Re: Using Modbus to communicate with other MODBUS devices


[ Follow Ups ] [ Post Followup ] [ Internet PLC Forum ] [ FAQ ]

Posted ByCK Tan on September 12, 2001 at 14:09:52:

In Reply to: Modbus posted byLuc Bastien on September 12, 2001 at 13:51:53:

A MODBUS master is one that can actively send out MODBUS RTU commands to command other slaves to do something or respond with required data.

A MODBUS slave waits for MODBUS commands coming from external host and responds with requested data or carry out the action.

The T100MD is able to handle MODBUS commands both as a master and as a slave. To communicate with external computing devices to exchange data, the program will differ depending on the role it is supposed to play.

I will try to explain how to achieve it in the two scenarios:

1) PLCs act as slaves
==================

In this case, there really isn't much programming involved other than execution of the ADC(n) commands to periodically read the ADC data into internal memory so that the external MODBUS host can query them.
e.g.
| Clk:0.1s Fn_#10
|----||-----------------------{dCusF}
|

Within the custom function #10 you just need a simple FOR NEXT loop to read the ADC value into internal data memory:

FOR I = 1 TO 8
DM[I] = ADC(I)
NEXT

Multiple T100MD PLCs can each be assigned a unique ID and connected to the host via RS485 so the host can address the PLC individually.

The DM[1] to DM[8] memory location which we used to store the ADC are mapped into the MODBUS word address 1000 to 1007 (decimal) (NOTEL: if you use Modicon's I/O address notation, then the holding registers are said to occupy from address: 41001 to 41008, which in MODBUS specification is defined as 1000 to 1007!)

1) PLCs act as Master
==================

In this case, the PLC need to send out the data to an external MODBUS slave device. Reading of the ADC data is the same as above, but you need to use the WRITEMODBUS command to send data out of the PLC:

E.g. Within custom function
----------------------

WRITEMODBUS 13, 2, 1234, DM[1]




Follow Ups



Post Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Internet PLC Forum ] [ FAQ ]