B&R X20CS1030 modbus module

Dear All,

I have used X20CS1030 module with my PLC 4PPC70 and trying to do modbus data read/write through RS285 with temperature card local make in which i am facing issue of reading & writing the value from temperature card.

As i have used DRVmbus task in my logic and looking for some sample project in which data is read/write using modbus protocol.

I would really appreciate the efforts for solving the issue.

Thanks & Regards,
Shrenik

Hi Shrenik,

The AS Help includes examples on how to use the DRV_mbus library.
Please follow the link and you will find an examples on how to implement a MODBUS client. The examples can be imported as samples in to your project.

Have “Logical view” selected and in the “Toolbox” on the right hand side type in “samp” and it will filter out “Library Samples”. Click on library samples, select library in the tree, and then the name of the library, and thereafter you will see a task that will be added to you logical view.

Link to example in manual

Hope it helps!

Regards // Johan

Dear Johan,

Thanks for sharing the details and I appreciate your support.
I have implemented that sample example of DRV mbus in my project and I am able to read / write the data on slave ID -1.
But I have one query I want to read/write data to slave ID-1,2,3,4 & 5, so how to configure the multiple slave id in the logic.

Thanks & Regards,
Shrenik

Hello Shrenik,

In the LibDRVmbus1_ST example, there is a column in the data object for the target address of the slave station. This is where you designate which server/device (slave) station the Modbus command is for. When editing the data object, remember that data objects are byte aligned, not delimited. Meaning the data object cares about the number of characters used in each field (use the example as your guide).

If you are instead using the one-shot MBMCmd() function block, then you would place the server/device ID in the “node” input of the function block.

Dear Austin,

As I want to read/write the data instantly because I have developed 5 embedded cards in which I have to read the keys & write the leds of embedded card using modbus rtu.

So my concern is there are 5 slave id’s in which I have to send and receive the data from my PLC.

"LibDRVmbus.EventPV3 ", 03, $01, "LibDRVmbus.LocalPV3 ", 0000, 0001 ;Reading Keys
"LibDRVmbus.EventPV4 ", 16, $01, "LibDRVmbus.LocalPV4 ", 0001, 0001 ;Writing LEDs

"LibDRVmbus.EventPV5 ", 03, $02, "LibDRVmbus.LocalPV5 ", 0000, 0001 ;Reading Keys
"LibDRVmbus.EventPV6 ", 16, $02, "LibDRVmbus.LocalPV6 ", 0001, 0001 ;Writing LEDs

I have updated the data mod file with slave id 2 but facing delay in reading the variable.

I would really appreciate your support for solving the issue.

Thanks & Regards,
Shrenik

If the EventPV is not specified for an entry, this entry is executed cyclically.
If this is then used for all entries, the plc program is relieved from enabling and disabling the EventPV’s.

With an RS485 interface only one sender can be active at a certain time.
RS485 consists of two wire connection +DATA and -DATA.
So it is not possible to read or write data instantly to multiple nodes.

The master will initiate the communication by sending a modbus frame which contains the node number.
All slaves must be listen to the bus at this point.
The slave which is addressed must deactivate the listen mode of the interface and activate the send mode.
The master must at this point also deactivate it’s send mode and activate the listen mode.
The slave sends an acknowledge messsage if data is written, or send the asked information when data is read.

The master will then activate it’s send mode and will send a modbus frame wich contains the next node number or next modbus command.
This sequence is then reperated multiple times depending on the number of slaves and the number of modbus commands.

This activating and deactivating of the send and receive mode on this two wire RS485 interface takes time and is mostly done with prefined timeouts.

If this is too slow, you could consider connecting RS422 (4 wires).

Or use multiple X20CS1030 cards.
See also attached german pdf of an obsolete module, but with valuable information.
Perhaps somebody could supply the english version of this pdf.
INT1_D_1.PDF (300.7 KB)

1 Like

Corné Geerts provided an excellent explanation about the timing of the RS485 and Modbus over serial. If that doesn’t cover your issue, then please be more specific about the issue you are having.

Attached is the English language manual for the INT1.
INT1_E_1.pdf (1021.4 KB)

1 Like

Dear Corne Geerts,

Thanks for sharing the information.

But I want to know that using x20cs1030 we can communicate one master & one slave id at a time ?

Please let me know.

Thanks & Regards,
Shrenik

Hello Shrenik,
This question was already answered in earlier post.

What problem do you have with the delay you mentioned ?

Dear Corne Geerts,

Thanks for replying.

My question is using X20CS1030 module can communicate with multiple slave id at the same time. If not then I have to used multiple X20CS1030 module for multiple slave id.

Please let me know.

Thanks & Regards,
Shrenik

Hello Shrenik,

I think Corné and I are on the same page, in that we don’t understand what you mean by “facing delay in reading the variable” in your issue description.

Corné’s post answers the question about simultaneous communication to multiple nodes, which is one interpretation of a “delay.”

For example, the following timing is allowed:
TimeStamp[1] = No communication on RS485 line.
TimeStamp[2] = Master: Modbus frame to device #01.
TimeStamp[3] = No communication on RS485 line.
TimeStamp[4] = Device #01: Response to Modbus frame.
TimeStamp[5] = No communication on RS485 line.
TimeStamp[6] = Master: Modbus frame to device #02.
TimeStamp[7] = No communication on RS485 line.
TimeStamp[8] = Device #02: Response to Modbus frame.
TimeStamp[9] = No communication on RS485 line.

The following timing is not:
TimeStamp[1] = No communication on RS485 line.
TimeStamp[2] = Master: Modbus frame to device #01 & device #02.
TimeStamp[3] = No communication on RS485 line.
TimeStamp[4] = Device #01: Response to Modbus frame.
TimeStamp[5] = No communication on RS485 line.
TimeStamp[6] = Device #02: Response to Modbus frame.
TimeStamp[7] = No communication on RS485 line.

My question is using X20CS1030 module can communicate with multiple slave id at the same time. If not then I have to used multiple X20CS1030 module for multiple slave id.

I interpret this question as “Can I achieve Modbus communication to multiple different device ids from the same CS1030 interface?” The answer is yes, you can. The device id for each Modbus command is specified in the data object (or node input of MBMCmd() ) and do not have to be homogeneous for the entire data object. If you are still having issues with the Modbus communication, then we would need more specifics to assist you with the issue.

Dear Austin,

Kindly find the attached code which I am using for Modbus RTU.
modbus rtu.pdf (141.7 KB)

Let me know how to resolve the issue to read/write data with multiple slave id.

If you have any example or code which is running with multiple slave id using X20CS1030 then please share the code.

I would really appreciate your support.

Thanks & Regards,
Shrenik

As @corne.geerts previously wrote, “With an RS485 interface only one sender can be active at a certain time.” It doesn’t matter whose hardware you use. And Modbus is not a fast protocol. Each station might take 50 ms or more to complete one Modbus function’s transaction. (Actual rate varies, but 50 ms is a good estimate.)

In other words, if you execute a write function and immediately execute a read function to confirm the write result, you may be waiting on the order of 100 ms between the start of writing and the end of reading.
if you daisy-chain five Modbus stations to an X20CS1030 and simply read from them over and over, you’re looking at a refresh rate of 250 ms or longer from each station.

Hi @shrenikec,

It looks like you got some good suggestions from other community members, and it has been a couple of weeks since the last activity on this post. Can you please mark the reply that helped you the most as the solution? Or if you still have open questions on this topic, can you please provide an update?

Edit: This reply will be marked as the solution due to inactivity.

1 Like