#include "driverlib/5xx_6xx/adc12.h"
#include "inc/hw_types.h"
#include "deprecated/CCS/msp430xgeneric.h"
#include "driverlib/5xx_6xx/debug.h"
Functions | |
unsigned short | ADC12_init (unsigned int baseAddress, unsigned int sampleHoldSignalSourceSelect, unsigned char clockSourceSelect, unsigned int clockSourceDivider) |
void | ADC12_enable (unsigned int baseAddress) |
void | ADC12_disable (unsigned int baseAddress) |
void | ADC12_setupSamplingTimer (unsigned int baseAddress, unsigned int clockCycleHoldCountLowMem, unsigned int clockCycleHoldCountHighMem, unsigned short multipleSamplesEnabled) |
void | ADC12_disableSamplingTimer (unsigned int baseAddress) |
void | ADC12_memoryConfigure (unsigned int baseAddress, unsigned char memoryBufferControlIndex, unsigned char inputSourceSelect, unsigned char positiveRefVoltageSourceSelect, unsigned char negativeRefVoltageSourceSelect, unsigned short endOfSequence) |
void | ADC12_enableInterrupt (unsigned int baseAddress, unsigned long interruptMask) |
void | ADC12_disableInterrupt (unsigned int baseAddress, unsigned long interruptMask) |
void | ADC12_clearInterrupt (unsigned int baseAddress, unsigned int memoryInterruptFlagMask) |
unsigned char | ADC12_getInterruptStatus (unsigned int baseAddress, unsigned int memoryInterruptFlagMask) |
void | ADC12_startConversion (unsigned int baseAddress, unsigned int startingMemoryBufferIndex, unsigned char conversionSequenceModeSelect) |
void | ADC12_disableConversions (unsigned int baseAddress, unsigned short preempt) |
int | ADC12_getResults (unsigned int baseAddress, unsigned char memoryBufferIndex) |
void | ADC12_setResolution (unsigned int baseAddress, unsigned char resolutionSelect) |
void | ADC12_setSampleHoldSignalInversion (unsigned int baseAddress, unsigned int invertedSignal) |
void | ADC12_setDataReadBackFormat (unsigned int baseAddress, unsigned short readBackFormat) |
void | ADC12_enableReferenceBurst (unsigned int baseAddress) |
void | ADC12_disableReferenceBurst (unsigned int baseAddress) |
void | ADC12_setReferenceBufferSamplingRate (unsigned int baseAddress, unsigned short samplingRateSelect) |
unsigned long | ADC12_getMemoryAddressForDMA (unsigned int baseAddress, unsigned char memoryIndex) |
unsigned short | ADC12_isBusy (unsigned int baseAddress) |
unsigned short ADC12_init | ( | unsigned int | baseAddress, |
unsigned int | sampleHoldSignalSourceSelect, | ||
unsigned char | clockSourceSelect, | ||
unsigned int | clockSourceDivider | ||
) |
Initializes the ADC12 Module.
baseAddress | is the base address of the ADC12 module. |
sampleHoldSignalSourceSelect | is the signal that will trigger a sample-and-hold for an input signal to be converted. Valid values are ADC12_SAMPLEHOLDSOURCE_SC [Default] ADC12_SAMPLEHOLDSOURCE_1 ADC12_SAMPLEHOLDSOURCE_2 ADC12_SAMPLEHOLDSOURCE_3 This parameter is device specific and sources should be found in the device's datasheet. Modified bits are ADC12SHSx of ADC12CTL1 register. |
clockSourceSelect | selects the clock that will be used by the ADC12 core, and the sampling timer if a sampling pulse mode is enabled. Valid values are ADC12_CLOCKSOURCE_ADC12OSC - MODOSC 5 MHz oscillator from the UCS [Default] ADC12_CLOCKSOURCE_ACLK - The Auxilary Clock ADC12_CLOCKSOURCE_MCLK - The Master Clock ADC12_CLOCKSOURCE_SMCLK - The Sub-Master Clock Modified bits are ADC12SSELx of ADC12CTL1 register. |
clockSourceDivider | selects the amount that the clock will be divided. Valid values are ADC12_CLOCKDIVIDER_1 [Default] ADC12_CLOCKDIVIDER_2 ADC12_CLOCKDIVIDER_3 ADC12_CLOCKDIVIDER_4 ADC12_CLOCKDIVIDER_5 ADC12_CLOCKDIVIDER_6 ADC12_CLOCKDIVIDER_7 ADC12_CLOCKDIVIDER_8 ADC12_CLOCKDIVIDER_12 ADC12_CLOCKDIVIDER_16 ADC12_CLOCKDIVIDER_20 ADC12_CLOCKDIVIDER_24 ADC12_CLOCKDIVIDER_28 ADC12_CLOCKDIVIDER_32 Modified bits are ADC12DIVx of ADC12CTL1 register and ADC12PDIV of ADC12CTL2 register. |
This function initializes the ADC module to allow for analog-to-digital conversions. Specifically this function sets up the sample-and-hold signal and clock sources for the ADC core to use for conversions. Upon successful completion of the initialization all of the ADC control registers will be reset, excluding the memory controls and reference module bits, the given parameters will be set, and the ADC core will be turned on (Note, that the ADC core only draws power during conversions and remains off when not converting).Note that sample/hold signal sources are device dependent. Note that if re-initializing the ADC after starting a conversion with the startConversion() function, the disableConversion() must be called BEFORE this function can be called.
References ADC12_CLOCKDIVIDER_32, ADC12_CLOCKSOURCE_SMCLK, ADC12_SAMPLEHOLDSOURCE_3, ASSERT, HWREG, HWREGB, and STATUS_SUCCESS.
void ADC12_enable | ( | unsigned int | baseAddress | ) |
Enables the ADC12 block.
baseAddress | is the base address of the ADC12 module. |
This will enable operation of the ADC12 block. Modified bits are ADC12ON of ADC12CTL0 register.
References HWREGB.
void ADC12_disable | ( | unsigned int | baseAddress | ) |
Disables the ADC12 block.
baseAddress | is the base address of the ADC12 module. |
This will disable operation of the ADC12 block. Modified bits are ADC12ON of ADC12CTL0 register.
References HWREGB.
void ADC12_setupSamplingTimer | ( | unsigned int | baseAddress, |
unsigned int | clockCycleHoldCountLowMem, | ||
unsigned int | clockCycleHoldCountHighMem, | ||
unsigned short | multipleSamplesEnabled | ||
) |
Sets up and enables the Sampling Timer Pulse Mode.
baseAddress | is the base address of the ADC12 module. |
clockCycleHoldCountLowMem | sets the amount of clock cycles to sample-and-hold for the higher memory buffers 0-7. Valid values are ADC12_CYCLEHOLD_4_CYCLES [Default] ADC12_CYCLEHOLD_8_CYCLES ADC12_CYCLEHOLD_16_CYCLES ADC12_CYCLEHOLD_32_CYCLES ADC12_CYCLEHOLD_64_CYCLES ADC12_CYCLEHOLD_96_CYCLES ADC12_CYCLEHOLD_128_CYCLES ADC12_CYCLEHOLD_192_CYCLES ADC12_CYCLEHOLD_256_CYCLES ADC12_CYCLEHOLD_384_CYCLES ADC12_CYCLEHOLD_512_CYCLES ADC12_CYCLEHOLD_768_CYCLES ADC12_CYCLEHOLD_1024_CYCLES Modified bits are ADC12SHT0x of ADC12CTL0 register. |
clockCycleHoldCountHighMem | sets the amount of clock cycles to sample-and-hold for the higher memory buffers 8-15. Valid values are ADC12_CYCLEHOLD_4_CYCLES [Default] ADC12_CYCLEHOLD_8_CYCLES ADC12_CYCLEHOLD_16_CYCLES ADC12_CYCLEHOLD_32_CYCLES ADC12_CYCLEHOLD_64_CYCLES ADC12_CYCLEHOLD_96_CYCLES ADC12_CYCLEHOLD_128_CYCLES ADC12_CYCLEHOLD_192_CYCLES ADC12_CYCLEHOLD_256_CYCLES ADC12_CYCLEHOLD_384_CYCLES ADC12_CYCLEHOLD_512_CYCLES ADC12_CYCLEHOLD_768_CYCLES ADC12_CYCLEHOLD_1024_CYCLES Modified bits are ADC12SHT1x of ADC12CTL0 register. |
multipleSamplesEnabled | allows multiple conversions to start without a trigger signal from the sample/hold signal Valid values are ADC12_MULTIPLESAMPLESDISABLE - a timer trigger will be needed to start every ADC conversion. [Default] ADC12_MULTIPLESAMPLESENABLE - during a sequenced and/or repeated conversion mode, after the first conversion, no sample/hold signal is necessary to start subsequent sample/hold and convert processes. Modified bits are ADC12MSC of ADC12CTL0 register. |
This function sets up the sampling timer pulse mode which allows the sample/hold signal to trigger a sampling timer to sample-and-hold an input signal for a specified number of clock cycles without having to hold the sample/hold signal for the entire period of sampling. Note that if a conversion has been started with the startConversion() function, then a call to disableConversions() is required before this function may be called.
References ADC12_CYCLEHOLD_1024_CYCLES, ASSERT, HWREG, and HWREGB.
void ADC12_disableSamplingTimer | ( | unsigned int | baseAddress | ) |
Disables Sampling Timer Pulse Mode.
baseAddress | is the base address of the ADC12 module. |
Disables the Sampling Timer Pulse Mode. Note that if a conversion has been started with the startConversion() function, then a call to disableConversions() is required before this function may be called.
Modified bits are ADC12SHP of ADC12CTL0 register.
void ADC12_memoryConfigure | ( | unsigned int | baseAddress, |
unsigned char | memoryBufferControlIndex, | ||
unsigned char | inputSourceSelect, | ||
unsigned char | positiveRefVoltageSourceSelect, | ||
unsigned char | negativeRefVoltageSourceSelect, | ||
unsigned short | endOfSequence | ||
) |
Configures the controls of the selected memory buffer.
baseAddress | is the base address of the ADC12 module. |
memoryBufferControlIndex | is the selected memory buffer to set the configuration for. Valid values are ADC12_MEMORY_0 [Default] ADC12_MEMORY_1 ADC12_MEMORY_2 ADC12_MEMORY_3 ADC12_MEMORY_4 ADC12_MEMORY_5 ADC12_MEMORY_6 ADC12_MEMORY_7 ADC12_MEMORY_8 ADC12_MEMORY_9 ADC12_MEMORY_10 ADC12_MEMORY_11 ADC12_MEMORY_12 ADC12_MEMORY_13 ADC12_MEMORY_14 ADC12_MEMORY_15 |
inputSourceSelect | is the input that will store the converted data into the specified memory buffer. Valid values are ADC12_INPUT_A0 [Default] ADC12_INPUT_A1 ADC12_INPUT_A2 ADC12_INPUT_A3 ADC12_INPUT_A4 ADC12_INPUT_A5 ADC12_INPUT_A6 ADC12_INPUT_A7 ADC12_INPUT_A8 ADC12_INPUT_A9 ADC12_INPUT_TEMPSENSOR ADC12_INPUT_BATTERYMONITOR ADC12_INPUT_A12 ADC12_INPUT_A13 ADC12_INPUT_A14 ADC12_INPUT_A15 Modified bits are ADC12INCHx of ADC12MCTLx register. |
positiveRefVoltageSourceSelect | is the reference voltage source to set as the upper limit for the conversion stored in the specified memory. Valid values are ADC12_VREFPOS_AVCC [Default] ADC12_VREFPOS_EXT ADC12_VREFPOS_INT Modified bits are ADC12SREF of ADC12MCTLx register. |
negativeRefVoltageSourceSelect | is the reference voltage source to set as the lower limit for the conversion stored in the specified memory. Valid values are ADC12_VREFNEG_AVSS [Default] ADC12_VREFNEG_EXT Modified bits are ADC12SREF of ADC12MCTLx register. |
endOfSequence | indicates that the specified memory buffer will be the end of the sequence if a sequenced conversion mode is selected Valid values are ADC12_NOTENDOFSEQUENCE - The specified memory buffer will NOT be the end of the sequence OR a sequenced conversion mode is not selected. [Default] ADC12_ENDOFSEQUENCE - The specified memory buffer will be the end of the sequence. Modified bits are ADC12EOS of ADC12MCTLx register. |
Maps an input signal conversion into the selected memory buffer, as well as the positive and negative reference voltages for each conversion being stored into this memory buffer. If the internal reference is used for the positive reference voltage, the internal REF module must be used to control the voltage level. Note that if a conversion has been started with the startConversion() function, then a call to disableConversions() is required before this function may be called.
References ADC12_INPUT_A15, ADC12_MEMORY_15, ADC12_VREFNEG_EXT, ADC12_VREFPOS_INT, ASSERT, and HWREGB.
void ADC12_enableInterrupt | ( | unsigned int | baseAddress, |
unsigned long | interruptMask | ||
) |
Enables selected ADC12 interrupt sources.
baseAddress | is the base address of the ADC12 module. |
memoryInterruptMask | is the bit mask of the memory buffer and overflow interrupt sources to be enabled. Mask values is the logical OR of any of the following ADC12IE0 - new conversion data in the 0th memory buffer ADC12IE1 - new conversion data in the 1st memory buffer ADC12IE2 - new conversion data in the 2nd memory buffer ADC12IE3 - new conversion data in the 3rd memory buffer ADC12IE4 - new conversion data in the 4th memory buffer ADC12IE5 - new conversion data in the 5th memory buffer ADC12IE6 - new conversion data in the 6th memory buffer ADC12IE7 - new conversion data in the 7th memory buffer ADC12IE8 - new conversion data in the 8th memory buffer ADC12IE9 - new conversion data in the 9th memory buffer ADC12IE10 - new conversion data in the 10th memory buffer ADC12IE11 - new conversion data in the 11th memory buffer ADC12IE12 - new conversion data in the 12th memory buffer ADC12IE13 - new conversion data in the 13th memory buffer ADC12IE14 - new conversion data in the 14th memory buffer ADC12IE15 - new conversion data in the 15th memory buffer ADC12OVIE0 - a conversion is about to save to a memory buffer that has not been read out yet. ADC12TOVIE0 - a conversion is about to start before the previous conversion has been completed. |
Enables the indicated ADC12 interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
References ADC12OVIE0, ADC12TOVIE0, ASSERT, and HWREG.
void ADC12_disableInterrupt | ( | unsigned int | baseAddress, |
unsigned long | interruptMask | ||
) |
Disables selected ADC12 interrupt sources.
baseAddress | is the base address of the ADC12 module. |
memoryInterruptMask | is the bit mask of the memory buffer and overflow interrupt sources to be disabled. Mask values is the logical OR of any of the following ADC12IE0 - new conversion data in the 0th memory buffer ADC12IE1 - new conversion data in the 1st memory buffer ADC12IE2 - new conversion data in the 2nd memory buffer ADC12IE3 - new conversion data in the 3rd memory buffer ADC12IE4 - new conversion data in the 4th memory buffer ADC12IE5 - new conversion data in the 5th memory buffer ADC12IE6 - new conversion data in the 6th memory buffer ADC12IE7 - new conversion data in the 7th memory buffer ADC12IE8 - new conversion data in the 8th memory buffer ADC12IE9 - new conversion data in the 9th memory buffer ADC12IE10 - new conversion data in the 10th memory buffer ADC12IE11 - new conversion data in the 11th memory buffer ADC12IE12 - new conversion data in the 12th memory buffer ADC12IE13 - new conversion data in the 13th memory buffer ADC12IE14 - new conversion data in the 14th memory buffer ADC12IE15 - new conversion data in the 15th memory buffer ADC12OVIE0 - a conversion is about to save to a memory buffer that has not been read out yet. ADC12TOVIE0 - a conversion is about to start before the previous conversion has been completed. |
Disables the indicated ADC12 interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
Modified registers are ADC12CTL0 and ADC12IE.
References ADC12OVIE0, ADC12TOVIE0, ASSERT, and HWREG.
void ADC12_clearInterrupt | ( | unsigned int | baseAddress, |
unsigned int | memoryInterruptFlagMask | ||
) |
Clears ADC12 selected interrupt flags.
baseAddress | is the base address of the ADC12 module. |
memoryInterruptFlagMask | is a bit mask of the interrupt flags to be cleared. Mask value is the logical OR of any of the following OFS_ADC12IFG0 - Flag the 0th memory buffer interrupt OFS_ADC12IFG1 - Flag the 1st memory buffer interrupt OFS_ADC12IFG2 - Flag the 2nd memory buffer interrupt OFS_ADC12IFG3 - Flag the 3rd memory buffer interrupt OFS_ADC12IFG4 - Flag the 4th memory buffer interrupt OFS_ADC12IFG5 - Flag the 5th memory buffer interrupt OFS_ADC12IFG6 - Flag the 6th memory buffer interrupt OFS_ADC12IFG7 - Flag the 7th memory buffer interrupt OFS_ADC12IFG8 - Flag the 8th memory buffer interrupt OFS_ADC12IFG9 - Flag the 9th memory buffer interrupt OFS_ADC12IFG10 - Flag the 10th memory buffer interrupt OFS_ADC12IFG11 - Flag the 11th memory buffer interrupt OFS_ADC12IFG12 - Flag the 12th memory buffer interrupt OFS_ADC12IFG13 - Flag the 13th memory buffer interrupt OFS_ADC12IFG14 - Flag the 14th memory buffer interrupt OFS_ADC12IFG15 - Flag the 15th memory buffer interrupt |
The selected ADC12 interrupt flags are cleared, so that it no longer asserts. The memory buffer interrupt flags are only cleared when the memory buffer is accessed. Note that the overflow interrupts do not have an interrupt flag to clear; they must be accessed directly from the interrupt vector.
Modified registers are ADC12IFG.
References HWREG.
unsigned char ADC12_getInterruptStatus | ( | unsigned int | baseAddress, |
unsigned int | memoryInterruptFlagMask | ||
) |
Returns the status of the selected memory interrupt flags.
baseAddress | is the base address of the ADC12 module. |
memoryInterruptFlagMask | is a bit mask of the interrupt flags status to be returned. Mask value is the logical OR of any of the following OFS_ADC12IFG0 - Flag the 0th memory buffer interrupt OFS_ADC12IFG1 - Flag the 1st memory buffer interrupt OFS_ADC12IFG2 - Flag the 2nd memory buffer interrupt OFS_ADC12IFG3 - Flag the 3rd memory buffer interrupt OFS_ADC12IFG4 - Flag the 4th memory buffer interrupt OFS_ADC12IFG5 - Flag the 5th memory buffer interrupt OFS_ADC12IFG6 - Flag the 6th memory buffer interrupt OFS_ADC12IFG7 - Flag the 7th memory buffer interrupt OFS_ADC12IFG8 - Flag the 8th memory buffer interrupt OFS_ADC12IFG9 - Flag the 9th memory buffer interrupt OFS_ADC12IFG10 - Flag the 10th memory buffer interrupt OFS_ADC12IFG11 - Flag the 11th memory buffer interrupt OFS_ADC12IFG12 - Flag the 12th memory buffer interrupt OFS_ADC12IFG13 - Flag the 13th memory buffer interrupt OFS_ADC12IFG14 - Flag the 14th memory buffer interrupt OFS_ADC12IFG15 - Flag the 15th memory buffer interrupt |
Returns the status of the selected memory interrupt flags. Note that the overflow interrupts do not have an interrupt flag to clear; they must be accessed directly from the interrupt vector.
References HWREG.
void ADC12_startConversion | ( | unsigned int | baseAddress, |
unsigned int | startingMemoryBufferIndex, | ||
unsigned char | conversionSequenceModeSelect | ||
) |
Enables/Starts an Analog-to-Digital Conversion.
baseAddress | is the base address of the ADC12 module. |
startingMemoryBufferIndex | is the memory buffer that will hold the first or only conversion. Valid values are ADC12_MEMORY_0 [Default] ADC12_MEMORY_1 ADC12_MEMORY_2 ADC12_MEMORY_3 ADC12_MEMORY_4 ADC12_MEMORY_5 ADC12_MEMORY_6 ADC12_MEMORY_7 ADC12_MEMORY_8 ADC12_MEMORY_9 ADC12_MEMORY_10 ADC12_MEMORY_11 ADC12_MEMORY_12 ADC12_MEMORY_13 ADC12_MEMORY_14 ADC12_MEMORY_15 Modified bits are ADC12STARTADDx of ADC12CTL1 register. |
conversionSequenceModeSelect | determines the ADC operating mode. Valid values are ADC12_SINGLECHANNEL - one-time conversion of a single channel into a single memory buffer. [Default] ADC12_SEQOFCHANNELS - one time conversion of multiple channels into the specified starting memory buffer and each subsequent memory buffer up until the conversion is stored in a memory buffer dedicated as the end-of-sequence by the memory's control register. ADC12_REPEATED_SINGLECHANNEL - repeated conversions of one channel into a single memory buffer. ADC12_REPEATED_SEQOFCHANNELS - repeated conversions of multiple channels into the specified starting memory buffer and each subsequent memory buffer up until the conversion is stored in a memory buffer dedicated as the end-of-sequence by the memory's control register. Modified bits are ADC12CONSEQx of ADC12CTL1 register. |
This function enables/starts the conversion process of the ADC. If the sample/hold signal source chosen during initialization was ADC12OSC, then the conversion is started immediately, otherwise the chosen sample/hold signal source starts the conversion by a rising edge of the signal. Keep in mind when selecting conversion modes, that for sequenced and/or repeated modes, to keep the sample/hold-and-convert process continuing without a trigger from the sample/hold signal source, the multiple samples must be enabled using the ADC12_setupSamplingTimer() function. Note that after this function is called, the ADC12_stopConversions() has to be called to re-initialize the ADC, reconfigure a memory buffer control, enable/disable the sampling timer, or to change the internal reference voltage.
Modified registers are ADC12CTL0 and ADC12CTL1.
References ADC12_MEMORY_15, ADC12_REPEATED_SEQOFCHANNELS, ASSERT, HWREG, and HWREGB.
void ADC12_disableConversions | ( | unsigned int | baseAddress, |
unsigned short | preempt | ||
) |
Disables the ADC from converting any more signals.
baseAddress | is the base address of the ADC12 module. |
preempt | specifies if the current conversion should be preemptly stopped before the end of the conversion. Valid values are ADC12_COMPLETECONVERSION - Allows the ADC12 to end the current conversion before disabling conversions. ADC12_PREEMPTCONVERSION - Stops the ADC12 immediatly, with unpredicatble results of the current conversion. |
Disables the ADC from converting any more signals. If there is a conversion in progress, this function can stop it immediatly if the preempt parameter is set as TRUE, by changing the conversion mode to single-channel, single-conversion and disabling conversions. If the conversion mode is set as single-channel, single-conversion and this function is called without preemption, then the ADC core conversion status is polled until the conversion is complete before disabling conversions to prevent unpredictable data. If the ADC12_startConversion() has been called, then this function has to be called to re-initialize the ADC, reconfigure a memory buffer control, enable/disable the sampling pulse mode, or change the internal reference voltage.
Modified registers are ADC12CTL0 and ADC12CTL1.
References ADC12_isBusy(), ADC12_PREEMPTCONVERSION, and HWREGB.
int ADC12_getResults | ( | unsigned int | baseAddress, |
unsigned char | memoryBufferIndex | ||
) |
Returns the raw contents of the specified memory buffer.
baseAddress | is the base address of the ADC12 module. |
memryBufferIndex | is the specified Memory Buffer to read. Valid values are ADC12_MEMORY_0 [Default] ADC12_MEMORY_1 ADC12_MEMORY_2 ADC12_MEMORY_3 ADC12_MEMORY_4 ADC12_MEMORY_5 ADC12_MEMORY_6 ADC12_MEMORY_7 ADC12_MEMORY_8 ADC12_MEMORY_9 ADC12_MEMORY_10 ADC12_MEMORY_11 ADC12_MEMORY_12 ADC12_MEMORY_13 ADC12_MEMORY_14 ADC12_MEMORY_15 |
Returns the raw contents of the specified memory buffer. The format of the content depends on the read-back format of the data: if the data is in signed 2's complement format then the contents in the memory buffer will be left-justified with the least-siginificant bits as 0's, whereas if the data is in unsigned format then the contents in the memory buffer will be right-justified with the most-significant bits as 0's.
References ADC12_MEMORY_15, ASSERT, and HWREG.
void ADC12_setResolution | ( | unsigned int | baseAddress, |
unsigned char | resolutionSelect | ||
) |
Use to change the resolution of the converted data.
baseAddress | is the base address of the ADC12 module. |
resolutionSelect | determines the resolution of the converted data. Valid values are ADC12_RESOLUTION_8BIT ADC12_RESOLUTION_10BIT ADC12_RESOLUTION_12BIT [Default] Modified bits are ADC12RESx of ADC12CTL2 register. |
This function can be used to change the resolution of the converted data from the default of 12-bits.
References ADC12_RESOLUTION_12BIT, ASSERT, and HWREGB.
void ADC12_setSampleHoldSignalInversion | ( | unsigned int | baseAddress, |
unsigned int | invertedSignal | ||
) |
Use to invert or un-invert the sample/hold signal.
baseAddress | is the base address of the ADC12 module. |
invertedSignal | set if the sample/hold signal should be inverted Valid values are ADC12_NONINVERTEDSIGNAL - a sample-and-hold of an input signal for conversion will be started on a rising edge of the sample/hold signal. [Default] ADC12_INVERTEDSIGNAL - a sample-and-hold of an input signal for conversion will be started on a falling edge of the sample/hold signal. Modified bits are ADC12ISSH of ADC12CTL1 register. |
This function can be used to invert or un-invert the sample/hold signal. Note that if a conversion has been started with the startConversion() function, then a call to disableConversions() is required before this function may be called.
void ADC12_setDataReadBackFormat | ( | unsigned int | baseAddress, |
unsigned short | readBackFormat | ||
) |
Use to set the read-back format of the converted data.
baseAddress | is the base address of the ADC12 module. |
readBackFormat | is the specified format to store the conversions in the memory buffer. Valid values are ADC12_UNSIGNED_BINARY [Default] ADC12_SIGNED_2SCOMPLEMENT Modified bits are ADC12DF of ADC12CTL2 register. |
Sets the format of the converted data: how it will be stored into the memory buffer, and how it should be read back. The format can be set as right-justified (default), which indicates that the number will be unsigned, or left-justified, which indicates that the number will be signed in 2's complement format. This change affects all memory buffers for subsequent conversions.
References ADC12_SIGNED_2SCOMPLEMENT, ASSERT, and HWREGB.
void ADC12_enableReferenceBurst | ( | unsigned int | baseAddress | ) |
Enables the reference buffer's burst ability.
baseAddress | is the base address of the ADC12 module. |
Enables the reference buffer's burst ability, allowing the reference buffer to turn off while the ADC is not converting, and automatically turning on when the ADC needs the generated reference voltage for a conversion.
References HWREGB.
void ADC12_disableReferenceBurst | ( | unsigned int | baseAddress | ) |
Disables the reference buffer's burst ability.
baseAddress | is the base address of the ADC12 module. |
Disables the reference buffer's burst ability, forcing the reference buffer to remain on continuously.
References HWREGB.
void ADC12_setReferenceBufferSamplingRate | ( | unsigned int | baseAddress, |
unsigned short | samplingRateSelect | ||
) |
Use to set the reference buffer's sampling rate.
baseAddress | is the base address of the ADC12 module. |
samplingRateSelect | is the specified maximum sampling rate. Valid values are ADC12_MAXSAMPLINGRATE_200KSPS [Default] ADC12_MAXSAMPLINGRATE_50KSPS Modified bits are ADC12SR of ADC12CTL2 register. |
Sets the reference buffer's sampling rate to the selected sampling rate. The default sampling rate is maximum of 200-ksps, and can be reduced to a maximum of 50-ksps to conserve power.
References ADC12_MAXSAMPLINGRATE_50KSPS, ASSERT, and HWREGB.
unsigned long ADC12_getMemoryAddressForDMA | ( | unsigned int | baseAddress, |
unsigned char | memoryIndex | ||
) |
Returns the address of the specified memory buffer for the DMA module.
baseAddress | is the base address of the ADC12 module. |
memoryIndex | is the memory buffer to return the address of. Valid values are ADC12_MEMORY_0 [Default] ADC12_MEMORY_1 ADC12_MEMORY_2 ADC12_MEMORY_3 ADC12_MEMORY_4 ADC12_MEMORY_5 ADC12_MEMORY_6 ADC12_MEMORY_7 ADC12_MEMORY_8 ADC12_MEMORY_9 ADC12_MEMORY_10 ADC12_MEMORY_11 ADC12_MEMORY_12 ADC12_MEMORY_13 ADC12_MEMORY_14 ADC12_MEMORY_15 |
Returns the address of the specified memory buffer. This can be used in conjunction with the DMA to store the converted data directly to memory.
unsigned short ADC12_isBusy | ( | unsigned int | baseAddress | ) |
Returns the busy status of the ADC12 core.
baseAddress | is the base address of the ADC12 module. |
Returns the status of the ADC core if there is a conversion currently taking place.
References ADC12_BUSY, ADC12_NOTBUSY, and HWREGB.
Referenced by ADC12_disableConversions().