X,Y coordinates - Decimal point and Zero suppression
Coordinate data make up the bulk of Gerber files. It is difficult to manually follow the table motion from a printout because the Gerber format uses several techniques to minimize the number of bytes required to represent the data. These suppression techniques are :
- Suppress the decimal point in the x,y data
- Suppress either the leading or the trailing zeros
- Only output changes in coordinate data
- Only output changes in commands
a. Decimal point suppression
The decimal point is redundant if you know in advance where it will be. The decimal point needs to be reinserted by the photo-plotter control software in the correct location. Consider the following Gerber commands:
X00560Y00320D02* X00670Y00305D01* X00700Y00305D01*
The table moves along X from 00560 to 00670 during the first two commands. But what does 00560 represent? It
could be 5.6 inches, 0.56 inches, 0.056 inches or even 0.0056 inches. No way to tell. If the designer tells you that there are two integers before the decimal point and 4 integers after the decimal point then you know that 00560 represents 0.56 inch.
b. Leading and Trailing Zero Suppression
The designers of the Gerber database didn't rest after eliminating the decimal point. They must have looked at a printout and thought, "What good are all those extra zeros in front? Suppose we cut them off. You can still figure out the coordinate value if you count decimal points from the right side of the number".
| No Zero Suppression |
Leading Zero Suppression |
| X00560Y00320D02* |
X560Y230D2* |
| X00670Y00305D01* |
X670Y305D1* |
| X00700Y00305D01* |
X700Y305D1* |
Without zero suppression 48 bytes are used. With leading zero suppression 33 bytes are required to represent the same information. Depending on the data you might be better off leaving the leading zeros on and suppressing the trailing zeros.
| No Zero Suppression |
Trailing Zero Suppression |
| X00560Y00320D02* |
X0056Y0023D2* |
| X00670Y00305D01* |
X0067Y00305D1* |
| X00700Y00305D01* |
X007Y00305D1* |
To correctly interpret the data you must count from the left side of the number to locate the decimal point. Today leading zero suppression is more commonly encountered.
c. Modal Data Coordinates
After eliminating the decimal point and suppressing the redundant zeros you might expect the database designers would rest on their success. Not at all. One sharp eyed programmer noticed that the same coordinate would appear over and over again when the table moved only along X or Y, so " Why not remember the last value of X and Y, and output a coordinate only if it changes?"
| All coordinates |
Modal coordinates |
| X560Y230D2* |
X560Y230D2* |
| X670Y305D1* |
X670Y305D1* |
| X700Y305D1* |
X700D1* |
The concept that the plotter remembers the last value of coordiinates is called 'modality'. PC boards often have hundreds of pads in a row along X or Y and a properly sorted Gerber file will be much smaller when the redundant coordinate is eliminated.
d. Modal Commands
Modality is a good concept for data and works equally well for commands. For example, if you have a string of draw commands, why repeat the D01 command again and again? Let it stay in effect until another command (D02 or D03) occurs to change it.
| D1 not modal |
D1 modal |
| X560Y230D2* |
X560Y230D2* |
| X670Y305D1* |
X670Y305D1* |
| X700D1* |
X700* |
| X730D1* |
X730* |
| X760D1* |
X760* |
Back to PCB layout data overview
|