On Fri, Jan 11, 2002 at 04:53:37PM +0100, Delhaye Marijn wrote: > Hello , I got a problem . I work with a PIC16F877 , its the master > of a bus . So , on the serial port of the PIC16F877 there's an > RS485 - bus with a few slaves on it . Now i want to show the actions > that happens on the bus , on the PC-screen when the PC is on. And also > when the PC is on ,i want to control the slaves with the PC . > My bus must stay working when the PC is off . > How i must connect the PC to the system ? > Must i connect the PC to my master ? or on the bus with an adaptor. And > how i must do this ? Well there is no "must" as you put it. There are several different approaches each with their own set of issues. You want to PC to act as a Super Primary when it's online, with a Local Primary taking over when the Super Primary is unavilable. Almost all of your interaction issues are between the Super Primary and the Local Primary: 1 How do they communicate? 2 How does the SP indicate its superiority? 3 How does the LP know when the SP has "left the building"? A multiprimary arrangement where the LP and the SP reside on the same bus the other nodes is way more trouble than it's worth. The most straightforward solution is to create a separate bus between the SP and LP where the SP is the primary of that bus and the LP is the secondary of that bus. So let's take a crack at these: 1 How do they communicate? Use a second serial bus. EIA232 should be fine since it's point to point. Since the 877 USART is already in use it'll take a small bit of work to build an interrupt driven bit banging serial interface. But there are quite a few examples of such interfaces out there. Organize the SP as the primary and the LP as the secondary of the interface. So the LP will listen for requests from the SP and respond to them. 2 How does the SP indicate its superiority? Simple. It'll just start sending commands down in EIA232 connection to the LP. Since the LP is the secondary on that interface, it'll be obligated to respond. Once the LP starts receiving commands, it switches from normal LP mode where it controls the EIA485 bus to a passthrough mode where it transferrs commands from the SP to the bus. 3 How does the LP know when the SP has "left the building"? Two ways. First is that SP can have an explicit "Return to LP mode" command for the LP returning control to it. In addition the SP should send some type of MARK command simply indicating that it's still online and in control of the bus. If the the SP disappears, then the absence of the MARK command will cause the LP to time out and resume local control of the bus. Those are my thoughts. It'll be much more complicated if you add a separate primary directly to the bus. Plus that adapter would have to have all of the passthough set of what I described above, including the bit banged serial interface. Plus it would have to have some what of superceeding the LP on the bus. Messy. Hope this helps, BAJ > > Thanks for helping me ! > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu