Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: mongkol on August 11, 2011, 09:18:02 AM

Title: How to write macro to control two spindle motor ?
Post by: mongkol on August 11, 2011, 09:18:02 AM
Hello,
I need the help. Right now I have two spindle on Z- axis. If I fill MDI on mach3 screen with M03,two spindles will rotate simultaneously.
I  want to control two spindles independently. I don't know how to write macro.
I mean if I write M101,the A spindle will rotate but the B spindle will not.
           If I write M102,the B spindle will rotate but the A spindle will not.

Pls advise me how to write VB macro

Mongkol
Title: Re: How to write macro to control two spindle motor ?
Post by: BR549 on August 11, 2011, 10:38:13 AM
Looks like you have every thing you need now.  M3 turns on both, M101 turns on A,  M102 turns on B. What other possible combos are there??

Just a thought(;-) TP
Title: Re: How to write macro to control two spindle motor ?
Post by: mongkol on August 11, 2011, 10:46:00 AM
TP,
Thanks for the reply. I don't know how to write VB macro on M101 and M102. Pls advise.

Mongkol
Title: Re: How to write macro to control two spindle motor ?
Post by: stirling on August 12, 2011, 05:31:58 AM
Hello,
I need the help. Right now I have two spindle on Z- axis. If I fill MDI on mach3 screen with M03,two spindles will rotate simultaneously.
I'll assume you have BOTH spindles activated/connected via OUTPUT1.

First connect your second spindle to OUTPUT6 (for example) instead.

Now M03 will only activate spindle 1.

Now create another macro (say) M102 with this line...

activateSignal(OUTPUT6).

Then ADD the following to M05

deactivateSignal(OUTPUT6)

Now M03 will turn on spindle 1 and M102 will turn on spindle 2 and M05 will turn off whichever one/or both is on.

(remember to setup OUTPUT6 (or whichever) in ports n pins)

Cheers

Ian
Title: Re: How to write macro to control two spindle motor ?
Post by: BR549 on August 12, 2011, 11:28:09 AM
OK I get what you mean now,sorry.  I think Stirling has you covered on this one.

(;-) TP