beautypg.com

D - two’s complement binary numbers, Positive decimal values, Appendix d – Rockwell Automation 1769-IF4XOF2 Compact 8-Bit Low Resolution Analog I/O Combination Module User Manual

Page 91: Two’s complement binary numbers, Appendix

background image

1

Publication 1769-UM008A-EN-P - November 2001

Appendix

D

Two’s Complement Binary Numbers

The processor memory stores 16-bit binary numbers. Two’s
complement binary is used when performing mathematical
calculations internal to the processor. Analog input values from the
analog modules are returned to the processor in 16-bit two’s
complement binary format. For positive numbers, the binary notation
and two’s complement binary notation are identical.

As indicated in the figure on the next page, each position in the

number has a decimal value, beginning at the right with 2

0

and ending

at the left with 2

15

. Each position can be 0 or 1 in the processor

memory. A 0 indicates a value of 0; a 1 indicates the decimal value of
the position. The equivalent decimal value of the binary number is the
sum of the position values.

Positive Decimal Values

The far left position is always 0 for positive values. As indicated in the
figure below, this limits the maximum positive decimal value to 32640
(all positions are 1 except the far left position).

0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0

0 x 2

15

= 0 This position is always 0 for positive numbers.

1 x 2

14

= 16384

1 x 2

13

= 8192

1 x 2

12

= 4096

1 x 2

11

= 2048

1 x 2

10

= 1024

1 x 2

9

= 512

1 x 2

8

= 256

1 x 2

7

= 128

0 x 2

6

= 64

0 x 2

5

= 0

0 x 2

4

= 0

0 x 2

3

= 0

0 x 2

2

= 0

0 x 2

1

= 0

0 x 2

0

= 0

16384

8192

4096

2048

1024

512

256
128
64
0

0

0

0

0

0

________

32640