![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| ||||
| ||||
Ok, how do I do write a simple program in gcode? I want to make the mill go from say 0 to 100, then back to 50 then up to 200 and back to 150 then up to 250 etc. So far I know G0y100 will move me from home, to y100mm position at full speed. There is an F200 command for feed speed, but where abouts in that line would that F code go? And can I add in a dwell too. And do I have to then number the lines as N1, N2, N3 with each seperate command on each line etc. Peter
__________________ My little site on MIG welding http://www.learn-how-to-weld.com/mig-welding/ |
|
#2
| |||
| |||
| Apples G0 is for rapid moves, G1Y100F50. G1 is what you want to use for a feed move G1Y100F50. G1Y-50F50. A Dwell is G04P500 The 500=0.5 second dwell (place this on a line by its self were ever you want it to stop/Dwell) Try this to start to see how it will work for you, You can ajust the numbers to suit
__________________ Mactec54 |
|
#3
| ||||
| ||||
| Cool thanks for that, I will give it a shot tomorrow and see how I go. yes G01 makes sense now.. In this code G04P500 What does the 4 mean? Or is it G04 together which means dwell, it looks like that.
__________________ My little site on MIG welding http://www.learn-how-to-weld.com/mig-welding/ |
|
#4
| |||
| |||
| Here is a run down on G-Code, standards are not strictly adhered to so things do change from machine to machine. G-code - Wikipedia, the free encyclopedia One of the better books I have found on CNC programming. CNCProgramming Handbook: Acomprehensive Guide to Practical Cnc Programming by Peter Smid - ISBN 9780831133474 And yes the dwell command is G04 or most machines will also take G4 |
|
#5
| |||
| |||
| Apples, whitespace within a block and leading zeros aren't significant in G-Code so G04P500 is the same as: G04 P500 G4 P500 G4P500 I suggest you download http://www.machsupport.com/docs/Mach3Mill_1.84.pdf and read chapter 10. It gives a good introduction to g-code and will answer a lot of your questions. bob |
| Sponsored Links |
|
#7
| ||||
| ||||
| Hey, I could get it to dwell. But then it just kept on dwelling, like chilling out and not moving at all. Here is a similar code o0001 (program name) N10 G00 Y100 N20 G4 P500 N30 G00 Y0 Do I need to add a start/go code after the dwell command?
__________________ My little site on MIG welding http://www.learn-how-to-weld.com/mig-welding/ |
|
#9
| |||
| |||
| Posted by mactec54 Try this G0Y0. You need a ./ period after the zero If its a Fanuc Control a period (decimal point) makes not difference for a zero value, Y0, Y0., Y0.0 are treated all the same by the Fanuc control. If a period is omitted in a coordinate value, the control will count 3 or 4 places to the left, depending on whether the control is in imperial or metric mode. In metric mode G21, Y100000 is read as Y100., similarly, Y100 is read as Y0.100 With a Fanuc control, G04 can be specified as Revs of the spindle by specifying G95 before the G04 dwell call, either on the same line of prior to the call. If your machine is in G95 (feed per revolution) mode and the spindle is not running, the program will stop at the dwell line waiting for the required number of rotations to be completed. You only show the move lines in your program snippet, so I don't know if you have the spindle running or not. If the spindle is not running, that may be the reason for the program dwelling for an indefinite period. The fact that the move lines are in rapid traverse will allow those moves to occur irrespective of the control being in G95 (feed per revolution), or G94 (feed per minute) mode as rapid positioning does not rely on the spindle rotating. Put G94 in your program prior to the G04 command and that should fix the problem if the spindle is not running. That's about the only thing that I can see in your program that would make it stop indefinitely once the G04 command has been launched. Again depending on the control, an X value will work with a G04 and is my preference. G04 X0.5 will initiate a dwell of 0.5 seconds in G94 mode and 0.5 spindle revs in G95 mode. With a Fanuc control, there is a parameter that can be set that will cause the G04 to be treated as a dwell in seconds for both G94 and G95 mode. Regards, Bill |
|
#10
| ||||
| ||||
| Yes indeed, welcome to the wonderful world of different controls which have slightly different g-code dialects. Some controls want that trailing decimal point even if there is no fraction, so we have to write "X1.". Some don't care and we can write "X1". RE your G4 (and there are controls that make you write G04) Dwell, the P500 may be interpreted as 500 milliseconds = 1/2 second on some controls or 500 seconds = over 8 minutes on others. That may be one reason why your Dwell just went on and on. As was pointed out, Dwell may also be expressed as revolutions (handy for some operations like making sure the bottom of the hole has seen a rev or two before you withdraw the twist drill). So, your first task is to lay hands on the programming book for your controller. Otherwise all these little idiosyncracies will make no sense as each person gives you advice from the context of their controller. You might find my G-Wizard G-Code Editor a helpful tool for learning: GWizardE: A Machinist's CNC G-Code Editor It lets you setup the g-code to match your controller's preferences. BTW, CAM programs call that a "post" informally. GWE has a "post" capability. In addition it has "Wizards" to help you get the syntax right entering the g-codes and "Hints" that tell you what the g-code does in plain English. Since it's in Beta test, it's free to play around with. Cheers, Bob Warfield
__________________ Try G-Wizard Machinist's Calculator for free: http://www.cnccookbook.com/CCGWizard.html |
| Sponsored Links |
|
#11
| |||
| |||
For Fanuc style controls, always use a decimal point in your moves. Example X5 means move .0005, X5. means move 5 inches. Big difference. Use your G0 to X, Y, rapid to where you want to do your work. You have to use height offset to rapid to where you want to start. Example G43H1Z.1 would use the value in height offset register 1 to move your Z axis to .10 above the top of your part. Use a G1 with a feedrate of say F5. for 5 inches per minute to feed to the depth required, since the G1 is modal, that means it is in a feed rate mode until you give it a different G0 code, you can just write the coordinates that you want to machine too. Example G1 Z-.25 F5.; X-1.Y1.; Y-1.;X1.;Y1.;X-1.;X0.Y0.;G0Z1.;M30; If you were using a .50 mill, the above program would cut you a 1.5 square pocket .25 deep, go back to the center and rapid the Z up 1.0 from the top of your part. Hope this helps from an old timer. |
|
#12
| ||||
| ||||
| Else if a G91 incremental mode is active the N30 G00 Y0 line will not move anywhere. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple GCode Reference / Commands? | WarrenW | G-Code Programing | 14 | 11-30-2010 03:03 AM |
| Need A Quote- Write knife grinding program | tr4252 | Employment Opportunity | 17 | 03-10-2010 07:57 PM |
| How to write a code program to cut threads | jjenks | NCPlot G-Code editor / backplotter | 7 | 04-21-2008 09:18 PM |
| Possible to write variables to a program? | Heavy D | G-Code Programing | 2 | 08-21-2006 11:08 PM |
| someone wanna write a program? | ljoe1969 | DIY-CNC Router Table Machines | 2 | 06-06-2004 07:47 PM |