Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: learman on February 26, 2010, 03:34:29 PM

Title: macro for the non macro'ish
Post by: learman on February 26, 2010, 03:34:29 PM
 
Could somebody pls write a macro for me. I would like to shut off output 4 If an input ( lets call it input 2) dose not close. I hooked a flow meter to my machine and would like the heat to shut off if the water is not on. The Macro would need to give at least 3/4 to 1 second for the switch to close. This input would only be on when output 4 is active. I have only used one macro to zero a DRO, so i am extremely dense.

thanks
josh
Title: Re: macro for the non macro'ish
Post by: Hood on February 26, 2010, 07:06:10 PM
I think you would need to use the macropump for that, well thats if I am understanding what you want as I am thinking you need to be constantly monitoring the flow meter?
However the easiest way would probably be to do a Brain for it, fairly simple to do and no VB needed :)
Other way would be to have the flow meter connected to the coil of a relay and the contacts of the relay in series with the heater, if the flow meter wasnt registering the relay would drop out and switch off the heater.

Hood
Title: Re: macro for the non macro'ish
Post by: learman on February 26, 2010, 08:12:44 PM
Thanks Hood

The flow meter is a normally open normaly closed contact, I have it set to close at 24 gpm, so a pump wont be needed. I cant wire it in series as the heater is on befor the flow meter reaches 24 gpm and the heat is off befor the flow meter is off.  What would a brain like this look like?

Thanks
Title: Re: macro for the non macro'ish
Post by: learman on February 26, 2010, 09:30:27 PM
oops sorry, I need a marco pump
Title: Re: macro for the non macro'ish
Post by: Hood on February 27, 2010, 04:40:41 AM
Oh ok thats a bit tricky, will have to think about that but will involve some sort of timer whether using the macro pump or a brain.
Is the time you mentioned above the time it takes for the flowmeter to switch on?
Hood
Title: Re: macro for the non macro'ish
Post by: Hood on February 27, 2010, 05:52:19 AM
Ok if you put this in the macropump it should work I think.

If GetOemLED(77) Then               'Look at OutPut 4 LED to make sure its active
Sleep (1000)                               ' Wait for 1 second
If  Not IsActive (Input2) Then       ' If Input 2 is not active
DeActivateSignal(OutPut4)           ' Turn off OutPut 4
MsgBox ("Water Flow is Low, Heater has been turned Off")   'Message to let you know Heater has been turned off gue to lack of flow
End If
End If

You will need to enable the macropump on General Config page and restart Mach.

Hood

Title: Re: macro for the non macro'ish
Post by: learman on February 27, 2010, 08:00:27 AM
Dude You are awesome, I am actually exited for Monday morning ( believe it or don't)!
You even put in an message thanks.  Could you direct me to the location on the macro comands, I would much like to get a better understanding on its language.

josh
Title: Re: macro for the non macro'ish
Post by: Hood on February 27, 2010, 09:09:26 AM
Ray Livingstone wrote a manual I think, think its been posted here somewhere, if I find it I will post a link.
Hood
Title: Re: macro for the non macro'ish
Post by: Hood on February 27, 2010, 09:14:23 AM
Here it is
http://www.machsupport.com/forum/index.php/topic,12740.0.html
Not sure all whats in it but should give you a good idea of whats what. Also the wiki has some info, think the Mach2 Customising manual as well has some info and you will also need to know the OEM codes for buttons, DROs, LEDs etc and you can find them in the OEM list in the sticky at the top of the forum or on the Wiki.

I find looking at the wizards VB gives you a good idea how to do things as well.

Hood
Title: Re: macro for the non macro'ish
Post by: learman on February 27, 2010, 10:31:33 AM
Thanks Hood,
Have a nice weekend!
Title: Re: macro for the non macro'ish
Post by: learman on March 03, 2010, 02:26:22 PM
Yep the macro pump works great!!
I'm hooked I want to run some some more but it seems 1 is the limit. Can the same macropump be written as a brain and work the same way? I would like to watch some temperature switches and position sensors. oh no,, what have you started.
josh
Title: Re: macro for the non macro'ish
Post by: Hood on March 03, 2010, 02:30:30 PM
Just add more code in the macropump and it will work :)
Slows down a bit if you have too much in it but should be fine for what you want.
Or you can use brains alongside a macropump if you wish to use a brain for something else.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 03, 2010, 02:47:59 PM
I'll do that
thanks Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 01:16:39 PM
Hi

I was hoping you could tell my why my macro is not working correctly on one of Machs older version 2.0.061. This version works great but to turn on output 4 you have to call it P2 not P4.

If GetOemLED(77) Then < " I'm not sure if version 2.0.061 recognizes this line"
Sleep (1000)
If Not IsActive (Input2) Then
DeactivateSignal(Output4)
MsgBox ("Water Flow Is Low Heat has been shut off")
End If
End If
If IsActive(INPUT1) Then
MsgBox ("Water Temperature is High")
End If

I would hate to update this version, its the best running machine in the building.
Thanks
Josh
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 02:10:43 PM
Dont think it being an old version should matter for that but if you attach your xml from that machine I will see if I can find a problem.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 02:32:52 PM
Hope this works!
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 02:41:58 PM
Thats your backups, what you want is the single xml file for the profile you use, if you use standard mill profile it will be called Mach3Mill.xml. If you have a custom profile it will have that name.

You will find the xml in the main Mach3 folder, its not in a sub folder.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 03:13:03 PM
try agian
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 03:30:18 PM
Nope, seems to be a blank xml :(
Third time lucky? ;D

Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 03:45:01 PM
I don't know but, its showing it needs to be opened with internet explorer?
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 03:47:10 PM
This is justs some of it, is this what you are looking for?
- <Preferences>
  <Syskey1>0</Syskey1>
  <DefDir>C:\Mach3</DefDir>
  <Profile />
  <NewPath>0</NewPath>
  <BR>0.0</BR>
  <BG>0.0</BG>
  <BB>0.0</BB>
  <FR>0.0</FR>
  <FG>0.0</FG>
  <FB>1.0</FB>
  <RR>1.0</RR>
  <RG>0.0</RG>
  <RB>0.0</RB>
  <AR>0.7</AR>
  <AG>0.2</AG>
  <AB>0.7</AB>
  <ER>1.0</ER>
  <EG>1.0</EG>
  <EB>0.0</EB>
  <MatRed>0.</MatRed>
  <MatGreen>0.1</MatGreen>
  <MatBlue>0.1</MatBlue>
  <PulseSpeed>0</PulseSpeed>
  <ID>None</ID>
  <FirstRun>1</FirstRun>
  <LastUser>josh learman</LastUser>
  <Layout>1024.set</Layout>
  <m_SafeZ>0.</m_SafeZ>
  <CVUseAngle>0</CVUseAngle>
  <CVDegrees>0.</CVDegrees>
  <JogHeat>0</JogHeat>
  <KeyClick>0</KeyClick>
  <THC5>0</THC5>
  <SpinInc>100</SpinInc>
  <M30SpinOff>1</M30SpinOff>
  <AutoCalcs>0</AutoCalcs>
  <Boxed>1</Boxed>
  <SafeZStop>0</SafeZStop>
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 03:48:19 PM
Try right clicking on your xml and zipping it then attaching the zip, you will need to name the zip something like learman.zip so the forum will accept.
Hood
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 03:49:05 PM
Yes but takes too long trying to look at it that was so really need the xml itself.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 03:49:56 PM
Why is it showing up as an explorer doc?
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 03:51:59 PM
xml is a browser document so it will open as such if you double click it.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 03:54:05 PM
OK,so mine is showing nothing on your end.
Ill try sending it again
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 03:56:31 PM
It is opening but doesnt have any motor or outputs or inputs settings  etc, in other words its basically blank.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 04:01:05 PM
Humm. Not sure what to do next. ?
Title: Re: macro for the non macro'ish
Post by: Hood on March 08, 2010, 04:04:03 PM
Do you have winzip or winrar on the machine in question? if you do go to the Mach3 folder and right click on the xml for the profile you are using and choose to zip (or RAR) it then attach the zip (or rar)

Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 08, 2010, 06:26:32 PM
I'm doing some diggin at home and found on one of my backup disks there is a file called machmill xml !! AAh ha! I'll pull that one out of my machine tomarrow and post it.

JOSH
Title: Re: macro for the non macro'ish
Post by: learman on March 09, 2010, 12:41:36 PM
Try this!
Title: Re: macro for the non macro'ish
Post by: Hood on March 09, 2010, 01:39:57 PM
Ok that seems more like it. Now to your problem, how are you switching on OutPut4?
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 09, 2010, 01:41:12 PM
with P2 command
Title: Re: macro for the non macro'ish
Post by: Hood on March 09, 2010, 01:48:57 PM
Thats a new one on me I am afraid, can you elaborate a bit more?

Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 09, 2010, 01:58:02 PM
Sorry about the confusion, its my constant state?
M3
M3
X  00.000 Y00.00000 Z00.00000 F550.00
M11 P2  < This is the command to turn output 4 on, or my heat.
G1 X -00.070 Y00.00000 Z00.00000 F010.0
M11 P7
G1 X -04.800 Y00.00000 Z00.00000 F080.0
M10 P2 < this is the command to turn it off,output 4, or my heat.
M10 P2
X -06.00 Y00.00000 Z00.00000 F130.00
G4 P1.7
X -06.300 Y00.00000 Z00.00000 F7800.00
M10 P7
X -06.400 Y00.00000 Z00.00000 F700.00
M11 P3
M11 P5
M10 P7
X -06.420 Y00.00000 Z00.00000 F800.00
G4 P0.1
M10 P5
M10 P9
M10 P7
X -06.450 Y00.00000 Z00.00000 F800.00
M6
Title: Re: macro for the non macro'ish
Post by: Hood on March 09, 2010, 02:05:27 PM
Ah ok, can you attach your m10 and m11 macros please.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 09, 2010, 02:28:12 PM
First Try
Title: Re: macro for the non macro'ish
Post by: learman on March 09, 2010, 02:29:18 PM
Second Try
Title: Re: macro for the non macro'ish
Post by: Hood on March 09, 2010, 03:01:04 PM
Seems to be working fine here but I will see if I can find the exact version of Mach you are using and test again.
Hood
Title: Re: macro for the non macro'ish
Post by: learman on March 09, 2010, 03:03:06 PM
Thank you :D
Title: Re: macro for the non macro'ish
Post by: Hood on March 09, 2010, 03:11:41 PM
Afraid the closest I can find to your version is R2.0.077 and it works fine with that.
I will PM my email address if you can zip and send the Mach3.exe from that version I will test it.

Hood