Biyernes, Pebrero 10, 2012

All about the programming language G-code

The G code programming language (standard for numerically controlled machines) developed by the EIA (Electronic Industry Association), provide a basis for the writing of numeric control programs for NC and CNC machine.


Specific Codes:
G-codes are also called preparatory codes, and are any word in a CNC program that begins with the letter "G". Generally it is a code telling the machine tool what type of action to perform, such as:
  • Rapid move (transport the tool through space to the place where it is needed for cutting; do this as quickly as possible)
  • Controlled feed move in a straight line or arc
  • Series of controlled feed moves that would result in a hole being bored, a workpiece cut (routed) to a specific dimension, or a profile (contour) shape added to the edge of a workpiece
  • Set tool information such as offset
  • Switch coordinate systems

G-Code from the Machine's Perspective

There are a handful of basic concepts you should know before we dive into what individual g-codes do and how to use them. Most importantly, you must understand what a computer language is and how to think about it. G-Code is a computer language aimed at telling your machine what to do. The trouble with computer languages like g-code is that unlike people, machines are very literal. They assume you know exactly what you want, they don't question you about it, and they immediately try to comply, even if that means hurting themselves!

For that reason, you need to adopt an approach of being protective of your machine, perhaps even over protective bordering on paranoid. It will do exactly what you tell it to even if that means rapiding a spinning cutter with 20HP behind it directly into your expensive fourth axis and destroying it. There's no need to be afraid of g-code, but it is important to understand it and to respect it in order to be successful. Getting to that stage is another excellent reason to spend time learning the g-code. It will give you insights into your machine that enable you to extract more performance and to protect it better from accidents.


G-Wizard G-Code Editor
Speaking of understanding g-code and protecting the machine, throughout this course we will be setting up to do exercises using the G-Wizard G-Code Editor. Think of it as a convenient etch-a-sketch on which you enter g-codes and can immediately see the toolpath that results. This makes learning a lot faster and easier when you have that immediate response versus trying to plot things on graph paper or work with your machine controller. In addition, you can make your mistakes on a simulator rather than with the actual machine until you get a lot more comfortable in your ability to command the machine successfully.
GWE Hints
GWE has a "Hints" window that shows you what each code does in plain English...
With GWE, you can study the g-code from the comfort of your armchair and let it sink in. More importantly, GWE gives you lots of additional information that's hard to get at with most controllers, and it has a host of features to help you through the process of learning g-code. For example, it's "Hints" feature tells you what each code does in plain English.
We'll be including some exercises with each section that involve working with GWE. From time to time we'll also include videos that help illustrate how to go about using GWE for the exercises.


Single Stepping to Understand the G-Code Better
A good simulator can do a lot more than just display a backplot; it can run through the program step by step and show you a great deal of information about what's going on. With GWE, a set of buttons similar to what is found on your CNC is used to control the simulation:
Simulator Controls
Simulator Controls...
To start a simulation, press the "Rewind" followed by "Cycle Start". You can control playback speed as a percentage of maximum with the Playback Speed controls. The Tortoise makes it run slow, the Hare makes it run fast and you can change the percentage as well. If you want to step through block by block, turn on the "Single Block" button. It will turn red to signify it is active. To exit the simulator and show only the finished Backplot, just press "Feed Hold".
Using these controls you can go through your program block by block. The "Special Stepping Controls" give you the ability to move ahead to points of interest more quickly:
- "5-Step" causes 5 blocks at a time to execute in Single Block mode instead of just one at a time. You can change the number of blocks this button will execute via the Simulator Options menu.
- "Next G00" moves the simulation ahead to the next G00. Often a g-code program will alternate between cutting moves and G00 moves to position for the next cut, so this is a convenient way to move forward.
- "Next G04" moves the simulator ahead to the next Dwell (G04). Why is that helpful? Dwells can be inserted almost anywhere in a program without causing a problem, so insert a Dwell in a place you want to be able to go to easily while debugging your program and use this button to get there quickly.
- "Next M06" moves the simulator ahead to the next Toolchange.
- "Next GOTO" moves the simulator ahead to the next place where the program jumps to a subroutine or block number. It's handy if you're trying to debug macros.

Simulator Screen Areas
When the Simulator is running, GWE displays quite a lot of additional information in a variety of screen areas:
Simulator Screen Areas
Simulator screen areas labeled in red...
Each screen area is called out in the illustration above in red. Here is the function of each:
G-Code
This area shows you the g-code. The line being executed is highlighted. The illustration shows the very top line highlighted. If you click on this pane, GWE will offer to stop the simulation so you can edit the code.
Backplot
This shows you the backplot of the moves made up to the currently executing line.
Position
Position is like the position display on your machine controller. It's showing you the X, Y, and Z coordinates, the Spindle RPM, the Feedrate, the current Tool, the Coolant status, and the time the program has run.
Modes
Modes tells you all the modal states of the controller. For example, is some work offset active? It also tells you the last few#variables that changed and what the values were that they changed to.
Hint
The Hint tells you in plain English what the g-code for the current line is expected to do. It also gives you a lot of other information that may not be obvious just looking at the program such as where an arc's center is located.




Conclusion
Therefore kahit hindi ako familiar dito sa G-code programming language ay masasabi kong mas pinadali ang pag poprograming dito pero syempre kelangan parin ng expirience para sa maximum na pag gamit nito para sa future programs na gagawin


SAna hindi alam ni sir to ^^


-Adrian Paul Liveta
-200910042

Walang komento:

Mag-post ng isang Komento