page 41
Function
CAN_RECEIVE
Library CRxxxx.LIB
Function symbol
Purpose
Configures a data reception object and reads the reception
buffer of the data object.
Parameters
Function inputs
Function outputs
Description
CAN_RECEIVE must be called once for each data object during
the initialization phase to inform the CAN controller of the
identifiers of the data objects.
In the further program cycles CAN_RECEIVE is called to read
the corresponding reception buffer, for long program cycles this
is done several times. The programmer must make sure by
evaluating the byte AVAILABLE that newly received data objects
are retrieved from the buffer and are further processed. Each
call of the function decrements the byte AVAILABLE by 1. If the
value of AVAILABLE equals 0, the buffer contains no data.
By evaluating the bit OVERFLOW an overflowing data buffer
can be detected. If the bit OVERFLOW is set, at least 1 data
object is
lost
.
Name Data type Description
CONFIG BOOL For the configuration of the data object the
bit must be set TRUE once. For data
transmission to commence the CONFIG bit
must be set to FALSE.
CLEAR BOOL Deletes the data buffer (queue).
ID WORD Contains the number of the data object
identifier 0 ... 2048.
Name Data type Description
DATA ARRAY The array contains max. 8 data bytes.
DLC BYTE The number of the transmitted bytes in
the array DATA, possible values 0 ... 8.
RTR BYTE Is not used
AVAILABLE BYTE Number of the messages received
OVERFLOW BOOL TRUE: Overflow of the data buffer.
Data loss!
FALSE: The buffer is not yet full.