Hello Guest it is March 06, 2021, 07:32:26 PM

Author Topic: New to macros; do macros run only when needed?  (Read 4677 times)

0 Members and 1 Guest are viewing this topic.

New to macros; do macros run only when needed?
« on: January 28, 2015, 12:47:05 PM »
I have had no luck getting homing to work on my machine, so I've decided to write a macro that should do what I want. This macro should set the DRO of X axis to zero if the switch wired to input#1 is tripped, and then reverse away from it. Not tested yet, as I'm not near the machine.

If IsActive(INPUT1) Then 'if switch is triggered
   DoOemButton (250)     'stop X axis
   Code "G92 X0"            'zero X axis
   Code "G00 X10"          'move away from switch
   While IsMoving()
   Wend
End If

This should allow me to zero from my Gcode program.

Can I call this macro when needed by using an M command in the Gcode? Would it switch off after it has returned to the main Gcode?
The problem is, I only need this to happen once in each file, but if the macro is constantly running in the background checking the input, it will use a lot of processor power; not good.

Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: New to macros; do macros run only when needed?
« Reply #1 on: January 28, 2015, 10:11:41 PM »
What about HOMING does not work for you?

(;-) TP
Re: New to macros; do macros run only when needed?
« Reply #2 on: January 29, 2015, 05:14:36 AM »
Have a look at my previous post, it explains in detail what happens when I try to home an axis... I still don't know why it behaves like that; I'm having more luck at the minute writing macros!

Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: New to macros; do macros run only when needed?
« Reply #4 on: January 29, 2015, 10:37:48 AM »
Are you sure you have the switches setup correctly ? I have never seen Mach3 not home if setup correctly.

If you look on the diagnostics page and push the switch manually does the correct HOME led light up and then go OUT when you release the switch?

AND no your macro will not work correctly.

(;-) TP
Re: New to macros; do macros run only when needed?
« Reply #5 on: January 29, 2015, 12:40:23 PM »
I changed the macro a bit, it works now, although I'll probably also try a different approach to see if that works.. My ports and pins and homing are all set up correctly as far as I can see, the correct leds (M1 Home, M2 Home) light on the diagnostic page when I manually trigger the X home switch while the command 'G28.1 X0' is running. And yet Mach still ignores my home switch when I trigger it... Same thing happens during Y axis home. These are the only 2 axes configured at the moment.

Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: New to macros; do macros run only when needed?
« Reply #6 on: January 29, 2015, 01:00:16 PM »
Are you running with the LPT driver OR using an outside motion controller ??

(;-) TP

Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: New to macros; do macros run only when needed?
« Reply #7 on: January 29, 2015, 01:12:14 PM »

As a test from the diagnostic page, trip the X axis HOME switch and see if the A home LED lights up.

IF so then from the MDI (same page) give a command to home X , G28.1 X0.  While it is moving trip and release the X home switch. Does Mach3 stop ?

(;-0 TP

Re: New to macros; do macros run only when needed?
« Reply #8 on: January 29, 2015, 01:31:30 PM »
It's 2 parallel ports, and 2 pmdx 122 breaker boards, only using the inbuilt (non PCI card) port currently. I disabled Y home; now X home is the only home enabled. I have no A home at this point, although I have an A axis.

Only M1 home (which is X) lit in 1st test, 2nd test gave same results as previously, ie mach ignores me tripping home switch. Was watching diagnostic page in 2nd test, M1 home lit.

Offline BR549

*
  •  6,944 6,944
    • View Profile
Re: New to macros; do macros run only when needed?
« Reply #9 on: January 29, 2015, 01:45:10 PM »
Is this a licensed version OR DEMO ?

Goto HELP then About .  does it say DEMO ?

(;-) TP
« Last Edit: January 29, 2015, 01:46:53 PM by BR549 »