7-15
Section
Timer and Counter Instructions
398
The following diagram shows the structure of a target value comparison table.
Target values must be unique; an error will occur if a target value appears in the
table more than once.
TB
Number of target values (0001 to 0016, BCD)
TB+1
Target value #1, lower 4 digits (BCD)
TB+2
Target value #1, upper 4 digits (BCD)
TB+3
Subroutine number for #1 (See note.)
One target
value setting
Note
The subroutine number can be F000 to F049 to activate the subroutine when
decrementing and can be 0000 to 0049 to activate the subroutine when incre-
menting. An error will occur if the high-speed counter is set to increment mode
but a decrementing subroutine number (F000 to F049) is specified.
Range Comparison
A range comparison table contains 8 ranges which are defined by an 8-digit low-
er limit and an 8-digit upper limit, as well as their corresponding subroutine num-
bers. The comparison is performed once each cycle at the end of program exe-
cution and can be performed during program execution with INI(61).
When the PV falls within a given range the corresponding subroutine is called
and executed. (When interrupt processing is not required, an undefined subrou-
tine number may be entered.) Ranges can overlap, so the PV can fall within
more than one range; in the PV is within two or more ranges, the subroutine for
the first of the ranges will be executed.
The following diagram shows the structure of a range comparison table. Always
set 8 ranges. If fewer than 8 ranges are needed, set the remaining subroutine
numbers to FFFF.
TB
Lower limit #1, lower 4 digits (BCD)
TB+1
Lower limit #1, upper 4 digits (BCD)
TB+2
Upper limit #1, lower 4 digits (BCD)
TB+3
Upper limit #1, upper 4 digits (BCD)
TB+4
Subroutine number (See note 2.)
TB+35
Lower limit #8, lower 4 digits (BCD)
TB+36
Lower limit #8, upper 4 digits (BCD)
TB+37
Upper limit #8, lower 4 digits (BCD)
TB+38
Upper limit #8, upper 4 digits (BCD)
TB+39
Subroutine number (See note 2.)
First range setting
Eighth range setting
Note
1. Each range’s lower limit must be less than its upper limit. An error will occur if
the lower limit is greater than the upper limit.
2. The subroutine number can be 0000 to 0049 and the subroutine will be exe-
cuted as long as the counter’s PV is within the specified range. A value of
FFFF indicates that no subroutine is to be executed.
3. Since the comparison is usually performed just once each cycle, be sure to
take the cycle time into account when the upper and lower limits represent
time values.
4. A subroutine number can be used more than once in the table.
Flags
ER:
The comparison table exceeds the data area boundary, or there is an
error in the comparison table settings.
Indirectly addressed DM word is non-existent. (Content of *DM word is
not BCD, or the DM area boundary has been exceeded.)