TIME_TO_WORD

TIME into WORD

TIME_TO_WORD converts a value of the data type TIME into a value of the data type WORD.

Parameters

Input

Unnamed input (TIME)

input data type

Output

Unnamed output (WORD)

Conversion result

Remarks

If the required data type is supported, we recommend using the overloaded instruction TO_WORD

Example

POU header

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
		Time_value: TIME:=T#0s;
		WORD_value: WORD:=0;
	END_VAR

This example uses variables. You can also use a constant for the input variable.

POU body

time_value of the data type TIME is converted into a value of the data type WORD. The result will be written into the output variable WORD_value.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_VARIN,,TIME_value,8,1,10,3,);
B(B_VAROUT,,WORD_value,19,1,21,3,);
B(B_F,TIME_TO_WORD!,Instance,10,1,19,3,,?D?C);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

WORD_value:=TIME_TO_WORD(time_value);

IL body

LD

time_value

TIME_TO_WORD

ST

WORD_value

Modified on: 2019-01-24Feedback on this pagePanasonic hotline