BobB

Multiple Modbus RTU Reads

4 posts in this topic

I normally use the PMCR system for Modbus RTU reads but have an absolute heap on this job I am working on (4 serial cards - stuff from everywhere) so have decided to use the function block method - it will be easier.

Attached is a file which is my method that I hope will work for a small part of the job. I have used a counter to step the reads and a bit counter to count the done bits and step the counter on to the next read. Not sure if this will work but assume that when a done bit turns on and the counter moves to the next read the done bit will turn off and then when the next read takes place that done bit will turn on and step the counter again.

If any of you have used this before would you mind checking my code please. If it will not work I do not want to be programming a heap of stuff that will not work.

Thanks for any comments.

Modbus Sample.cxp

Share this post


Link to post
Share on other sites

Oooh - no takers? Surprised. Michael Walsh?

Share this post


Link to post
Share on other sites

Sorry, I have not been on here very much as of late.  Trying to catch up.  Conceptually, it looks like it will work.  I would use one Function block and move the info to the inputs and then move away the output data for each execution.  If you compile this code, it fails because the FBs take up too much non-retained memory and the defaults need to be changed.  That being said, if you change the default memory allocations to accommodate the FBs, it should work as is.  

Share this post


Link to post
Share on other sites

Thanks Michael - yes - memory has been moved and expanded to E.

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