mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

CANSetOperationMode

Prototype

void CANSetOperationMode(char mode, char wait_flag);

 

 

Description

Sets CAN to requested mode, i.e. copies mode to CANSTAT. Parameter mode needs to

 

be one of CAN_OP_MODE constants (see CAN constants).

 

Parameter wait_flag needs to be either 0 or 0xFF:

 

If set to 0xFF, this is a blocking call – the function won’t “return” until the requested

 

mode is set. If 0, this is a non-blocking call. It does not verify if CAN module is

 

switched to requested mode or not. Caller must use function CANGetOperationMode

 

to verify correct operation mode before performing mode specific operation.

 

 

Requires

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.

 

 

Example

CANSetOperationMode(CAN_MODE_CONFIG, 0xFF);

 

 

CANGetOperationMode

Prototype

char CANGetOperationMode(void);

 

 

Returns

Current opmode.

 

 

Description

Function returns current operational mode of CAN module.

 

 

Requires

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.

 

 

Example

if (CANGetOperationMode() == CAN_MODE_NORMAL) { ... };

 

 

page

 

142

MikroElektronika: Development tools - Books - Compilers