Lacey Posted February 27, 2019 Report Posted February 27, 2019 I need to read multiple Modbus registers from a non Unitronics controller. These registers are not consecutive registers. What is the best way to do this? Multiple Read Holding Registers (3) one after another? Rung examples of your ideas would be most helpful and appreciated. Thanks!!!
MVP 2023 Ausman Posted February 28, 2019 MVP 2023 Report Posted February 28, 2019 Any multiple register read I put into a vector of MIs, and then pick out the ones I want to work with by using the store function to put them into other MIs, or put them in a data table. What I also do during this transition is have a +/- addition going on, that lets me fine tune readings to my external master, be it pressure, temp etc. I try to never adjust a sending device direct. cheers, Aus
MVP 2023 Flex727 Posted February 28, 2019 MVP 2023 Report Posted February 28, 2019 16 hours ago, Lacey said: I need to read multiple Modbus registers from a non Unitronics controller. These registers are not consecutive registers. What is the best way to do this? Multiple Read Holding Registers (3) one after another? Rung examples of your ideas would be most helpful and appreciated. Unitronics MODBUS communications are very forgiving in my experience. If the registers are non-consecutive, but not too far apart it's probably easier to read the entire vector that encompasses the data you want and then select what you need via ladder (as Ausman suggests above). If the registers are too spread out (total vector >120 registers) then you can certainly do consecutive reads. If there are a large number of them, then set up timers to read them individually, but if you just need a small number read, they can be read in the same cycle. The example below shows both a read and write in the same PLC cycle (using MODBUS TCP/IP). The second one just waits until the first one is complete (due to MB 20). If you're not sure, just try it - you won't break anything.
John_R Posted March 8, 2019 Report Posted March 8, 2019 +1 to both Aus and Flex regarding reading an entire vector and picking out what you want if they are close, or separate reads if they are spread out. Similar to Flex's example, I typically use a state machine of sorts, to step through each read via an index count (which is reset after the last read).
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now