Skip to Content
Hands-On RTOS with Microcontrollers
book

Hands-On RTOS with Microcontrollers

by Brian Amos
May 2020
Intermediate to advanced
496 pages
13h 54m
English
Packt Publishing
Content preview from Hands-On RTOS with Microcontrollers

Optimizing to reduce CPU time

Often, an RTOS is used because many different activities need to happen almost simultaneously. When a task needs to take action because an event occurs, there are a few ways of monitoring for the event.

Polling is when a value is continuously read in order to capture a transition. An example of this would be waiting for a new ADC reading. A polled read might look something like this:

uint_fast8_t freshAdcReading = 0;while(!freshAdcReading){    freshAdcReading = checkAdc();}

While this code will detect when a new ADC reading has occurred, it will also cause the task to continually be in the Running state. If this happens to be the highest priority task in the system, this will starve the other tasks of CPU time. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers - Second Edition

Hands-On RTOS with Microcontrollers - Second Edition

Jim Yuill, Penn Linder

Publisher Resources

ISBN: 9781838826734Supplemental Content