Arduino Forum

Using Arduino => General Electronics => Topic started by: dreamworker72 on Feb 29, 2012, 09:07 pm

Title: SN74LS164N don't work
Post by: dreamworker72 on Feb 29, 2012, 09:07 pm
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   
Title: Re: SN74LS164N don't work
Post by: CrossRoads on Feb 29, 2012, 09:24 pm
http://www.ti.com/lit/ds/symlink/sn74ls164.pdf

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)
Title: Re: SN74LS164N don't work
Post by: DVDdoug on Feb 29, 2012, 09:45 pm
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?

Quote
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.
Title: Re: SN74LS164N don't work
Post by: Techone on Mar 01, 2012, 01:35 am
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...  :smiley-roll: 

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".
Title: Re: SN74LS164N don't work
Post by: CrossRoads on Mar 01, 2012, 01:39 am
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.
Title: Re: SN74LS164N don't work
Post by: dreamworker72 on Mar 01, 2012, 09:35 am
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:
Quote
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.
Title: Re: SN74LS164N don't work
Post by: dreamworker72 on Mar 01, 2012, 09:30 pm
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.
Title: Re: SN74LS164N don't work
Post by: MarkT on Mar 01, 2012, 11:02 pm
The (0.1uF) decoupling capacitor is never optional in digital electronics.
Title: Re: SN74LS164N don't work
Post by: dreamworker72 on Mar 01, 2012, 11:27 pm
@MarkT:
Quote
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. 
Title: Re: SN74LS164N don't work
Post by: CrossRoads on Mar 02, 2012, 03:25 am
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.
Title: Re: SN74LS164N don't work
Post by: dreamworker72 on Mar 02, 2012, 10:25 am
@CrossRoads:
my code
Quote

//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
Quote

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);
  }
}
Title: Re: SN74LS164N don't work
Post by: CrossRoads on Mar 03, 2012, 01:05 am
That 2nd one is pretty much the shiftout() command.
Am surprised that isn't working.
Title: Re: SN74LS164N don't work
Post by: Techone on Mar 03, 2012, 03:03 am
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.
Title: Re: SN74LS164N don't work
Post by: takao21106 on Mar 05, 2012, 01:59 pm
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.
Title: Re: SN74LS164N don't work
Post by: dreamworker72 on Mar 07, 2012, 11:42 pm
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 :)

@takao21106: thank you for your reply, now I have the proof that the LS is not good for this kind of experiments ;)
Title: Re: SN74LS164N don't work
Post by: Techone on Mar 07, 2012, 11:59 pm
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.   
Title: Re: SN74LS164N don't work
Post by: CrossRoads on Mar 08, 2012, 01:09 am
Hmm, yes 74LS164 can only source 0.4mA (hi output), and sink just 8mA (low output).

http://www.ti.com/lit/ds/symlink/sn74ls164.pdf

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.
http://www.ti.com/lit/ds/symlink/sn74hc164.pdf
Title: Re: SN74LS164N don't work
Post by: Techone on Mar 08, 2012, 03:51 am
Thanks CrossRoads for those links. It look like I have to use a transistor to help switch ON / OFF the leds with the 74LS164.
Title: Re: SN74LS164N don't work
Post by: CrossRoads on Mar 08, 2012, 04:11 am
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.
Title: Re: SN74LS164N don't work
Post by: Techone on Mar 08, 2012, 04:23 am
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.  ;)