Mikroelektronika MIKROE-724 データシート

ページ / 726
300
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
ECAN Library
mikroBasic PRO for dsPIC30/33 and PIC24 provides a library (driver) for working with the dsPIC33FJ and pic24HJ 
ECAN module.
ECAN is a very robust protocol that has error detection and signalling, self–checking and fault confinement. Faulty 
ECAN data and remote frames are re-transmitted automatically, similar to the Ethernet.
Data transfer rates depend on distance. For example, 1 Mbit/s can be achieved at network lengths below 40m while 
250 Kbit/s can be achieved at network lengths below 250m. The greater distance the lower maximum bitrate that can 
be achieved . The lowest bitrate defined by the standard is 200Kbit/s. Cables used are shielded twisted pairs. 
ECAN supports two message formats:
- Standard format, with 11 identifier bits, and 
- Extended format, with 29 identifier bits 
ECAN message format and DMA RAM buffer definiton can be found in the 
ECan_Defs.mbas
 header file located in the 
ECAN project folder. Read this file carefully and make appropriate adjustments for mcu in use. Also, if a new project 
is to be created this file has to be copied, adjusted and included into the project via include pragma directive with 
corresponding Search Path updating.
Important:
 
- ECAN buffers are located in DMA RAM, so two DMA channels are used for message transfer, one for each direction  
  (ECAN->DMA RAM, DMA RAM->ECAN). See the ECANxDmaChannelInit routine. 
- Consult CAN standard about CAN bus termination resistance. 
- CAN library routines require you to specify the module you want to use. To select the desired CAN module, simply  
  change the letter 
x in the routine prototype for a number from 1 to 2
- Number of CAN modules per MCU differs from chip to chip. Please, read the appropriate datasheet before utilizing  
  this library. 
Library Routines
 
- ECANxDmaChannelInit 
 
- ECANxSetOperationMode 
 
- ECANxGetOperationMode 
 
- ECANxInitialize 
 
- ECANxSelectTxBuffers 
 
- ECANxFilterDisable 
 
- ECANxFilterEnable 
 
- ECANxSetBufferSize 
 
- ECANxSetBaudRate 
 
- ECANxSetMask 
 
- ECANxSetFilter 
 
- ECANxRead 
 
- ECANxWrite