Navigation:  Equipments (Devices) > PLC200 > Program > Communication Network > Modbus TCP >

MBTCP_ClientControlStatus

Monitoração de Cliente de rede Modbus TCP

Previous pageReturn to chapter overviewNext page

Block that allows monitoring various statuses of the Modbus TCP network client.

 

Ladder Representation

 

MBTCP_CLIENTCONTROLSTATUS_block

 

Block Structure

 

Variable Type

Name

Data Type

Description

VAR_INPUT

Execute

BOOL

Block enabling

DisableComm

BOOL

Disables Modbus TCP 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

LastErrorServerAddress

DWORD

Server address in which the last communication error was detected

LastErrorServerPort

WORD UINT

Server port in which the last communication error was detected

LastErrorUnitID

BYTE USINT

Server UnitID in which the last communication error was detected

LastErrorResult

BYTE USINT

Operation result of the last communication error received

(0 - No error)

(4 - Server response timeout)

(5 - Server returned error)
(6 - Connection to server has failed)
(7 - TCP/IP Connection ended prematurely)

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 TCP communication and resets the status counters and markers of the client. 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 client.

 

Compatibility

 

Device

Version

PLC300

1.30 or higher

 

Block Flowchart

 

MBTCP_CLIENTCONTROLSTATUS_flowchart

 

Example in Ladder

 

MBTCP_CLIENTCONTROLSTATUS_example01

 

The example above requests status data of the Modbus RTU network client, 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, LE_PORT : WORD;

   LE_ADDRESS : DWORD;

   LE_RESULT, LE_CODE, LE_UNITID : USINT;

END_VAR

 

DO1 := FB_MBTCP_ClientControlStatus(

   DisableComm:=DISABLE,

   Execute:=DI1,

   CommDisabled=>MB_DISABLE,

   TxCounter=>COUNT_TX,

   RxCounter=>COUNT_RX,

   NoAnswerCounter=>COUNT_NOANSWER,

   ErrorResponseCounter=>COUNT_ERROR,

   LastErrorServerAddress=>LE_ADDRESS,

   LastErrorServerPort=>LE_PORT,

   LastErrorUnitID=>LE_UNITID,

   LastErrorResult=>LE_RESULT,

   LastErrorCode=>LE_CODE);