Supported platforms: CODESYS 3.5
This function block includes functionality for using a GPRS/LTE modem connection.
All input parameters are taken in use at the rising edge of i_Enable.
|
This section applies to 6000 series units with a modem card. |
|
Connectivity settings such as APN, phone number, SIM PIN code, and the Network mode depend on the operator, SIM card and the purchased data plan. |
|
Only one instance of function block is supported. |
|
From library version 3.1.0.0 the Modem connection can be controlled without calling the methods, but the FB instead. |
|
From library version 3.1.0.0 the Modem main FB has automatic reconnection functionality. The FB tries reconnection after given interval time when connection is lost. |
Input variable name |
Data type |
Default |
Description |
i_Enable |
BOOL |
FALSE |
Enable operation. |
i_AccessPoint |
STRING |
'internet' |
Access point name (APN). |
i_PhoneNumber |
STRING |
'*99#' |
Phonenumber. |
i_NetworkMode |
ModemNetworkMode |
Auto |
Used network mode |
i_NumberOfRetries |
UINT |
10 |
Number of retries when trying to (re)connect. The retry count is reset - at the rising edge of i_Enable input, and - when connected successfully. |
i_RetryInterval |
UINT |
30s |
Retry interval time in seconds. |
Output variable name |
Data type |
Description |
o_State |
ModemConnectionState |
Modem connection state. |
o_Error |
ModemError |
Modem connection error. |
o_RetryCounter |
UINT |
Current connection retry count. |
|
The old interface methods are supported, but not adviced to be used. |
The method initializes function block.
|
Init must be called before any other method of the FB. |
No inputs.
Data type |
Description |
ModemError |
Library error code. |
The method sets modem settings for connection.
|
This method must be called with proper settings before opening connection. |
Input variable name |
Data type |
Description |
i_pSettings |
POINTER TO ModemSettings |
Pointer to modem settings. |
Data type |
Description |
ModemError |
Library error code. |
The method opens modem connection asynchronously. After this method is called, connection status can be checked by GetConnectionState method.
|
CloseConnection method has no effect until connection state is ModemConnected. |
No inputs.
Data type |
Description |
ModemError |
Library error code. |
The method gets current modem settings.
Input variable name |
Data type |
Description |
i_pSettings |
POINTER TO ModemSettings |
Pointer to modem settings. |
Data type |
Description |
ModemError |
Library error code. |
Method returns current connection state.
No inputs.
Data type |
Description |
ModemConnectionState |
Modem connection state. |
The method closes modem connection asynchronously. This method is automatically called when
application is reset, application is downloaded, or application exits.
|
CloseConnection method has no effect until connection state is ModemConnected. |
No inputs.
Data type |
Description |
ModemError |
Library error code. |
Definitions: |
|
LTE: EPEC_Modem.Modem; enable: BOOL := TRUE; error: EPEC_Modem.ModemError; state: EPEC_Modem.ModemConnectionState;
|
|
Code: |
|
LTE( i_Enable := enable, i_AccessPoint := 'internet', i_PhoneNumber := '*99#', i_NetworkMode := EPEC_Modem.ModemNetworkMode.ModemNetworkModeAuto, i_NumberOfRetries := 10, i_RetryInterval := 30, o_State => state, o_Error => error );
|
|
-
Source file topic000946.htm
Last updated 4-Sep-2025