DVP-ES2/EX2/SS2/SA2/SX2/SE Operation Manual - Programming
3-128
M1000
DCNT
C251 K100
DHSCS
C251
K100
M0
¾ When C251 counts up and the value in C251 varies from 100 to101, DHSCS instruction
sets M0 ON.
¾ When C251 counts down and the value in C251 varies from 100 to 99, DHSCR
instruction resets M0.
¾ Timing diagram for the comparison:
Counting
No.
Time
Count up
Count down
M0
101
100
99
98
101
100
99
98
12
Program Example 3:
Executes interrupt subroutine by applying software comparator.
M1000
DCNT
C235 K100
DHSCS
C235
K100
I010
EI
FEND
I010
M1000
OUT
Y10
IRET
END
¾ When value in C235 varies from 99 to100, interrupt subroutine triggered by I010 executes
immediately to set Y0 ON.
Points to note:
¾ If operand D is specified as S, M or Y0~Y3 for the above high speed comparison, the compare
result will immediately output to the external points Y0~Y3 (Y0~Y5 for SS2/SX2). However, if
D is specified as Y4~Y337, external outputs will be updated till the end of program (delay for
one scan cycle).