Defines | |
#define | DDS_AD9954_CFR1 0x00 |
AD9954 CFR1 - Control functions including RAM, profiles, OSK, sync, sweep, SPI, and power control settings. | |
#define | DDS_AD9954_CFR2 0x01 |
AD9954 CFR2 - Control functions including sync, PLL multiplier, VCO range, and charge pump current. | |
#define | DDS_AD9954_ASF 0x02 |
AD9954 ASF - Auto ramp rate speed control and output scale factor (0x0000 to 0x3fff). | |
#define | DDS_AD9954_ARR 0x03 |
AD9954 ARR - Amplitude ramp rate for OSK function. | |
#define | DDS_AD9954_FTW0 0x04 |
AD9954 FTW0 - Frequency tuning word 0. | |
#define | DDS_AD9954_FTW1 0x06 |
AD9954 FTW1 - Frequency tuning word 1. | |
#define | DDS_AD9954_NLSCW 0x07 |
AD9954 NLSCW - Negative Linear Sweep Control Word used for spectral shaping in FSK mode. | |
#define | DDS_AD9954_PLSCW 0x08 |
AD9954 PLSCW - Positive Linear Sweep Control Word used for spectral shaping in FSK mode. | |
#define | DDS_AD9954_RWCW0 0x07 |
AD9954 RSCW0 - RAM Segment Control Word 0. | |
#define | DDS_AD9954_RWCW1 0x08 |
AD9954 RSCW0 - RAM Segment Control Word 1. | |
#define | DDS_RAM 0x0b |
AD9954 RAM segment. | |
#define | DDS_FREQ_TO_FTW_DIGITS 9 |
Number of digits in DDS frequency to FTW conversion. | |
Functions | |
void | ddsInit () |
Initialize the DDS regsiters and RAM. | |
void | ddsSetOutputScale (uint16_t scale) |
Set DDS amplitude value in the range 0 to 16383 where 16383 is full scale. | |
void | ddsSetAmplitude (uint8_t amplitude) |
Set the DDS amplitude in units of dBc of full scale where 1 is 0.1 dB. | |
void | ddsSetFreq (uint32_t freq) |
Convert frequency in hertz to 32-bit DDS FTW (Frequency Tune Word). | |
void | ddsPhase (bool_t phase) |
Set the output phase. | |
void | ddsPTT (bool_t state) |
Turn on the DDS output. | |
void | ddsSetFTW (uint32_t ftw) |
Set DDS frequency tuning word. | |
void | ddsSetMode (DDS_MODE mode) |
Set the DDS to run in A-FSK, FSK, or PSK31 mode. | |
Variables | |
const uint32_t | DDS_MULT [DDS_FREQ_TO_FTW_DIGITS] = { 11, 1, 8, 4, 8, 1, 0, 6, 6 } |
Array of multiplication factors used to convert frequency to the FTW. | |
const uint32_t | DDS_DIVISOR [DDS_FREQ_TO_FTW_DIGITS-1] = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 } |
Array of divisors used to convert frequency to the FTW. | |
const uint16_t | DDS_AMP_TO_SCALE [] |
Lookup table to convert dB amplitude scale in 0.5 steps to a linear DDS scale factor. | |
const uint32_t | freqTable [256] |
#define DDS_AD9954_ARR 0x03 |
#define DDS_AD9954_ASF 0x02 |
AD9954 ASF - Auto ramp rate speed control and output scale factor (0x0000 to 0x3fff).
Referenced by ddsSetOutputScale().
#define DDS_AD9954_CFR1 0x00 |
AD9954 CFR1 - Control functions including RAM, profiles, OSK, sync, sweep, SPI, and power control settings.
Referenced by ddsSetMode().
#define DDS_AD9954_CFR2 0x01 |
AD9954 CFR2 - Control functions including sync, PLL multiplier, VCO range, and charge pump current.
#define DDS_AD9954_FTW0 0x04 |
#define DDS_AD9954_FTW1 0x06 |
AD9954 FTW1 - Frequency tuning word 1.
#define DDS_AD9954_NLSCW 0x07 |
AD9954 NLSCW - Negative Linear Sweep Control Word used for spectral shaping in FSK mode.
Referenced by ddsSetMode().
#define DDS_AD9954_PLSCW 0x08 |
AD9954 PLSCW - Positive Linear Sweep Control Word used for spectral shaping in FSK mode.
Referenced by ddsSetMode().
#define DDS_AD9954_RWCW0 0x07 |
AD9954 RSCW0 - RAM Segment Control Word 0.
#define DDS_AD9954_RWCW1 0x08 |
AD9954 RSCW0 - RAM Segment Control Word 1.
#define DDS_FREQ_TO_FTW_DIGITS 9 |
#define DDS_RAM 0x0b |
AD9954 RAM segment.
void ddsInit | ( | ) |
Initialize the DDS regsiters and RAM.
References DDS_AD9954_ARR, DDS_MODE_POWERDOWN, ddsSetMode(), ddsSetOutputScale(), IO_CS, IO_OSK, IO_PS0, IO_PS1, and IO_UPDATE.
Referenced by main().
void ddsPhase | ( | bool_t | phase | ) |
Set the output phase.
phase | true for 180 degree phase shift; false for 0 degree phase shift |
References IO_CS, and IO_UPDATE.
Referenced by diagPort(), and psk31TimeUpdate().
void ddsPTT | ( | bool_t | state | ) | [inline] |
Turn on the DDS output.
state | true to activate; otherwise false |
References IO_OSK.
Referenced by tncTimeUpdate(), and tncTxPacket().
void ddsSetAmplitude | ( | uint8_t | amplitude | ) |
Set the DDS amplitude in units of dBc of full scale where 1 is 0.1 dB.
For example, a value of 30 is 3dBc or a value of 85 is 8.5dBc.
amplitude | in 0.1 dBc of full scale |
References DDS_AMP_TO_SCALE, ddsSetOutputScale(), and IO_OSK.
Referenced by diagPort(), psk31TxPacket(), and tncTxPacket().
void ddsSetFreq | ( | uint32_t | freq | ) |
Convert frequency in hertz to 32-bit DDS FTW (Frequency Tune Word).
freq | frequency in Hertz |
References DDS_DIVISOR, DDS_FREQ_TO_FTW_DIGITS, DDS_MULT, and ddsSetFTW().
Referenced by diagPort(), and psk31TxPacket().
void ddsSetFTW | ( | uint32_t | ftw | ) |
Set DDS frequency tuning word.
The output frequency is equal to RefClock * (ftw / 2 ^ 32).
ftw | Frequency Tuning Word |
References DDS_AD9954_FTW0, IO_CS, and IO_UPDATE.
Referenced by ddsSetFreq(), and tncTimeUpdate().
void ddsSetMode | ( | DDS_MODE | mode | ) |
Set the DDS to run in A-FSK, FSK, or PSK31 mode.
mode | DDS_MODE_APRS, DDS_MODE_PSK31, or DDS_MODE_HF_APRS constant |
References DDS_AD9954_CFR1, DDS_AD9954_NLSCW, DDS_AD9954_PLSCW, DDS_MODE_APRS, DDS_MODE_HF_APRS, DDS_MODE_POWERDOWN, DDS_MODE_PSK31, IO_CS, and IO_UPDATE.
Referenced by ddsInit(), diagPort(), psk31TimeUpdate(), psk31TxPacket(), tncTimeUpdate(), and tncTxPacket().
void ddsSetOutputScale | ( | uint16_t | scale | ) |
Set DDS amplitude value in the range 0 to 16383 where 16383 is full scale.
This value is a linear multiplier and needs to be scale for RF output power in log scale.
scale | in the range 0 to 16383 |
References DDS_AD9954_ASF, IO_CS, and IO_UPDATE.
Referenced by ddsInit(), and ddsSetAmplitude().
const uint16_t DDS_AMP_TO_SCALE[] |
Initial value:
{ 16383, 15467, 14601, 13785, 13013, 12286, 11598, 10949, 10337, 9759, 9213, 8697, 8211, 7752, 7318, 6909, 6522, 6157, 5813, 5488, 5181, 4891, 4617, 4359, 4115, 3885, 3668, 3463, 3269, 3086, 2913, 2750, 2597, 2451, 2314, 2185, 2062, 1947, 1838, 1735, 1638 }
Referenced by ddsSetAmplitude().
const uint32_t DDS_DIVISOR[DDS_FREQ_TO_FTW_DIGITS-1] = { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 } |
Referenced by tncTimeUpdate().