#include "driverlib/5xx_6xx/dac12.h"
#include "inc/hw_types.h"
#include "deprecated/CCS/msp430xgeneric.h"
#include "driverlib/5xx_6xx/debug.h"
Functions | |
unsigned short | DAC12_init (unsigned int baseAddress, unsigned char submoduleSelect, unsigned short outputSelect, unsigned int positiveReferenceVoltage, unsigned int outputVoltageMultiplier, unsigned char amplifierSetting, unsigned int conversionTriggerSelect) |
void | DAC12_setAmplifierSetting (unsigned int baseAddress, unsigned char submoduleSelect, unsigned char amplifierSetting) |
void | DAC12_disable (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_enableGrouping (unsigned int baseAddress) |
void | DAC12_disableGrouping (unsigned int baseAddress) |
void | DAC12_enableInterrupt (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_disableInterrupt (unsigned int baseAddress, unsigned char submoduleSelect) |
unsigned short | DAC12_getInterruptStatus (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_clearInterrupt (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_calibrateOutput (unsigned int baseAddress, unsigned char submoduleSelect) |
int | DAC12_getCalibrationData (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_setCalibrationOffset (unsigned int baseAddress, unsigned char submoduleSelect, int calibrationOffsetValue) |
void | DAC12_enableConversions (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_setData (unsigned int baseAddress, unsigned char submoduleSelect, unsigned int data) |
void | DAC12_disableConversions (unsigned int baseAddress, unsigned char submoduleSelect) |
void | DAC12_setResolution (unsigned int baseAddress, unsigned char submoduleSelect, unsigned int resolutionSelect) |
void | DAC12_setInputDataFormat (unsigned int baseAddress, unsigned char submoduleSelect, unsigned char inputJustification, unsigned char inputSign) |
unsigned long | DAC12_getDataBufferMemoryAddressForDMA (unsigned baseAddress, unsigned char submoduleSelect) |
unsigned short DAC12_init | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect, | ||
unsigned short | outputSelect, | ||
unsigned int | positiveReferenceVoltage, | ||
unsigned int | outputVoltageMultiplier, | ||
unsigned char | amplifierSetting, | ||
unsigned int | conversionTriggerSelect | ||
) |
Initializes the DAC12 module with the specified settings.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
outputSelect | selects the output pin that the selected DAC12 module will output to. Valid values are DAC12_OUTPUT_1 [Default] DAC12_OUTPUT_2 Modified bits are DAC12OPS of DAC12_xCTL0 register. |
positiveReferenceVoltage | is the upper limit voltage that the data can be converted in to. Valid values are DAC12_VREF_VCC [Default] DAC12_VREF_INT DAC12_VREF_EXT Modified bits are DAC12SREFx of DAC12_xCTL0 register. |
outputVoltageMultiplier | is the multiplier of the Vout voltage. Valid values are DAC12_VREFx1 [Default] DAC12_VREFx2 DAC12_VREFx3 Modified bits are DAC12IR of DAC12_xCTL0 register and DAC12OG of DAC12CTL1 register. |
amplifierSetting | is the setting of the settling speed and current of the Vref+ and the Vout buffer. Valid values are DAC12_AMP_OFF_PINOUTHIGHZ - Initialize the DAC12 Module with settings, but do not turn it on. [Default] DAC12_AMP_OFF_PINOUTLOW - Initialize the DAC12 Module with settings, and allow it to take control of the selected output pin to pull it low (Note: this takes control away port mapping module). DAC12_AMP_LOWIN_LOWOUT - Select a slow settling speed and current for Vref+ input buffer and for Vout output buffer. DAC12_AMP_LOWIN_MEDOUT - Select a slow settling speed and current for Vref+ input buffer and a medium settling speed and current for Vout output buffer. DAC12_AMP_LOWIN_HIGHOUT - Select a slow settling speed and current for Vref+ input buffer and a high settling speed and current for Vout output buffer. DAC12_AMP_MEDIN_MEDOUT - Select a medium settling speed and current for Vref+ input buffer and for Vout output buffer. DAC12_AMP_MEDIN_HIGHOUT - Select a medium settling speed and current for Vref+ input buffer and a high settling speed and current for Vout output buffer. DAC12_AMP_HIGHIN_HIGHOUT - Select a high settling speed and current for Vref+ input buffer and for Vout output buffer. Modified bits are DAC12AMPx of DAC12_xCTL0 register. |
conversionTriggerSelect | selects the trigger that will start a conversion. Valid values are DAC12_TRIGGER_ENCBYPASS - Automatically converts data as soon as it is written into the data buffer. (Note: Do not use this selection if grouping DAC's). [Default] DAC12_TRIGGER_ENC - Requires a call to enableConversions() to allow a conversion, but starts a conversion as soon as data is written to the data buffer (Note: with DAC12 module's grouped, data has to be set in BOTH DAC12 data buffers to start a conversion). DAC12_TRIGGER_TA - Requires a call to enableConversions() to allow a conversion, and a rising edge of Timer_A's Out1 (TA1) to start a conversion. DAC12_TRIGGER_TB - Requires a call to enableConversions() to allow a conversion, and a rising edge of Timer_B's Out2 (TB2) to start a conversion. Modified bits are DAC12LSELx of DAC12_xCTL0 register. |
This function initializes the DAC12 module with the specified settings. Upon successful completion of the initialization of this module the control registers and interrupts of this module are all reset, and the specified variables will be set. Please note, that if conversions are enabled with the enableConversions() function, then disableConversions() must be called before re-initializing the DAC12 module with this function.
References ASSERT, DAC12_AMP_HIGHIN_HIGHOUT, DAC12_OUTPUT_2, DAC12_SUBMODULE_1, DAC12_TRIGGER_TB, DAC12_VREF_EXT, DAC12_VREFx1, DAC12_VREFx2, DAC12_VREFx3, HWREG, and STATUS_SUCCESS.
void DAC12_setAmplifierSetting | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect, | ||
unsigned char | amplifierSetting | ||
) |
Sets the amplifier settings for the Vref+ and Vout buffers.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
amplifierSetting | is the setting of the settling speed and current of the Vref+ and the Vout buffer. Valid values are DAC12_AMP_OFF_PINOUTHIGHZ - Initialize the DAC12 Module with settings, but do not turn it on. [Default] DAC12_AMP_OFF_PINOUTLOW - Initialize the DAC12 Module with settings, and allow it to take control of the selected output pin to pull it low (Note: this takes control away port mapping module). DAC12_AMP_LOWIN_LOWOUT - Select a slow settling speed and current for Vref+ input buffer and for Vout output buffer. DAC12_AMP_LOWIN_MEDOUT - Select a slow settling speed and current for Vref+ input buffer and a medium settling speed and current for Vout output buffer. DAC12_AMP_LOWIN_HIGHOUT - Select a slow settling speed and current for Vref+ input buffer and a high settling speed and current for Vout output buffer. DAC12_AMP_MEDIN_MEDOUT - Select a medium settling speed and current for Vref+ input buffer and for Vout output buffer. DAC12_AMP_MEDIN_HIGHOUT - Select a medium settling speed and current for Vref+ input buffer and a high settling speed and current for Vout output buffer. DAC12_AMP_HIGHIN_HIGHOUT - Select a high settling speed and current for Vref+ input buffer and for Vout output buffer. Modified bits are DAC12LSELx of DAC12_xCTL0 register. |
This function sets the amplifier settings of the DAC12 module for the Vref+ and Vout buffers without re-initializing the DAC12 module. This can be used to disable the control of the pin by the DAC12 module.
References ASSERT, DAC12_AMP_HIGHIN_HIGHOUT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_disable | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Clears the amplifier settings to disable the DAC12 module.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function clears the amplifier settings for the selected DAC12 module to disable the DAC12 module. Modified bits are DAC12AMP_7 of DAC12_xCTL0 register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_enableGrouping | ( | unsigned int | baseAddress | ) |
Enables grouping of two DAC12 modules in a dual DAC12 system.
baseAddress | is the base address of the DAC12 module. |
This function enables grouping two DAC12 modules in a dual DAC12 system. Both DAC12 modules will work in sync, converting data at the same time. To convert data, the same trigger should be set for both DAC12 modules during initialization (which should not be DAC12_TRIGGER_ENCBYPASS), the enableConversions() function needs to be called with both DAC12 modules, and data needs to be set for both DAC12 modules seperately.
Modified bits are DAC12GRP of DAC12_xCTL0 register.
References HWREG.
void DAC12_disableGrouping | ( | unsigned int | baseAddress | ) |
Disables grouping of two DAC12 modules in a dual DAC12 system.
baseAddress | is the base address of the DAC12 module. |
This function disables grouping of two DAC12 modules in a dual DAC12 system.
Modified bits are DAC12GRP of DAC12_xCTL0 register.
References HWREG.
void DAC12_enableInterrupt | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Enables the DAC12 module interrupt source.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function to enable the DAC12 module interrupt, which throws an interrupt when the data buffer is available for new data to be set. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Note that an interrupt is not thrown when DAC12_TRIGGER_AUTO has been set for the parameter conversionTriggerSelect in initialization.
Modified bits are DAC12IE and DAC12IFG of DAC12_xCTL0 register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_disableInterrupt | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Disables the DAC12 module interrupt source.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
Enables the DAC12 module interrupt source. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
Modified bits are DAC12IE bits of DAC12_xCTL0 register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
unsigned short DAC12_getInterruptStatus | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Returns the status of the DAC12 module interrupt flag.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function returns the status of the DAC12 module interrupt flag. Note that an interrupt is not thrown when DAC12_TRIGGER_AUTO has been set for the conversionTriggerSelect parameter in initialization.
References ASSERT, DAC12_INT_ACTIVE, DAC12_INT_INACTIVE, DAC12_SUBMODULE_1, and HWREG.
void DAC12_clearInterrupt | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Clears the DAC12 module interrupt flag.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
The DAC12 module interrupt flag is cleared, so that it no longer asserts. Note that an interrupt is not thrown when DAC12_TRIGGER_AUTO has been set for the parameter conversionTriggerSelect in initialization.
Modified bits are DAC12IFG of DAC12_xCTL0 register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_calibrateOutput | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Calibrates the output offset.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function disables the calibration lock, starts the calibration, whats for the calibration to complete, and then relocks the calibration lock. Please note, this function should be called after initializing the dac12 module, and before using it.
Modified bits are DAC12CALON of DAC12_xCTL0 register and DAC12PW of DAC12_0CALCTL register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
int DAC12_getCalibrationData | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Returns the calibrated offset of the output buffer.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function returns the calibrated offset of the output buffer. The output buffer offset is used to obtain accurate results from the output pin. This function should only be used while the calibration lock is enabled. Only the lower byte of the word of the register is returned, and the value is between -128 and +127.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_setCalibrationOffset | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect, | ||
int | calibrationOffsetValue | ||
) |
Returns the calibrated offset of the output buffer.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function is used to manually set the calibration offset value. The calibration is automatically unlocked and relocked to be able to allow for the offset value to be set.
Modified bits are DAC12PW of DAC12_xCTL0 register DAC12PW and DAC12LOCK of OFS_DAC12_0CALCTL register DAC12_0CALDAT register
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_enableConversions | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Enables triggers to start conversions.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function is used to allow triggers to start a conversion. Note that this function does not need to be used if DAC12_TRIGGER_AUTO was set for the conversionTriggerSelect parameter during initialization. If DAC grouping is enabled, this has to be called for both DAC's.
Modified bits are DAC12ENC of DAC12_xCTL0 register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_setData | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect, | ||
unsigned int | data | ||
) |
Sets the given data into the buffer to be converted.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
data | is the data to be set into the DAC12 data buffer to be converted. Modified bits are DAC12_Data of DAC12_xDAT register. |
This function is used to set the given data into the data buffer of the DAC12 module. The data given should be in the format set (12-bit Unsigned, Right-justified by default). Note if DAC12_TRIGGER_AUTO was set for the conversionTriggerSelect during initialization then using this function will set the data and automatically trigger a conversion. If any other trigger was set during initialization, then the DAC12_enableConversions() function needs to be called before a conversion can be started. If grouping DAC's and DAC12_TRIGGER_ENC was set during initialization, then both data buffers must be set before a conversion will be started.
Modified registers are DAC12_0DAT.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_disableConversions | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Disables triggers to start conversions.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
This function is used to disallow triggers to start a conversion. Note that this function does not have any affect if DAC12_TRIGGER_AUTO was set for the conversionTriggerSelect parameter during initialization.
Modified bits are DAC12ENC of DAC12_xCTL0 register.
References ASSERT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_setResolution | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect, | ||
unsigned int | resolutionSelect | ||
) |
Sets the resolution to be used by the DAC12 module.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
resolutionSelect | is the resolution to use for conversions. Valid values are DAC12_RESOLUTION_8BIT DAC12_RESOLUTION_12BIT [Default] Modified bits are DAC12RES of DAC12_xCTL0 register. |
This function sets the resolution of the data to converted.
Modified bits are DAC12ENC of DAC12_xCTL0 register. DAC12RES of DAC12_xCTL0 register.
References ASSERT, DAC12_RESOLUTION_12BIT, DAC12_RESOLUTION_8BIT, DAC12_SUBMODULE_1, and HWREG.
void DAC12_setInputDataFormat | ( | unsigned int | baseAddress, |
unsigned char | submoduleSelect, | ||
unsigned char | inputJustification, | ||
unsigned char | inputSign | ||
) |
Sets the input data format for the DAC12 module.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
inputJustification | is the justification of the data to be converted. Valid values are DAC12_JUSTIFICATION_RIGHT [Default] DAC12_JUSTIFICATION_LEFT Modified bits are DAC12DFJ of DAC12_xCTL1 register. |
inputSign | is the sign of the data to be converted. Valid values are DAC12_UNSIGNED_BINARY [Default] DAC12_SIGNED_2SCOMPLEMENT Modified bits are DAC12DF of DAC12_xCTL0 register. |
This function sets the input format for the binary data to be converted.
References ASSERT, DAC12_JUSTIFICATION_LEFT, DAC12_JUSTIFICATION_RIGHT, DAC12_SIGNED_2SCOMPLEMENT, DAC12_SUBMODULE_1, DAC12_UNSIGNED_BINARY, and HWREG.
unsigned long DAC12_getDataBufferMemoryAddressForDMA | ( | unsigned | baseAddress, |
unsigned char | submoduleSelect | ||
) |
Returns the address of the specified DAC12 data buffer for the DMA module.
baseAddress | is the base address of the DAC12 module. |
submoduleSelect | decides which DAC12 sub-module to configure. Valid values are DAC12_SUBMODULE_0 DAC12_SUBMODULE_1 |
Returns the address of the specified memory buffer. This can be used in conjunction with the DMA to obtain the data directly from memory.
References ASSERT, and DAC12_SUBMODULE_1.