Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 08:05:16 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Brains Development
| | |-+  Terminate a brain with "run macro M650.m1s" ???????
Pages: 1 2 »   Go Down
Print
Author Topic: Terminate a brain with "run macro M650.m1s" ???????  (Read 1304 times)
0 Members and 1 Guest are viewing this topic.
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« 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
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 760


Briceville, TN, USA



View Profile WWW
« 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
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« Reply #2 on: February 21, 2008, 06:05:24 AM »

Thanks very much Scott.

I have read through your post about ten times.  Smiley

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.  Smiley

Greg
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 760


Briceville, TN, USA



View Profile WWW
« 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
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« 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. Smiley

Will have some more questions then. Grin

Greg
Logged
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« 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. Huh

Greg
« Last Edit: February 25, 2008, 07:19:33 AM by Greolt » Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 760


Briceville, TN, USA



View Profile WWW
« 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
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« 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 » Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 760


Briceville, TN, USA



View Profile WWW
« 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
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« 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
Logged
Pages: 1 2 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!