integrating a go/pause switch into LinuxCNC (not an estop)

More
11 Nov 2016 15:28 #82698 by SenorAguas
Hi Guys, I've been learning a lot, but I need some help. I'm building an semi automation machine that has a switch to let the machine know if the product is loaded. Here's how it works--an operator pushes a loaded pallet into a hard stop and switch, and I want that to trigger the program start and then pause if the pallet is pulled out.

I've been able to configure the switch to be an e-stop, but that's not what I'm looking for, because the operator would have to reset the e-stop, turn on power, and run the program every cycle.

Here's what I want it to do:

Run the program if the switch is opened. The switch is on pin 15 (and 5V) right now, configured as digital in 1.
Pause the program if the switch is closed.
Resume when the switch is opened again.

Any idea how to configure this?

---OR---

I could just use the switch to pause and resume, and rely on the operator to press a pvVCP start button.

Which ever is easier. Any help would be greatly appreciated. I started to try to do this with Classicladder, but I got lost.

Please Log in or Create an account to join the conversation.

More
13 Nov 2016 00:35 #82727 by andypugh
I think that the right HAL pins exist.

The logic is:

IF machine is idle AND the switch is pressed THEN run
IF the machine is running AND the switch is NOT pressed then inhibit motion.

loadrt and2 count-2
addf and2.0 servo-thread
addf and2.1 servo-thread

net button_closed parport.0.pin-01-in => and2.0.in0
net button_open parport.0.pin-01-in-not and2.0.in0

net machine-idle halui.program.is-idle => and2.0.in1
net machine-running halui.program.is-running => and2.1.in1

net start-cycle and2.0.out => halui.program.run
net pause-motion and2.1.out => motion.feed-inhibit

linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html
The following user(s) said Thank You: SenorAguas

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 14:34 #82776 by SenorAguas
Thanks! Now to see if I can actually get it working! I'm really new to this hal editing stuff.

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 15:05 - 14 Nov 2016 15:06 #82783 by SenorAguas
Ok, I added the code with no changes except changing pin-01 to pin-15.

It couldn't load and2, but I think it was because "count-2" should be "count=2".

After changing that to =, I'm getting the following error:

Pin 'and2.0.in0' was already linked to signal 'button_closed'
Last edit: 14 Nov 2016 15:06 by SenorAguas.

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 15:28 #82786 by andypugh

Pin 'and2.0.in0' was already linked to signal 'button_closed'


Sorry, should be and2.1.in0
The following user(s) said Thank You: SenorAguas

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 16:07 #82792 by Todd Zuercher
it was just another little typo change the second and2.0.in0 in your file to and2.1.in0.
The following user(s) said Thank You: SenorAguas

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 16:31 #82794 by SenorAguas
I'm 95% there! It's pausing when I want it to, and resuming, but it is getting an error when loading another pallet and starting the program again:

can't do that (EMC_TASK_PLAN_RUN:507 in manual mode

Is there an auto mode that I should be switching into?

Thanks so much for your help! I'm definitely going to be posting the final hal file when it gets resolved!

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 16:51 #82796 by SenorAguas
I'm thinking I need this in there somewhere, but I'm not sure how to use it:

halui.mode.auto

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 17:33 - 14 Nov 2016 17:45 #82800 by SenorAguas
-Edited due to bad info on my part-

I added halui.mode.auto but now it automatically goes into the next cycle without me removing pallet. I'm aslo getting errors. I'm guessing I need some logic about when to go into auto mode?

Here's my HAL file:

loadrt and2 count=2
addf and2.0 servo-thread
addf and2.1 servo-thread

net button_closed parport.0.pin-15-in => and2.0.in0
net button_open parport.0.pin-15-in-not => and2.1.in0

net machine-idle halui.program.is-idle => and2.0.in1
net machine-running halui.program.is-running => and2.1.in1

net start-cycle halui.mode.auto and2.0.out => halui.program.run
net pause-motion and2.1.out => motion.feed-inhibit
Last edit: 14 Nov 2016 17:45 by SenorAguas. Reason: bad info the first time around

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 18:33 #82804 by andypugh
mode.mdi might be what you need.

Please Log in or Create an account to join the conversation.

Time to create page: 0.209 seconds
Powered by Kunena Forum