Unable to resolve coolant momentary switch issue

More
9 years 2 months ago #97132 by IIOII
I've written some similar logic in Lua for a previous Mach4 build, so the logic and code should be somewhat similar in C. What's the process for creating and compiling a custom C component? Alternatively, does anyone have some hal logic they could share to achieve the required result?

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

More
9 years 2 months ago #97156 by rodw

IIOII wrote: I've written some similar logic in Lua for a previous Mach4 build, so the logic and code should be somewhat similar in C. What's the process for creating and compiling a custom C component? Alternatively, does anyone have some hal logic they could share to achieve the required result?


If you drop in on the plasma and laser section on this forum, there are several components I've written. Use them as an example.
This is a simple one. forum.linuxcnc.org/plasma-laser/32657-th...-indicator-component
Then its just as simple as typing "halcompile --install mycomponent.comp"
And the component is compiled and installed for you.

Just remember your component is being called every time the servo loop is called. Don't do any loops, just wait until the next pass through.

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

More
9 years 2 months ago - 9 years 2 months ago #97174 by Todd Zuercher
This will work with the toggle2nist, it just needs to be connected right and maybe an edge, added.
Code:
loadrt toggle2nist count=1 loadrt edge count=1 addf toggle2nist.0 servo-thread addf edge.0 servo-thread #Seems these need to be here to keep check boxes visible net coolant-flood <= iocontrol.0.coolant-flood # Coolant switch net flood-button <= hm2_7i76e.0.7i76.0.0.input-27 => edge.0.in net button-edge <= edge.0.out => toggle2nist.0.in net flood-on <= toggle2nist.0.on => halui.flood.on net flood-off <= toggle2nist.0.off => halui.flood.off net flood-control <= halui.flood.is-on => toggle2nist.0.is-on # Coolant LED control net coolant-flood => hm2_7i76e.0.7i76.0.0.output-14
Last edit: 9 years 2 months ago by Todd Zuercher.
The following user(s) said Thank You: OT-CNC, IIOII

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

More
9 years 2 months ago #97190 by andypugh

IIOII wrote: What's the process for creating and compiling a custom C component?


linuxcnc.org/docs/2.7/html/hal/comp.html

For fun you could use LUT5, with inputs from the button, halui.coolant.is-on and the iocontrol coolant pins.
LUT5 is especially good fun when you feed its own output back as an input. But it does tend to make for rather "write once" HAL code.

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

More
9 years 2 months ago #97237 by IIOII
Thank you Todd and all with your help to rectify this problem. Todd's code works perfectly. Wiring is now complete on my system!

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

More
8 years 9 months ago #104807 by OT-CNC
Code:
loadrt toggle2nist count=1 loadrt edge count=1 addf toggle2nist.0 servo-thread addf edge.0 servo-thread #Seems these need to be here to keep check boxes visible net coolant-flood <= iocontrol.0.coolant-flood # Coolant switch net flood-button <= hm2_7i76e.0.7i76.0.0.input-27 => edge.0.in net button-edge <= edge.0.out => toggle2nist.0.in net flood-on <= toggle2nist.0.on => halui.flood.on net flood-off <= toggle2nist.0.off => halui.flood.off net flood-control <= halui.flood.is-on => toggle2nist.0.is-on


I copied the above code to my hal file and modified it to reflect my hardware. Thanks for posting it. Coolant button works on my mill now except for after external estop has been triggered.
After clearing estop and cycling power, the coolant button no longer turns on coolant. I have to issue M8 code or click coolant box via mouse first.
The coolant button works fine on initial power up of linuxcnc. I do not have to select coolant first with the mouse or m code.
Is that expected behavior or did I brake something with my external estop loop?

I will try to attach my actual hal file later in case something is broken.

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

Time to create page: 0.261 seconds
Powered by Kunena Forum