AN123 Silicon_Laboratories, AN123 Datasheet - Page 6

no-image

AN123

Manufacturer Part Number
AN123
Description
Using THE DAC AS A Function Generator
Manufacturer
Silicon_Laboratories
Datasheet
AN123
sfr16 DP
sfr16 TMR3RL
sfr16 TMR3
sfr16 ADC0
sfr16 ADC0GT
sfr16 ADC0LT
sfr16 RCAP2
sfr16 T2
sfr16 RCAP4
sfr16 T4
sfr16 DAC0
sfr16 DAC1
//-----------------------------------------------------------------------------
// Function PROTOTYPES
//-----------------------------------------------------------------------------
void main (void);
void SYSCLK_Init (void);
void PORT_Init (void);
void UART0_Init (void);
void Timer4_Init (int counts);
void Timer4_ISR (void);
long pow(int x, int y);
void Print_Command_List(void);
void Sine(void);
void Square(void);
void Triangle(void);
void Saw(void);
void Off(void);
void Help(void);
void Error(void);
//-----------------------------------------------------------------------------
// Global CONSTANTS
//-----------------------------------------------------------------------------
#define SYSCLK
#define BAUDRATE
#define SAMPLE_RATE_DAC 80000L
#define PHASE_PRECISION 65536
#define command_length 2
#define command_size 3
typedef struct Command_Table_Type {
}Command_Table_Type;
typedef enum Waveform {
6
char command[command_size];
void (*function_ptr)(void);
SQUARE,
= 0x82;
= 0x92;
= 0x94;
= 0xbe;
= 0xc4;
= 0xc6;
= 0xca;
= 0xcc;
= 0xe4;
= 0xf4;
= 0xd2;
= 0xd5;
22118400
9600
// data pointer
// Timer3 reload value
// Timer3 counter
// ADC0 data
// ADC0 greater than window
// ADC0 less than window
// Timer2 capture/reload
// Timer2
// Timer4 capture/reload
// Timer4
// DAC0 data
// DAC1 data
// SYSCLK frequency in Hz
// Baud rate of UART in bps
// DAC sampling rate in Hz
// range of phase accumulator
// command length is 2 characters
// command size is 3 bytes
// when a command is entered, it is
// compared to the command field of
// of the table. If there is a match
// then the the function located at
// function_ptr will be executed
// the different possible output
// waveforms
Rev. 1.1

Related parts for AN123