6501
Mach4 General Discussion / Re: Mach4 Spindle At Speed, Spindle Zero Problem
« on: September 30, 2017, 02:53:28 PM »
Hi,
first you need to add the two signals into the signal library, its a table called SigLib in the screen load script, add the following:
This allows you to use AtSpeed and IsStopped global variables throughout Mach. If you have a look at the bottom of page 9 and the top of page
10 of the LUA Scripting Guide in your Mach4 Help Docs you will see that Mach4 has built-in m3, m4 and m5 which cannot in fact be altered. What
you can do is write your own m3, m4 or m5 and Mach will execute your script instead. Any functionality in Machs internal script will have to be duplicated
in your external script in addition to whatever extra 'fruity bits' you want to happen.
Next little trap is that you should name your scripts with lowercase m and the script number without leading zeros. Thus M03 is likely to result in error
whereas m3 will be fine. Remember if Mach doesn't find your script it will use its own, if you name your script badly it may miss the fact that its there.
I will gather some more info and comeback with some suggestions.
Craig
first you need to add the two signals into the signal library, its a table called SigLib in the screen load script, add the following:
Code: [Select]
[mc.ISIG_SPINDLE_AT_SPEED] = function (state)
if (state==1) then
AtSpeed=1
else
AtSpeed=0
end
end,
[mc.ISIG_SPINDLE_AT_ZERO]= function (state)
if (state==1) then
IsStopped=1
else
IsStopped=0
end
end,
This allows you to use AtSpeed and IsStopped global variables throughout Mach. If you have a look at the bottom of page 9 and the top of page
10 of the LUA Scripting Guide in your Mach4 Help Docs you will see that Mach4 has built-in m3, m4 and m5 which cannot in fact be altered. What
you can do is write your own m3, m4 or m5 and Mach will execute your script instead. Any functionality in Machs internal script will have to be duplicated
in your external script in addition to whatever extra 'fruity bits' you want to happen.
Next little trap is that you should name your scripts with lowercase m and the script number without leading zeros. Thus M03 is likely to result in error
whereas m3 will be fine. Remember if Mach doesn't find your script it will use its own, if you name your script badly it may miss the fact that its there.
I will gather some more info and comeback with some suggestions.
Craig