Param (PARAMS) ¶ Editable SNMP parameters and limits. InOut: Scope Name Type Initial Comment Constant gc_uiMaxSNMPValues UINT 20 Maximum number of SNMP values to receive per request gc_uiMaxOIDs UINT 10 Maximum number of OIDs in a request gc_uiMaxAgentValues UINT 100 Maximum number of registered values (agent) gc_uiMaxTelegramLength INT 1024 Maximum length of a SNMP request or a SNMP response (in bytes) gc_iMaxValueLength INT 256 Maximum length of a SNMP value (in bytes) gc_iMaxUsers INT 10 Maximum numbers of users gc_iMaxEnginesPerUser INT 100 Maximum numbers of engines per user
Structs ¶ SNMPValue (Struct) SNMPVarBinding (Struct) User (Struct)
SNTP Service SL Library Documentation ¶ Company : CODESYS Title : SNTP Service SL Version : 1.9.0.0 Categories : Application|Utils Namespace : SNTP Author : CODESYS Development GmbH Placeholder : SNTP_Service_SL Description [ 1 ] ¶ The SNTP Library contains function blocks for easy implementation of SNTP client and server components on a CODESYS control. The function block SNTPGetUTCTime can be used to request the UTC time of a SNTP/NTP server (SNTP V3, SNTP V4). The function block SNTPServer can be used to build a simple SNTP server. Function blocks of the SNTP library: Function block to request the time of a SNTP server: SNTPGetUTCTime (SNTP client). Function block to provide the local server time: SNTPServer (SNTP server) The package contains following components: Library SNTPService (Namespace: SNTP) Example project (SNTP client and server) Help file (chm) Product data sheet (English, German) The package SNTPService includes the library SNTPService and the example project SNTPExample . The application SNTPRequestExample shows the usage of the function block SNTPGetUTCTime . The application SNTPServerExample shows how to use the function block SNTPServer . Application SNTPRequestExample ¶ The application reads the current UTC time from a SNTP server and shows the result, the local time and the time difference in a visualization. Visualization of the application SNTPRequestExample Application SNTPServerExample ¶ The application SNTPServerExample starts a simple SNTP server on port 123. Application ‘’SNTPServerExample`` Contents: ¶ SNTP Service Enums Function Blocks Indices and tables ¶ [ 1 ] Based on SNTP Service SL.library, last modified 11.09.2023, 10:41:58. LibDoc 4.4.0.0-b.37 The content file SNTP Service SL.clean.json was generated with CODESYS V3.5 SP16 Patch 3 on 11.09.2023, 10:42:01.
SNTP Service ¶ Enums ERROR (Enum) NTP_VERSION (Enum) Function Blocks SNTPGetUTCTime (FunctionBlock) SNTPServer (FunctionBlock)
Enums ¶ ERROR (Enum) NTP_VERSION (Enum)
ERROR (ENUM) ¶ TYPE ERROR : SNTP Errors InOut: Name Initial Comment NO_ERROR 0 No error (0) TIME_OUT 1 Time out (1) INIT_ERROR 2 Initialization failed (2) SEND_ERROR 3 Request could not be send to the server (3) RECEIVE_ERROR 4 Error while receiving a message (4) CAN_NOT_GET_SYSTIME 5 Can not read the current system timestamp (5) SERVER_REFUSED_REQUEST 6 The server has sent a KoD-Message and should not be called again (6) INVALID_LICENSE 7 Invalid License (7)
NTP_VERSION (ENUM) ¶ TYPE NTP_VERSION : Supported NTP versions. InOut: Name Comment V3 Version 3 V4 Version 4
Function Blocks ¶ SNTPGetUTCTime (FunctionBlock) SNTPServer (FunctionBlock)
SNTPGetUTCTime (FB) ¶ FUNCTION_BLOCK SNTPGetUTCTime Sends a SNTP request to a NTP/SNTP server and reads the current server time. InOut: Scope Name Type Initial Comment Input xExecute BOOL A rising edge starts the SNTP request sSNTPServer STRING(255) IP address of the NTP/SNTP server sOwnIP STRING(255) ‘0.0.0.0’ Optional: IP address of the PLC, Default: 0.0.0.0 uiSNTPPort UINT Port of the NTP/SNTP server uiOwnPort UINT Own port udiTimeout UDINT 1000 Timeout in ms (default 1000) eNTPVersion NTP_VERSION NTP_VERSION.V3 Version of the NTP protokol (default V3) Output xDone BOOL True if the call has been finished xBusy BOOL True while the request is running xError BOOL True if an error occured. eError ERROR Error code uliTimestamp ULINT Current UTC time in milliseconds since 1.1.1970 of the NTP/SNTP server with roundtrip correction. You can use the function SysTimeRtc.SysTimeRtcConvertHighResToLocal to convert the UTC time to SysTimeRtc.SYSTIMEDATE. uliReceiveClientTS ULINT Current UTC time in milliseconds since 1.1.1970 when the timestamp has been received by the client (current time of the runtime). You can use the function SysTimeRtc.SysTimeRtcConvertHighResToLocal to convert the UTC time to SysTimeRtc.SYSTIMEDATE.
SNTPServer (FB) ¶ FUNCTION_BLOCK SNTPServer SNTP Server for time synchronization. InOut: Scope Name Type Initial Comment Input xActivate BOOL Starts and stops the server uiOwnPort UINT Port of the server sOwnIP STRING(255) ‘0.0.0.0’ Optional: IP address of the PLC, Default: 0.0.0.0 Output xError BOOL True if an error occured. eError ERROR Error code see ERROR