SN74LS164N don't work

Hi to all, I'm Paolo an Electronic Engeneer from Italy. I decided to use Arduino for teaching microcontrollers programming to some students in private lessons. Usually all ideas are easy to create with Arduino, but now I have a problem.
I must use a shift register call SN74LS164N and it don't work neither with shiftOut function, nor with explicit use of digitalWrite construct on clock and data inputs, even if I wired properly the chip with datasheet. The LEDS on OUTPUT pins remain off if I connect the data and clock on arduino pins choosed for this function, but if I connect the data INPUT directly to 5 volts all LEDS turned on.
My Oscilloscope is broken and I can't use it for testing the chip, before I construct a test circuit with NE555 someone can tell me something about SN74LS164N and his experience with this chip?
Regards
Paolo

You are holding the Clear/ line high, and B (or A) high, while you use CLK and A (or B) as the Serial Data in line?

You also have a 0.1uF cap on Vcc pin? (and not on any other control line)

Do you have a schematic? (I have no idea how it's connected or where your LEDs are connected, etc.) I assume you've tried a 2nd chip?

My Oscilloscope is broken and I can't use it for testing the chip

If you run this thing slow enough and basically single-step it, you can use a multimeter check the input/output states. Even with a 'scope, it would be easier to troubleshoot if you can check it while there's no clock and everything is static.

or he can use a logic probe, if the 555 is set to a slow frequency ( 5 Hz ).

I just check my parts... I do have that chip ( 4 of them, maybe more ... ). I wonder thay still working... :roll_eyes:

A quick check the datasheet... and CrossRoads is right. A or B input for data, as long one of them is HIGH. The /MR is in my opinion, connect to the reset pin of the Arduino. A LOW will reset the chip also the Arduino. In my experiments with Flip-flops, you have to reset the FF. I did without reset the FF - connect to HIGH, and it did not work. I use the chip 74LS90 and also 74LS74. And a clock signal at the clock pin.

I don't know if the shiftOut() will work, but it is worth to try and see what happen. The "tiny" problem with this chip compare with the 74HC595 is the lack of a "latch".

Lack of a latch just means the LEDs connected to the output will flicker as data goes thru.
The Clear/ line can be connected to an arduino output if the user needed to clear the chip under software control.

Thank you for the replies. I draw with Fritzing the circuit for clarity.
@CrossRoad: You link the datasheet that I use. I don't place the 0.1uF cap: Is This integrated so sensitive to fluctuations ? I'll try with cap than.
@Techone:

or he can use a logic probe, if the 555 is set to a slow frequency ( 5 Hz ).

Infact this is the method I want to use, but I'll try the method of DVDdoug to learn something new.

I created the test circuit with period of 1 second, selecting properly the resistors and capacitors, and the IC work correctly. Then I guess there is some problem with the timing of LOW and HIGH voltage level.

The (0.1uF) decoupling capacitor is never optional in digital electronics.

@MarkT:

The (0.1uF) decoupling capacitor is never optional in digital electronics.

I know that this are a good project rule, but in this simple case is not essential, however I try after the hint of CrossRoads but the problem is still present. Without Arduino and using NE555 and a switch the circuit work correctly.

Post your code, I bet there is something simple wrong.
I used an Octal Latch as a shift out register, same logic as the LS164 but with the connections made externally.

@CrossRoads:
my code

//first simple version
const int clock = 6;
const int data = 7;
void setup()
{
pinMode(clock, OUTPUT);
pinMode(data , OUTPUT);
digitalWrite(clock, LOW);
digitalWrite(data,LOW);
shiftOut(data, clock, LSBFIRST, B10101010);
}
void loop(){}

After this attempt gone wrong I try with this

const int data = 7;
const int clock = 6;

void setup(){
pinMode(data, OUTPUT);
pinMode(clock, OUTPUT);
digitalWrite(clock,LOW);
digitalWrite(data,LOW);
}

int numero = 0;
void loop(){

if (numero <= 255){
numero++;
}
else{
numero = 0;
}

scrivi(numero);
delay(500);
}

void scrivi(byte dato){

for (int i = 0; i <= 7; i++){
digitalWrite(data, bitRead(dato, i));

delay(100);
digitalWrite(clock, HIGH);
delay(100);
digitalWrite(clock, LOW);
}
}

That 2nd one is pretty much the shiftout() command.
Am surprised that isn't working.

Connect the /MR to the reset pin of the Ardiuno, and re-run the code and see what happen. I suspect the chip did not reset properly.

Try it and see what happen.

you need cap for higher frequency, not always required
if you have additional caps already on the board.

when you get strange effect by touching the pins or the PCB,
then you need more decoupling caps.

Have you connected A and B inputs?

Also LS TTL is not really good, HC or HCT is better, works at voltage less than 5 volts.

Excuse me for this late reply, but I had some problems. I seek the hints of Techone and I understand that the problem is the /MR pin. The funny thing is that if I include a resistor between Vcc and /MR pin the IC work corectly, however I pulled out one 74HC164 from an old PIC circuit and I was able to perform the lesson. Thank you to all for your effort :slight_smile:

@takao21106: thank you for your reply, now I have the proof that the LS is not good for this kind of experiments :wink:

Nice to hear everything work out fine.

My rule about any type of "reset" or "clear" in FF , counters, CPU, PIA , etc... any chips that use a FF inside, will need a reset circuit. All PC - MCU - CPU - Cell phone - iPad - have a reset circuit.

Here why : At power up, the FF are in "whatever" state, so a long enough reset pulse - LOW reset or HIGH reset pulse is done at power-up, place all FF at the same state, and place the CPU - MCU at Program Counter 0 <-- on Intel anyway. And all systems is ready to go. Even the ATMEGA329P have a reset pin.

Hmm, yes 74LS164 can only source 0.4mA (hi output), and sink just 8mA (low output).

Should have looked that up sooner. Obvlous solution would have been to reconnect things to have the LS164 driving the cathodes instead of the anodes.

74HC164 works because it can source 4mA.

Thanks CrossRoads for those links. It look like I have to use a transistor to help switch ON / OFF the leds with the 74LS164.

Or,
Change your wiring to have the anodes at +5 and the resistor/cathodes pulled low by the shift register to turn them on.
The 8mA sink current of the LS164 will drive the LEDs easily.

OK...sinking current... got it. With 470 ohms as a limiting resistor, the current will be below the 8 mA LS164 current limit. Assuming the led voltage is about 2 V, the limiting current is about 6 mA. Safe...

Thanks CrossRoads. :wink: