Hi Zuxztah,
have you enabled the spindle rate over-ride, I suspect not. Also have you set up at least one range in Machs Spindle page?, I suspect not.
Without it the max and min spindle speeds are both zero. Have a look at the screen shot.
For the required spindle over-ride enable try this code:
---------------------------------------------------------
-- set Target RPM DRO
---------------------------------------------------------
RPM=mc.mcCntlGetPoundVar(inst,2132);
mc.mcSpindleSetOverrideEnable(inst,1);
local OVRenable=mc.mcSpindleGetOverrideEnable(inst);
if OVRenable then;
local OVR=mc.mcSpindleGetOverride(inst);
RPM=RPM*OVR;
end;
local range=mc.mcSpindleGetCurrentRange(inst)
if RPM>mc.mcSpindleGetMaxRPM(inst,range) then RPM=mc.mcSpindleGetMaxRPM(inst,range) end;
if RPM<mc.mcSpindleGetMinRPM(inst,range) then RPM=mc.mcSpindleGetMinRPM(inst,range) end;
local freq=RPM/6;
local hfreq=mc.mcRegGetHandle(inst,"modbus0/freq");
mc.mcRegSetValue(hfreq,freq);
scr.SetProperty('dro(128)','Value',tostring(RPM));
Whether you chose to add dro(128) is up to you.
Craig