Tiva Driver Lib
Macros | Functions
Adc_api

Macros

#define ADC_SEQ   (ADC_O_SSMUX0)
 
#define ADC_SEQ_STEP   (ADC_O_SSMUX1 - ADC_O_SSMUX0)
 
#define ADC_SSMUX   (ADC_O_SSMUX0 - ADC_O_SSMUX0)
 
#define ADC_SSEMUX   (ADC_O_SSEMUX0 - ADC_O_SSMUX0)
 
#define ADC_SSCTL   (ADC_O_SSCTL0 - ADC_O_SSMUX0)
 
#define ADC_SSFIFO   (ADC_O_SSFIFO0 - ADC_O_SSMUX0)
 
#define ADC_SSFSTAT   (ADC_O_SSFSTAT0 - ADC_O_SSMUX0)
 
#define ADC_SSOP   (ADC_O_SSOP0 - ADC_O_SSMUX0)
 
#define ADC_SSDC   (ADC_O_SSDC0 - ADC_O_SSMUX0)
 

Functions

void ADCIntRegister (uint32_t ui32Base, uint32_t ui32SequenceNum, void(*pfnHandler)(void))
 
void ADCIntUnregister (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCIntDisable (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCIntEnable (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
uint32_t ADCIntStatus (uint32_t ui32Base, uint32_t ui32SequenceNum, bool bMasked)
 
void ADCIntClear (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCSequenceEnable (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCSequenceDisable (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCSequenceConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Trigger, uint32_t ui32Priority)
 
void ADCSequenceStepConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Step, uint32_t ui32Config)
 
int32_t ADCSequenceOverflow (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCSequenceOverflowClear (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
int32_t ADCSequenceUnderflow (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCSequenceUnderflowClear (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
int32_t ADCSequenceDataGet (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer)
 
void ADCProcessorTrigger (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCSoftwareOversampleConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Factor)
 
void ADCSoftwareOversampleStepConfigure (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Step, uint32_t ui32Config)
 
void ADCSoftwareOversampleDataGet (uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer, uint32_t ui32Count)
 
void ADCHardwareOversampleConfigure (uint32_t ui32Base, uint32_t ui32Factor)
 
void ADCComparatorConfigure (uint32_t ui32Base, uint32_t ui32Comp, uint32_t ui32Config)
 
void ADCComparatorRegionSet (uint32_t ui32Base, uint32_t ui32Comp, uint32_t ui32LowRef, uint32_t ui32HighRef)
 
void ADCComparatorReset (uint32_t ui32Base, uint32_t ui32Comp, bool bTrigger, bool bInterrupt)
 
void ADCComparatorIntDisable (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
void ADCComparatorIntEnable (uint32_t ui32Base, uint32_t ui32SequenceNum)
 
uint32_t ADCComparatorIntStatus (uint32_t ui32Base)
 
void ADCComparatorIntClear (uint32_t ui32Base, uint32_t ui32Status)
 
void ADCReferenceSet (uint32_t ui32Base, uint32_t ui32Ref)
 
uint32_t ADCReferenceGet (uint32_t ui32Base)
 
void ADCPhaseDelaySet (uint32_t ui32Base, uint32_t ui32Phase)
 
uint32_t ADCPhaseDelayGet (uint32_t ui32Base)
 

Detailed Description

Function Documentation

void ADCComparatorConfigure ( uint32_t  ui32Base,
uint32_t  ui32Comp,
uint32_t  ui32Config 
)

Configures an ADC digital comparator.

Parameters
ui32Baseis the base address of the ADC module.
ui32Compis the index of the comparator to configure.
ui32Configis the configuration of the comparator.

This function configures a comparator. The ui32Config parameter is the result of a logical OR operation between the ADC_COMP_TRIG_xxx, and ADC_COMP_INT_xxx values.

The ADC_COMP_TRIG_xxx term can take on the following values:

  • ADC_COMP_TRIG_NONE to never trigger PWM fault condition.
  • ADC_COMP_TRIG_LOW_ALWAYS to always trigger PWM fault condition when ADC output is in the low-band.
  • ADC_COMP_TRIG_LOW_ONCE to trigger PWM fault condition once when ADC output transitions into the low-band.
  • ADC_COMP_TRIG_LOW_HALWAYS to always trigger PWM fault condition when ADC output is in the low-band only if ADC output has been in the high-band since the last trigger output.
  • ADC_COMP_TRIG_LOW_HONCE to trigger PWM fault condition once when ADC output transitions into low-band only if ADC output has been in the high-band since the last trigger output.
  • ADC_COMP_TRIG_MID_ALWAYS to always trigger PWM fault condition when ADC output is in the mid-band.
  • ADC_COMP_TRIG_MID_ONCE to trigger PWM fault condition once when ADC output transitions into the mid-band.
  • ADC_COMP_TRIG_HIGH_ALWAYS to always trigger PWM fault condition when ADC output is in the high-band.
  • ADC_COMP_TRIG_HIGH_ONCE to trigger PWM fault condition once when ADC output transitions into the high-band.
  • ADC_COMP_TRIG_HIGH_HALWAYS to always trigger PWM fault condition when ADC output is in the high-band only if ADC output has been in the low-band since the last trigger output.
  • ADC_COMP_TRIG_HIGH_HONCE to trigger PWM fault condition once when ADC output transitions into high-band only if ADC output has been in the low-band since the last trigger output.

The ADC_COMP_INT_xxx term can take on the following values:

  • ADC_COMP_INT_NONE to never generate ADC interrupt.
  • ADC_COMP_INT_LOW_ALWAYS to always generate ADC interrupt when ADC output is in the low-band.
  • ADC_COMP_INT_LOW_ONCE to generate ADC interrupt once when ADC output transitions into the low-band.
  • ADC_COMP_INT_LOW_HALWAYS to always generate ADC interrupt when ADC output is in the low-band only if ADC output has been in the high-band since the last trigger output.
  • ADC_COMP_INT_LOW_HONCE to generate ADC interrupt once when ADC output transitions into low-band only if ADC output has been in the high-band since the last trigger output.
  • ADC_COMP_INT_MID_ALWAYS to always generate ADC interrupt when ADC output is in the mid-band.
  • ADC_COMP_INT_MID_ONCE to generate ADC interrupt once when ADC output transitions into the mid-band.
  • ADC_COMP_INT_HIGH_ALWAYS to always generate ADC interrupt when ADC output is in the high-band.
  • ADC_COMP_INT_HIGH_ONCE to generate ADC interrupt once when ADC output transitions into the high-band.
  • ADC_COMP_INT_HIGH_HALWAYS to always generate ADC interrupt when ADC output is in the high-band only if ADC output has been in the low-band since the last trigger output.
  • ADC_COMP_INT_HIGH_HONCE to generate ADC interrupt once when ADC output transitions into high-band only if ADC output has been in the low-band since the last trigger output.
Returns
None.
void ADCComparatorIntClear ( uint32_t  ui32Base,
uint32_t  ui32Status 
)

Clears sample sequence comparator interrupt source.

Parameters
ui32Baseis the base address of the ADC module.
ui32Statusis the bit-mapped interrupts status to clear.

The specified interrupt status is cleared.

Returns
None.
void ADCComparatorIntDisable ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Disables a sample sequence comparator interrupt.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function disables the requested sample sequence comparator interrupt.

Returns
None.
void ADCComparatorIntEnable ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Enables a sample sequence comparator interrupt.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function enables the requested sample sequence comparator interrupt.

Returns
None.
uint32_t ADCComparatorIntStatus ( uint32_t  ui32Base)

Gets the current comparator interrupt status.

Parameters
ui32Baseis the base address of the ADC module.

This function returns the digital comparator interrupt status bits. This status is sequence agnostic.

Returns
The current comparator interrupt status.
void ADCComparatorRegionSet ( uint32_t  ui32Base,
uint32_t  ui32Comp,
uint32_t  ui32LowRef,
uint32_t  ui32HighRef 
)

Defines the ADC digital comparator regions.

Parameters
ui32Baseis the base address of the ADC module.
ui32Compis the index of the comparator to configure.
ui32LowRefis the reference point for the low/mid band threshold.
ui32HighRefis the reference point for the mid/high band threshold.

The ADC digital comparator operation is based on three ADC value regions:

  • low-band is defined as any ADC value less than or equal to the ui32LowRef value.
  • mid-band is defined as any ADC value greater than the ui32LowRef value but less than or equal to the ui32HighRef value.
  • high-band is defined as any ADC value greater than the ui32HighRef value.
Returns
None.
void ADCComparatorReset ( uint32_t  ui32Base,
uint32_t  ui32Comp,
bool  bTrigger,
bool  bInterrupt 
)

Resets the current ADC digital comparator conditions.

Parameters
ui32Baseis the base address of the ADC module.
ui32Compis the index of the comparator.
bTriggeris the flag to indicate reset of Trigger conditions.
bInterruptis the flag to indicate reset of Interrupt conditions.

Because the digital comparator uses current and previous ADC values, this function allows the comparator to be reset to its initial value to prevent stale data from being used when a sequence is enabled.

Returns
None.
void ADCHardwareOversampleConfigure ( uint32_t  ui32Base,
uint32_t  ui32Factor 
)

Configures the hardware oversampling factor of the ADC.

Parameters
ui32Baseis the base address of the ADC module.
ui32Factoris the number of samples to be averaged.

This function configures the hardware oversampling for the ADC, which can be used to provide better resolution on the sampled data. Oversampling is accomplished by averaging multiple samples from the same analog input. Six different oversampling rates are supported; 2x, 4x, 8x, 16x, 32x, and 64x. Specifying an oversampling factor of zero disables hardware oversampling.

Hardware oversampling applies uniformly to all sample sequencers. It does not reduce the depth of the sample sequencers like the software oversampling APIs; each sample written into the sample sequencer FIFO is a fully oversampled analog input reading.

Enabling hardware averaging increases the precision of the ADC at the cost of throughput. For example, enabling 4x oversampling reduces the throughput of a 250 k samples/second ADC to 62.5 k samples/second.

Returns
None.
void ADCIntClear ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Clears sample sequence interrupt source.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

The specified sample sequence interrupt is cleared, so that it no longer asserts. This function must be called in the interrupt handler to keep the interrupt from being triggered again immediately upon exit.

Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
Returns
None.
void ADCIntDisable ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Disables a sample sequence interrupt.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function disables the requested sample sequence interrupt.

Returns
None.
void ADCIntEnable ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Enables a sample sequence interrupt.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function enables the requested sample sequence interrupt. Any outstanding interrupts are cleared before enabling the sample sequence interrupt.

Returns
None.
void ADCIntRegister ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
void(*)(void)  pfnHandler 
)

Registers an interrupt handler for an ADC interrupt.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
pfnHandleris a pointer to the function to be called when the ADC sample sequence interrupt occurs.

This function sets the handler to be called when a sample sequence interrupt occurs. This function enables the global interrupt in the interrupt controller; the sequence interrupt must be enabled with ADCIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source via ADCIntClear().

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.
uint32_t ADCIntStatus ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
bool  bMasked 
)

Gets the current interrupt status.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
bMaskedis false if the raw interrupt status is required and true if the masked interrupt status is required.

This function returns the interrupt status for the specified sample sequence. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Returns
The current raw or masked interrupt status.
void ADCIntUnregister ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Unregisters the interrupt handler for an ADC interrupt.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function unregisters the interrupt handler. This function disables the global interrupt in the interrupt controller; the sequence interrupt must be disabled via ADCIntDisable().

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.
uint32_t ADCPhaseDelayGet ( uint32_t  ui32Base)

Gets the phase delay between a trigger and the start of a sequence.

Parameters
ui32Baseis the base address of the ADC module.

This function gets the current phase delay between the detection of an ADC trigger event and the start of the sample sequence.

Returns
Returns the phase delay, specified as one of ADC_PHASE_0, ADC_PHASE_22_5, ADC_PHASE_45, ADC_PHASE_67_5, ADC_PHASE_90, ADC_PHASE_112_5, ADC_PHASE_135, ADC_PHASE_157_5, ADC_PHASE_180, ADC_PHASE_202_5, ADC_PHASE_225, ADC_PHASE_247_5, ADC_PHASE_270, ADC_PHASE_292_5, ADC_PHASE_315, or ADC_PHASE_337_5.
void ADCPhaseDelaySet ( uint32_t  ui32Base,
uint32_t  ui32Phase 
)

Sets the phase delay between a trigger and the start of a sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32Phaseis the phase delay, specified as one of ADC_PHASE_0, ADC_PHASE_22_5, ADC_PHASE_45, ADC_PHASE_67_5, ADC_PHASE_90, ADC_PHASE_112_5, ADC_PHASE_135, ADC_PHASE_157_5, ADC_PHASE_180, ADC_PHASE_202_5, ADC_PHASE_225, ADC_PHASE_247_5, ADC_PHASE_270, ADC_PHASE_292_5, ADC_PHASE_315, or ADC_PHASE_337_5.

This function sets the phase delay between the detection of an ADC trigger event and the start of the sample sequence. By selecting a different phase delay for a pair of ADC modules (such as ADC_PHASE_0 and ADC_PHASE_180) and having each ADC module sample the same analog input, it is possible to increase the sampling rate of the analog input (with samples N, N+2, N+4, and so on, coming from the first ADC and samples N+1, N+3, N+5, and so on, coming from the second ADC). The ADC module has a single phase delay that is applied to all sample sequences within that module.

Note
This capability is not available on all parts.
Returns
None.
void ADCProcessorTrigger ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Causes a processor trigger for a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number, with ADC_TRIGGER_WAIT or ADC_TRIGGER_SIGNAL optionally ORed into it.

This function triggers a processor-initiated sample sequence if the sample sequence trigger is configured to ADC_TRIGGER_PROCESSOR. If ADC_TRIGGER_WAIT is ORed into the sequence number, the processor-initiated trigger is delayed until a later processor-initiated trigger to a different ADC module that specifies ADC_TRIGGER_SIGNAL, allowing multiple ADCs to start from a processor-initiated trigger in a synchronous manner.

Returns
None.
uint32_t ADCReferenceGet ( uint32_t  ui32Base)

Returns the current setting of the ADC reference.

Parameters
ui32Baseis the base address of the ADC module.

Returns the value of the ADC reference setting. The returned value is one of ADC_REF_INT, ADC_REF_EXT_3V, or ADC_REF_EXT_1V.

Note
The value returned by this function is only meaningful if used on a part that is capable of using an external reference. Consult the data sheet for your part to determine if it has an external reference input.
Returns
The current setting of the ADC reference.
void ADCReferenceSet ( uint32_t  ui32Base,
uint32_t  ui32Ref 
)

Selects the ADC reference.

Parameters
ui32Baseis the base address of the ADC module.
ui32Refis the reference to use.

The ADC reference is set as specified by ui32Ref. It must be one of ADC_REF_INT, ADC_REF_EXT_3V, or ADC_REF_EXT_1V for internal or external reference. If ADC_REF_INT is chosen, then an internal 3V reference is used and no external reference is needed. If ADC_REF_EXT_3V is chosen, then a 3V reference must be supplied to the AVREF pin. If ADC_REF_EXT_1V is chosen, then a 1V external reference must be supplied to the AVREF pin.

Note
The ADC reference can only be selected on parts that have an external reference. Consult the data sheet for your part to determine if there is an external reference.
Returns
None.
void ADCSequenceConfigure ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
uint32_t  ui32Trigger,
uint32_t  ui32Priority 
)

Configures the trigger source and priority of a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
ui32Triggeris the trigger source that initiates the sample sequence; must be one of the ADC_TRIGGER_* values.
ui32Priorityis the relative priority of the sample sequence with respect to the other sample sequences.

This function configures the initiation criteria for a sample sequence. Valid sample sequencers range from zero to three; sequencer zero captures up to eight samples, sequencers one and two capture up to four samples, and sequencer three captures a single sample. The trigger condition and priority (with respect to other sample sequencer execution) are set.

The ui32Trigger parameter can take on the following values:

  • ADC_TRIGGER_PROCESSOR - A trigger generated by the processor, via the ADCProcessorTrigger() function.
  • ADC_TRIGGER_COMP0 - A trigger generated by the first analog comparator; configured with ComparatorConfigure().
  • ADC_TRIGGER_COMP1 - A trigger generated by the second analog comparator; configured with ComparatorConfigure().
  • ADC_TRIGGER_COMP2 - A trigger generated by the third analog comparator; configured with ComparatorConfigure().
  • ADC_TRIGGER_EXTERNAL - A trigger generated by an input from the Port B4 pin. Note that some microcontrollers can select from any GPIO using the GPIOADCTriggerEnable() function.
  • ADC_TRIGGER_TIMER - A trigger generated by a timer; configured with TimerControlTrigger().
  • ADC_TRIGGER_PWM0 - A trigger generated by the first PWM generator; configured with PWMGenIntTrigEnable().
  • ADC_TRIGGER_PWM1 - A trigger generated by the second PWM generator; configured with PWMGenIntTrigEnable().
  • ADC_TRIGGER_PWM2 - A trigger generated by the third PWM generator; configured with PWMGenIntTrigEnable().
  • ADC_TRIGGER_PWM3 - A trigger generated by the fourth PWM generator; configured with PWMGenIntTrigEnable().
  • ADC_TRIGGER_ALWAYS - A trigger that is always asserted, causing the sample sequence to capture repeatedly (so long as there is not a higher priority source active).

Note that not all trigger sources are available on all Tiva family members; consult the data sheet for the device in question to determine the availability of triggers.

The ui32Priority parameter is a value between 0 and 3, where 0 represents the highest priority and 3 the lowest. Note that when programming the priority among a set of sample sequences, each must have unique priority; it is up to the caller to guarantee the uniqueness of the priorities.

Returns
None.
int32_t ADCSequenceDataGet ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
uint32_t *  pui32Buffer 
)

Gets the captured data for a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
pui32Bufferis the address where the data is stored.

This function copies data from the specified sample sequencer output FIFO to a memory resident buffer. The number of samples available in the hardware FIFO are copied into the buffer, which is assumed to be large enough to hold that many samples. This function only returns the samples that are presently available, which may not be the entire sample sequence if it is in the process of being executed.

Returns
Returns the number of samples copied to the buffer.
void ADCSequenceDisable ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Disables a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

Prevents the specified sample sequence from being captured when its trigger is detected. A sample sequence should be disabled before it is configured.

Returns
None.
void ADCSequenceEnable ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Enables a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

Allows the specified sample sequence to be captured when its trigger is detected. A sample sequence must be configured before it is enabled.

Returns
None.
int32_t ADCSequenceOverflow ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Determines if a sample sequence overflow occurred.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function determines if a sample sequence overflow has occurred. Overflow happens if the captured samples are not read from the FIFO before the next trigger occurs.

Returns
Returns zero if there was not an overflow, and non-zero if there was.
void ADCSequenceOverflowClear ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Clears the overflow condition on a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function clears an overflow condition on one of the sample sequences. The overflow condition must be cleared in order to detect a subsequent overflow condition (it otherwise causes no harm).

Returns
None.
void ADCSequenceStepConfigure ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
uint32_t  ui32Step,
uint32_t  ui32Config 
)

Configure a step of the sample sequencer.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
ui32Stepis the step to be configured.
ui32Configis the configuration of this step; must be a logical OR of ADC_CTL_TS, ADC_CTL_IE, ADC_CTL_END, ADC_CTL_D, one of the input channel selects (ADC_CTL_CH0 through ADC_CTL_CH23), and one of the digital comparator selects (ADC_CTL_CMP0 through ADC_CTL_CMP7).

This function configures the ADC for one step of a sample sequence. The ADC can be configured for single-ended or differential operation (the ADC_CTL_D bit selects differential operation when set), the channel to be sampled can be chosen (the ADC_CTL_CH0 through ADC_CTL_CH23 values), and the internal temperature sensor can be selected (the ADC_CTL_TS bit). Additionally, this step can be defined as the last in the sequence (the ADC_CTL_END bit) and it can be configured to cause an interrupt when the step is complete (the ADC_CTL_IE bit). If the digital comparators are present on the device, this step may also be configured to send the ADC sample to the selected comparator using ADC_CTL_CMP0 through ADC_CTL_CMP7. The configuration is used by the ADC at the appropriate time when the trigger for this sequence occurs.

Note
If the Digital Comparator is present and enabled using the ADC_CTL_CMP0 through ADC_CTL_CMP7 selects, the ADC sample is NOT written into the ADC sequence data FIFO.

The ui32Step parameter determines the order in which the samples are captured by the ADC when the trigger occurs. It can range from zero to seven for the first sample sequencer, from zero to three for the second and third sample sequencer, and can only be zero for the fourth sample sequencer.

Differential mode only works with adjacent channel pairs (for example, 0 and 1). The channel select must be the number of the channel pair to sample (for example, ADC_CTL_CH0 for 0 and 1, or ADC_CTL_CH1 for 2 and 3) or undefined results are returned by the ADC. Additionally, if differential mode is selected when the temperature sensor is being sampled, undefined results are returned by the ADC.

It is the responsibility of the caller to ensure that a valid configuration is specified; this function does not check the validity of the specified configuration.

Returns
None.
int32_t ADCSequenceUnderflow ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Determines if a sample sequence underflow occurred.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function determines if a sample sequence underflow has occurred. Underflow happens if too many samples are read from the FIFO.

Returns
Returns zero if there was not an underflow, and non-zero if there was.
void ADCSequenceUnderflowClear ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum 
)

Clears the underflow condition on a sample sequence.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.

This function clears an underflow condition on one of the sample sequencers. The underflow condition must be cleared in order to detect a subsequent underflow condition (it otherwise causes no harm).

Returns
None.
void ADCSoftwareOversampleConfigure ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
uint32_t  ui32Factor 
)

Configures the software oversampling factor of the ADC.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
ui32Factoris the number of samples to be averaged.

This function configures the software oversampling for the ADC, which can be used to provide better resolution on the sampled data. Oversampling is accomplished by averaging multiple samples from the same analog input. Three different oversampling rates are supported; 2x, 4x, and 8x.

Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per trigger. This also means that 8x oversampling is only available on the first sample sequencer.

Returns
None.
void ADCSoftwareOversampleDataGet ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
uint32_t *  pui32Buffer,
uint32_t  ui32Count 
)

Gets the captured data for a sample sequence using software oversampling.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
pui32Bufferis the address where the data is stored.
ui32Countis the number of samples to be read.

This function copies data from the specified sample sequence output FIFO to a memory resident buffer with software oversampling applied. The requested number of samples are copied into the data buffer; if there are not enough samples in the hardware FIFO to satisfy this many oversampled data items, then incorrect results are returned. It is the caller's responsibility to read only the samples that are available and wait until enough data is available, for example as a result of receiving an interrupt.

Returns
None.
void ADCSoftwareOversampleStepConfigure ( uint32_t  ui32Base,
uint32_t  ui32SequenceNum,
uint32_t  ui32Step,
uint32_t  ui32Config 
)

Configures a step of the software oversampled sequencer.

Parameters
ui32Baseis the base address of the ADC module.
ui32SequenceNumis the sample sequence number.
ui32Stepis the step to be configured.
ui32Configis the configuration of this step.

This function configures a step of the sample sequencer when using the software oversampling feature. The number of steps available depends on the oversampling factor set by ADCSoftwareOversampleConfigure(). The value of ui32Config is the same as defined for ADCSequenceStepConfigure().

Returns
None.