Mitsubishi Electronics FX2C Home Theater Server User Manual


 
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
g
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
g
ebra are used to determine the lar
g
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
g
data re
g
ister s as the destination device D please remember that 16 bit
operation will occup
y
5 consecutive, data re
g
isters but 32 bit operation will occup
y
10 data
re
g
isters in pairs formin
g
5 double words.
d) When multiple bit devices are used to store the result (re
g
ardless of 16 or 32 bit operation),
onl
y
the specified size of
g
roup is written to for 5 consecutive occurrences, i.e. K1Y0 would
occup
y
20 bit devices from Y0 (K1 = 4 bit devices and there will be 5
g
roups for the 5
results). As the maximum data stack is 256 (0 to 255) entries lon
g
, the optimum
g
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
g
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
g
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 ]