Data types
Data types say what a variable holds: a bit, an integer, a real, a duration, or the memory of a timer or a counter.
What it does
Every variable has a type. The type sets the possible values, the memory used and the instructions that can use it: a contact reads a BOOL, an addition works on INT, DINT or REAL, a timer needs a TIMER variable.
When to use it
When creating each variable: BOOL for a button or an output, DINT for a part counter, REAL for a measurement, TIME for a duration.
In this category
- BOOLBoolean (bit)A single bit: 0 or 1, false or true.
- INT16-bit integerWhole number, from −32,768 to 32,767.
- DINT32-bit integerLarge whole number, about −2.1 to 2.1 billion.
- REALReal numberNumber with decimals (about 7 significant digits).
- TIMEDurationA duration, counted in milliseconds.
- IEC_TIMEREUTIMERUSIEC_TIMERTIMERTimerA timer's memory: one variable per timer.
- IEC_COUNTEREUCOUNTERUSIEC_COUNTERCOUNTERCounterA counter's memory: one variable per counter.