32 Applied Instructions (High Speed Processing 2)
32.1 DHSCT / High Speed Counter Compare With Data Table
742
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
Program example
In the program example shown below, the current value of C235 (counting X000) is compared with the
comparison data table set in R0 and later, and a specified pattern is output to Y010 to Y013.
Operation example
Comparison
point
number
Comparison data SET/RESET pattern
Table counter (D8138)
Device
Comparison
value
Device
Operation
output set value
0 R1, R0 K100 R2 H0007 0↓
1 R4, R3 K150 R5 H0004 1↓
2 R7, R6 K200 R8 H0003 2↓
3 R10, R9 K250 R11 H0006 3↓
4 R13, R12 K300 R14 H0008 4 ↓ (repeated from "0")
[ST]
M8235:=NOT M8000;
OUT_C(M8000,CC235,K0);
MOVP(M8000,H0008,K1Y10);
DHSCR(M8000,K400,CN235,CC235);
DHSCT(M8000,R0,K5,CN235,K4,Y010);
M8000
C235 is used as an up counter.
Initial output
M8235
M8000
Ring length: 0 to 400
OUT_C
EN ENO
CCoil
CValue
CC235
K0
MOVP
EN
s
ENO
d
K1Y10
DHSCT
EN ENO
s1
m
s2
n
d
DHSCR
EN
s1
s2
ENO
d
K400
CN235
CC235
R0
K5
CN235
K4
Y010
[Structured ladder/FBD]
H0008
400
300
200
100
0
1
2
3
4
01
2
3
0
ON
OFF
ON
Time
Y010
Y011
Y012
8136
Table
counter
ON
ON
OFF
OFF
OFF
Y013
250
150
Current value
of C235