BinaryTime6_To_LWORD
Converts the components of the structured type T_BinaryTime into binary data of the type LWORD. The coding of the components in LWORD corresponds to the TwinCAT Binary-Time LWORD format specification.
Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)
Syntax
FUNCTION BinaryTime6_To_LWORD : LWORD(0.. 16#FFFFFFFFFFFF);
VAR_INPUT
in : T_BinaryTime;
END_VAR
VAR_OUTPUT
bError : BOOL;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
in | The time information to be converted as a Binary-Time structure. |
Outputs
Name | Type | Description |
---|---|---|
bError | BOOL | The output is "TRUE" if the value of the in.timeOfDay component is greater than "TOD#23:59:59,999". In this case the function returns the value "0". |
Return value
Name | Type | Description |
---|---|---|
BinaryTime_To_LWORD | LWORD(0..16#FFFFFFFFFFFF); | Converted time information as Binary-Time binary data. |
Sample
METHOD BinaryTime6_ToFrom_LWORD : BOOL
VAR_INPUT
fbIED : REFERENCE TO FB_IED;
END_VAR
VAR
tValue : T_BinaryTime;
sValue : STRING;
END_VAR
IF NOT __ISVALIDREF(fbIED) THEN
RETURN;
END_IF
tValue := LWORD_To_BinaryTime6(0);
sValue := BinaryTime6_To_String(tValue);(* sValue := 'BT#1984-01-01-00:00:00' *)
IF fbIED.Relay.LLN0.brcb1.TimeOfEntry.nValue <> BinaryTime6_To_LWORD(tValue) THEN
tValue := fbIED.Relay.LLN0.brcb1.TimeOfEntry.tValue;
END_IF
tValue := LWORD_To_BinaryTime6(1);
sValue := BinaryTime6_To_String(tValue);(* sValue := 'BT#1984-01-01-00:00:00.001'*)
IF fbIED.Relay.LLN0.brcb2.TimeOfEntry.nValue <> BinaryTime6_To_LWORD(tValue) THEN
tValue := fbIED.Relay.LLN0.brcb2.TimeOfEntry.tValue;
END_IF
tValue := String_To_BinaryTime6('BT#2017-03-21-11:22:33.44');
sValue := BinaryTime6_To_String(tValue);(* sValue := 'BT#2017-03-21-11:22:33.440'*)
IF fbIED.Relay.LLN0.brcb3.TimeOfEntry.nValue <> BinaryTime6_To_LWORD(tValue) THEN
tValue := fbIED.Relay.LLN0.brcb3.TimeOfEntry.tValue;
END_IF
BinaryTime6_ToFrom_LWORD := TRUE;