Hello Guest it is March 29, 2024, 06:59:08 AM

Author Topic: Script for air pressure sensor  (Read 6611 times)

0 Members and 1 Guest are viewing this topic.

Script for air pressure sensor
« 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.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Script for air pressure sensor
« Reply #1 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
Re: Script for air pressure sensor
« Reply #2 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.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Script for air pressure sensor
« Reply #3 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

« Last Edit: September 20, 2011, 07:16:00 PM by BR549 »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Script for air pressure sensor
« Reply #4 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


Re: Script for air pressure sensor
« Reply #5 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?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Script for air pressure sensor
« Reply #6 on: September 20, 2011, 09:01:59 PM »
Are you using the standard 1024 screenset that comes with mAch3?

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Script for air pressure sensor
« Reply #7 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
Re: Script for air pressure sensor
« Reply #8 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).
Re: Script for air pressure sensor
« Reply #9 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.