Hi Zuxztah,
with the screen editor open highlight the very very topmost item of the Screen Tree Manager, your screenset, presumably one you named.
Now open the Events tab and the various scripts are listed, including the PLC script. Open it in the editor as you would a button, ie click on it
and then the rightmost extension.
Scroll down to the last statements of script:
--This is the last thing we do. So keep it at the end of the script!
machStateOld = machState;
machWasEnabled = machEnabled;
Clearly stated these must be at the end of the script. I put the speed code immediately in front of those:
---------------------------------------------------------
-- set Target RPM DRO
---------------------------------------------------------
RPM=mc.mcCntlGetPoundVar(inst,2132);
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));
--This is the last thing we do. So keep it at the end of the script!
machStateOld = machState;
machWasEnabled = machEnabled;
Craig