Data types & addressing
Everything in a PLC is stored as bits. This module shows how bits become numbers, which data type to pick for each signal, and how each PLC brand names its inputs, outputs and memory.
By the end of this module you can
- Convert between binary, decimal and hexadecimal
- Choose BOOL, INT, DINT, REAL, TIME or STRING for a signal, and know their ranges
- Explain overflow, and why INT 32767 + 1 is −32768
- Read addresses on Siemens, Rockwell, Mitsubishi and IEC PLCs
- Prefer symbolic tag names, and name tags consistently
A bit is 0 or 1. Eight bits make a byte, 16 bits a word, 32 bits a double word. Each bit position has a weight: 1, 2, 4, 8… so 0000 0000 0000 1101 is 8 + 4 + 1 = 13. Hexadecimal groups four bits into one digit 0–F, which is why engineers like it: 1101 = D.
A 16-bit word
Click bits to switch them. Bit 15 is the sign bit when the word is read as a signed INT.
| IEC type | Size | Range | Use it for |
|---|---|---|---|
| BOOL | 1 bit | FALSE / TRUE | Inputs, outputs, flags, status bits |
| INT | 16 bit | −32 768 … 32 767 | Raw analog values, small counts, Modbus registers |
| DINT | 32 bit | ±2 147 483 647 | Counters, totals, step numbers: the safe default for whole numbers |
| REAL | 32 bit float | ±3.4·1038, about 7 significant digits | Engineering values: bar, °C, m/s, setpoints |
| TIME | 32 bit | e.g. T#2m30s | Timer presets and elapsed times |
| STRING | variable | 'Batch OK' | Batch IDs, barcodes, messages |
0.1 + 0.2 = 0.3 can be FALSE. Compare with >= / <= or a tolerance band.Older PLCs addressed everything by location: "input byte 0, bit 3". Modern ones are symbolic: you name a tag and the software finds the memory. Most still let you see or use the absolute address.
IEC 61131-3 direct addresses start with %, then I (input), Q (output) or M (memory), then the size: X bit, B byte, W word, D double word. Examples: %IX0.3, %QX1.0, %MW10, %ID4. In practice you declare named variables and map them to these addresses once.
Logivyx is fully symbolic: every value is a tag (Conveyor.Start_PB). For the Soft-PLC, tags live in Logivyx memory; physical I/O arrives through Data Exchange devices (Modbus, EtherNet/IP remote I/O) mapped onto tags.
| Area | Bit | Byte / Word / DWord |
|---|---|---|
| Inputs | %I0.0 … %I0.7, %I1.0… | %IB0, %IW64, %ID4 |
| Outputs | %Q0.0 | %QB0, %QW80 |
| Bit memory | %M10.0 | %MB10, %MW10, %MD20 |
| Data blocks | "Motor_DB".Running (optimized DB, symbolic only) | |
Byte addresses overlap: %MW10 is bytes 10 and 11, so %MW10 and %MW11 share byte 11. Use even addresses for words and steps of 4 for double words (%MD20, %MD24) to avoid corrupting data. Bits count 0–7 inside each byte.
ControlLogix and CompactLogix are tag-based. There is no %M area: you create tags of type BOOL, DINT, REAL, TIMER… at controller or program scope. I/O modules create structured tags automatically:
| Local:1:I.Data.0 | Input module in slot 1, point 0 |
| Local:2:O.Data.5 | Output module in slot 2, point 5 |
| Remote_IO:3:I.Ch0Data | Analog channel 0 of a module in a remote rack |
Good practice: create an alias tag such as Start_PB pointing to Local:1:I.Data.0 and use the alias in logic. Older SLC 500/MicroLogix use file addresses like I:1/0, O:2/5, B3:0/0, N7:0.
| Device | Meaning | Example |
|---|---|---|
| X | Input | X0, X17 (iQ-F octal) · X1F (iQ-R hex) |
| Y | Output | Y0, Y10 |
| M / L | Internal relay / latch relay (retentive) | M100, L10 |
| D | Data register, 16 bit | D100; 32-bit uses the pair D100–D101 |
| T / C | Timer / counter | T0, C5 |
| SM / SD | Special relay / register | SM400 always ON, SD520 scan time |
iQ-F (FX5) numbers X and Y in octal: X0–X7, then X10. Q, L and iQ-R use hexadecimal: X0–XF, then X10. GX Works3 also supports labels (symbolic names) mapped to devices.
Programs are read far more often than they are written, usually by a maintenance engineer at 3 a.m. Good names make the logic explain itself:
- Say what the signal means, not where it is wired:
Conveyor1_Run, notQ4_3. - Make the TRUE state obvious:
Door_Closed,Air_Pressure_OK,Stop_PB_OK, never justDoor. - Use a consistent pattern:
Area_Device_Signal, and suffixes such as_PB(push button),_LS(limit switch),_FB(feedback),_SP(setpoint). - Group related tags in structures (UDTs):
Pump1.Run_Cmd,Pump1.Running,Pump1.Fault. You'll build these in Level 8.
Take the conveyor I/O list from module 02 and give each signal an address on the PLC you use. Then check against the model answer.
Conveyor addresses
- Choose a brand tab above. Assume the digital inputs are on the first input card, the outputs on the first output card and the analog input on the first analog channel.
- Write the address for each of the five digital inputs and three outputs.
- Write the analog input address and the data type of its raw value.
- Pick a data type for: the carton weight in kg, the cartons-per-shift count, and the "running" status.
- Compare with the model answer.
Model answer
| Tag | Siemens S7-1200 | Rockwell CompactLogix | Mitsubishi iQ-F |
|---|---|---|---|
| Start_PB | %I0.0 | Local:1:I.Data.0 | X0 |
| Stop_PB_OK | %I0.1 | Local:1:I.Data.1 | X1 |
| Motor_MPCB_OK | %I0.2 | Local:1:I.Data.2 | X2 |
| Motor_Running_FB | %I0.3 | Local:1:I.Data.3 | X3 |
| Carton_PE | %I0.4 | Local:1:I.Data.4 | X4 |
| Motor_Contactor | %Q0.0 | Local:2:O.Data.0 | Y0 |
| Lamp_Running | %Q0.1 | Local:2:O.Data.1 | Y1 |
| Lamp_Fault | %Q0.2 | Local:2:O.Data.2 | Y2 |
| Weight_Raw | %IW64 (Int) | Local:3:I.Ch0Data | a D register set in the module parameters |
Weight in kg: REAL. Cartons per shift: DINT. Running: BOOL. Slot numbers and the analog address depend on your hardware configuration.