Download 6 - Diversant Software
Transcript
158 CAN Support can_receive Receives all objects that are not bound (see “can_bind_obj,can_bind_last_obj”) via the RTX 51/251 mailbox 7. The waiting objects are handled in a FIFO (First-In, FirstOut) manner; i.e. the first received object (top of the queue) will be removed first. When the FIFO buffer is full (eight objects received) and the application does not read from the buffer with “can_receive”, then all further objects are lost. Prototype: unsigned char can_receive (unsigned char timeout, void xdata *buffer_ptr); Parameter: timeout is the time-out when no object is received. Same definition as in RTX-51/RTX-251: 0: No time-out, do not wait for receiving if an object is not already in the FIFO buffer. 1..254: Number of RTX-51/251 system ticks until time-out when no object received. 255: Wait until an object is received (infinite waiting). 6 buffer_ptr is the pointer to a structure of the type CAN_MESSAGE_STRUCT in the XDATA memory. The received object will be copied to this structure. The structure CAN_MESSAGE_STRUCT (defined in RTXCAN.H) is organised as depicted below: ident 2 bytes c_data 8 bytes