INT 16-bit integer
Also called: integer, short integer, 16-bit integer
Whole number, from −32,768 to 32,767.
What it does
A signed 16-bit integer. It is also the type of a counter's preset and current value.
When to use it
Small quantities: part count, step number, whole-number setpoint.
| Size | 16 bits |
|---|---|
| Possible values | -32,768 … 32,767 |
| Starting value | 0 |
| Constants (examples) | 0, 25, -40 |
The bits
Each bit is worth a power of 2 (bit 0 = 1, bit 1 = 2, bit 2 = 4…) and the bits at 1 add up. The last bit (bit 15) is the sign: it is worth -32,768. All bits at 1 therefore give −1.
| Value | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
| 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
| 32,767 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| -1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| -32,768 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Behaviour in detail
- No decimals: 7 / 2 gives 3.
- Past its limits the value wraps around (32,767 + 1 gives −32,768), as on a real PLC.
- A counter stops at its limits instead of wrapping.
European (IEC) and American styles
Same name on both sides (INT). The American style often uses DINT for almost everything; INT is more common in the European style.