Searching \ for '[OT]More than 8 LED's from a single 8-bit port' in subject line. ()
Help us get a faster server
FAQ page: techref.massmind.org/techref/ios.htm?key=port
Search entire site for: 'More than 8 LED's from a single 8-bit port'.

Exact match. Not showing close matches.
'[OT]More than 8 LED's from a single 8-bit port'
2000\01\06@185344 by

OK, I got some food  in my stomach so I can think a little
more clearly now.

You'll only need 4 pins to give you 12 LED's with this
method. You can light any LED at any time OR if you
need all on, you'll need to multiplex them.

The pins that are not actively driving the LED in question
(only two pins are active at any one time) need to be set
to tri-state (inputs).

Let me try and draw a picture:

First,    each LED is back to back with the other, such as:

->|-     and
-|<-   meaning each anode is hooked to the cathode of the other
in each two LED group. I will represent this as a -**- in my drawing,
where each "**" represents two LED's back to back.

O is a PIC PIN

So here we go:

|------------**------------|
|                          |
|        |-------**--------|
|        |                 |
|-------**--------|        |
|        |        |        |
|---**---|---**---|---**---|
|        |        |        |
O        O        O        O

12 Leds from 4 pins.

I left out the currently limiting resistors, but you'll
need to add them directly at the PIC pins... don't
forget the current will be going through two resistors,
so make sure each is half of the final value.

Jeff

Don McKenzie wrote:

> Jeff King wrote:
> >
> >
> > If you need all 10 on at once, your going to have to multiplex
> > them....might be messy but should be doable.
>
> Not really messy, you should be able to do a matrix of 4 by 4 giving 16
> LEDs.

By messy I meant the multiplex code on a PIC that doesn't have
a TMR overflow IRQ. My "assumption" is he was trying to get
the absolute lowest price.... meaning, no TMR overflow IRQ..
but been a while since I worked on a real low end PIC.... do
they all have TMR overflow? Then not messy at all.

The 12" turkey sub is starting to kick in so the brain is coming
alive.

-Jeff

Jeff King wrote:

> O is a PIC PIN
>
> So here we go:
>
> |------------**------------|
> |                          |
> |        |-------**--------|
> |        |                 |
> |-------**--------|        |
> |        |        |        |
> |---**---|---**---|---**---|
> |        |        |        |
> O        O        O        O
>
> 12 Leds from 4 pins.
>
> I left out the currently limiting resistors, but you'll
> need to add them directly at the PIC pins... don't

That's basically what I meant Jeff, I just can't draw as well.
It must be that Turkey Sub. :-)

Of course you can do it with max-2719's and 164 shift registers and
multiplexing, and etc, but if it's a simple circuit to get 10 LEDs out
of 8 pins, then the above is fine.

Don McKenzie    dondontronics.com      http://www.dontronics.com

World's Largest Range of Atmel/AVR and  PICmicro Hardware and  Software.
Free Basic Compiler and Programmer http://www.dontronics.com/runavr.html

On Thu, 6 Jan 2000, Jeff King wrote:

{Quote hidden}

You know, I've been doing a lot of programming lately - too much in fact.
But the last time I played with leds you couldn't get current to flow
through a 'back-to-back' configuration. Maybe I should just stick to
programming. :).

Scott

Scott Dattalo wrote:

> > First,    each LED is back to back with the other, such as:
> >
> > ->|-     and
> > -|<-   meaning each anode is hooked to the cathode of the other
> > in each two LED group.

snip---

> You know, I've been doing a lot of programming lately - too much in fact.
> But the last time I played with leds you couldn't get current to flow
> through a 'back-to-back' configuration. Maybe I should just stick to
> programming. :).
>
> Scott

He may have used the wrong terminology 'back to back' but what Jeff said
was anode of one to cathode of the other in each 2 group, meaning across
each other, just like a dual or tri-color LED configuration.

Don McKenzie    dondontronics.com      http://www.dontronics.com

World's Largest Range of Atmel/AVR and  PICmicro Hardware and  Software.
Free Basic Compiler and Programmer http://www.dontronics.com/runavr.html

Scott Dattalo wrote:

> You know, I've been doing a lot of programming lately - too much in fact.
> But the last time I played with leds you couldn't get current to flow
> through a 'back-to-back' configuration. Maybe I should just stick to
> programming. :).

No, just send me more turkey subs.  Back to back was confusing. Is
there another way to say connect them across each other? (anode to
cathode with BOTH pins).

When I think of back to back, I see either    ---->|--|<----
or:   ----------|<---->|-----
which of course I did not mean at all. I meant:

|----|<-----|
-|           |-
|---->|-----|

Is there another term then back to back for this configuration?

-Jeff

parallell led's.................but opposite polarity.......
-----Original Message-----
From: Jeff King <jeffaerodata.net>
To: PICLISTMITVMA.MIT.EDU <PICLISTMITVMA.MIT.EDU>
Date: Thursday, January 06, 2000 5:51 PM
Subject: Re: [OT]More than 8 LED's from a single 8-bit port

{Quote hidden}

Try saying Inverse Parallel.

(words like parallel and series go over much better than back to back
and side by side, etc)

Jeff King wrote:
{Quote hidden}

2000\01\06@200916 by
Anti-parallel ? Reverse-parallel ?

Jinx

>  |----|<-----|
> -|           |-
>  |---->|-----|
>
> Is there another term then back to back for this configuration?
>
> -Jeff
>

> When I think of back to back, I see either    ---->|--|<----
> or:   ----------|<---->|-----
> which of course I did not mean at all. I meant:
>
>  |----|<-----|
> -|           |-
>  |---->|-----|
>
> Is there another term then back to back for this configuration?

Inverse parallel?

> Inverse parallel?

That works pretty well. Brings to mind the right image.

---
Peace,
William Kitchen

The future is ours to create.

On Thu, 6 Jan 2000, Jeff King wrote:

{Quote hidden}

After I sent the message, I thought about how you would do this and then
understood what you are talking about. The term you're looking for is
'anti-parallel'. But it has been a looonngg day.

Regards,
Scott

Combining the 4-pin and 4017 methods together - use a BCD-
output counter (eg 74LS393 or 4040) and set the bit pattern on
the o/ps to match the 4-pin PIC idea. That way you're still using
only 2 PIC pins (for Clk & Reset) but do have a bar display. If you
calculate the difference between the current and the next display
you could even not use Reset on the counter and thus use only
one PIC pin.

Jinx

> If you calculate the difference between the current and the next
> display you could even not use Reset on the counter and thus use only
> one PIC pin.

Yeah, but then you're screwed if anything makes the 4017 count
during the power up process, before the PIC code is running.
Maybe could get away with it by using a power up reset circuit,
possibly the same one used for the PIC.

---
Peace,
William Kitchen

The future is ours to create.

> If you calculate the difference between the current and the next
> display you could even not use Reset on the counter and thus use only
> one PIC pin.

Here's another thought. Could maybe use a resistor and cap such
that the reset pin sees a slow rising version of the count pulse.
This way a short pulse makes the 4017 count, and a longer pulse
makes it reset.

---
Peace,
William Kitchen

The future is ours to create.

Microchip TB029

Jinx

Jeff King wrote:

> By messy I meant the multiplex code on a PIC that doesn't have a TMR
> overflow IRQ.  My "assumption" is he was trying to get the absolute
> lowest price.... meaning, no TMR overflow IRQ.. but been a while since
> I worked on a real low end PIC.... do they all have TMR overflow?

No, the low-end devices have neither IRQ, which doesn't matter a hoot,
nor TMR0 overflow flag (T0IF) which is *much* more important.

But it's still really easy.  You must of course use polling, but this
is no great hassle.  You divide up your "main loop" processing into
blocks which are achievable within your multiplex interval, say 2 ms.

You intersperse the sequence of these blocks with alternate waits for
one and zero on TMR0 bit 7, and arrange so that TMR0 overflows each 4 ms
(i.e., bit 7 toggles each 2 ms).  IOW, TMR0 is clocked at 64 µs,
prescaler set to 32 (option mask b'100') using 4.096 MHz crystal.

Program flow goes:

waithi  macro
btfss   TMR0,7
goto \$-1
endm

waitlo  macro
btfsc   TMR0,7
goto \$-1
endm

loop:
do_1st    ; Up to approx 2 ms processing
waithi
strobe_next_digit
do_2nd    ; Up to approx 2 ms processing
waitlo
strobe_next_digit
do_3rd    ; Up to approx 2 ms processing
waithi
strobe_next_digit
do_4th    ; Up to approx 2 ms processing
waitlo
strobe_next_digit
goto  loop

Note that do_1st, do_2nd etc. do not have to always execute in less
than 2 ms, as long as they do so on average and never, in combination
with strobe_next_digit, approach 4 ms either singly or as a consecutive
pair.  Hope this is clear

Scott Dattalo wrote, quoting Jeff King:

>> Is there another term then back to back for this configuration?
> The term you're looking for is 'anti-parallel'.

Yeah, and various other permutations thereof.  One, numeric, sprang to
mind but I dare not say... (;-)

Jinx wrote:

> Combining the 4-pin and 4017 methods together - use a BCD- output
> counter (eg 74LS393 or 4040) and set the bit pattern on the o/ps to
> match the 4-pin PIC idea.

Sorry, it doesn't work that way.  The 4-pin trick requires the ability
to tri-state (set to input) the I/O lines.

Also, if you're going to use an output expander, you want a shift
register which loads all your data in 8 clocks, rather than a counter.
Updates will be so fast that intermediate states will be invisible, so a
latching shift register is unnecessary for display.

If each output of a 74HC164 will drive sufficient current (you can
have 10 mA, but no more :), then use five of the outputs to drive up to
five LEDs out of your ten low simultaneously, and two other outputs (one
left over!) to multiplex alternate banks of five LEDs high via a NPN
emitter follower with collector supplied from unregulated Vcc.

Resistors are only required for the five cathode drives, none are
needed for the emitter followers.  The same method could be used with
seven PIC outputs, which can drive five LEDs low simultaneously with
20 mA.  This is similar to the original multiplexed proposal except that
the emitter followers allow lots more current - much brighter!
--
Cheers,
Paul B.

Scott wrote:
>> Is there another term then back to back for this configuration?
>
>After I sent the message, I thought about how you would do this and then
>understood what you are talking about. The term you're looking for is
>'anti-parallel'. But it has been a looonngg day.

Not so long :-)
It's still used when you put 2 SCRs to work as a TRIAC.

Marcelo

Jeff wrote:
>First,    each LED is back to back with the other, such as:
>|------------**------------|
>|                          |
>|        |-------**--------|
>|        |                 |
>|-------**--------|        |
>|        |        |        |
>|---**---|---**---|---**---|
>|        |        |        |
>O        O        O        O

Pay attention to do not use high bright leds, as the current will flow thru
the desired led and thru 3 other leds in series that will be in parallel
with the first one.

o--+----L---------+-----o
|---L--L--L---- |

So you will have a full bright led and three partially lighted leds.
With four pins you can light 6 leds thru 3 resistors.

Marcelo Y.

Note I modified drawing below:
+ = resistor

Marcelo Yamamoto wrote:

{Quote hidden}

As I mentioned my earlier post, I hadn't shown the resistors, but they
were there. Each pin has a resistor.... lets say 220ohms for a total
of 440ohms. So any LED that is powered across it will see about
2.2volts, or whatever its turnon voltage is.

Remember, a LED is still a diode, and the turnon knee is fairly
sharp. So, in "theory" the most any other LED will see will be
1.1 volts, so it shouldn't turn on. Of course, if you start mixing
technologies..... maybe a blue LED with a red led, since they
have varying turn-on voltages, you might have problems.

-Jeff

Jeff wrote:
>As I mentioned my earlier post, I hadn't shown the resistors, but they
>were there. Each pin has a resistor.... lets say 220ohms for a total
>of 440ohms. So any LED that is powered across it will see about
>2.2volts, or whatever its turnon voltage is.
>
>Remember, a LED is still a diode, and the turnon knee is fairly
>sharp. So, in "theory" the most any other LED will see will be
>1.1 volts, so it shouldn't turn on. Of course, if you start mixing
>technologies..... maybe a blue LED with a red led, since they
>have varying turn-on voltages, you might have problems.

Yes, I agree. But I have tried it and you should avoid some High bright
leds. They turn on even with 1 volt. Not fully bright, but you can see it is
lighted.

Marcelo Y.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...