WORD in TIME
WORD_TO_TIME converts a value of the data type WORD into a value of the data type TIME.
Input
Output
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
WORD_value: WORD:=0;
time_value: TIME:=T#0s;
END_VAR
This example uses variables. You can also use a constant for the input variable.
WORD_value of the data type WORD (16-bit) is converted into a value of the data type TIME (16-bit). The result will be written into the output variable time_value.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 2 ;
NETWORK_BODY
B(B_F,WORD_TO_TIME!,Instance,9,0,18,2,,?D?C);
B(B_VARIN,,WORD_value,7,0,9,2,);
B(B_VAROUT,,time_value,18,0,20,2,);
L(1,0,1,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
time_value:=WORD_TO_TIME(WORD_value);
LD |
WORD_value |
WORD_TO_TIME |
|
ST |
time_value |