[simpits-tech] What's on the Workbench?
simpits-tech@simpits.org
simpits-tech@simpits.org
Thu, 02 May 2002 12:53:28 +1200 (NZST)
Quoting Ross Hutton <rosshut10@yahoo.com.au>:
> Hey, I'm following a similar route using AVR's (not
> token ring at the moment though). What sort of
> hardware interface are you using for the network?
I am using the PIC's built-in RS232 UART.. The chip is a 16F876-20SP. It is
currently running at 9600, but I will bump that up that to 28k8 later in the
production.
> The Tx of the first AVR would go to the Rx of the next
> in the chain until finally the Tx of the last AVR goes
> to the Rx on the PC. The Tx of the PC would go to the
> Rx of the first AVR. It's a nice way to go for small
> systems.
That is exactly what I have done. :)
The PC sends out a packet addressed to chip '3'. The first chip looks at the
packet header, and if the destination is '1' then the chip processes that
packet. If the destination is not 1, then it decrements the destination number
and passes the packet on to the next chip... Any packet with a destination of
0 continues around the loop until it reaches the PC.
I have built in a polling system, so at startup the PC can do something like
this:
PC->PIC 1: Tell me what you are
PIC 1->PC: I am a device type 3/5 ( 5 momentary switches)
PC->PIC 2: Tell me what you are
PIC 2->PC: I am a device type 1/4 ( 4 seven segs)
PC->PIC 3: Tell me what you are...
This packet goes around the network and arrives back at the PC, so the PC
knows that there are 2 devices.
I have build in packet start and packet end bytes to protect against devices
receiving part of a packet and to provide a little proctection again packet
corruption. The PIC's just trash any bytes not contained within a packet start
and packet end, and they pass on any bytes not destined for them.
Cheers,
Stuart Whelan
Technical Consultant
System Performance & Availability Services
Datacom Systems LTD
DDI: +64 3 3437144
MOB: +64 25 275 0309