RS485 is a very reliable method; I used a casino bus at 57,600bps over a long distance (150 m +). Use the addressable feature of the PIC UART, so that everybody on the bus only has to listen to the address rather than the message body as well. --Bob A V G wrote: > Hi all, > > I'm currently working on a project for the university which involves > interfacing several PIC microcontrollers (dsPIC33FJ128GP802) to a PC > via MODBUS RTU over RS485. Since the microcontrollers will be > controlling temperature and humidity, they will be subject to > temperature and humidity fluctuations. I would imagine that a quartz > crystal would be advantageous in this case due to it's stability. > > I am thinking of running the RS485 line at 9600 bits/s. I am > interested in maintaining a *stable* bus, it doesn't need to be > particularity fast. Reliability is the highest priority. > > I used a simple program that calculates PIC UART configuration > register values based on the clock frequency and desired bit rate. I > selected various common frequencies such as 16 MHz, 20 MHz, and so on, > but all of them resulted in the program calculating a non-zero error > percentage value (0.16% at 20 MHz and 9600 bits/s). A screenshot of > the program can be viewed here: > http://img249.imageshack.us/img249/8761/screenshotno.png > > Is this non-zero error value acceptable? Will it cause reliability > issues? Does it need to be avoided, and if so, how? > > The second question is, does anyone know of a good MODBUS stack for > the PIC? I will most likely be using the C30 compiler for the > dsPIC33FJ128GP802. I would also like to use UART RX interrupts to > handle the protocol, but DMA is a possibility too. > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist