Книга: Advanced PIC Microcontroller Projects in C

9.10.3 CANInitialize 

9.10.3 CANInitialize 

The CANInitialize function initializes the CAN module. All mask registers are cleared to 0 to allow all messages. Upon execution of this function, the normal mode is set. The function prototype is:

void CANInitialize(char SJW, char BRP, char PHSEG1, char PHSEG2,
 char PROPSEG, char CAN_CONFIG_FLAGS)

where

 SJW  is the synchronization jump width

 BRP  is the baud rate prescaler

 PHSEG1  is the Phase_Seg1 timing parameter

 PHSEG2  is the Phase_Seg2 timing parameter

 PROPSEG  is the Prop_Seg

CAN_CONFIG_FLAGS can be one of the following configuration flags:

• CAN_CONFIG_DEFAULT  Default flags

• CAN_CONFIG_PHSEG2_PRG_ON  Use supplied PHSEG2 value

• CAN_CONFIG_PHSEG2_PRG_OFF  Use maximum of PHSEG1 or information processing time (IPT), whichever is greater

• CAN_CONFIG_LINE_FILTER_ON  Use CAN bus line filter for wake-up

• CAN_CONFIG_FILTER_OFF  Do not use CAN bus line filter

• CAN_CONFIG_SAMPLE_ONCE  Sample bus once at sample point

• CAN_CONFIG_SAMPLE_THRICE  Sample bus three times prior to sample point

• CAN_CONFIG_STD_MSG  Accept only standard identifier messages

• CAN_CONFIG_XTD_MSG  Accept only extended identifier messages

• CAN_CONFIG_DBL_BUFFER_ON  Use double buffering to receive data

• CAN_CONFIG_DBL_BUFFER_OFF  Do not use double buffering

• CAN_CONFIG_ALL_MSG  Accept all messages including invalid ones

• CAN_CONFIG_VALID_XTD_MSG  Accept only valid extended identifier messages

• CAN_CONFIG_VALID_STD_MSG  Accept only valid standard identifier messages

• CAN_CONFIG_ALL_VALID_MSG  Accept all valid messages

These configuration values can be bitwise AND’ed to form complex configuration values.

Оглавление книги


Генерация: 1.596. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз