Functions | |
void | AUXDACSetVref (uint8_t refSource) |
Sets the voltage reference source. More... | |
void | AUXDACEnablePreCharge (void) |
Enables DAC precharge. More... | |
void | AUXDACDisablePreCharge (void) |
Disables DAC precharge. More... | |
uint32_t | AUXDACCalcMax (void) |
Calculates the upper limit voltage the DAC can output. More... | |
uint32_t | AUXDACCalcMin (void) |
Calculates the lower limit voltage the DAC can output. More... | |
uint32_t | AUXDACCalcCode (uint32_t uVoltOut, uint32_t uVoltOutMin, uint32_t uVoltOutMax) |
Calculates the appropriate DAC code for a specific voltage value. More... | |
void | AUXDACSetSampleClock (uint8_t dacClkDiv) |
Configures and sets the DAC sample clock. More... | |
void | AUXDACSetCode (uint8_t dacCode) |
Updates the current DAC code. More... | |
void | AUXDACEnable (uint8_t dacPinId) |
Enables the DAC. More... | |
void | AUXDACDisable (void) |
Disables the DAC. More... | |
uint32_t AUXDACCalcCode | ( | uint32_t | uVoltOut, |
uint32_t | uVoltOutMin, | ||
uint32_t | uVoltOutMax | ||
) |
Calculates the appropriate DAC code for a specific voltage value.
Once a voltage reference source has been selected with AUXDACSetVref and the DAC's output voltage range has been defined with AUXDACCalcMin and AUXDACCalcMax, a DAC code can be derived.
uVoltOut | The desired output voltage in millivolts [mV]. |
uVoltOutMin | The minimum output voltage in millivolts [mV] which can be output by the DAC in the current configuration. It should be the value returned by AUXDACCalcMin. |
uVoltOutMax | The maximum output voltage in millivolts [mV] which can be output by the DAC in the current configuration. It should be the value returned by AUXDACCalcMax. |
uint32_t AUXDACCalcMax | ( | void | ) |
Calculates the upper limit voltage the DAC can output.
This function uses calibration coefficients stored in the factory configuration area (FCFG1) to determine the DAC's output voltage that corresponds to DAC code 255. This voltage depends on the selected voltage reference source.
uint32_t AUXDACCalcMin | ( | void | ) |
Calculates the lower limit voltage the DAC can output.
This function uses calibration coefficients stored in the factory configuration area (FCFG1) to determine the DAC's output voltage that corresponds to DAC code 1. This voltage depends on the selected voltage reference source.
DAC Code 0 corresponds to 0 V. Therefore, the DAC can only output 0 V and values between the lower limit defined by this function and the upper limit defined by AUXDACCalcMax.
void AUXDACDisable | ( | void | ) |
Disables the DAC.
This function disables the DAC sample clock, the DAC buffer, the DAC. It also disconnects COMPA_IN internally.
void AUXDACDisablePreCharge | ( | void | ) |
Disables DAC precharge.
If AUXDAC_VREF_SEL_DCOUPL has been selected as a voltage reference source, the DAC's output voltage range can be further controlled by enabling or disabling precharge.
When precharge is disabled the DAC's output voltage will range from 0 V to 1.28 V.
void AUXDACEnable | ( | uint8_t | dacPinId | ) |
Enables the DAC.
This function enables the DAC sample clock and the DAC buffer. It selects COMPA_IN as output, and it routes the DAC's output to the given I/O pin.
dacPinId | Analog capable I/O pin: |
void AUXDACEnablePreCharge | ( | void | ) |
Enables DAC precharge.
If AUXDAC_VREF_SEL_DCOUPL has been selected as a voltage reference source, the DAC's output voltage range can be further controlled by enabling or disabling precharge.
When precharge is enabled the DAC's output voltage will range from 1.28 V to 2.56 V.
void AUXDACSetCode | ( | uint8_t | dacCode | ) |
Updates the current DAC code.
This function is meant to be used after AUXDACEnable has been called. It allows to update the DAC code by rapidly disabling the DAC, setting the new DAC code, and then rapidly re-enabling the DAC.
dacCode | The new DAC code |
void AUXDACSetSampleClock | ( | uint8_t | dacClkDiv | ) |
Configures and sets the DAC sample clock.
This function determines the sample clock base frequency considering that the operational rate for the DAC sample clock state machine is the AUX Bus Rate.
AUX Bus Rate divided by (dacClkDiv + 1) determines the sample clock base frequency.
dacClkDiv | The clock division factor |
void AUXDACSetVref | ( | uint8_t | refSource | ) |
Sets the voltage reference source.
The DAC's output range depends on the selection of a voltage reference source. This function must be called before enabling the DAC using AUXDACEnable() or before setting a DAC code using AUXDACCalcCode().
refSource | DAC voltage reference source: |
#define AUXDAC_COMPA_IN_AUXIO0 AUXDAC_COMPA_IN_AUXIO19 |
#define AUXDAC_COMPA_IN_AUXIO1 AUXDAC_COMPA_IN_AUXIO20 |
#define AUXDAC_COMPA_IN_AUXIO19 0x80 |
#define AUXDAC_COMPA_IN_AUXIO2 AUXDAC_COMPA_IN_AUXIO21 |
#define AUXDAC_COMPA_IN_AUXIO20 0x40 |
#define AUXDAC_COMPA_IN_AUXIO21 0x20 |
#define AUXDAC_COMPA_IN_AUXIO22 0x10 |
#define AUXDAC_COMPA_IN_AUXIO23 0x08 |
#define AUXDAC_COMPA_IN_AUXIO24 0x04 |
#define AUXDAC_COMPA_IN_AUXIO25 0x02 |
#define AUXDAC_COMPA_IN_AUXIO26 0x01 |
#define AUXDAC_COMPA_IN_AUXIO3 AUXDAC_COMPA_IN_AUXIO22 |
#define AUXDAC_COMPA_IN_AUXIO4 AUXDAC_COMPA_IN_AUXIO23 |
#define AUXDAC_COMPA_IN_AUXIO5 AUXDAC_COMPA_IN_AUXIO24 |
#define AUXDAC_COMPA_IN_AUXIO6 AUXDAC_COMPA_IN_AUXIO25 |
#define AUXDAC_COMPA_IN_AUXIO7 AUXDAC_COMPA_IN_AUXIO26 |
#define AUXDAC_COMPA_IN_NC 0x00 |
#define AUXDAC_VREF_SEL_ADCREF ADI_4_AUX_MUX2_DAC_VREF_SEL_ADCREF |
Referenced by AUXDACCalcMax(), AUXDACCalcMin(), and AUXDACSetVref().
#define AUXDAC_VREF_SEL_DCOUPL ADI_4_AUX_MUX2_DAC_VREF_SEL_DCOUPL |
Referenced by AUXDACCalcMax(), and AUXDACCalcMin().
#define AUXDAC_VREF_SEL_NC ADI_4_AUX_MUX2_DAC_VREF_SEL_NC |
Referenced by AUXDACCalcMax(), and AUXDACCalcMin().
#define AUXDAC_VREF_SEL_VDDS ADI_4_AUX_MUX2_DAC_VREF_SEL_VDDS |
Referenced by AUXDACCalcMax(), and AUXDACCalcMin().