| Electronic Components Datasheet Search |
|
70353C Datasheet(PDF) 46 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
70353C Datasheet(HTML) 46 Page - Microchip Technology |
|
46 / 76 page ![]() dsPIC33E/PIC24E Family Reference Manual DS70353C-page 21-46 © 2008-2011 Microchip Technology Inc. Example 21-4: Code Example for Filtering Standard Data Frame #include <p33Exxxx.h> /* This code example demonstrates a method to configure the ECAN module to receive Standard ID CAN messages. SID Messages with SID range 0x1D0-0x1D7 will be accepted. */ /* Include fuse configuration code here. Optionally the fuse configuration can be specified via MPLAB IDE Menu operations. */ FUSE_CONFIGURATION_MACROS_COME_HERE #define NUM_OF_ECAN_BUFFERS 32 /* This is the ECAN message buffer declaration. Note the buffer alignment. */ unsigned int ecan1MsgBuf[NUM_OF_ECAN_BUFFERS][8] __attribute__((aligned(NUM_OF_ECAN_BUFFERS * 16))); int main(void) { unsigned long address; /* Place code to set device speed here. For this example the device speed should be set at 40 MHz (i.e., the device is operating at 40 MIPS). */ ConfigureDeviceClockFor40MIPS(); /* The dsPIC33E device features I/O remap. This I/O remap configuration for the ECAN module can be performed here. */ SetIORemapForECANModule(); /* Set up the ECAN1 module to operate at 250 kbps. The ECAN module should be first placed in configuration mode. */ C1CTRL1bits.REQOP = 4; while(C1CTRL1bits.OPMODE != 4); C1CTRL1bits.WIN = 1; /* Set up the CAN module for 250kbps speed with 10 Tq per bit. */ C1CFG1 = 0x47; // BRP = 8 SJW = 2 Tq C1CFG2 = 0x2D2; C1FCTRL = 0xC01F; // No FIFO, 32 Buffers /* Assign 32x8word Message Buffers for ECAN1 in device RAM. This example uses DMA1 for RX. Refer to 21.8.1 “DMA Operation for Transmitting Data” for details on DMA channel configuration for ECAN transmit. */ DMA1CONbits.SIZE = 0x0; DMA1CONbits.DIR = 0x0; DMA1CONbits.AMODE = 0x2; DMA1CONbits.MODE = 0x0; DMA1REQ = 34; DMA1CNT = 7; DMA1PAD = (volatile unsigned int)&C1RXD; DMA1STAL = (unsigned int) &ecan1msgBuf; DMA1STAH = (unsigned int) &ecan1msgBuf; DMA1CONbits.CHEN = 0x1; |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |