AN123 Silicon_Laboratories, AN123 Datasheet - Page 8

no-image

AN123

Manufacturer Part Number
AN123
Description
Using THE DAC AS A Function Generator
Manufacturer
Silicon_Laboratories
Datasheet
AN123
};
code char string0[] = “\n\n*** OUTPUT IS NOW A “;
code char string1[] = “\n\n----------------------------------\n\n”;
//-----------------------------------------------------------------------------
// MAIN Routine
//-----------------------------------------------------------------------------
void main (void) {
8
0x18f8, 0x15e2, 0x12c8, 0x0fab, 0x0c8b, 0x096a, 0x0647, 0x0324,
0x0000, 0xfcdc, 0xf9b9, 0xf696, 0xf375, 0xf055, 0xed38, 0xea1e,
0xe708, 0xe3f5, 0xe0e7, 0xdddd, 0xdad8, 0xd7da, 0xd4e1, 0xd1ef,
0xcf05, 0xcc22, 0xc946, 0xc674, 0xc3aa, 0xc0e9, 0xbe32, 0xbb86,
0xb8e4, 0xb64c, 0xb3c1, 0xb141, 0xaecd, 0xac65, 0xaa0b, 0xa7be,
0xa57e, 0xa34c, 0xa129, 0x9f14, 0x9d0e, 0x9b18, 0x9931, 0x975a,
0x9593, 0x93dc, 0x9236, 0x90a1, 0x8f1e, 0x8dab, 0x8c4b, 0x8afc,
0x89bf, 0x8894, 0x877c, 0x8676, 0x8583, 0x84a3, 0x83d7, 0x831d,
0x8276, 0x81e3, 0x8163, 0x80f7, 0x809e, 0x8059, 0x8028, 0x800a,
0x8000, 0x800a, 0x8028, 0x8059, 0x809e, 0x80f7, 0x8163, 0x81e3,
0x8276, 0x831d, 0x83d7, 0x84a3, 0x8583, 0x8676, 0x877c, 0x8894,
0x89bf, 0x8afc, 0x8c4b, 0x8dab, 0x8f1e, 0x90a1, 0x9236, 0x93dc,
0x9593, 0x975a, 0x9931, 0x9b18, 0x9d0e, 0x9f14, 0xa129, 0xa34c,
0xa57e, 0xa7be, 0xaa0b, 0xac65, 0xaecd, 0xb141, 0xb3c1, 0xb64c,
0xb8e4, 0xbb86, 0xbe32, 0xc0e9, 0xc3aa, 0xc674, 0xc946, 0xcc22,
0xcf05, 0xd1ef, 0xd4e1, 0xd7da, 0xdad8, 0xdddd, 0xe0e7, 0xe3f5,
0xe708, 0xea1e, 0xed38, 0xf055, 0xf375, 0xf696, 0xf9b9, 0xfcdc,
char i;
char* arg_ptr1;
char* arg_ptr2;
long temp_frequency;
int temp_amplitude;
int printed_amplitude = 100;
void (*f)(void);
WDTCN = 0xde;
WDTCN = 0xad;
SYSCLK_Init ();
PORT_Init ();
// initializations for wave generation
REF0CN = 0x03;
Timer4_Init(SYSCLK/SAMPLE_RATE_DAC);
// initialization for command input
DAC1CN = 0x97;
// counting variable
// pointers to command line parameters
// used to hold the values input from the
// keyboard while they are error checked
// a separate copy of amplitude because
// temp_amplitude is written over
// function pointer used to call the proper
// function from the command table
// Disable watchdog timer
// enable internal VREF generator
// using Timer4 as update scheduler
// initialize T4 to update DAC1
// after (SYSCLK cycles)/sample have
// passed.
// enable DAC1 in left-justified mode
Rev. 1.1

Related parts for AN123