Reading Hal pins from Gcode [SOLVED]

More
29 Apr 2017 09:47 - 29 Apr 2017 11:17 #92328 by rodw
I've been trying to workout how to read the value of hal pins from gcode so I can access values set in the GUI to set various cutting parameters. I'm using Master branch.

From a link to documentation Andy posted on an earlier thread I have changed my .ini file to include:
[RS274NGC]
FEATURES = 8
I have a pin called
plasma.G0-Gap

So in Gcode on a metric machine in the MDI window, I have tried this
F 2000
g1 y #<_hal[plasma.G0-Gap]>

But I get this error
Named parameter #<_hal[plasma.g0-gap]> not defined

I have not found an example , but it appears to be correct syntax to me.
What am I doing wrong?
Is the upper case in the pin name significant?

A quick example of the correct syntax would be really appreciated.
Last edit: 29 Apr 2017 11:17 by rodw.

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

More
29 Apr 2017 10:07 - 29 Apr 2017 10:10 #92330 by tommylight
Do not take my word for it, but
g1 y #<_hal[plasma.G0-Gap]>
needs a parameter, namely a value of something like 2 or 3 in your case (mm).
Just a stab in the dark.
Also G0 on a pin? An Y in the mdi line with no actual position?
I know it should get that from the pin value, but Y??? Should it be Z?
Oh well, back to cleaning up the mess in the shop.
Last edit: 29 Apr 2017 10:10 by tommylight.
The following user(s) said Thank You: rodw

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

More
29 Apr 2017 10:22 - 29 Apr 2017 10:22 #92332 by rodw
Replied by rodw on topic Reading Hal pins from Gcode
Tommy, thanks

I tried adding a G21 to set metric before it but that did not work. Same error.

And yes, it will be Z once I get organised but currently that needs a negative value. I know thats easy, but keeping it nice and simple while testing.

I could net see any examples on parameters to G91.

I have to tell you I know nothing about Gcode
Last edit: 29 Apr 2017 10:22 by rodw.

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

More
29 Apr 2017 10:28 - 29 Apr 2017 10:28 #92334 by rodw
Replied by rodw on topic Reading Hal pins from Gcode
Ooops sorry, I meant no examples for G1.

To me, it is clearly not finding the pin #<_hal[plasma.G0-Gap]>

as anything on the line after it does not generate an error.
Last edit: 29 Apr 2017 10:28 by rodw.

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

More
29 Apr 2017 10:32 #92336 by rodw
Replied by rodw on topic Reading Hal pins from Gcode
Here is the GUI



The value I'm trying to read is the 45 above the Rapid Gap - button

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

More
29 Apr 2017 11:16 #92337 by rodw
Replied by rodw on topic Reading Hal pins from Gcode
Solved.The error is because there is upper case characters in the pin name becasue the interpreter converts everything to lower case.

I tried saving a pin with all lower case characters to parameter #33 with this command
#33 = #<_hal[thcad10.target-velocity]>

I did not get an error message and after I closed Linuxcnc, the parameter was saved in linuxcnc.var.
33	11288.476562

I then picked a random gmoccapy plasma pin that was all lower case and it also saved to #33 happily.

Very cool!.

This parameter is the target velocity (frequency) returned by the Mesa THCAD at the required preset torch volts.
For those interested, if you are saving values in your own custom parameters, if you create them in the linuxcnc.var file they become persistent and that are saved from one session to the other.

So now all I need to do is to rename a few pins and I'm in business!

PS. This is feature is very poorly documented
The following user(s) said Thank You: tommylight, AndrewL

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

More
30 Apr 2017 14:58 #92348 by tommylight
Again, there is no stopping you ! Good job.
The following user(s) said Thank You: rodw

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

More
30 Apr 2017 21:11 #92375 by Todd Zuercher
Using the hal pin parameters might work. But I would not trust it for data entered and used during a run. Those parameters are not always updated during a run. A better approach would be to connect the hal pins to motion.analog-in-xx pins and read them in using G66.

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

More
30 Apr 2017 22:51 #92391 by rodw
Replied by rodw on topic Reading Hal pins from Gcode

Using the hal pin parameters might work. But I would not trust it for data entered and used during a run. Those parameters are not always updated during a run. A better approach would be to connect the hal pins to motion.analog-in-xx pins and read them in using G66.


Thanks Todd, I am aware of the limitations but to set the starting parameters, I think they'll be fine.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum