![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/3/8d/38d56254-54fe-46e3-85ae-d3f5260e1091/38d56254-54fe-46e3-85ae-d3f5260e1091-bgc3.png)
FX Series Programmable Controlers Applied Instructions 5
5-69
5.7.2 SER (FNC 61)
Operation:
The SER instruction searches a defined data stack
from head address S1, with a stack len
th n. The
data searched for is specified in parameter S2 and
the results of the search are stored at destination
device D for 5 consecutive devices.
Points to note:
a) Normal rules of al
ebra are used to determine the lar
est and smallest values, i.e. -30 is
smaller than 6 etc.
b) If no occurrence of the searched data can be found then destination devices D, D+1 and
D+2will equal 0 (zero).
c) When usin
data re
ister s as the destination device D please remember that 16 bit
operation will occup
5 consecutive, data re
isters but 32 bit operation will occup
10 data
re
isters in pairs formin
5 double words.
d) When multiple bit devices are used to store the result (re
ardless of 16 or 32 bit operation),
onl
the specified size of
roup is written to for 5 consecutive occurrences, i.e. K1Y0 would
occup
20 bit devices from Y0 (K1 = 4 bit devices and there will be 5
roups for the 5
results). As the maximum data stack is 256 (0 to 255) entries lon
, the optimum
roup of bit
devices required is K2, i.e. 8 bit devices.
Mnemonic Function
Operands
Program steps
S1 S2 D n
SER
FNC 61
(Search a
Data Stack)
Generates a list
of statistics
about a sin
le
data value
located/found in
a data stack
KnX, KnY,
KnM, KnS,
T, C, D
KnX, KnY,
KnM, KnS,
T, C, D
V, Z
K, H
KnY, KnM,
KnS
T, C, D
Note: 5
consecutive
devices
are used
K,H, D
Note:
n= 1~256 for 16
bit operation
n= 1~128 for
32 bit
operation
SER, SERP:
9 steps
DSER,
DSERP:
17 steps
Destination
device
Device description
D Total number of occurrences of the searched value S2 (0 if no occurrences are found)
D+1
The position (within the searched data stack) of the first occurrence of the searched value S
2
D+2
The position (within the searched data stack) of the last occurrence of the searched value S
2
D+3
The position (within the searched data stack) of the smallest value found in the data
stack (last occurrence is returned if there are multiple occurrences of the same value)
D+4
The position (within the searched data stack) of the lar
est value found in the data stack
(last occurrence is returned if there are multiple occurrences of the same value)
X72
SER D 50 K 20
[ S1 ] [ D ]
D 35
K100
n[ S2 ]