TIME Constants¶
You use TIME constants to operate the standard timer modules. TIME
is a 32-bit IEC 61131-3 compliant time constant. In addition to TIME
, CODESYS also supports LTIME
as a time base for high-resolution timers. LTIME
is a 64-bit time constant that extends the standard with a resolution in nanoseconds.
Syntax of time constants
t#<time declaration>
As an alternative, you can use the following styles of syntax instead of “t#”: T#
, time
, TIME
.
You use this time declaration for all of the units of time listed below. These units must be in the order as shown below; however, not all units have to be declared.
d
: days
h
: hours
m
: minutes
s
: seconds
ms
: milliseconds
Examples of correct use of time constants in an ST assignment:
TIME1 := T#14ms; |
|
TIME1 := T#100s12ms; |
(Overflow in the highest components is permitted.) |
TIME1 := t#12h34m15s; |
Examples of incorrect use:
TIME1 := t#5m68s; |
(overflow at a lower position) |
TIME1 := 15ms; |
(T# missing) |
TIME1 := t#4ms13d; |
(incorrect order of time dimensions) |
Syntax of LTIME constants
LTIME#<time declaration>
In the time declaration, you can use the same units of time as for TIME constants. You can also use the the following units:
µs: microseconds
ns: nanoseconds
Examples of correct use of LTIME constants in an ST assignment:
LTIME1 := LTIME#1000d15h23m12s34ms2us44ns |
|
LTIME1 := LTIME#3445343m3424732874823ns |
See also