Hello Guest it is December 21, 2024, 08:26:02 AM

Author Topic: How can I reset Mach4 Modbus through lua?  (Read 3992 times)

0 Members and 1 Guest are viewing this topic.

How can I reset Mach4 Modbus through lua?
« on: August 27, 2020, 08:12:15 PM »
I am developing tool changer using an arduino, and have set up communications to Mach4 using the Modbus plugin. This part was way easier to set up than I expected.

I am adding a tool changer tab to the mach4 operator screen. This will show the status of the tool changer arduino, give the capability to do manual control operations, show arduino I/O statuses, etc.

I want to add button to this screen to re-initialize the modbus connection in case it has an error, such as happens if the Ethernet cable is unplugged or the arduino power is cycled. I have discovered that opening and closing the modbus configuration screen will reset the modbus and clear the error. I want to make a button that will perform the same function.

Any advice?

Offline jbuehn

*
  •  101 101
Re: How can I reset Mach4 Modbus through lua?
« Reply #1 on: August 28, 2020, 01:51:44 PM »
I believe you can write "RESTART" to mbcntl/command register.
Re: How can I reset Mach4 Modbus through lua?
« Reply #2 on: August 28, 2020, 06:26:02 PM »
Ha! Thanks for that info. I didn't know about mbcntl/command.

I couldn't get "RESTART" to work, but sending "STOP" and then "START" once the status changes to stopped does what I want.

You made my day. Thanks again.