Advanced Function Instruction
7-98
FUN112
D
P
BKCMP
BLOCK COMPARE
(
DRUM
)
FUN112
D
P
BKCMP
Rs : Data for compare, can be a constant or a
register
Ts : Starting register block storing upper and
lower limit
L : Number of pairs of upper and lower limits
D : Starting relay storing results of
comparison
Y
M
S
WX
WY
WM
WS
TMR CTR
HR
IR
OR
SR ROR
DR
K
Range
Ope-
rand
Y0
∣
Y255
M0
∣
M999
S0
∣
S999
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
16/32-bit
+/-
number
Rs
○
○
○
○
○
○
○
○
○
○
○
○
○
Ts
○
○
○
○
○
○
○
○
○
○
○
○
L
○
○
*
○
1~256
D
○
○
○
z
When comparison control "EN" = 1 or "EN
↑
" (
P
instruction) has a transition from 0 to 1, comparisons will be
perform one by one between the contents of Rs and the upper and lower limits form by L pairs of 16 or 32-bit
(
D
modifier) registers starting from the Ts register (starting from T0 each adjoining 2 register units form a pair
of upper and lower limits). If the value of Rs falls within the range of the pair, then the bit within the comparison
results relay D which corresponds to that pair will be set to 1. Otherwise it will be set as 0 until comparison of
all the L pairs of upper and lower limits is completed.
z
When M1975=0, if there is any pair where the upper limit value is less than the lower limit value, then the limit
error flag "ERR" will be set to 1, and the comparison output for that pair will be 0.
z
When M1975=1, there is no restriction on the relation of upper limit and lower limit, this can apply for 360
°
rotary
electronic drum switch application.
Upper limit
Lower limit
Result
Compare
Compared
value
0 T
S1
T
S0
D
0
1 T
S3
T
S2
D
1
L
−
1 T
S2L
−
1
T
S2L
−
2
Rs
D
L
−
1
z
Actually this instruction is a drum switch, which can be used in interrupt program and when incorporate with
immediate I/O instruction (IMDIO) can achieve an accurate electronic drum.
X0
EN R
S
:
Ts :
Y 5
112.BKCMP
D :
C 0
L :
4
ERR
R 10
CLR
C0
CK
X1
C 0
PV :
360
z
In this program, C0 represents the rotation angle (Rs) of
a drum shaft. The block compare instruction performs a
comparison between Rs and the 4 pairs (L = 4) of upper
and lower limits, R10,R11, R12,R13, R14,R15 and
R16,R17. The comparison results can be obtained from
the four drum output points Y5 to Y8.
z
The input point X1 is a rotation angle detector mounted
on the drum shaft. With each one degree rotation of the
drum shaft angle, X1 produces a pulse. When the drum
shaft rotates a full cycle, X1 produces 360 pulses.
Содержание FBs-CBE
Страница 78: ...MEMO ...
Страница 111: ...4 6 X0 X1 Node A Y0 Y1 Node B differential down Incerse differential up t Scan time Inverse t t ...
Страница 141: ...Basic Function Instruction 6 16 FUN 2 SKP SKIP START FUN 2 SKP Y2 Y1 Y0 T201 10S X0 X1 X2 0 10 0 ...
Страница 305: ...MEMO ...
Страница 348: ...MEMO ...