2331
Mach4 General Discussion / Re: PMC Help
« on: July 05, 2019, 07:19:48 PM »
Hi Gary,
I just now recall that you had a thread going about using SSRs to reverse a spindle. Could this thread be related to producing
the required delay between operations such that the spindle decelerates BEFORE being switched in the other direction?
If that is the case I have some ideas that may help.
In particular all and every spindle operation is initiated by an m3 (or m4 if CCW). This is true when called from a Gcode program,
an MDI call to rotate the spindle or using the on screen <Spindle CW> (or <Spindle CCW>) button.
I would suggest that you write your own m3, m4 and m5 macros.
Normally m3, m4 and m5 are considered built in Mach macros which you can't altered...right? Well you can, if you write your own
m3 macro say, Mach will use your one in preference to its built-in macro. Mach does this by searching for a valid m3 macro
by in the first instance searching in your profiles macro folder. If it finds one it will use it. If not it will search higher up the search
tree until it fins the built in macro.
The trick is to write your own macro that contains all the Mach needs to operate normally, ie all the standard built in code, but also
any extra code that you want to do a specific thing. In this case the button codes (<Spindle CW> and <Spindle CCW>) are
available for your inspection. Thus being able to in the first instance duplicate, then subsequently modifying it is easy.
The essential benefit about writing your own m3, m4 and m5 is that it becomes fundamental behavior of your machine spindle,
at least with this profile, and that no matter how you turn the spindle on or off (Gcode, MDI, button) the delay will always
be there, not an extra thing you have to add in or otherwise think about.
Craig
I just now recall that you had a thread going about using SSRs to reverse a spindle. Could this thread be related to producing
the required delay between operations such that the spindle decelerates BEFORE being switched in the other direction?
If that is the case I have some ideas that may help.
In particular all and every spindle operation is initiated by an m3 (or m4 if CCW). This is true when called from a Gcode program,
an MDI call to rotate the spindle or using the on screen <Spindle CW> (or <Spindle CCW>) button.
I would suggest that you write your own m3, m4 and m5 macros.
Normally m3, m4 and m5 are considered built in Mach macros which you can't altered...right? Well you can, if you write your own
m3 macro say, Mach will use your one in preference to its built-in macro. Mach does this by searching for a valid m3 macro
by in the first instance searching in your profiles macro folder. If it finds one it will use it. If not it will search higher up the search
tree until it fins the built in macro.
The trick is to write your own macro that contains all the Mach needs to operate normally, ie all the standard built in code, but also
any extra code that you want to do a specific thing. In this case the button codes (<Spindle CW> and <Spindle CCW>) are
available for your inspection. Thus being able to in the first instance duplicate, then subsequently modifying it is easy.
The essential benefit about writing your own m3, m4 and m5 is that it becomes fundamental behavior of your machine spindle,
at least with this profile, and that no matter how you turn the spindle on or off (Gcode, MDI, button) the delay will always
be there, not an extra thing you have to add in or otherwise think about.
Craig