.

运算符‘SUB’

.
.

IEC运算符减去变量。

允许的数据类型:BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, REAL, LREAL, TIME, LTIME, TIME_OF_DAY (TOD), LTIME_OF_DAY (LTOD), DATE, LDATE, DATE_AND_TIME (DT) LDATE_AND_TIME (DT)

.时间数据类型的可能组合:

  • TIME - TIME = TIME
  • LTIME - LTIME = LTIME

.日期和时间数据类型的可能组合:

  • 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

 

TIME/LTIME负值无定义。

.

.例如

ST

var1 := 7-2; 
 

FBD