Siemens SIMATIC S5-95F Manual page 178

Table of Contents

Advertisement

S5-95F
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" 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.
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
EWA 4NEB 812 6210-02
L KF +499
LD C 1
Introduction to STEP 5
Correct method:
If the "L C1" statement is en-
tered, the formats are identi-
cal.
High byte
Low byte
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
L C 1
is
H
7-33

Advertisement

Table of Contents
loading

Table of Contents