AN123 Silicon_Laboratories, AN123 Datasheet - Page 11

no-image

AN123

Manufacturer Part Number
AN123
Description
Using THE DAC AS A Function Generator
Manufacturer
Silicon_Laboratories
Datasheet
//
void PORT_Init (void)
{
}
//-----------------------------------------------------------------------------
// Timer4_Init
//-----------------------------------------------------------------------------
// This routine initializes Timer4 in auto-reload mode to generate interrupts
// at intervals specified in <counts>.
//
void Timer4_Init (int counts)
{
}
//-----------------------------------------------------------------------------
// UART0_Init
//-----------------------------------------------------------------------------
//
// Configure the UART0 using Timer1, for <baudrate> and 8-N-1.
//
void UART0_Init (void)
{
}
//-----------------------------------------------------------------------------
// Print_Command_List
//-----------------------------------------------------------------------------
//
// Prints the command list to the standard output.
//
void Print_Command_List (void)
{
printf (“\n\
}
SQ - Square Wave\n\
SI - Sine Wave\n\
TR - Triangle Wave\n\
SA - Saw Tooth Wave\n\
OF - Output OFF\n\
?? - Help\n\n”);
XBR0
XBR1
XBR2
P0MDOUT |= 0x01;
T4CON = 0;
CKCON |= 0x40;
RCAP4 = -counts;
T4 = RCAP4;
EIE2 |= 0x04;
T4CON |= 0x04;
SCON0
TMOD
TH1
TR1
CKCON |= 0x10;
PCON
TI0
|= 0x80;
= -(SYSCLK/BAUDRATE/16);
= 1;
= 1;
= 0x50;
= 0x20;
= 0x04;
= 0x00;
= 0x40;
// Enable UART0
// Enable crossbar and weak pull-up
// Set TX0 pin to push-pull
// STOP timer; set to auto-reload mode
// T4M = ‘1’; Timer4 counts SYSCLKs
// set reload value
// enable Timer4 interrupts
// start Timer4
// SCON0: mode 1, 8-bit UART, enable RX
// TMOD: timer 1, mode 2, 8-bit reload
// set Timer1 reload value for baudrate
// start Timer1
// Timer1 uses SYSCLK as time base
// SMOD0 = 1
// Indicate TX0 ready
Rev. 1.1
AN123
11

Related parts for AN123