PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
DDS.h File Reference

Containing everything needed for the direct digital synthesis. More...

#include "../Configuration.h"
#include "../Pins/Pins.h"
#include <avr/interrupt.h>
#include <avr/pgmspace.h>

Go to the source code of this file.

Functions

void InitDDSTimer ()
 Initialize the DDS timer.
 
void StartDDSTimer ()
 Start the DDS timer.
 
void DisableDDSTimer ()
 Disable the DDS timer.
 
void DisableDDS1 ()
 Set the voltage of DDS channel 1 to zero.
 
void DisableDDS2 ()
 Set the voltage of DDS channel 2 to zero.
 

Variables

volatile uint32_t dds_channel1_increment
 Variable holding the increment value of DDS channel 1.
 
volatile uint32_t dds_channel2_increment
 Variable holding the increment value of DDS channel 2.
 
volatile uint16_t dds_channel1_waveTable [(1<< DDS_QUANTIZER_BITS)]
 Array holding the waveform that should be created on DDS channel 1.
 
volatile uint16_t dds_channel2_waveTable [(1<< DDS_QUANTIZER_BITS)]
 Array holding the waveform that should be created on DDS channel 2.
 
volatile bool dds_channel1_enabled
 Variable holding the information if DDS channel 1 is enabled.
 
volatile bool dds_channel2_enabled
 Variable holding the information if DDS channel 2 is enabled.
 
const uint16_t SINE_WAVE_TABLE_12BIT[] PROGMEM
 

Detailed Description

Containing everything needed for the direct digital synthesis.

Date
23.12.2020 18:23:27
Author
Markus Scheich
See also
https://www.avrfreaks.net/forum/dds-function-generator-using-atmega328p
https://www.digikey.de/de/articles/the-basics-of-direct-digital-synthesizers-ddss

Function Documentation

◆ InitDDSTimer()

void InitDDSTimer ( )

Initialize the DDS timer.

This initializes all neccessary registers of the DDS timer and resets the phase accumulators.

Variable Documentation

◆ dds_channel1_increment

volatile uint32_t dds_channel1_increment
extern

Variable holding the increment value of DDS channel 1.

This value depends on the configured frequency of the channel.

◆ dds_channel2_increment

volatile uint32_t dds_channel2_increment
extern

Variable holding the increment value of DDS channel 2.

This value depends on the configured frequency of the channel.

◆ PROGMEM

const uint16_t SAWTOOTH_WAVE_TABLE_12BIT [] PROGMEM
Initial value:
=
{
0x7FF,0x831,0x863,0x896,0x8C8,0x8FA,0x92B,0x95D,0x98E,0x9C0,0x9F1,0xA21,0xA51,0xA81,0xAB1,0xAE0,
0xB0F,0xB3D,0xB6A,0xB98,0xBC4,0xBF0,0xC1C,0xC46,0xC71,0xC9A,0xCC3,0xCEB,0xD12,0xD38,0xD5E,0xD83,
0xDA7,0xDCA,0xDEC,0xE0D,0xE2E,0xE4D,0xE6C,0xE89,0xEA5,0xEC1,0xEDB,0xEF5,0xF0D,0xF24,0xF3A,0xF4F,
0xF63,0xF75,0xF87,0xF97,0xFA6,0xFB4,0xFC1,0xFCD,0xFD7,0xFE0,0xFE8,0xFEF,0xFF5,0xFF9,0xFFC,0xFFE,
0xFFF,0xFFE,0xFFC,0xFF9,0xFF5,0xFEF,0xFE8,0xFE0,0xFD7,0xFCD,0xFC1,0xFB4,0xFA6,0xF97,0xF87,0xF75,
0xF63,0xF4F,0xF3A,0xF24,0xF0D,0xEF5,0xEDB,0xEC1,0xEA5,0xE89,0xE6C,0xE4D,0xE2E,0xE0D,0xDEC,0xDCA,
0xDA7,0xD83,0xD5E,0xD38,0xD12,0xCEB,0xCC3,0xC9A,0xC71,0xC46,0xC1C,0xBF0,0xBC4,0xB98,0xB6A,0xB3D,
0xB0F,0xAE0,0xAB1,0xA81,0xA51,0xA21,0x9F1,0x9C0,0x98E,0x95D,0x92B,0x8FA,0x8C8,0x896,0x863,0x831,
0x7FF,0x7CD,0x79B,0x768,0x736,0x704,0x6D3,0x6A1,0x670,0x63E,0x60D,0x5DD,0x5AD,0x57D,0x54D,0x51E,
0x4EF,0x4C1,0x494,0x466,0x43A,0x40E,0x3E2,0x3B8,0x38D,0x364,0x33B,0x313,0x2EC,0x2C6,0x2A0,0x27B,
0x257,0x234,0x212,0x1F1,0x1D0,0x1B1,0x192,0x175,0x159,0x13D,0x123,0x109,0x0F1,0x0DA,0x0C4,0x0AF,
0x09B,0x089,0x077,0x067,0x058,0x04A,0x03D,0x031,0x027,0x01E,0x016,0x00F,0x009,0x005,0x002,0x000,
0x000,0x000,0x002,0x005,0x009,0x00F,0x016,0x01E,0x027,0x031,0x03D,0x04A,0x058,0x067,0x077,0x089,
0x09B,0x0AF,0x0C4,0x0DA,0x0F1,0x109,0x123,0x13D,0x159,0x175,0x192,0x1B1,0x1D0,0x1F1,0x212,0x234,
0x257,0x27B,0x2A0,0x2C6,0x2EC,0x313,0x33B,0x364,0x38D,0x3B8,0x3E2,0x40E,0x43A,0x466,0x494,0x4C1,
0x4EF,0x51E,0x54D,0x57D,0x5AD,0x5DD,0x60D,0x63E,0x670,0x6A1,0x6D3,0x704,0x736,0x768,0x79B,0x7CD,
}