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

Handling interrupts

This section illustrates an approach that improves on polling. We replace the busy-wait loop and instead configure the USART peripheral to generate an interrupt signal when a new character is received by the input data register (IDR). The interrupt signal causes a special function, known as an interrupt service routine (ISR), to be called, and this, in turn, reads the IDR and clears the interrupt signal. We illustrate this approach by a simple recipe called helloISR_c3v0.

Getting ready

Two small changes to SER_Init() are needed to configure UART4 so that interrupts are generated when a character is received. The value written to CR1 is changed from 0x200C to 0x202C, thereby setting bit-5 (RXNEIE), and the Nested Vectored Interrupt ...

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