Requesting Modbus Ladder Examples

P

Thread Starter

Plumstogo

Hello! I am using a Twido (Master) controller to communicate to 2 devices (Slaves). The slaves devices can only handle requests of 10 words at a time. It is required to read 45 word from each device. The 1st word of each device is called a Telegram and always returns a value of 900 when communicating. Currently, my ladder program uses a counter to increment through 5 read request per device. My problems is how do you determine when a device stops communicating with the master and which device? I am also looking for sample Echange and Message example code.
 
M

Mathieu Lachance

Hi!

Check with your local Schneider specialist if he can send to you the Modbus communication macro and the documentation.

We used it in an application where there's a Twido (master) communicating with a Modicon Quantum PLC (slave) and it's quite easy to use.
 
I can Email you an example application. There is an explanation of the EXCH / Message function in the Twido software manual, but its not as clear as it should be.

Email me

[email protected]
 
use the EXCH instruction to send your read request
and verify that the request has ended well by testing
the relevant MSGx.D bit (1: request ended, 0 request under way) and MSGx.E bit (0 : no error, 1 last request ended on error) your application could be (in IL) :

xxx (fill the comm table)
EXCH1(%MWx:y) (* first *)
[%MWz := 1] (* message counter *)

LD MSG1.D (* request ended *)
ANDN MSG1.E (* no error *)
AND [ %MWz < max_counter_value ]
xxxx (* modify the comm table for next request *)
yyyy (* process the received values *)
EXCH MSG1(%MWx:y)(* send next request *)

LD MSG1.D (* request ended *)
AND MSG1.E (* error *)
yyyy (* do what you need to treat the error *)

... and so on
 
Top