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

9.10.8 CANWrite

9.10.8 CANWrite

The CANWrite function is used to send a message to the CAN bus. A zero is returned if message can not be queued (buffer full). The function prototype is:

char CANWrite(long id, char *data, char datalen,
 char CAN_TX_MSG_FLAGS)

id is the CAN message identifier. Only 11 or 29 bits may be used depending on message type (standard or extended). data is an array of bytes up to 8 where the data to be sent is stored. datalen is the length of the data (1 to 8).

CAN_TX_MSG_FLAGS can be one of the following:

• CAN_TX_PRIORITY_0  Transmit priority 0

• CAN_TX_PRIORITY_1  Transmit priority 1

• CAN_TX_PRIORITY_2  Transmit priority 2

• CAN_TX_PRIORITY_3  Transmit priority 3

• CAN_TX_STD_FRAME  Standard identifier message

• CAN_TX_XTD_FRAME  Extended identifier message

• CAN_TX_NO_RTR_FRAME  Non RTR message

• CAN_TX_RTR_FRAME  RTR message

These flags can be bitwise AND’ed if desired.

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


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