3. Instructions
Example for Range Comparison for 1 to 32 Ranges (CJ2M Only)
When CIO 0.00 turns ON in the following programming example, CTBL(882) registers a range comparison
table using upper and lower limits for high-speed counter 0 and starts comparison. When the PV of the
high-speed counter leaves the upper/lower limits for range 1, interrupt task 0 is executed. When the PV
leaves the upper/lower limits for range 2, interrupt task 5 is executed.
High-speed counter PV
Upper limit value 2: 2,100 decimal
Lower limit value 2: 1900 decimal
Upper limit value 1: 1,050 decimal
Lower limit value 1: 950 decimal
Interrupt task that is started
750
0.00
No.0
No.5
No.5
@CTBL
#0000
High-speed counter 0
Registers a range comparison table with 1
#0004
to 32 ranges, and starts comparison.
D0
First range comparison table word
TB
TB 1 D1
TB 2 D2
TB 3 D3
TB 4 D4
TB 5 D5
TB 6 D6
TB 7 D7
TB 8 D8
TB 9 D9
TB 10 D10
Note: Bit 15 = 1, so the interrupt task is executed
when the PV leaves the range.
Operating time
No.0
No.0
CS/CJ/NSJ Series Instructions Reference Manual (W474)
#0002
D0
Number of ranges: 2
#03B6
Lower limit value 1
03B6 hex (950 decimal)
#0000
#041A
Upper limit value 1
041A hex (1,050 decimal)
#0000
Range 1 interrupt task No.: 0
#8000
(leaving range)
#076C
Lower limit value 2
#0000
076C hex (1,900 decimal)
#0834
Upper limit value 2
0834 hex (2,100 decimal)
#0000
Range 2 interrupt task No.: 5
#8005
(leaving range)
Need help?
Do you have a question about the CJ - INSTRUCTIONS and is the answer not in the manual?