Mikroc, Canspisetbaudrate – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 164

Advertising
background image

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

156

MikroElektronika: Development tools - Books - Compilers

page

Prototype

void

CANSPISetBaudRate(char SJW, char BRP, char PHSEG1, char

PHSEG2, char PROPSEG, char CAN_CONFIG_FLAGS);

Description

Sets CANSPI baud rate. Due to complexity of CANSPI protocol, you cannot simply
force a bps value. Instead, use this function when CANSPI 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

CANSPI 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;

...

CANSPISetBaudRate(1, 1, 3, 3, 1, init);

CANSPISetBaudRate

Advertising
This manual is related to the following products: