Time_to/time_of_day conversions, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 493

Advertising
background image

L-force | PLC Designer

IEC Operators and additional norm extending functions



DMS 3.2 EN 02/2011 TD29

491

9.9.6

TIME_TO/TIME_OF_DAY Conversions

Converting from the variable type TIME or TIME_OF_DAY to a different type:

The time will be stored internally in a DWORD in milliseconds (beginning with 12:00
A.M. for the TIME_OF_DAY variable). This value will then be converted.

When you perform a type conversion from a larger to a smaller type, you risk losing
some information.

For the STRING type variable, the result is a time constant.

Examples in IL:

LD T#12ms
TIME_TO_STRING
ST str

(*Result is 'T#12ms' *)

LD T#300000ms
TIME_TO_DWORD
ST dw

(*Result is 300000 *)

LD TOD#00:00:00.012
TOD_TO_SINT
ST si

(*Result is 12 *)

Examples in ST:

str :=TIME_TO_STRING(T#12ms);

(* Result is T#12ms *)

dw:=TIME_TO_DWORD(T#5m);

(* Result is 300000 *)

si:=TOD_TO_SINT(TOD#00:00:00.012); (* Result is 12 *)

Examples in FBD:

Advertising