Hello Guest it is September 30, 2023, 09:49:18 PM

Author Topic: what are rules for M89 variable & subroutine numbering in external subroutines  (Read 1092 times)

0 Members and 1 Guest are viewing this topic.

Do the variables that are used in an external subroutine (like #12 = 42) affect the variables that are used in the main program with the same name (like #12 = 37.5)?
I am aware that variables in the main program are public to the entire main/local module.
Will the variable #12, if used, in both the local program and the external subroutine interfere with each other? If they do, that means each subroutine must be uniquely constructed.
I am aware that things like G52 are not buffered and if incorrectly used, will return to the main program to an incorrect pointer.

Another item that I haven't completely explored yet. Will the local subroutine numbers (like O10, O11, etc) in the external program module interfere with the main program subroutine numbers of the same number? My G-Code generator reuses local subroutine numbers on each project build, and it is highly likely that creating a general purpose subroutine will have subroutine numbers that are identical to the numbers in the main program.

I could find no documentation that lays these rules out.
What are the rules here? 
Pixel Tamer

Offline rcaffin

  •  1,052 1,052
    • View Profile
Everything in Mach is global. This is different from Fanuc.
So the opportunities for confusion and chaos are almost unlimited.