3.6 DAC - Digital-to-Analog Converter
3.6.1 Introduction
The MCC Melody DAC PLIB Driver (Peripheral Library) generates API to support DAC specific peripheral functionality on AVRxxxDx and ATtiny target MCU's.
The Digital-to-Analog Converter (DAC) converts a digital value written to the Data (DACn.DATA) register to an analog voltage. The conversion range is between GND and the selected voltage reference in the Voltage Reference (VREF) peripheral. The DAC has one continuous time output with high drive capabilities. The DAC conversion can be started from the application by writing to the Data (DACn.DATA) register.
3.6.2 Supported Device Families
AVR® Dx | AVR® Ex | ATtiny |
3.6.3 Required header files:
#include "mcc_generated_files/dac/dac[X].h"
3.6.4 Module Documentation
3.6.4.1 DAC0
Contains the API prototypes and other data types for the DAC0 driver.
3.6.4.1.1 Module description
Contains the API prototypes and other data types for the DAC0 driver.
Functions
int8_t DAC0_Initialize (void)
Initializes the DAC0 and must be called only once, before any other DAC0 routine is called. If the enable bit is set to 0, writing to the Data register will not trigger a conversion until the enable bit is set to 1.
void DAC0_Enable (void)
Enables the DAC0 module.
void DAC0_Disable (void)
Disables the DAC0 module.
void DAC0_SetOutput (dac_resolution_t value)
Starts a digital-to-analog conversion.
uint8_t DAC0_GetResolution (void)
Returns the DAC0 resolution in number of bits.
3.6.4.1.2 Function Documentation
DAC0_Disable()
void DAC0_Disable (void )
Disables the DAC0 module.
|
None. |
DAC0_Enable()
void DAC0_Enable (void )
Enables the DAC0 module.
|
None. |
DAC0_GetResolution()
uint8_t DAC0_GetResolution (void )
Returns the DAC0 resolution in number of bits.
|
Resolution of the DAC. |
DAC0_Initialize()
int8_t DAC0_Initialize (void )
Initializes the DAC0 and must be called only once, before any other DAC0 routine is called. If the enable bit is set to 0, writing to the Data register will not trigger a conversion until the enable bit is set to 1.
|
Initialization status. |
|
DAC0_SetOutput()
void DAC0_SetOutput (dac_resolution_t value)
Starts a digital-to-analog conversion.
|
None. |
3.6.5 File Documentation
3.6.5.1 source/dac0.c File Reference
Contains the API implementations for the DAC0 driver.
#include "../dac0.h"
3.6.5.1.1 Functions
int8_t DAC0_Initialize (void)
Initializes the DAC0 and must be called only once, before any other DAC0 routine is called. If the enable bit is set to 0, writing to the Data register will not trigger a conversion until the enable bit is set to 1.
void DAC0_Enable (void)
Enables the DAC0 module.
void DAC0_Disable (void)
Disables the DAC0 module.
void DAC0_SetOutput (dac_resolution_t value)
Starts a digital-to-analog conversion.
uint8_t DAC0_GetResolution (void)
Returns the DAC0 resolution in number of bits.
3.6.5.1.2 Detailed Description
Contains the API implementations for the DAC0 driver.
DAC0 Generated Driver File
3.6.5.2 source/dac0.h File Reference
#include "../system/utils/compiler.h"
3.6.5.2.1 Functions
int8_t DAC0_Initialize (void)
Initializes the DAC0 and must be called only once, before any other DAC0 routine is called. If the enable bit is set to 0, writing to the Data register will not trigger a conversion until the enable bit is set to 1.
void DAC0_Enable (void)
Enables the DAC0 module.
void DAC0_Disable (void)
Disables the DAC0 module.
void DAC0_SetOutput (dac_resolution_t value)
Starts a digital-to-analog conversion.
uint8_t DAC0_GetResolution (void)
Returns the DAC0 resolution in number of bits.
3.6.5.2.2 Typedefs
-
typedef uint16_t dac_resolution_t
3.6.5.2.3 Detailed Description
DAC0 Generated Driver API Header File
3.6.5.2.4 Typedef Documentation
dac_resolution_t
typedef uint16_t dac_resolution_t
Datatype for the resolution of the DAC