Jim Wagner wrote:
> Both SPI and TWI (I2C) are multi-drop. SPI requires a
> separate enable (chip select) for each device so that could
> mean a lot of "wires". Neither is designed for more than a
> few meters.
Though Philips has some interesting new I2C bus extenders.
> For regular serial, RS422 is the one-talker, many listener
> protocol and RS485 is the many-talk, many listen version
> though they pretty much use the same hardware.
> CAN is like RS485 with a protocol built on top, as I
> recall.
No, it's much more than that. For one thing, there are no masters.
And it's electrically more robust (it's differential, and typically will
work at a reduced speed even if one of the 2 wires is shorted to ground
or power). Good for several km easily.
Among other things, there are actually specifications regarding timing,
error detection and correction, etc., and is always implemented in
hardware (to be really CAN compliant).
See http://www.can-cia.org/
It's probably too heavy-duty for a TinyX5.
> On Wed, 17 May 2006 11:02 +0100 (BST)
> "David Collier" <from_yahooAVRchat@dexdyne.com> wrote:
>> I want to string a load of simple slaves out along a
>> serial bus.
>>
>> Does anyone think I could implement a 1-wire slave using
>> an ATtinyx5?
Sure. You could do something very much like the Dallas/Maxim 1-wire bus.
You would have to switch between input mode and output LOW mode on the pin.
>> Yes I know it's patented.
>>
>> Alternatively does anyone have a better suggestion? Would
>> the I2C
>> look-alike mode do it for me? Anyone got any experience
>> of such a thing,
>> or know where to scrounge the necessary code?
Another scheme to look at would be the LIN bus; it's one wire and good
for limited distances (and slow; 19200 bps). Typically implemented using
standard UARTs.
http://www.interfacebus.com/Design_Connector_LIN_Bus.html
Atmel have an app note with C code in it (for another micro family, but
might be useful):
http://www.atmel.com/dyn/resources/prod_documents/doc4189.pdf
http://www.atmel.com/dyn/resources/prod_documents/Code_4189B.zip
--
Ned Konz
ned@bike-nomad.com
http://bike-nomad.com