9-bit Addressable Latch Required - Page 1
Forum section: electronics / beginners

author: Docara
author_rank: Regular Contributor
timestamp: July 08, 2018, 07:52:02 am
content: Hi,I'm using 3 Piezo Switches with RGB LEDs included. The LED's resistors are part of the assembly and the whole device is rated for 12V.I would like to have individual control over each of these LEDs via uC but I cannot multiplex them in the usual way because they are too dim in operation and so I need them on 'statically'The only way I can think off to is a 9-bit addressable latch (8-bit + 4-bit in practice) and just have the uC use 4 I/O pins for the addresses and 1 I/O pin for the data.1. Is there an alternative (better) way to do this2. Just to confirm - the output would always be presentThanksMatt

author: JS
author_rank: Frequent Contributor
timestamp: July 08, 2018, 08:14:14 am
content: 9 bits on a single chip seems odd, pcf8574 is an adressable latch, active high, hi-z low (works as input when low) 8 IO pins, you would only need 2 pins on the micro to drive up to 8 of them, I2C control so adress is selected in the data bus, no external chip select. Pretty common and modules come with those to test as they are used to drive lcd displays and is a very versatile chip.If you need a single chip a 9 bit shift register would do what you nees but it could generate some flikker as you load the data to it. Or a 16 bit serial to parallel converter. I don't know any 9 bits converter...JS

author: Docara
author_rank: Regular Contributor
timestamp: July 08, 2018, 08:20:52 am
content: Hi JS,I know you cant get a 9-bit addressable latch, I need one - that's my problem!Please read my post again I've suggested an 8 and 4The I2C port expander route looks an interesting direction to pursueThanksMatt

author: JS
author_rank: Frequent Contributor
timestamp: July 08, 2018, 08:24:37 am
content: I saw that, but using 2 different ICs for the same task seems odd, and if you are short of pins you can probably use some of those extra 7 anyway, and the ones I said can be used as IO. I2C would be my first choice, even more olif you are counting your pins. 1 wire might hafe some solutions but I2C is the most obvious one to go.JS

author: Docara
author_rank: Regular Contributor
timestamp: July 08, 2018, 08:36:34 am
content: The 16bit version (PCF8575) I think is a viable alternative, unfortunately it's only rated for 5V output so Tranny's will be needed.

author: JS
author_rank: Frequent Contributor
timestamp: July 08, 2018, 08:40:37 am
content: Quote from: Docara on July 08, 2018, 08:36:34 amYes, would be nice for it to be open collectors but I guess that's a different IC (let me know which)I don't know your conf, you can certainly drive leds with this IC if 5V is good enough, current shouldn't be a problem. Also as it's only active high you'd ccant drive common anode leds...JS

author: Ian.M
author_rank: Super Contributor
timestamp: July 08, 2018, 09:00:53 am
content: Are they common anode? If soTPIC6C595will get you 8x 30V 100mA open drain outputs in a single chip for only 3 I/O pins (or an existing SPI bus + one extra /CS pin). For the 9th output, use a discrete MOSFET, on another I/O pin.

author: Docara
author_rank: Regular Contributor
timestamp: July 08, 2018, 09:05:09 am
content: Yeah also the nice thing about this one is the lack of registers to deal with. I dont quite get the need to have to write 2 bytes (1 for each port) all the time -very annoying!!My application is 12V common cathode.https://www.camdenboss.com/camden-boss/cps22if-plwh-12rgb-plastic-rgb-illuminated-piezo-switch/c-23/p-18780Gotta love transistorsMatt

author: Ian.M
author_rank: Super Contributor
timestamp: July 08, 2018, 09:48:25 am
content: Errrr ........ its datasheet shows common ANODE:https://www.camdenboss.com/products/datasheet/CPS22IF-LWH_series_D.pdf

author: Docara
author_rank: Regular Contributor
timestamp: July 08, 2018, 09:51:19 am
content: Quote from: Ian.M on July 08, 2018, 09:48:25 amOld mans blurry eyes(I'm using the same set as the ones that tell me 18yr olds down the pup find me attractive LOL)

author: Ian.M
author_rank: Super Contributor
timestamp: July 08, 2018, 11:43:18 am
content: Have you looked at the TPIC6C595 I suggested? If you don't mind the 9th LED briefly flickering during updates (which could be so fast the flicker would be essentially invisible), you can drive the 9th LED MOSFET from the same I/O pin as data in to the TPIC6C595 and just set the desired level immediately after clocking out the 8 bits, which gets it down to only 3 I/Os.Its unfortunate that Camden Boss don't offer a 5V version of the buttons.

author: james_s
author_rank: Super Contributor
timestamp: July 08, 2018, 04:55:02 pm
content: Can you use a shift register? You can chain a pair of 74HC595's to get 16 bits and you don't have to use them all.You could also use any number of different 8 bit latches or decoders and run the 9th LED directly from one of the uC pins.

author: JS
author_rank: Frequent Contributor
timestamp: July 08, 2018, 05:47:31 pm
content: Quote from: james_s on July 08, 2018, 04:55:02 pmThat's the idea I was missing, I knew I was missing something as simple and efficent as that but I couldn't get it!JS

author: boB
author_rank: Frequent Contributor
timestamp: July 08, 2018, 07:28:55 pm
content: Quote from: james_s on July 08, 2018, 04:55:02 pmSomething like this is good. AND, if you don't want to use 2 of them and 8 of the bits are going to be latched "somehow", maybe you could use the processor bit itself that is going into the 595 as the 9th bit ? As long as they aren't written too often, you probably wouldn't notice that 9th LED being shortly turned on when 1's are coming out and into the shift register ?Fun problem !boB

author: Ian.M
author_rank: Super Contributor
timestamp: July 08, 2018, 08:54:05 pm
content: As I said 12 hours ago: TPIC6C595 + 1 MOSFET. Its an 8 bit shift register that's controlled like a 74HC595, but has 30V 100mA open drain outputs.

author: boB
author_rank: Frequent Contributor
timestamp: July 08, 2018, 09:14:48 pm
content: Quote from: Ian.M on July 08, 2018, 08:54:05 pmInteresting part. So, with the double-D FFs, looks like this could work and possibly without a FET if the LED current is within spec.Wouldn't this require an extra microprcessor pin for the two clocks or maybe an inverter for double-edge clocking to get thatextra serial output to work right ?boB

author: Ian.M
author_rank: Super Contributor
timestamp: July 08, 2018, 09:48:30 pm
content: Its not relevant to the O.P's problem but there are also the TPIC6B595 - 50V, 150mA and the TPIC6A595 - 50V, 350mA in the same family.If you don't care about the data rippling across all the LEDs as its updated*, you only need two pins: Clock SRCK and RCK with one of them, and drive SER_IN and the MOSFET (via a 470R gate resistor so its gate capacitance doesn't slug the SER_IN risetime) with the other. N.B. that configuration takes nine clock pulses to load a byte.* Given a fast enough MCU it can be updated in under 10us, so the ripple flicker is negligible. Even if its 100 times slower, a 1ms ripple flash will barely be perceptible even in dim lighting

author: Docara
author_rank: Regular Contributor
timestamp: July 09, 2018, 03:35:32 pm
content: Hello Everyone,Thank you all for the replies.I couldn't see a 'Solved' button anywhere.I am more than likely going to use either the MCP23017, MCP23S17 or PCF8575 16bit port extender and transistors to drive the (3x3) 12V LED's.The way the internals are organised makes other things easier for me - combinations of changing colours, flashing. Additionally the use of SPI or I2C to control things is also a massive for pin count reasons.I consider the question answered.Thanks again