Maker Pro
Maker Pro

74hc238 binary decoder info

Dustin Yoder

Jul 16, 2014
6
Joined
Jul 16, 2014
Messages
6
I bought several 74hc238 3x8 binary decoder chips to try to allow my raspberry pi gpio pins to potentially control many more relays. first step is to test my binary decoder chip so I put it on a bread board with the pi's 3v out connected to vcc and pi's gnd to gnd. Then i tie g2a and g2b both to ground. Then i hooked up 4 leds to the chip outputs 0-3. I put a 200ohm resistor between ground and leds. So i assume no output till i give the enable pin 3v, but the leds are flickering. They light more or less if i touch the chip or even the breadboard. I can tell that the led for 0 lihts brighter when i put 3v on the enable pin but it stays bright after i remove the 3v from enable. Is my chip screwed up or do i need a resistor on vcc or something? Thanks for the help.

Chip datasheet here. http://www.sparkfun.com/datasheets/Components/General/COM-09577-m74hc238.pdf
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Have you connected ALL inputs somewhere? There are three enable inputs (pins 4, 5 and 6) and three select inputs (pins 1, 2 and 3) and they all have to be connected to something.

Pins 4 and 5 must be low, and pin 6 must be high, to enable the IC. Pins 1 and 2 must be driven by your Raspberry Pi, and pin 3 must be tied low if you're not also driving it.

The 74HC238 will only drive one output active at a time. So although you can control seven relays independently, you can't enable more than one simultaneously.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
A possibly better option is the 74HC595 which will allow you to independently control 8 outputs per chip and you can cascade them. And all you require is 3 outputs and some bitbanging.

I'm sure that if you Google"raspberry pi 74HC595" you will find someone who has been here before.
 

Dustin Yoder

Jul 16, 2014
6
Joined
Jul 16, 2014
Messages
6
So I was under the impression that disconnecting the 3v from the inputs was the same as having a gpio pin connected but turned off. Is this is not the case?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
"... connected but turned off..." doesn't mean anything. Also the input and output pins on the HC238 are not GPIO. Each one is defined as either an input or an output by the design of the device. Inputs on HC devices have a very high impedance and will float to random states if they are not connected to something with a defined state.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
So I was under the impression that disconnecting the 3v from the inputs was the same as having a gpio pin connected but turned off. Is this is not the case?

As Kris has said. For CMOS (you're using 74HCxxx which is high speed CMOS) the imputs need to be pulled to one logic state or the other.

TTL (74xxx) or LSTTL (74LSxxx) have inputs that float high, so a disconnected input is like one tied to the positive supply rail.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
TTL (74xxx) or LSTTL (74LSxxx) have inputs that float high, so a disconnected input is like one tied to the positive supply rail.
You're not supposed to rely on that. Though designers usually do :)
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
You're not supposed to rely on that. Though designers usually do :)

True, I was going to add that it's bad practice as it has a very low noise margin. But since we're talking about CMOS I decided to pass on it.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Excellent, congratulations.
 
Top