Datasheet

Programming PIC Microcontrollers in BASIC - mikroElektronika
module. More details about CAN can be found in appropriate literature and on mikroElektronika Web site.
Note: CANSPI routines are supported by any PIC MCU model that has SPI interface on PORTC. Also, CS pin of MCP2510 or
MCP2515 must be connected to RC0 pin.
5.2.4.1 CANSPISetOperationMode – Sets CAN to requested mode
Prototype
sub procedure CANSPISetOperationMode(dim mode as byte, dim Wait as byte)
Description The procedure copies <mode> to CANSTAT and sets CAN to requested mode.
Operation <mode> code can take any of predefined constant values.
<Wait> takes values TRUE(255) or FALSE(0)
If Wait is true, this is a blocking call. It won't return until requested mode is set. If Wait is false, this is a non-
blocking call. It does not verify if CAN module is switched to requested mode or not. Caller must use
CANGetOperationMode() to verify correct operation mode before performing mode specific operation.
Example
CANSPISetOperationMode(CAN_MODE_LISTEN, TRUE) ' Sets CAN to Listen mode
5.2.4.2 CANSPIGetOperationMode – Returns the current operation mode of CAN
Prototype
sub function CANSPIGetOperationMode as byte
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/05.htm (29 sur 112)05/11/2004 02:20:52