74LS164 Controling a bit at time without chaging the state of the other 7 ??

Hi,

I have a code working good with 74LS164 and leds, led chaser look alike.
My question is it us possible to control individually one bit at time without chaging the state of the others 7 ?? If yes please post a small example.

Thanks

#define data 2
#define clock 3

// use binary notation to discribe our number layouts
byte zero  = B10000000;
byte one   = B01000000;
byte two   = B00100000;
byte three = B00010000;
byte four  = B00001000;

void setup()
{
  pinMode(clock, OUTPUT); // make the clock pin an output
  pinMode(data , OUTPUT); // make the data pin an output3
  
 }

void loop()
{
   shiftOut(data, clock, LSBFIRST, zero);
    delay(1000);
   shiftOut(data, clock, LSBFIRST, one);
    delay(1000);
   shiftOut(data, clock, LSBFIRST, two);
    delay(1000); 
   shiftOut(data, clock, LSBFIRST, three);
    delay(1000); 
   shiftOut(data, clock, LSBFIRST, four);
    delay(1000);  
 
}

Sounds like bitWrite is what you're looking for: http://arduino.cc/en/Reference/BitWrite

That particular shift register doesn't latch its outputs so they will change as you clock a new 8 bits into the serial input(s). If you clock fast this might not matter to you (say if driving LEDs). However if you don't want pulses to appear on the outputs then you're stuck. A latching shift register like the ever-popular 74HC595 will do the right thing in that situation since it has a separate latch input.

Any reason to use 74LS series rather than 74HC? They HC series is general superior and these days seems a lot cheaper and easier to source. They also have pretty much zero static current consumption, whereas TTL is very power-hungry. Also HC chips can source useful amounts of current, not just sink it...

Hi,

Im using it just because i have 4 and try to use them and do not buy new parts, sow i cant send a bit at time without chaging the state of the other 7 ?? wit this chip?

Thanks

No - compare the diagrams in the datasheets for the 74XX164 and 74XX595 - the latter has a latch between the shift register and the outputs... However you can reduce the time they are switching to a few microseconds if you clock it fast (say with the SPI hardware or direct port manipulation / bit-banging). Depends what you then do with the output signals if this matters.

Humm, it seems very complicated for a beginner like me :~
My idea was to work the 74LS164 as a port expander and put his "ports" low and high without chaging the state of the other.

Thanks