SUB

Overview

IEC operator for the subtraction of one variable from another one.

Allowed types:

oBYTE

oWORD

oDWORD

oLWORD

oSINT

oUSINT

oINT

oUINT

oDINT

oUDINT

oLINT

oULINT

oREAL

oLREAL

oTIME

oTIME_OF_DAY(TOD)

oDATE

oDATE_AND_TIME(DT)

For time data types, the following combinations are possible:

oTIME–TIME=TIME

oDATE–DATE=TIME

oTOD–TIME=TOD

oTOD–TOD=TIME

oDT-TIME=DT

oDT-DT=TIME

Consider that negative TIME values are undefined.

Example in IL

LD     7
SUB    2
ST     Var1

Example in ST

var1 := 7-2;

Example in FBD

G-SE-0024265.1.gif-high.gif