Ladder and custom M codes

More
16 Jun 2015 22:35 #59884 by tome
tome created the topic: Ladder and custom M codes
I now have my classic ladder logic set up to control my pneumatic tailstock and collet. I want to have custom M codes so that the programmer can issue an M120 to retract the tailstock, or an M121 to engage it. Of course I want the CL logic to be in control when the M-code is issued. How do I do this? Before using CL my retract M-code (M120) looked like this:

#!/bin/bash
halcmd sets tailstock-fwd FALSE
halcmd sets tailstock-rev TRUE

Now I want to hand off control to CL. In my .hal file for retract I have:
net tailstock-retract classicladder.0.in-00 gladevcp.hal_button1

If I try to use:
halcmd sets tailstock-retract I get an error that says "signal tailstock-retract" already has writers
If I try to use:
halcmd sets tailstock-retract I get an error that says "signal classicladder.0.in-00" not found

I am not sure what I should be using here...

-Tom
More
17 Jun 2015 06:07 - 17 Jun 2015 06:14 #59899 by BigJohnT
BigJohnT replied the topic: Ladder and custom M codes
By "in control" are you needing the M100 to wait for classicladder?

You can't setp a signal that has input controlling it and in any case to set a signal you use sets (set signal) not setp (set pin). Without seeing your HAL files or at least the section in question it's impossible to say what you might have wrong.

linuxcnc.org/docs/html/hal/basic_hal.html

JT
Last Edit: 17 Jun 2015 06:14 by BigJohnT.
More
17 Jun 2015 22:51 - 17 Jun 2015 22:53 #59914 by andypugh
andypugh replied the topic: Ladder and custom M codes

tome wrote: net tailstock-retract classicladder.0.in-00 gladevcp.hal_button1

If I try to use:
halcmd sets tailstock-retract I get an error that says "signal tailstock-retract" already has writers


Yes, the tailstock-retract signal is controlled by the PyVCP button.
In practice the button sends its value to the signal every millisecond or so, so even if you could sets the signal from the script the value would be over-written.

You first need to decide on the actual logic you want. Try writing a table that shows what you want the control solenoid to do for every combination of the screen buttons and the M100 / M101 commands. You might want it to be asymmetrical.
You can then encode that into a LUT5 component.

[Edit] LUT5 has 5 inputs, so consider adding the door open-close signal to the state table.
Last Edit: 17 Jun 2015 22:53 by andypugh.
More
19 Jun 2015 22:46 #59993 by tome
tome replied the topic: Ladder and custom M codes
Thanks JT and Andy. Your messages spurred the solution in my head. I just created a new signal that the M-code can assert and XOR'd that with my classic ladder input and all works.
-Tom
Time to create page: 0.078 seconds
Powered by Kunena Forum