SUB
The IEC operator subtracts variables.
Allowed data types: BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, REAL, LREAL, TIME, TIME_OF_DAY, TOD, LTIME, LTIME_OF_DAY, LTOD, DATE, DATE_AND_TIME, DT, LDATE, LDATE_AND_TIME, LDT
Possible combinations for time data types:
TIME – TIME = TIME
LTIME – LTIME = LTIME
Possible combinations for date and time data types:
DATE – DATE = TIME
LDATE – LDATE = LTIME
TOD – TIME = TOD
LTOD – LTIME = LTOD
TOD – TOD = TIME
LTOD – LTOD = LTIME
DT – TIME = DT
LDT – LTIME = LDT
DT – DT = TIME
LDT – LDT = LTIME
Negative TIME/LTIME values are undefined. |
Samples:
ST:
nVar := 7-2;
FBD: