12.05.2014 Views

Automating Manufacturing Systems - Process Control and ...

Automating Manufacturing Systems - Process Control and ...

Automating Manufacturing Systems - Process Control and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

plc numbers - 13.7<br />

Type<br />

unsigned<br />

signed<br />

2s compliment<br />

Description<br />

binary numbers can only have positive values.<br />

the most significant bit (MSB) of the binary number<br />

is used to indicate positive/negative.<br />

negative numbers are represented by complimenting<br />

the binary number <strong>and</strong> then adding 1.<br />

Range for Byte<br />

0 to 255<br />

-127 to 127<br />

-128 to 127<br />

Figure 13.9<br />

Binary (Integer) Number Types<br />

Examples of signed binary numbers are shown in Figure 13.10. These numbers use<br />

the most significant bit to indicate when a number is negative.<br />

decimal<br />

binary byte<br />

2<br />

1<br />

0<br />

-0<br />

-1<br />

00000010<br />

00000001<br />

00000000<br />

10000000<br />

10000001<br />

-2 10000010<br />

Note: there are two zeros<br />

Figure 13.10<br />

Signed Binary Numbers<br />

An example of 2s compliment numbers are shown in Figure 13.11. Basically, if the<br />

number is positive, it will be a regular binary number. If the number is to be negative, we<br />

start the positive number, compliment it (reverse all the bits), then add 1. Basically when<br />

these numbers are negative, then the most significant bit is set. To convert from a negative<br />

2s compliment number, subtract 1, <strong>and</strong> then invert the number.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!