• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
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..
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
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.

Latest threads

EE World Online Articles

Loading
Top