How would you do it? 16 led's

jmumby

Senior Member
Isn't it funny how they have about 8 different versions of a datasheet for the same chip with tiny differences? For example a 4514 Latched 4-16 decoder. On one sheet it says that the input data is held and released to the outputs on a strobe. While another says the last data input is held and sent to an output on a strobe.

Where is this going? Well I want to turn on and off 16 leds, individually or 2,3 or 16 at a time. I figured I could load up the outputs on this chip strobe it and get a result. It seems the later description is true unfortunately as I can only turn on one LED at a time.

Anyone have a chip to control 16 individually controlled LED's, charlieplex free zone. I did do a loop but once you get to 16 lots of data the flashing gets a bit epileptic.
 
Last edited:

hippy

Technical Support
Staff member
The 4514 descriptions aren't confusing to me, even with the different wording; the four data inputs are latched when strobed, then those four latched lines are used by the 4-to-16 decoder to assert one of the 16 lines depending on the four bit values, the other lines being de-asserted.

I don't off-hand know of a single chip which can control 16 outputs but a pair of 8 outputs each will do the job. For using minimal I/O, any of the shift-registers with output latches or 74xx259 bit addressable latch should do. If you want multiple I/O to change simultaneously shift register is the way to go.
 

Buzby

Senior Member
Look at the datasheet diagram for the 4514.

You will see that the strobe locks the data on the 4 input lines into the 4 latches.

Then the 4-to-16 decoder drives 1 of 16 outputs, according to the state of the latches.

This means it can only turn on 1 LED at a time.

The 595 option one solution, or take a look at the MM5451, it can drive any combination of upto 35 LEDs directly.

( There may be a more modern equivalent of the MM5451, but I'm building a project with one at the moment out of my junk box, so I didn't look any further. )
 

hippy

Technical Support
Staff member
That MM5451 would be ideal, Rapid used to stock it but it seems to have disappeared off the radar last time I looked - I thought it had gone obsolete years ago so was surprised to see it resurface on Rapid; should have bought some while in stock :-(

Added : Farnell has some MM5451 in stock. Rapid do a "16-bit SMD LED Display drivers" but, as it indicates, SMD, but fairly cheap.
 
Last edited:

westaust55

Moderator
Food for thought:

Since you have a PICAXE 18X which has i2c comms, another option is a single MCP23017 IO expander chip.

These chips have two 8-bit ports. Each of the 16 pins can be an input or output.
With all 16 as outputs and in the right mode, you could send two bytes (total 16 bits) in a single i2c command.

For example: writei2c location, (b0, b1)

While the 75HC595 method will work well, from some past tests I did, the mCP23017 will be about twice the speed compared to the SHIFTOUT command on an X1 part and thus likely about 4 time the speed of bit-banging on non X1/X2 parts.
 

eclectic

Moderator
It'll cost a little more, but a 28X1 / 28X2 is
easily available, and easy to code.

Sender for testing
Code:
#picaxe 18x ; test sender
setfreq m4 
main:
for b0 = 0 to 255
b1 = b0/2

serout 7,n4800,(b0,b1)
pause 100
next
goto main
receiver 28X1 or 28X2
Code:
#picaxe 28x1  ;V.2 needs timeout?
setfreq m4

let dirsC = %11111111

again:
main:
serrxd [1000,again],b0,b1

let Outpins  = b0
let pinsC    = b1

goto main

#rem
#picaxe 28x2
setfreq m4 ; needed for 4800baud

let dirsB = %11111111
let dirsC = %11111111

main:
serrxd b0,b1

let pinsB = b0
let pinsC = b1

goto main
Could you manage with 15 LED's?
a 20X2 would work well.

e
 

kranenborg

Senior Member
Another option: MAX6956 (I2C driven) with individual LED brightness control ... (but the MCP23017 is excellent if you do not intend to use brightness control)

/Jurjen
 
Last edited:

jmumby

Senior Member
Thanks everyone

Looks like two 595's will be the go as I can't source MM5451's in NZ or any of the other funky suggestions. Shift registers were the intial go but I wanted a one chip wonder and my half reading led me to my doom.
 

westaust55

Moderator
Nothing wrong with the 74HC595 approach.
\
You may/might be able to increase the PICAXE clock from 4MHz to 8MHz provided the speed increase does not impact on other code or hardware.
 

BCJKiwi

Senior Member
The 'one chip wonder' MCP23017 is available 'in NZ' from Futurlec.com at very reasonable postage ex Thailand - check them out!
 

jmumby

Senior Member
See post #2:)
Well a a 40X is $36.00 and I have lots of 18x's kickin around and the 4-16 chip was about $4 so essentially a $4 project with spares. Now it's a $9 project so I'm happy. Although Im getting my picaxe stuff via sparkfun now, at 71cent to the dollar picaxe chips are half price.
 

westaust55

Moderator
Well a a 40X is $36.00 and I have lots of 18x's kickin around and the 4-16 chip was about $4 so essentially a $4 project with spares. Now it's a $9 project so I'm happy. Although Im getting my picaxe stuff via sparkfun now, at 71cent to the dollar picaxe chips are half price.
For reference, the MCP23017 that I mentioned at post 8 and that BCJKiwi has also mentioned are available thru Futurlec for AUD$1-50. Buy some extras and a handfull of other bits at the same time and postage is AUD$4 for the lot delivered from Thailand in about a week.
 
Top