222
Timer and Counter Instructions Section 5-15
The following diagram shows the structure of a target value comparison table
for use with absolute high-speed counters 1 and 2 (CQM1-CPU44-E/-EV1
only). Input the target values in ascending or descending order.
Note 1. The subroutine number can be 0000 to 0049 for CPM1/CPM1A PCs.
In CQM1 PCs, the subroutine number can be F000 to F255 (F000 to F127
for the CQM1-CPU11/21-E) to activate the subroutine when decrementing
and can be 0000 to 0255 (0000 to 0127 for the CQM1-CPU11/21-E) to ac-
tivate the subroutine when incrementing.
2. Allow an interval of at least 0.2 ms for interrupt processing when setting the
target value for high-speed counters 1 and 2.
Target Value Comparison Operation
The following diagram illustrates the operation of target value comparisons for
target values 1 through 5 set consecutively in the comparison table.
As illustrated above, the current count is compared with each target value in
the order that they are registered in the target value comparison table. When
the count is the same as the current target value, an interrupt is generated,
and comparison starts with the next target value. When all target values in the
comparison table have been matched and interrupts for them generated, the
target value is reset to the first target value in the table and the operation is
repeated.
Range Comparison A range comparison table contains 8 ranges which are defined by an 8-digit
lower limit and an 8-digit upper limit, as well as their corresponding subroutine
numbers. The corresponding subroutine is called and executed when the PV
falls within a given range. (When interrupt processing is not required, an
undefined subroutine number may be entered.)
Always set 8 ranges. If fewer than 8 ranges are needed, set the remaining
subroutine numbers to FFFF. If more than 8 ranges are needed, another com-
parison instruction such as BCMP(68) can be used to compare ranges with
the high-speed counter PVs in IR 230 through IR 235 (SR 248 and SR 249 in
CPM1/CPM1A PCs). Bear in mind that these words are refreshed just once
each cycle.
TB Number of target values (BCD)
TB+1 Target value #1 (BCD)
TB+2 Subroutine number (See note.)
One target value setting
Initial
value
Count
Interrupts
Target
1
Target
2
Target
4
Target
3
Target
5