Controlling spindle using python scripts and Modbus TCP

More
10 Oct 2025 03:36 #336181 by davidgill
Hi All,
I have been playing with this for days and have not cracked it. I was using AI for answers but every solution failed. I want to do the following. I have the python code sorted but getting LinuxCNC to call the python scripts seems to be the problem. The python script sets the Modbus TCP registers on the VFD.Spindle forward, pass the value 1 to my python script as an argSpindle reverse, pass the value 2 to my python script as an argStop spindle, pass the value 5 to my python script as an argSpindle speed, pass a value between 0 and 200 to a python script.can anyone offer a solution. Cheers
 

Please Log in or Create an account to join the conversation.

More
10 Oct 2025 06:43 #336183 by Hakan
Sounds like a user component.

There are some examples, for example the mitsub_vfd.py here github.com/LinuxCNC/linuxcnc/tree/master/src/hal/user_comps

Please Log in or Create an account to join the conversation.

More
10 Oct 2025 20:38 #336230 by andypugh
import linuxcnc and hal into the Python script, then create HAL pins to receive the spindle commands from HAL.

Load the Python script at load-time with a "loadusr" command in the HAL.

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum