CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 12-27-2008, 04:35 PM
 
Join Date: Dec 2008
Location: palestine
Posts: 10
1041448 is on a distinguished road
Using G-code???

Hi guys , im new to CNC ,and i have a question.
Do i need special hardware to use g code in my machine ?? can i compile g code and install it on my PIC??
what do i need exactly to use G code in my machine???

Thanks for all the help in advance.
Reply With Quote

  #2   Ban this user!
Old 12-27-2008, 07:20 PM
 
Join Date: Jul 2004
Location: United States
Posts: 6
luckyjim is on a distinguished road
That's the way we all learned.

Don't know what kind of kind machine you are using, or what controller, but I have never seen one that you could not just stand at the console keypad and type it in. Lots of guys still do that. Personally I think they're nuts. Go sit down at your computer, open Notepad, Wordpad, or any other word processor, (if you use Word, save your program as a .txt file) and start typing. When you have what you want, you can upload it using your RS232 port, floppy disc, ethernet, etc.. You'll need cables and a communications program of some sort. There are a lot of old, simple, bulletproof ones.
Ask around. Actually you can use -Hyperterminal-, the program that comes with all Windows OS's. You'll find it in the accessories folder. It's tough to use though if you don't know just how to set it up for your controller. The floppy disc is the easiest if your machine control has a floppy disc drive but it probably won't if it's older.. Otherwise get ready for the sore feet you'll get standing at the console typing with 2 fingers... G-code, Mazatrol, Caps, Maps or whatever, it all ends up as 0's, and 1's (binary) in the machine's head.
After you've spent your 10,000 hours typing all that G-code, you've paid your dues. Then go buy a good Cad/Cam package and never type another line.
G0 od luck
Remember, close the door before an M8!
Reply With Quote

  #3   Ban this user!
Old 12-27-2008, 10:52 PM
vlmarshall's Avatar  
Join Date: Mar 2006
Location: usa
Posts: 474
vlmarshall is on a distinguished road
Talking

Originally Posted by luckyjim View Post
Remember, close the door before an M8!
Haha, I've been known to put an extra M00 before an M08, with the comment (Close Doors or Take a Bath!) between the two, in setups that require the operator to swap or flip parts during a cycle.

Reply With Quote

  #4   Ban this user!
Old 12-28-2008, 06:25 AM
 
Join Date: Dec 2008
Location: palestine
Posts: 10
1041448 is on a distinguished road

Thank you for your time to answer .
Im not sure i got what i wanted from the answer.
1-What do i need to use G code in my machine? can i send G code instructions serially to the PIC on my CNC ?? how should the PIC understand the G code instructions G00 G01 ..etc ???
2- Is there a special hardware i must get to use G code ?? or does G code can be installed on a PIC .
3- If im not using G code what can i use instead??
Reply With Quote

  #5  
Old 12-28-2008, 08:53 AM
wendtmk's Avatar
Moderator
 
Join Date: Dec 2005
Location: USA
Posts: 234
wendtmk is on a distinguished road

We need a wee bit more information than what you've given us so far. What are you using for motion control software? What kind of a machine? What kind of controller are you using?

Mark
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 12-28-2008, 11:14 AM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

Guys, you might be misunderstanding the question.

1041448
I know nothing about PIC's. Are you working on a concept similar to seen here?
http://cnczone.com/forums/showthread.php?t=59461
The author of that thread was offering help 6 mths ago. Maybe the offer is still open.

Then again, I may also be misunderstanding the question
__________________
Anyone who says "It only goes together one way" has no imagination.
Reply With Quote

  #7   Ban this user!
Old 12-28-2008, 12:36 PM
 
Join Date: Jul 2004
Location: United States
Posts: 6
luckyjim is on a distinguished road
More info.

Originally Posted by 1041448 View Post
Thank you for your time to answer .
Im not sure i got what i wanted from the answer.
1-What do i need to use G code in my machine? can i send G code instructions serially to the PIC on my CNC ?? how should the PIC understand the G code instructions G00 G01 ..etc ???
2- Is there a special hardware i must get to use G code ?? or does G code can be installed on a PIC .
3- If im not using G code what can i use instead??
Type your code in with the controller keypad to start. Get some examples of simple warm up routines and experiment with them. The controller will know what to do with the program when you press the cycle start button. Start slow, set the Rapid rate and feedpot way down. See that big, red, half broken off button? That's your E stop. Be ready to use it. Writing G-code is no different than what you are doing now. Typing words (G1) and sentences (called blocks), G1 X2. Y2. F10.5;. At the console keypad, probably alphanumeric if it's a turning center, you will probably have to hit input after each word and EOB ( at the end of each block

.If you mean PC when you write PIC, then yes, you can upload your G-Code files serially using the serial port on your PC and the RS232 port on your machine. As I said above, you will need the proper cables and software to upload your file. I don't know what other options you have. Unless you have some oddball contol like a Bandit or something, G-code is what you use. Even machines like Mazaks with their Mazatrol programming system allow the programmer to change settings to accept EIA (G-Code). Fadal has a simple program that will communicate with any machine with a RS232 port for about $200.00 There are plenty of others. If you have Windows, you already have one, Hyperterminal, but it's over my head.. You can probably find some generous soul to give you something easier than that. You need the cable no matter what. What configuration the cable needs to be depends on your machine control. It's usually just a matter of gender changers or null modems, with are cheap to get it right if it doesn't work the 1st time. You'll need a manual to find out what baud rate, how manystop bits, and what parity to use to communicate. Or someone out here who has the same setup as you and can help you out. It's not as bad as it sounds.
We need to know what type machine and controller you have. We need more details. Show us an example of what you're trying to do.
It's tough when your all alone trying to figure his out, but it can be done.
Reply With Quote

  #8   Ban this user!
Old 12-28-2008, 01:55 PM
 
Join Date: Dec 2008
Location: palestine
Posts: 10
1041448 is on a distinguished road

Im sorry i wasnt clear in my question.
I attached a flow chart of the machine i intend to build .
Hardware wise , do I need another part ??
Can i use G code with design?? how would that go??
Again thx for all of ur time.
Attached Thumbnails
Click image for larger version

Name:	Design.jpg‎
Views:	76
Size:	31.3 KB
ID:	72367  
Reply With Quote

  #9   Ban this user!
Old 12-28-2008, 03:10 PM
jcoats's Avatar  
Join Date: Nov 2005
Location: USA
Posts: 92
jcoats is on a distinguished road

G-code (g and m codes) make an interpreted 'language' that you really don't 'compile'. Some g-code interpreters use different 'dialects' of g-code. So if you know the set of instructions your code interpreter uses well, you can pretty quickly write g-code programs to do lots of 'normal' (standard geometric shape) processing.

In the picture it appears that the PIC may be running a g-code interpreter. You would code the g-code in your 'computer' and send the g-code to the PIC via a serial cable. The PIC interprets it, sends commands to your stepper motor drivers to activate the steppers corresponding to your g-code commands.

To get the 'job done' you probably need a 'board' for the PIC, to interface to the RS-232 and to the LM-289 driver boards. You will also need power supplies for the Stepper motors (that will really hook to the LM-289 driver boards) and a logic power supply for the PIC, it's board, and possibly the logic side of the LM-289 driver boards depending on their particular requirements. A box to put them in with fan for cooling, protection, etc is also a nice idea.

If you want to up your personal efficiency (if your time is worth money) getting a bit more hardware than a PIC as a controller, you can use an inexpensive commercial g-code interpreter (like Mach3 or competitors) or a good free interpreter (like EMC2 from linuxcnc.org)

Then you probably want to get some CAD/CAM software that allows you to do more with less of your time, like CAMBAM or any number of others.

I think you may be starting out well, if you want to really learn the how's and why's of CNC and machine control using a setup like you pictured. If/when you get 'the bug' and want to be more serious you can 'move up' or build new more robust equipment as your needs and finances dictate.

If this was trying to put beans on your table at this point, I would consider going to a more commercial solution sooner rather than later. If it is for hobby / education, take your time, learn, enjoy.

I'm curious, what code are you programming the PIC with to be the g-code interpreter? Or are you going to write your own? It would be an interesting task, but it has been years since I did board/chip level development for fun.

I hope this helps a bit. Does it answer the question you thought you asked?
Reply With Quote

  #10   Ban this user!
Old 12-28-2008, 05:44 PM
 
Join Date: May 2005
Location: canada
Posts: 1,149
cyclestart is on a distinguished road

I can't add much to jcoats very thorough answer except a diagram. This is a drawing of how most people here approach stepper cnc. The gcode interpretor on the computer and step/direction signals sent from computer by parallel port. pport cable to breakout board and commercial drives (gecko, kelingnc, whatever)

I expect you were aware of the common approach and have good reason for going the PIC route. There is a PIC design forum here. You question may draw different responses if posted there.

Edit/ "Commercial drives" was a bad choice of words. Sounds industrial/expensive.
Bored and nitpicking my own post.
Attached Thumbnails
Click image for larger version

Name:	3-axis_ProboStep_wiring_dia.jpg‎
Views:	67
Size:	99.0 KB
ID:	72398  
__________________
Anyone who says "It only goes together one way" has no imagination.

Last edited by cyclestart; 12-28-2008 at 08:34 PM.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 12-28-2008, 06:23 PM
 
Join Date: Jul 2004
Location: United States
Posts: 6
luckyjim is on a distinguished road
Huh?

You lost me bro. I'm just an old machinist.
Reply With Quote

  #12   Ban this user!
Old 12-28-2008, 07:47 PM
 
Join Date: Jan 2007
Location: MI. USA
Posts: 203
CarbideBob is on a distinguished road

G-code is just a programming language. Just like basic or C but the instructions are designed for moving things around.

Your PIC is not going to understand the instructions so you need a piece of software in between to convert the high level instructions to something you chip understands. If you program a computer in basic you need something like visual basic to convert the basic commands to the chip level instructions that your x86 cpu can process.

Typically G-code is converted to machine instructions one line at a time and then processed by the motion controllers CPU. In computer jargon this type of processing is know as an interpreter. G-code is rarely (if ever) compiled. A compiler processes your entire program at once and produces a file, usually now called an .exe file, which contains the chip level instructions to be executed.

Packing a full G-code interpreter into a PIC would be quite a challenge. My G-code system is over 20,000 lines of code but that includes the user interface. A subset using just G00, G01, G02, and G03 wouldn't be too hard if you've got a fair amount of programming experience. If you want features like cutter compensation and such I'd suggest you look for a packaged solution.

Something like Mach or EMC will do all the heavy lifting for you and you won't need the PIC at all.
Bob
__________________
You can always spot the pioneers -- They're the ones with the arrows in their backs.
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd NC Code and G-Code Tazzer General CAM Discussion 10 01-09-2012 01:07 PM
To hand Code? or to CAD Code? automizer Polls 81 11-26-2011 09:30 PM
learning g code or cad-cam code output? slow_rider G-Code Programing 3 02-27-2010 08:48 PM
G-code for beginners - want to learn G-code FPV_GTp G-Code Programing 7 11-17-2008 11:25 PM
looking for g code 3d from bobcadcam or simmilar for indexer lpt v5 with g code soft troyswood Ability Systems - LPT Indexer and G-Code 2 12-24-2006 09:21 PM




All times are GMT -5. The time now is 12:09 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361