ARM Technical Support Knowledge Articles

GENERATING INTERRUPTS IN SIMULATION SCRIPT

Applies to: uVision Debugger

Answer


Information in this article applies to:


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

Article last edited on: 2004-06-28 21:31:21

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