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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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.<br />

www.PA<strong>Control</strong>.com

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

Saved successfully!

Ooh no, something went wrong!