[sci.electronics] Design a bar graph

tindle@ms.uky.edu (Ken Tindle) (11/03/90)

I have three binary lines, for eight possible states (yeah, oh wow).  How
can one light seven LED's from this, with zero having all LED's off and
seven lighting all seven of them, in bar graph fashion?  A dot display is
easy, but bar is tougher.  As a final touch, one should tax each digital
line with but one standard TTL load. 

I can think of two ways to implement this, but they both seem like too many
parts have to be used.  I wonder if anyone has a brainstorm out there.  It's
a bit surprising how tough this problem was (at least to me).

In real life, it wouldn't be a big deal to just use a moving dot, but I like
to tell Joe A. Electron what to do, not have him laugh at me.  I hate it
when that happens! 

--------------------------\ /-----------------------------------------------
INTERNET:tindle@ms.uky.edu | "Could you please continue the petty bickering?
BITNET: tindle@ukma.bitnet |  I find it most intriguing."   ---    Data, 
Ken Tindle - Lexington, KY |  Star Trek, The Next Generation, "Haven"
--------------------------/ \-----------------------------------------------

norlin@uokmax.ecn.uoknor.edu (Norman Lin) (11/03/90)

tindle@ms.uky.edu (Ken Tindle) writes:

>I have three binary lines, for eight possible states (yeah, oh wow).  How
>can one light seven LED's from this, with zero having all LED's off and
>seven lighting all seven of them, in bar graph fashion?  A dot display is
>easy, but bar is tougher.  As a final touch, one should tax each digital
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>line with but one standard TTL load. 
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If I understand this restriction, this pretty much rules out any solution
involving a demultiplexer, since one would need several OR gates connected
to the demultiplexer output, each OR gate having one input from the current
output line and another from the previous (i.e. line 4 would go high either
if line 4 was selected from demultiplexer input 010 OR if line 5 was high,
since we want a bar graph, line 5 -> line 4 which similarly -> line 3 ->
line 2 -> line 1, so we get a continuous 1-2-3-4-5 bar output).  Thus,
the only solution I see (and you are right, it is a bit surprisingly,
and, I might add, annoyingly, difficult!) is to use some sort of an arithmetic
unit with binary or perhaps BCD output, since only this way can you control
all 7 lines independently and simultaneously (as needed for your bar graph)
while still only "taxing each digital line with but one standard TTL load."
Stated in the following manner, the problem may perhaps be more easily solved:

   Given the binary number 000, what do I do to get the binary number 000 0000?
                           001                                        000 0001
                           ...                                        ... ....
                           110                                        011 1111
                           111                                        111 1111

I see no trivial solution to this, but I do believe looking at the problem
this way may help in finding its solution.

Of course the brute-force least-parts solution is to write out the entire
truth table and use a PLA... :-)

>I can think of two ways to implement this, but they both seem like too many
>parts have to be used.

What were your methods?

>--------------------------\ /-----------------------------------------------
>INTERNET:tindle@ms.uky.edu | "Could you please continue the petty bickering?
>BITNET: tindle@ukma.bitnet |  I find it most intriguing."   ---    Data, 
>Ken Tindle - Lexington, KY |  Star Trek, The Next Generation, "Haven"
>--------------------------/ \-----------------------------------------------
-- 
\    /\/\    /\/\        +-----------------------------+    /\/\    /\/\    /./
\\  /./\\\  /./\\\  /====|Norman Lin/norlin@129.15.20.2|===/./\\\  /./\\\  /./
\\\/./  \\\/./  \\\/./===| norlin@uokmax.ecn.uoknor.edu|====/  \\\/./  \\\/./
 \/\/    \/\/    \/\/    +-----------------------------+        \/\/    \/\/

totty@flute.cs.uiuc.edu (Brian Totty) (11/04/90)

> I have three binary lines, for eight possible states (yeah, oh wow).  How
> can one light seven LED's from this, with zero having all LED's off and
> seven lighting all seven of them, in bar graph fashion?  A dot display is
> easy, but bar is tougher.  As a final touch, one should tax each digital
> line with but one standard TTL load. 

	I have seen a data sheet sometime in the last month that did what I
	think you want.  It could either display a bargraph (all LEDs
	up to value on) or just a single LED for the value.  It even provided
	for the cascading of these chips appropriately.  Unfortunately, I
	can't seem to find the data sheet for it now.  I'll keep looking.

	As a related question, are there any 4 bit -> 7-segment LED
	decoder/driver chips that represent the 4 bits in Hexadecimal
	rather than BCD with garbage for the top 6 values?


   /                      Brian Totty              o o
  /__  __  o       1304 W. Springfield Avenue       o  
 /  / /   /             Urbana, IL 61801           \_/  "We have corn in
/__/ /   /             totty@cs.uiuc.edu                Massachusetts too!"

chuck@mitlns.mit.edu (11/04/90)

-Message-Text-Follows-

In article <16307@s.ms.uky.edu>, tindle@ms.uky.edu (Ken Tindle) writes...

>I have three binary lines, for eight possible states (yeah, oh wow).  How
>can one light seven LED's from this, with zero having all LED's off and
>seven lighting all seven of them, in bar graph fashion?  A dot display is
>easy, but bar is tougher.  As a final touch, one should tax each digital
>line with but one standard TTL load. 
> 

  Probably no better than your solution but here are 2 ways I can think
of.  

   1. Use resitors to binary weight your 3 lines and turn it into analogue.
  Then use one of the bar graph driver chips made for stereos. You need
  to find one that has linear levals not logrithmic.

   2. Use 74XX138 (or is it 139) one of eight decoder to get 1 of eight
  lines active low. drive LEDs as follows

                         +-|\
                           | >-----+----|<|----330ohm--5v
             line n+1------|/      |
                                   |
                        +----------+
                        |
                        +--|\
                           | >-----+----|<|----330ohm--5v
             line n--------|/      |
                                   |

      Takes three chips 1 74xx138 and 2 quad and gates. How many did
 it take you?



					Chuck@mitlns.mit.edu

whit@milton.u.washington.edu (John Whitmore) (11/04/90)

In article <1990Nov3.185821.23815@julius.cs.uiuc.edu> totty@flute.cs.uiuc.edu (Brian Totty) writes:
>
>> I have three binary lines, for eight possible states (yeah, oh wow).  How
>> can one light seven LED's from this, with zero having all LED's off and
>> seven lighting all seven of them, in bar graph fashion? 

	If you can connect R/2R/4R resistors to the lines to make an
analog signal out of it, an LM3914 dot/bar display driver will do it.
It comes complete with a single resistor brightness control (fixed 1k ohm
will do for fixed LED current).
>
>	As a related question, are there any 4 bit -> 7-segment LED
>	decoder/driver chips that represent the 4 bits in Hexadecimal
>	rather than BCD with garbage for the top 6 values?
>
	I know of two; in CMOS, there's MC14495.  Made by Motorola, it
includes a four-bit latch, output buffers, and current limiting resistors.
In TTL, the old Fairchild F9368.  Straight TTL (1.6 mA input current),
these were the two WARM chips on the old 1802 ELF board (they drove the
address/data bus readout).  I don't think they have latches (and I
replaced mine with the CMOS as quickly as I could... lo those many years
ago).

		John Whitmore

tindle@ms.uky.edu (Ken Tindle) (11/04/90)

In article <1990Nov3.200047.11252@athena.mit.edu> chuck@mitlns.mit.edu writes:
>In article <16307@s.ms.uky.edu>, tindle@ms.uky.edu (Ken Tindle) writes...
>>I have three binary lines, for eight possible states (yeah, oh wow).  How
>>can one light seven LED's from this, with zero having all LED's off and
>>seven lighting all seven of them, in bar graph fashion?  A dot display is
>>easy, but bar is tougher.  As a final touch, one should tax each digital
>>line with but one standard TTL load. 

Well, I've got four solutions to this now, here's one I didn't think of:

>   [suggests cascaded AND gates]
>      Takes three chips 1 74xx138 and 2 quad and gates. How many did
> it take you?

This is a good solution, wish I'd thought of it!

There are three other answers I see:

o EPROM
o PAL
o change to analog, use LM3914 driver

One can program either an EPROM or PAL, with PAL being a little less wasteful,
to give the right output pattern for any input pattern.  This'd certainly
work, but one must take care to watch dc current drive.

The analog driver approach and EPROM approach were the two I thought of.
The EPROM needed programming and buffering, and the analog was just.. kinda
messy.

Glad I posted, since the AND solution is probably the one I'll use, and I
didn't think of it at all.  Would use a PAL, but just don't have all the 
pieces needed here to make it work.  But now I have the incentive! 

--------------------------\ /-----------------------------------------------
INTERNET:tindle@ms.uky.edu | "Could you please continue the petty bickering?
BITNET: tindle@ukma.bitnet |  I find it most intriguing."   ---    Data, 
Ken Tindle - Lexington, KY |  Star Trek, The Next Generation, "Haven"
--------------------------/ \-----------------------------------------------

ardai@teda.UUCP (Mike Ardai) (11/04/90)

In article <16307@s.ms.uky.edu> tindle@ms.uky.edu (Ken Tindle) writes:
-I have three binary lines, for eight possible states (yeah, oh wow).  How
-can one light seven LED's from this, with zero having all LED's off and
-seven lighting all seven of them, in bar graph fashion?

How about a ROM?  Just use an 82s123 PROM (or even a 2716 EPROM), feed
your three bits into the low address bits, ground all the rest, and drive 
your LEDS (through a buffer if needed) from the data bits.
/mike

-- 
\|/  Michael L. Ardai   Teradyne EDA East
--- -------------------------------------------------------------------------
/|\  ...!sun!teda!ardai (preferred)  or ardai@bu-pub.bu.edu

cgordon@vpnet.chi.il.us (Crash Gordon) (11/05/90)

>Author: [Ken Tindle]
>I have three binary lines, for eight possible states (yeah, oh wow).  How
>can one light seven LED's from this, with zero having all LED's off and
>seven lighting all seven of them, in bar graph fashion?

Easy.  Use the smallest EPROM you can program. Apply your three binary
signals to three bits of the address bus.  (Preferably the three LSBs, but
it doesn't realy matter).  Now program the chip so that the data output
presents the desired LED pattern for each valid input.

>As a final touch, one should tax each digital
>line with but one standard TTL load. 

And so it does.


>Author: [Brian Totty]
> As a related question, are there any 4 bit -> 7-segment LED
> decoder/driver chips that represent the 4 bits in Hexadecimal
> rather than BCD with garbage for the top 6 values?

See above.  (Although this doesn't get you a driver, it does do the decode.)

This technique can do all kinds of weird translations and lookups.  In fact,
with a counter on the address input and PWM-type data, low-quality audio can
be reproduced.  Just run the data lines directly to an amplifier/speaker. 
You can store 8 phrases (well, words -- unless you've got BIG EPROMs :-), or
chain the data bits together for one longer phrase.  I've fit "Hello" on one
bit of a 27256 ...

----------------------------------------------------------------
Gordon S. Hlavenka                       cgordon@vpnet.chi.il.us
Disclaimer:        "EPROMs:  They're not just for code anymore!"

phillip@bartal.CRLABS.COM (Phillip M. Vogel) (11/06/90)

In article <16307@s.ms.uky.edu> you threw down the gauntlet:
>I have three binary lines, for eight possible states (yeah, oh wow).  How
>can one light seven LED's from this, with zero having all LED's off and
>seven lighting all seven of them, in bar graph fashion?  A dot display is
>easy, but bar is tougher.  As a final touch, one should tax each digital
>line with but one standard TTL load. 
>
>I can think of two ways to implement this, but they both seem like too many
>parts have to be used.  I wonder if anyone has a brainstorm out there.  It's
>a bit surprising how tough this problem was (at least to me).
>

Ok, either use a ROM, PROM, PAL, PEEL, FPGA, FPLA,
Microproccessor, or whatever. But seriously, folks, this aint so
hard.

Use something like an NE590 (Signetics 3 to 8 demux), which is
something like a 74138 with high current high voltage open
collector outputs.  Put all the LEDs in series with a ~20 mA
current source driving one end (the anode), and the cathodes
tied to each output of the 590. The only catch is that your
current source has to be able to put out a voltage of about 15 or
so volts, depending on the LEDs you use.

BTW, I didn't look up the specs on the 590, so I suppose it's
possible that the inputs represent more than one load. if so, the
you gotta use input buffers.

( these ->|- things are supposed to be LEDs )
         ____
20 mA>>> ____|-->|->|->|->|->|->|->|-		    
                  |  |  |  |  |  |  |
                  |  |  |  |  |  |  |
              +---+--+--+--+--+--+--+--+
              |   Q1 Q2 Q3 Q4 Q5 Q6 Q7 |
              |                        |
              |  I0    I1    I2        |
              +--+-----+-----+---------+
                 |     |     |
Hey. if it don't work, well, it's worth what you paid for it; and
if it DOES work, well, gimme a dollar (hi Chris!).

Another FREE design from....
--
Phillip M. Vogel, President             | #include <standard_disclaimer.h>
Bartal Design Group, Inc. Englewood, NJ | (201)567-1343   FAX:(201)568-2891
UUCP: pyrnj!bartal!phillip              | Domain: phillip@bartal.crlabs.com

tindle@ms.uky.edu (Ken Tindle) (11/07/90)

In article <423@bartal.CRLABS.COM> phillip@bartal.CRLABS.COM (Phillip M. Vogel) writes:
>Use something like an NE590 (Signetics 3 to 8 demux), which is
>something like a 74138 with high current high voltage open
>collector outputs.  Put all the LEDs in series with a ~20 mA
>current source driving one end (the anode), and the cathodes
>tied to each output of the 590. The only catch is that your
>current source has to be able to put out a voltage of about 15 or
>so volts, depending on the LEDs you use.

OK, this is solution #5.  I received mail from Brian Rhodefer from Tek
suggesting the same thing, but he substituted a 7445, which might be a
bit more common.

I'm curious as to the implementation of the current source, though.  What
are some favorite current source circuits?

I think National has a chip in a TO-92 case that does something like this.

--------------------------\ /-----------------------------------------------
INTERNET:tindle@ms.uky.edu | "Could you please continue the petty bickering?
BITNET: tindle@ukma.bitnet |  I find it most intriguing."   ---    Data, 
Ken Tindle - Lexington, KY |  Star Trek, The Next Generation, "Haven"
--------------------------/ \-----------------------------------------------

brianr@tekig5.PEN.TEK.COM (Brian E Rhodefer) (11/08/90)

In article <1990Nov3.200047.11252@athena.mit.edu> chuck@mitlns.mit.edu writes:
>
   (Tedious-to-enter circuit diagram deleted)
>
>      Takes three chips 1 74xx138 and 2 quad and gates. How many did
> it take you?
>
>
>					Chuck@mitlns.mit.edu

One chip:  A 7445 open-collector binary-to-decimal decoder/driver.

The seven LEDs can be wired in series, with the cathode end of the
string going to output 7 of the decoder, and successive cathode/anode
node pairs going to outputs 6 through 1.  Wire the anode end of the
string to output 0, and apply a 20mA current source that has enough
voltage compliance to push through all seven LEDs.  Whichever output
of the 7445 gets turned on will shunt the current to ground, preventing it
from flowing through however many LEDs are "downstream" of that output.
All the LEDs up to that output carry the current, and therefore light up.


Brian Rhodefer

tom@syssoft.com (Rodentia) (11/15/90)

In article <273510f4-521.3sci.electronics-1@vpnet.chi.il.us> cgordon@vpnet.chi.il.us (Crash Gordon) writes:
>
>>Author: [Ken Tindle]
>>I have three binary lines, for eight possible states (yeah, oh wow).  How
>>can one light seven LED's from this, with zero having all LED's off and
>>seven lighting all seven of them, in bar graph fashion?
>
 [response deleted, it's just that the original article expired]
>
>>As a final touch, one should tax each digital
>>line with but one standard TTL load. 
>

   I finally worked this one out in a way I think Ken wanted,
it's one load each input, and each output may have one additional
load other than the LED, and there is an increasing prop delay.

   It uses eight OR gates, you can break the O0 LED and it's seven
LED's just like you said.  Also, I left off the decoder in this case, 
but just put it on I7..0.


GND-+
    |
I7___=D-+-------------------------------O7
        |
I6_______=D-+---------------------------O6
            |
I5___________=D-+-----------------------O5
                |
I4_______________=D-+-------------------O4
                    |
I3___________________=D-+---------------O3
                        |
I2_______________________=D-+-----------O2
                            |
I1___________________________=D-+-------O1
                                |
I0_______________________________=D-----O0

Legend:
=D-  or gate
+    dot (for connection)

   Hope this is close to what you wanted.  Three parts (decoder
and two quad OR gates).  A PAL might fit it all, or maybe a 
22V10.  As was stated, a PROM would definitely do it in one part.

-- 
Thomas Roden                            tom@syssoft.com
Systems and Software, Inc.              Voice:  (714) 833-1700
                                        FAX:    (714) 833-1900