Справочник Пользователя для Mitsubishi Electronics FX

Скачать
Страница из 382
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 length 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 algebra are used to determine the largest 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 using data register s as the destination device D please remember that 16 bit
operation will occupy 5 consecutive, data registers but 32 bit operation will occupy 10 data
registers in pairs forming 5 double words.
d) When multiple bit devices are used to store the result (regardless of 16 or 32 bit operation),
only the specified size of group is written to for 5 consecutive occurrences, i.e. K1Y0 would
occupy 20 bit devices from Y0 (K1 = 4 bit devices and there will be 5 groups for the 5
results). As the maximum data stack is 256 (0 to 255) entries long, the optimum group 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 single 
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 largest value found in the data stack 
(last occurrence is returned if there are multiple occurrences of the same value)
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
X72
SER D 50 K 20
[ S1 ]
[ D ]
D 35 K100
n
[ S2 ]