Simulating interrupts in MPLAB X

Status
Not open for further replies.

Cantafford

Member
Hello,

I want to use MPLAB's X stimulus to simulate a timer1 interrupt.
I watched few tutorials but I didn't find something that explains what I want.

What I did was use the advanced pin/register and set a condition that when IFS0 register equals 0x04(which means T1IF bit = 1) but I do not know what to put under "Define triggers"(the circled area in the snapshot) so that to make my program go to the interrupt routine.



Also if you know where can I read about using the stimulus feature of the simulator for MPLAB X let me know. Thanks.
 
You don't need a stimulus file.... Just start the debugger and set a breakpoint on the first line

if(IEC0bits.T1IE && IFS0bits.T1IF).. And it will stop here on overflow.. If you set up a watch variable to view all the SFR's you are using... You will see their condition..
 
If you are using external interrupts you can add a stimulus but internal peripherals wont need them..

You have declared you interrupt incorectly... You should have had messages in blue...

I did this..

#define _ISRFAST __attribute__((interrupt, shadow))

void _ISRFAST _T1Interrupt(void);
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…