2 Instruction Descriptions
2-554
NJ-series Instructions Reference Manual (W502)
SUB_TOD_TOD
The SUB_TOD_TOD instruction subtracts a time of day from another time of day.
The SUB_TOD_TOD instruction subtracts time of day In2 from time of day In1. The result of subtraction
in Out is a time.
The following example is for when In1 is TOD#23:59:59.999999999 and In2 is
TOD#23:59:50.000000000.
Instruction Name FB/FUN Graphic expression ST expression
SUB_TOD_TOD Subtract Time of
Day
FUN Out:=SUB_TOD_TOD(In1,
In2);
Variables
Name Meaning I/O Description Valid range Unit Default
In1 Time of day
1
Input
Time of day 1
Depends on data type.
Hour, min-
utes, seconds
TOD#0:0
:0
In2 Time of day
2
Time of day 2
Out Resulting
time
Output Resulting time Depends on data type. ns
---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 OK
In2 OK
Out OK
Function
(@)SUB_TOD_TOD
EN ENO
In1 Out
In2
abc:=SUB_TOD_TOD(TOD#23:59:59.999999999,
TOD#23:59:50.000000000);
LD
ST
abc
TOD#23:59:59.999999999
TOD#23:59:50.000000000
SUB_TOD_TOD
EN ENO
In1
In2
−
TOD#23:59:59.999999999
TOD#23:59:50.000000000
T#0d0h0m9.999999999s
In1
In2
Out=abc