Binary, Binary coded decimal – Rockwell Automation 1770, D17706.5.16 Ref Mnl DF1 Protocol Command User Manual

Page 199

Advertising
background image

11–3

Data Encoding

Publication 1770Ć6.5.16 - October 1996

Binary

The binary numbering system is a simple method for computer and
PLC applications because it is the most natural way to represent data
bits. However, since the binary system uses the digits 0 and 1, it is
cumbersome to show values in binary format.

Each digit in a binary number has a place value expressed as a power
of 2. You calculate the decimal equivalent of a binary number by
multiplying each binary digit by its corresponding place value and
then adding the results of the multiplications.

Binary Representation, Number 239

Bit:

1

2

1

1

0

1

1

1

1

7

6

5

4

3

1

0

1 x 2

7

= 128

1 x 2

6

= 64

1 x 2

5

= 32

1 x 2

4 =

0

1 x 2

3

=

8

1 x 2

2

=

4

1 x 2

1

2

1 x 2

0

1

239

10

Binary Coded Decimal

PLC data is often represented in binary coded decimal (BCD) form.
In this system, each group of four bits in a PLC word represents one
decimal number between 0 and 9. In this way, each 16-bit word can
represent a BCD value between 0 and 9,999. Many PLCs use only a
three-digit BCD (12 bits). The upper digit (3 bits) is used for
information such as timer or counter status.

BCD Representation of Decimal 239

0

0

1

1

third digit

0

1

1

0

second digit

0

1

0

0

first digit

0 x 2

3

= 0

0 x 2

2

= 0

1 x 2

1

= 2

0 x 2

0

= 0

0 x 2

3

= 0

0 x 2

2

= 0

1 x 2

1

= 2

1 x 2

0

= 1

1 x 2

3

= 8

0 x 2

2

= 0

0 x 2

1

= 0

1 x 2

0

= 1

= 2

10

= 3

10

= 9

10

= 239

10

Advertising