Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ARM?? Cortex?? M4 Cookbook

You're reading from  ARM?? Cortex?? M4 Cookbook

Product type Book
Published in Mar 2016
Publisher Packt
ISBN-13 9781782176503
Pages 296 pages
Edition 1st Edition
Languages
Author (1):
Dr. Mark Fisher Dr. Mark Fisher
Profile icon Dr. Mark Fisher
Toc

Table of Contents (16) Chapters close

ARM Cortex M4 Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
A Practical Introduction to ARM CORTEX C Language Programming Programming I/O Assembly Language Programming Data Conversion Multimedia Support Real-Time Signal Processing Real-Time Embedded Systems Embedded Toolchain Index

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 from the previous recipes and add these to the project. Copy adcISR.c and rename it adcTimerISR.c. Add this to the project.

  3. Add #include timer.h to adcTimerISR.c and call TIM2_Initialize() in main(). Check whether the project successfully builds...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime