toolchange.ngc error calling subroutine

More
02 Apr 2023 22:28 #268125 by mloser
 I followed the toolchange.ngc example as best I could.  I have the errors all fixed as far as I can tell.I get the attached error message when I run the M6 command.  I attached the .hal and .ini filesalong with the toolchange.ngc file.  I have the PROGRAM_PREFIX and SUBROUTINE_PATH lines in the .ini file.

Thanks,
Mike 

 

File Attachment:

File Name: DynamiteMi...4-02.hal
File Size:21 KB
 

File Attachment:

File Name: DynamiteMi...4-02.ini
File Size:5 KB
 
Attachments:

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

More
02 Apr 2023 22:54 #268127 by spumco
Need the toolchange.ngc file too
The following user(s) said Thank You: tommylight

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

More
03 Apr 2023 01:09 #268135 by tommylight

Need the toolchange.ngc file too

Seems like inside the above ngc file is a call for 0<500> that does not exist.

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

More
03 Apr 2023 02:29 #268141 by mloser
Sorry about that. Here is toolchange.ngc

File Attachment:

File Name: toolchange.ngc
File Size:3 KB
Attachments:

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

More
03 Apr 2023 14:01 #268173 by mloser
o500 is at the top of toolchange.ngc;ARM_IN subroutine
o500 sub
M64 P0 ; Move arm in
G4 .25 ;wait
M65 P0 ;Remove "arm in" signal
M66 P0 L4 Q4 ; Wait for arm-in LS (low)
O501 if [#5399 LT 0]
(abort, failed to move arm in)
O501 endif
o500 endsub

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

More
03 Apr 2023 15:36 #268181 by spumco
Ok, hopefully someone else will come along and correct me as I'm a little hazy on O-words and subroutines.

I think what you want to do is put the subroutines at the end of the file, or rename them and save them as separate files.

Like so:
o<toolchange> sub
...
o200 IF [#<_selected_tool> GT 0]
        o<arm_in> call ;Arm In
        o<unclamp> call ; Unclamp
        G53 G0 Z #2 'TODO Move Z to tool change clearance height 
...
o<toolchange> endsub

and in your subroutines folder you have files named:
arm_in
arm_out
unclamp
etc.

In my ATC sequence the functions you've got as subroutines have been remapped as M-codes.  My version of your "O500" is "M25", and m25.ngc has been saved in my sub folder.  My version of the sequence above would look like this:
o<toolchange> sub
...
o200 IF [#<_selected_tool> GT 0]
        M25 ;Arm In
        M24 ; Unclamp
        G53 G0 Z #2 'TODO Move Z to tool change clearance height 
...
o<toolchange> endsub

Try sticking the subs at the end of the file first.  If that doesn't help, try saving each sub function as a separate file.
The following user(s) said Thank You: mloser

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

More
03 Apr 2023 15:39 #268182 by spumco
And another thing...

The LCNC manual cautions against putting comments on the same line as O-words.

linuxcnc.org/docs/devel/html/gcode/o-code.html

You might try removing the comments in the main toolchange "oNNN call" lines first and see if that's the issue.
The following user(s) said Thank You: mloser

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

More
29 May 2023 16:51 #272437 by CNCGOOS
Question.

where do you have savend the file toolchange.ngc?

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

Time to create page: 0.266 seconds
Powered by Kunena Forum