4.4 Codes
For safe und efficient data communication the letters of the alphabet and the decimal numbers
must be converted into a code that a machine can understand.
4.4.1 BCD Code
Binary-coded decimal (BCD) is an encoding for decimal numbers in which each digit (0 to 9) is
represented by a 4-bit binary number (0000 to 1001, see table below). Thus one byte (8 bits)
can store two decimal numbers.
To convert decimal numbers with more than one digit the BCD expressions of the individual
digits are linked together. A four digit number in BCD code occupies one word (16 Bit) and can
cover the range from 0000 to 9999.
Example
In the MELSEC System Q the BCD code is not used for internal operations.However, in indus
-
trial applications BCD is frequently used to input values or to display numbers on a LED dis
-
play. For those cases several instructions for converting to and from BCD code are available.
MELSEC System Q Beginners Manual 4 – 5
An Introduction to Programming Codes
Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
1010 0101 00 1 01
1
10
2
537
BCD
Decimal