Number System in PLC Explained | Binary, Decimal, Hexadecimal & Data Types Guide
In industrial automation, understanding number systems is essential for programming and interpreting data in Programmable Logic Controllers (PLCs). PLCs internally operate using binary logic, but engineers frequently work with multiple number systems such as decimal, octal, and hexadecimal.
This article provides a complete and practical guide to number systems in PLCs, including binary, decimal, octal, hexadecimal, BCD, integers, real numbers, and data types, helping engineers and students improve their programming and troubleshooting skills.
Overview of Number Systems in PLC’s
PLC'S connect to a wide variety of devices, some of which use variable voltage and current values. Internally however, PLC'S use signals that are either off or on.
These OFF and ON signals correspond to binary values 0 and 1.
- Logic 0 → OFF
- Logic 1 → ON
- A binary 0 also called logic 0 can be used to indicate that an input or output is off and a binary 1 also called logic 1 can be used to indicate that an input or output is on.
- Consecutive binary bits are also grouped in lengths ranging from a byte to a double word to represent various types of information.
Binary bits are grouped into:
- Byte (8 bits)
- Word (16 bits)
- Double Word (32 bits)
- For example, a group of consecutive bits, sometimes called a bit string, may represent a numerical value in various number systems such as Binary, Octal Decimal, and Hexadecimal.
- Because a bit string can represent many things, it must be assigned a data type so that a PLC can properly interpret the information.
Decimal Number System (Base 10)
- The decimal number system is sometimes called base 10 and every position in a decimal number represents a power of 10.
- The available numbers, digits, for each position range from 0 to 9 and the numerical value of a position is determined by multiplying the position digit by the power of 10 for that position.
- The total numerical value for a decimal number is found by adding the numerical values for all positions.
- While binary, octal, and hexadecimal numbers may at first seem confusing, they follow the same concepts as decimal numbers except that the number base and available characters are different.
Binary Number System (Base 2)
- Binary is the core language of PLCs.
- The binary number system has a base of 2 and uses only two characters, 1 and 0.
- Each position is called a bit and is associated with a power of 2 based on where it is in the number.
- The further to the left a bit is in a binary number, the higher the power of 2.
- The number on the far left-hand side is referred to as the most significant bit or Most Significant Bit (MSB) and the number on the far right hand side is referred to as the least significant bit or Least Significant Bit (LSB).
- A1 is placed in a position if that power of 2 is used in the number, Otherwise a 0 is placed in a position.
- The number of bits used to represent numbers varies but in the example shown, an 8-bit binary number also called a byte is used.
- When a PLC does a calculation, it does not convert a binary number to decimal to make the calculation, however it is useful to understand how to convert a binary number to decimal.
- Fortunately, the process of converting a binary number to an equal decimal value is as simple as adding the equivalent decimal value for each position in the binary number where a 1 is shown.
- Position with a 0 do not add to the number value.
- The process of converting a decimal number into a binary number is easy to do by repeatedly dividing the decimal number by two and placing the remainder in the appropriate position in the binary number.
- For the example show, the first remainder, 0 is placed in the 1's column.
- The next remainder 1, is placed in the 2's column.
- The process continues as shown with the last remainder of 1 placed in the 128's column.
- This shows that 11001110 in binary is equal to 206 in decimal.
Octal Number System (Base 8)
- Octal is another number system used with PLC'S. The octal number system has a base of 8 and uses characters 0 through 7.
- Each position is associated with a power of 8 based on where it is in the number.
- The further to the left a position is, the higher the power of 8.
- The process of converting an octal number to an equal decimal value is as simple as adding the equivalent decimal value for each position in the octal number.
- Although you will not frequently have to convert decimal to octal to use a PLC, it is easy to do this conversion by repeatedly dividing the decimal number by eight and placing the remainder in the appropriate position in the octal number.
- For the example shown the first remainder 1 is placed in the 1's column.
- The next remainder 3 is placed in the 8's column.
- 8 does not divide into 4 so that leaves a remainder of 4 in the 64's column.
- This shows that 281 in decimal is equal to 431 in octal.
- The real value of octal comes from its relationship with binary.
- While a PLC can easily use binary numbers sometimes it is convenient for humans to see equivalent binary values in octal because octal numbers require fewer place values to represent a number.
- If you know the equivalent binary number for each of the octal characters 0 through 7 you can easily convert an octal number of any length to the equivalent binary number.
Hexadecimal Number System (Base 16)
- The hexadecimal number system has a base of 16. This means that 16 values must be represented for each position in a hexadecimal number.
- This is done by using the numbers 0 through 9 to represent the first 10 values and the letters A through F to represent the remaining six values.
- Each position in a hexadecimal number is associated with a power of 16 based on where it is in the number. The further to the left a position is the higher the power of 16.
- The process of converting a hexadecimal number to an equal decimal value is as simple as adding the equivalent decimal value for each position in the hexadecimal number.
- Although you will not frequently have to convert decimal to hexadecimal to use a PLC, it is easy to do this conversion by repeatedly dividing the decimal number by 16 and placing the remainder in the appropriate position in the hexadecimal number.
- For the example shown the first remainder of 15 represented by F in hexadecimal is placed in the 1s column.
- The next remainder of 3 is placed in the 16's column.
- 16 does not divide into 13, so you are left with a remainder of 13 represented by D in hexadecimal in the 256's column.
- This shows that D3F in hexadecimal is equal to 3391 in decimal.
- The real value of hexadecimal comes from its relationship with binary.
- While a PLC can easily use binary numbers, sometimes it is convenient for humans to see equivalent binary values in hexadecimal because hexadecimal numbers require fewer place values to represent a number.
- If you know the equivalent binary number for each of the hexadecimal characters 0 through F you can easily convert a hexadecimal number of any length to the equivalent binary number.
Binary Coded Decimal (BCD)
- PLC'S use a variety of input and output device codes.
- Binary coded decimal (BCD) is the most common of these codes.
- BCD is not a number system but is used by some input and display devices because it allows people to input or see values in decimal.
- Internal to the PLC BCD values must be converted to binary numbers that the PLC can use.
- An example of a BCD device is a type of four-digit Thumb wheel switch.
- Each Thumb wheel digit controls four PLC inputs, so a four- digit Thumb wheel uses 16 digital inputs.
- Each Thumb wheel digit represents decimal values 0 through 9.
Integer Data Types in PLC
- Integers are whole numbers used in PLC programming.
- There are a variety of ways to show an integer, and the integer types available vary with the PLC model.
- As the accompanying graphic shows there are eight integer types available for SIMATIC S7-1500 PLC'S. 4 unsigned integer types and 4 signed integer types.
- Both unsigned and signed integers are available to meet the requirements of various types of instructions in a PLC program.
- Integer types of varying lengths are available so that only the amount of memory needed is used.
- In other words, why use 64 bits to store a number when only 8 or 16 bits are required.
- When a signed integer is stored, bit patterns beginning with 0 are used to store 0 and all the positive values, and bit patterns beginning with 1 are used to store all the negative values.
- Negative values are stored in two's complement form, which means that the pattern of bits for a negative binary number is determined by inverting all the bits in the equivalent positive binary value and then adding 1.
- Two's complement is used to store negative values in PLC'S because it simplifies math processes.
- The accompanying graphic shows the range of binary numbers and their equivalent decimal values that can be stored as a signed short integer.
Real Numbers (Floating Point)
PLC'S work with real numbers also called floating point numbers, which are expressed in scientific notation.
Structure (32-bit):
- 1 bit → Sign
- 8 bits → Exponent
- 23 bits → mantissa
- To convert a number to scientific notation move the decimal point to the left or right to create a mantissa that is greater than or equal to 1 but less than 10.
- Then multiply the mantissa by a power often to compensate for the decimal point movement.
- Real numbers are often displayed as a mantissa followed by E and then the exponent.
- In the 32-bit format, the first bit represents the sign associated with the mantissa, a 1 represents a negative sign.
- The next 8 bits represent the exponent, which can be negative or positive. The remaining 23 bits represent the mantissa.
- There is a similar 64-bit format Siemens SIMATIC PLC'S can use 32-bit real numbers.
- Siemens SIMATIC S7- 1200 and S7- 1500 PLC'S can also use 64-bit long real numbers.
Data Types in PLC
- Binary bits can be used independently or as a group.
- When used as a group, they are used to represent numerical values as well as other types of data.
- In order to know how a bit string will be interpreted by a PLC, you must know the data types of various lengths are specified for: binary numbers, integers, floating point number, date and time, characters, parameters, system data and other types of data).
- Because the number of data types has increased overtime, not all data types of data types are available for all SIMATIC PLC'S.
- The accompanying graphic shows the binary number, Integer and real number data types available for some of these PLC'S.
- To determine how an instruction in a PLC program interprets bits in the locations designated by the instructions operands you must know the data type the instruction assigns to these bits.
- There are many data types and they are often represented by shorthand names such as Dword or Sint.
- For example the graphic shows a multiply instruction with a signed integer (Int) data type.
- As shown in the lower part of this graphic the instructions data type can be easily changed.
- When making this selection make sure that the data type is compatible with the instructions operands.
- binary numbers,
- integers,
- floating point numbers,
- date and time,
- characters,
- parameters,
- system data, and other types of data.
- Because the number of data types has increased over time not all data types are available for all Siemens PLC'S.
- The table shows the binary number integer, and real number data types available for some modular Siemens PLC'S.
- Additional information on these and other data types is available in the documentation for each PLC model.
Conclusion
Understanding number systems is fundamental for effective PLC programming and troubleshooting. By mastering binary, decimal, octal, and hexadecimal systems along with data types, engineers can interpret PLC data accurately and optimize control systems. This knowledge not only improves programming efficiency but also enhances diagnostic capabilities in industrial automation environments.
About the Author – Insight Control System
Insight Control System provides technical education and practical guidance in the fields of Building Automation Systems (BAS), HVAC controls, PLC programming, sensors, and industrial automation.
The content published on this platform is based on field experience, technical documentation analysis, and real-world system applications.
Our objective is to simplify complex automation concepts for engineers, technicians, students, and industry professionals worldwide.
Every article is carefully structured to deliver accurate technical knowledge, practical insights, and industry-relevant information aligned with modern automation standards.
We continuously update our content to reflect current technologies, control strategies, and best engineering practices.
⚠️If you notice any technical discrepancy or would like to contribute industry insights, please contact us via our Contact page
Recommended Technical Guides
- Siemens S7 PLC Analog I/O Modules Power Supply & Communication Modules
- Siemens PLC Distributed I/O, System Configuration, PLC Tags & Monitoring in TIA Portal
- Siemens PLC Communication and Industrial Networks | PROFIBUS DP, PROFINET, Cables & Protocols Explained
- Belimo Company Technical Overview HVAC Automation Solutions Explained
- Top 100+ Building Automation System Abbreviations and their Meanings Part 1
- PLC Basic Instructions Explained | Essential Allen-Bradley MicroLogix & PLC-5 Ladder Logic Functions.
- Installation of PLC Control Panel Complete Guide for Safe & Reliable Operation
- Industrial and Building Automation Project Development 10 Essential Steps for Global Success
- Ingress Protection (IP) Ratings in BMS|Full Breakdown with HVAC Field Devices
Connect with Insight Control System
Follow us for more Building Automation & Industrial Automation technical updates:
YouTube | LinkedIn | Facebook | Instagram | Pinterest | X















Comments
Post a Comment