123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
-
- {REDUND_OK} FUNCTION_BLOCK DTExSetTime (*sets the current time using the DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*date and time to be written*)
- Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_OK} FUNCTION_BLOCK DTSetTime (*sets current time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*date and time to be written*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_OK} FUNCTION_BLOCK DTGetTime (*reads the current time in the DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- DT1 :DATE_AND_TIME; (*date and time read*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_OK} FUNCTION clock_ms : TIME (*provides a continuous millisecond counter in the TIME data type*)
- END_FUNCTION
- {REDUND_OK} FUNCTION_BLOCK UtcDTGetTime (*reads the current UTC-time in the DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- DT1 :DATE_AND_TIME; (*UTC date and time read*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDTSetTime (*sets current UTC-time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*UTC date and time to be written*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDTExSetTime (*sets current UTC-time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*UTC date and time to be written*)
- Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK DTStructureGetTime (*reads the current time in the calendar structure*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK DTStructureSetTime (*sets current time in calendar structure*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK DTStructureExSetTime (*sets current time in calendar structure*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDTStructureGetTime (*reads the UTC time in the calendar structure*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, 0xXXXX = see help*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDTStructureSetTime (*sets UTC time in calendar structure*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDTStructureExSetTime (*sets UTC time in calendar structure*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- Option :USINT; (*additional option: timEXSETTIME_NO_OPTION, timEXSETTIME_NO_LOGENTRY*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDT_TO_LocalDTStructure (*sets current UTC-time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*UTC date and time*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK LocalDT_TO_UtcDTStructure (*sets current UTC-time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*Local date and time*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK UtcDTStructure_TO_LocalDT (*sets current UTC-time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- DT1 :DATE_AND_TIME; (*Local date and time*)
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK LocalDTStructure_TO_UtcDT (*sets current UTC-time in DATE_AND_TIME data type*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- VAR_OUTPUT
- DT1 :DATE_AND_TIME; (*UTC date and time*)
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state : UINT; (*internal variable*)
- i_result : UINT; (*internal variable*)
- i_tmp : UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ascTIMEStructure : UDINT (*converts a "time" structure to a character string in the format "15:14:13\0"*)
- VAR_INPUT
- pTIMEStructure :UDINT; (*address of the time structure*)
- pStr :UDINT; (*address of the character field*)
- len :UDINT; (*length of the character field *)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ascDTStructure : UDINT (*converts a "date" structure to a character string in the format "Sun Jan 3 15:14:13 1988\0"*)
- VAR_INPUT
- pDTStructure :UDINT; (*address of the calendar structure *)
- pStr :UDINT; (*address of the character field*)
- len :UDINT; (*length of the character field*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ascTIME : UDINT (*converts the TIME data type to a character string in the format "15:14:13\0"*)
- VAR_INPUT
- TIME1 :TIME; (*time*)
- pStr :UDINT; (*address of the character field*)
- len :UDINT; (*length of the character field*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION ascDT : UDINT (*converts the DATE_AND_TIME data type to character string in the format "Sun Jan 3 15:14:13 1988\0"*)
- VAR_INPUT
- DT1 :DATE_AND_TIME; (*date and time*)
- pStr :UDINT; (*address of the character field*)
- len :UDINT; (*length of the character field*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION TIMEStructure_TO_TIME : TIME (*converts a "time" structure to the TIME data type*)
- VAR_INPUT
- pTIMEStructure :UDINT; (*address of the time structure*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION TIME_TO_TIMEStructure : UDINT (*converts the TIME data type to a "time" structure*)
- VAR_INPUT
- TIME1 :TIME; (*time*)
- pTIMEStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION DTStructure_TO_DT : DATE_AND_TIME (*converts a "date" structure to the DATE_AND_TIME data type*)
- VAR_INPUT
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION DT_TO_DTStructure : UDINT (*converts the DATE_AND_TIME data type to a "date" structure*)
- VAR_INPUT
- DT1 :DATE_AND_TIME; (*date and time*)
- pDTStructure :UDINT; (*address of the calendar structure*)
- END_VAR
- END_FUNCTION
- {REDUND_OK} FUNCTION DiffT : UDINT (*shows the difference between two times (TIME data type) expressed in milliseconds*)
- VAR_INPUT
- TIME2 :TIME; (*time 2*)
- TIME1 :TIME; (*time 1*)
- END_VAR
- END_FUNCTION
- {REDUND_OK} FUNCTION DiffDT : UDINT (*shows the difference between two times (DATE_AND_TIME data type) expressed in seconds*)
- VAR_INPUT
- DT2 :DATE_AND_TIME; (*date and time 2*)
- DT1 :DATE_AND_TIME; (*date and time 1*)
- END_VAR
- END_FUNCTION
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK TimeDeviceGetInfo (*read information about time device*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pServer :UDINT; (*Pointer to string*)
- len :USINT; (*length of pServer*)
- END_VAR
- VAR_OUTPUT
- timeDevice :USINT; (*sntpREAL_TIME_CLOCK or sntpTIME_SERVER*)
- avgDeviation :REAL; (*average deviation between software time and time device*)
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state :UINT; (*internal variable*)
- i_result :UINT; (*internal variable*)
- i_tmp :UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK DstGetInfo (*read information about time device*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- pDTStructure :UDINT; (*Pointer to DTStructure*)
- END_VAR
- VAR_OUTPUT
- dstState :USINT; (*timDAYLIGHT_SAVING_TIME, timNORMAL_TIME or timNO_DST*)
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state :UINT; (*internal variable*)
- i_result :UINT; (*internal variable*)
- i_tmp :UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
- {REDUND_CONTEXT} {REDUND_UNREPLICABLE} FUNCTION_BLOCK DstGetInfoDT (*read information about time device*)
- VAR_INPUT
- enable :BOOL; (*enables execution*)
- DT1 :DATE_AND_TIME; (*date and time in UTC*)
- END_VAR
- VAR_OUTPUT
- dstState :USINT; (*timDAYLIGHT_SAVING_TIME, timNORMAL_TIME or timNO_DST*)
- status :UINT; (*execution status: ERR_OK, ERR_FUB_ENABLE_FALSE, ERR_FUB_BUSY, 0xXXXX = see help*)
- END_VAR
- VAR
- i_state :UINT; (*internal variable*)
- i_result :UINT; (*internal variable*)
- i_tmp :UDINT; (*internal variable*)
- END_VAR
- END_FUNCTION_BLOCK
|