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

Using timers to trigger conversions

As sampling frequency plays such a critical role in determining the quality of the digital representation of the analog signal input, and to avoid aliasing artifacts, it is preferable to use a timer to trigger the conversion rather than to enable continuous conversions as we did in the previous recipe. This recipe, adcTimerISR_c5v0, illustrates this technique. The aim of this recipe is to configure TIM2 _CH2 in output compare mode so that it toggles every 100 ms and then use this timing signal to trigger the ADC.

How to do it…

  1. First create a new project called adcTimerISR.uvprojx and use the RTE manager to configure it as we did for the folder adcISR_c5v0 for the Setting up the ADC recipe.
  2. Copy timer.c and Custom_ADC.c ...

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