ABL electronic PIC12 Personal Computer User Manual


 
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
14 4
MikroElektronika:
Development
tools
-
Books
-
Compilers
page
Prototype
void CANSetBaudRate(char SJW, char BRP, char PHSEG1, char PHSEG2,
char PROPSEG, char CAN_CONFIG_FLAGS);
Description Sets CAN baud rate. Due to complexity of CAN protocol, you cannot simply force a bps
value. Instead, use this function when CAN is in Config mode. Refer to datasheet for
details.
Parameters:
SJW as defined in 18XXX8 datasheet (1–4)
BRP as defined in 18XXX8 datasheet (1–64)
PHSEG1 as defined in 18XXX8 datasheet (1–8)
PHSEG2 as defined in 18XXX8 datasheet (1–8)
PROPSEG as defined in 18XXX8 datasheet (1–8)
CAN_CONFIG_FLAGS is formed from predefined constants (see CAN constants)
Requires CAN must be in Config mode; otherwise the function will be ignored.
Example
init = CAN_CONFIG_SAMPLE_THRICE &
CAN_CONFIG_PHSEG2_PRG_ON &
CAN_CONFIG_STD_MSG &
CAN_CONFIG_DBL_BUFFER_ON &
CAN_CONFIG_VALID_XTD_MSG &
CAN_CONFIG_LINE_FILTER_OFF;
...
CANSetBaudRate(1, 1, 3, 3, 1, init);
CANSetBaudRate