43
$\begingroup$

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?

$\endgroup$
2

6 Answers 6

85
$\begingroup$

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.

$\endgroup$
7
  • 19
    $\begingroup$ 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. $\endgroup$
    – TripeHound
    Apr 28, 2017 at 5:32
  • 11
    $\begingroup$ 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. $\endgroup$
    – Crowley
    Apr 28, 2017 at 10:34
  • 11
    $\begingroup$ "If it were designed today..." they would use 24 bit hexadecimal codes :) $\endgroup$ Apr 28, 2017 at 13:35
  • 1
    $\begingroup$ @Lnafziger I was referring to mode-S $\endgroup$ Apr 28, 2017 at 17:59
  • 3
    $\begingroup$ 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! $\endgroup$ Oct 25, 2017 at 20:13
64
$\begingroup$

Octal representation is a cheap way to deal with small binary numbers

Modes A and C transponders send their ID using a train of pulses of unmodulated carrier, which can be seen as a sequence of bits. Today, such transponders use 12 pulses (mode S transponders use a 24-bit address which is different):

enter image description here
Source

Pulses are labeled A4-A2-A1, B4-B2-B1, C4-C2-C1 and D4-D2-D1 (interleaved in the transmission). They are contained within two framing pulses for transmitter-receiver synchronization purpose, and there is an additional pulse X in the middle, always at 0 today, but used in the glory days as custom data by manufacturers (e.g. to report to ATC the position of a retractable landing gear).

The transponder must be told the value of each bit in some way. Today it wouldn't be a problem to enter the ID as a decimal number (between 0 and 4095), but when the transponder was invented, decades before the arrival of inexpensive programmable chips, a reliable converter was a costly device.

On the other hand, it was not an option to just provide the 12 values using On/Off switches:

enter image description here
Sample of miniature switches, source

Obviously mistakes would have been numerous, either during vocal transmission of the ID, or when entering the ID.

The simplest solution broadly used when dealing with bits is to group them, and associate a single symbol to each possible combination in the group.

It would be good to use groups with 10 combinations, we already have symbols "0" to "9" to represent them. Unfortunately when grouping bits by two, we obtain groups with 4 combinations each. If we group by three bits, the groups have 8 combinations. By four, the groups have 16 combinations, etc.

Because we are dealing with a number expressed in radix 2, the number of symbols to be used is always a power of two, never a power of 10. So engineers had no choice at the time, than to forget the decimal numbers and use an odd number of combinations. As an example, let's group by 2 bits and use Greek letters for the required 4 symbols:

enter image description here

We would be poor designers to produce this (except for a remake of Airplane!), but you've got the principle. To keep the system simple, we can use decimal number symbols if we need at most 10 symbols, and complete with letters if we need more. This is exactly what is done when spelling numbers in octal (groups of 3 bits) and hexadecimal radices (groups of 4 bits).

As explained in other excellent answers, the first transponders had only 6 bits for their ID, so octal was the sensible choice, and IDs were presented as 2 octal figures, e.g. "75" to represent "111 101". When the ID length was extended, the octal system remained in use.

In case your are interested by the details of how octal is used, I propose details below.


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 between 0 and 4095. Let's illustrate with some values:

enter image description here

We can add as many 0 on the left as we want (e.g. to have 12 bits), like we do in decimal: 25 = 025 = 00025.

Octal and hexadecimal representations of binary numbers

For convenience, we usually replace groups of bits by some equivalent to reduce the number of signs used. It's common to use groups of 3 and 4 bits:

enter image description here

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.

Hexadecimal: Similarly a group of 4 bits generates 16 combinations (twice the number of combinations for a group of 3, as the two values of the additional bit can be associated with all the 3-bit combinations. We can replace the 4 bits of a group by a figure in radix 16. Such system is named "hexadecimal" numbering.

enter image description here

Back to our examples, replacing the bit groups by their equivalents in radix 8 and 16:

enter image description here

Select which radix to use

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), two representations of the same binary number.

Which one is better in this case? The answer has been provided in other excellent posts: At the beginning there were 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.

From radix to electromechanical switch

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

enter image description here
Source

We use the angular position of the wheel to close or open the three contacts. There are many designs to do this, one is to use brushes rotating over a disc with printed conductive tracks:

enter image description here
Source

The switches 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 3 hexadecimal wheels with 4 contacts.

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...)

It was possible later, with the introduction of integrated circuits (as simple as memories) to convert quite easily decimal to binary. The 74S484 has been one such ICs. It could handle two inputs representing decimal values ("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:

enter image description here


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, I have done the exercise for only a single bit (out of 12) and for only two decimal wheels out of 4. I removed the details of the exercise, but they can be seen in the edit history. Here is the result:

enter image description here

The minimization allowed to reduce the number of terms (hence gates) to 10. 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.

$\endgroup$
6
  • 7
    $\begingroup$ Engineer much? :) Excellent explanation! $\endgroup$
    – FreeMan
    Apr 28, 2017 at 13:37
  • 13
    $\begingroup$ @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. $\endgroup$
    – mins
    Apr 28, 2017 at 17:30
  • 1
    $\begingroup$ This is a much better answer than Lnafziger's. $\endgroup$ May 1, 2017 at 1:09
  • 2
    $\begingroup$ @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! :) $\endgroup$
    – Lnafziger
    Jun 4, 2017 at 19:07
  • 2
    $\begingroup$ @TylerDurden, "better" is a value judgement that requires a goal to compare against. The goal is always subjective. Please define "better" according to what criteria. If the criteria is "fewer words" then this answer is objectively not better. $\endgroup$ Sep 25, 2022 at 20:38
9
$\begingroup$

Short Answer

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.

Tradeoffs

‘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$$

Here we find several advantages:

  • 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.
$\endgroup$
1
  • 1
    $\begingroup$ Excellent answer! $\endgroup$
    – Lnafziger
    Apr 28, 2017 at 16:11
9
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
-1
$\begingroup$

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.

$\endgroup$
5
  • 1
    $\begingroup$ 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, $\endgroup$
    – alephzero
    Apr 27, 2017 at 21:53
  • 1
    $\begingroup$ 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. $\endgroup$
    – alex
    Apr 27, 2017 at 22:02
  • 1
    $\begingroup$ and quantum computing is going to blow your mind if you're a fan of counting possible [qu]bit states :) $\endgroup$ Apr 27, 2017 at 23:49
  • $\begingroup$ @mins I've heard of analogue computers, but don't they require near constant tuning to be accurate? $\endgroup$
    – alex
    Apr 28, 2017 at 10:43
  • $\begingroup$ @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. $\endgroup$
    – mins
    Apr 28, 2017 at 11:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .