mikroC - C Compiler for Microchip PIC microcontrollers
RS485Slave_Receive
Prototype
void RS485Slave_Receive(char *data);
Description
Receives message addressed to it. Messages are multi-byte, so this function must be
called for each byte received (see the example at the end of the chapter). Upon receiving
a message, buffer is filled with the following values:
data[0..2]
data[3]
data[4]
data[5]
data[6]
Function automatically adjusts
These flags need to be cleared from the program.
Requires
MCU must be initialized as Slave in RS-485 communication in order to be assigned an
address. See
Example
unsigned short msg[8];
...
RS485Slave_Read(msg);
RS485Slave_Send
Prototype
void RS485Slave_Send(char *data, char datalen);
Description
Sends
sage (1 <= datalen <= 3).
Requires
MCU must be initialized as Slave in RS-485 communication in order to be assigned an
address. See
It is programmer's responsibility to ensure (by protocol) that only one device sends data
via 485 bus at a time.
Example
unsigned short msg[8];
...
RS485Slave_Send(msg, 2);
page
246
is the message,
is number of message bytes received, 1–3,
is set to 255 when message is received,
is set to 255 if error has occurred,
is the address of the Slave which sent the message.
data[4]
RS485Slave_Init
from buffer to Master via RS-485;
data
RS485Slave_Init
MikroElektronika: Development tools - Books - Compilers
and
upon every received message.
data[5]
.
is a number of bytes in mes-
datalen
.
mikroC
making it simple...
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?