Hello Guest it is April 23, 2024, 05:14:46 AM

Author Topic: Proper M code Macro?  (Read 6911 times)

0 Members and 1 Guest are viewing this topic.

Proper M code Macro?
« on: February 23, 2007, 08:26:47 PM »
I have a Vacuum pump activated from Output 4 
I created a Macro M88.m1s which contains;  DeActivateSignal(output4)
I wanted to put an M1 and then an M88 at the end of my gcode to turn of the vacuum when the part was finished provided optional stop is not active.  That works fine.

However, If the Vacuum is running and I open a Gcode file into Mach, Mach somehow acts upon the M88 shutting down the vacuum, without running the Gcode.  It seems as if the quick run through mach does to generate the toolpath view calls the M88.  This is not the case with M5 for instance though.

Any Ideas as to how I can prevent this?

I am running Mach 3Version R2.0.040 now but I first noticed it with version 1.83.041
the end of my Gcode files looks like this:
N99 G0X0.0000Y0.0000Z3.0000
N100 M9
N101 M5
N102 G0Z3.0000
N103 G53 Z-1.000
N104 M1
N105 M88
N106 M30

Thanks!

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: Proper M code Macro?
« Reply #1 on: February 24, 2007, 04:44:56 AM »
Hi Chris,

if you change your macro to check if mach is running it should fix your problem

try something like :-

IF OEMLED(804) THEN ' 804 is the cycle start led
  DeActivateSignal(output4)
ENDIF

Graham.
Without engineers the world stops

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Proper M code Macro?
« Reply #2 on: February 24, 2007, 06:26:51 AM »
Hey Chris,
    How about posting some Pics of that fine machine.

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Proper M code Macro?
« Reply #3 on: February 24, 2007, 10:22:32 AM »
Thanks Grahm, 
I tried:
If getOEMLED(804)=0 Then
  DeActivateSignal(output4)
End If

I get the same result or if (804)=1 then it simply doesn't turn off the Output at all.

I am curious How does an M9 work?  I know it is not listed as a Macro, but I need an M88 linked to Output#4 to
work similar to an M9.  M9 doesn't turn coolant off upon loading Gcode.

I said similar to an M9 because Upon pressing Stop M9 turns off and I do not want that with M88.

Yeah Brett, I'll post some pics ;)

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Proper M code Macro?
« Reply #4 on: February 24, 2007, 09:31:04 PM »
Hey Chris,
     Everybody, this is my good friend Chris. He is the one responsible for my Mach addiction. I posted in a hurry before work this morning. I didn't have the time to give him the proper welcome he deserves. He is one of the best and sharpest firends a person could have.

GLAD TO SEE YOU HERE CHRIS!!!!!!!!!!!!!!!!!!!!!!!!!
Brett

(EDIT)
Chris, I meant to say, Graham is the Gcode guru I was telling you about. He helps a lot of people. You are in very good hands. ;D
« Last Edit: February 24, 2007, 09:45:28 PM by Chaoticone »
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline rcrabb

*
  •  146 146
    • View Profile
Re: Proper M code Macro?
« Reply #5 on: February 24, 2007, 09:35:41 PM »
Welcome to the forum Chris.
Ryan
Re: Proper M code Macro?
« Reply #6 on: February 24, 2007, 10:01:53 PM »
Hello Chris,
The problem that you have is that you need a way to tell if the file is loading and IF it is DON'T run the macro... The best way to do this is the following:

ProgLoading = IsLoading()
If(ProgLoading = 0) Then
       DeActivateSignal(output4)
End If

I have tested this here and it works... Hope it is what you needed
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Proper M code Macro?
« Reply #7 on: February 24, 2007, 11:49:23 PM »
Thanks for the Welcome Guys!
Brett thanks for helping out I have had the M88 thing as a task on my list for a year and finally decided to implement it. Now I can fall asleep on the couch and not have to rush out to switch off my Vacuum pump after it has idled for 2 hours.

And thanks Brian for the code.  I read about the Isloading() function in the wiki but I had the formatting totally wrong....
Your solution works perfect! and with a minimum amount of code.

Thanks A Ton Man!

Chris

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Proper M code Macro?
« Reply #8 on: February 25, 2007, 06:34:26 AM »
Chris,
   I knew you would like it here. Lots of good, smart people here like yourself. I can now be happy on my way to work knowing you got it sorted.

Thanks a lot everybody.

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!