Sign in to follow this  
Followers 0
Eradicated

(SCU41-V1) Modbus Slave - area mappings

5 posts in this topic

So I've been trying to reduce the work that I'm bound to do by using built-in Modbus Slave mode in CJ1W-SCU41-V1 rather than writing my own protocol based on TXDU/RXDU functions. Now I would like to focus on coils in Modbus, as I've encountered a little problem here. According to the manual W336-E1-10 I can map either CIO, W, H or A area to coils in Modbus Slave mode (page 302 of the manual at the very bottom). That's great, as due to some limitations I have to use Work area in this case and that's how the comm port has been setup. So I've started my testing and where it comes to 0x05 Modbus function (write single coil) everything works just fine, setting/resetting desired bit in the Work area. And that would be enough if I wouldn't have to use 0x0F (write multiple coils) function. I've been pretty amazed that if I use 0x0F function it writes coils not in the Work area, but in the CIO area! At first I thought that I've found a bug, until I came across a description on the page 316 of above-mentioned manual, i.e.: "Writes multiple bits in I/O memory. Allocated memory is in the CIO Area (fixed)." So as I see I can map the area for Modbus coils to Work memory area, but it only works for 0x05 function and not for 0x0F? That's a little bit of nonsense to me, what is the point in it? So now I would like to ask someone who had to deal with this issue in the past: do I have to write my own procedures for Modbus (rather than using built-in mode) if I want functions 0x05 and 0x0F write in the same memory area, other than CIO area? I know I can make these both function write in the CIO area, but that's not possible in my case. Edited by Eradicated

Share this post


Link to post
Share on other sites
Since I haven't found workaround for the problem (it seems that it is impossible to define memory area for 0x0F function). That'is why I have decided to implement my own code for Modbus RTU Slave. Yet I have encountered another problem. Does anyone have an idea how to manage 3.5T character time as frame delimiter (according to Modbus standard)? In general I could continuously check the receive buffer every cycle and verify if it doesn't change in consecutive cycles and on that basis decide whether a transmission is over. Or define time value in [ms] for the same purpose to check if transmission is over. However this would require the master to query my slave with certain time delays (e.g. 0.5 ) to allow for processing in PLC. So this is doable. But is there any way to detect this 3.5T character time via some built-in function in SCU? Does anyone have an idea? I am asking, as even the Modbus Slave protocol macro waits for defined number of characters and not relies on this delay time. I would be grateful for any advice.

Share this post


Link to post
Share on other sites
No need - you have to define your work areas for Modbus slave in the card setup and it works easily. Go to IO Table and Unit Setup - open the serial card - select which areas you wish to use for cils area, input registers and holding registers - you can define them to wherever you wish. one of the things I really love about Omron - you can do what you want and are not bound by some European company who knows everything!

Share this post


Link to post
Share on other sites
That's right, I can select the work area for the Modbus coils area: Though, according to the manual (W336-E1-10, page 316) when it comes to write multiple coils Modbus function the area is fixed (i.e. "Allocated memory is in the CIO Area (fixed)."). So even though I have selected the W area for the coils, this function will always write to CIO area. It seems to me that someone at Omron didn't have the time to do the work the way it should be done. And since I cannot use CIO area for the coils and have to use write multiple coils during communication, I have to implement my own protocol. Edited by Eradicated

Share this post


Link to post
Share on other sites
I cannot understand why you do not want to use CIO - it is a huge mud map and I would be surprised if you ever use it up. I hardly ever use the W area for anything - just allocate CIO as I wish.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0