# Why is the range of transponder digits 0 to 7 rather than 0 to 9?

As a controller on IVAO I sometimes assign codes like 0168 and find out later that the code isn’t valid. For me, the range 0-9 seems more logical. Why do we have to use octal numbers and not decimal?

• The code is not limited to 0-7, the code happens to be expressed in radix 8, but it could be in radix 10, or any other one. $3657_{\small 8}$ is the same than $1529_{\small {10}}$. See this converter. However a binary encoder wheel with 10 positions is (was) more difficult to build than a wheel with 8 positions. – mins Apr 27 '17 at 20:20
• @mins, I disagree with your last statement. Initially once transponders had settable codes, there were 6 bits, and that was by convention assigned two octal digits. It had nothing to do with a 10 position wheel vs an 8 position wheel, or the economics thereof. – mongo Apr 27 '17 at 20:24
• – fooot Apr 27 '17 at 20:42
• @mins The altitude data is not transmitted just as a number of feet (or meters) but in a code that uses the same binary number system as the identifier. See en.wikipedia.org/wiki/Gillham_code. Another trivia fun fact: the original British WWII transponder system was codenamed "Parrot". That's where the ATC instruction "squawk" came from! – alephzero Apr 27 '17 at 22:07

The four-digit transponder code that is entered by a pilot is an octal number rather than a decimal number, and in the octal numbering system, only the digits 0-7 are valid.

As far as why, internally it's actually a 12-bit binary number and octal works really well since can be used as a "shortcut" for entering groups of three binary digits at a time (000 - 111, which is 0-7 in octal).

If it were designed today, with the additional computing power and software complexity available, it would be possible to use a decimal number even if it is stored as binary internally, just so that it is more familiar. At the time that the system was created though, changing the dials directly set the code in hardware and doing the conversion would have been much more complex / difficult / expensive.

In short, it was convenient for the engineers and manufacturers, and just an oddity for the end users, so they left it that way.

• In addition, even though nowadays it would be possible to use decimal encoding, with dials that allow setting 0000...4095, you would need to prevent setting 4096...4999 (or 9999 if you didn't limit the first dial to 0...4). Using octal dials, you cannot select outside the valid range of 0000...7777. – TripeHound Apr 28 '17 at 5:32
• As a side note; This is the very same reason IPv4 adresses contain 4 0-255 numbers (2^8 options), MAC adresses are written down as a set of hexadecimal pairs (2^8 options in range 00 to FF). Both are used because of very easy conversion from/to binary system. Since user doesnt do any math with such addresses, there is no drawback at all. – Crowley Apr 28 '17 at 10:34
• "If it were designed today..." they would use 24 bit hexadecimal codes :) – J. Hougaard Apr 28 '17 at 13:35
• @Lnafziger I was referring to mode-S – J. Hougaard Apr 28 '17 at 17:59
• I want to upvote this answer, but its value is exactly 2^6 and I just can't destroy this beautiful number and dare everone who upvotes it! – Noah Krasser Oct 25 '17 at 20:13

Transponders are using series of values with 2 states that can be viewed as binary numbers to a certain extend. A very short answer to your question is: When dealing with bits, it's more easy to have devices that work with a number of combinations which is a power of 2 (2, 4, 8, 16, 32...) than a power of ten (10, 100...).

This won't really explain, so I propose to look at the problem in depth for the fun, and while doing this let's fix a number of frequent misconceptions. As a bonus, I'll show the actual complexity of using decimal selectors in the case of transponder by trying to design a circuit using Boolean tools.

Technical specification: a 12-bit binary number and 4096 values

The transponder radio signal for the ID transmission is made of 12 pulses (modes A/C) that can be low or high, this allows 4096 ($2^{\small {12}}$) combinations.

As the pulses have only two states, low or high, we can refer them directly as a 12-bit binary number.

The pulses are A4-A2-A1 B4-B2-B1 C4-C2-C1 D4-D2-D1, they are interleaved in the transmission.

As it would be a waste to not use all of them, we are left with an this number of 4096 possibilities.

To tell the transponder what are the L/H levels of the 12 pulses, we need to provide a 12-bit binary number between 0 and 4095.

Let's take some values (you can follow all conversions using this online converter):

Make numbers more human: Octal and hexadecimal numbers

It's not easy to remember accurately such 12-bit binary number. To be able to manage binary values, we usually replace groups of bits by another equivalent.

It's common to use groups of 3 and 4 bits (we can add as many 0 on the left as we want, like we do in decimal: 25 = 025 = 00025):

Octal: A group of 3 bits can generate 8 combinations, we can easily replace this group by a single figure in radix 8 to cover these combinations. Radix 8 is named "octal" numbering.

Maybe you're asking why radix 8 has 8 figures only: It's a consequence of the radix definition, e.g. we are using radix 10 in life, we have 10 figures from 0 to 9.

Hexadecimal: Similarly a group of 4 bits generates 16 combinations (twice the number of combinations for a group of 3, as the additional bit can have two values). We can replace the 4 bits of a group by a figure in radix 16, which name is "hexadecimal" numbering.

Let's be back to our examples, and replace the groups of bits by their equivalents in radix 8 or 16:

What have we got so far? We started with a 12-bit number, grouped bits either by 3 or 4, obtained the octal value (0000 to 7777) and hexadecimal value (000 to fff) equal to the binary number. We also have the decimal value of the bits (0 to 4095). Which one is better in this case?

The answer has been provided in other posts: At the beginning there was only 6 pulses allocated for the ID. Logically, they were grouped by 3, and octal was chosen. If there had been 7 pulses, probably the hexadecimal representation would have been selected, with values from 00 to 7f.

It was easy to design a wheel switch (thumbwheel) with 8 octal symbols that manage 3 actual switches to generate 3 on/off (low/high) electrical signals:

To use the angular position of the wheel to close or open the three contacts, we could use many designs, one is to use brushes rotating over a disc with printed conductive tracks:

The switch then provides directly the binary group. By assembling four switches, we could provide the transponder the "squawk" code, that is the binary configuration for the ID pulses.

It's as easy to use hexadecimal wheels with 4 contacts.

So why not 10 symbols?

We cannot group bits of a binary number into groups that can have exactly 10 combinations. This property is limited to power of 2 radix (4, 8, 16, 32...)

The radix 10 figures (our decimal system) are not good substitutes for direct conversion of binary.

It was possible later, with the introduction of integrated circuits (memories) to convert quite easily for decimal to binary. The 74S484 has been one such ICs. It could handle two inputs representing decimal values (the so-called "binary-coded decimal", BCD) and convert them in pure binary. The converter for 4 decimal figures (0 to 4095) would be designed like this, using 5 of these circuits:

As you see, it's more simple to use only 8 symbols ($2 ^{\small {3}}$), or 16 ($2 ^{\small {4}}$), and more generally a power of two.

It's legitimate to think we could also use a logic based on simple Boolean gates (NAND, XOR...) to manage the conversion from decimal to binary instead of a memory. This is not apparent at first sight, but it would actually requires a huge quantity of gates.

In order to be convinced, just follow the last part of this long post, I have done the exercise for only a single bit (out of 12) and for only two decimal wheels out of 4.

Calculate bit 4 value using only logical gates

Let's evaluate the Boolean circuitry required to get the right value for bit 4 of the binary ID (the one which as a weight of 16), taking into account only 2 decades: The wheel for the tens, and the wheel for the units.

With two decades, we manage 100 IDs, 0 to 99 in decimal. When we convert these decimal numbers into binary, we see that bit 4 has a value of 1 for wheels combinations 16 to 31, 48 to 63 and 80 to 95. I used this table to make this clear (click to enlarge):

There are also wheel BCD outputs that are not valid, because a decimal wheel won't issue a BCD code of 1010 which is greater than 9. The final result is in the truth table in pink in the right hand columns.

It also appears the value of the rightmost bit of the Unit wheel BCD output has no impact in the value of bit 4, so we may discard it from the analysis.

Currently the function to obtain bit 4 has not been optimized and it has tens of terms, each one would more or less requires its own gate (Dt is bit D of the BCD value for the Tens wheel, Cu is bit C for the Units wheel, etc):

Let's enter this into a Karnaugh's map using Karma from UFRGS. We are interested in indicating the combinations of inputs for which bit 4 has a value of 0, of 1, and cases where its value is not relevant (noted "-" in the truth table):

The order BCD bit values in the map is such that only one bit varies between adjacent cells (this order has a advantage of locating closely a variable and its 1's complement, and creating symmetry axes in the map (more details in Wikipedia article on Karnaugh's map).

Using Karma, we can now simplify the function used to set the value of bit 4:

After minimization:

The minimization allowed to reduce the number of terms (hence gates) from 24 complex to 10 simple. Still, this is only for one bit and two wheels. Sometimes it just doesn't worth the additional difficulty, specially at a time there was no ICs, to stick to decimal.

This last part was for the fun, but it clearly demonstrates how using octal or hexadecimal can greatly simpliy the work to be done.

• Engineer much? :) Excellent explanation! – FreeMan Apr 28 '17 at 13:37
• Why on earth would you make a redesign now using complicated 1970s technology like that, when all you need is a simple keypad and a microcontroller - only \$10 for both, compared with at least \$50 for the parts to build this museum piece? That's assuming you can even source the parts - the 74S484 chip is long out of production, though there are more modern equivalents. – alephzero Apr 28 '17 at 17:09
• @alephzero: This is an educational answer, it needs to provide the concepts, not the state of the art. BTW a "simple keypad and micro-controller" are more expensive than you think in the aviation world, you have to make them certified. This is not a world where you can phone Apple to tell them you have a problem. – mins Apr 28 '17 at 17:30
• This is a much better answer than Lnafziger's. – Tyler Durden May 1 '17 at 1:09
• @TylerDurden I believe that it depends on the technical level of the reader, and this answer will be better for a more technical person (like us) while my answer is better suited for less technical types. When I answer a question, I use the complexity appropriate to the original question, and the wording of his question made it seem like he didn't need this level of detail. Good info for others though, and I certainly up-voted this answer to show appreciation for the info and effort that he put into it! :) – Lnafziger Jun 4 '17 at 19:07

Entering squawk codes in octal, or base-8 where allowable digits are 0 through 7, makes the human-machine interface between pilot and transponder as simple as possible.

### Background

Mode A and Mode C compatible transponders use 12-bit identity or beacon codes. Each bit has two options, high or low, which works out to a total of 212 = 4,096 representable (i.e., that fit within 12 bits) identifiers, ranging from 0 to 4,095 in base-10, written 409510. Now, not all representable indentifiers are valid. For example, 75008 is reserved for specific situations, but that is not for the circuitry to worry about.

Quantities that fit exactly within some number of bits do not line up cleanly with powers of ten. Consider a hypothetical transponder that accepts four decimal digits 0000 through 9999 or 104 = 10,000 possible inputs. The pilot is more likely to handjam a bogus squawk than a representable one. This “simpler” interface now has an error condition that it must deal with: representable and unrepresentable inputs. If the pilot types or spins the dials to anything above 4095, how will the transponder reply? Should it blink an error light that the pilot may miss? How should it reply to interrogation while in a bad state? Silently clip the beacon code to all bits high (111 111 111 1112 = 409510 = 77778)? Stop replying entirely? More modes mean more testing and more expense.

‘Ah,’ thinks the clever old-school engineer. ‘No more fancy buttons; we will give the leftmost dial only five positions, 0 through 4.’ But what about the second dial that must be 0 when the first is 4 but can be any digit otherwise?

We have twelve bits to fill. Perhaps the pilot enters the binary directly. “Cessna 123AB, squawk zero-zero-one-zero-one-zero-zero-zero-…” Just imagine the frequency congestion with such long instructions, readbacks, corrections, and confirmations.

Our short-term memory is good for about seven items, give or take two. Twelve binary digits (“bits”) are too unwieldy. Other factors of 12 are 6×2 and 4×3.

Factoring the twelve identity bits into six and two means squawk codes in either two 6-bit quantities (0-63) or six 2-bit (0-3) chunks. Imagine dealing with 64-position dials in the old days. Doing it with decimal buttons gets us back to the problem of unrepresentable codes. Six dials each with 0 to 3 may work, but that makes the dials smaller and forces the pilot to deal near the limit of short-term memory, both making this option error-prone and thus less desirable.

Three groups of 4-bit or hexadecimal quantities could work. Although hex values range from 0 to 1510, a common convention is to use digits 0 through 9 and then A through F for ten to fifteen. In other words, we are down to one digit per place, but in the old days, that would have meant using 16-place dials. Today, that would mean sixteen buttons on the face of the transponder. However, “Approach, Cessna tree-alpha-bravo declaring an emergency and squawking foxtrot-charlie-zero for this charlie foxtrot!” does have some mnemonic value.

### The Sweet Spot

Considering it the other way, we have four groups of three bits. In binary, place values are powers of two (not powers of ten like we’re used to thinking in decimal). Working with three bits each, the maximum value for any beacon code digit is

$$(1 \cdot 2^2=4) + (1 \cdot 2^1=2) + (1 \cdot 2^0=1) = 7$$

• Squawk codes have four places — easily manageable in short-term memory.
• All digits are familiar 0 through 7, so
• Dial inputs have only eight positions or
• Eight buttons suffice.
• All four-digit pilot inputs are representable in Mode A or Mode C.
• The transponder doesn’t have to worry about what to do with bad inputs.
• Excellent answer! – Lnafziger Apr 28 '17 at 16:11

The simple answer is that a mode A or mode C transponder allow 12 bits of identification data, and three bits can be described as an octal digit. Therefore there are four octal digits, of which range between 0000 and 7777.

The question has changed, so I am supplementing this answer. The convention of using octal numbers for transponder codes dates back to an earlier implementation of transponders which had 6 bits of aircraft identifying data. It was decided (I believe by some white shirted COTR) to go with octal digits. Dealing with computers, octal or hex are easier than decimal. Later the transponder aircraft identifying field became 12 bits, and the octal convention was maintained. It is a convention, and it has been maintained.

Supplemental: I remember a transponder which had 6 toggle switches for entering the code, prior to the 12 bit standard. The switches were marked by threes with 4-2-1 underneath them. Back prior to computer literacy of the masses, once can speculate the the selection of digits, rather than for example, hex, entered into consideration as IFF and transponder technology developed. A VFR squawk code could be entered as a 12, which would have most significant 1 switch up, and the least significant 2 switch up. I recall that secondary radar show that the same as 1200, even though it came from a transponder without the 12 bit standard. 77, or all switches up was for emergencies, and 76 and 75 all respectively mapped to modern day 7700, 7600 and 7500 codes.

The 12 bits were set by the system timing and accuracy of pulse generation and processing technology available at the time. Having set 12 bits they could have done 0 to 4095 but that would have required special switches and/or gearing for the display. So to keep things simple they used Octal with 4 simple, 8 position switches.

In computer systems, everything is binary. This is due to the logic circuitry only having 2 states, high and low voltage. Because of this, decimal wouldn't be as simple to convert to binary as octal or hex are.

• The decimal-to-binary translation is completely trivial for any computer system (even the cheapest calculator can do it!) - but the first aircraft transponders were used towards the end of WWII, well before there were any computers small enough to fit inside a plane and reliable enough to be useful for this type of application, – alephzero Apr 27 '17 at 21:53
• These systems were designed many decades ago, and the system remains unchanged for simplicity's sake. But all computers are still binary. And machine code isn't decimal because of this. – alex Apr 27 '17 at 22:02
• and quantum computing is going to blow your mind if you're a fan of counting possible [qu]bit states :) – Lightness Races in Orbit Apr 27 '17 at 23:49
• @mins I've heard of analogue computers, but don't they require near constant tuning to be accurate? – alex Apr 28 '17 at 10:43
• @alex: We know how to have stable voltages, or stable clocks, to a given precision. We can use operational amplifiers, PLL, etc as the base. – mins Apr 28 '17 at 11:16