Hello Guest it is June 16, 2019, 05:33:14 PM

Author Topic: Spindle button and M3 and M4  (Read 4974 times)

0 Members and 1 Guest are viewing this topic.

Offline Davek0974

*
  •  2,539 2,539
    • View Profile
    • DD Metal Products Ltd
Re: Spindle button and M3 and M4
« Reply #20 on: September 15, 2016, 04:24:04 PM »
Hi

reply no.16 has your answer, it all lives in the spindle toggle button.

One thing you may find with Mach is that there are few bullet proof solutions - many ways to solve most issues :)

Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Spindle button and M3 and M4
« Reply #21 on: September 16, 2016, 04:06:54 AM »
Just a thought but...

you start Mach and command M4, then M5. You then hit the spindle button - which way does the spindle turn?

I wonder if your original mods to M3/4 would give a more consistent feel.

Up to zmajmr I guess.

now if only there was a list of variables or a way of finding free ones ???

Not sure there's a definitive list but do some searches - there's bits and pieces scattered about - think of it as Mach3 Pokemon go  ;D.

also interesting info on destroying variables (BASIC) :)

The variables you create in a macro are all local, so like any other similar language, they are created and destroyed with each invocation.

Offline Davek0974

*
  •  2,539 2,539
    • View Profile
    • DD Metal Products Ltd
Re: Spindle button and M3 and M4
« Reply #22 on: September 16, 2016, 04:43:04 AM »
Well, with the code all in the spindle button, it will rely on the status of the spindle LED's in Mach - providing these work it shouldn't matter if you pressed M4 M5 M4 M5 or whatever - it examines the status of those led's at the instant you press the toggle button ;)

Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Spindle button and M3 and M4
« Reply #23 on: September 16, 2016, 05:22:44 AM »
Nope.

You start Mach and do an M4 - spindle CCW
You do a M5 - spindle stopped.
You hit the button - both leds are off so it goes to the else clause to turn it on.
But which way?
Well - 1601 has never been touched yet so it's zero
So your spindle starts CW. - i.e. NOT what it was last doing.

Offline Davek0974

*
  •  2,539 2,539
    • View Profile
    • DD Metal Products Ltd
Re: Spindle button and M3 and M4
« Reply #24 on: September 16, 2016, 05:44:47 AM »
Ah, i was wondering when you would spot that one :)

Definitely better to put the SetVar bits in the M3/M4 then I think, that would solve it, presuming there is no sneaky macro stuff running elsewhere calling an ActivateSignal(OUTPUTxx) :)
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Spindle button and M3 and M4
« Reply #25 on: September 16, 2016, 05:54:54 AM »
presuming there is no sneaky macro stuff running elsewhere calling an ActivateSignal(OUTPUTxx) :)

well indeed - but if you have a system that does that I'd suggest a career in piano playing is not going to end well.  ;)

Offline Davek0974

*
  •  2,539 2,539
    • View Profile
    • DD Metal Products Ltd
Re: Spindle button and M3 and M4
« Reply #26 on: September 16, 2016, 06:11:18 AM »
LOL ;)
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline Davek0974

*
  •  2,539 2,539
    • View Profile
    • DD Metal Products Ltd
Re: Spindle button and M3 and M4
« Reply #27 on: September 16, 2016, 06:14:18 AM »
So, to the OP,

In your M3 macro

Add...
SetVar(1601,0)

In your M4 macro

Add...
SetVar(1601,1)

In your spindle toggle code, find the line that says DoSpinCW() and put a ' at the start so it looks like 'DoSpinCW()

Then Add...

Code: [Select]
  If GetVar(1601)=0 Then
    DoSpinCW()
  Else
    DoSpinCCW()
  End If

Sorted :)
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Spindle button and M3 and M4
« Reply #28 on: September 16, 2016, 06:43:24 AM »
Nooooooooooooooooooooooooooooo...  ;D

You've gone back to where you started.

See reply #7

Offline Davek0974

*
  •  2,539 2,539
    • View Profile
    • DD Metal Products Ltd
Re: Spindle button and M3 and M4
« Reply #29 on: September 16, 2016, 06:58:27 AM »
Ah crap, i am trying to run a printing press at the same time though ;)(

This was the bit i wanted...

Code: [Select]
If GetOEMLed(164) or GetOEMLed(165) then
  DoSpinStop()
else
  If GetVar(1601)=0 then
    DoSpinCW()
  Else
    DoSpinCCW()
  End If
End if
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives