MB_GetState block
Short summary
Name |
|
→POU type |
|
Category |
more system blocks, blocks for Modbus, block with internal error diagnostic |
Graphical interface |
|
Available since |
|
Functionality
The block determines the state of a given →Modbus connection.
It is imperative that you are using MB_GetState
in order to determine the state of a Modbus connection within each cycle of the application. Make sure that the application contains the required steps depending on the return code of MB_GetState
. Do not use internal variables within the application for determining the state of a connection. – Please also observe the note on the usage as it is specified for the MB_InitTCP block.
Inputs, return value
|
Identifier |
Description |
|
---|---|---|---|
Inputs: |
|
|
the handle for an existing connection (with initial value |
Return value: |
– |
|
returns the current state of the given connection handle:
|
Input EN
and output ENO
are available when →calling the block. See "Execution control: EN, ENO" for information on input EN
and output ENO
.
See:
-
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
-
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic.
Internal error diagnostic for block
The block checks the following error cases: The LibModbus system service has not been loaded and/or you have no permissions to use Modbus (no enabled feature in the license for the →runtime system).
In such an error case, the output ENO
of the block is set to value FALSE
(or an equivalent).
Example for usage within ST-editor
Best practice in order to get to know the usage of the Modbus blocks: Create a new project based on the project template Moving Light with Modbus Access and study this sample project. This project contains a usage of this block.