Keil Logo

C51: GETTING INTERRUPTS WORKING


Information in this article applies to:

  • C51 Version 5.50

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.

Last Reviewed: Tuesday, June 8, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.