EasyManua.ls Logo

Microchip Technology dsPIC33 series - Page 80

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...
dsPIC33/PIC24 Family Reference Manual
DS70005340A-page 80 2018 Microchip Technology Inc.
Example 7-1: Using the Transmit Event FIFO Code (Continued)
txObj = (CANFD_TX_MSGOBJ *)C1FIFOUA1L;
txObj->bF.id.SID = 0x300;
txObj->bF.id.EID = 0x0000;
txObj->bF.ctrl.BRS = 1 ; //Switch bit rate
txObj->bF.ctrl.DLC = 0xF; //64 bytes
txObj->bF.ctrl.FDF = 1; // CANFD frame
txObj->bF.ctrl.IDE = 0; //Standard frame
txObj->bF.ctrl.SEQ = fifoSize ; //
Sequence does not get transmitted, but stored in TEF
for(index=0;index<0x40;index++ )
{
txObj->byte[index+8] = 0xA5 ; // 64 bytes of 0xA5
}
C1FIFOCON1Lbits.UINC = 1; // Set UINC bit
}
C1FIFOCON1Lbits.TXREQ = 1; // Set TXREQ bit
while (C1FIFOCON1Lbits.TXREQ == 1);
/* Keep reading the TEF objects until the last transmitted message*/
for (fifoSize= 0; fifoSize < 5; fifoSize++)
{
while(C1TEFSTAbits.TEFNEIF ==0);
CANFD_TEF_MSGOBJ *tefObj;
tefObj = (CANFD_TEF_MSGOBJ *)C1TEFUAL;
//ProcessTEFMessages (currentMessageBuffer) ;
C1TEFCONLbits.UINC = 1 ; // Set UINC bit
}
while(1);
}

Related product manuals