Working RS485 sketches wanted

I think you are struggling with two different concepts. First is the RS485 standard which just defines the physical electrical properties of the communications hardware that makes up a RS485 link. With the proper external chips, wire, termination resistors, and possibly a little tweaking of the serial driver you use to switch from transmit mode to receive mode that is pretty much a done deal, many have and are doing it and much should be avalible to help you implement this physical communications link.

The second concept is what software communications protocol will you use for stuff you hook up to your RS485 link? There is no single standard software protocol that works, but rather several, and of course your free to design your own protocol that the master and slave devices will utilize in their software design. Modbus is one popular protocol often using RS485 type links.

So there are no simple answers for you questions. If you are trying to communicate to existing slave devices then you need to find out what software protocol they are expecting to be used with. If not you are free to design your own or just find a decent Modbus library and utilize that protocol.

Lefty