Trigger Dig. Out depending on the covered distance

More
07 Jan 2015 16:08 - 07 Jan 2015 16:09 #54704 by TopperH
Hello everybody and a happy new year! :)

Thank you all very much for your answers and suggestions. I will try to understand them and then post some new questions here, for sure. ;)

And especially thanks to you, andypough, for your HAL Code! I will add, try it out and then report here. :)

Cheers
Last edit: 07 Jan 2015 16:09 by TopperH.

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

More
07 Jan 2015 16:56 #54705 by andypugh

your HAL Code


Just to be clear, it isn't HAL code, it is "comp" code to create a custom HAL component using:
linuxcnc.org/docs/html/hal/comp.html

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

More
07 Jan 2015 18:49 - 07 Jan 2015 18:51 #54706 by TopperH
Oh, good to know, thanks! :)

This results in the next question, because the comp file is not compiling as it should.

pin in float xpos "should be connected to the x axis position feedback"


What is the right syntax to connect the feedback to that xpos pin in a comp file?

In the .hal file coming from the Pncconf Wizzard it is connected like this:
net	x-pos-fb	axis.0.motor-pos-fb	<=	hm2_5i25.0.stepgen.05.position-fb

and how do I link the "out" pin to one of the physical DO Pins?
Last edit: 07 Jan 2015 18:51 by TopperH.

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

More
07 Jan 2015 19:46 #54707 by andypugh

This results in the next question, because the comp file is not compiling as it should.

What is the error message?

What is the right syntax to connect the feedback to that xpos pin in a comp file?
In the .hal file coming from the Pncconf Wizzard it is connected like this:

net	x-pos-fb	axis.0.motor-pos-fb	<=	hm2_5i25.0.stepgen.05.position-fb


In that case you can add xpos (etc) to the same net with
net x-pos-fb dashline.0.xpos
As this uses the same "signal"name it adds the pin to the same net and the pin sees the same data.

and how do I link the "out" pin to one of the physical DO Pins?

net somemeaningfulsignalname dashline.0.out => hm2_5i25.0.7i76.00.digitalout.00
(Or whatever your digital output pins are really called)

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

More
07 Jan 2015 20:48 #54711 by BigJohnT
Might be a good time to have a short read on basic HAL syntax.

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

JT

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

More
07 Jan 2015 22:35 #54719 by TopperH
Yeah, I've got it working!! :D Thank you very much!
I wasn't sure if the connection has to be made inside the comp file or the custom.hal

The compiling errors resulted from having some kind of "connection" inside the comp.

Another remaining question, if I look at the Pins via LinuxCNCs HAL-Meter, I see the dashline.0.motion-type changing, but also in the rapid traverse mode(1) the dashline.0.out is toggling.
Are the motion_type and motion_mask from

if ( (1<< motion_type) & motion_mask)

interpreted as the pins motion-type, motion-mask?

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

More
07 Jan 2015 22:46 #54720 by andypugh

Another remaining question, if I look at the Pins via LinuxCNCs HAL-Meter, I see the dashline.0.motion-type changing, but also in the rapid traverse mode(1) the dashline.0.out is toggling.
Are the motion_type and motion_mask from

if ( (1<< motion_type) & motion_mask)

interpreted as the pins motion-type, motion-mask?


Yes. The standard for HAL pins is to use "-" as the separator, but that is not a legal character for a C variable, so they are substituted by "_" in the code.

If rapid-traverse is type 1 then the default motion-mask is wrong. Try setting it to 12 instead.
The machine I tested on was running a version of LinuxCNC where the motion-type pin was not available.

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

More
07 Jan 2015 23:10 #54721 by TopperH
Jep, already found it. 12 was the way to go. :)

The function itself is plain c-code, right? So that I can add some things by myself, like turning the output to FALSE if in rapid move. Now it keeps the value at the beginning of the move...

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

More
07 Jan 2015 23:16 #54723 by andypugh

The function itself is plain c-code, right? So that I can add some things by myself, like turning the output to FALSE if in rapid move.



Yes, just C. You probably just need an "else" for the first "if" and maybe want to reset the distance at the same time so that every G1 begins with a bit of "True"

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

Time to create page: 0.107 seconds
Powered by Kunena Forum