FB_EcDcTimeCtrl64
![FB_EcDcTimeCtrl64 1:](Images/png/2267420555__Web.png)
This function block can be used to read the individual components such as year, month, day etc. of a 64-bit "Distributed Clock System Time" variable of type T_DCTIME64. The function block has several A_GETXYZ actions. Once the required action has been called, the value of the XYZ component is available in the “get” output variable. The “put” input variable is currently not used.
The function block features the following tasks:
- A_GetYear
- A_GetMonth
- A_GetDay
- A_GetDayOfWeek
- A_GetHour
- A_GetMinute
- A_GetSecond
- A_GetMilli
- A_GetMicro
- A_GetNano
Inputs
VAR_IN_OUT
put : WORD;
END_VAR
Name | Type | Description |
---|---|---|
put | WORD | Input parameter (currently not used) |
Inputs/outputs
VAR_IN_OUT
in : T_DCTIME64;
END_VAR
Name | Type | Description |
---|---|---|
in | T_DCTIME64 | The "Distributed Clock System Time" variable to be converted |
Outputs
VAR_IN_OUT
bError : BOOL;
get : WORD;
END_VAR
Name | Type | Description |
---|---|---|
bError | BOOL | This output is set if an error has occurred during the action call. |
get | WORD | Output parameter (year, month, day, etc.) |
Example of an implementation in ST:
PROGRAM P_TEST
VAR
dcStruct : DCTIMESTRUCT;
dcTime : T_DCTIME64;
fbCtrl : FB_EcDcTimeCtrl;
wYear : WORD;
wMonth : WORD;
wDay : WORD;
wDayOfWeek : WORD;
wHour : WORD;
wMinute : WORD;
wSecond : WORD;
wMilli : WORD;
wMicro : WORD;
wNano : WORD;
END_VAR
dcTime := F_GetCurDcTickTime64();
fbCtrl.A_GetYear( in := dcTime, get => wYear );
fbCtrl.A_GetMonth( in := dcTime, get => wMonth );
fbCtrl.A_GetDay( in := dcTime, get => wDay );
fbCtrl.A_GetDayOfWeek( in := dcTime, get => wDayOfWeek );
fbCtrl.A_GetHour( in := dcTime, get => wHour );
fbCtrl.A_GetMinute( in := dcTime, get => wMinute );
fbCtrl.A_GetSecond( in := dcTime, get => wSecond );
fbCtrl.A_GetMilli( in := dcTime, get => wMilli );
fbCtrl.A_GetMicro( in := dcTime, get => wMicro );
fbCtrl.A_GetNano( in := dcTime, get => wNano );
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.0 | PC or CX (x86, x64, ARM) | Tc2_EtherCAT |