From: Tony Williams
Subject: Re: Alternative design to this?
Date: Fri, 20 Sep 2002 09:39:32 +0100
References: <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com>
NNTP-Posting-Date: Fri, 20 Sep 2002 08:42:49 +0000 (UTC)
User-Agent: Pluto/1.14i (RISC-OS/3.60)
In article <firstname.lastname@example.org>,
Peet Grobler wrote:
> What does shift registers do? Maybe I should go find a datasheet and
> have myself a look.
Peet, I have been investigating a remote control
system recently. It does (isolated) remote DAC/ADC,
and digital i/o, all based on a very simple serial
Opto LED --+
supply \|/ _________ +----Remote target
from host +--| Opto | \|/ supply
| _________ | ________
+--| Opto | +--| S/R |
CLOCK------->-|LED Trans|-----| CD4094 |->More CD4094?
| _________ | ||||||||
+--| Opto | | 8x digital
STROBE------>-|LED Trans|--+ outputs
_________ | __\|/______________
| Opto |--+ | |
READ--------<-|Trans LED|-<---|CMOS Multiplexer(s)|
/|\ |_________| |___________________|
Connections Your remote switches
Every remote target has those 4x Optos, a 4094 shift
register, and an "1 of N" CMOS multiplexer (4051 or
whatever). The remote target also has its own supply.
A single 4094 will handle all the digital i/o needed,
but remote ADC/DAC will require at least one other
4094 cascaded onto the first (and DACs + comparators).
The host system sends synchronous DATA/CLOCK signals
to shift 8-bits of data into the 4094, and then a
single STROBE pulse latches the data onto the 4094's
8 output pins. In the simple sketch above this would
set the CMOS muxer to select the required switch to
look at, whose state appears on the READ line.
I'm generating all the control signals in software,
in the controlling host, at about 20KHz. It takes
about 1mS to load 16-bits into a pair of 4094's
and read the result. A 12-bit DAC-load takes about
5mS and a 12-bit succesive approximation ADC-sequence
Over long distances you may wish to clock slower.
After all, switches might takes 10's of mS to
reliably change state anyway.
> My application does not rqequire high speed as such, problem is,
> I'll have to poll all the inputs all the time.
Use your AVR as the central host, spinning in a loop,
polling all remote target locations and logging the
results into registers. Send the data from those
registers to the PC, over a local RS232 line.
To drive several remote targets, parallel DATA, CLOCK,
and READ, and give each target its own STROBE. eg, an
8-bit AVR port could control 5 remote targets.