| ||||||||
Technical Support Support Resources Product Information | µVISION DEBUGGER: GENERATING INTERRUPTS IN SIMULATION SCRIPTInformation in this article applies to:
QUESTIONI 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? ANSWERYes. 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 ALSOLast Reviewed: Monday, June 28, 2004 | |||||||
| ||||||||