O'Reilly logo

ARM® Cortex® M4 Cookbook by Dr. Mark Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up the ADC

The aim of this recipe is to configure the ADC in single-conversion mode and then convert the voltage set by the thumbwheel into a 12-bit digital value. We'll configure the ADC to generate an interrupt at the end of each conversion and write an interrupt handler to read the ADC and initiate a new conversion. The only task for our main function to perform is to output the ADC value to the LEDs, but as there are only 8 LEDs we can only display the most-significant 8-bits of the ADC value. We'll call this recipe adcISR_c5v0.

How to do it…

To set up the ADC follow the steps outlined:

  1. Open a new folder named adcISR_c5v0 and create a new project named adcISR.uvprojx.
  2. Select LED (API) from RTE Board Support but do not select A/D converter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required