Keil Logo

µVISION DEBUGGER: GENERATING INTERRUPTS IN SIMULATION SCRIPT


Information in this article applies to:

  • µVision Version 2.20

QUESTION

I want to simulate an interrupt input in my application. I have hardware that uses the output signal on Port 1.5 and loops this output back to the interrupt input INT0 on Port 3.2. I have written the following signal function to accomplish this:

SIGNAL void LoopBackInterrupt (void)  {
   while( 1)  {
      if (P1 & 0x20)  PORT3 &= ~4 ;
      else                PORT3 |= 4 ;
      twatch(1) ;
  }
}

This method works fine, but slows down simulation speed when I start the signal function with LoopBackInterrupt () in the Command Window. Is there a better way to do this?

ANSWER

Yes. A better way to generate the interrupt is to use an access breakpoint that triggers only when the value at P1 changes. For example, the following command sets a breakpoint that executes only when P1 changes.

bs write P1, 1, "PORT3 = (PORT3 & ~0x4) | ((P1 & 32) ? 4 : 0)"

When triggered, this breakpoint changes the state on the interrupt input P3.2. Of course, this is triggered only when your application writes to P1.

SEE ALSO

Last Reviewed: Monday, June 28, 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.