Datasheet

Programming PIC Microcontrollers in BASIC - mikroElektronika
Master and Slave devices interchange packets of information, each of these packets containing synchronization bytes, CRC byte,
address byte, and the data. In Master/Slave architecture, Slave can never initiate communication. Each Slave has its unique address
and receives only the packets containing that particular address. It is programmer's responsibility to ensure that only one device
transmits data via 485 bus at a time.
RS485 routines require USART module on port C. Pins of USART need to be attached to RS485 interface transceiver, such as
LTC485 or similar. Pins of transceiver (Receiver Output Enable and Driver Outputs Enable) should be connected to port C, pin 2
(see the figure at end of the chapter).
Note: Address 50 is a common address for all Slave devices: packets containing address 50 will be received by all Slaves. The only
exceptions are Slaves with addresses 150 and 169, which require their particular address to be specified in the packet.
5.2.14.1 RS485Master_Init – Initializes MCU as Master in RS485 communication
Prototype sub procedure RS485master_init
Description Initializes MCU as Master in RS485 communication. USART needs to be initialized.
Example
RS485Master_Init
5.2.14.2 RS485Master_Read – Receives message from Slave
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/05.htm (88 sur 112)05/11/2004 02:20:53