[Date Prev][Date Next][Thread Prev][Thread Next] - [Date Index][Thread Index][Author Index]

Re: Fade remover


> Unfortunately the CDP1802 CPU with 64k bytes ECC RAM running at 100K
> instructions/s in IHU-1 doesn't have the resources to handle the FEC
> and/or interleaving tasks.  It was a deliberate decision to stick with
> the tried and true technology for IHU-1.  IHU-2 has the capacity but is
> not being used.

To be honest, I do not understand at all what you mean - I could program
a HP48 pocket calculator to perform this task at 400bps.

Here is a piece of code in C for the files:

 *	k=7 R=1/2
 *	Convolutional Encoder
 *	Parameters:
 *	input:		byte to be encoded
 *	output1:		pointer to output byte #1
 *	output2:		pointer to output byte #2
void encode_7_2(char input, char *output1, char *output2)
	static char state=0;	/* "shift register" */
	int i, bit;

	for (i = 0; i < 8; i++) {
		bit = input & 1;
		state = (state << 1) | bit;
		input = input >> 1;
		*output1 = *output1 << 1;
		*output1 |= hamw_tbl[state & POLY_1) % 2;
		*output2 = *output2 << 1;
		*output2 |= hamw_tbl[state & POLY_2) % 2;

POLY_1 is the generator polynomial (reversed) for the first output, POLY_2
for the second. If chosen apropriately then code can be made "systematic"
i.e. one of the output bits constantly reflect the input bit so that a
very simple decoder (without gain, though) can be made by just discarding
the second bit.
hamw_tbl is a table which contains the hamming weight (number of 1's) of
the given word, i.e. {0, 1, 1, 2, 1, 2, 2, 3, ...}. What we are doing in these
two lines when calculating the output bit is determining the modulo-2 sum
of all ones i.e. EX-ORing them.

Note: Trellis is terminated automatically by interframe-fill. Block
synchronization is obtained by block preamble.

If optimized for speed the code above will probably take about 20 instructions
per bit and maybe 300 bytes (including the table) code. So where is the problem?

The interleaver is even easier to construct:
Fill a buffer (here: 8 bytes) with your data. Read it out by calling the following
function (here: 8 times) to get one interleaved byte with each call:

 *	8 x 8bit interleaver
 *	buffer:	fill with 8 data bytes, then call
 *		function 8 times to read out
char buffer[8];
char interleaver_8_get()
	char output;
	int i;

	for (i = 0; i < 8; i++) {
		output = (output << 1) | (buffer[i] & 1);
		buffer[i] = buffer[i] >> 1;
	return output;

Granted, 8 bit is not very much and it gets a little more complicated
as length increases. But then 64 bytes would be pretty good already.
The receiver just does the inverse and then applies the convolutional
decoder (which is the complicated part).

  -- Jens
Via the amsat-bb mailing list at AMSAT.ORG courtesy of AMSAT-NA.
To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org