Hi,
To hardware:
* RS485 is a two wire bus, differential signalling, plus ground signal.
* It needs differential pair wiring with a wave impedance of about 120 Ohms.
* All devices are connected in a string ==> No star wiring.
* The master does not need tof be connected at one end, it may be placed anywhere in the bus,
* Both bus ends need to be terminated with 120 Ohms each (independent of master connection)
* The bus should be biased to get a valid high signal when bus is idle = all drivers are off.
* All receiver may be enabled all the time. If disabling, then TTL Rx data output needs a pullup.
* Only one (or none) driver should be enabled in a time
Software:
* when interrupt flags are used, but no ISR, then the flags need to be cleared manually (I don't see here)
* The bus must be released after transmission (Disable driver). This can be done after each byte or after each frame. But take care not to disable the transmitter too early. Not after storing the byte into the UART transmit buffer, but after the STOP bit is transfered to the bus.
* there is no need to disable/enable UART receive/transmit periferal. Both may be ON all the time, but you will receive your own sent out data (echo).
Klaus