Hi!
I have the problem that i need about 60 i/o-pins, but i just have a 16c67
and so i just have 33...
I have to check a lot of light barriers, so is there something with
multiplexing or something?
What is a usual way to manage this?
ciao
> Hi!
> I have the problem that i need about 60 i/o-pins, but i just have
> a 16c67 and so i just have 33... I have to check a lot of light barriers,
> so is there something with multiplexing or something?
> What is a usual way to manage this?
> ciao
I've just done something similar to this using 74HC251s. This is an
8-to-1 demultiplexer with a 3 bit select. The 74HC165 serial-to-
parallel convertor would also work, as would the 4051 or an I/O
expander (eg a PIA like the 6522 or 8243)
Multiplexing is a good idea if you haven't problems whit the time of
multiplextion.
Other way, is use a direct driver for led display (ex. MM5440), this only
need 3 wire signal control and it can be concatenated to other driver. each
driver can drive up 32 segments.
If you want make the drive only need shift registers and latch.
It'll cost you a few external chips, but its expandable (and cheap).
Ok - all detector inputs come through a bunch of OR gates (small signal
diodes) to ONE input.
One output pin clocks through cascaded decade counters, each output of which
fires up an LED in your light barriers one-at-a-time. The third output
resets the counters for guaranteed synchronisation at the start of each
cycle.
Your software resets the external counter chips and an internal counter is
set to 0. You wait a small settling time then read in the value of light
barrier #0. Next you pulse the counter clock, increment the internal
counter and wait for light barrier #1 to settle. Read #1 and move on to the
next . . .
Rise time for LEDs is pretty fast, so this would probaly be Ok for around 20
light barriers. For more just parallel the clock and reset to each decade
counter and dedicate an input to each set of 10 light barriers connected to
each decade counter. Pin count is 2 + (light barriers / 10). You read each
input after the settle time then clock all the paralleled counters together.
> Multiplexing is a good idea if you haven't problems whit the time of
> multiplextion.
Selection of individual sources will be faster using an addressable
multiplexer rather than a shift register ie 74HC251-type vs 74HC165-
type. With a mux you can send the xxx (sorry those with porn detectors)
select bits to read a specific line but with a shift register you need to
clock 8 bits into the PIC to measure just one. An alternative would be
to use bussed latches to hold the data, which could then be piped
through a single multiplexer. On two occassions I've needed the full
speed of the F84A on multiple transitory sources and had to use two
with a serial connection between them. As Fransisco says, it comes
down to how much time you have and how mean you want to be with
port pins
> How about a 3 pin solution?
>
> It'll cost you a few external chips, but its expandable (and cheap).
>
> Ok - all detector inputs come through a bunch of OR gates (small signal
> diodes) to ONE input.
> One output pin clocks through cascaded decade counters, each output of which
> fires up an LED in your light barriers one-at-a-time. The third output
> resets the counters for guaranteed synchronisation at the start of each
> cycle.
>
> Your software resets the external counter chips and an internal counter is
> set to 0. You wait a small settling time then read in the value of light
> barrier #0. Next you pulse the counter clock, increment the internal
> counter and wait for light barrier #1 to settle. Read #1 and move on to the
> next . . .
>
> Rise time for LEDs is pretty fast, so this would probaly be Ok for around 20
> light barriers. For more just parallel the clock and reset to each decade
> counter and dedicate an input to each set of 10 light barriers connected to
> each decade counter. Pin count is 2 + (light barriers / 10). You read each
> input after the settle time then clock all the paralleled counters together.
>
> Bye.
>
>
>
> > Ok - all detector inputs come through a bunch of OR gates (small signal
> > diodes) to ONE input.
I've had some trouble with diode-ORing clock pulses and had to stretch
them to get through the diodes. Could it be that the capacitance of the
diodes (1N914/1N4148) is too high for pulses in the region of 1us as
you'd find in a typical bsf nop bcf operation ?
> > One output pin clocks through cascaded decade counters, each
> > output of which fires up an LED in your light barriers one-at-a-time.
> > The third output resets the counters for guaranteed synchronisation
> > at the start of each cycle
If you're thinking of something like a 4017 (active high Reset), connect
a resistor, say 10k between Clk and Reset, and a cap of around 100n
from Reset to 0V. A short pulse to Clk will get through, but will be too
short to charge the cap on Reset through the 10k. Lengthen the pulse
enough to charge the cap to bring Reset high and you've got a one-
wire control for Clk and Reset
You can usually set up both the transmitters and the receivers in the
light barriers in two matrices. One matrix turns on a LED while the other
senses a phototransistor. Using 24 pins (8x8 + 8x8) you should be able to
read 64 barriers. Be sure to make the read pulses long enough,
phototransistors used with low light are dog slow.