Circuit Shorts: The Flavors of Binary-Coded Decimals (BCD)
on
BCD encoding has advantages in some applications and was used quite extensively in the early days of digital processing. You can still see modern microcontrollers output BCD because, for example, it’s easier to display on a seven-segment display compared to the additional logic required if the output was in binary. Each flavor of BCD was developed with a subtle advantage for a particular application, like a symmetry property or the location of particular bits. Most of those applications are not all that relevant anymore, however.
A few of the many encoding flavors are shown in the table below where the numbers in the header are the weights of the bits, which can also be negative. So 8d in 63-2-1 encoding is 1101b (1x6 + 1x3 + 0x(-2)+ 1x(-1)), although 0, 3, and 6 can be encoded in two different ways!

But there’s more. Those states that aren’t used in Natural BCD are sometimes used to indicate if the number is negative or positive; those are called Packed BCD. The 3GPP developed Telephony BCD where unused characters are packed with characters from a common keypad. And, BCD was part of a landmark 1970s ruling by the US Supreme Court that enforced the restriction that algorithms and mathematical expressions could not be patented. (Gary Benson and Arthur Tabbot tried to patent an algorithm for converting BCD into binary.)
Wikipedia has much more about the flavors of BCD. I’m writing all this to share the excitement of discovering the hidden subtle tastes of BCD, and also to enable you and I to say “Oh, you mean Natural BCD…” with a knowledgeable grin.

Discussion (5 comments)