Precautions During ProgrammingFP0
8 − 5
8.2 Handling BCD Data
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)
0110 0100 0101
Each digit is converted
to a binary number.
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)”.
1 9 9 2
PLC
BCD
↓
BIN
(Conversion
using
F81 (BIN)
instruction)
Digital
switch
0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0
Data inputted into
the PLC (BCD data)
1 9 9 2
0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 0
Data which can be
processed in the PLC
(BIN data)
Converted to 1992 in decimal data.