I want to make a thing to hang from my ceiling with a ton of
strobing/flashing LEDs (different rates and times) - what is the best
way to control the LEDs?
--
<------------------------------------------------------->
< Martin Klingensmith, AKA Format. >
< Pyrotechnics - Mountain Bikes - Electronics - Coding >
< Aquaria - Computers - Computer Selling - And the list >
< Keeps going, and going... >
<------------------------------------------------------->
<<
I want to make a thing to hang from my ceiling with a ton of
strobing/flashing LEDs (different rates and times) - what is the best
way to control the LEDs?
>>
With a ton of 555's !
> I want to make a thing to hang from my ceiling with a ton of
> strobing/flashing LEDs (different rates and times) - what is the best
> way to control the LEDs?
THE ANSWER:
one PIC12C508 per 12 LEDs
'ultiplexed:
5 output pins available.
leds driven in bidirectional pairs.
3 x 2 = 6 (5 pins drive 6 LED pairs)
cost per LED = 1 led
1/12 PIC12C508
1/6 resistor
1/12+ of PCB
works for me:
0 0
0 0
0 0
Pic12C508
0 0
0 0
0 0
any combination of LEDs can appear lo be lit simultaneously.
requests for code to:
>In a message dated 18/07/98 23:26:25, you write:
>
><<
> I want to make a thing to hang from my ceiling with a ton of
> strobing/flashing LEDs (different rates and times) - what is the best
> way to control the LEDs?
> >>
>With a ton of 555's !
>
I take a few deep breaths. I have a shot of blackberry brandy.
"I am calm, I am relaxed, all is well with the universe." I tell myself.
SO WHY DO YOU GUYS MAKE FUN OF THE 555?
The 555 has taken its place in history. Of the two IC's in the
Smithsonian Museum, one is the 555, the other isn't.
The 555 was the first IC computer, Yes, the 555 is an
analog computer. The 555 was one of the IC's that were
used as a prize in a box of cereal. Remember the
"Build your own computer" promotion that Sweet Tarts
used to get kids interested on computers? Some say that
this helped provided the talent that put men on the moon.
And yet such a nobel device can also be used in humble ways.
The latest data sheet I have seen states that the 555
can sink or source 200 ma. So without any other components,
it can be used as a driver. And with LED's connected between
their outputs in various ways, they can control almost a
ton of LED's with only eight 555's.
Also by putting a resistive sensor in the charging circuit, and
having a fix resistance in the discharge circuit, the 555 becomes
a resistance to frequency converter. And the ratio of the
pulse widths vary with the variable resistance.
Is not the 555 the chip of choice when building Pic emulators?
So, "Respect the 555 and it will respect you."
"I am calm, I am relaxed, all is well with the universe." I tell myself.
> I take a few deep breaths. I have a shot of blackberry brandy.
> "I am calm, I am relaxed, all is well with the universe." I tell myself.
>
> SO WHY DO YOU GUYS MAKE FUN OF THE 555?
>
> The 555 has taken its place in history. Of the two IC's in the
> Smithsonian Museum, one is the 555, the other isn't.
> The 555 was the first IC computer, Yes, the 555 is an
> analog computer. The 555 was one of the IC's that were
> used as a prize in a box of cereal. Remember the
> "Build your own computer" promotion that Sweet Tarts
> used to get kids interested on computers? Some say that
> this helped provided the talent that put men on the moon.
>
> And yet such a nobel device can also be used in humble ways.
> The latest data sheet I have seen states that the 555
> can sink or source 200 ma. So without any other components,
> it can be used as a driver. And with LED's connected between
> their outputs in various ways, they can control almost a
> ton of LED's with only eight 555's.
>
> Also by putting a resistive sensor in the charging circuit, and
> having a fix resistance in the discharge circuit, the 555 becomes
> a resistance to frequency converter. And the ratio of the
> pulse widths vary with the variable resistance.
>
> Is not the 555 the chip of choice when building Pic emulators?
>
> So, "Respect the 555 and it will respect you."
>
> "I am calm, I am relaxed, all is well with the universe." I tell myself.
>
> Bill C. @spam@angryKILLspamcornutt.com
--
<------------------------------------------------------->
< Martin Klingensmith, AKA Format. >
< Pyrotechnics - Mountain Bikes - Electronics - Coding >
< Aquaria - Computers - Computer Selling - And the list >
< Keeps going, and going... >
<------------------------------------------------------->
>In a message dated 18/07/98 23:26:25, you write:
>
><<
> I want to make a thing to hang from my ceiling with a ton of
> strobing/flashing LEDs (different rates and times) - what is the best
> way to control the LEDs?
> >>
>With a ton of 555's !
Holtek do a few LED flasher chips, one of which is in a TO-92 3-pin
package!
____ ____
_/ L_/ Mike Harrison / White Wing Logic / KILLspamwwlKILLspamnetcomuk.co.uk _/ L_/
_/ W_/ Hardware & Software design / PCB Design / Consultancy _/ W_/
/_W_/ Industrial / Computer Peripherals / Hazardous Area /_W_/
>I'm talking about 160 LEDs here!
>
>Bill Cornutt wrote:
>
>> I take a few deep breaths. I have a shot of blackberry brandy.
>> "I am calm, I am relaxed, all is well with the universe." I tell myself.
>>
>> SO WHY DO YOU GUYS MAKE FUN OF THE 555?
>>
>> The 555 has taken its place in history. Of the two IC's in the
>> Smithsonian Museum, one is the 555, the other isn't.
>> The 555 was the first IC computer, Yes, the 555 is an
>> analog computer. The 555 was one of the IC's that were
>> used as a prize in a box of cereal. Remember the
>> "Build your own computer" promotion that Sweet Tarts
>> used to get kids interested on computers? Some say that
>> this helped provided the talent that put men on the moon.
>>
>> And yet such a nobel device can also be used in humble ways.
>> The latest data sheet I have seen states that the 555
>> can sink or source 200 ma. So without any other components,
>> it can be used as a driver. And with LED's connected between
>> their outputs in various ways, they can control almost a
>> ton of LED's with only eight 555's.
>>
>> Also by putting a resistive sensor in the charging circuit, and
>> having a fix resistance in the discharge circuit, the 555 becomes
>> a resistance to frequency converter. And the ratio of the
>> pulse widths vary with the variable resistance.
>>
>> Is not the 555 the chip of choice when building Pic emulators?
>>
>> So, "Respect the 555 and it will respect you."
>>
>> "I am calm, I am relaxed, all is well with the universe." I tell myself.
>>
>> Bill C. RemoveMEangryTakeThisOuTcornutt.com
>
>
>
>--
><------------------------------------------------------->
>< Martin Klingensmith, AKA Format. >
>< Pyrotechnics - Mountain Bikes - Electronics - Coding >
>< Aquaria - Computers - Computer Selling - And the list >
>< Keeps going, and going... >
><------------------------------------------------------->
>
> From: Format <spamBeGonemartinspamBeGoneIMCNET.NET>
> I don't understand how I could use 5-555s though, please tell me! It
sounds a
> helluva lot better than the several PICs idea I have now
>
> Bill Cornutt wrote:
>
> > Sorry,
> >
> > I took the "ton of LED's" literally.
> > For 160 LED's you will only need five 555's.
You don't really need 5 555's to drive all 160 leds.
I think you will only need ONE! :)
Let's say a 555 can drain/source 200ma, VCC at 16V and
an LED lights at 2V at 20ma.
so, 200ma*16V = n*2V*20ma
n = 80 leds per one 555.
Just connect 8 LEDs in series and parallel all 10 series
LED sets.
If you make the LEDs flash alternately it can drive all
160 leds at the same time.
one PIC12C508 per 12 LEDs
5 output pins available.
leds driven in bidirectional pairs.
3 x 2 = 6 (5 pins drive 6 LED pairs)
Ok, I'll bite. I thought in a traditional matrix arrangement, you needed
the diode characteristics to avoid hidden current paths. Having
bidirectional pairs would defeat that, and you'd have problems "sometimes"
(I never quite understood which paths were problems.) Have you actually
got this working (as implied by "requests for code...")
I think you missed the point of the original request. Marin wanted a
shitload of LEDs on his ceiling to be flashing in a kind of pseudo random
sequence, not all off or all on.
555's definately have their uses, even as a low cost driver when the poor
PIC can't quite manage with it's 20mA ports.
I think the best method would be to implement a PRBS (Pseudo Random Bit
Sequence) in software and clock the data into a shitload of shift registers.
If you use HC parts they should be able to drive an LED at reasonable
brightness. A 12c508 shouldn't be hard pushed to acheive this as you won't
want to be flashing the LEDs at much more than a few hertz (unless you are
trying some kind of epilepsy seizure inducing experiment!)
Sorry I don't have any code for the PRBS, but it shouldn't be hard. It is
basically a shift register with the input being obtained by XORing 2 or more
outputs. If you can have a look at The Art Of Electronics, it explains the
principal of operation in some detail, and tells you were to tap the outputs
for maximum length sequences.
> You don't really need 5 555's to drive all 160 leds.
> I think you will only need ONE! :)
>
> Let's say a 555 can drain/source 200ma, VCC at 16V and
> an LED lights at 2V at 20ma.
>
> so, 200ma*16V = n*2V*20ma
> n = 80 leds per one 555.
>
> Just connect 8 LEDs in series and parallel all 10 series
> LED sets.
>
> If you make the LEDs flash alternately it can drive all
> 160 leds at the same time.
>
> Reggie
>
A pseudo-random sequence would be what I am aiming at. I think I could do
something with a couple 555's (556's?) each controlling a couple LEDs, with a
PIC controlling the 555's somehow (I don't know yet)
555's aren't that expensive (not as much as 160 LEDs!)
> I think you missed the point of the original request. Marin wanted a
> shitload of LEDs on his ceiling to be flashing in a kind of pseudo random
> sequence, not all off or all on.
>
> 555's definately have their uses, even as a low cost driver when the poor
> PIC can't quite manage with it's 20mA ports.
>
> I think the best method would be to implement a PRBS (Pseudo Random Bit
> Sequence) in software and clock the data into a shitload of shift registers.
> If you use HC parts they should be able to drive an LED at reasonable
> brightness. A 12c508 shouldn't be hard pushed to acheive this as you won't
> want to be flashing the LEDs at much more than a few hertz (unless you are
> trying some kind of epilepsy seizure inducing experiment!)
>
> Sorry I don't have any code for the PRBS, but it shouldn't be hard. It is
> basically a shift register with the input being obtained by XORing 2 or more
> outputs. If you can have a look at The Art Of Electronics, it explains the
> principal of operation in some detail, and tells you were to tap the outputs
> for maximum length sequences.
>
> Mike Rigby-Jones
> RemoveMEmrjonesTakeThisOuTnortel.co.uk
>
> > You don't really need 5 555's to drive all 160 leds.
> > I think you will only need ONE! :)
> >
> > Let's say a 555 can drain/source 200ma, VCC at 16V and
> > an LED lights at 2V at 20ma.
> >
> > so, 200ma*16V = n*2V*20ma
> > n = 80 leds per one 555.
> >
> > Just connect 8 LEDs in series and parallel all 10 series
> > LED sets.
> >
> > If you make the LEDs flash alternately it can drive all
> > 160 leds at the same time.
> >
> > Reggie
> >
--
<------------------------------------------------------->
< Martin Klingensmith, AKA Format. >
< Pyrotechnics - Mountain Bikes - Electronics - Coding >
< Aquaria - Computers - Computer Selling - And the list >
< Keeps going, and going... >
<------------------------------------------------------->
Scientific American published an article about how to make
artificial fireflies which sensed and synchronised to
the flashing of others, as they do in nature.
Obviously totally synchronous flashing could be done by wiring LEDs
together - what would be nice is a pseudo-random display where
you generally got interesting waves of light.
If you are lucky enough to live near fireflies, you could attract
these amorous insects. Remember to use _green_ LEDs -
flashing red LEDs could attract life forms wishing to mate, but
unpleasant specimens of one's own species! :-)
The 555 definitely will source 200 milliamps, but I am not
sure for how long. I once connected a #47 pilot lamp to the output of
a 555 and drove it for a minute or less and I almost left the first
layer of skin from one of my fingers baked to its surface when I
touched it to see how hot it was. I seem to also recall that it
behaved strangely with that much of a load on it. Basically, the 555
is a lot happier if you don't push things that hard.
Martin McCormick WB5AGZ Stillwater, OK
OSU Center for Computing and Information Services Data Communications Group
Hmm...
I just thought, why bother with the PIC if you need to feed the
output into a load of shift registers. Just use a bit of discreet logic and
clock it all with a 555. There, knew I could get one in there somehow :)
I sure like the idea of a shift register or two, or three, maybe four?
And one 555 for each output on a shift register. That is, if
the shift register has eight output pins, 1,2...8 then there would
be one 555 sourcing current for all led's attached to pin 1 of all
the shift registers.
There could also be a shift register controlling the 555's. By shifting a
one into the 555's control shift register and then shifting the one down
the line at some rate, you accomplish two things. First you multiplex
the led's by only enabling each group (all pin 1's, all pin 2's ...all pin
8's)
for a short time. And also you have insured that each shift register only
has one pin driving led's at a time. (so they won't burn any fool that
sticks his finger on it to see if it is running hot) (getting your finger
branded with the numbers 555 could only be worse if it have been
a 666 chip)
I leave the method of getting diferent brightness for the led's as a
exercise for the reader. (I have ideas, but this is a tough crowd)
> Hmm...
> I just thought, why bother with the PIC if you need to feed the
>output into a load of shift registers. Just use a bit of discreet logic
and
>clock it all with a 555. There, knew I could get one in there somehow :)
>
> Mike Rigby-Jones
> RemoveMEmrjonesEraseMEEraseMEnortel.co.uk
>
>Sorry I don't have any code for the PRBS, but it shouldn't be hard. It is
It's in Myke Predko's book.
Andy
==================================================================
Andy Kunz - Statistical Research, Inc. - Westfield, New Jersey USA
==================================================================
> Ok, I'll bite. I thought in a traditional matrix arrangement, you
> needed the diode characteristics to avoid hidden current paths.
> Having bidirectional pairs would defeat that,
Ahh! No, you mistake something here. It is not the uni-directional
characteristic of the LEDs which is brought into play, but their
threshold characterisitic, i.e., 1.4 volts or so.
Take a four-point matrix (i.e., two "rows", two "columns") of back-to-
back LEDs (i.e., eight of them) and energise one row-column pair. The
other three pairs are indeed in series, paralleled across this, but as
their threshold voltage is three times the first, they do not light.
It generalises for M by N.
To do this with incandescent lights properly, you need to add the
diodes. You can use either diodes or threshold phenomena, LEDs offer
both so you can drive those tri-colour (R-Y-G) matrices quite easily
this way. That said, it is actually *easier* to drive them if they use
the three-wire versions of tri-colour LEDs.
Using PICs, you can drive a column of data at a time, directly from
the PIC with a column driver (NPN emitter follower) to take the heavier
current. You can do this without TRIS, but using TRIS you can use the
same drive pins (bar 1) to select columns as well. This allows n(n-1)
LEDs to be driven brightly.
Take a four-point matrix (i.e., two "rows", two "columns") of back-to-
back LEDs (i.e., eight of them) and energise one row-column pair. The
other three pairs are indeed in series, paralleled across this, but as
their threshold voltage is three times the first, they do not light.
Excuse me if I am not understanding this, but this circuit would
only work if the power source is unidirectional. If you use a
PIC to drive the rows and columns, each column or row would
source as well as sink current, and two LEDs would be on
at a minimum. You would have to add diodes so the columns
could only source, and the rows could only sink, or vice versa.
[a]--------------------------+
r |
[b]-------------+----->|-----+
+-----|<-----+
+--+ g +--+
r| | g| |
- V - V
^ - ^ -
| |g | |r
+--+ r +--+
+-----|<-----+
[c]-------------+----->|-----+
g |
[d]--------------------------+
Energise +V to a, Gnd to b, let c and d float, the a-b Green LED will
light; The b-c, c-d, and d-a red LEDs will have a total 1.4V across
them (as the green a-b LED is LIT!) thus will still not light.
It's SNEAKY, but I like it! (I assume a small resistor is put in each
led [a, b, c, d], right? Half the needed resistance to limit 5V through
the diodes, basically?)
John Shreffler wrote:
>
> Excuse me if I am not understanding this, but this circuit would
> only work if the power source is unidirectional. If you use a
> PIC to drive the rows and columns, each column or row would
> source as well as sink current, and two LEDs would be on
> at a minimum. You would have to add diodes so the columns
> could only source, and the rows could only sink, or vice versa.
>
> John Shreffler
> [a]--------------------------+
> r |
> [b]-------------+----->|-----+
> +-----|<-----+
> +--+ g +--+
> r| | g| |
> - V - V
> ^ - ^ -
> | |g | |r
> +--+ r +--+
> +-----|<-----+
> [c]-------------+----->|-----+
> g |
> [d]--------------------------+
> It's SNEAKY, but I like it! (I assume a small resistor is put in
> each led [a, b, c, d], right? Half the needed resistance to limit 5V
> through the diodes, basically?)
Minor corrections; the limit resistors here go only in the a and c or
b and d lines, and are the whole value needed to limit the current. If
you were to put resistors in each LED (pair) line, it would at higher
voltages defeat the threshold effect.
Now note that this is the sub-optimal circuit - I proposed it merely
to explain the threshold concept easily. The version *optimised* for
number of diodes per pin also contains diode pairs across each diagonal
totalling twelve diodes for four lines or n(n-1) diodes for n lines.
This would require a resistor for each drive line.
The *fully* optimised circuit uses emitter followers (hopefully
packaged arrays?) driving each matrix line thus:
O +Vdd
|
/
|/
PIC o--+---| NPN driver
| |V
| \
| |
+-VVV--+-----o Matrix point
R
.. where R is (Vdd - 0.6 - 1.4 - Vol) Vdd= supply voltage
_______________________ 0.6= Vbe for driver
1.4= LED drop
Iseg Vol= PIC drive offset @ Iseg
Iseg= LED drive current
When driven low, R limits PIC current for one individual LED
"segment". When driven high, the NPN driver buffers enough current for
all LEDs whose anodes share that matrix point to be driven
simultaneously, albeit within the capability of the PIC total sink
current.
Nine PIC pins and nine buffer transistors permit nine 7-segment
common-anode digits (including decimals) to be multiplexed in a nine-
phase strobe at 15mA per segment (should be quite a bright display!).
Each PIC pin drives an anode common for one digit and one cathode
segment for each of the other eight digits.
[a]--------------------------+
r |
[b]-------------+----->|-----+
+-----|<-----+
+--+ g +--+
r| | g| |
- V - V
^ - ^ -
| |g | |r
+--+ r +--+
+-----|<-----+
[c]-------------+----->|-----+
g |
[d]--------------------------+
Energise +V to a, Gnd to b, let c and d float, the a-b Green LED will
light; The b-c, c-d, and d-a red LEDs will have a total 1.4V across
them (as the green a-b LED is LIT!) thus will still not light.
It's SNEAKY, but I like it! (I assume a small resistor is put in each
led [a, b, c, d], right? Half the needed resistance to limit 5V through
the diodes, basically?)
John Shreffler wrote:
>
> Excuse me if I am not understanding this, but this circuit would
> only work if the power source is unidirectional. If you use a
> PIC to drive the rows and columns, each column or row would
> source as well as sink current, and two LEDs would be on
> at a minimum. You would have to add diodes so the columns
> could only source, and the rows could only sink, or vice versa.
>
> John Shreffler
A minor enhancement to your circuit, Paul. Connect the collectors of the
NPN transistors directly to the unregulated supply and size the transistors
for the expected dissipation. Keeps the 5v supply nice and small and
doesn't cost much to do.
What exactly are we trying to drive with this circuit? It seems
that the resistor as shown is doing nothing useful, because this is a
follower circuit. (Resistor as shown is configured to help
turn off the npn transistor. We do that in darlingtons to remove
the stored base charge in the second transistor. But not here)
If we want current limiting, we place the resistor between the emitter
and the anode(s) of the LEDs in that matrix line.
> From: Dwayne Reid <spamBeGonedwaynerSTOPspamEraseMEPLANET.EON.NET>
> To: KILLspamPICLISTspamBeGoneMITVMA.MIT.EDU
> Subject: Re: loads of flashing LEDs
> Date: Thursday, July 23, 1998 11:58 AM
>
> A minor enhancement to your circuit, Paul. Connect the collectors of the
> NPN transistors directly to the unregulated supply and size the transistors
> for the expected dissipation. Keeps the 5v supply nice and small and
> doesn't cost much to do.
>
>
> > The *fully* optimised circuit uses emitter followers (hopefully
> >packaged arrays?) driving each matrix line thus:
> >
> > O +Vdd
> > |
> > /
> > |/
> >PIC o--+---| NPN driver
> > | |V
> > | \
> > | |
> > +-VVV--+-----o Matrix point
> > R
>
>
> Dwayne Reid <EraseMEdwaynerEraseMEplanet.eon.net>
> Trinity Electronics Systems Ltd Edmonton, AB, CANADA
> (403) 489-3199 voice (403) 487-6397 fax
> A minor enhancement to your circuit, Paul. Connect the collectors of
> the NPN transistors directly to the unregulated supply and size the
> transistors for the expected dissipation. Keeps the 5v supply nice
> and small and doesn't cost much to do.
Brilliant Dwayne! (I probably thought of that at some time but forgot
it again ;-)
______
Father Tom (is it?). We are talking about driving a full
combinatorial LED matrix, that is there is a LED wired from any matrix
point *to* any other, thus there are two back-to-back LEDs directly
between *each* two matrix points. This means for n matrix points (PIC
lines) you can drive n(n-1) LEDs.
I gave as a typical example, fully driving eight, eight segment (seven
plus DP) LED displays with nine PIC pins, nine transistors and nine
resistors = full component inventory for this function.
The CUD (Circuit Under Discussion) is the driver for each PIC pin to
the array. It is an asymmetric tri-state driver which permits an n-
phase anode-side multiplexing (strobe), allowing multiple cathode lines
to be driven simultaneously for maximum brightness. Of course it can be
used in the same fashion for any dot-addressable display mode (the
popular times-square display etc.).
It is easier if the displays are common anode. The actual wiring of
the segment linees to the drive points and the consequences in the PIC
routines are at this point "an exercise for the reader", but once every-
one is happy about the hardware principles, I forsee a little discussion
on code.
--
Cheers,
Paul B.
>What exactly are we trying to drive with this circuit? It seems
>that the resistor as shown is doing nothing useful, because this is a
>follower circuit.
There are several (4 or more) driver circuits driving a LED matrix. The
resistor is the current limit when the PIC output is LO. The transistor
provides current gain so that multiple LEDs can be turned on when its PIC
output is HI. Unlit LEDs have the PIC output tristated during that portion
of the scan cycle. Yes, the resistor also serves to keep the transistor
turned off when it is supposed to be off. But you size the resistor
according to the desired LED current.
4 drivers will control 12 LEDs. Up to 3 LEDs can be lit during each step of
the scan. 5 drivers will control 20 LEDs, with up to 4 LEDs being lit
during each part of the scan. The transistors allow the number of scan
steps to be held to the number of driver stages without compromising LED
brightness.
> From: Dwayne Reid <spamBeGonedwaynerKILLspamPLANET.EON.NET>
> To: .....PICLISTspam_OUTMITVMA.MIT.EDU
> Subject: Re: loads of flashing LEDs
> Date: Thursday, July 23, 1998 11:16 PM
>
> >What exactly are we trying to drive with this circuit? It seems
> >that the resistor as shown is doing nothing useful, because this is a
> >follower circuit.
>
> There are several (4 or more) driver circuits driving a LED matrix. The
> resistor is the current limit when the PIC output is LO. The transistor
> provides current gain so that multiple LEDs can be turned on when its PIC
> output is HI. Unlit LEDs have the PIC output tristated during that portion
> of the scan cycle. Yes, the resistor also serves to keep the transistor
> turned off when it is supposed to be off. But you size the resistor
> according to the desired LED current.
>
> 4 drivers will control 12 LEDs. Up to 3 LEDs can be lit during each step of
> the scan. 5 drivers will control 20 LEDs, with up to 4 LEDs being lit
> during each part of the scan. The transistors allow the number of scan
> steps to be held to the number of driver stages without compromising LED
> brightness.
>
>
> >> >
> >> > O +Vdd
> >> > |
> >> > /
> >> > |/
> >> >PIC o--+---| NPN driver
> >> > | |V
> >> > | \
> >> > | |
> >> > +-VVV--+-----o Matrix point
> >> > R
>
> I can draw a full schemo if that helps.
>
> dwayne
>
>
> Dwayne Reid <TakeThisOuTdwayner.....TakeThisOuTplanet.eon.net>
> Trinity Electronics Systems Ltd Edmonton, AB, CANADA
> (403) 489-3199 voice (403) 487-6397 fax
Thomas McGahee wrote:
> I forgot that you were using this as a bi-directional driver.
> Now the purpose of R being where it is makes sense.
> High drives via follower, and Low drives via R. Clever!
Yes, now I finally understand too. Ingenious.
I think I might use this idea, but I would imagine the coding to be a
challenge.
I'm liking this idea more and more myself. Oringinally I
didn't care much for it because as someone else mentioned,
different look up tables for different digits. Don't know
if someone else has pointed it out and I didn't see it, but
for 9 7seg +dp displays the coding would be easy. Just
shift the connections by one for each digit. Use the carry
as the common, read the table, and rotate. Just wire each
digit differently..
Disp 0: 0 a b c d e f g p
Disp 2: b c d e f g p 0 a
All of a sudden easy to use with one code table. Anyone
have some good code to do a rotate through one byte w/o
carry for 8 7 segments on just one port? May just be easier
to waste a pin but I hate to waste a pin due to lack of
coding. Not to mention I'd rather just have 8 locations to
pump out for scanning and not have to store and find the 9th
bit if I don't need it..
Alan
James Cameron wrote:
> Yes, now I finally understand too. Ingenious.
>
> I think I might use this idea, but I would imagine the coding to be a
> challenge.
>
> I think I might use this idea, but I would imagine the coding to be a
> challenge.
Well, the coding to operate a random LED array of course would be much
the same whichever way you do it, but I presume you refer to the driving
of seven-segment displays from a lookup table. I don't think it's that
hard!
Considering the case of nine displays, driven by the eight bits of
port B and one from port A. As I see it, you end up with a segment mask
derived from the lookup table for the desired digit (character) value,
plus a position mask for the particular display.
The position mask is used to set the port register (B) (sets "strobe"
line) and is used to mask the corresponding bit (if indeed, any) of
character to be transferred to the "wild" bit in tris register A. It is
then used to mask *out* a bit of character before writing this value to
tris B, and the "wild" bit of port A is set if position (and thence port
B) was zero. Much easier to tabulate than describe:
"Position" 12345678 ("0"=ninth position) A
e.g. 00010000 (fourth digit) F B
G
"Character" pabcdefg ("p"=decimal point) E C
e.g. 01111001 (digit "3") D
Port B 00010000 Position
Tris B 10000110 .NOT. (Position .OR. Character)
Port A 000nnnn0 Bit 0 = (position == 0)
Tris A 000xxxx0 Bit 0 = (position .AND. .NOT. Character)
This coding is for a character code where 1 = lit to make the bitmaps
easier to read and code.
The hardware structure to implement this is quite simple. There are
eight port B drive lines distributed as segment drives (cathode) to all
digits. Each digit in turn takes its common anode drive from one of
these lines and for that digit, the segment drive which is usurped comes
from the ninth, "wild" line instead. The ninth digit of course takes
its common anode drive from the wild line.
Hey, I'm not infringing anyone's patent here, am I?
--
Cheers,
Paul B.