
Chapter 5. Application instructions
5-18
Comparing circuit (example of CMP instruction)
1. Operation
There is a up- down counter C000. P030 is up-count input, and P031 is down-count input. If the current
value of timer is 0 ~ 9, P060 turns on. If the current value is 10 ~ 19, P061 will be on. P062 will turn on
when 20 ~ 29, P063 will turn on when 30 ~ 39, and P064 will be on when the current value is 40 or
larger.
2. Program
U CTUD C000
D
R <S> 00050
P030
P031
P032
F010
CMP C000 00010
F120
(
M0000
)
F010
CMP C000 00020
F120
(
M0001
)
F010
CMP C000 00030
F120
(
M0002
)
F010
CMP C000 00040
F120
(
M0003
)
M0000
(
P060
)
M0000
(
P061
)
M0001
M0001
(
P062
)
M0002
M0002
(
P063
)
M0003
M0003
(
P064
)
END
0000
0006
0014
0012
0020
0028
0022
0030
0038
0036
0040
0046
0043
0051
0049
0 ~ 10
Less than 40
10 ~ 19
30 ~ 39
20 ~ 29
40 or more
Less than 30
Less than 20
Less than 10
C000 : the current value of
counter