Jump to content

Modbus RTU to Motor Drive Example


Recommended Posts

Hi Team

After sifting through all of the examples and esp some here posted by Ash Neilson and others, I have come up with something that fits my requirements. (Example based on Ash's Step Logic)

I have had it working for a week now, and ironed out most of the bugs. It is not the most elegant bit of code, but maybe of use to some new players.

Basically I have 3 SEW LTP motor drives. I am interested in 17 registers - non contiguous. Randomly from 0 -181. So I devised a datatable with Slave ID, Register #, Read Value, Write Value and if the register is writeable. A pointer increments after each read/write operation and then loads up the next values for the next operation. if writeable it write's, if not it reads, and it keeps looping.

I did have intentions of assigning a priority system - but haven't figured this out. Also in hindsight should have possibly kept the read and write blocks separate.

Feedback welcomed, hopefully with some more input we could put together a real useful template/example for comms with non Uni devices.

Attached is the example, you are most interested in the "Modbus Step Logic" subroutine and the Modbus datatable. The relevant operands are MI300-MI399

I used the datatables in conjunction with excel to edit operand descriptions, and then imported them back into visilogic. (Can't upload excel files?)

Modbus_Template.vlp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...