Field Guide · concept

Also known as: BCD, Binary-coded decimal, packed BCD

Binary-coded decimal (BCD) stores each decimal digit 0–9 in its own 4-bit nibble, from 0000 to 1001.1 Because a nibble can express sixteen values but only ten digits are used, the six codes 10101111 go unused — so BCD wastes about 17% of the available range in exchange for a direct, conversion-free mapping between stored bits and the decimal digits a human reads.

197 0001 1001 0111 nibblenibblenibble each decimal digit occupies its own 4 bits
The decimal number 197 in BCD: each digit maps straight to its own nibble — 1→0001, 9→1001, 7→0111 — with no binary-to-decimal arithmetic needed.

How it works

In pure binary the number 197 is 11000101, and recovering its decimal digits takes repeated division. BCD skips that: each digit is encoded independently, so 197 is simply 0001 1001 0111. Reading a digit out to a seven-segment display, rounding to a decimal place, or transmitting a digit string becomes a lookup with no conversion. The trade is density — BCD needs four bits per digit where binary would pack the same value more tightly, and a quarter of each nibble’s codes are illegal.

BCD comes in two layouts. Packed BCD stores two digits per byte, one in each nibble, which is the compact form used in most protocols and storage. Unpacked BCD stores a single digit per byte, wasting the high nibble but simplifying byte-at-a-time processing. Arithmetic on BCD requires a decimal-adjust step whenever a nibble would exceed 1001, which is why processors historically included a decimal-adjust instruction.

In practice

BCD is favoured wherever decimal digits are displayed or transmitted directly and a binary-to-decimal conversion would be a nuisance. Numeric POCSAG pages carry their digits as BCD, as do the maritime identities and call fields of DSC (Digital Selective Calling). The Radio Data System (RDS) uses BCD for time and date, and real-time-clock chips store the seconds, minutes, hours, and calendar in BCD so firmware can read the time out digit by digit. In each case the payload is meant to be read as decimal, so encoding it as decimal from the start is simpler than repeatedly converting.

Relevance to SDR

A decoder that pulls a numeric page or a DSC identity off the air must know the field is BCD, not binary — misreading a packed BCD byte as an ordinary integer yields nonsense. Recognising the 10101111 codes as invalid also serves as a cheap sanity check on a recovered bitstream. GopherTrunk’s trunking focus centres on P25/DMR/NXDN/TETRA control data, but BCD is exactly the kind of low-level digit encoding a paging or maritime decoder built alongside it must parse correctly.

Sources

  1. Binary-coded decimal — Wikipedia, for the nibble-per-digit encoding, unused codes, and the packed vs unpacked forms. 

See also