FB_CTRL_GET_SYSTEM_TIME
The function block reads the current Windows system time and makes it available in the SystemTimeStruct.
Description
This function block makes the current system time available in its output structure. The resolution is specified through the tCtrlCycleTime
parameter; the maximum resolution is 10 ms, and it is necessary to observe the condition "tCtrlCycleTime > 2 • tTaskCycleTime". Otherwise the resolution is reduced to "2 • tCtrlCycleTime".
Outputs
VAR_OUTPUT
stSystemTime : TIMESTRUCT;
eErrorId : E_CTRL_ERRORCODES;
bError : BOOL;
END_VAR
TYPE TIMESTRUCT
STRUCT
wYear : WORD;
wMonth : WORD;
wDayOfWeek : WORD;
wDay : WORD;
wHour : WORD;
wMinute : WORD;
wSecond : WORD;
wMilliseconds : WORD;
END_STRUCT
END_TYPE
Name | Type | Description |
---|---|---|
stSystemTime | TIME | Structure in which the system time is output. |
eErrorId | E_CTRL_ | Supplies the error number when the output |
bError | BOOL | Becomes TRUE as soon as an error situation occurs. |
wYear | WORD | The year: 1970 ~ 2106; |
wMonth | WORD | The month: 1 ~ 12 (January = 1, February = 2 etc.); |
wDayOfWeek | WORD | The day of the week: 0 ~ 6 (Sunday = 0, Monday = 1 etc.); |
wDay | WORD | The day of the month: 1 ~ 31; |
wHour | WORD | Hour: 0 ~ 23; |
wMinute | WORD | Minute: 0 ~ 59; |
wSecond | WORD | Second: 0 ~ 59; |
WMilliseconds | WORD | Millisecond: 0 ~ 999; |
Inputs/ outputs
VAR_IN_OUT
stParams : ST_CTRL_GET_SYSTEM_TIME;
END_VAR
Name | Type | Description |
---|---|---|
stParams | ST_CTRL_ | Parameter structure of the function block |
stParams
consists of the following elements:
TYPE
ST_CTRL_GET_SYSTEM_TIME:
STRUCT
tTaskCycleTime : TIME;
tCtrlCycleTime : TIME;
END_STRUCT
END_TYPE
Name | Type | Description |
---|---|---|
tCtrlCycleTime | TIME | Cycle time with which the control loop is processed. This must be greater than or equal to the TaskCycleTime. The function block uses this input value to calculate internally whether the state and the output values have to be updated in the current cycle. |
tTaskCycleTime | TIME | Cycle time with which the function block is called. If the function block is called in every task cycle this corresponds to the task cycle time of the calling task. |