Field Guide · algorithm

Also known as: POCSAG codeword, POCSAG batch, frame synchronisation codeword

The POCSAG codeword is the 32-bit unit that carries every address and every character of a POCSAG page: one flag bit, 20 data bits, 10 BCH parity bits, and a trailing overall even-parity bit.1 Codewords never travel alone — they are packed 16 at a time into a batch that opens with a fixed synchronisation codeword, the landmark a receiver locks onto before it reads anything.2

SC 16 codewords = 8 frames × 2 one batch (sync + 16 codewords) flag 20 data bits 10 BCH parity even parity bit 31 flag · bits 30..11 data · bits 10..1 BCH(31,21) · bit 0 overall even parity
A POCSAG batch is one sync codeword and sixteen data codewords; each data codeword is a flag, 20 data bits, a BCH(31,21) parity field and one overall even-parity bit.

How it works

The 31 high bits of the codeword are a BCH(31,21) code: 21 information bits (the flag plus 20 data bits) followed by 10 parity bits, able to correct up to two bit errors per codeword. GopherTrunk’s framing.BCHDecode31_21 finds the nearest valid codeword; when the received word is more than two bits from any of them it reports the codeword uncorrectable so the caller can drop it. The generator polynomial is g(x) = x¹⁰ + x⁹ + x⁸ + x⁶ + x⁵ + x³ + 1, the constant 0x769 from CCIR Recommendation 584. The 32nd bit is a plain even-parity check over the 31 above it — a last, cheap way to notice a single residual flip that BCH re-encoding did not catch.

The flag bit names the codeword’s shape. The layout of the 21 information bits differs by shape:

Field Address codeword Message codeword
Flag (bit 20 of info) 0 1
Payload 18-bit address + 2-bit function 20-bit message field
Recovered by Address, Func MessageBits

Two whole codewords are reserved as fixed patterns: the sync codeword 0x7CD215D8 (the Frame Synchronization Codeword, FSC) that begins every batch, and the idle codeword 0x7A89C197 that fills unused frame slots. A receiver treats the idle pattern as “skip” — it carries the address flag bit but does not correspond to a real pager address.

Batch and addressing

A batch is 8 frames × 2 codewords behind the sync word, and the frame slot an address codeword lands in is part of the address. The codeword carries only the 18 high address bits; the batch layer combines them with the frame index 0..7 to reconstruct the full 21-bit RIC (Radio Identity Code) the paging network uses — GopherTrunk does this in ReconstructRIC. An address codeword opens a page, subsequent message codewords in the batch extend it, and the next address or idle codeword (or an uncorrectable one) terminates it. The 2-bit function code (A/B/C/D) traditionally selects tone, numeric or alphanumeric delivery; GopherTrunk maps function B to a numeric decode and C to alphanumeric, falling back to alphanumeric for the ambiguous codes.

In practice

The classic field gotcha is polarity. POCSAG is FSK over FM, and an FM discriminator can hand the bit slicer the whole stream inverted. Rather than force the operator to flip a switch, GopherTrunk’s Syncer is polarity-agnostic: while hunting it compares its sliding 32-bit window against SyncCodeword and against the codeword’s bit-inverse (^window == SyncCodeword), records which polarity matched, and XORs every subsequent bit of the batch with that polarity before parsing. This is the same trick every robust FSK-over-FM paging decoder uses, and it is what lets a scanner lock POCSAG without knowing the receiver’s sense in advance. The FLEX codeword reuses the identical BCH(31,21) primitive but reverses the bit order, so the two share GopherTrunk’s tested BCH code with a bit-reversal wrapper.

Sources

  1. POCSAG — Wikipedia, on the CCIR Radiopaging Code No. 1, its batch and codeword structure, and the sync/idle codewords. 

  2. BCH code — Wikipedia, on the error-correcting family that protects each POCSAG codeword. 

See also