Using a sn74lvc244 8 bit quad output line driver?
rwgast_logicdesign
Posts: 1,464
Ok so I posted about this idea a little ways back and now im ready to build the thing...
I basically want to build a board that has 8 LED's and 9 push buttons. When the a push button is pressed i want the led to light up (that can be controlled via the prop no biggie). When the ninth push button is pressed i want it to read the binary mask of the LED pattern and send it off to the prop.
This is all pretty basic and the code should be fairly easy.. The problem is I dont want to use 17 pins to accomplish this thing. Ive glossed over the data sheet for my lvc244 and searched google a bit, and Im not understanding exactly how this thing gets wired and how it saves pins? I mean i basically have 8 outputs and 9 inputs and two lvc244 chips. Im thinking 1 chip will use 8 prop pins and supply me with 24 pins, thats what tri state output means??
I basically want to build a board that has 8 LED's and 9 push buttons. When the a push button is pressed i want the led to light up (that can be controlled via the prop no biggie). When the ninth push button is pressed i want it to read the binary mask of the LED pattern and send it off to the prop.
This is all pretty basic and the code should be fairly easy.. The problem is I dont want to use 17 pins to accomplish this thing. Ive glossed over the data sheet for my lvc244 and searched google a bit, and Im not understanding exactly how this thing gets wired and how it saves pins? I mean i basically have 8 outputs and 9 inputs and two lvc244 chips. Im thinking 1 chip will use 8 prop pins and supply me with 24 pins, thats what tri state output means??
Comments
And with a separate press on button 9, tell the prop to read what button(s) 1-8 is down?
How to use 9 prop pins.
Wire 8 buttons like this, the 9th button (without a led) put the another 10k res where the 220 ohm is.
You could go from 9 pins to 5 by using a 8-to-1 mux: (parallel to serial is also an option).
http://www.mouser.com/Semiconductors/Logic-ICs/Encoders-Decoders-Multiplexers-Demultiplexers/_/N-4s67oZscv7?P=1z0w8z9Z1z0yyznZ1z0z44dZ1z0z5fd&Ns=Pricing%7c0
1 pin to read the switches and 3 pins to tell what address.
74HC151 (for up to 5v TTL the 74HCT151)
The Propeller Tool library has a 4 x 4 keypad object. You could modify it to use a 3 x 3 keypad.
The eight LEDs could be controlled with three pins using a 595 shift register.
@tonyp ok if i use your schematic I dont quite understand. I would need the pin to be an input and output at the same time.. is there a way to do that. I mean when the button is pressed i need the prop to read that then set the LED output state to 1. So then and if its 1 I need it to change to 0. I dont see a way to handel something like that with both the button and LED on the same pin
If you really want to use the minimum number of pins then you can use 1 '595 to drive the leds and one '165 to read the switches.
For the '165 8 buttons would go on the 8 parallel inputs and the ninth button would go on the serial input pin.
For the '595 the 8 leds/resistors would connect to the parallel data outputs.
You would need 3 prop pins to drive the 2 chips. One pin would be data out to the '595 and data in from the '165, one pin would load data from the switches to the '165 and transfer data from the '595 serial register to it's output register, and one pin to clock (shift) the data.
If you are interested I can post a block diagram.
a 74HC164 and a 74HC165
1 prop pin for clk that is shared by both 74HC
1 prop pin for ser-out (though no latch, it goes so fast that the LED will look off while shifting up, and then wait 1/10sec)
1 prop pin for ser-in
1 prop pin for button9, using hardware debounce> http://www.ganssle.com/images/debouncerrc.jpg (both 10k ohm, 0.1uF cap)
Maybe could get button9 to be shared with ser-out that temp have dir set as input, with rather high resistor values to switch so it will have no effect on ser-out to hc165.
But that requires two control pins so 4input+2outputpins =6 instead of 8.
And you would have to make sure the two OE are never both at a low state .
So they should have a pull-up resistors while booting up.
Using the second 244 in reverse for the LEDs would give you a 50% duty, and sharing EO with above 244 would bring count down to 11 prop pins used.
As button 9 still can not be included in a 8bit bus.
Or you could just use one 244 (as in the picture below)
To read the switches you turn the prop pins around as inputs and pull the LVC244 OE pins low.
Read the state, Set OE back high, Set prop pins as outputs for the LEDs (done quickly you should not seen them blink).
=10 prop pins used (including button 9)
You would need the toggle flops on the switches to hold the button press (press once high, again toggle low again....) until the 9th button is pressed at which time, the prop could then clock the switch states in serial fashion. If you design/selected your parts right, you might be able to combine the T-flop and shift register functions in to a single function. I do not say single chip, most octal D flops and latches have a common clock pin so setting them individually and latching the switch press may not be practical. You still even with the T-flop may need to debounce the switches in hardware. You could then serially send to another shiftregister the leds that you want lit up. If you don't want or your design can not tolerate the shift of high and low, you can use a chip with output latch or add an external level of latches to effectively double buffer the output shift register. How you do it will of course determine the actual minimum number of pins. Or if the output register has tristate outputs and your circuit can tolerate an open circuit output, simply use the tristate output (usually /OE) to isolate the output pins until the value is shifted in. For what it is worth, you can probably shelve the '244s for another project.
Frank