LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
Data Structures | Macros | Enumerations | Functions
CHIP: LPC18xx/43xx D/A conversion driver

Detailed Description

Data Structures

struct  LPC_DAC_T
 DAC register block structure. More...
 

Macros

#define DAC_VALUE(n)   ((uint32_t) ((n & 0x3FF) << 6))
 
#define DAC_BIAS_EN   ((uint32_t) (1 << 16))
 
#define DAC_CCNT_VALUE(n)   ((uint32_t) (n & 0xffff))
 
#define DAC_DBLBUF_ENA   ((uint32_t) (1 << 1))
 
#define DAC_CNT_ENA   ((uint32_t) (1 << 2))
 
#define DAC_DMA_ENA   ((uint32_t) (1 << 3))
 
#define DAC_DACCTRL_MASK   ((uint32_t) (0x0F))
 

Enumerations

enum  DAC_CURRENT_OPT_T { DAC_MAX_UPDATE_RATE_1MHz = 0, DAC_MAX_UPDATE_RATE_400kHz }
 Current option in DAC configuration option. More...
 

Functions

void Chip_DAC_Init (LPC_DAC_T *pDAC)
 Initial DAC configuration. More...
 
void Chip_DAC_DeInit (LPC_DAC_T *pDAC)
 Shutdown DAC. More...
 
void Chip_DAC_UpdateValue (LPC_DAC_T *pDAC, uint32_t dac_value)
 Update value to DAC buffer. More...
 
void Chip_DAC_SetBias (LPC_DAC_T *pDAC, uint32_t bias)
 Set maximum update rate for DAC. More...
 
STATIC INLINE void Chip_DAC_ConfigDAConverterControl (LPC_DAC_T *pDAC, uint32_t dacFlags)
 Enables the DMA operation and controls DMA timer. More...
 
STATIC INLINE void Chip_DAC_SetDMATimeOut (LPC_DAC_T *pDAC, uint32_t time_out)
 Set reload value for interrupt/DMA counter. More...
 
STATIC INLINE IntStatus Chip_DAC_GetIntStatus (LPC_DAC_T *pDAC)
 Get status for interrupt/DMA time out. More...
 

Macro Definition Documentation

#define DAC_BIAS_EN   ((uint32_t) (1 << 16))

If this bit = 0: The settling time of the DAC is 1 microsecond max, and the maximum current is 700 microAmpere If this bit = 1: The settling time of the DAC is 2.5 microsecond and the maximum current is 350 microAmpere

Definition at line 62 of file dac_18xx_43xx.h.

#define DAC_CCNT_VALUE (   n)    ((uint32_t) (n & 0xffff))

Value to reload interrupt DMA counter

Definition at line 64 of file dac_18xx_43xx.h.

#define DAC_CNT_ENA   ((uint32_t) (1 << 2))

DCAR Time out count enable

Definition at line 69 of file dac_18xx_43xx.h.

#define DAC_DACCTRL_MASK   ((uint32_t) (0x0F))

DCAR DACCTRL mask bit

Definition at line 73 of file dac_18xx_43xx.h.

#define DAC_DBLBUF_ENA   ((uint32_t) (1 << 1))

DCAR double buffering

Definition at line 67 of file dac_18xx_43xx.h.

#define DAC_DMA_ENA   ((uint32_t) (1 << 3))

DCAR DMA access

Definition at line 71 of file dac_18xx_43xx.h.

#define DAC_VALUE (   n)    ((uint32_t) ((n & 0x3FF) << 6))

After the selected settling time after this field is written with a new VALUE, the voltage on the AOUT pin (with respect to VSSA) is VALUE/1024 ? VREF

Definition at line 56 of file dac_18xx_43xx.h.

Enumeration Type Documentation

Current option in DAC configuration option.

Enumerator
DAC_MAX_UPDATE_RATE_1MHz 

Shorter settling times and higher power consumption; allows for a maximum update rate of 1 MHz

DAC_MAX_UPDATE_RATE_400kHz 

Longer settling times and lower power consumption; allows for a maximum update rate of 400 kHz

Definition at line 78 of file dac_18xx_43xx.h.

Function Documentation

STATIC INLINE void Chip_DAC_ConfigDAConverterControl ( LPC_DAC_T pDAC,
uint32_t  dacFlags 
)

Enables the DMA operation and controls DMA timer.

Parameters
pDAC: pointer to LPC_DAC_T
dacFlags: An Or'ed value of the following DAC values:
  • DAC_DBLBUF_ENA :enable/disable DACR double buffering feature
  • DAC_CNT_ENA :enable/disable timer out counter
  • DAC_DMA_ENA :enable/disable DMA access
Returns
Nothing
Note
Pass an Or'ed value of the DAC flags to enable those options.

Definition at line 129 of file dac_18xx_43xx.h.

void Chip_DAC_DeInit ( LPC_DAC_T pDAC)

Shutdown DAC.

Parameters
pDAC: pointer to LPC_DAC_T
Returns
Nothing

Definition at line 60 of file dac_18xx_43xx.c.

STATIC INLINE IntStatus Chip_DAC_GetIntStatus ( LPC_DAC_T pDAC)

Get status for interrupt/DMA time out.

Parameters
pDAC: pointer to LPC_DAC_T
Returns
interrupt/DMA time out status, should be SET or RESET

Definition at line 153 of file dac_18xx_43xx.h.

void Chip_DAC_Init ( LPC_DAC_T pDAC)

Initial DAC configuration.

         - Maximum current is 700 uA
         - Value to AOUT is 0
Parameters
pDAC: pointer to LPC_DAC_T
Returns
Nothing

Definition at line 51 of file dac_18xx_43xx.c.

void Chip_DAC_SetBias ( LPC_DAC_T pDAC,
uint32_t  bias 
)

Set maximum update rate for DAC.

Parameters
pDAC: pointer to LPC_DAC_T
bias: Using Bias value, should be:
  • 0 is 1MHz
  • 1 is 400kHz
Returns
Nothing

Definition at line 77 of file dac_18xx_43xx.c.

STATIC INLINE void Chip_DAC_SetDMATimeOut ( LPC_DAC_T pDAC,
uint32_t  time_out 
)

Set reload value for interrupt/DMA counter.

Parameters
pDAC: pointer to LPC_DAC_T
time_out: time out to reload for interrupt/DMA counter
Returns
Nothing

Definition at line 143 of file dac_18xx_43xx.h.

void Chip_DAC_UpdateValue ( LPC_DAC_T pDAC,
uint32_t  dac_value 
)

Update value to DAC buffer.

Parameters
pDAC: pointer to LPC_DAC_T
dac_value: value 10 bit to be converted to output
Returns
Nothing

Definition at line 66 of file dac_18xx_43xx.c.