Macro M5

Mach3 and Mach4 questions, tips and topics can be posted here
Post Reply
D3workz
1.5 Star Member
1.5 Star Member
Posts: 37
Joined: Wed Jul 29, 2020 10:42 am

Macro M5

Post by D3workz »

Hello guys,

I am new to plasma CNCs and a total idiot in coding. However, I was wondering, can I edit the M5 macro to create a delay before Mach3 switches off the torch relay?

From what I have researched, would one of these be OK:

Sleep(1000)
DospinStop()

OR

While(IsMoving())
DospinStop()

OR

While(IsMoving())
Sleep(1000)
DospinStop()

For some reason I feel like I am wrong in all!

Any help would be appreciated guys.

THanks

Dim
robertspark
4.5 Star Elite Contributing Member
4.5 Star Elite Contributing Member
Posts: 1814
Joined: Mon Jun 12, 2017 6:43 pm

Re: Macro M5

Post by robertspark »

if you go to the config and ports and pins and then spindle tab you can just add a delay there.... no editing required
D3workz
1.5 Star Member
1.5 Star Member
Posts: 37
Joined: Wed Jul 29, 2020 10:42 am

Re: Macro M5

Post by D3workz »

I assume you are referring to the CW Delay Spin DOWN... I ll give it a try.

But in any case, just for learning sake, would any of the above coding I mention work??

Thanks

Dim
robertspark
4.5 Star Elite Contributing Member
4.5 Star Elite Contributing Member
Posts: 1814
Joined: Mon Jun 12, 2017 6:43 pm

Re: Macro M5

Post by robertspark »

D3workz wrote: Tue Aug 04, 2020 10:25 am Sleep(1000)
DospinStop()
Ok, this will do what I think you want to do which is to wait 1 second, and then stop....
Motion would have already stopped by the time an M5 Macro runs given it is a non-synchronous macro (i.e. motion pauses before it is implemented).
D3workz wrote: Tue Aug 04, 2020 10:25 am While(IsMoving())
DospinStop()
This one will just stop the spindle / open the spindle relay (given motion will stop anyway before an M5 is called)

D3workz wrote: Tue Aug 04, 2020 10:25 am While(IsMoving())
Sleep(1000)
DospinStop()
This one is the same as the first one..... because M5 is a non-synchronous macro motion has to stop / pause before it runs..... so while (is moving()) should do nothing or be of no benefit to the macro code.

Sleep obviously puts the macro to sleep for 1000mSec (1sec) and then stops the spindle / opens the spindle relays (M4/M3, whichever are toggled).
Post Reply

Return to “Mach3 & Mach4 CNC”