A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
Hello,
I am able to receive CAN messages using polling mode.
I would like to receive CAN message using interrupts. It is not
working with my implementation
The following is the part of code: Could you suggest some ideas?
CIOCON = 0x20;
RCON = 0x80;
IPR3 = 0x01; /* Interrupt Priority */
PIE3 = 0x01; /* Interrupt Enable */
INTCON = 0xC0;
#pragma code high_vector=0x08
void high_interrupt (void)
{
_asm GOTO high_interrupt_isr _endasm
}
#pragma code
#pragma interrupt high_interrupt_isr
void high_interrupt_isr(void)
{
if(PIR3bits.RXB0IF==1)
{
CAN_Receive();
PIR3bits.RXB0IF=0;
PIE3 = 0x01; /* Interrupt Enable */
INTCON = 0xC0;
}
}
#pragma interrupt CAN_Receive
void CAN_Receive(void)
{
unsigned int id,idx=0;
unsigned int idx2=0;
unsigned char * rxBuf;
if(RXB0CONbits.RXFUL)
{
rxBuf =(unsigned char *)&RXB0D0;
id=(unsigned int)RXB0SIDH;
id=(id<<3) | (unsigned int)((RXB0SIDL>>5)& 0x07);
RXB0CONbits.RXFUL = 0;
}
RxMsgTab[idx].CANID=id;
for (idx2=0; idx2
{
RxMsgTab[idx].CAN_MsgPtr[idx2]=rxBuf[idx2];
}
}
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )