beautypg.com

Bcd numbers – Rockwell Automation 1747-PT1, D1747NP002 Hand-Held Terminal User Manual

Page 451

background image

Appendix B
Number Systems, Hex Mask

B–3

Another example:

16–bit pattern = 1111 1000 0010 0011

2

=

( 2

14

+ 2

13

+ 2

12

+ 2

11

+ 2

5

+ 2

1

+ 2

0 )

– 2

15

= ( 16384

+

8192

+

4096

+

2048

+

32

+

2

+

1 )

32768

=

30755

32768

= –2013

An easier way to calculate a negative value is to locate the last “1” in the
string of 1s beginning at the left, then subtract its value from the total value
of positions to the right of that position.

For example:

16–bit pattern = 1111 1111 0001 1010

2

=

( 2

4

+ 2

3

+ 2

1 )

– 2

8

= ( 16

+

8

+

2 )

256

= –230

Binary Coded Decimal numbers use a 4–bit binary code to represent decimal
values ranging from 0 to 9 as shown below:

BCD

Value

0
1
2
3
4
5
6
7
8
9

Binary

Value

0000
0001
0010
0011
0100
0101
0110

0111

1000
1001

Thumbwheels and LED displays are two types of I/O devices that use BCD
numbers.

The position values of BCD numbers are powers of 2, as in binary, beginning
with 2

0

at the right:

2

3

2

2

2

1

2

0

8

4

2

1

Position Decimal Value

BCD Numbers