Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 14 of 16

SLC 500 4-Channel Analog I/O Modules User Manual: B - Two’s Complement Binary Numbers

Pages 97 to 100 of 113, from SLC 500 4-Channel Analog I/O Modules User Manual

The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 1746-NI4

Page 97

Appendix

B

Two’s Complement Binary Numbers

The SLC 500 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 20 and ending at the left with 215. 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 on the next page, this limits the maximum positive decimal value to 32767 (all positions are 1 except the far left position). For example: 0000 1001 0000 1110 = 211+28+23+22+21 = 2048+256+8+4+2 = 2318 0010 0011 0010 1000 = 213+29+28+25+23 = 8192+512+256+32+8 = 9000

1

Publication 1746-UM005B-EN-P - June 2004

Page 98

B-2

Two’s Complement Binary Numbers

1x2 14 = 16384

16384

1x2 13 = 8192

8192 4096

1x2 12 = 4096 1x2 11 = 2048 1x2 10 = 1024

2048 1024

1x2 9 = 512

512

1x2 8 = 256

256 128

1x2 7 = 128 1x2 6 = 64

64

1x2 5 = 32

32

1x2 4 = 16 1x2 3 = 8 1x2 2 = 4 1x2 1 = 2 1x2 0 = 1 0 1

1

0x2 15 = 0

1

1

1

1

1

1

1

1

1

1

1

1

1

16 8 4 2 1 32767

This position is always zero for positive numbers

Negative Decimal Values In two’s complement notation, the far left position is always 1 for negative values. The equivalent decimal value of the binary number is obtained by subtracting the value of the far left position, 32768, from the sum of the values of the other positions. In the figure on the next page (all positions are 1), the value is 32767 - 32768 = -1. For example: 1111 1000 0010 0011 = (214+213+212+211+25+21+20) - 215 = (16384+8192+4096+2048+32+2+1) - 32768 = 30755 - 32768 = -2013.

Publication 1746-UM005B-EN-P - June 2004

Page 99

Two’s Complement Binary Numbers

1x2 14 = 16384

16384

1x2 13 = 8192

8192 4096

1x2 12 = 4096 1x2 11 = 2048 1x2 10 = 1024

2048 1024

1x2 9 = 512

512

1x2 8 = 256

256 128

1x2 7 = 128 1x2 6 = 64

64

1x2 5 = 32

32

1x2 4 = 16 1x2 3 = 8 1x2 2 = 4 1x2 1 = 2 1x2 0 = 1 0

1

1

1x2 15 = 1

1

1

1

1

B-3

1

1

1

1

1

1

1

1

1

16 8 4 2 1 32767

This position is always 1 for negative numbers

Publication 1746-UM005B-EN-P - June 2004

Page 100

B-4

Two’s Complement Binary Numbers

Publication 1746-UM005B-EN-P - June 2004