Simple 1-Node Modbus TCP Master
2 members have voted
This is a little Modbus routine I wrote to connect to one remote node, in my case a Dalsa IPD vision device. It's not designed to connect to several devices, just a one-to-one such as my camera setup, a single servo drive or VFD.
As such, it is really optimized for maximum communication to that single device. The module reads the vector of addresses from the slave constantly, as fast as possible. Writes only take place when a value in the Tx Vector is changed. So the PLC always has the freshest possible data in the fastest possible manner.
On the HMI Side, I collected about a dozen different status bits into two message objects, one for the Ethernet adapter and one for the socket.
Special thanks go out to Ash Neilson, who was a tremendous help on getting the serial variation of this running last year.
If you look at the source and find yourself wondering why there are two Socket 3 Busy bits, check out the conversation here:
I hope you find it useful!
TM
Edit: forgot something, added rollover for the RHR / PHR counters and an error count.
1 Comment
Recommended Comments
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