9. Number Systems for PLC Technicians


0
Categories : PLC Foundations

When working with PLCs, it is important to understand that the controller does not “think” the same way humans do.

Humans normally use the decimal system:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

But PLCs and digital systems work internally with binary:

0 and 1

In simple words:

Humans use decimal numbers.
PLCs use binary data internally.

This is why PLC technicians should understand the basic number systems used in automation.

According to Programmable Logic Controllers, 6th Edition, PLCs work internally with binary numbers, and different PLC models and instructions may use systems such as decimal, binary, octal, hexadecimal, BCD, Gray code, and ASCII.


Why Number Systems Matter in PLC Work

You do not need to be a mathematician to troubleshoot PLCs, but you do need to understand what numbers mean inside the controller.

Number systems are used in PLCs for:

Input and output status
Memory bits
Fault codes
Status words
Communication data
Analog values
Encoder positions
BCD displays
ASCII messages
Hexadecimal diagnostics
Binary masks
Word-level instructions

Example:

A fault code may appear as 16#0040
A status word may show bit 3 ON
An HMI may display a decimal value
A PLC instruction may use a hexadecimal mask
A sensor input may be stored as a binary 1 or 0

If you understand the basics, these values become much less intimidating.


1. Decimal System

The decimal system is the number system we use every day.

It uses base 10.

Digits: 0 through 9
Base: 10

Examples:

10
25
100
250
1000

In PLC work, decimal numbers are commonly used for values that humans need to understand.

Examples:

Production count = 1250
Timer preset = 5000 ms
Fault code = 102
Tank level = 75%
Speed reference = 45 Hz

Decimal is easy for people to read, but the PLC stores and processes the data electronically as binary values.


2. Binary System

The binary system is base 2.

It uses only two digits:

0 and 1

In PLC logic, this matches the basic ON/OFF world of industrial control.

0 = OFF / False / Not Energized
1 = ON / True / Energized

Examples:

DI_Start_PB = 1
DI_Stop_OK = 1
DI_Box_Present = 0
DO_Motor_Run = 1
Fault_Active = 0

This is why binary is so important. Every discrete input and output can be represented as either 0 or 1.


Binary and PLC Inputs

Imagine a 16-point digital input module.

Each input point can be ON or OFF.

Input 0 = 1
Input 1 = 0
Input 2 = 1
Input 3 = 1
Input 4 = 0

The PLC stores these states as bits in memory.

Example:

0000 0000 0000 1101

Each bit represents one input or condition.


3. Bits, Bytes, and Words

Before going deeper, it helps to understand these terms.

TermMeaning
BitOne binary digit, 0 or 1
Byte8 bits
WordCommonly 16 bits
DINT / Double Word32 bits

Example of 8 bits:

10101100

Example of 16 bits:

0000 0000 1010 1100

Example of 32 bits:

0000 0000 0000 0000 0000 0000 1010 1100

In PLC troubleshooting, bits are often used for ON/OFF logic, while words and DINTs are used for grouped data, counts, states, and status values.


4. Binary Place Values

Binary place values are based on powers of 2.

From right to left:

1, 2, 4, 8, 16, 32, 64, 128

Example:

Binary:  0000 1101
Values:       8 4 2 1

The bits that are ON are:

8 + 4 + 1 = 13

So:

0000 1101 binary = 13 decimal

Simple Binary Example
Binary: 1010

Place values:

8 4 2 1
1 0 1 0

Add the active positions:

8 + 2 = 10

So:

1010 binary = 10 decimal

5. Why Binary Matters in PLC Troubleshooting

Binary becomes very useful when looking at grouped status words.

Example:

Drive_Status_Word = 0000 0000 0000 0101

This means some individual bits are ON.

If we number bits from right to left:

Bit 0 = ON
Bit 1 = OFF
Bit 2 = ON
Bit 3 = OFF

This status word could mean:

Bit 0 = Drive Ready
Bit 2 = Drive Running

So the PLC can store many status conditions inside one word.


6. Hexadecimal System

The hexadecimal system, often called hex, is base 16.

It uses:

0 through 9
A through F

Where:

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Hexadecimal is commonly used because it is a compact way to represent binary data.

Example:

1111 binary = F hex
1010 binary = A hex
0001 binary = 1 hex

Why Hex Is Useful

Binary can become long and hard to read.

Example:

Binary:
0000 0000 0000 1111

Hexadecimal version:

16#000F

Much cleaner.

In Allen-Bradley / Studio 5000, hexadecimal constants may be shown with:

16#

Example:

16#000F
16#00FF
16#FFFF

7. Hex and Bit Masks

Hex is often used for bit masks.

Example:

16#0001 = Bit 0
16#0002 = Bit 1
16#0004 = Bit 2
16#0008 = Bit 3
16#0010 = Bit 4

This matters when working with:

Status words
Fault words
Drive data
Communication data
Masking instructions
Word-level logic

Example:

Status_Word AND 16#0004

This may be used to check whether bit 2 is ON.


8. Binary to Hex Quick Reference

BinaryHexDecimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15

A good trick:

1 hex digit = 4 binary bits

This makes converting between binary and hex easier.


9. BCD — Binary Coded Decimal

BCD means Binary Coded Decimal.

BCD represents each decimal digit using 4 binary bits.

Example decimal number:

25

BCD representation:

2 = 0010
5 = 0101

So:

25 BCD = 0010 0101

BCD was commonly used with older devices such as:

Thumbwheel switches
Numeric displays
Older operator interfaces
Panel meters
Legacy PLC systems

BCD Example

Decimal:

7863

BCD:

7 = 0111
8 = 1000
6 = 0110
3 = 0011

So:

7863 BCD = 0111 1000 0110 0011

Important:

BCD is not the same as normal binary.

Decimal 25 in normal binary is:

11001

But 25 in BCD is:

0010 0101

That difference matters when working with older PLC instructions and devices.


10. Gray Code

Gray code is a special binary code where only one bit changes at a time between positions.

This is useful for reducing errors in position feedback.

Gray code is commonly associated with:

Absolute encoders
Position sensors
Motion systems
Robotics
Machine tools
Servo applications

The textbook explains that Gray code is used with position encoders because only one digit changes from one count to the next, reducing the chance of reading errors.


Why Gray Code Is Useful

In normal binary, going from 7 to 8 changes many bits.

7 decimal  = 0111 binary
8 decimal  = 1000 binary

Many bits change at the same time.

With Gray code, only one bit changes between adjacent positions.

That makes it useful for encoder disks and position tracking.


11. ASCII Code

ASCII stands for:

American Standard Code for Information Interchange

ASCII represents letters, numbers, and symbols as digital codes.

Examples:

A
B
C
1
2
3
#
%
.

In PLC work, ASCII can appear in:

Barcode readers
Printers
Serial communication
String data
Labelers
Scanners
Vision systems
Scale indicators
Legacy communication devices

Example:

A = ASCII code
1 = ASCII code
# = ASCII code

Technicians may encounter ASCII when troubleshooting serial communication, barcode scanners, or data strings.


12. Octal System

The octal system is base 8.

It uses digits:

0 through 7

Octal is less common in modern Allen-Bradley work than binary, decimal, and hexadecimal, but it may appear in some older systems or documentation.

For most automation technicians, the main systems to understand first are:

Decimal
Binary
Hexadecimal
BCD
ASCII

13. Signed Numbers and Negative Values

PLCs also need to store negative numbers.

Example:

Temperature = -10°C
Position error = -25 counts
Speed correction = -5%

Because PLCs store values electronically, negative numbers are represented using binary methods such as two’s complement.

You do not need to manually calculate two’s complement every day, but you should understand the practical result:

A signed INT can store positive and negative numbers.
A signed DINT can store larger positive and negative numbers.

Example ranges:

INT  = -32,768 to 32,767
DINT = -2,147,483,648 to 2,147,483,647

This is important when selecting data types for counts, calculations, analog values, and machine states.


14. Number Systems in Studio 5000

In Studio 5000, you may see values displayed in different formats.

Common formats include:

Decimal
Binary
Hex
ASCII

For example, a DINT may be viewed as:

Decimal: 15
Binary: 0000 0000 0000 0000 0000 0000 0000 1111
Hex:     16#0000000F

Same value, different display format.

This is important:

Changing the display format does not change the value. It only changes how you view it.


15. Practical Example: Fault Word

Imagine a machine has a fault word:

Fault_Word = 0000 0000 0000 1010

Bit positions:

Bit 0 = 0
Bit 1 = 1
Bit 2 = 0
Bit 3 = 1

Fault table:

BitFault
0E-Stop Open
1Motor Overload
2Low Air Pressure
3Guard Door Open

Active faults:

Bit 1 = Motor Overload
Bit 3 = Guard Door Open

This is how one word can hold multiple fault conditions.


16. Practical Example: Drive Status Word

A VFD may send a status word to the PLC.

Example:

Drive_Status_Word = 16#0005

Hex 16#0005 equals binary:

0000 0000 0000 0101

Active bits:

Bit 0 = ON
Bit 2 = ON

If the manual says:

Bit 0 = Ready
Bit 2 = Running

Then:

Drive is ready and running.

This is why binary and hex are useful in real troubleshooting.


17. Practical Example: BCD Thumbwheel

Imagine an old machine has a thumbwheel switch for selecting a preset.

The operator sets:

25

The PLC may receive:

0010 0101

That is BCD for 25.

If the PLC treats it as normal binary, it may interpret it incorrectly.

This is why some PLCs have BCD conversion instructions.


18. Practical Example: ASCII from Barcode Scanner

A barcode scanner may send a string to the PLC.

Example:

LOT12345

The PLC receives characters as ASCII data.

The program may then use that data for:

Lot tracking
Reject decisions
Production records
Label verification
Data logging

Understanding that text is stored as digital codes helps when troubleshooting scanners and serial communication.


19. Technician Cheat Sheet

Decimal

Used for normal human-readable numbers.

Count = 100
Fault Code = 102
Preset = 5000
Binary

Used for ON/OFF bits.

0 = OFF
1 = ON
Hexadecimal

Used for compact representation of binary data.

16#000F
16#00FF
BCD

Used for decimal digits stored as binary groups.

25 BCD = 0010 0101
Gray Code

Used for position feedback and encoders.

Only one bit changes at a time.
ASCII

Used for characters and text communication.

Barcode scanners, strings, serial devices.

20. Common Mistakes

Mistake 1 — Thinking Hex Is a Different Value

Example:

Decimal 15
Binary 1111
Hex F

These can represent the same value.

The display format is different, but the value can be the same.


Mistake 2 — Confusing BCD and Binary

Example:

25 decimal = 11001 binary
25 BCD = 0010 0101

They are not the same.


Mistake 3 — Ignoring Bit Positions

A fault word is only useful if you know what each bit means.

Always check the device manual or PLC documentation.


Mistake 4 — Using the Wrong Data Type

If a number can go negative or exceed 32,767, an INT may not be enough.

Use the correct data type:

BOOL for ON/OFF
DINT for whole numbers
REAL for decimal/process values
STRING for text

Automation Technician Notes

When you see a number in a PLC, ask:

Is this decimal, binary, hex, BCD, ASCII, or raw data?
Is this a single value or a group of bits?
Is the value signed or unsigned?
Is this a fault word or status word?
Is this coming from a drive, HMI, scanner, or analog module?
What does the equipment manual say each bit means?
Is the HMI displaying the value in the correct format?

A good technician does not panic when seeing binary or hex values.

A good technician identifies the format and interprets the value correctly.


Best Practices

Use these practices when dealing with number systems:

Document status word bits clearly.
Use tag descriptions.
Use comments for fault codes.
Keep device manuals available.
Use meaningful tag names.
Convert hex to binary when troubleshooting bit-level data.
Do not assume BCD is normal binary.
Use correct data types.
Verify HMI display format.

Example tag descriptions:

Drive_Status_Word.0 = Drive Ready
Drive_Status_Word.1 = Drive Faulted
Drive_Status_Word.2 = Drive Running
Fault_Word.3 = Guard Door Open

Clear documentation saves troubleshooting time.


Key Terms
TermMeaning
DecimalBase 10 number system used by humans
BinaryBase 2 number system using 0 and 1
BitOne binary digit
Byte8 bits
WordCommonly 16 bits
DINT32-bit integer
HexadecimalBase 16 number system
BCDBinary Coded Decimal
Gray CodeCode where only one bit changes at a time
ASCIICode used for letters, numbers, and symbols
Status WordWord containing multiple status bits
Fault WordWord containing multiple fault bits
Bit MaskValue used to check or isolate specific bits

Final Thoughts

Number systems are part of everyday PLC work, even if they are not always obvious.

Discrete inputs and outputs are based on binary logic. Status words and fault words often use binary or hexadecimal. Older devices may use BCD. Encoders may use Gray code. Barcode readers and serial devices may use ASCII.

For an Automation Technician, the goal is not to memorize every conversion. The goal is to understand what each number system is used for and how to interpret it during troubleshooting.

Once you understand decimal, binary, hexadecimal, BCD, Gray code, and ASCII at a practical level, PLC diagnostics become much easier to read and understand.

Leave a Reply

Your email address will not be published. Required fields are marked *