Introduction to STEP 5
You can use the "LD" operation to load a binary number as a BCD number for timer and counter
values.
Example: Comparing a count in counter 1 with decimal number 499.
The comparison value must be stored in the accumulator by means of the load
operation. In order not to have to convert the value 499 into other numerical systems
(binary or hexadecimal) for input, use the "L KF +499" statement. The number 1F3
then stored in the accumulator.
The current count must also be loaded into the accumulator.
Incorrect method:
If you use the "LD C1" statement
for this purpose, the current count
will be loaded in BCD. The "!=F"
comparison operation results in a
not-equal-to condition since the
comparison involves different
formats.
0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1
0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 1
7-20
Correct method:
If the "L C1" statement is en-
tered, the formats are identical.
0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1
L KF+499
0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1
LC C 1
High byte
Low byte
L KF+499
L C 1
EWA 4NEB 812 6115-02b
S5-90U/S5-95U
is
H