Okay, it was my Modbus configuration. I forgot to +1 to the "Modbus Register" On Teco EV VFD the Run, Stop, Reverse, Forward is register 230 or 00E6H (in HEX). I just needed to input 231 (230+1) to get VFD running. As for the code in Mach4 "m3". This worked for me:
function m3()
inst=mc.mcGetInstance()
mc.mcCntlSetLastError(inst, 'Spindle CW');
hregDIR = mc.mcRegGetHandle(inst, "modbus0/DIR");
mc.mcRegSetValue(hregDIR, 11);
end
Note: 00 = Stop, 01=CW, 11=CCW.
Now I need to find out what variable holds the "S" (speed)
To be clear: When I load a NC program and I have a line with S2000 M3 in it to set the speed and spin direction, I need to understand what variable holds the "S2000" so I can capture it and send it to my VFD.
I'll post my finding when I figure it out.
Thanks, Rick