# Calculating the PSK31 Audio Beacon NCO Constants

In my last post I described a method of creating PSK31 signals without explicit pulse shaping and used it to create a PSK31 audio beacon. The technique utilized two phase aligned NCOs (numerically controlled oscillators) from which it was necessary to produce a specific frequency shift rather than a specific frequency. Since this is not normally the case, I decided it was important to review how to calculate the required NCO constants and why the focus on a specific shift is important.

Start with the equation used to calculate the output frequency of an NCO:

(1)

where

n = the current phase accumulator value,

N = NCO modulus (maximum phase accumulator value),

f_{osc} = NCO oscillator value,

f_{out} = NCO output frequency.

The difference between two adjacent frequencies f_{2} and f_{1} can be calculated as:

(2)

where

n_{delta} = n_{2} – n_{1}

f_{delta} = f_{2} – f_{1}

n_{2} = phase accumulator value for f_{2}

n_{1} = phase accumulator value for f_{1}

and the other values are as previously defined.

This is the general equation for the resolution of an NCO and the available frequency shifts will be multiples of f_{delta}.

To generate the PSK31 signal it’s important that the two NCOs are phase aligned at the beginning of each bit. This is easy to ensure for a 1 bit where both are producing the same frequency, but what about a 0 bit where both are producing different frequencies?

The phase difference between the two NCOs at the end of a single bit can be calculated as:

(3)

where

n_{diff} = phase difference

T_{bit} = bit period, in seconds

and the other values are as previously defined.

Substituting (1) into (3)

(4)

To ensure bit alignment, n_{diff} = N. Therefore:

(5)

or f_{delta} = ½ the bit rate.

So as long as f_{delta} = ½ the bit rate, the NCO phases will be aligned at the beginning of each bit. That’s why the focus on frequency shift rather than absolute frequency.

- Posted in: Uncategorized
- Tagged: PIC, PSK31