Navigation:  Equipments (Devices) > CFW500 > Ladder > Communication Network > Modbus RTU >

MB_SlaveStatus

Modbus RTU Slave Status

Previous pageReturn to chapter overviewNext page

Block that allows monitoring the status of 4 slaves of the Modbus RTU network.

 

Ladder Representation

 

MB_SLAVESTATUS_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

Execute

BOOL

Block enabling

ErrorsToSetOffline#

BYTE

Amount of errors that the master must identify until it considers communication with an offline slave

AddressSlave1#

BYTE

Slave address 1 to be monitored

AddressSlave2#

BYTE

Slave address 2 to be monitored

AddressSlave3#

BYTE

Slave address 3 to be monitored

AddressSlave4#

BYTE

Slave address 4 to be monitored

VAR_OUTPUT

Done

BOOL

Output enabling

GeneralOffline

BOOL

Flag indicating any one of the monitored communication is offline

Slave1Offline

BOOL

Flag of offline status slave 1

Slave2Offline

BOOL

Flag of offline status slave 2

Slave3Offline

BOOL

Flag of offline status slave 3

Slave4Offline

BOOL

Flag of offline status slave 4

 

Operation

 

This block remains active while Execute is at TRUE level, updating its outputs according to the number of errors recorded for each slave. When Execute receives FALSE level, the inputs are ignored and the outputs are zeroed. The Done output receives TRUE level when Execute has TRUE level and block finished its execution.

 

The ErrorsToSetOffline # input allows registering the number of errors identified in a slave that will feature an offline communication. AddressSlave inputs allow inserting four slave addresses to be monitored. When this monitored slave reports the programmed number of errors, its corresponding SlaveOffline output is set to TRUE level. If any of SlaveOffline outputs is at TRUE level, GeneralOffline also receives TRUE level.

 

Block Flowchart

 

MB_SLAVESTATUS_flowchart

 

Example in Ladder

 

MB_SLAVESTATUS_example01

 

The above example checks the number of error responses sent by the slaves 2, 4, 6 and 8 of the Modbus RTU. If any of them is greater than 5, its SX_OFF status is led to TRUE level. The block ends successfully, Done output is activated.

 

Example in ST

 

 The example below displays the instructions for applying the example above in the ST language.

 

 

VAR

   ANY_OFFLINE, S1_OFF, S2_OFF, S3_OFF, S4_OFF : BOOL;

END_VAR

 

DO1 := FB_MB_SlaveStatus(

   Execute:=DI1,

   ErrorsToSetOffline:=5,

   AddressSlave1:=2,

   AddressSlave2:=4,

   AddressSlave3:=6,

   AddressSlave4:=8,

   GeneralOffline=>ANY_OFFLINE,

   Slave1Offline=>S1_OFF,

   Slave2Offline=>S2_OFF,

   Slave3Offline=>S3_OFF,

   Slave4Offline=>S4_OFF);