mikroC
making it simple...
CANSPI Library
mikroC - C Compiler for Microchip PIC microcontrollers
SPI module is available with a number of PICmicros. mikroC provides a library (driver) for working with the external CAN modules (such as MCP2515 or MCP2510) via SPI.
In mikroC, each routine of CAN library has its CANSPI counterpart with identical syntax. For more information on the Controller Area Network, consult the CAN Library. Note that the effective communication speed depends on the SPI, and is certainly slower than the “real” CAN.
Note: CANSPI functions are supported by any PIC MCU that has SPI interface on PORTC. Also, CS pin of MCP2510 or MCP2515 must be connected to RC0. Example of HW connection is given at the end of the chapter.
Note: Be sure to check CAN constants necessary for using some of the functions. See page 145.
Library Routines
CANSPISetOperationMode
CANSPIGetOperationMode
CANSPIInitialize
CANSPISetBaudRate
CANSPISetMask
CANSPISetFilter
CANSPIRead
CANSPIWrite
Following routines are for the internal use by compiler only:
RegsToCANSPIID
CANSPIIDToRegs
|
| page |
|
MikroElektronika: Development tools - Books - Compilers | 153 | ||
|
|