PDA

View Full Version : Trying to make this work- G code



WOODKNACK
06-10-2003, 08:13 AM
Hey guys,
Maybe someone out here can figure this one out. I have a program that is suppose to move my x axis 4 inches one way and then back again 50 times! But I cant seem to get it to repeat? Anybody have any ideas?

F10
G20 G90
M98 P1234 Q50
o1234
G1 x4
G1 x0
m99

kong
06-10-2003, 09:31 AM
I don't understand g-code that well, but I'll tell you what I know!
Firstly, you cannot have 2 g's on the same line, so you will have to seperate G20 and G90.
Secondly, I have just looked through the turbocnc manual, and it does not mention M98 and M99. In the turbocnc example (sample.cnc) the writer uses M60 and M62 to call sub-routines, so maybe this should be used instead.
Like I said, I do not know g-code, I have only read the instructions!

Rekd
06-10-2003, 09:38 AM
Originally posted by WOODKNACK

F10
G20 G90
M98 P1234 Q50
o1234
G1 x4
G1 x0
m99


the "O"1234 is for a seperate program.
Do this;



%
O1
F10.
G20 G90
M98 P1234 Q50
M30

O1234
G91
G1X4.
X-4.
M99
%


Assuming you're on a Fanuc compatable, make it just like that. You don't have decimal points on your feeds and X moves either.

The G90 and G20 are ok on the same line, G20 is (likely, depending on the control,) Inch programming, the G90 is Aboslute.

:edit:
If you're typing this in at the controller, you'll need to remove the "%"'s, and seperate the program. Create a new program, using 1234 as the number, and put the "lower" code in that program.
:/edit:

'Rekd teh B.U.M.A.

WOODKNACK
06-10-2003, 10:00 AM
Still cant get it to work. Stops at m30 code?

kong
06-10-2003, 10:52 AM
Rekd, when you say it's ok to have the two g's on the same line, are you talking about TurboCNC, or g-code in general? Also, I have re-read the instructions, and I have also noticed this:

************
Code letters:
************
Blah, blah....

D,L,H,Q Future Use
etc...

So does this mean that the Q values are not implemented yet?

HuFlungDung
06-10-2003, 10:53 AM
You have to read the manual :D

There is no way we could possibly guess what gcodes and associated parameters will work unless you can quote the relevant pages from your manual. Computers are very unforgiving of syntax errors!

Rekd
06-10-2003, 11:05 AM
Rekd, when you say it's ok to have the two g's on the same line, are you talking about TurboCNC, or g-code in general? Also, I have re-read the instructions, and I have also noticed this

that's on a fanuc or most fanuc compatables.

Try replacing the "Q" with an "L" and see if that works.

CAMmando
06-10-2003, 11:11 AM
What Rekd Said :)

WOODKNACK
06-10-2003, 11:21 AM
nope! no go. like I said it doesnt seem to be on that line. its the M30 line that it stops at.

Rekd
06-10-2003, 11:26 AM
:edit:
Keep in mind, you need two programs to do this. The first program, O1, calls the second program, O1234 via M98 P1234 L50 (The L50 repeats 50 times.)

The M30 is the end of all programs. The M99 is the end of sub program, with loopback to the calling program, O1 in this case. When it stops at the M30, has it gone thru the 2 X moves?
:/edit:

Do you have a sample program? Perhaps a sample with sub programs or sub routines?

'Rekd

WOODKNACK
06-10-2003, 11:28 AM
No this is just something I found on the internet and was trying to get it going in turbocnc..

balsaman
06-10-2003, 11:28 AM
stops and says what? Any error?

Eric

kong
06-10-2003, 11:28 AM
Ooh, ooh, me again!
More from the instructions:


************
M60 Jump to subroutine
************
Jump to line number given and save return address.
Usage:

N020 M60 #10 ;Jumps to line 10. Use a unique N code when calling subs.

************
M62 Return from subroutine
************
Back to most recent M60 call.
Usage:

M62 ;Will jump back to line N020 and execute next line in the above example.

See sample.cnc for a simple subroutine example. Please note that when using
subroutines, you'll need a unique N code on each calling line so that the
program knows where to go back to.
Therefore you will need to modify Rekd's code in order to run it, adding the line numbers for the sub-routine.
And if that doesn't work, then setup the machine just for one run, and use the automated production option, and set it for 50 runs.

balsaman
06-10-2003, 11:38 AM
Yep what kong said would be easier. 50 times.

Eric

WOODKNACK
06-10-2003, 11:54 AM
ok guys ill give that a try. Thanks. This is so much fun!!!!
I feel like im :drowning: in gcode! LOL

CAMmando
06-10-2003, 12:25 PM
Rekd, when you say it's ok to have the two g's on the same line, are you talking about TurboCNC, or g-code in general?

Normally, in fanuc compatible G code, multible G codes are fine as long as they are not in conflict (ie from the same group) such as G1 and G3.

Multiple M codes on the same line is usually trouble.

CAM teh Fanucer T and the "MG's"

HuFlungDung
06-10-2003, 12:45 PM
It sounds like the subroutine calls are more in what I would call "Bandit style", where the subroutine is nested inside the main program, preferably after the M30, but not necessarily if you can include an unconditional jump in the main program by commanding a line number on the next line after the M60.

The number associated with the M60 is the sub call address, there is no seperate "big O" program number involved.

hardmill
06-10-2003, 01:00 PM
Do you have the capability?
If so there you go. Yell if you need help.
PEACE:D