Shop OBEX P1 Docs P2 Docs Learn Events
16 LED Bargraph Display Using BS2 — Parallax Forums

16 LED Bargraph Display Using BS2

Lee_SpeakmanLee_Speakman Posts: 32
edited 2006-02-14 19:41 in General Discussion
As some of you may know im designing a digital tachometer for a car. Id like to have a bargraph display, that will increment as your engine revs increase. I only want to use 4 output pins.

So far ive thought of using a BCD 1-10 chip and cascade them.·The only problem with this is only one LED will be on a time, wherease I want to have it looking like a bargraph, does anyone know of a specialist chip that will do such a task?

I could also use some kind of counter, that will increment by one ever time it recieves a pulse on a pin, and decrements by one if a pulse is recieved on another pin. This would save me 2 more pins. is there a chip avaliable for this too?

I could easily design either of the above drivers, problem is, its going to take multiple chips to do it, and im concerned with PCB space.

Thanks in advance:

Lee S

Comments

  • David BDavid B Posts: 592
    edited 2006-02-11 15:45
    The LM3916 might do what you're looking for.

    David
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-02-11 16:23
    You could always use a 16-bit shift register....

    datasheet: (16-Bit)
    http://www.fairchildsemi.com/ds/74/74F675A.pdf

    ..This would only require 3 I/O pins. This is also
    be comparable to using two 8-bit shift registers.

    http://www.parallax.com/detail.asp?product_id=602-00009

    datasheet: (8-Bit)
    http://www.semiconductors.philips.com/acrobat_download/datasheets/74HC_HCT595_4.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • pjvpjv Posts: 1,903
    edited 2006-02-11 18:08
    Hi Lee;

    So why not use a simply connected SX running at 4 Mhz to drive the 10 bar graph LEDs, and use a serial pin for communications with whatever is generating the bar "signal".

    This would be a way to make your own "specialist chip", and it only uses one (communications) pin. Alternately, of course, you could choose not to do communications, and use 4 pins encoded with the bar info. And to boot, it's all done with a single chip.

    Cheers,

    Peter (pjv)
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-02-11 18:24
    Your right Peter, somehow I was thinking that he wanted a 16 led bargraph.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • pjvpjv Posts: 1,903
    edited 2006-02-11 19:44
    Hi Beau;

    Evenso, with a simple SX20 there are enough pins for 16 leds plus 4 for data.

    Cheers,

    Peter (pjv)
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-11 22:07
    Hi guys,ive considered the LM3916, but it is voltage controlled, and as far as im aware there is no way to vary the voltage of output pins. I could interface it with a frequency to voltage converter such as the LM2917 and use the freq out command, however Its just making things more complecated. I take it the SX is another parallax product? I really would like to use more 'off the shelf' products as in England buying a BS2 I wont have much change from $70. For some reason I never even considered a shift register - I think the expression 'Cant See the Forest for the Tree's' applies here! Thanks everyone will let you know how I get on!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-11 22:11
    On a Digital Dashboard mod I did to a Pontiac Grand Prix some years ago I used the LM3914 with a F-V converter for the analog bar graph section.· On the Stamp you could use the PWM output depending on how much time could be devocted to "re-freshing" that pin, but the buffer circuit could be configured as a sample & hold using an op-amp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-11 22:27
    So depending on how many LED's I want on, I can use the PWM command to vary the 'voltage' from the F-V comverter? I seem to remeber the PWM command doesnt produce a constant frequency and the duty cycle is a bit random over small spaces of time. Would it be able to control the F-V converteraccuratly enough?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-11 22:57
    Lee,

    ·· No, the F-V and BS2 PWM use are mutually exclusive.· You should use one or the other.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-12 20:25
    Hey gents ive found a shift register in my box of bits and id like to try this code out that I found in one of the parallax publications. Probloem is, it wont even tokenize. It has problems on the first line "Clock PIN 0" It says expected : or end of line.

    Im fairly new to Basic stamp and PBASIC so i dont know why this code is wrong, can anyone point me in the right direction?


    ' {$STAMP BS2}

    Clock PIN 0 ' shift clock (74HC595.11)
    SerData PIN 1 ' serial data (74HC595.14)
    Latch PIN 2 ' output latch (74HC595.12)

    DelayTime CON 100

    pattern VAR Byte ' zig-zag pattern

    Reset:
    LOW Latch ' make output and low
    pattern = %00000001

    Main:
    DO
    GOSUB Out_595 ' put pattern on 74x595
    PAUSE DelayTime ' hold
    pattern = pattern << 1 ' shift pattern left
    LOOP UNTIL (pattern = %10000000)
    DO
    GOSUB Out_595
    PAUSE DelayTime
    pattern = pattern >> 1 ' shift pattern right
    LOOP UNTIL (pattern = %00000001)
    GOTO Main

    Out_595:

    SHIFTOUT SerData, Clock, MSBFIRST, [noparse][[/noparse]pattern] ' send pattern to '595
    PULSOUT Latch, 5 ' latch outputs
    RETURN
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-12 20:33
    I think ive sorted the first 3 lines out by changing PIN to CON. Im having the same error messatges pop up with the LOOP UNTIL statements now.
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-12 20:53
    Sorry gents all fixed and working a treat. To many beers i think!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-12 20:58
    Lee you need the PBASIC 2.5 directive in your code for the PIN statement to work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • mediaprefectmediaprefect Posts: 31
    edited 2006-02-14 19:41
    Lee,

    "Hi guys,ive considered the LM3916, but it is voltage controlled, and as far as im aware there is no way to vary the voltage of output pins."

    How about a single pin solution? PWM out on one pin through a diode into an RC filter, charging a cap and bleading off the charge with the resistor. Take that voltage into the LM3916 and drive your LED display. Adjust your RC time constant to suit you application.

    Rick
Sign In or Register to comment.