LED Strips


Results 1 to 9 of 9

Thread: LED Strips

Threaded View

  1. #7
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: LED Strips

    I have a bunch of experience with the WS2801 based strips, which you can run using shiftout pretty easy. You basically shift in your bits on the data line with each pulse of the clock line if i remember correctly something like this for the WS2801 Strips (my favorite):

    Code:
    noLEDs           CON   32         ' Change this number to number of LEDs in your strip
    
    shftMode        CON   1           ' Shift data out highest bit first. Clock idles low
    
    LEDsDAT         VAR PORTE.0   ' Shift out data port, change as needed
    
    LEDsCLK          VAR PORTE.1   ' Shift out clock port, change as needed 
    
    i                    VAR    Byte     ' Loop variable
    
    Main:
    
    FOR i TO noLEDs                   ' We have to either shift allllllllll the data bits out at once to all LEDs in one SHIFTOUT or for one RGB LED at a time in a loop, much easier this way!, lots of ways to do this.
    
    SHIFTOUT LEDsDAT, LEDsCLK, shftMode, [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] 'Shift out 24 bits to one RGB LED at a time - should be all LEDS ON (can be varibles too)
    
    NEXT i                               ' Loop till all LEDs loaded
    
    i = 0                                 ' Please be kind, rewind.
    
    PAUSE 1000                      ' For human eyes to be able to see that them LEDs are ON
    
    FOR i TO noLEDs                ' Rinse, Repeat - but turn them all off this time
     
    SHIFTOUT LEDsDAT, LEDsCLK, shftMode, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] 'Shift out 24 bits - should be all LEDS OFF (can be varibles too) 
    
    
    NEXT i                           ' A little loopy                             
    
    PAUSE 1000                    ' For human eyes to be able to see that them LEDs are OFF (ever wonder if the fridge light is still on when you close the door?)
                   
    GOTO Main                     ' Do it till the cows come home!
    
    END                              ' My only friend, The end... (fridge door, The Doors, whatever)
    The problem is a lot of newer strips use weirder data protocols which are very timing sensitive. You can make them work, but your PIC is probably going to be dedicated to that, with another pic telling it what to do without a lot of work with interrupts and assembly. Thats why I try to stick to WS2801s

    ALSO! if you are driving a bunch of LEDs on your strips, like 32/M in my example, you have to have enough current to drive your strips!!! you also may need to buffer the data and clock lines to be able to drive a bunch of LED controller chips too!!!

    -Ryan
    Last edited by Ryan7777; - 9th September 2014 at 19:49.

Similar Threads

  1. Addressable RGB LED's & LED strips
    By spcw1234 in forum General
    Replies: 24
    Last Post: - 17th December 2017, 09:56
  2. Free LED lights and LED strips
    By mistrip in forum Adverts
    Replies: 0
    Last Post: - 18th May 2012, 04:44
  3. LED Bargraph chip (guitar LED bling-age) ..do with a PIC?
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 12th July 2009, 23:15
  4. Replies: 3
    Last Post: - 5th December 2008, 15:00
  5. Led + resistor ?
    By ruijc in forum General
    Replies: 7
    Last Post: - 10th March 2008, 20:33

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts