ADC presentation - Victor Brzeski, Jordan Barry

Report
TM4C123G ADC
PERIPHERAL
Jordan Barry
Victor Brzeski
Brief Overview
• Samples, and converts an
analog voltage to a digital
value
• Used frequently in sensor
measurement
• Conversion triggered via SWI
or HWI
TM4C123g MCU’s ADC
• Two ADC modules
• 12 Input Channels each
• 12-bit Precision
• Maximum sample rate of 1 million samples/second
• FIFO buffers
• Trigger Control
• SWI
• Timers
• Analog Comparators
• PWM interrupts
• GPIO Interrupts
Hardware Interface
• Results are bound via VREFP and
VREFN
• These are internally connected to analog
supply voltage/GND
• Sample Averaging Circuit
• Averages 4 samples during conversion
• Useful for noisy signals
• Differential Sampling
• Difference of 2 channels
• Internal Temperature Sensor
• Can be sampled for chip temp
TI API Example
• Using the TI API functions listed at: TI's Website we use
their short example given:
• Enable the channel desired for when trigger occurs
• Trigger sample sequence (Event Occurs eg. SWI, HWI)
• Wait for ADC conversion to complete (Semaphore)
• Read value from ADC result FIFO registers
Code Provided by TI
Triggers
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
- \b ADC_TRIGGER_PROCESSOR - A trigger generated by the processor, via the
//!
ADCProcessorTrigger() function.
//! - \b ADC_TRIGGER_COMP0 - A trigger generated by the first analog
//!
comparator; configured with ComparatorConfigure().
//! - \b ADC_TRIGGER_COMP1 - A trigger generated by the second analog
//!
comparator; configured with ComparatorConfigure().
//! - \b ADC_TRIGGER_COMP2 - A trigger generated by the third analog
//!
comparator; configured with ComparatorConfigure().
//! - \b 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.
//! - \b ADC_TRIGGER_TIMER - A trigger generated by a timer; configured with
//!
TimerControlTrigger().
//! - \b ADC_TRIGGER_PWM0 - A trigger generated by the first PWM generator;
//!
configured with PWMGenIntTrigEnable().
//! - \b ADC_TRIGGER_PWM1 - A trigger generated by the second PWM generator;
//!
configured with PWMGenIntTrigEnable().
//! - \b ADC_TRIGGER_PWM2 - A trigger generated by the third PWM generator;
//!
configured with PWMGenIntTrigEnable().
//! - \b ADC_TRIGGER_PWM3 - A trigger generated by the fourth PWM generator;
//!
configured with PWMGenIntTrigEnable().
//! - \b 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).
Interrupts
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
//! - \b ADC_INT_SS0 - interrupt due to ADC sample sequence 0.
//! - \b ADC_INT_SS1 - interrupt due to ADC sample sequence 1.
//! - \b ADC_INT_SS2 - interrupt due to ADC sample sequence 2.
//! - \b ADC_INT_SS3 - interrupt due to ADC sample sequence 3.
//! - \b ADC_INT_DMA_SS0 - interrupt due to DMA on ADC sample sequence 0.
//! - \b ADC_INT_DMA_SS1 - interrupt due to DMA on ADC sample sequence 1.
//! - \b ADC_INT_DMA_SS2 - interrupt due to DMA on ADC sample sequence 2.
//! - \b ADC_INT_DMA_SS3 - interrupt due to DMA on ADC sample sequence 3.
//! - \b ADC_INT_DCON_SS0 - interrupt due to digital comparator on ADC sample
//! sequence 0.
//! - \b ADC_INT_DCON_SS1 - interrupt due to digital comparator on ADC sample
//! sequence 1.
//! - \b ADC_INT_DCON_SS2 - interrupt due to digital comparator on ADC sample
//! sequence 2.
//! - \b ADC_INT_DCON_SS3 - interrupt due to digital comparator on ADC sample
//! sequence 3.
Logic flow – Interrupt Based
• Set ADC trigger to a SWI, at a specific sampling period
• Eg. ADC_TRIGGER_TIMER via RTOS
• Configure ADC to interrupt when ADC sample sequence
is complete
• Eg. ADC_INT_SS0
• Sample values from FIFO Register
• Read from SSFIFO3 Register
• Send values to PID or bang/bang algorithm
• Adjust motor duty cycle
Questions
• Please

similar documents