This topic describes the management and operations of the controllers’ communication functions using the READ_VAR
function block as an example. (The PLCopen standard defines rules for function blocks.)
The parameters that are common to all function blocks in the PLCCommunication library are highlighted in this graphic:
These parameters are shared by several function blocks in the PLCCommunication library:
Input |
Type |
Comment |
---|---|---|
|
BOOL |
The function is executed on the rising edge of this input.
NOTE: When |
|
BOOL |
Aborts the ongoing operation at the rising edge |
|
ADDRESS |
Address of the targeted external device (can be the output of the ADDM function block) |
|
WORD |
Exchange timeout is a multiple of 100 ms (0 for infinite)
NOTE: The Timeout time is fixed at ≅1 s for the HMI SCU and cannot be set for the Modbus communication function blocks.
|
NOTE: A function block operation may require several exchanges. The timeout applies to each exchange between the controller and the modem, so the global duration of the function block might be longer than the timeout. |
Output |
Type |
Comment |
---|---|---|
|
BOOL |
|
|
BOOL |
|
|
BOOL |
|
|
BOOL |
|
|
BYTE |
|
|
DWORD |
|
Busy
output is reset to 0, one (and only one) of these 3 outputs is set to 1:
Done
Error
Aborted
Function blocks require a rising edge in order to be initiated. The function block needs to first see the Execute
input as false in order to detect a subsequent rising edge.
WARNING | |
---|---|
The function starts at the rising edge of the Execute
input. The Busy
output is then set to TRUE
. This figure shows the function block's behavior when the operation is automatically completed (with or without detected errors):
Note 1: The Done
or Error
bit is set to TRUE
during a task cycle only if Execute
has already been reset to FALSE
when the operation ended.
This figure shows the function being aborted by the application. The rising edge of the Abort
input cancels the ongoing function. In such cases, the aborted output is set to 1 and CommError
contains the code Canceled - 16#02
(exchange stopped by a user request):
Note 1: The Abort
bit is set to TRUE
during a task cycle only if Execute
has already been reset to FALSE
when the abort request occurred.