Datasheet

Programming PIC Microcontrollers in BASIC - mikroElektronika
Description Only messages that appropriately address Slaves will be received. As messages are multi-byte, this procedure
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] is actual data
data[3] is number of bytes received, 1..3
data[4] is set to 255 when message is received
data[5] is set to 255 if error has occurred
rest of the buffer is undefined
Procedure automatically sets data[4] and data[5] upon every received message. These flags need to be cleared
repeatedly from the program.
MCU must be initialized as Master in 485 communication to assign an address to MCU.
Example
RS485Slave_Read(dat)
5.2.14.6 RS485Slave_Write – Sends message to Master
Prototype
sub procedure RS485Slave_Write(dim byref data as byte[2], dim datalen as
byte)
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/05.htm (91 sur 112)05/11/2004 02:20:55