output with interval on/off timerelay flip flop

More
16 Jan 2021 13:15 #195529 by BoBe28
hello,
I´m new to linuxcnc.
I recently changed my system from mach3 to linux due to signal (USB) issues.
It took quite a while to set everything up, but now it runs fine. (MESA 7i76e)
I'm runnig a diy mill and only machinig wood.

Maybe someone could help me with my current project.

I connected my coolant signal "net coolant-mist" (M7) with a magnetic valve to blast air on to my tool.
Now I would like to open (1sec) and close (5sec) the valve in this example.
So if I run "M7" in my programm the air blast should go on and off giving my small air-compressor time to refill.
Would the flip flop function be the right thing to achieve my goal?

Thanks,

Bob

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

More
16 Jan 2021 22:55 - 16 Jan 2021 22:58 #195587 by chris@cnc
Hi Bob,
I wrote short modul for this.
Its pretty easy to use.
Timer Could adjust by setp timeron and off
If you have compile , install and load Take a Look in halshow.
You will found new Modul with pin In, pin out And timer
description 
"""
//Compile :
//halcompile --compile mist.comp
//sudo halcompile --install mist.comp
//Halfile load :
//loadrt mist
//addf mist.0 servo-thread
//setp mist.0.TimerOn 30
//setp mist.0.TimerOff 300
/* 4 way input Modul with Timercontrol output 
	Input 0 = output 1
	Input 1 && Input 2 = output 1
	Input 2 && Input 3 = Timer On output 1 && Timer Off output 0 
*/
""";

forum.linuxcnc.org/10-advanced-configura...w-hal-modul?start=10

Hope it helps Christian
Last edit: 16 Jan 2021 22:58 by chris@cnc.
The following user(s) said Thank You: BoBe28

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

More
17 Jan 2021 11:48 #195649 by BoBe28
hello Christian,
thank you for your quick response.
Because I'm new to linux and am not a programmer, I don't understand were to put in the code. Does it all go in den *.hal file or do I create a new *.comp file?
I couldn't install the mist.comp file.

thanks,
Bob

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

More
17 Jan 2021 13:05 - 17 Jan 2021 18:54 #195658 by chris@cnc
Hi Bob,
file mist.comp is the code file. In file header you can see how to compile and install it. If you want to use finish work rename the file mist.so.comp in mist.so and install to folder /usr/lib/linuxcnc/modules/.
Now you can use this module in hal file. Howto use in hal is also decriped in header. Basicaly you have 4 input and one output. short writen
if mist.0.in0 -> mist.0.on
else if mist.0.in1 && mist.0.in2 -> mist.0.on
else if mist.0.in2 && mist.0.in3 -> mist.0.on for mist.0.TimerOn and off for mist.0.TimerOff

my hal example:
loadrt mist                     # load module
setp mist.0.TimerOn 5       # Set Timer on
setp mist.0.TimerOff 10     # Set Timer off

net sauger-button-m    mist.0.in0	pyvcp.status-sauger-m  	    pyvcp.sauger-an-m   # If button "M" true mist is on
net sauger-button-a     mist.0.in1 	pyvcp.status-sauger-a  	    pyvcp.sauger-an-a         
net programm-run        mist.0.in2  	halui.program.is-running                                             # If button "A" true and program run mist is on
net sauger-button-i      mist.0.in3  	pyvcp.status-sauger-i   	    pyvcp.sauger-an-i     # If button "I"  true and program run mist intervall
net absaugung   	       mist.0.on		hm2_7i76e.0.7i76.0.0.output-01

Attachments:
Last edit: 17 Jan 2021 18:54 by chris@cnc.

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

More
18 Jan 2021 18:31 - 24 Jan 2021 14:19 #195814 by BoBe28
hello Christian,
thanks again. I copied your file in the diretory and found the function in the hal configuration.
Next I will try to figure out, how to connect it to the mist-coolant.
I I'll give it another try on the weekend.
bob

Update,

So I gave it another try this sunday, figuring out how to make the connections work.
Still trying to understand this HAL file. :)

# ---Interval---

net mist.is-on mist.0.in2 halui.mist.is-on
net mist.is-on mist.0.in3 halui.mist.is-on
net collant-mist mist.0.on hm2_7i76e.0.7i76.0.0.output-00

Works really good.

Thanks,

Bob
Last edit: 24 Jan 2021 14:19 by BoBe28.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum