Re: CAN Component - Buffer
Posted: Wed Jul 13, 2022 3:13 pm
Hi,
I've played with lots of different combinations. The command from the RXcheck routine that make the difference is..
What is really odd to me. If I place this or similar at the end of the Interrupt handler it makes no difference.
If I place it as stand alone C code at the end of the actual Interrupt routine it works fine.
I also added something in the handler to disable the Interrupt before running the interrupt macro.
It may also by my crap syntax but I could not get 'Buffer0 Interrupt Flag TRUE' AND 'Buffer0 Full TRUE' to be checked by the IF statement.
This however does run.
Put as last line in Interrupt macro
J.
I've played with lots of different combinations. The command from the RXcheck routine that make the difference is..
Code: Select all
RXB0CONbits.RXFUL = 0; // Clear Buffer0 Full Flag
If I place it as stand alone C code at the end of the actual Interrupt routine it works fine.
I also added something in the handler to disable the Interrupt before running the interrupt macro.
It may also by my crap syntax but I could not get 'Buffer0 Interrupt Flag TRUE' AND 'Buffer0 Full TRUE' to be checked by the IF statement.
This however does run.
Code: Select all
if ((PIR3>>0) & 1) //Check for Buffer0 Interrupt Flag
{
PIE3bits.RXB0IE = 0; //Disable CAN Buffer 0 Interrupts
FCM_%n(); // call selected macro
}
Code: Select all
PIR3bits.RXB0IF = 0; //PIR3 & ~(1); // Clear Buffer0 Interrupt Flag
RXB0CONbits.RXFUL = 0; // Clear Buffer0 Full Flag
PIE3bits.RXB0IE = 1; //Enalbe CAN Buffer 0 Interrupts