Menu

More than one LED on a pin

Help
2007-01-13
2013-05-30
  • Nobody/Anonymous

    Hello,
    I have read a few articles on Charlieplexing (Driving more than one LED on one output pin). The problem is, they are really confusing and hard to understand. Plus, the code is always in Assembly-- which I don't fully understand.

    I was hoping someone could explain this to me, how to drive more than one led from a pin. This way I can make some LED sign boards. With it, some code would be helpful (especially in GCB, as it is such an awesome language)..
    Thanks so much,
    Omar

     
    • Russ Hensel

      Russ Hensel - 2007-01-13

      I believe this is done using the three output states of the pin, high, low, and high z or input.  You cannot light both led's at once.  If you want full control you really need one pin per led, or some sort of addressable array and latch. Another way is to time multiplex the led's.  Use one bit to select a column and say 8 bits for the leds in the column.  12 bits lets you do 8 by 4.  Each led is only on for 1/4 the time.  Code will not help untill you decide on hardware and approach.  This is not a novice project for large number of led's.  Consider a 40 pin part like the 16F871.  it has ports a thru d.  How many port bits do you need.  I would think a couple of hundred.  Proabably no part has enough pins.  You could use multiple parts.  That has its own complications.  Look a piclist.com and search on led sign boards.  Perhaps there is a canned solution out there.

      Russ

       
    • Nobody/Anonymous

      I just wanted to make a little 4x4 sign bored. I don't know, I can probably live with a smaller one. But I think you are right. My solution would probably be using more pinned devices.

      Thank you!

       
    • Nobody/Anonymous

      You could do this with relays.  For a 4x4, you would need 4 pins connected to relays, and 4 pins for LED's ? 

      Steve

       
    • Nobody/Anonymous

      Expanding on the addressable array latch idea.  An 8X? array could be set up by bit banging a 74hc595 (8-bit serial-in, parallel-out shift register).  These devices are cascadable to create as many columns as you like.  The 595 package can also handle around 600ma, whereas the Pic can only handle 200ma-300ma, depending on the package.  So using a Pic with lots of pins only works if low current leds or transistors are used.

      You could use an 18 pin device like the 16F819, which has a SPI/I2C, and the required open drain data and clock outputs.  Use those pins and one other I/O pin for the register clock, and you are on your way.

      A snippet addressing two 595's, not in GCBasic but you get the idea.

      Sub Shftout()
      Latch = 0                'Start output data latch
          For Clocks = 1 to 16
            Clk = 0            'Shift register clocked
            Data = Dout                   'Serial Data to 595's
            Clk = 1
            Dout.Rshift
          Next Clocks
           
      Latch = 1                               
      End Sub

      Regards,
      Kent

       
    • Russ Hensel

      Russ Hensel - 2007-01-18

      Interfacing LED Displays
      How many light bulbs does it take
      to change a microcomputer port? If
      you are building something using a
      moving message ad display, or just
      want to use lots of LED’s, this can get
      to be a very real question.
      A typical micro port line has three
      states: A high impedance for inputs,
      a logic low output, or a logic high
      output. A LED will only light when a
      current limited voltage of just over
      two volts is applied.
      Note that two or more series LED’s
      will not light if they are in parallel
      with a single lit LED. Because their
      combined thresholds are too high.
      Note also that a LED will withstand
      five volts of reverse voltage. Thus, a
      LED will not light when it is reverse
      biased or if its voltage is too low.
      Figure three shows us a unique
      n-connectedness setup that lets you
      control an amazing 56 LED’s from a
      single 8-bit port.   .....

      this from

      http://www.tinaja.com/glib/muse152.pdf

      Russ

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.