Chapter 3.1 - Fundamentals of Logic
Chapter 3.1 - Fundamentals of Logic
Fundamentals of Logic
Section 3.1
Number Systems
Section 3.1.1
Decimal System
The radix or base of a number system determines
the total number of different symbols or digits
used by that system.
The decimal system has a base of 10 with
the digits 0 through 9 being used.
The value of a
decimal number
depends on the
digits that make
up the number
and the place
value of each
digit.
Section 3.1.2
Binary System
The binary system has a base of 2 and the only
allowable digits are 0 and 1.
Binary (base 2)
Octal (base 8)
Negative Numbers
Binary systems can Signed Binary Numbers
not use positive and
negative symbols to
represent the polarity
of a number.
In signed binary
numbers, the left-most
bit is the equivalent of a
+/- sign. "0" indicates
that the number is
positive, "1" indicates
negative.
Another method of expressing a negative number
is by using the complement of a binary number.
To complement a binary number, change all the
1s to 0s and all the 0s to 1s. This is known as the
1’s complement form of a binary number.
2’s complement
is the binary
number that
results when
1 is added to the
1’s complement.
Octal System
The octal
numbering
system is a
base 8 system Numbers
8 and 9
not allowed
Octal is a convenient means of handling
large binary numbers.
One octal digit can
be used to express
three binary digits.
Hexadecimal System
Copyright (c) 2017 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education
The hexadecimal (hex) system is a base 16 system.
Letters A to
F are used
to represent
decimal
numbers
10 to 15.
The hex numbering system is used in PLCs
because a word of data consists of 16 data bits.
Converting hexadecimal to decimal.
Selected digit of
decimal 8 outputs the
equivalent 4 bits of
BCD data – 1000BCD
Single Digit Thumbwheel Switch Simulation
Codes
Section 3.2.1
Gray Code
The Gray code is set up so that as we progress
from one number to the next, only one bit changes.
Each position does not
have a definite weight.
This can be quite
confusing for counting
circuits, but it is ideal
for encoder circuits.
Gray codes are used with position encoders
for accurate control of the motion of robots,
machine tools, and servomechanisms.
ASCII Code
Copyright (c) 2017 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education
ASCII stands for American Standard Code
for Information Interchange.
It is an
alphanumeric
code because it
includes letters as
well as numbers.
The keystrokes on the keyboard of a computer
are converted directly into ASCII for
processing by the computer.
Parity Bit
Some PLC communication systems use a binary
bit to check the accuracy of data transmission.
Binary Arithmetic
When adding with binary numbers, there are
only four conditions that can occur:
Binary addition
example
Binary addition example cont.
To subtract from larger binary numbers, subtract
column by column, borrowing from the adjacent
column when necessary. When borrowing from
the adjacent column, there are now two digits,
i.e., 0 borrow 1 gives 10.
Binary numbers can also be negative. The procedure
for this calculation is identical to that of decimal numbers
because the smaller value is subtracted from the larger
value and a negative sign is placed in front of the result.
There are other methods available for doing
subtraction: 1’s complement and 2’s complement.
Using the 1’s complement