Tuesday, March 17, 2009

Gerber Data Format

The Gerber data format is an industry standard used for printed circuit board layouts. This type of data is used by photoplotter equipment which uses a light to "draw" a line using an aperture, or shape. The Gerber data file is an ASCII format that instructs the photoplotter with four basic pieces of information:

  • X/Y Coordinate Information
  • Aperture Selection - tool shape to chose
  • Shutter Commands - one of open, close, or flash
  • End of Line Character - typically an asterisk (*)

X/Y Coordinate Information

The X/Y coordinate information, like any numerical data in a Gerber data file, has an integer and decimal portion. However, the decimal point in not a valid character, and the decimal values are written as integers. The position of the decimal place in the integer is determined by three parameters:

  • Number of integer (whole number) digits
  • Number of decimal (precision) digits
  • Zero suppression
These parameters give rise to the "2,3" and "2,4" file format designations. The number in front of the comma (2) designates the whole number digits, and the number trailing (3 & 4 respectively) represent the number of precision digits. When written out, the decimal point of the value is removed, and the values are appended to one another.

For example, in "2,3" format, the value 12.345 becomes "12345". In the "2,4" format, the same value becomes "123450" in order to fulfill the precision requirement.

Zero suppression can be one of three types: leading, trailing, and none. Leading and trailing zero suppression remove "0" characters that are unnecessary to reduce the data file size.

For example, in "2,4" format, the value 0.0100 can benefit from zero suppression. Since 2,4 format requires 2 whole number digits (in this case 00), and four precision digits (in this case 0100), then the resulting value is converted to 00+0100, written as "000100" if there is no zero suppression.

With leading zero suppression, "000" at the front is not required, and so it is written as "100".

With trailing zero suppression, "00" at the end is not required, so it is written as "0001".

Zero suppression is only one method of reducing the size of Gerber data files. Another method is to eliminate the use of redundant data; this is referred to as Modality.
Gerber File Examples

There are two types of Gerber file formats. Refer to the Plotter Codes information for explanations on the information contained in the following data file examples:

Gerber RS-274D File Example

RS-274D uses two files to represent each layer of data. The first file is an aperture file which tells the plotter which shapes it can draw with. The second file is a list of coordinates and commands which tell the plotter how to draw the layer.

Aperture file

D10 10H 10V Round -Draw-
D11 20H 20V Round -Draw-
D12 15H 15V Round -Draw-
D13 5H 5V Round -Draw-
D14 40H 40V Round *Flash*
D15 34H 46V RCT *Flash*
D16 10H 10V Square -Draw-
D17 28H 100V RCT *Flash*
D18 60H 14V RCT *Flash*
D19 40H 40V Round -Draw-
D20 14H 60V RCT *Flash*


Coordinate Data File

%LPD*%
G75*D10*G1X98750Y71250D3*
%LPC*%
G75*D11*G1X19791Y-5996D2*X19878Y-6035D1*X19957Y-6114*X19996Y-6232*
Y-6272*X19957Y-6390*X19878Y-6468*X19791Y-6500*X19720D2*X19642Y-6468D1*
X19563Y-6390*X19524Y-6272*Y-6035*X19563Y-5870*X19602Y-5799*X19681Y-5720*
X19760Y-5681*X19524Y-6232D2*X19563Y-6114D1*X114510*Y130765*X119760*
X127890D2*Y140765D1*X122640*Y130765*X127890*X136020D2*Y140765D1*X130770*
Y130765*X136020*X144150D2*Y140765D1*X138900*Y130765*X144150*X111630D2*
X106380D1*Y140765*X111630*Y130765*X6800Y102445D2*X34800D1*Y140445*
Y140695*X28800*X6800*Y140445*Y102445*X129310Y70565D2*Y98565D1*X91310*
X91060*Y92565*Y70565*X91310*X129310*X45050D2*Y98565D1*X7050*X6800*Y92565*
Y70565*X7050*X45050*X87180Y38685D2*Y66685D1*X49180*X48930*Y60685*Y38685*
X49180*X87180*X129310Y6805D2*Y34805D1*X91310*X91060*Y28805*Y6805*X91310*
X129310*X45050D2*Y34805D1*X7050*X6800*Y28805*Y6805*X7050*X45050*X0Y0D2*
M02*

Gerber RS-274X File Example

Below is a sample of a RS-274X file, notice that aperture definitions are contained in the header of the file, there is no separate aperture file.

*G04 Output by CAMMaster V9.0.51 PentaLogix LLC*
*G04 Fri Feb 16 07:54:01 2007*
*%FSLAX44Y44*%
%MOIN*%
%IPPOS*%
%ADD10R,20.0X16.0*%
%ADD11C,0.008*%
%ADD12R,0.06X0.015*%
%ADD13O,0.06X0.015*%
%ADD14R,0.05X0.06*%
%ADD15R,0.03X0.04*%
%ADD16R,0.04X0.03*%
%ADD17R,0.12X0.12*%
%ADD18R,0.06X0.044*%
%ADD19R,0.06X0.05*%
%ADD20R,0.09X0.075*%

%LPD*%
G75*D10*G1X98750Y71250D3*
%LPC*%
G75*D11*G1X19791Y-5996D2*X19878Y-6035D1*X19957Y-6114*X19996Y-6232*
Y-6272*X19957Y-6390*X19878Y-6468*X19791Y-6500*X19720D2*X19642Y-6468D1*
X19563Y-6390*X19524Y-6272*Y-6035*X19563Y-5870*X19602Y-5799*X19681Y-5720*
X19760Y-5681*X19524Y-6232D2*X19563Y-6114D1*X114510*Y130765*X119760*
X127890D2*Y140765D1*X122640*Y130765*X127890*X136020D2*Y140765D1*X130770*
Y130765*X136020*X144150D2*Y140765D1*X138900*Y130765*X144150*X111630D2*
X106380D1*Y140765*X111630*Y130765*X6800Y102445D2*X34800D1*Y140445*
Y140695*X28800*X6800*Y140445*Y102445*X129310Y70565D2*Y98565D1*X91310*
X91060*Y92565*Y70565*X91310*X129310*X45050D2*Y98565D1*X7050*X6800*Y92565*
Y70565*X7050*X45050*X87180Y38685D2*Y66685D1*X49180*X48930*Y60685*Y38685*
X49180*X87180*X129310Y6805D2*Y34805D1*X91310*X91060*Y28805*Y6805*X91310*
X129310*X45050D2*Y34805D1*X7050*X6800*Y28805*Y6805*X7050*X45050*X0Y0D2*
M02*

RS-274D data files do not define apertures. Therefore, an application that lays out printed circuit boards and a photoplotter can interpret the aperture differently. To overcome this problem, an aperature file must also be included with the RS-274D file to ensure compatability - this is what the RS-274X Gerber format can solve. The RS-274X format has an aperture definition embedded in the file so that the separate aperture file is not required.
Additional Information

For additional information on Gerber files an their applications in printed circuit board layout, see the Gerber Files and Uses table.


No comments:

Post a Comment