Presentation is loading. Please wait.

Presentation is loading. Please wait.

By James Cockrell and Justin Loveless

Similar presentations


Presentation on theme: "By James Cockrell and Justin Loveless"— Presentation transcript:

1 By James Cockrell and Justin Loveless
Tiva C ADC By James Cockrell and Justin Loveless

2 Overview of Analog-Digital Converter (ADC)
Turns an analog voltage into a digital value Used for sensor measurement Can be triggered with either SWI’s or HWI’s

3 TM4C ADC Specs Reference voltages: Range & Resolution
VREFP – tied to 3.3V on the Launchpad. VREFN – tied to ground on the Launchpad. Range & Resolution Range = 0  4095 Resolution = 3.3V / 4096 = 8.05 mV (p. 803) Max Sampling Speed = 1 million samples/second Hardware Averaging Averages 4 samples in hardware during conversion Differential Sampling Sample the difference between two inputs Internal Temp Sensor Can be sampled for chip temp

4 ADC0 and ADC1 There are two 12 bit ADC’s
All input channels and triggers are shared by both ADC’s

5 Sequencers Pick sequencers based on how many samples you want
For our example we only need one sample Sequencer Number of Samples Depth of FIFO SS3 1 SS2 4 SS1 SS0 8

6 Analog input pins (p.795) These pins can be used as analog inputs if their alternate functions are enabled Pin Name Pin Number Pin Assignment AIN0 6 PE3 AIN1 7 PE2 AIN2 8 PE1 AIN3 9 PE0 AIN4 64 PD3 AIN5 63 PD2 AIN6 62 PD1 AIN7 61 PD0 AIN8 60 PE5 AIN9 59 PE4 AIN10 58 PB4 AIN11 57 PB5

7 Triggers (p. 793) Potential triggers include
Controller (software) Timers Analog Comparators PWM GPIO Nothing (continuous samples) Our example will use a software as the trigger

8 Example setup It’s actually that simple! 3.3V Tiva C PE3 Pot GND

9 Example ADC Code Set up clock for 40 MHz
Enable peripheral ADC0, then reset it to apply changes Disable ADC0 sequencer 3 Configure ADC sequencer Configure steps for sequences Enable peripheral GPIO port E

10 Example ADC Code Activate PE3’s alternate function (AIN0)
Set up interrupt handler for ADC0 sequencer 3 Enable interrupts for ADC0 sequencer 3 Re-enable ADC0 sequencer 3 Enable global interrupts Post request for ADC conversion (in a loop)

11 Example ADC Code (ISR handler)
Clear interrupt flag for ADC0 Sequencer 3 Wait until conversion is done Read data, and process it

12 Libraries to include From the TivaWare peripheral drivers:
File path to TivaWare libraries and examples: C:\ti\TivaWare_C_Series \examples\peripherals

13 Questions?

14 Resources Grp1/docs/software/LM4F-LaunchPad-05%20-%20ADC.pdf Chapter 5 Explains the API functions Tiva C peripheral library and examples download site TM4C123G- LaunchPad/TM4C123G_LaunchPad_Workshop_Workbook.pdf Overview and specifications


Download ppt "By James Cockrell and Justin Loveless"

Similar presentations


Ads by Google