User Tools

Site Tools


Coding and Decoding of a frame

a frame consists of 255 byte data and 3 byte header. The header is a fixed 3-byte value and will not be processed further. The sequence of header processing is described in “Frame Format”. This document show the details of the various processing stages.

If you want to program a compatible modem, just copy these functions as-is into your application, initialize them at program start and use them.


Scrambling is used to prevent long sequences of same values, which would make synchronization in the receiver impossible.

scrambler.cpp uses a table with pseudo-random values and X-ORs the complete frame (except the header) with these values.

The receiver unscrambles the frame with the same function to get the original data.


many different FEC/Reed Solomon algorithms have been tested at a signal SNR of +15dB above noise.

The best results delivered the “Shifra” reed solomon code. This code is free and open source for non-commercial projects like HSmodem. A wrapper for HSmodem is in fec.cpp. It has functions to initialize, generate and decode the FEC for one complete frame.


A standard CRC16 algorithm is used with a generator polynom of 0x8408. The code is simple and located in crc16.cpp

en/hsmodem/scrambler.txt · Last modified: 2021/03/28 19:14 (external edit)