LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LPC17xx/40xx DAC example

Detailed Description

Example description
This example shows how to use DAC peripheral with 2 modes: POLLING mode or DMA mode.

The DAC will be initialized with maximum current is 700uA. This allows a maximum update rate of 1Mhz DAC updated values have range from 0 to 0x3FF. AOUT ouput voltage will change from: Vss to VDD. Run and observe AOUT signal by oscilloscope.

The UART is used with a small menu to start and control the program.

Special connection requirements

Build procedures:
LPC17xx/40xx example quickstart for Keil uVision4
LPC17xx/40xx example quickstart for IAR EWARM
LPC17xx/40xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Embedded Artists' LPC1788 Developer's Kit
Embedded Artists' LPC4088 Developer's Kit
NXP Xpresso LPC1769 board

Submitting LPCOpen issues:
Community support for LPCOpen

Macros

#define DATA_SIZE   0x400
 
#define DAC_TIMEOUT   0x3FF
 

Functions

static void App_DMA_Test (void)
 
static void App_Polling_Test (void)
 
void DMA_IRQHandler (void)
 DMA interrupt handler sub-routine.
 
int main (void)
 Main routine for DAC example.
 

Variables

static const char WelcomeMenu []
 
static const char SelectMenu []
 
static const char DirectionMenu []
 
static volatile uint8_t channelTC
 
static volatile uint8_t dmaChannelNum
 
static volatile uint8_t DAC_Interrupt_Done_Flag
 
static volatile uint8_t Interrupt_Continue_Flag
 
static uint32_t DMAbuffer
 

Macro Definition Documentation

#define DAC_TIMEOUT   0x3FF

Definition at line 94 of file dac.c.

#define DATA_SIZE   0x400

Definition at line 76 of file dac.c.

Function Documentation

static void App_DMA_Test ( void  )
static

Definition at line 105 of file dac.c.

static void App_Polling_Test ( void  )
static

Definition at line 160 of file dac.c.

void DMA_IRQHandler ( void  )

DMA interrupt handler sub-routine.

Returns
Nothing

Definition at line 197 of file dac.c.

int main ( void  )

Main routine for DAC example.

Main program body.

Returns
Nothing

Definition at line 211 of file dac.c.

Variable Documentation

volatile uint8_t channelTC
static

Definition at line 89 of file dac.c.

volatile uint8_t DAC_Interrupt_Done_Flag
static

Definition at line 90 of file dac.c.

const char DirectionMenu[]
static
Initial value:
=
"Press \'o\' or \'p\' to change sound frequency\r\n"

Definition at line 85 of file dac.c.

uint32_t DMAbuffer
static

Definition at line 91 of file dac.c.

volatile uint8_t dmaChannelNum
static

Definition at line 89 of file dac.c.

volatile uint8_t Interrupt_Continue_Flag
static

Definition at line 90 of file dac.c.

const char SelectMenu[]
static
Initial value:
=
"Press number 1-2 to choose DAC running mode:\r\n"
"\t1: Polling Mode \r\n"
"\t2: DMA Mode \r\n"

Definition at line 81 of file dac.c.

const char WelcomeMenu[]
static
Initial value:
=
"Hello NXP Semiconductors \r\n"
"DAC DEMO \r\n"
"Press \'c\' to continue or \'x\' to quit\r\n"

Definition at line 77 of file dac.c.