This article is about PLC Data Types. Read Also Previous Articles if you did not read before.
- Lecture 1: What is Programmable Logic Controller in PLC?
- Lecture 2: PLC Hardware Components – PC Information
- Lecture 3: PLC Internal Architecture and Diagram Explanation
- Lecture 4: What is PLC System? and Working Principle
- Lecture 5: How to Connect Input Devices to PLC? Input Devices Examples
- Lecture 6: How to Connect Output Devices to PLC? PLC Output Devices
- Lecture 7: PLC Applications Examples And Solutions
- Lecture 8: Numbering System in PLC (Digital System)
- Lecture 9: The Binary System Concept in PLC
- Lecture 10: Octal and Hexadecimal Numbering in PLC System
- Lecture 11: Binary Coded Decimals Examples
- Lecture 12: Binary Arithmetic Examples – PLC Professional Course
PLC Data Types
In most Programmable Logic Controllers (PLCs), a 16-bit word is commonly used to represent information. This word size allows for the representation of positive numbers in the range of 0 to +65535, which is equivalent to the binary value 1111111111111111. For signed numbers, the two’s complement representation is used, with the Most Significant Bit (MSB) indicating the sign. This allows for signed numbers in the range of -32768 to +32767 to be represented.
Signed numbers within a 16-bit word are typically referred to as integers, and the symbol “INT” is used to represent them in PLC programming for inputs and outputs. Additionally, a shorter version of the integer, using only 8 bits, is called a short integer, denoted by the symbol “SINT.” SINT numbers have a range of -128 to +127.
For larger numeric values, PLCs provide data types such as double-integer (DINT) and long-integer (LINT). A DINT uses 32 bits to represent the number, providing a range of -2^31 to +2^31 – 1. Similarly, an LINT uses 64 bits, allowing for a range of -2^63 to +2^63 – 1.
When numbers are not signed, the symbols “UINT,” “USINT,” “UDINT,” and “ULINT” are used for unsigned integers, short integers, double integers, and long integers, respectively. These data types are used when the sign bit is not needed to represent the numbers.
Decimal fractions, also known as real or floating point numbers, are represented in PLCs using the symbol “REAL” for inputs and outputs in programs. In PLCs, a real number is typically represented by two 16-bit words. For example, the number 1.234567E+03 would be represented as 1.234567 multiplied by 10 raised to the power of 3, indicated by the “E” notation, where the number following “E” represents the exponent.
What is BOOL?
In addition to the 32-bit REAL data type, PLCs also provide support for long real numbers using the “LREAL” data type. LREAL uses 64 bits to represent the number, allowing for greater precision and a wider range of values compared to the 32-bit REAL data type.
In PLC programming, the term “BOOL” is used to represent Boolean data type. Boolean data type represents binary values, typically represented as on/off or true/false. In PLCs, Boolean values are typically stored as single bits, where 0 represents false or off, and 1 represents true or on. Boolean data types are commonly used for representing discrete states or conditions in industrial control systems.
In the IEC standard for representing time duration, the symbols “d” represent days, “h” represent hours, “m” represent minutes, “s” represent seconds, and “ms” represent milliseconds. This notation is used to specify a specific duration of time. For example, T#12d2h5s3ms represents a time duration of 12 days, 2 hours, 5 seconds, and 3 milliseconds. The “#” symbol indicates that the following numerical value is the quantity associated with the respective time unit.
Define PLC Data Types?
In programmable logic controllers (PLCs), various data types are used to represent different types of information. Here are some commonly used data types in PLC programming:
- Boolean (BOOL): Represents a binary value, typically used for on/off or true/false conditions.
- Integer (INT): Represents signed whole numbers within a specific range, such as -32768 to +32767 for a 16-bit integer.
- Unsigned Integer (UINT): Represents unsigned whole numbers within a specific range, such as 0 to 65535 for a 16-bit unsigned integer.
- Double Integer (DINT): Represents signed integers with a larger range, typically 32 bits.
- Unsigned Double Integer (UDINT): Represents unsigned integers with a larger range, typically 32 bits.
- Floating Point (REAL): Represents decimal numbers with floating-point precision, typically using 32 bits.
- Long Real (LREAL): Represents decimal numbers with extended precision, typically using 64 bits.
- String (STRING): Represents a sequence of characters or text. The length of the string may vary.
- Timer (TIMER): Represents a timer data type used for time-based operations, such as delaying or measuring intervals.
- Counter (COUNTER): Represents a counter data type used for counting events or occurrences.
These data types provide a way to store and manipulate different types of data in PLC programs, enabling control and automation of industrial processes. The specific data types and their ranges may vary depending on the PLC manufacturer and programming language used.