A PLC identifies each piece of data by its absolute address (memory area, byte, and bit) or by a symbolic name. Data types set the size and interpretation: BOOL, integers, reals, time, and strings. Structures and arrays group a machine's data so the logic can be reused.
Short answer
Everything a PLC program reads or writes (an input, an output, a counter, a setpoint) is a piece of data with an address and a type. The address says where it is; the type says how much space it takes and how it is interpreted. Mastering both is what separates a maintainable program from one nobody dares to touch. The basic types are defined by IEC 61131-3; the address format is decided by each manufacturer. Structured Text syntax (IF, CASE, FOR) and examples are in Structured Text (ST) for PLCs.
Bits, bytes, and words
Memory is organized in units:
| Unit | Size | Typical use |
|---|---|---|
| Bit | 1 bit | A digital input or output, a flag |
| Byte | 8 bits | Eight grouped bits |
| Word | 16 bits | An integer, an analog input |
| Double word | 32 bits | A long integer, a real |
| Long word | 64 bits | Double-precision reals, long times |
A digital input is a bit; a group of eight inputs forms a byte. An analog input arrives as a 16-bit word.
Absolute and symbolic addressing
Absolute. The address combines a memory area with a position. Each manufacturer has its own notation: some write I0.1 (input, byte 0, bit 1) and Q0.0 (output). Others use area letters with numbers (for example X, Y, M, D in a Japanese family). Others use hierarchical names of the form module-channel-bit. The guide on PLC brand equivalences lists the correspondences.
Symbolic. A name is assigned to each piece of data, and the program uses the name. The environment resolves the address. Some manufacturers base the whole model on names (tags) and the user never writes an address; others keep both forms.
Well-chosen names describe the equipment and the function: M1_START, M1_THERMAL_OK, TT101_TEMPERATURE. With a convention, anyone on the team understands the program without consulting the address table. The symbol table is kept up to date in the project, because it is what links the program to the electrical schematic and the cable list.
Elementary data types
| Type | Content | Notes |
|---|---|---|
BOOL | True or false | 1 logical bit |
SINT, INT, DINT, LINT | Signed integers of 8, 16, 32, and 64 bits | The range grows with the bits |
USINT, UINT, UDINT, ULINT | Unsigned integers | Larger positive range |
BYTE, WORD, DWORD, LWORD | Bit strings of 8, 16, 32, and 64 bits | For handling individual bits |
REAL, LREAL | Numbers with decimals, 32 and 64 bits | Limited precision; not compared with = |
TIME | Duration | Constants such as T#5s |
STRING | Text | Declared maximum length |
| Date and time | Date, time of day, date and time | For logs and calendars |
The size of INT and the list of available types depend on the programming environment. Look up the range of each type in your model’s manual.
Illustrative example: from counts to motor current
Assumed data: the 15 kW, 400 V motor has a 4-20 mA current transmitter proportional to 0-40 A, and the module delivers a 16-bit integer in the range 0-27648 (assumed; each module declares its own).
| Variable | Type | Example |
|---|---|---|
M1_I_COUNTS | INT | 19354 |
M1_I_AMPS | REAL | 28.0 |
M1_I_ALARM | BOOL | false |
M1_I_LIMIT | REAL | 32.0 (assumed alarm setpoint) |
The conversion goes from INT to REAL and is multiplied by 40/27648. If it were done in integers, the result would be truncated: 19354 × 40 / 27648 in integer arithmetic would give 28 only by luck, and with other values it would lose the decimals. With the rule of dividing last and using a suitable type, the calculation is correct. The comparison with the limit is done with > or <, not with exact equality.
Derived types: structures and arrays
- Array (
ARRAY): several elements of the same type, accessible by index. It serves for setpoint tables or short histories. - Structure (
STRUCT): groups data of different types under one name. AMOTORstructure can contain start, stop, overload, current, and operating hours. - Enumeration: a list of names with values, for example the states of a sequence (
IDLE,STARTING,RUNNING).
The combination of structures and function blocks is what lets you write a motor’s logic once and apply it to forty. The data of each instance lives in its own structure, and the HMI and the SCADA connect to those same names, as in substation SCADA and HMI.
Scope and retention of variables
| Scope | Visible in | Use |
|---|---|---|
| Local | The block or program where it is declared | Internal calculations |
| Global | The whole project | Field signals, shared states |
| Block input/output | The block interface | Input parameters and results |
Retentive variables keep their value after a power loss; the others return to their initial value. It is decided case by case: a production counter, yes; the state of a sequence, normally not, because the machine must start at rest and not continue on its own.
Communications addressing
When the PLC exchanges data with other equipment, the address also includes how the data looks from outside. In Modbus RTU and TCP each piece of data is a coil or a register with a number. The programmer must know three things: which internal address corresponds to each number, how the bytes of a real that takes two registers are ordered, and what the numbering origin is (zero or one). Those mismatches are a classic source of wrong readings when integrating drives, meters, or relays.
Organizing data for the HMI and the SCADA
The operator screen and the supervisory system read and write PLC data. So that this integration is not a source of errors:
- Complete structures are published per piece of equipment and not loose variables, so that adding a motor to the screen is a matter of copying a template.
- Read data (states, measurements) is separated from write data (commands, setpoints), and the latter goes through a block that validates ranges.
- Engineering units are defined once, in the PLC, and the screens display them without reconverting.
- Alarms carry a text, a priority, and a number that matches the cause-and-effect matrix.
- The data the SCADA needs over a protocol is grouped in a contiguous block, which simplifies configuring the map. See SCADA, SAS, DCS, and HMI: differences.
Example of a naming convention
| Part | Example | Meaning |
|---|---|---|
| Area | A02 | Plant zone |
| Equipment | P101 | Pump 101 |
| Signal | START, FAULT, I_AMP | Function |
| Result | A02_P101_FAULT | Full name |
A convention like this allows signals to be sorted, filtered, and located by area or by equipment, and makes the program, the schematic, and the screen speak the same language.
Common mistakes
- Programming with absolute addresses and no symbols.
- Ambiguous names (
COIL_1,AUX2) that nobody understands a year later. - Integer overflow in accumulators and calculations.
- Truncation from integer arithmetic in divisions and scalings.
- Comparing reals with exact equality.
- Reusing the same flag for two functions.
- Not defining retention, so a counter is lost or a sequence resumes.
- Misaligned byte order when reading reals over a network.
- Leaving the symbol table out of date with respect to the schematic.
Checklist
- Naming convention written and applied.
- Symbol table consistent with the schematic and the cables.
- Types and ranges suited to the maximum possible value.
- Scalings calculated in reals and with range protection.
- Structures for repeated equipment.
- Retentive variables decided one by one.
- Communication addresses documented, with numbering origin and byte order.
- No duplicate or unused flags.
Frequently asked technical questions
- How many flags does a PLC have? It depends on the model’s memory; the manufacturer’s manual gives the limit.
- Can an address be changed without breaking the program? With symbols, yes; with absolute addresses, each use has to be reviewed.
- What is a pointer or a reference? A variable that indicates the location of another; it is advanced and used with care.
- How is a piece of data passed to the HMI? By sharing the symbol or the address; the configuration depends on the brand.
How we help
A symbol table consistent with the schematic, the cable list, and the HMI reduces commissioning errors and eases audits. At Tiza Group we do the detailed control engineering and keep the documentation up to date; we then test and commission the system. See engineering design and studies and testing and commissioning, or write to us through contact.
Related guides
- SCADA, SAS, DCS, and HMI: differences
- PLC inputs and outputs: types and wiring
- Free PLC simulation and tools: OpenPLC
- PLCs in Substations: Uses, IEC 61131-3 and Testing
- Intelligent MCC: CENTERLINE 2100, SIVACON S8, MNS, Okken
References
- IEC 61131-3, data types and variables (paid standard).
- Siemens SCE, S7-1200 and S7-1500 training books (account required).
- Hugh Jack, Automating Manufacturing Systems with PLCs (CC BY-NC-SA 3.0 US).
Frequently asked questions
What is the difference between an absolute and a symbolic address?
The absolute address gives the physical place in memory, for example input 0, bit 1. The symbolic one is a name, like START_PUSHBUTTON, that the environment links to an address. Names make the program readable and let you move addresses without rewriting it.
When should I use REAL and when INT?
INT for counts and whole values; REAL for quantities with decimals, such as temperature or scaled pressure. Reals take more memory and are compared with a tolerance, not with exact equality.
Why does a value overflow?
Each integer type has a range. A signed 16-bit integer does not reach 40,000; when the limit is exceeded the value turns negative or is truncated. It is avoided by choosing a larger type or limiting the calculation.
What is retentive memory?
An area whose contents are kept after a power loss. It is used for accumulated counters, recipes, and parameters. The rest of the memory is set to zero or to its initial value on restart.