ARM Technical Support Knowledge Articles

GETTING INTERRUPTS WORKING

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOMS

I have written an interrupt function, but it never seems to be called. Have you got any general tips for things I can try?

RESOLUTION

First check the map file (.m51) to make sure that a jump has been inserted at the correct address (e.g. 000BH for interrupt 2) by the linker. The jump is indicated by an absolute segment three bytes in length and does not have a segment name.

Double-check your code to make sure you have interrupts enabled (EA = 1) and the particular interrupt you are using is enabled. Check with your device databook for the conditions required to trigger the interrupt.

Check the Application note on our web site which contains pre-written routines that use the timer interrupts. These definately work. Simulate the code in dScope to get a feel for how interrupts work. If you are trying to use the timers, then use the pre-written code in the application note or compare it with your own and understand any differences.

Finally, simulate your program in dScope. Run it until the point where you are waiting for an interrupt, then open the Interrupts Peripheral window and set the flag which triggers an interrupt (e.g. TF1 for timer 1). Then step through your program and it should jump to your interrupt routine. If it doesn't, then you have initialised your peripheral incorrectly.

Article last edited on: 2004-06-08 13:31:03

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