Chapter 03 - Number Systems and Codes
Chapter 03 - Number Systems and Codes
Logic Controllers
Third Edition
Frank D. Petruzella
McGraw-Hill
Chapter 3
Number Systems
And Codes
Decimal System
Ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Base: 10
Two digits: 0, 1
Base: 2
Another Method
In the binary number
when you see a 1, multiply
128 64 32 16 8 4 2 1
that 1 times the value that
is directly over it. Where
you see a 0 in the box,
just ignore it.
AEach
One
wordbit
16-bit
represents
will output
be file
thein
created word
“on” is
orreserved
“off”
the table state
only ifforofeach
the oneslot
processor
TheMade
column
up ofonsingle
the right
bitslists
grouped
the output
into 16-bit
module words
address.
output
in the
finds anchassis.
point.
output These points
module are numbered
residing 0 through15.
in a particular slot.
1. The binary number system has a base of 8.
(True/False)
Sign
Sign Decimal
Decimal
Bit Magnitude
Bit MagnitudeBits
Bits Value
Value
Negative Numbers
Eight digits: 0, 1, 2, 3, 4, 5, 6, 7
Base: 8
I:2/16 O:3/22
Octal System
The digits range from 0 to 7; therefore, numbers
8 and 9 are not allowed!
Converting Octal To Decimal
As in all other numbering system, each digit in an
octal number has a weighted decimal value
according to its position.
Converting Octal-to-Binary
Octal is used to handle large binary numbers. One octal
digit is used to express three binary digits.
Hexadecimal System
The hexadecimal (hex) numbering system can
be summarized as follows:
Sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Base: 16
The thumb-wheel
switch outputs the
equivalent 4-bits
of BCD data
Typical PLC Number Conversion Instruction
The keystrokes
on the keyboard
of a computer are
converted directly
into ASCII for
processing by the
computer.
Parity Bit
Some PLC communications systems use a parity bit
to check the accuracy of data transmission. For example,
when data are transferred between PLCs, one of the
binary bits may accidentally change states.
Parity is a system where each character transmitted
contains one additional bit known as a parity bit. The bit
may be binary 0 or binary 1, depending on the number
of 1’s and 0’s in the character itself.
Even parity
means that the
total number of
binary 1 bits in
the character,
including the
parity bit, is even.
Binary Addition
1’s complement
Binary Multiplication
0x0=0
0x1=0
1x0=0
1x1=1
Binary Multiplication
101
x 110
000
101
101
11110
Binary Division
A = B (A equals B)