`[<<][staapl][>>][..]`
Fri Nov 30 12:21:49 CET 2007

## math routines

```
time for math routines. some design decisions:

* signed/unsigned
* bit size
* saturated/overflow

it would be nice to be able to reuse these later in the DTC standard
forth as math routines. i do have special need here, in the sense that
the input is only 8 bit.

the main problem is the multiplication routine. the standard has a
16x16 -> 32 signed multiplication.

2 approaches for the filter:
* simple: 2nd order IIR bandpass
* matched FIR filter as in PSK31

i have enough memory to perform FIR filtering. let's focus on trying
to understand the PSK31 demodulator. till now i only found code
examples, no highlevel pseudocode or diagrams.

here Peter G3PLX talks about AFC (automatic frequency correction):
http://www.ka7oei.com/fsk_transmitter.html#FSK31_Explained

with PSK apparently the frequency correction doesn't need to know
anything about the data, since the spectrum is symmetric around the
carrier.

i'm not sure whether AFC is necessary in my scheme: all recievers and
transmitters are stationary, and there's no wind. on the scope however
i did see some slight variation in period, but this was probably due
motion of the speaker/mic (just sticking up by its pair of connecting
wires).

"To get in sync. the PSK31 receiver derives it's timing from the 31Hz
amplitude modulation on the signal. The Varicode alphabet has been
specially designed to make sure there's always enough AM to keep the
receiver in sync. Notice that we can extract the AM from the
incoming signal even if it's not quite on tune. In PSK31 therefore,
the AFC and the synchronisation are completely independent of each
other."

So it's not completely true that the AFC doesn't need to know anything
about the data: data needs to be 'rich enough'. But the trick of
getting the AM straight from the signal is interesting. This means i
can probably proceed nicely from AM -> PM

Some alarming notions here:

"Like the two-tone and unlike FSK, however, if we pass this through a
transmitter, we get intermodulation products if it is not linear, so
we DO need to be careful not to overdrive the audio. However, even
the worst linears will give third-order products of 25dB at +/-47Hz
(3 times the baudrate wide) and fifth-order products of 35dB at
+/-78Hz (5 times the baudrate wide), a considerable improvement over
the hard-keying case. If we infinitely overdrive the linear, we are
back to the same levels as the hard-keyed system."

What i saw on my scope, is a strong 2nd harmonic, probably due to
non--linearity caused by the DC bias in the speaker. Using some kind
of feedforward correction based on a measurement it is probably
possible to correct this when it becomes a problem: the transmitter is
simple enough so all kinds of wave shaping corrections could be
introduced there.

"The PSK31 receiver overcomes this (ED: side lobes due to square
window) by filtering the receive signal, or by what amounts to the
same thing, shaping the envelope of the received bit. The shape is
more complex than the cosine shape used in the transmitter: if we
used a cosine in the receiver we end up with some signal from one
bit. The more complex shape in the receiver overcomes this by
shaping 4 bits at a time and compensating for this intersymbol
interference, but the end result is a passband that is at least 64dB
down at +/-31Hz and beyond, and doesn't introduce any
inter-symbol-interference when receiving a cosine-shaped
transmission."

"PSK31 is therefore ideally suited to HF use, and would not be
expected to show any advantage over the hard-keyed
integrate-and-dump method in areas where the only thing we are
fighting is white noise and we don't need to worry about
interference."

So maybe it's not necessary yet? Since we're using a single frequency
in the first attempt, a demodulator that rejects nearby signals might
not be required.

Anyway. Conclusion: i need to have a look at the exact algorithm used
for matching + synchronization.

```
`[Reply][About]`
`[<<][staapl][>>][..]`