Actions

EmSys

Keil ADC Peripheral Project

From EdWiki

ADC Simulation

In this article, we will use ADC0 which converts the analog input from AIN6 (J3.4 of LaunchPad) using sample sequencer 3 and software trigger continuously. AIN6 channel is on PD1 pin.

  • For more details, click on this link, then select ADC Tab.
  1. Create a New uVision Project as described here
    It's a good practice to create each project in a new folder.
    Name : adc0_ain6_ss3
  2. Download adc_ain6_ss3.c
  3. Add adc_ain6_ss3.c file to 'Source Group 1'..
    How to Add Existing Files to 'Source Group 1'..? You may refer here
  4. Set Options for Target as given here
  5. Build the Project
    How to Build the Project? You may refer here
  6. Configure Debugger to use simulator
    To run the program using Simulator, we have to configure the Debugger to use the simulator as given here
  7. Start the Debugger
Keil start debug menu.png

This will connect μVision to the Simulation model and downloads the project image into the simulated memory of the microcontroller. Once the program image has been loaded, the microcontroller is reset and the code is run until it reaches the main() function

  • Open Watch Windows (Watch #1) ( View Watch Windows Watch #1 )
Keil watch window menu.png
  • Just above main() is the declaration for a variable called adc_value. Highlight this variable, right click, and select “Add adc_value” to Watch #1
Keil adc watch window 1.png
  • Select Peripherals TExaS ADC
Keil texas adc menu.png


  • Start code execution Keil run tool icon.png


  • Now, move the Slide pot left-to-right/right-to-left


Keil texas adc sim win.png
Keil texas adc diagram.png











  • Observe the ADC value changing in the watch window


Keil adc watch window.png