DVP-ES2/EX2/EC5/SS2/SA2/SX2/SE&TP Operation Manual - Programming
-138
Program Example 1:
Set/reset M0 by applying software comparator
M1000
DCNT
C235 K100
DHSCS
C235
K100
M0
 When value in C235 varies from 99 to100, DHSCS instruction sets M0 ON. (M1235 = OFF,
C235 counts up)
 When value in C235 varies from 101 to100, DHSCR instruction resets M0. (M1235 = ON,
C235 counts down)
 Timing diagram for the comparison:
Counting
No.
Time
Count up Count down
M0
101
100
99
98
101
100
99
98
12
Program Example 2:
Set/reset M0 by applying hardware comparator
M1000
DCNT
C251 K1
00
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
1 2