# Gillham code

Gillham code is a zero-padded 12-bit binary code using a parallel nine- to eleven-wire interface, the Gillham interface, that is used to transmit uncorrected barometric altitude between an encoding altimeter or analog air data computer and a digital transponder. It is a modified form of a Gray code and is sometimes referred to simply as a "Gray code" in avionics literature.

## History

The Gillham interface and code are an outgrowth of the 12-bit IFF Mark X system, which was introduced in the 1950s. The civil transponder interrogation modes A and C were defined in air traffic control (ATC) and secondary surveillance radar (SSR) in 1960.
The code is named after Ronald Lionel Gillham, a signals officer at Air Navigational Services, Ministry of Transport and Civil Aviation, who had been appointed a civil member of the Most Excellent Order of the British Empire (MBE) in the Queen's 1955 Birthday Honours. He was the UK's representative to the International Air Transport Association (IATA) committee developing the specification for the second generation of air traffic control system, known in the UK as "Plan Ahead", and is said to have had the idea of using a modified Gray code. The final code variant was developed in late 1961 for the ICAO Communications Division meeting (VII COM) held in January/February 1962, and described in a 1962 FAA report. The exact timeframe and circumstances of the term Gillham code being coined are unclear, but by 1963 the code was already recognized under this name. By the mid-1960s the code was also known as MOA–Gillham code or ICAO–Gillham code. ARINC 572 specified the code as well in 1968.
Once recommended by the ICAO for automatic height transmission for air traffic control purposes, the interface is now discouraged and has been mostly replaced by modern serial communication in newer aircraft.

## Altitude encoder

An altitude encoder takes the form of a small metal box containing a pressure sensor and signal conditioning electronics. The pressure sensor is often heated, which requires a warm-up time during which height information is either unavailable or inaccurate. Older style units can have a warm-up time of up to 10 minutes; more modern units warm up in less than 2 minutes. Some of the very latest encoders incorporate unheated 'instant on' type sensors. During the warm-up of older style units the height information may gradually increase until it settles at its final value. This is not normally a problem as the power would typically be applied before the aircraft enters the runway and so it would be transmitting correct height information soon after take-off.
The encoder has an open-collector output, compatible with 14 V or 28 V electrical systems.

## Coding

The height information is represented as 11 binary digits in a parallel form using 11 separate lines designated D2 D4 A1 A2 A4 B1 B2 B4 C1 C2 C4. As a twelfth bit, the Gillham code contains a D1 bit but this is unused and consequently set to zero in practical applications.
Different classes of altitude encoder do not use all of the available bits. All use the A, B and C bits; increasing altitude limits require more of the D bits. Up to and including 30700 ft does not require any of the D bits (9-wire interface). This is suitable for most light general aviation aircraft. Up to and including 62700 ft requires D4 (10-wire interface). Up to and including 126700 ft requires D4 and D2 (11-wire interface). D1 is never used.
| Gillham binary code [D124 A124 B124 C124] | Squawk octal code [ABCD] | Height [m] | Height [ft] |
| 000 000 000 001 | 0040 | −365.76 | −1200 |
| 000 000 000 011 | 0060 | −335.28 | −1100 |
| 000 000 000 010 | 0020 | −304.8 | −1000 |
| 000 000 000 110 | 0030 | −274.32 | −900 |
| 000 000 000 100 | 0010 | −243.84 | −800 |
| 000 000 001 100 | 0410 | −213.36 | −700 |
| 000 000 001 110 | 0430 | −182.88 | −600 |
| 000 000 001 010 | 0420 | −152.4 | −500 |
| 000 000 001 011 | 0460 | −121.92 | −400 |
| 000 000 001 001 | 0440 | −91.44 | −300 |
| 000 000 011 001 | 0640 | −60.96 | −200 |
| 000 000 011 011 | 0660 | −30.48 | −100 |
| 000 000 011 010 | 0620 | 0 | 0 |
| 000 000 011 110 | 0630 | 30.48 | 100 |
| 000 000 011 100 | 0610 | 60.96 | 200 |
| 000 000 010 100 | 0210 | 91.44 | 300 |
| 000 000 010 110 | 0230 | 121.92 | 400 |
| 000 000 010 010 | 0220 | 152.4 | 500 |
| 000 000 010 011 | 0260 | 182.88 | 600 |
| 000 000 010 001 | 0240 | 213.36 | 700 |
| 000 000 110 001 | 0340 | 243.84 | 800 |
| 000 000 110 011 | 0360 | 274.32 | 900 |
| 000 000 110 010 | 0320 | 304.8 | 1000 |
| 000 000 110 110 | 0330 | 335.28 | 1100 |
| 000 000 110 100 | 0310 | 365.76 | 1200 |
| 000 000 111 100 | 0710 | | 1300 |
| 000 000 111 110 | 0730 | | 1400 |
| 000 000 111 010 | 0720 | | 1500 |
| 000 000 111 011 | 0760 | | 1600 |
| 000 000 111 001 | 0740 | | 1700 |
| 000 000 101 001 | 0540 | | 1800 |
| 000 000 101 011 | 0560 | | 1900 |
| 000 000 101 010 | 0520 | | 2000 |
| 000 000 101 110 | 0530 | | 2100 |
| 000 000 101 100 | 0510 | | 2200 |
| 000 000 100 100 | 0110 | | 2300 |
| 000 000 100 110 | 0130 | | 2400 |
| 000 000 100 010 | 0120 | | 2500 |
| 000 000 100 011 | 0160 | | 2600 |
| 000 000 100 001 | 0140 | | 2700 |
| 010 000 000 110 | 0032 | | 126400 |
| 010 000 000 010 | 0022 | | 126500 |
| 010 000 000 011 | 0062 | | 126600 |
| 010 000 000 001 | 0042 | | 126700 |

## Decoding

Bits D2 (msbit) through B4 (lsbit) encode the pressure altitude in 500 ft increments (above a base altitude of −1000±250 ft) in a standard 8-bit reflected binary code (Gray code). The specification stops at code 1000000 (126500±250 ft), above which D1 would be needed as a most significant bit.
Bits C1, C2 and C4 use a mirrored 5-state 3-bit Gray BCD code of a Giannini Datex code type (with the first 5 states resembling O'Brien code type II) to encode the offset from the 500 ft altitude in 100 ft increments. Specifically, if the parity of the 500 ft code is even then codes 001, 011, 010, 110 and 100 encode −200, −100, 0, +100 and +200 ft relative to the 500 ft altitude. If the parity is odd, the assignments are reversed. Codes 000, 101 and 111 are not used.$^{:13(6.17–21)}$
The Gillham code can be decoded using various methods. Standard techniques use hardware or software solutions. The latter often uses a lookup table but an algorithmic approach can be taken.