Hm, that could be an option, but I'd rather not use that much pins. I've only got 6 pins left on the PIC18F452 and I'd like to keep those. The fewer pins used the better.
> The two wire bi-colour LED's usually require the supply voltage
> polarity to be reversed to change the colour. To control them from
> a PIC would require an H-pack (or bridge) configuration. One wire
> of the LED's to connect to a voltage divider giving half supply
> voltage and the other wire to a pipolar PIC I/O pin so that when
> the PIC output goes high it gives polarity for red and when low
> it gives polarity for green. You still have to work out how to
> control the LED's when you want them both off. An easier method
> might be to regonfigure your design so that tou can use 3 wire
> bi-colour led"s
Well, using 1 PIC port for each LED is out of the question. Using 3-wire bi-color LEDs is out of the question, since the switches only have 2 holes to mount a LED into. Well, unless you know of a nice switch that cathers for 3-wire LEDs. I've browsed the whole Farnell catalog for useable switches and the Mec Multimec 3F were by far the nicest, although I have to admit that they are pretty expensive :(.
I asked samples, when I receive them, I'll see if it is possible to drill an extra hole in the switch so that 3-pins LEDs can be mounted. I'm afraid it won't be possible though.
> I *think* you would need 16 pins to control 8 * 2-pin LEDs. If so, you
> could either connect 2 * 8-bit SRs serially and have each LED to an
> adjacent pair of SR o/ps or use the SRs in parallel with the LEDs
> between them (ie SR1d0 - LED+R - SR2d0), which amounts to the
> same thing except 1 * 16-bit is a little simpler to i/f to
>
> OTOH Maxim et al are always putting out new LED controller ICs
I'd like PWM to be able to dim the LEDs at night, for example when I want to fall asleep with music playing, so that I don't get disturbed by the bright LEDs. A blink function would be good too, that would free up the I2C bus (or the SPI bus of course) when I need to blink the LEDs. I saw that the MAX7314 has a blink input & PWM support, but it can only source current, so it's no good either. Does anybody know of a chip that can both source & sink current (10-15 mA per I/O should be fine) and that has blink & PWM output support?
It looks like Philips has got an even beter chip, the PCA9532, it does the blinking on it's own, but it can't source current either.
Hm, what about using a chip such as the Philips PCA9532 and let it drive 2 octal buffers such as the 74HC541. Could that work? If course it takes up a lot more space which isn't all that good either, but it's still better than occupying the I2C bus all the time.
Help! I just spend 3 hours searching the net for a chip that has I2C/SPI control, 16 outputs, blink & PWM function and that can both sink & source current and nothing turned up :(.
Regards, Anthony Van Herrewege
PS: I added info on the preamp I'm making to my website, check it out here: http://members.lycos.nl/anthonvyh/index.php?page=preamp-main. Oh, and if you see anything stupid (and I'm sure the circuit's full of stupid mistakes), please inform me about it. Thanks!
At 08:22 AM 6/26/2004, Anthony Van Herrewege wrote:
> > Why don't you just use 5 PIC port pins?
>
>Hm, that could be an option, but I'd rather not use that much pins. I've
>only got 6 pins left on the PIC18F452 and I'd like to keep those. The
>fewer pins used the better.
Then just use an 8 pin PIC to drive the LEDs. The LEDs are matrixed onto 4
or 5 pins. Talk to it serially via the input-only pin (GPIO3). Its a tiny
footprint and probably much cheaper than the alternatives.
Celebrating 20 years of Engineering Innovation (1984 - 2004)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.
> Then just use an 8 pin PIC to drive the LEDs. The LEDs are matrixed onto 4
> or 5 pins. Talk to it serially via the input-only pin (GPIO3). Its a tiny
> footprint and probably much cheaper than the alternatives.
>
> dwayne
Ah yes, off course, great idea! And I could add PWM & blinking support and everything in software. But how do I connect those 2-pins bicolor LEDs to the pins? I tried to figure it out, but unfortunately, I didn't succeed...
On Sat, 26 Jun 2004 07:22:18 -0700, Anthony Van Herrewege wrote:
>> Why don't you just use 5 PIC port pins?
>
>Hm, that could be an option, but I'd rather not use that much pins. I've only got 6 pins left on the PIC18F452 and I'd like to keep those. The fewer pins used the better.
>
I haven't been following this thread too closely so this may not be an
option for you but take it for what it's worth (if anything).
It should be possible to connect your LEDs between the outputs of two
8-bit serial-to-parallel shift registers. For one color, write a 1 to
one of the registers and a 0 to the other. Swap these bits for the
other color. Write a 0 to both bits for LED off. Actually, writing a 1
to both pins would turn the LED off as well.
If flicker isn't a concern while changing the LEDs, all you'd need is
1 clock line and 1 data line out of the PIC. Otherwise, you'll need a
third line to latch the data (and, of course, shift registers with a
latch-enable input).
At 03:39 PM 6/26/2004 -0700, you wrote:
> > Then just use an 8 pin PIC to drive the LEDs. The LEDs are matrixed onto 4
> > or 5 pins. Talk to it serially via the input-only pin (GPIO3). Its a tiny
> > footprint and probably much cheaper than the alternatives.
> >
> > dwayne
>
>Ah yes, off course, great idea! And I could add PWM & blinking support and
>everything in software. But how do I connect those 2-pins bicolor LEDs to
>the pins? I tried to figure it out, but unfortunately, I didn't succeed...
You need 5 and 5 resistors (one in series with each port pin).
Connect each LED back-to-back pair across one unique pair of pins after
the series resistor, of which there are 10, so you have two spare.
Only one LED can actually be on at once, but by multiplexing you can have
more than one apparently on.
> I haven't been following this thread too closely so this may not be an
> option for you but take it for what it's worth (if anything).
>
> It should be possible to connect your LEDs between the outputs of two
> 8-bit serial-to-parallel shift registers. For one color, write a 1 to
> one of the registers and a 0 to the other. Swap these bits for the
> other color. Write a 0 to both bits for LED off. Actually, writing a 1
> to both pins would turn the LED off as well.
>
> If flicker isn't a concern while changing the LEDs, all you'd need is
> 1 clock line and 1 data line out of the PIC. Otherwise, you'll need a
> third line to latch the data (and, of course, shift registers with a
> latch-enable input).
>
> Regards, Bob
I thought of that too, but, as someone else pointed out, it would take up a lot of space.
> You need 5 and 5 resistors (one in series with each port pin).
> Connect each LED back-to-back pair across one unique pair of pins after
> the series resistor, of which there are 10, so you have two spare.
>
> Only one LED can actually be on at once, but by multiplexing you can
> have more than one apparently on.
>
> Best regards, Spehro Pefhany
Thanks! Thanks a lot! That should be pretty simple, even although I've never done any PIC programming. The PIC12F683 looks good, too good even, but the price diffence between all the PIC12F parts is only $0.45 anyway. And 2 more LEDs I can connect, great, that's just what I need. And I have 3 more pins free on the 6 pins connector I'll use. Ha, this just couldn't be better :). Just to be sure I did it right, if it's not too much asked, could you please check this: http://members.lycos.nl/anthonyvh/images/preamp-buttons1-big.gif?
> > You need 5 and 5 resistors (one in series with each port pin).
> > Connect each LED back-to-back pair across one unique pair of pins after
> > the series resistor, of which there are 10, so you have two spare.
> >
> > Only one LED can actually be on at once, but by multiplexing you can
> > have more than one apparently on.
> >
> > Best regards, Spehro Pefhany
>
>Thanks! Thanks a lot! That should be pretty simple, even although I've
>never done any PIC programming. The PIC12F683 looks good, too good even,
>but the price diffence between all the PIC12F parts is only $0.45 anyway.
>And 2 more LEDs I can connect, great, that's just what I need. And I have
>3 more pins free on the 6 pins connector I'll use. Ha, this just couldn't
>be better :). Just to be sure I did it right, if it's not too much asked,
>could you please check this:
>http://members.lycos.nl/anthonyvh/images/preamp-buttons1-big.gif?
>
>Regards, Anthony
The matrix looks okay, however note one of the classic PIC gotchas.. the
GP3 pin is INPUT ONLY.
Also check to make sure that none of the other output pins are open drain.
You can reduce the number of resistors to 5 by halving the value and putting
them in series with the outputs rather than the LEDs.
> The matrix looks okay, however note one of the
> classic PIC gotchas.. the GP3 pin is INPUT ONLY.
>
> Also check to make sure that none of the other
> output pins are open drain.
>
> You can reduce the number of resistors to 5 by
> halving the value and putting them in series with
> the outputs rather than the LEDs.
>
> Best regards, Spehro Pefhany
I noticed my mistake with GP3, I changed the schematic
now. Thanks for the tip on the resistors, that should
make everything even more simple.
I started writing my first ASM program for the LEDs
and I think I got part of the code OK, but I'm tired
of looking at it for the moment.
Some students at my university anted to do this once...
What they ended up with was wiring the circuit a bit oddly, so that one pin
would have more than one function.
Imagine 4 pinns [0-3] where the first Bi-color led was connected with the
common pin to pin0 and the two color pinns to 1 and 2.
To make it light, pin0 need to be low I think, and one of the color pinns be
high. Then one would turn it off and lower pin 1 while turning on either
pin 2 or 3. I think this was how it was wired. It was in such a way that
one didn't get spurious lightings, but it did work. The leds could be run a
bit hader as they would be on a 25% dutycycle in this application using only
4 I/O ports.
--- Matthew Brush <matthewbrushspam_OUTYAHOO.CA> wrote:
> I'm just kinda jumping in on this thread, but what
> about a 4 to 16 multiplexer like the 74HC154 (i
> think)?
>
> each led gets two outputs, one for each color.
>
> This would take at least 4 I/O pins on the PIC and
> maybe another to clock the multiplexer, but it'd be
> small and fancy.
>
> Just an idea...cheers
>
> =====
> MJ Brush
Well, if I use a PIC12 instead of a multiplexer I only
need 1 I/O pin on the PIC, 2 if I want to make sending
data easier.
> Some students at my university anted to do this
> once...
> What they ended up with was wiring the circuit a bit
> oddly, so that one pin
> would have more than one function.
>
> Imagine 4 pinns [0-3] where the first Bi-color led
> was connected with the
> common pin to pin0 and the two color pinns to 1 and
> 2.
> To make it light, pin0 need to be low I think, and
> one of the color pinns be
> high. Then one would turn it off and lower pin 1
> while turning on either
> pin 2 or 3. I think this was how it was wired. It
> was in such a way that
> one didn't get spurious lightings, but it did work.
> The leds could be run a
> bit hader as they would be on a 25% dutycycle in
> this application using only
> 4 I/O ports.
>
> Kyrre
I can't use that kind of bi-color LEDs. I have to use
2-legged bi-color LEDs, there isn't any common pin,
the supply needs to be reversed to switch colors.
ahh. Why not connect them in a tandem like way anyway ?
What would happen is current can go through the led between the two pinns
you activate as + and - but it will also try to go through all the other
pairs via the other led's. The last one would not make the LED's light up.