mikroC

making it simple...

CAN Library

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC provides a library (driver) for working with the CAN module.

CAN is a very robust protocol that has error detection and signalling, self–check- ing and fault confinement. Faulty CAN data and remote frames are re-transmitted automatically, similar to the Ethernet.

Data transfer rates vary from up to 1 Mbit/s at network lengths below 40m to 250 Kbit/s at 250m cables, and can go even lower at greater network distances, down to 200Kbit/s, which is the minimum bitrate defined by the standard. Cables used are shielded twisted pairs, and maximum cable length is 1000m.

CAN supports two message formats:

Standard format, with 11 identifier bits, and

Extended format, with 29 identifier bits

Note: CAN routines are currently supported only by P18XXX8 PICmicros. Microcontroller must be connected to CAN transceiver (MCP2551 or similar) which is connected to CAN bus.

Note: Be sure to check CAN constants necessary for using some of the functions. See page 145.

Library Routines

CANSetOperationMode

CANGetOperationMode

CANInitialize

CANSetBaudRate

CANSetMask

CANSetFilter

CANRead

CANWrite

Following routines are for the internal use by compiler only:

RegsToCANID

CANIDToRegs

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

141