I got it partially working. The first part of the setup, setting the VFD modbus params to drive the spindle on/off work fine. Setting the Dir pin on the motor output has no effect, so I turned it off. All I did was set the output for the relay control of the spindle to output #2 which is configured to go to port 0, pin 0. Modbus autopoll is mapped to send the command to the VFD.
Additionally I found that the following VBScript will reverse the spindle direction. I can execute this script before spindle rotation or during rotation, and it reverses direction. (The VFD does a smooth slow down and direction reverse autmatically)
SetModOutput (1, 0) - Clockwise
SetModOutput (1, 1) - Counter Clockwise
How can I hook these script commands into the Mach 3 spindle commands? If I could tell an M3 command to execute the first line, as well as doing the relay control it is already doing, and of course the second line for an M4 command. Is this possible?
I can't get the variable speed to work at all though. The variable speed is in a holding register. I map it to output #64, and it sends out 0 continously so the motor runs at 0 speed. I enable the 'modbus spindle - use step/dir as well' option and put in the max freq the VFD will accept. It still outputs 0 and the motor doesn't turn of course. What am I missing here? While the spindle is running, I can use this command in the script editor to change its speed:
SetModOutput (64, 650)
This sets it to full speed.
So I've got some script commands that work, but I'm not sure what to do with them. Can you point me in the right direction?
--Scott