© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
S. SmithRP2040 Assembly Language Programminghttps://doi.org/10.1007/978-1-4842-7753-9_11

11. How to Set and Catch Interrupts

Stephen Smith1  
(1)
Gibsons, BC, Canada
 

All the various iterations of the flashing LEDs program had one thing in common: they were one large loop using different methods to control the timing of the flashing. If this was part of a larger program that was doing other tasks, such as driving a robot, then putting in hooks everywhere to check if the LEDs need processing is annoying and can easily lead to bugs. Another approach is to set a timer interrupt; here, we program a timer, which, when it goes off, interrupts our program to process ...

Get RP2040 Assembly Language Programming: ARM Cortex-M0+ on the Raspberry Pi Pico now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.