Accessing HAL pin from gcode
29 Sep 2016 18:29 #81084
by wn007
Accessing HAL pin from gcode was created by wn007
I have features = 12 enabled and the gcode loads ok however the resultant #1 = #[<_hal.mycomp.xoffset>] always evaluates to 0.000 even though the HAL component shows a non-zero value. I have seen where the hal pin needs to have a -f appended is this the case?
Please Log in or Create an account to join the conversation.
30 Sep 2016 04:01 #81099
by Larry
Replied by Larry on topic Accessing HAL pin from gcode
Hi wn007:
Based on your description, there really isn't a lot to go on. However if you check out the, “M codes”, particularly M62 – M68, that might be a nice place to start.
Based on your description, there really isn't a lot to go on. However if you check out the, “M codes”, particularly M62 – M68, that might be a nice place to start.
Please Log in or Create an account to join the conversation.
30 Sep 2016 05:04 #81100
by Rick G
Replied by Rick G on topic Accessing HAL pin from gcode
Please Log in or Create an account to join the conversation.
30 Sep 2016 12:41 #81103
by wn007
Replied by wn007 on topic Accessing HAL pin from gcode
Yes, I have gone through that topic several times.
I am on 2.7.4
Here is the gcode that I am using. The strange thing is that when I load the ngc file from disk it actually executes the while loop within the oword subroutine immediately (while parsing). It appears to only update the HAL pin on the program load not while executing the gcode.
G20
G91
G94
G1 Z89.053 F10
G1 B8.0168 X9.03586959 F250
G1 W1.07238080 F15
G1 Y10.3500000000 F325
M64 P3
M65 P3
#1 = #<_hal[motion.analog-in-00]>
o<take_pics> call [#1]
M30
o<take_pics> sub
G91
#2 = .485
o100 do
#3 = #2 - #1
#4 = #3 / 8
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
M62 P3
G1 Y-.05 X#4 F50
M63 P3
#1 = #<_hal[motion.analog-in-00]>
o100 while [#1 NE 0]
I am on 2.7.4
Here is the gcode that I am using. The strange thing is that when I load the ngc file from disk it actually executes the while loop within the oword subroutine immediately (while parsing). It appears to only update the HAL pin on the program load not while executing the gcode.
G20
G91
G94
G1 Z89.053 F10
G1 B8.0168 X9.03586959 F250
G1 W1.07238080 F15
G1 Y10.3500000000 F325
M64 P3
M65 P3
#1 = #<_hal[motion.analog-in-00]>
o<take_pics> call [#1]
M30
o<take_pics> sub
G91
#2 = .485
o100 do
#3 = #2 - #1
#4 = #3 / 8
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
M62 P3
G1 Y-.05 X#4 F50
M63 P3
#1 = #<_hal[motion.analog-in-00]>
o100 while [#1 NE 0]
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
30 Sep 2016 13:48 #81105
by Todd Zuercher
Replied by Todd Zuercher on topic Accessing HAL pin from gcode
What if you tried this.
G20
G91
G94
G1 Z89.053 F10
G1 B8.0168 X9.03586959 F250
G1 W1.07238080 F15
G1 Y10.3500000000 F325
M64 P3
M65 P3
M66 E0
#1 = [#5399]
o<take_pics> call [#1]
M30
o<take_pics> sub
G91
#2 = .485
o100 do
#3 = #2 - #1
#4 = #3 / 8
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
G1 Y-.05 X#4 F50
M62 P3
G1 Y-.05 X#4 F50
M63 P3
M66 E0
#1 = [#5399]
o100 while [#1 NE 0]
Please Log in or Create an account to join the conversation.
30 Sep 2016 13:55 #81107
by wn007
Replied by wn007 on topic Accessing HAL pin from gcode
I have tried the M66 E0 which in fact works, however it breaks blending so there is a pause between successive loops. We are attempting to eventually reach 300 to 400 IPM with no pauses / breaks in the execution. Thanks for the reply.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
30 Sep 2016 14:11 - 30 Sep 2016 14:13 #81110
by Todd Zuercher
Replied by Todd Zuercher on topic Accessing HAL pin from gcode
I'm not sure it can be done without breaking blending, because blending can't be calculated if the move is unknown.
Last edit: 30 Sep 2016 14:13 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
02 Oct 2016 16:48 #81152
by andypugh
Yes, this is the problem with G-code access to HAL pins. The values get read-in while the motion queue is being filled, not at the point that the G-code line is executed. (I thought that the docs mentioned that)
Replied by andypugh on topic Accessing HAL pin from gcode
It appears to only update the HAL pin on the program load not while executing the gcode.
Yes, this is the problem with G-code access to HAL pins. The values get read-in while the motion queue is being filled, not at the point that the G-code line is executed. (I thought that the docs mentioned that)
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
03 Oct 2016 00:51 #81162
by Todd Zuercher
Replied by Todd Zuercher on topic Accessing HAL pin from gcode
You might be able to achieve your goal by using a slightly different approach. Could you do your math and check your analog pin in hal, then having hal set a motion.digital-in bit that then breaks your G-code loop? If you need to control the values of your points set them with an analog out, in the code but do the realtime testing in hal.
Please Log in or Create an account to join the conversation.
03 Oct 2016 11:53 #81174
by wn007
Replied by wn007 on topic Accessing HAL pin from gcode
Yes, I did find in the docs where the inline HAL is evaluated once on load and should not be used for current values during execution.
Please Log in or Create an account to join the conversation.
Time to create page: 0.098 seconds