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:

Possible combinations for date and time data types:

SUB 1:

Negative TIME/LTIME values are undefined.

Samples:

ST:

nVar := 7-2; 

FBD:

SUB 2: