16-Channel LED Drivers


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Or

    If you really don't want dimming or blinking the LED why don't you go for an i/o expander chip such as MCP23016. I2C controlled and you can even use it as inports for different stuff.

    Best invention since canned beer!

    They do the same job as a led driver but you have alot less registers to fight with.

    /me

  2. #2
    Join Date
    Feb 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jumper View Post
    why don't you go for an i/o expander chip such as MCP23016
    Check out National's Funlight driver. http://www.national.com/mpf/LP/LP3943.html
    I would consider the above if the source/sink wasn't so low, I would like a little more available juice. I know for most LED applications the 25mA will work but I would still prefer a little bit more.

    The TLC5940 gives me 120mA a channel, part of the reason I picked that one.
    Last edited by Sponge Bob; - 13th February 2009 at 10:32.

  3. #3
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Sponge_Bob,

    I think I've got your solution. I've been doing similar things with LEDs lately and my favorite driver IC to date is the SP16DP05. It has 16 channels and uses a simple SPI interface to the PIC to turn LEDs on or off. I've included a schematic showing several LEDs in series per pin, but you can just as easily use one per channel. I don't immediately recall what the upper current limit of this chip is, but it is healthy. Here's a snippet of code:

    Code:
    	SHIFTOUT SDI, CLK, 1, [16bit_value\16]	' Send data to STP16DP05
    	HIGH LE						' Enable the STP16DP05
    	LOW LE						' Disable the STP16DP05
    Setting 16bit_value to $FF or %1111111111111111 would turn on all the LEDs while sending $00 or %0000000000000000 would turn off all LEDs. Each bit in the 16-bit value controls one of the 16 outputs.

    I also bought an Allegro A6278 which looks to do about the same thing - upper limits are a little lower - and it's almost half the cost of the STP16DP05 on Digikey. I haven't played with it yet, but it should work and hook up nearly the same way if cost is a big concern. Otherwise go with STP16DP05. I hope this helps.

  4. #4
    Join Date
    Feb 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks for the suggestion on chips, the STP16DP05 and A6278 both look like viable options, the higher mA and single max current limiting resistor are exactly what I was looking for.

    I will have to order a few of them for testing.

    Also thanks for the pseudo code, but is there anyway I could beg, plead or cry for a snippet of real code that I could immediately compile and load on a pic16f628a so I could be off and running without the inevitable frustration of one stupid missed syntax or dumb hardware mistake that leads me down the debugging road with no solid working basis?

    I'll pick up the STP16DP05 and A6278 so no preference on what one the code is for...

    Nothing fancy even just the all on all off example you hinted at. Just something to build upon.

    I know it sounds lazy and it is no doubt, but many times the frustration takes all the fun out of the hobby and I never get things working.

  5. #5
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Sponge_Bob,

    Tsk, tsk - you're lucky I'm in a generous mode tonight. Alright, first thing to do is open the PBP INC file for the 16F628A and comment out the config line. Assuming you're using Windows and have everything installed in the default locations go to: C:\pbp and open the file named 16F628A.INC. Place a semicolon in front of the line starting with: __config and save the file.

    I've included a schematic to try out. And here's some code to try:

    Code:
    INCLUDE "modedefs.bas"
    asm
            __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF & _BOREN_OFF & _PWRTE_ON
    endasm
    
    DEFINE OSC 4								' Tell the program the oscillator is running at 4 MHz
    CMCON.0 = 1									' Turn off comparators
    CMCON.1 = 1									' Turn off comparators
    CMCON.2 = 1									' Turn off comparators
    VRCON.6 = 0									' Disconnect Vref from RA2
    VRCON.7 = 0									' Vref is powered off
    TRISA = %11111111							' Make all port a pins inputs
    TRISB = %11101000							' Make port b pins 0-2 & 4 outputs and the rest as inputs
    PORTA = $00									' Set all port a pins to low
    PORTB = $00									' Set all port b pins to low
    
    SPI			VAR		PORTB.2					' Serial input to STP16DP05
    CLK			VAR		PORTB.1					' Clock input to STP16DP05
    LE			VAR		PORTB.0					' Enable pin for STP16DP05
    OE			VAR		PORTB.4					' PWM / ON & OFF for LEDs
    LED_value	VAR		word					' Variable used to send data to STP16DP05
    flip		VAR		bit						' Used to determine which direction to scroll LEDs
    
    LOW OE										' Turn on LEDs
    LED_value = $FFFF							' Set LED value equal to $FFFF to turn on all the LEDs
    '***********************************************************************************************
    Test:										' Test Routine - Flash all LEDs once
    	SHIFTOUT SDI, CLK, 1, [LED_value\16]	' Send data to STP16DP05
    	HIGH LE									' Enable the STP16DP05
    	LOW LE									' Disable the STP16DP05
    	PAUSE 500								' Wait for half a second
    	LED_value = $0000						' Set LED value equal to zero to turn off all the LEDs
    	SHIFTOUT SDI, CLK, 1, [LED_value\16]	' Send data to STP16DP05
    	HIGH LE									' Enable the STP16DP05
    	LOW LE									' Disable the STP16DP05
    	PAUSE 500								' Wait for half a second
    '***********************************************************************************************
    ' To do the same thing without sending data to STP16DP05 multiple times, try this:
    	LED_value = $FFFF						' Set LED value equal to $FFFF to turn on all the LEDs
    	SHIFTOUT SDI, CLK, 1, [LED_value\16]	' Send data to STP16DP05
    	HIGH LE									' Enable the STP16DP05
    	LOW LE									' Disable the STP16DP05
    	PAUSE 500								' Wait for half a second
    	HIGH OE									' Turn off all LEDs regards of state of latches on STP16DP05
    	PAUSE 500								' Wait for half a second
    '***********************************************************************************************
    	LOW OE									' Turn on all LEDs where latches are enabled
    	LED_Value = $0001						' Set LED value to %0000000000000001 to turn on first LED
    '***********************************************************************************************
    Main:										' Main Routine - Simple Knight Rider Effect
    	SHIFTOUT SDI, CLK, 1, [LED_value\16]	' Send data to STP16DP05
    	HIGH LE									' Enable the STP16DP05
    	LOW LE									' Disable the STP16DP05
    	IF LED_value = $8000 THEN flip = 1		' If LED value is equal to %1000000000000000, then set flip equal to one
    	IF LED_value = $0001 THEN flip = 0		' If LED value is equal to %0000000000000001, then set flip equal to zero
    	IF flip = 0 THEN						' If flip is equal to zero, then
    		LED_value = LED_value << 1			' Shift LED value to left by one
    	ELSE									' If flip is not equal to zero, then
    		LED_value >> 1						' Shift LED value to left by one
    	ENDIF									' End if statement
    	PAUSE 500								' Wait for half a second
    GOTO Main									' Go to Main routine
    '***********************************************************************************************
    END											' End program should it run awry
    Now, please note that I haven't tried this code out, but hopefully it's enough to get you started. Let me know if you have any problems and good luck!
    Attached Images Attached Images

  6. #6
    Join Date
    Feb 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by elec_mech View Post
    Sponge_Bob,

    Tsk, tsk - you're lucky I'm in a generous mode tonight
    Thank you much, even though I'm a newbie here, I know it's taboo to asked for such, but I honestly learn better by example like this it gives me a much better start on figuring the rest out. I have spent countless hours trying to figure out stupid stuff, and yes I learned how to do it, but I would have learned it just as well if someone set me in the right direction.

    Parts were ordered this weekend so I should have them later this week and can test this all out, hoping for the best.

    Also you had mentioned Digikey for the part, Mouser has then for about $1 cheaper but they don't carry the DIP version but if the SO-24 works for you it might be considered.

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  4. DMX512 and PWM LED Drivers
    By Bronx68 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th September 2007, 04:53
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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