RS-274D : Standard Gerber with separate aperture tables
We can illustrate the structure and the content by using a very simple Gerber file:
The line numbers at the right side are not part of the file.
How to understand this Gerber file :
- Just by simply looking at the file, we can easily see that each (*) asterisk defines the end of the line (EOL).
- Further we can see that there are different kinds of commands:
- instructions beginning with G, D, M
- X,Y coordinates
- Explanation of the commands
- G-Codes: initialization codes
- D01, D02, D03: Draw and Flash Commands
- D10-D999: Apertures or D-codes
- M Codes: Miscellaneous
1. G-Codes : Initialization codes
The G-commands are initialization commands. They are mostly used to indicate to the plotter which data format is used.
We can recognize the following G-codes:
G90/G91 Incremental vs. Absolute Coordinates: ( line 1)
- The G90 command in line 1 tells the machine that data coordinates are absolute. Each set of coordinates is referenced
to the table's origin (0,0).
- The alternative to absolute is incremental - each coordinate is measured relative to the previous coordinate value and is set
by issuing the G91 command.
G70/G71 Inches versus millimeters ( line 2)
- The G70 command (line 2) indicates that the unit of measurements for the data to follow is inches
- The G71 command indicates that the unit is millimeters
G54 optional demand - don't panic if you don't find it back (line 3)
- The Tool select (G54) instructs the plotter to select the shape and line width described as Dxx immediately following the D54 command.
2. D01,D02,D03 : Draw and flash commands
D-codes are instructions to the photo-plotter. The first three D-codes control the movement of the x-y table.
- D01 (D1) - line 4 : move to the x-y location specified with the shutter open
- D02 (D2) - line 5 : move to the x-y location specified with the shutter closed
- D03 (D3) - line 6 : move to the x-y location specified with the shutter closed; then open and close the shutter, known as flashing.
D01 is the command that "draws" lines, D02 is the command to move the table without exposing any film. D01 and D02 correspond to
moving the paper on a pen plotter with the pen down (D01) and the pen up (D02).
D03 is the flash command. The table is moved with the shutter down. When the desired X-Y coordinates are reached, the shutter
opens and closes leaving the image of the aperture on the film. The flash introduction is an efficient way to image the thousands
of pads present on most circuit boards.
The commands D01-D02-D03 follow the coordinate data - lines 4,5,6 would move the table position first to 0,0 with the shutter closed,
then draw a line from 0,0 to 450,330 and position a flash on 455,300.
3. Apertures or D-codes
Unlike D01,D02 and D03, the D-codes with values from 10 till 999 are data, not commands.
They represent the line thickness and the shape used to make flashes or draws.
4. Miscellaneous M-codes.
At the end of the file we see the command M02*. Gerber calls the M-codes "miscellaneous codes".
The only commonly used M-codes are the stop commands at the end of a file. M00,M01 and M02 are all different types of program stop commands.
Back to PCB layout data overview