5.5.8 How Can I Make My Interrupt Routine Faster?
Try the following suggestions for faster ISR execution:
- Smaller code is often faster code. For details, see the following section of this user’s guide:
- Suggestions to make code faster also work for ISR code. For details, refer to the following section of this user’s guide:
- Consider having the ISR simply set a flag and return. The flag can
then be checked in main-line code to handle the interrupt. This has the advantage of
moving the complicated interrupt-processing code out of the ISR so that it no longer
contributes to its register usage. Always use the
volatile
qualifier for variables shared by the interrupt and main-line code; see the following sections of this user’s guide: