DWORD_TO_TIME

DOUBLE WORD in TIME

DWORD_TO_TIME converts a value of the data type DWORD into a value of the data type TIME. A value of 1 corresponds to a time of 10ms, e.g. the input value 12345 (16#3039) is converted to a TIME T#2m3s450.00ms.

Parameters

Input

Unnamed input (DWORD)
Input data type

Output

Unnamed output (TIME)
Conversion result

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
		DWORD_value: DWORD:=0;
		time_value: TIME:=T#0s;
	END_VAR

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

POU body

DWORD_value of the data type DWORD (32-bit) is converted to value of the data type TIME (16-bit). The result is written into the output variable time_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_F,DWORD_TO_TIME!,Instance,10,1,20,3,,?D?C);
B(B_VARIN,,DWORD_value,8,1,10,3,);
B(B_VAROUT,,time_value,20,1,22,3,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

time_value:=DWORD_TO_TIME(DWORD_value);

IL body

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