EasyManua.ls Logo

Microchip Technology dsPIC33 series - Page 91

Microchip Technology dsPIC33 series
116 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2018 Microchip Technology Inc. DS70005340A-page 91
CAN FD Protocol Module
Example 9-1: Message Reception Code (Continued)
/* Configure filter 0 and MASK 0 to accept extended id messages with id = 2 and 3 */
C1FLTCON0Lbits.F0BP = 1; // message stored in FIFO1
C1FLTOBJ0L = 0x1000; // EID = 0x00002
C1FLTOBJ0H = 0x4000; // Match messages with extended identifier address
C1MASK0L = 0xF7FF; // MEID = 0x1FFFE - Last it is 0
C1MASK0H = 0xFFFF; // Match message types
C1FLTCON0Lbits.FLTEN0 = 1; // Enable the filter 0
/* Place the CAN module in Normal mode. */
C1CONHbits.REQOP = 0;
while(C1CONHbits.OPMOD != 0);
/* Get the address of the message buffer to read the received messages.*/
/* set UINC bit to update the FIFO tail */
CANFD_RX_MSGOBJ *rxObj;
rxObj = (CANFD_RX_MSGOBJ *)C1FIFOUA1L;
while(C1FIFOSTA1bits.TFNRFNIF ==0);
//Process the received messages
C1FIFOCON1Lbits.UINC = 1; // Update the FIFO message pointer.
while(1);
}

Related product manuals