2-317
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
High-speed Counter/Pulse
Output Instructions
2
CTBL
Flags
Function
CTBL(882) registers a comparison table and starts comparison for the port specified in P and the
method specified in C. Once a comparison table is registered, it is valid until a different table is regis-
tered or until the CPU Unit is switched to PROGRAM mode.
Each time CTBL(882) is executed, comparison is started under the specified conditions. When using
CTBL(882) to start comparison, it is normally sufficient to use the differentiated version (@CTBL(882))
of the instruction or an execution condition that is turned ON only for one scan.
Note If an interrupt task that has not been registered is specified, a fatal program error will occur the first time an
interrupt is generated.
Registering a Comparison Table (C = 0002 or 0003 hex)
If C is set to 0002 or 0003 hex, a comparison table will be registered, but comparison will not be started.
Comparison is started with INI(880).
Registering a Comparison Table and Starting Comparison (C = 0000 or 0001 hex)
If C is set to 0000 or 0001 hex, a comparison table will be registered, and comparison will be started.
Stopping Comparison
Comparison is stopped with INI(880). It makes no difference what instruction was used to start compar-
ison.
Target Value Comparison
The corresponding interrupt task is called and executed when the PV matches a target value.
The same interrupt task number can be specified for more than one target value.
The direction can be set to specify whether the target value is valid when the PV is being incre-
mented or decremented. If bit 15 in the word used to specify the interrupt task number for the range is
OFF, the PV will be compared to the target value only when the PV is being incremented, and if bit 00
is ON, only when the PV is being decremented.
The comparison table can contain up to 6 target values, and the number of target values is specified
in TB (i.e., the length of the table depends on the number of target values that is specified).
Comparisons are performed for all target values registered in the table.
Note 1 An error will occur if the same target value with the same comparison direction is registered more than
once in the same table.
2If the high-speed counter is set for incremental pulse mode, an error will occur if decrementing is set in the
table as the direction for comparison.
3If the count direction changes while the PV equals a target value that was reached in the direction opposite
to that set as the comparison direction, the comparison condition for that target value will not be met. Do
not set target values at peak and bottom values of the count value.
Name Label Operation
Error Flag P_ER ON if the specified range for P or C is exceeded.
ON if the number of target values specified for target value comparison is set to 0.
ON if the number of target values specified for target value comparison exceeds 6.
ON if the upper value is less than the lower value for any range.
ON if the set values for all ranges are disabled during a range comparison.
ON if the high-speed counter is set for incremental pulse mode and decrementing is set in the table as the direction
for comparison.
ON if the same target value is specified more than once in the same comparison direction for target comparison
when the high-speed counter is set to incremental pulse mode and linear mode.
ON if an instruction is executed when the high-speed counter is set to Ring Mode and the specified value exceeds
the maximum ring value.
ON if specified for a port not set for a high-speed counter.
ON if executed for a different comparison method while comparison is already in progress.
OFF in all other cases.