191
6-4. Hints for Programming High-level Instructions
6-4. Hints for Programming High-level
Instructions
1. How to Use BCD Data
1) BCD Data
BCD stands for Binary Coded Decimal and is one of the codes represented in binary. It was introduced as convenient
way to handle numbers which had to be input to digital machines, and to interpret numbers output from the machine.
BCD converts decimal values, which are readily handled by man to binary values, which are readily handled by the
equipment. The BCD representation of a decimal number is obtained by simply converting each decimal digit to four
binary digits (bits). BCD data are often used when data are input from digital switches or when data are output to 7-
segment indicators.
Example: When K1993 (decimal) is expressed in BCD.
Notes:
Table of Decimal and BCD
0000 0000 0000 0000
0000 0000 0000 0001
0000 0000 0000 0010
0000 0000 0000 0011
0000 0000 0000 0100
0000 0000 0000 0101
0000 0000 0000 0110
0000 0000 0000 0111
•
•
•
0000 0000 1001 1001
•
•
•
1001 1001 1001 1001
0
1
2
3
4
5
6
7
•
•
•
99
•
•
•
9999
Decimal
BCD
(Binary Coded Decimal)
• In decimal, we have the numbers 0 through 9, whereas in BCD, each of these numbers is represented by
a 4-bit binary number and cannot have numbers over 1001 [K9 (decimal)].
• Compared to standard binary, BCD data expresses a smaller range of numbers when the same number
of bits are used, as shown in the example.
Example:
BCD code
0 0 0 1
1 0 0 1
1 0 0 1
0 0 1 1
Decimal
1
9
9
3
K
Standard binary data
Single word
K-32,768 to K32,767
BCD data
K0 to K9,999
Double word
K-2,147,483,648 to K2,147,483,647
K0 to K99,999,999
Содержание FP1
Страница 1: ...PROGRAMMABLE CONTROLLER FP1 is a global brand name of Matsushita Electric Works Hardware ...
Страница 28: ...20 ...
Страница 98: ...90 ...
Страница 150: ...142 ...
Страница 208: ...200 ...
Страница 226: ...218 ...
Страница 280: ...272 ...