At a Glance
Management parameters are grouped together in the form of an array of four integers. The values contained in this array can be used to manage communication functions.
Uncheck the
attribute for each of the four management parameters.Initialize the Length parameter each time the function is called.
Set the Timeout parameter accordingly to your application:
If the communication function is send through the CPU, the typical timeout value is 500 ms.
If the communication function is send through a NOC module, the typical timeout value is 2 s.
Structure
The following table describes the structure of the data in the communication management table:
Order of the Word |
Most Significant Byte |
Least Significant Byte |
|
---|---|---|---|
Data managed by the system |
1 |
Exchange number |
Activity bit: rank 0 Cancel bit: rank 1 Immediate acknowledge bit: rank 2 |
2 |
|||
Data managed by the user |
3 |
||
4 |
Activity Bit
This bit indicates the execution status of the communication function.
It is set to 1 when launched and returns to 0 when its execution is complete.
This is the first bit of the first element of the table.
Declaration: If the management table has been declared as follows:
Tab_Gest ARRAY [1..4] OF INT
, the activity bit is the bit with the notation Tab_Gest[1].0
.
Tab_Gest[1].0
cannot be accessed in this manner.Cancel Bit
To cancel
the communication function (for Modicon M340 and Modicon M580 PLCs only) set this bit
to 1 and relaunch the EF. This is another
way than using the CANCEL
EF.
Declaration: If the management table has been declared as follows:
Tab_Gest ARRAY [1..4] OF INT
, the cancel bit is the bit
with the notation Tab_Gest[1].1
.
Programming
example in ST: cancelling a READ_VAR
function
IF (%MW40.0) THEN
SET(%MW40.1);
READ_VAR(ADDM(’0.0.0.6’),
’%MW’, 100, 10, %MW40:4, %MW10:10);
END_IF;
%MW40
is the GEST
parameter (management
table).%MW40.0
corresponds to the
activity bit of the READ_VAR
function
and is set to 1 when the communication function is active. If this
bit is set to 1, the program sets the %MW40.1
bit, the function cancel bit, to 1. This stops communication of
the READ_VAR
function.
%MW40
in this example), the function (READ_VAR
in this example) must be called in order to activate the cancellation
of the exchange.%MW40.1
in this example)
and then start again the communication function.Immediate Acknowledge Bit
Used only for the INPUT_CHAR
EF, this bit forces an immediate execution of
the EF. This feature is useful when working
with NOM modules on remote drops (the connection
is automatically closed by the CRP module
if no answer of the CRA module arrives in
the two minutes). The function INPUT_CHAR
can indeed remain infinitely active in the NOM module waiting for characters coming on the serial connection. When
this feature is activated, the NOM module
immediately answers to the input character request even if no character
is available (of course with receive characters length set to 0).
Declaration: If the management table has been declared as follows:
Tab_Gest ARRAY [1..4] OF INT
,
the immediate acknowledge bit is the bit with the notation Tab_Gest[1].2
.
Exchange Number
When a communication function is sent, the system automatically allocates it a number, enabling the exchange to be identified.
This number
can be used where necessary to stop the exchange in progress (using
the CANCEL
function).