Datasheet

RS485Slave_Receive
395
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
void RS485Slave_Receive(char *data_buffer);
Returns Nothing.
Description
Receives messages from Master. If Slave address and Message address field
don't match then the message will be discarded. Messages are multi-byte, so
this routine must be called for each byte received.
Parameters :
- data_buffer: 6 byte buffer for storing received data, in the following
manner:
- data[0..2]: message content
- data[3]: number of message bytes received, 1–3
-
data[4]: is set to 255 when message is received
-
data[5]: is set to 255 if error has occurred
The function automatically adjusts
data[4] and data[5] upon every received
message. These flags need to be cleared by software.
Requires
MCU must be initialized as a Slave for RS-485 communication. See
RS485Slave_Init.
Example
char msg[8];
...
RS485Slave_Read(msg);