The MCUXpresso SDK provides a peripheral driver for the 10-bit digital to analog converter (DAC) module of MCUXpresso SDK devices.
Typical use case
Polling Configuration
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dac
Interrupt Configuration
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/dac
A load impedance value greater than that value will cause settling time longer than the specified time. One or more graphs of load impedance vs. settling time will be included in the final data sheet.
Enumerator |
---|
kDAC_SettlingTimeIs1us |
The settling time of the DAC is 1us max, and the maximum current is 700 mA.
This allows a maximum update rate of 1 MHz.
|
kDAC_SettlingTimeIs25us |
The settling time of the DAC is 2.5us and the maximum current is 350uA.
This allows a maximum update rate of 400 kHz.
|
void DAC_Init |
( |
DAC_Type * |
base, |
|
|
const dac_config_t * |
config |
|
) |
| |
- Parameters
-
base | DAC peripheral base address. |
config | The pointer to configuration structure. Please refer to "dac_config_t" structure. |
void DAC_Deinit |
( |
DAC_Type * |
base | ) |
|
- Parameters
-
base | DAC peripheral base address. |
This function initializes the user configuration structure to a default value. The default values are as follows.
- Parameters
-
config | Pointer to the configuration structure. See "dac_config_t". |
void DAC_EnableDoubleBuffering |
( |
DAC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
Notice: Disabling the double-buffering feature will disable counter opreation. If double-buffering feature is disabled, any writes to the CR address will go directly to the CR register. If double-buffering feature is enabled, any write to the CR register will only load the pre-buffer, which shares its register address with the CR register. The CR itself will be loaded from the pre-buffer whenever the counter reaches zero and the DMA request is set.
- Parameters
-
base | DAC peripheral base address. |
enable | Enable or disable the feature. |
void DAC_SetBufferValue |
( |
DAC_Type * |
base, |
|
|
uint32_t |
value |
|
) |
| |
The DAC output voltage is VALUE*((VREFP)/1024).
- Parameters
-
base | DAC peripheral base address. |
value | Setting the value for items in the buffer. 10-bits are available. |
void DAC_SetCounterValue |
( |
DAC_Type * |
base, |
|
|
uint32_t |
value |
|
) |
| |
When the counter is enabled bit, the 16-bit counter will begin counting down, at the rate selected by PCLK,
from the value programmed into the DACCNTVAL register. The counter is decremented Each time the counter
reaches zero, the counter will be reloaded by the value of DACCNTVAL and the DMA request bit INT_DMA_REQ will be set in hardware.
- Parameters
-
base | DAC peripheral basic address. |
value | Setting the value for items in the counter. 16-bits are available. |
static void DAC_EnableDMA |
( |
DAC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | DAC peripheral base address. |
enable | Enable or disable the feature. |
static void DAC_EnableCounter |
( |
DAC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | DAC peripheral base address. |
enable | Enable or disable the feature. |
static bool DAC_GetDMAInterruptRequestFlag |
( |
DAC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | DAC peripheral base address. |
- Returns
- If return 'true', it means DMA request or interrupt occurs. If return 'false', it means DMA request or interrupt doesn't occur.