S5-95F
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
H
is
then stored in the accumulator.
The current count must also be loaded into the accumulator.
L KF +499
L KF +499
0 0 0 0 0 0 0 1
1 1 1 1 0 0 1 1
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
0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1
LD C 1
L C 1
Incorrect method:
If you use the ”LD C1” state-
ment for this purpose, the cur-
rent count will be loaded in
BCD. The ”!=F” comparison
operation results in a not-equal-
to condition since the compari-
son involves different formats.
Correct method:
If the ”L C1” statement is en-
tered, the formats are identi-
cal.
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
High byte
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a
Low byte
EWA 4NEB 812 6210-02
7-33