ARM Technical Support Knowledge Articles

HANDLING UNUSED INTERRUPTS

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

Is there a good way to handle unused 8051 interrupts in C?

ANSWER

Yes. In fact, there are a number of good ways to do this. The following is just one of them:

First, create a simple, generic "unused interrupt service routine handler." This routine might appear as follows:

void unused_ISR_handler (
  unsigned char interrupt_number)
{
/* log the interrupt_number */
}

The purpose of such a routine is to either log the spurious interrupt and continue execution or output the interrupt number and halt program execution.

Next, create a simple interrupt service routine for each unused interrupt:

void ex0_ISR (void) interrupt 0
{
unused_ISR_handler (0);
}

void sio_ISR (void) interrupt 4
{
unused_ISR_handler (4);
}

And, call the handler inside each ISR.

Article last edited on: 2005-01-30 16:45:56

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential