Keil ADC Peripheral Project
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.
- 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
- Download adc_ain6_ss3.c
- Add adc_ain6_ss3.c file to 'Source Group 1'..
- How to Add Existing Files to 'Source Group 1'..? You may refer here
- Set Options for Target as given here
- Build the Project
- How to Build the Project? You may refer here
- Configure Debugger to use simulator
- To run the program using Simulator, we have to configure the Debugger to use the simulator as given here
- Start the Debugger
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 )
- 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
- Select Peripherals → TExaS ADC
- Now, move the Slide pot left-to-right/right-to-left
- Observe the ADC value changing in the watch window