ABL electronic PIC12 Personal Computer User Manual


 
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
14 6
MikroElektronika:
Development
tools
-
Books
-
Compilers
page
Prototype
char CANRead(long *id, char *data, char *datalen, char
*CAN_RX_MSG_FLAGS);
Returns Message from receive buffer or zero if no message found.
Description Function reads message from receive buffer. If at least one full receive buffer is found, it
is extracted and returned. If none found, function returns zero.
Parameters:
id is message identifier; data is an array of bytes up to 8 bytes in length;
datalen is data length, from 1–8; CAN_RX_MSG_FLAGS is value formed from constants
(see CAN constants).
Requires CAN must be in mode in which receiving is possible.
Example
char rcv, rx, len, data[8]; long id;
rcv = CANRead(id, data, len, 0);
CANRead
Prototype
char CANWrite(long id, char *data, char datalen, char
CAN_TX_MSG_FLAGS);
Returns Returns zero if message cannot be queued (buffer full).
Description If at least one empty transmit buffer is found, function sends message on queue for
transmission. If buffer is full, function returns 0.
Parameters:
id is CAN message identifier. Only 11 or 29 bits may be used depending
on message type (standard or extended); data is array of bytes up to 8 bytes in length;
datalen is data length from 1–8; CAN_TX_MSG_FLAGS is value formed from constants
(see CAN constants).
Requires CAN must be in Normal mode.
Example
char tx, data; long id;
tx = CAN_TX_PRIORITY_0 & CAN_TX_XTD_FRAME;
CANWrite(id, data, 2, tx);
CANWrite