Saturday, May 31, 2008

Digital Mode of the Week: PSK31 (Part 1 - Varicode)

Varicode is a Huffman code for use in PSK31 narrow band teleprinting. PSK31 is a binary phase-shift keyed, 31.35-baud mode designed for direct keyboard-to-keyboard ham contacts. Varicode is integral to the overall concept that made PSK31 so well suited to ham radio, despite this low baud rate. In fact, it was the original name for the whole mode that was proposed in 1998 by its developer, an English ham named Peter Martinez (G3PLX).

Like many "major breakthroughs" in radio, the underlying concept has actually been around a while - in this case, since the Morse code. Morse speeds up transmission by making the more commonly used characters shorter, for example a single dit for E. Morse, like Huffman coding, lends itself to tree-shaped decoding algorithms that save a lot of time. Unlike with Baudot, logic can be designed (including in your brain) that bails out of the loop whenever it detects that a character is complete.

The basic Varicode character set is the same as 7-bit ASCII, but the bits aren't, and the framing is completely different. Throughput is a lot faster than if straight ASCII were being sent and everything else was equal. One consideration, however, is that efficiency goes down in languages other than English, or if the traffic is something other than plain lower case text. Either situation begins to deviate from the designed optimum.

The shortest character is the blank space (a single 1 bit), and second shortest is the lower case e (11). Note that all characters, including nulls, end in a 1. This is due to the technical characteristics of the transmission mode, which we'll talk about next week.

Here's the code. It should look familiar, except for the bits.


Dec . Hex .. Char ... Bit Code
....0 ... 00 ... NUL ... 1010101011
....1 ... 01 ... SOH ... 1011011011
....2 ... 02 ... STX ... 1011101101
....3 ... 03 ... ETX ... 1101110111
....4 ... 04 ... EOT ... 1011101011
....5 ... 05 ... ENQ ... 1101011111
....6 ... 06 ... ACK ... 1011101111
....7 ... 07 ... BEL .... 1011111101
....8 ... 08 ... BS ...... 1011111111
....9 ... 09 ... HT ...... 11101111
..10 ... 0A ... LF ...... 11101
..11 ... 0B ... VT ..... 1101101111
..12 ... 0C ... FF ...... 1011011101
..13 ... 0D ... CR ..... 11111
..14 ... 0E ... SO ...... 1101110101
..15 ... 0F ... SI ....... 1110101011
..16 ... 10 ... DLE ... 1011110111
..17 ... 11 ... DC1 ... 1011110101
..18 ... 12 ... DC2 ... 1110101101
..19 ... 13 ... DC3 ... 1110101111
..20 ... 14 ... DC4 ... 1101011011
..21 ... 15 ... NAK .. 1101101011
..22 ... 16 ... SYN ... 1101101101
..23 ... 17 ... ETB ... 1101010111
..24 ... 18 ... CAN .. 1101111011
..25 ... 19 ... EM ..... 1101111101
..26 ... 1A ... SUB .. 1110110111
..27 ... 1B ... ESC ... 1101010101
..28 ... 1C ... FS ..... 1101011101
..29 ... 1D ... GS .... 1110111011
..30 ... 1E ... RS ..... 1011111011
..31 ... 1F ... US ..... 1101111111
..32 ... 20 ... SP....... 1
..33 ... 21 ... ! ..... 111111111
..34 ... 22 ... " ..... 101011111
..35 ... 23 ... # .... 111110101
..36 ... 24 ... $ .... 111011011
..37 ... 25 ... % ... 1011010101
..38 ... 26 ... & .. 1010111011
..39 ... 27 ... ' ..... 101111111
..40 ... 28 ... ( .... 11111011
..41 ... 29 ... ) .... 11110111
..42 ... 2A ... * .. 101101111
..43 ... 2B ... +... 111011111
..44 ... 2C ... , .. 1110101
..45 ... 2D ... - .. 110101
..46 ... 2E ... . .. 1010111
..47 ... 2F ... / .. 110101111
..48 ... 30 ... 0... 10110111
..49 ... 31 ... 1... 10111101
..50 ... 32 ... 2... 11101101
..51 ... 33 ... 3... 11111111
..52 ... 34 ... 4... 101110111
..53 ... 35 ... 5... 101011011
..54 ... 36 ... 6... 101101011
..55 ... 37 ... 7... 110101101
..56 ... 38 ... 8... 110101011
..57 ... 39 ... 9... 110110111
..58 ... 3A ... : .. 11110101
..59 ... 3B ... ; .. 110111101
..60 ... 3C ... < .. 111101101
..61 ... 3D ... = .. 1010101
..62 ... 3E ... > .. 111010111
..63 ... 3F ... ? .. 1010101111
..64 ... 40 ... @ .. 1010111101
..65 ... 41 ... A... 1111101
..66 ... 42 ... B... 11101011
..67 ... 43 ... C... 10101101
..68 ... 44 ... D... 10110101
..69 ... 45 ... E... 1110111
..70 ... 46 ... F... 11011011
..71 ... 47 ... G... 11111101
..72 ... 48 ... H... 101010101
..73 ... 49 ... I... 1111111
..74 ... 4A ... J... 111111101
..75 ... 4B ... K... 101111101
..76 ... 4C ... L... 11010111
..77 ... 4D ... M... 10111011
..78 ... 4E ... N... 11011101
..79 ... 4F ... O... 10101011
..80 ... 50 ... P... 11010101
..81 ... 51 ... Q... 1111011101
..82 ... 52 ... R... 10101111
..83 ... 53 ... S... 1101111
..84 ... 54 ... T... 1101101
..85 ... 55 ... U... 101010111
..86 ... 56 ... V... 110110101
..87 ... 57 ... W... 101011101
..88 ... 58 ... X... 101110101
..89 ... 59 ... Y... 101111011
..90 ... 5A ... Z... 1010101101
..91 ... 5B ... [ .. 111110111
..92 ... 5C ... \ .. 111101111
..93 ... 5D ... ]... 111111011
..94 ... 5E ... ^ .. 1010111111
..95 ... 5F ... _ .. 101101101
..96 ... 60 ... ` .. 1011011111
..97 ... 61 ... a..... 1011
..98 ... 62 ... b..... 1011111
..99 ... 63 ... c..... 101111
100 ... 64 ... d..... 101101
101 ... 65 ... e..... 11
102 ... 66 ... f..... 111101
103 ... 67 ... g..... 1011011
104 ... 68 ... h..... 101011
105 ... 69 ... i...... 1101
106 ... 6A ... j..... 111101011
107 ... 6B ... k..... 10111111
108 ... 6C ... l..... 11011
109 ... 6D ... m... 111011
110 ... 6E ... n.... 1111
111 ... 6F ... o..... 111
112 ... 70 ... p..... 111111
113 ... 71 ... q..... 110111111
114 ... 72 ... r..... 10101
115 ... 73 ... s..... 10111
116 ... 74 ... t..... 101
117 ... 75 ... u..... 110111
118 ... 76 ... v..... 1111011
119 ... 77 ... w..... 1101011
120 ... 78 ... x..... 11011111
121 ... 79 ... y..... 1011101
122 ... 7A ... z..... 111010101
123 ... 7B ... {..... 1010110111
124 ... 7C ... |..... 110111011
125 ... 7D ... }.... 1010110101
126 ... 7E ... ~..... 1011010111
127 ... 7F .. DEL ... 1110110101