Hello Guest it is March 28, 2024, 06:05:34 AM

Author Topic: Terminate a brain with "run macro M650.m1s" ???????  (Read 39488 times)

0 Members and 1 Guest are viewing this topic.

Offline Greolt

*
  •  956 956
    • View Profile
Terminate a brain with "run macro M650.m1s" ???????
« on: February 20, 2008, 06:42:45 PM »
Can I terminate a brain with "run macro M650.m1s"  ?

I want a simple LPT input to trigger a macro.  Are brains the way to do this?

Greg

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #1 on: February 20, 2008, 11:39:26 PM »
Yes, but you will have to use brains and macropump

in brains:

InputX >NOP>UserLED1500  (save as name it, and turn it on in Brain config).

open up VB editor:

put thiis in and Save as "Macropump.m1s":

'Macropump.m1s

X=GetUserDRO(1500)

If GetUserLED(1500) and X=0 Then
code "M650"
SetUserDRO(1500,1)
end If

If Not(GetUserled(1500)) and X>0 Then
SetUserDRO(1500,0)
End If

'remember after you save it as your macropump, then turn on macro pump under general, close and reopen mach, make sure you enabled your triggger brain.
'scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #2 on: February 21, 2008, 06:05:24 AM »
Thanks very much Scott.

I have read through your post about ten times.  :)

Mostly it makes sense. Couple of questions,

The purpose of the brain?  Is that just because I asked how to do it with a brain or is there a purpose for it?  Why not a macro pump alone?

UserLED and UserDRO.  Do they need to actually exist on the screen?  Or can they just be phantoms in the background?

Next question,  the purpose of this is to trigger a Auto Tool Zero routine with an external button press.

Do I need to build in protection against accidental activation while Mach is doing something else?  Running a program or whatever.  Or is Mach going to protect itself from that automatically?

If you have read this far thanks again.  :)

Greg

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #3 on: February 21, 2008, 10:16:09 PM »
I did it with Brian becuase you wanted to do it that way.........hehehehe

You can do it with a Macropump alone if you want.

Yes the Dros and Leds can be invisibable.

No safeties are in it, you would need to put them there.

Scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #4 on: February 22, 2008, 12:11:50 AM »
Thanks Scott

I'll have to get back to this in a couple of days.

We have our Melbourne Australia CNC BBQ on tomorrow and I have stuff to get ready. :)

Will have some more questions then. ;D

Greg

Offline Greolt

*
  •  956 956
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #5 on: February 25, 2008, 05:02:33 AM »
Scott

I have looked at this macro till my old brain hurts and I just can't get my head around it.

What is the purpose of reading and setting  "UserDRO (1500)"  ?

If I could grasp that the rest looks easy.

X=GetUserDRO(1500)

If GetUserLED(1500) and X=0 Then
code "M650"
SetUserDRO(1500,1)
end If

If Not(GetUserled(1500)) and X>0 Then
SetUserDRO(1500,0)
End If


Despite searching for a while, I don't understand the "If Not" .  Perhaps if I did the rest would make sense. ???

Greg
« Last Edit: February 25, 2008, 07:19:33 AM by Greolt »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #6 on: February 25, 2008, 11:51:58 AM »
DRO 1500 is a "Lock out", it only allows the code to run ONE time in the macro pump per push and release of the button. Otherwize the macropump would hit the command several times before you could remove your finger.........

scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #7 on: February 25, 2008, 05:34:49 PM »
OK let me ask about the "If Not"

It is this that is a sticking point in my grasping it.

This is my best guess at what it is,

If Not(GetUserled(1500)) and X>0 Then

Means

If GetUserLed(1500)  is zero and X > zero Then

Is that right?

Greg
« Last Edit: February 25, 2008, 06:01:58 PM by Greolt »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #8 on: February 25, 2008, 08:26:29 PM »
hehehehe isnt logic FUN!!!!

  the If Not looks to see if it is OFF and if it is off that condition is TRUE cause the NOT inverts the logic............

Scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #9 on: February 25, 2008, 09:00:22 PM »
So then I gather my example , the second one, is sort of right?

I know that it is not usable VB,  but is that what the first one means?

Thanks,  Greg