>To all PICLIST users: > I need made and RS-485 multi-drop LAN, using severals modules based >on PIC's. >Could you please inform me about any books, papers, or any bibliografy on >RS-485 and books, papers, over communications protocol, asynchronous or >synchronous. >Many thanks in advance. The actual 485 drivers part is not too tricky; I just follow the Data Books in terms of the terminator resitors, etc. I've always used standard ASYNC as if it were RS232. Some spproaches that I've successfully employed: Master/Slave, ARQ, ASYNC, ASCII approach: Have a master node. Each slave node has an ID. Master sends a message which includes standard fields, such as: ; e.g. any ASCII character, say the STX character ID ; ID byte COUNT ; How many bytes in the message CODE ; A code for what packet is (optional, nice for ACK/NAK) [Data] ; Your payload, any reasonable length CRC ; CRC-16 works fine ; Terminating "framing character Listening nodes implement very simple state machines that key off of the STX/ETX characters. If you stick with ASCII and rule that STX/ETX may not appear in your payload - that's the simplest. Otherwise, you must double-up any STX or ETX when it appears in the binary payload, which also complicates your state machine, slightly. Listeners do their state machines, buffer message, react when it is received (check count, check CRC, etc. Do what message says (only if for them) and then ACK or NAK. Listen nodes MUST ACK or NAK any received message, if it is for them. Master employ an automatic retry policy (ARQ). ACK/NAK is just a message of same format with a particular CODE. This stuff can be done well in an ISR, or in conjection with an ISR serial driver - you pick. If you absolutely must allow multiple masters (not concurrently), then you have to create a message sequence for this "hand off". Anyway, I don't want to blather on. This scheme has always worked flawlessly for me, and I use it for microcontrollers, up to PCs and workstations. There are more official standards, I'm sure, but this is really so simple that I'm not sure it's worth trying to find one. Just my opinion. I can elaborate or offer C code if required. blah blah blah. Thomas.Coonan@Sciatl.com