| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
LPC18xx/43xx DAC example
Peripheral examples

## Detailed Description

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

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. So AOUT output voltage will change from: Vss to VDD. This example configures pin P4_4 as analog function for DAC output through ENAIO2 register. Run and observe AOUT signal by oscilloscope.

Use UART to monitor this demo.

Special connection requirements

- Hitex LPC1850EVA-A4-2 and LPC4350EVA-A4-2 boards (AOUT: X16.4 (X16 connector - pin LCDVD1))

Build procedures:
LPC18xx/43xx example quickstart for Keil uVision4
LPC18xx/43xx example quickstart for IAR EWARM
LPC18xx/43xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Hitex 1850 evaluation boards
Hitex 4350 evaluation boards
Keil 1857 evaluation boards
Keil 4357 evaluation boards

Submitting LPCOpen issues:
Community support for LPCOpen

## Macros
#define | DATA_SIZE 0x400

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

## Variables
static char | WelcomeMenu []
static char | SelectMenu []
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
uint32_t | DMAbuffer

## Macro Definition Documentation

#define DATA_SIZE 0x400

Definition at line 71 of file dac.c.

## Function Documentation

static void App_DMA_Test | ( | void |  | ) |
| static

Definition at line 91 of file dac.c.

static void App_Interrupt_Test | ( | void |  | ) |
| static

Definition at line 132 of file dac.c.

static void App_Polling_Test | ( | void |  | ) |
| static

Definition at line 160 of file dac.c.

void DAC_IRQHandler | ( | void |  | ) |

DAC interrupt handler sub-routine.

Returns
  Nothing

Definition at line 186 of file dac.c.

void DMA_IRQHandler | ( | void |  | ) |

DMA interrupt handler sub-routine.

Returns
  Nothing

Definition at line 199 of file dac.c.

int main | ( | void |  | ) |

Main routine for DAC example.

Main program body.

Returns
  Nothing

Definition at line 213 of file dac.c.

## Variable Documentation

volatile uint8_t channelTC
| static

Definition at line 79 of file dac.c.

volatile uint8_t DAC_Interrupt_Done_Flag
| static

Definition at line 80 of file dac.c.

uint32_t DMAbuffer

Definition at line 81 of file dac.c.

volatile uint8_t dmaChannelNum
| static

Definition at line 79 of file dac.c.

volatile uint8_t Interrupt_Continue_Flag
| static

Definition at line 80 of file dac.c.

char SelectMenu[]
| static

Initial value:
= "\r\nPress number 1-3 to choose DAC running mode:\r\n"
"\t1: Polling Mode \r\n"
"\t2: Interrupt Mode \r\n"
"\t3: DMA Mode \r\n"

Definition at line 75 of file dac.c.

char WelcomeMenu[]
| static

Initial value:
= "\r\nHello NXP Semiconductors \r\n"
"DAC DEMO \r\n"
"Press \'c\' to continue or \'x\' to quit\r\n"

Definition at line 72 of file dac.c.