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

More
9 years 11 months ago #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
9 years 11 months ago #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
9 years 11 months ago #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
9 years 11 months ago - 9 years 11 months ago #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: 9 years 11 months ago by SenorAguas.

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

More
9 years 11 months ago #82786 by andypugh

SenorAguas wrote: 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
9 years 11 months ago #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.

Time to create page: 0.285 seconds
Powered by Kunena Forum