Functions | |
bool | ADC12_B_init (uint16_t baseAddress, ADC12_B_initParam *param) |
Initializes the ADC12B Module. More... | |
void | ADC12_B_enable (uint16_t baseAddress) |
Enables the ADC12B block. More... | |
void | ADC12_B_disable (uint16_t baseAddress) |
Disables the ADC12B block. More... | |
void | ADC12_B_setupSamplingTimer (uint16_t baseAddress, uint16_t clockCycleHoldCountLowMem, uint16_t clockCycleHoldCountHighMem, uint16_t multipleSamplesEnabled) |
Sets up and enables the Sampling Timer Pulse Mode. More... | |
void | ADC12_B_disableSamplingTimer (uint16_t baseAddress) |
Disables Sampling Timer Pulse Mode. More... | |
void | ADC12_B_configureMemory (uint16_t baseAddress, ADC12_B_configureMemoryParam *param) |
Configures the controls of the selected memory buffer. More... | |
void | ADC12_B_setWindowCompAdvanced (uint16_t baseAddress, uint16_t highThreshold, uint16_t lowThreshold) |
Sets the high and low threshold for the window comparator feature. More... | |
void | ADC12_B_enableInterrupt (uint16_t baseAddress, uint16_t interruptMask0, uint16_t interruptMask1, uint16_t interruptMask2) |
Enables selected ADC12B interrupt sources. More... | |
void | ADC12_B_disableInterrupt (uint16_t baseAddress, uint16_t interruptMask0, uint16_t interruptMask1, uint16_t interruptMask2) |
Disables selected ADC12B interrupt sources. More... | |
void | ADC12_B_clearInterrupt (uint16_t baseAddress, uint8_t interruptRegisterChoice, uint16_t memoryInterruptFlagMask) |
Clears ADC12B selected interrupt flags. More... | |
uint16_t | ADC12_B_getInterruptStatus (uint16_t baseAddress, uint8_t interruptRegisterChoice, uint16_t memoryInterruptFlagMask) |
Returns the status of the selected memory interrupt flags. More... | |
void | ADC12_B_startConversion (uint16_t baseAddress, uint16_t startingMemoryBufferIndex, uint8_t conversionSequenceModeSelect) |
Enables/Starts an Analog-to-Digital Conversion. More... | |
void | ADC12_B_disableConversions (uint16_t baseAddress, bool preempt) |
Disables the ADC from converting any more signals. More... | |
uint16_t | ADC12_B_getResults (uint16_t baseAddress, uint8_t memoryBufferIndex) |
Returns the raw contents of the specified memory buffer. More... | |
void | ADC12_B_setResolution (uint16_t baseAddress, uint8_t resolutionSelect) |
Use to change the resolution of the converted data. More... | |
void | ADC12_B_setSampleHoldSignalInversion (uint16_t baseAddress, uint16_t invertedSignal) |
Use to invert or un-invert the sample/hold signal. More... | |
void | ADC12_B_setDataReadBackFormat (uint16_t baseAddress, uint8_t readBackFormat) |
Use to set the read-back format of the converted data. More... | |
void | ADC12_B_setAdcPowerMode (uint16_t baseAddress, uint8_t powerMode) |
Use to set the ADC's power conservation mode if the sampling rate is at 50-ksps or less. More... | |
uint32_t | ADC12_B_getMemoryAddressForDMA (uint16_t baseAddress, uint8_t memoryIndex) |
Returns the address of the specified memory buffer for the DMA module. More... | |
uint8_t | ADC12_B_isBusy (uint16_t baseAddress) |
Returns the busy status of the ADC12B core. More... | |
void ADC12_B_clearInterrupt | ( | uint16_t | baseAddress, |
uint8_t | interruptRegisterChoice, | ||
uint16_t | memoryInterruptFlagMask | ||
) |
Clears ADC12B selected interrupt flags.
Modified registers are ADC12IFG .
baseAddress | is the base address of the ADC12B module. |
interruptRegisterChoice | is either 0, 1, or 2, to choose the correct interrupt register to update |
memoryInterruptFlagMask | is the bit mask of the memory buffer and overflow interrupt flags to be cleared. Valid values are:
|
void ADC12_B_configureMemory | ( | uint16_t | baseAddress, |
ADC12_B_configureMemoryParam * | param | ||
) |
Configures the controls of the selected memory buffer.
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.
baseAddress | is the base address of the ADC12B module. |
param | is the pointer to struct for ADC12B memory configuration. |
References ADC12_B_configureMemoryParam::differentialModeSelect, ADC12_B_configureMemoryParam::endOfSequence, ADC12_B_configureMemoryParam::inputSourceSelect, ADC12_B_configureMemoryParam::memoryBufferControlIndex, ADC12_B_configureMemoryParam::refVoltageSourceSelect, and ADC12_B_configureMemoryParam::windowComparatorSelect.
void ADC12_B_disable | ( | uint16_t | baseAddress | ) |
Disables the ADC12B block.
This will disable operation of the ADC12B block.
baseAddress | is the base address of the ADC12B module. |
Modified bits are ADC12ON of ADC12CTL0 register.
void ADC12_B_disableConversions | ( | uint16_t | baseAddress, |
bool | preempt | ||
) |
Disables the ADC from converting any more signals.
Disables the ADC from converting any more signals. If there is a conversion in progress, this function can stop it immediately if the preempt parameter is set as ADC12_B_PREEMPTCONVERSION, 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_B_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.
baseAddress | is the base address of the ADC12B module. |
preempt | specifies if the current conversion should be preemptively stopped before the end of the conversion. Valid values are:
|
Modified bits of ADC12CTL1 register and bits of ADC12CTL0 register.
References ADC12_B_isBusy().
void ADC12_B_disableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask0, | ||
uint16_t | interruptMask1, | ||
uint16_t | interruptMask2 | ||
) |
Disables selected ADC12B interrupt sources.
Disables the indicated ADC12B interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
baseAddress | is the base address of the ADC12B module. |
interruptMask0 | is the bit mask of the memory buffer and overflow interrupt sources to be disabled. If the desired interrupt is not available in the selection for interruptMask0, then simply pass in a '0' for this value. Valid values are:
|
interruptMask1 | is the bit mask of the memory buffer and overflow interrupt sources to be disabled. If the desired interrupt is not available in the selection for interruptMask1, then simply pass in a '0' for this value. Valid values are:
|
interruptMask2 | is the bit mask of the memory buffer and overflow interrupt sources to be disabled. If the desired interrupt is not available in the selection for interruptMask2, then simply pass in a '0' for this value. Valid values are:
|
Modified bits of ADC12IERx register.
void ADC12_B_disableSamplingTimer | ( | uint16_t | baseAddress | ) |
Disables Sampling Timer Pulse Mode.
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.
baseAddress | is the base address of the ADC12B module. |
void ADC12_B_enable | ( | uint16_t | baseAddress | ) |
Enables the ADC12B block.
This will enable operation of the ADC12B block.
baseAddress | is the base address of the ADC12B module. |
Modified bits are ADC12ON of ADC12CTL0 register.
void ADC12_B_enableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask0, | ||
uint16_t | interruptMask1, | ||
uint16_t | interruptMask2 | ||
) |
Enables selected ADC12B interrupt sources.
Enables the indicated ADC12B interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Does not clear interrupt flags.
baseAddress | is the base address of the ADC12B module. |
interruptMask0 | is the bit mask of the memory buffer and overflow interrupt sources to be enabled. If the desired interrupt is not available in the selection for interruptMask0, then simply pass in a '0' for this value. Valid values are:
|
interruptMask1 | is the bit mask of the memory buffer and overflow interrupt sources to be enabled. If the desired interrupt is not available in the selection for interruptMask1, then simply pass in a '0' for this value. Valid values are:
|
interruptMask2 | is the bit mask of the memory buffer and overflow interrupt sources to be enabled. If the desired interrupt is not available in the selection for interruptMask2, then simply pass in a '0' for this value. Valid values are:
|
Modified bits of ADC12IERx register.
uint16_t ADC12_B_getInterruptStatus | ( | uint16_t | baseAddress, |
uint8_t | interruptRegisterChoice, | ||
uint16_t | memoryInterruptFlagMask | ||
) |
Returns the status of the selected memory interrupt flags.
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.
baseAddress | is the base address of the ADC12B module. |
interruptRegisterChoice | is either 0, 1, or 2, to choose the correct interrupt register to update |
memoryInterruptFlagMask | is the bit mask of the memory buffer and overflow interrupt flags to be cleared. Valid values are:
|
uint32_t ADC12_B_getMemoryAddressForDMA | ( | uint16_t | baseAddress, |
uint8_t | memoryIndex | ||
) |
Returns the address of the specified memory buffer for the DMA module.
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.
baseAddress | is the base address of the ADC12B module. |
memoryIndex | is the memory buffer to return the address of. Valid values are:
|
uint16_t ADC12_B_getResults | ( | uint16_t | baseAddress, |
uint8_t | memoryBufferIndex | ||
) |
Returns the raw contents of the specified memory buffer.
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-significant 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.
baseAddress | is the base address of the ADC12B module. |
memoryBufferIndex | is the specified memory buffer to read. Valid values are:
|
bool ADC12_B_init | ( | uint16_t | baseAddress, |
ADC12_B_initParam * | param | ||
) |
Initializes the ADC12B Module.
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.
baseAddress | is the base address of the ADC12B module. |
param | is the pointer to struct for initialization. |
References ADC12_B_initParam::clockSourceDivider, ADC12_B_initParam::clockSourcePredivider, ADC12_B_initParam::clockSourceSelect, ADC12_B_initParam::internalChannelMap, and ADC12_B_initParam::sampleHoldSignalSourceSelect.
uint8_t ADC12_B_isBusy | ( | uint16_t | baseAddress | ) |
Returns the busy status of the ADC12B core.
Returns the status of the ADC core if there is a conversion currently taking place.
baseAddress | is the base address of the ADC12B module. |
Referenced by ADC12_B_disableConversions().
void ADC12_B_setAdcPowerMode | ( | uint16_t | baseAddress, |
uint8_t | powerMode | ||
) |
Use to set the ADC's power conservation mode if the sampling rate is at 50-ksps or less.
Sets ADC's power mode. If the user has a sampling rate greater than 50-ksps, then he/she can only enable ADC12_B_REGULARPOWERMODE. If the sampling rate is 50-ksps or less, the user can enable ADC12_B_LOWPOWERMODE granting additional power savings.
baseAddress | is the base address of the ADC12B module. |
powerMode | is the specified maximum sampling rate. Valid values are:
|
void ADC12_B_setDataReadBackFormat | ( | uint16_t | baseAddress, |
uint8_t | readBackFormat | ||
) |
Use to set the read-back format of the converted data.
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.
baseAddress | is the base address of the ADC12B module. |
readBackFormat | is the specified format to store the conversions in the memory buffer. Valid values are:
|
void ADC12_B_setResolution | ( | uint16_t | baseAddress, |
uint8_t | resolutionSelect | ||
) |
Use to change the resolution of the converted data.
This function can be used to change the resolution of the converted data from the default of 12-bits.
baseAddress | is the base address of the ADC12B module. |
resolutionSelect | determines the resolution of the converted data. Valid values are:
|
void ADC12_B_setSampleHoldSignalInversion | ( | uint16_t | baseAddress, |
uint16_t | invertedSignal | ||
) |
Use to invert or un-invert the sample/hold signal.
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.
baseAddress | is the base address of the ADC12B module. |
invertedSignal | set if the sample/hold signal should be inverted Valid values are:
|
void ADC12_B_setupSamplingTimer | ( | uint16_t | baseAddress, |
uint16_t | clockCycleHoldCountLowMem, | ||
uint16_t | clockCycleHoldCountHighMem, | ||
uint16_t | multipleSamplesEnabled | ||
) |
Sets up and enables the Sampling Timer Pulse Mode.
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.
baseAddress | is the base address of the ADC12B module. |
clockCycleHoldCountLowMem | sets the amount of clock cycles to sample- and-hold for the higher memory buffers 0-7. Valid values are:
|
clockCycleHoldCountHighMem | sets the amount of clock cycles to sample-and-hold for the higher memory buffers 8-15. Valid values are:
|
multipleSamplesEnabled | allows multiple conversions to start without a trigger signal from the sample/hold signal Valid values are:
|
void ADC12_B_setWindowCompAdvanced | ( | uint16_t | baseAddress, |
uint16_t | highThreshold, | ||
uint16_t | lowThreshold | ||
) |
Sets the high and low threshold for the window comparator feature.
Sets the high and low threshold for the window comparator feature. Use the ADC12HIIE, ADC12INIE, ADC12LOIE interrupts to utilize this feature.
baseAddress | is the base address of the ADC12B module. |
highThreshold | is the upper bound that could trip an interrupt for the window comparator. |
lowThreshold | is the lower bound that could trip on interrupt for the window comparator. |
void ADC12_B_startConversion | ( | uint16_t | baseAddress, |
uint16_t | startingMemoryBufferIndex, | ||
uint8_t | conversionSequenceModeSelect | ||
) |
Enables/Starts an Analog-to-Digital Conversion.
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_B_setupSamplingTimer() function. Note that after this function is called, the ADC12_B_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.
baseAddress | is the base address of the ADC12B module. |
startingMemoryBufferIndex | is the memory buffer that will hold the first or only conversion. Valid values are:
|
conversionSequenceModeSelect | determines the ADC operating mode. Valid values are:
|
Modified bits of ADC12CTL1 register and bits of ADC12CTL0 register.