PDA

View Full Version : How to daisy chain 3 wire serial interface ICs?



lyassa
10-21-2011, 09:51 PM
I need to monitor the voltage of few batteries that are next to each other, but away from the Propeller. is it possible to daisy serial devices as the diagram below shows?



+-------+ +-------+
|mcp3208| |mcp3208|
+-------+ +-------+
c d s c d s
| | | | | |
+--]--]----+..|..|....to more
| +--]-------+..|....3 wire serial
| | +----------+....interface
| | |
to propeller

Mike Green
10-21-2011, 09:59 PM
No. You have to have a separate CS line for each device. It's a Chip Select line. You can connect the Clock and Data lines in parallel.

If you really need to have several devices on a bus, you should use I2C or 1-Wire protocols. I2C requires a clock and a data line while the 1-Wire protocol only needs 1 line. You'll need a ground wire and power although most 1-Wire devices can get power from the single line in-between data pulses.

lyassa
10-21-2011, 10:03 PM
Thanks Mike. Is there an generic object (in object exchange) to allow me to use the 1-wire protocol with mcp3208? Appreciate your answer.

Cluso99
10-21-2011, 10:03 PM
The MCP3208 has a 4 wire SPI interface. The fourth pin is -CS. While you can parallel up the 3 wires (clock, datain, dataout), you will need to supply a separate -CS (chip select) pin to each MCP3208. Otherwise all info will go to all MCP3208 and all will respond causing a conflict.

It may also be possible to drive the MCP3208's in parallel using clock and datain, but use separate dataout pins. This will depend on software and you will need to write a special object to handle multiple simultaneous replies.

Cluso99
10-21-2011, 10:05 PM
I see Mike has replied. I didn't see that the MCP3208 supports the 1 wire protocol.

lyassa
10-21-2011, 10:12 PM
Thanks Cluso99. Do you know about any ADC that support the 1 wire protocol?

tonyp12
10-21-2011, 11:29 PM
How many do plan to use?
it uses chipselect so you can share the other 3 lines.

So if you need 4 A/Ds, it could be done with 7 pins.
If you want 8 A/Ds, you could use a 74HC138 (3of8) for chip select, for a tolal of 6 pins.
it's active low so it will work with your IC.


If you are really low on pins, go with i2c and you can share props eeprom pins.
But if you want to use a few of the same A/D chip make sure it have at least 2pins for address select.
that you connect to V+ or/and Gnd so you can have 4 of them on the same bus.

Cluso99
10-22-2011, 12:11 AM
I haven't searched for 1wire ADCs. Try searching on DIgikey's site www.digikey.com (http://www.digikey.com)

kwinn
10-22-2011, 12:58 AM
If a fifth wire is available you could add one of the 6 pin single flipflops to each adc board and shift the chip select from one board to the next.

If the batteries are close enough to each other a '595 might also be used.

lyassa
10-22-2011, 11:29 PM
I found PCF8591 on Digikey as Cluso99 suggested. Here is the datasheet for it http://www.nxp.com/documents/data_sheet/PCF8591.pdf. I imagine I will need to write a Propeller driver to be able to use it. Hope that will not be a hard task to do.

Mike Green
10-23-2011, 12:58 AM
The Maxim/Dallas DS2450 is a 4 channel A/D converter that uses the 1-Wire protocol