Subroutine error

More
22 Oct 2025 20:29 #336890 by Philip Lydin
Subroutine error was created by Philip Lydin
Im setting up my cnc which has a toolchanger but i have some weird issues that if the tool prepared and tool changed iocontrol hal pins goes high i get an error that line 0 would exeed the z axis / joint 2 limit. I have 2 machines running linuxcnc but still cannot seem to figure out the problem. Im very lost so any info would help. 


o<toolchange> sub

M73
G90
G53 G0 Z0
G0 X0 Y0

o100 if [EXISTS[#<_ini[traj]axes>]]
    #<geometry> = #<_ini[traj]axes>
o100 endif

o110 if [#<geometry> EQ 4]
    G0 A0
o110 else if [#<geometry> EQ 5]
    G0 A0 C0
o110 endif

o<toolchange> endsub [1]

M2
this sub is just as a test. 

File Attachment:

File Name: hal_2025-10-22.txt
File Size:12 KB
 

File Attachment:

File Name: ini_2025-10-22.txt
File Size:4 KB
Attachments:

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

More
26 Oct 2025 18:41 #337236 by andypugh
Replied by andypugh on topic Subroutine error

G53 G0 Z0
 

Is Z=0 in machine coordinates inside the axis limits? If your soft-limit is at zero then possibly going to exactly zero triggers the error (I have a vague memory that this was a fixed bug, though). 

You could try setting max Z (or joint 2) to 0.01  (or whatever) then see if G53 Z0 still gives a fault. 
 

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

More
08 Nov 2025 10:56 #338076 by Philip Lydin
Replied by Philip Lydin on topic Subroutine error
This line in the ini was the problem "TOOL_CHANGE_POSITION = 0 0 410". My z limit is 300....

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

More
16 Nov 2025 17:29 #338529 by andypugh
Replied by andypugh on topic Subroutine error
Thanks for saying what the problem was, I will try to file that one away in my mental list of causes of tool change errors.

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

More
16 Nov 2025 17:31 #338530 by andypugh
Replied by andypugh on topic Subroutine error
You might want to switch your Z axis round, so 0 is at the top and -300 at the bottom. Some CAM packages assume that G53 G0 Z0 is a safe retract.

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

Time to create page: 0.155 seconds
Powered by Kunena Forum