Hello Guest it is October 17, 2019, 07:30:18 PM

Author Topic: return called with no sub in effect problem continues  (Read 1137 times)

0 Members and 1 Guest are viewing this topic.

return called with no sub in effect problem continues
« on: February 16, 2018, 09:56:02 PM »
i thought i had posted this but can not see it in recent posts so i have no idea if others have seen it either

I have read everything i can find on this topic and still have a problem. I have a test machine that is not connected to my router. It is running Version R3.043.066 of Mach3 I can run the code below and it works fine. However when i try to run the code on the real machine i get the return called with no sub in effect error. I have version R3.043.050 on the real machine and pretty much need to keep this because it is the only version i can get to work with an RU Pendant and other things like a Pokeys. I have tried virtually every version of mach3 that i can download and i really seem to be stuck with version ... 050 

i can try version .066 to see if the program will run on the router but i can not use that version for the reason stated above. I added M30 at the end of the program and also added line numbers and a return in each sub to the line called. none of this makes it work on the router but it still works fine on the test machine running v .066

N10 G20 (inch units)
N20 G90 (absolute distance)
N30 G64 (constant velocity mode)
N10 G40 (cancel cutter radius compensation)
N40 G17 (XY plane select)
N50 G52 X0 Y0 Z0 (cancel all offsets)


(M8 coolant on)
(set machine at 0 0 by touching)
(then move to first position X and Y .5" - 1/2 tool diameter)
(do one peck drill then advance 14 times pause tool change drill and reverse )
(can make following a sub, does not need to be incremental but X advance could be)
(space between holes is .325?)

N60 M3 S1000  (spindle on set to 180)
N70 G0 Y -.25
N80 M98 P1000 L5

N90 M6  (stop for part repositioning)
N100 M98 P2000 L5
N110 M30

O1000
G0 Z.1  (retract)
G1 F40 Z .09
G1 F10 Z -.120
G1 F50 Z -.1
G1 F20 Z -.15
G1 F10 Z -.25
G1 F10 Z -.31
G0 Z.1  (retract)
G91
G0 X .32
G90
M99 P80



O2000
G0 Z.1  (retract)
G1 F40 Z .09
G1 F10 Z -.120
(G4 P.5 dwell 500 ms  mach3 seems to be decimal seconds not MS)
G1 F50 Z -.1
G1 F20 Z -.15
G1 F10 Z -.25
(G4 P500 dwell 500 ms)
(M30 rewind program)
G1 F10 Z -.31
G0 Z.1  (retract)
G91
G0 X -.32
G90
M99 P100
Re: return called with no sub in effect problem continues
« Reply #1 on: February 17, 2018, 12:43:53 AM »
Hi,
I have not used subroutines so I can't really help however I have a question....

Quote
M99 P80
You have coded this line in your O1000 sub. Do you need the 'P80' as return address?. My reading of Peter Smid's book suggests not, it does allow for such return
statements but you don't need it.

May I suggest removing the P80 from O1000 and the similar P100 from O2000 and try it.

Craig
My wife left with my best friend...
     and I miss him!
Re: return called with no sub in effect problem continues
« Reply #2 on: February 17, 2018, 01:13:26 AM »
I confirm the problem exists in 050 and not in 066. As a workaround does it work for you to add a blank entry like just add N105 between N100 M98 P2000 L5 and N110 M30 so it looks like this?

N100 M98 P2000 L5
N105
N110 M30

Also it seems to work with or without putting the P parameter at the end of the subroutine.
Re: return called with no sub in effect problem continues
« Reply #3 on: February 17, 2018, 02:45:20 AM »
i tried the code without the P80 and P100 first and just added them because i thought it might help. either way works in v 066 but not in v 050

i added the blank lines and it works !!!!!!!!  amazing. how do you guys figure this sort of workaround out?
Re: return called with no sub in effect problem continues
« Reply #4 on: February 17, 2018, 03:16:14 AM »
Hi,
the credit is rjantz3's. You may have seen some Gcode files that end:

N110 M30
%

The % symbol is just to ensure that the M30 is recognized, the symbol effectively means that N110 is not the last line but the second to last line.

I have not seen this situation before but rjantz3 had it spot on.

Craig
My wife left with my best friend...
     and I miss him!

Offline rcaffin

*
  •  1,003 1,003
    • View Profile
Re: return called with no sub in effect problem continues
« Reply #5 on: February 27, 2018, 05:08:50 AM »
Yes, you can have all sorts of funny problems if the file does not end properly. This is even mentioned in the Mach3Mill manual somewhere (section 10.5). At the least, it MUST have a <carriage return> at the end of the last line.

As Craig suggested: put a '%' at the end of the code on its own line every time. (I think that too is in the manual - somewhere.)

Cheers
Roger
Re: return called with no sub in effect problem continues
« Reply #6 on: February 27, 2018, 12:25:46 PM »
i had blank lines at the end of the program, might not have gotten pasted into the post. it seems that blank lines are needed after each M98 as well. do not remember reading anything about that in the manual but it could be there? with a blank line after each M98 it works perfectly and i can start making thousands of little parts, oh joy :)

Offline rcaffin

*
  •  1,003 1,003
    • View Profile
Re: return called with no sub in effect problem continues
« Reply #7 on: February 28, 2018, 01:05:33 AM »
 it seems that blank lines are needed after each M98
Um ... interesting. I think you mean after every M99 though.

Now I think about it, I do always have a blank line after every M99. Hum ...

Cheers
Roger
Re: return called with no sub in effect problem continues
« Reply #8 on: February 28, 2018, 01:46:34 AM »
no, i mean after every M98. my main program calls two subs and if i do not have a blank line after each M98 the program will now run and generates and error of something like return with no sub. some clever person on this forum suggested a blank line afer each M(* and this fixed the problem . also verified that it is a problem only with some versions of Mach3  unfortunately i am stuck with a particular version because one thing i am using does not work with a new version and another does not work with an older version. i could just dump everything and start over with new hardware that will have different problems :)

Offline rcaffin

*
  •  1,003 1,003
    • View Profile
Re: return called with no sub in effect problem continues
« Reply #9 on: February 28, 2018, 02:19:13 AM »
After every M98 ? ? ? ?
You must have an ancient and arguably very defective version of Mach3.

I am curious as to why 'one thing I am using does not work with a new version' - what is that thing?
OK, I am really challenging the claim. It's really not a good idea to be tied like that to a defective version of anything.

I would be seeking to fix that 'thing' problem myself.

Cheers
Roger