FP_DTBIN_TO_SEC

Binary date and time -> seconds

FP_DTBIN_TO_SEC converts a binary value of the data type DTBIN into seconds.

Parameters

Input

s (DTBIN)

date and time in binary format

Output

d (DWORD, DINT, UDINT, DATE, TOD, DT)

Seconds

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
		bStart: BOOL:=FALSE;
		DTBIN_value: DTBIN:=Year_2digits := 14,
Month := 01,
Day := 23,
Hour := 22,
Min := 22,
Sec := 22;
		wSeconds: WORD:=0;
	END_VAR

LD body

When the variable bStart is set to TRUE, the function is carried out.

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,FP_DTBIN_TO_SEC!,,9,1,19,5,,?DEN?D@'s'?AENO?Cd);
B(B_CONTACT,,bStart,5,2,7,4,);
B(B_VARIN,,DTBIN_value,7,3,9,5,);
B(B_VAROUT,,wSeconds,19,3,21,5,);
L(1,3,5,3);
L(7,3,9,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF bStart then
wSeconds := FP_DTBIN_TO_SEC(DTBIN_value);
END_IF;

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