FP0
8.2
Handling BCD Data
8.2.1
BCD Data
BCD is an acronym for binary−coded decimal, and means that each digit of a decimal
number is expressed as a binary number.
Example:
Expressing a decimal number in BCD:
Decimal number
BCD
(Binary−coded
decimal)
8.2.2
Handling BCD Data in the PLC
When inputting data from a digital switch to the PLC or outputting data to a 7−segment
display (with a decoder), the data must be in BCD form. In this case, use a data
conversion instruction as shown in the examples at below.
BCD arithmetic instructions "F40 (B+) to F58 (DB−1)" also exist which allow direct
operation on BCD data, however, it is normally most convenient to use BIN operation
instructions "F20 (+) to F38(D−1)" as operation in the PLC takes place in binary.
Input From a Digital Switch
Use the BCD−to−BIN conversion instruction "F81 (BIN)".
Digital
1
9
switch
BCD
PLC
↓
BIN
0110
9
2
Data inputted into
the PLC (BCD data)
(Conversion
using
Data which can be
F81 (BIN)
processed in the PLC
instruction)
(BIN data)
Precautions During Programming
Each digit is converted
to a binary number.
0100
0101
1
0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0
0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 0
Converted to 1992 in decimal data.
8.2
Handling BCD Data
9
9
2
8 − 5