You are on page 1of 23

Number Systems

There are four number systems most frequently


used by the PLC During Input / Output address
assignment and programming :
1. Binary
ASCII Code: Used to represent
2. Octal
alpha-numeric characters,
3. Decimal mathematical signs. E.g. Computer
key-board.
4. Hexadecimal
Number Systems

The following Statements apply


to any number system:
• Every number system has a base or radix.
• Every system can be used for counting.
• Every system can be used to represent
quantities or codes.
• Every system has unique set of symbols.
DECIMAL NUMBER SYSTEM
• The base of decimal number system is 10, The
symbols, or digits, used in this system are 0, 1, 2,
3, 4, 5, 6, 7, 8, and 9.

• The total number of symbols (10) is the same as


the base, with the largest-valued symbol being
one less than the base (9 is one less than 10).

• It is important to note that the


technique for representing a value
greater than the largest symbol is the
same for any number system.
Decimal Number Systems
Place Value

Weight Value
Decimal Number Systems
The value of a decimal number is computed by
multiplying each digit by the weighted value of its
position and then summing the results. Let’s take, for
example, the number 9876. It can be expressed through
the sum-of-the weights method as:
Binary Number System
• The binary number system uses the number 2 as
the base. Thus, the only allowable digits are 0
and 1; there are no 2s, 3s, 4s etc.
• For devices such as programmable controllers
and digital computers, the binary system is the
most useful.
• It was adopted for convenience, since it is easier
to design machines that distinguish between only
two entities or numbers (i.e. 0 and 1), rather than
ten, as in decimal.
• Most physical elements anyway have only two
states:
• a light bulb is on or off,
• a valve is open or closed.
Binary Number System
As with the decimal system, expressing binary
numbers greater than the largest-valued symbol (in
this case 1) is accomplished by assigning a weighted
value to each position from right to left.
------- 6 5 4 3 2 1 0 position

-------- 26 25 24 23 22 21 20 weight
Binary Number Systems
Let’s calculate the decimal value that is equivalent to the value
of the binary number 10110110:

•Thus the binary number 10110110 is equivalent to the number 182 in the
decimal system.
•Each digit of a binary number is known as a bit; hence, this particular
binary number, 10110110 (182 in decimal), has 8 bits.
Binary Number Systems
• A group of 4 bits is known as a nibble;
• a group of 8 bits is a byte; and
• a group of more than one bytes is a word.
Decimal & Binary Counting
Octal Number System

•Writing a number in binary requires substantially more


digits than writing it in decimal. E.g. 182 (in decimal)
equals 10110110 (in binary).
•Too many binary digits can be cumbersome to read and
write, specially for humans.
•Therefore, the octal numbering system is often used
to represent binary numbers using fewer digits.
•The octal number system uses the number 8 as its
base, with its eight digits being 0, 1, 2, 3, 4, 5, 6, and 7.
Decimal, Binary & Octal Counting
Octal Number System
Like all other number systems, each digit in an octal
number has a weighted decimal value according to its
position.
For example, the “Octal” number 1767 is equivalent to
the “Decimal” number 1015:
Octal Number System
The octal numbering system is used as a convenient way of writing a
binary number. The octal system has a base of 8 (23), making it possible
to represent any binary number in octal by grouping binary bits in
groups of three.
In this manner, a very large binary number can be easily represented by
an octal number with significantly fewer digits.
For example:

A 16-bit binary number can be represented directly by six digits in octal.


Many PLCs use the Octal number system for referencing I/O numbering
and Memory addresses.
Hexadecimal Number System
The hexadecimal (hex) number system uses 16 as its
base.
It consists of 16 digits — the numbers 0 through 9 and
the letters A through F (which represent the numbers
10 through 15, respectively).
The Hexadecimal system is used for the same reason
as the Octal system, to express binary numbers using
fewer digits.
The Hexadecimal numbering system uses one digit to
represent four binary digits (or bits), instead of three
as in the octal system.
Binary, Decimal & Hexadecimal Counting
Conversion of “Hexadecimal”
Number F1A6 into “Decimal”
Hexadecimal Number System
• Like octal numbers, hexadecimal numbers can easily be
converted to binary without any mathematical
transformation.
• To convert a hexadecimal number to binary, simply write
the 4-bit binary equivalent of the hex digit for each
position. For example:
Need for Binary Codes
PLC must communicate with various external devices that either supply
information or receive information.
This input/output function involves the transmission, manipulation, and
storage of binary data. However for humans to understand this Binary
we require that the data be converted to a more interpretable form.

One way to do this is to assign a unique combination of 1s


and 0s to each number, letter, or symbol that must be
represented.
This technique is called binary coding.
In general, there are two categories of codes—those that
represent numbers only (BCD) and those that represent
letters, symbols, and decimal numbers (ASCII).
Binary Coded Decimal
The BCD system was introduced in order for humans to:
(1) handle numbers that must be input to digital machines
(2) interpret numbers that are outputed from machines.

The best solution to this problem was to convert a code


readily handled by man (decimal) to a code readily
handled by processing equipment (binary).
The decimal system uses the numbers 0 through 9 as its
digits, whereas BCD represents each of these numbers
as a 4-bit binary number.
Decimal, Binary & BCD Counting
Binary Coded Decimal

The BCD representation of a decimal number is


obtained by replacing each decimal digit with its BCD
equivalent. The BCD representation of decimal 7493
is shown here as an example:
The BCD format
Uses four bits to represent a single Decimal digit. The only
decimal numbers that these four bits need to represent are from 0
through 9.
Newer PLCs operate and store data in several of their software
instructions, such as arithmetic and data manipulations, using the
BCD format.
In BCD format, a 16-bit word can hold up to a 4-digit decimal
value, with the decimal values that can be represented ranging
from 0000–9999.
Below Figure shows a register containing the binary
representation of BCD 9999.

You might also like