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

MB_MasterControlStatus

Modbus RTU Master Control Status

Previous pageReturn to chapter overviewNext page

Block that allows monitoring various statuses of the Modbus RTU network master.

 

Ladder Representation

 

MB_MASTERCONTROLSTATUS_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

Execute

BOOL

Block enabling

DisableComm

BOOL

Disables Modbus RTU communication

VAR_OUTPUT

Done

BOOL

Output enabling

CommDisabled

BOOL

Disabled communication flag

TxCounter

WORD UINT

Counter of requests sent

RxCounter

WORD UINT

Counter of telegrams received

NoAnswerCounter

WORD UINT

Counter of requests not answered

ErrorResponseCounter

WORD UINT

Counter of responses received with error information

LastErrorSlaveAddress

BYTE USINT

Slave address in which the last communication error was detected

LastErrorResult

BYTE USINT

Operation result of the last communication error received

(0 = No error)

(4 – Response Timeout)

(5 = Slave returned error)

LastErrorCode

BYTE USINT

Code of the last communication error received

 

Operation

 

This block remains active while Execute is at TRUE level, updating its outputs according to the monitoring of the master and input requests. 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.

 

A TRUE level DisableComm disables the Modbus RTU communication and resets the status counters and markers of the master. These markers and counters are displayed in the output block each having some data corresponding to its description. Their values are also cleared at shutdown of the master.

 

Block Flowchart

 

MB_MASTERCONTROLSTATUS_flowchart

 

Example in Ladder

 

MB_MASTERCONTROLSTATUS_example01

 

The example above requests status data of the Modbus RTU network master, and allows disabling communication through DISABLE. 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

   DISABLE, MB_DISABLE : BOOL;

   COUNT_TX, COUNT_RX, COUNT_NOANSWER, COUNT_ERROR : WORD;

   LE_ADDRESS, LE_RESULT, LE_CODE : USINT;

END_VAR

 

DO1 := FB_MB_MasterControlStatus(

   DisableComm:=DISABLE,

   Execute:=DI1,

   CommDisabled=>MB_DISABLE,

   TxCounter=>COUNT_TX,

   RxCounter=>COUNT_RX,

   NoAnswerCounter=>COUNT_NOANSWER,

   ErrorResponseCounter=>COUNT_ERROR,

   LastErrorSlaveAddress=>LE_ADDRESS,

   LastErrorResult=>LE_RESULT,

   LastErrorCode=>LE_CODE);