Hi,
I'm currently having problems setting up an interrupt in my c code - this is the first time i have used interrupts and am having difficulty understanding where i'm going wrong....
In my initialise function i set up the interrupt bits:
Outside of the main, my ISR consists of:
My code builds successfully but in MPLAB SIM I get the error message:
CORE-E0001: Stack over flow error occurred from instruction at 0x0000d8
Is this because i'm trying to call a function within the interrupt? Have i set up the interrupt bits correctly?
Help on this would be greatly appreciated, as i'm very confused!
Thanks in advance,
elec123
I'm currently having problems setting up an interrupt in my c code - this is the first time i have used interrupts and am having difficulty understanding where i'm going wrong....
In my initialise function i set up the interrupt bits:
Code:
OPTION = 0x00;
INTCON = 0x00;
OPTION = 0x02;
GIE = 1;
PEIE = 1;
TMR0IE = 1;
TMR0 = 0x82;
Outside of the main, my ISR consists of:
Code:
void interrupt_isr()
{
unsigned char dig_output;
// Output error voltage correction
ADCON0 = 0x88;
a2d_conversion();
dig_output = ADRESH;
if (dig_output<97) // output voltage is less than 99V
{
--bodge; // increment duty cycle
}
else if (dig_output>100) // output voltage is greater then 101V
{
++bodge; // decrement duty cycle
}
TMR0 = 0x82;
TMR0IF = 0;
}
My code builds successfully but in MPLAB SIM I get the error message:
CORE-E0001: Stack over flow error occurred from instruction at 0x0000d8
Is this because i'm trying to call a function within the interrupt? Have i set up the interrupt bits correctly?
Help on this would be greatly appreciated, as i'm very confused!
Thanks in advance,
elec123