Bits, bytes, words and integer types
BOOL, BYTE, WORD, DWORD, signed and unsigned integers, two's complement, INT16/UINT16/INT32/UINT32 ranges and IEC 61131-3 types.
Units
| Unit | Bits | IEC 61131-3 type | Example |
|---|---|---|---|
| bit | 1 | BOOL | digital input, flag |
| byte | 8 | BYTE | 16#A5 |
| word | 16 | WORD | Modbus register, status word |
| double word | 32 | DWORD | two Modbus registers |
| long word | 64 | LWORD | four registers |
BYTE/WORD/DWORD are bit strings: a set of bits with no numeric meaning. For arithmetic the data is interpreted as a signed or unsigned integer.
Unsigned and signed integers
| IEC type | Bits | Range |
|---|---|---|
| USINT / SINT | 8 | 0…255 / −128…127 |
| UINT / INT | 16 | 0…65535 / −32768…32767 |
| UDINT / DINT | 32 | 0…4294967295 / −2147483648…2147483647 |
| ULINT / LINT | 64 | 0…2⁶⁴−1 / −2⁶³…2⁶³−1 |
Device specifications often call the same types UINT16, INT16, UINT32, INT32.
Two's complement
Negative numbers are stored in two's complement: the top bit is 1 and the value equals the unsigned value minus 2ⁿ.
16 bit: 0xFFFF = 65535 unsigned = −1 signed
0x8000 = 32768 unsigned = −32768 signed
0xFF38 = 65336 unsigned = −200 signed
The bit pattern is the same — only the interpretation changes. A temperature of −20.0 °C sent as INT16 with a factor of 10 arrives as 0xFF38; read as UINT16 by a SCADA it displays as 6533.6 °C.
Overflow
Out-of-range values wrap around: 32767 + 1 in INT16 gives −32768. Pulse and run-hour counters stored as UINT16 overflow after 65,536 counts — use UDINT/ULINT for accumulation or handle the wrap-around.
Hex and binary notation
One hex digit is exactly 4 bits (a nibble), so hex suits bit data: 0x1028 = 0001 0000 0010 1000 — bits 3, 5 and 12 are set. IEC 61131-3 literals are written 16#1028 and 2#0001_0000_0010_1000.
Tools
- Number Converter — DEC/HEX/BIN/OCT for 8–64 bit, signed and unsigned, overflow detection.
- Bit / Byte Tool — set and clear individual bits, bit masks.
Connections
Open in Knowledge Graph →Loading the map…
Sources
Updated 2026-10-01