Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: swanner on September 20, 2011, 02:58:35 PM

Title: Script for air pressure sensor
Post by: swanner on September 20, 2011, 02:58:35 PM
I just got my limit switches working on my cnc router. They're all wired in a daisy chain with the estop switch and in that daisy chain was the air pressure switch as well. I removed the connections for the air pressure switch because I don't want the machine to estop because of a pressure drop (the only critical need for air pressure is for tool changes). I think it would be better if I could modify the tool change script where the first thing it does is check the input I connect the pressure switch to, and if it's off (no air) then it would pause and a message pop up informing me to check the air, and clicking ok and closing the message would restart the tool change script, and if the air is on then proceed with the tool change and rest of the program.

Are there any basic flaws with this idea? At first I thought it would be pretty short and simple, but the more I comb though these forums/wiki/documentation and try and learn what I have to do it's becoming clear there is a very small chance I'll ever get this to work piecing it together from scratch. Any help or advice would be appreciated.
Title: Re: Script for air pressure sensor
Post by: BR549 on September 20, 2011, 04:34:24 PM
That is a very normal thing to do.  You would create a script to check the state of the switch AND IF you lost pressure it would STOP and give you a WARNING MESSAGE. Then give you the option to STOP and Cancell the job OR HOLD untill you turned the AIR back on(;-).

You would need to connect the wires to a spare INPUT pin on the port then assign that pin to a function such as Input3.  Then you need to modify the M6start macro to include the code to CHECK Input3 before continuing with the TOOL CHANGE.

YOU get the wiring done and WE will help you with the CONFIG and the Script code.

Just a thought, (;-) TP
Title: Re: Script for air pressure sensor
Post by: swanner on September 20, 2011, 06:17:00 PM
Gotcha, sounds like a plan. Got the wiring done, the way I have it configured is that when there is no air pressure the LED for Input 4 is lighting up. Checking the screen set, it is OEM-code 824. I've also attached my M6Start file so you can see what I'm dealing with. Thanks.
Title: Re: Script for air pressure sensor
Post by: BR549 on September 20, 2011, 07:14:20 PM
OK I have it running OK .

NOW , I give you 3 chances to get it fixed before cancelling out. WHAT do you want it to do IF it has to cancel out due to you cannot get it fixed?

IF I just end the macro then MACH will keep going without the toolchange. NOT a GOOD idea (;-)

I can save all the important info to do a restart from  tool change and then shut the program down ????

(;-)TP

Title: Re: Script for air pressure sensor
Post by: BR549 on September 20, 2011, 07:17:37 PM
OK I have it running OK .

NOW , I give you 3 chances to get it fixed before cancelling out. WHAT do you want it to do IF it has to cancel out due to you cannot get it fixed?

IF I just end the macro then MACH will keep going without the toolchange. NOT a GOOD idea (;-)

I can save all the important info to do a restart from  tool change and then shut the program down ????

I can just cancell the Gcode Program????????

(;-)TP


Title: Re: Script for air pressure sensor
Post by: swanner on September 20, 2011, 07:38:42 PM
Saving all the important info to do a restart from tool change seems to be the way to go, is it an additional script or part of the tool change script?
Title: Re: Script for air pressure sensor
Post by: BR549 on September 20, 2011, 09:01:59 PM
Are you using the standard 1024 screenset that comes with mAch3?

(;-) TP
Title: Re: Script for air pressure sensor
Post by: BR549 on September 20, 2011, 09:15:55 PM
FOr now this will get you going. Double check it before you trust it(;-)For now it gives you 3 tries and then cancels the program. It also tells you to write down the line # SO you know where to restart. I will add to it later when I get more time.

You will have to rename it back to what it was.

Hope that helps,(;-) TP
Title: Re: Script for air pressure sensor
Post by: swanner on September 20, 2011, 09:41:22 PM
Just tested it and it's not working. It's still going for a tool change with or without air pressure (switch/led is working).
Title: Re: Script for air pressure sensor
Post by: swanner on September 20, 2011, 09:47:00 PM
Here's a screen shot of my port and pins settings - maybe I gave you the wrong DRO? I got that number for the mach screen editor by clicking on the LED and looking at the properties.
Title: Re: Script for air pressure sensor
Post by: swanner on September 20, 2011, 09:49:48 PM
I missed that other message, I'm using the standard screen but I've modified it a bit, I don't think I've 'changed' anything, just deleted useless stuff and added some new stuff. Here it is if you want to take a look.
Title: Re: Script for air pressure sensor
Post by: BR549 on September 20, 2011, 10:05:27 PM
The reason I ask is there are usaully exrta gizmos hanging around the standard screen set that can be used for OTHER(;-) funtions without a screenMOD

I'll take a look at what you have, So I take it you can do a screen MOD ok??

(;-) TP
Title: Re: Script for air pressure sensor
Post by: swanner on September 21, 2011, 12:59:39 PM
I don't think I did very much to brag about, a good portion of my buttons are just 'ideas' and don't work yet. I found machsreen and after clicking around for a while I had figured out enough to add buttons and what not, I'm not really interested in changing the visuls as much as adding useful functions and safeguards and cutting down on repetitious stuff like touching off multiple tools.
Title: Re: Script for air pressure sensor
Post by: swanner on September 22, 2011, 12:20:03 PM
Have a look at what I did, it appears to be working:


'*************CheckAirPressure*****************************
If GetOEMLED (824) Then
MsgBox("Low Air Pressure Alert  Fix Problem and PRESS (OK)")
   If GetOEMLED (824) Then
   MsgBox("Problem not fixed, try again")
   End If
   If GetOEMLED (824) Then
   MsgBox("Problem not fixed, canceling routine")
   DOButton(1)
   While Ismoving()
   Wend
   Dobutton(3)
   While Ismoving()
   Wend
   DoOembutton(1003)
   End
   Else
   End If
End If
'**********************************************************

In fooling with this I discovered my HSD spindle has signal wires for tool-in-spindle and drawbar open, as well as a pin labeled 'thermal alarm'...know anything about those? I see the wires are already ran to the control cabinet but just not connected to anything. I see a line disabled in the tool change sript: 'SystemWaitFor (7) 'Wait for the tool Release Limit switch - I'm not sure what that's meant to do besides wait but I was thinking I could work scripts similar to the air pressure switch one to make sure the draw bar opens and the spindle is empty before picking up the next tool if I figure out how to get those two wires talking to the inputs.