Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 01:28:46 PM

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 1305 times)
0 Members and 1 Guest are viewing this topic.
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« Reply #10 on: February 25, 2008, 09:15:54 PM »

Well here is my attempt at a working macro.

No laughing allowed.  Grin

I could not grasp the "If Not" thing but this makes sense to me.


'Macropump to activate Auto Tool Zero (M650) from an external switch via input #4
'OEMled 824 or Input 4, will be normally active (1) until switch is pressed/closed (0)

A = GetOEMLed(824)  ' Input 4 LED
B = GetOEMled(164)  ' Spindle Rotating LED
C = GetOEMled(999)  ' System movement Led
D = GetUserDRO(1500)

If A and B and C and D = 0 Then   ' if every one of the three LEDs and one DRO are at zero then the M650 will be run
Code "M650"
SetUserDRO(1500,1)
End if

If A and D > 0 Then     ' if the switch has not been released then A will still be at zero so this will act as a lockout
SetUserDRO(1500,0)
End if


What do you think? 

Greg
« Last Edit: February 25, 2008, 09:55:42 PM by Greolt » Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 760


Briceville, TN, USA



View Profile WWW
« Reply #11 on: February 26, 2008, 09:43:32 AM »

'First off, I would NEVER laugh at you, you can ask Brian, I started off not knowing a darn thing
'Like you I asked questions, and plugged at it and played with it, till I did know, still have alot to learn.


'Here is a correction to your macro below


'Macropump to activate Auto Tool Zero (M650) from an external switch via input #4
'OEMled 824 or Input 4, will be normally active (1) until switch is pressed/closed (0)

A = GetOEMLed(824)  ' Input 4 LED
B = GetOEMled(164)  ' Spindle Rotating LED
C = GetOEMled(999)  ' System movement Led
D = GetUserDRO(1500)

If (A = 0) and (B = 0)  and (C = 0) and (D = 0) Then   ' if every one of the three LEDs and one DRO are at zero then the M650 will be run
Code "M650"            'The INput4 is pressed here and it locks out here
SetUserDRO(1500,1)
End if

If (A = 1) and (D > 0) Then     ' if the switch has been released then A will be at 1 so this will unlock for next press
SetUserDRO(1500,0)            'the input4 switch has been released
End if

'scott
« Last Edit: February 26, 2008, 09:48:06 AM by poppabear » 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 #12 on: February 26, 2008, 05:29:29 PM »

Thanks heaps Scott.

So I got it almost right except I did not know how the "and" statement worked.

That will mean I can have the Input #4 the more logical way.  At rest = 0,  Pressed = 1.

If (A = 1) and (B = 0)  and (C = 0) and (D = 0) Then

If (A = 0) and (D > 0) Then


I only had it around the other way because I thought I needed it to make the "and" work in the first line.

I'm off to test this on my router.

Have in mind to build in a delay so that the switch must be pressed for one second before the M650 will run.

But I will get back to that.   So beware of more questions soon. Grin

Thanks again,   Greg
Logged
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« Reply #13 on: February 28, 2008, 07:44:47 AM »

Scott

I got it to work.  Had to go with "IsActive(INPUT4)" as the "GetOEMLed(824)" would not work for some reason.

I tried to use "Ismoving()"  instead of  "GetOEMled (999)"  to check for system movement but could not figure how to get it to work.

Any ideas?

Greg




'Macropump to activate Auto Tool Zero (M615) from an external switch via input #4

A = IsActive (INPUT4)  ' Is switch pushed
B = GetOEMled (164)   ' Spindle is Rotating LED
C = GetOEMled (999)   ' System movement LED
D = GetUserDRO (1140)

If A And (B = 0) And (C = 0) And (D = 0) Then
Code "M615"
SetUserDRO(1140,1)
End If

If (A = 0) And (D > 0) Then
SetUserDRO(1140,0)
End If

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

Posts: 760


Briceville, TN, USA



View Profile WWW
« Reply #14 on: February 28, 2008, 08:32:58 AM »

try

C=IsMoving()

If A And (B = 0) And (C = Flase) And (D = 0) Then

Try these replacements see if it makes a difference, I havnt tested this, I am at work.

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 #15 on: February 28, 2008, 08:46:40 AM »

Thanks Scott.

Will try in the morning.  1:00 AM here.  Smiley

Greg
Logged
Greolt
Global Moderator
*
Online Online

Posts: 351


View Profile
« Reply #16 on: February 28, 2008, 07:52:56 PM »

Scott

I have it all working as I wanted.

Using the brain to apply the switch delay (for safety)

Brain also takes care of checking that spindle and movement are not active (more safety)

Then hands it over to the macropump  ( a simpler version now)

It has the interlock and triggers the M615

I have learnt some new stuff.  Smiley

Thanks heaps for your help Scott

Greg

PS: that Ismoving() worked as you said but I'm not doing it that way now. Smiley
« Last Edit: February 28, 2008, 07:55:41 PM by Greolt » 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!