shiftOut w/ 74HC595

Trying to understand the HOW of this. Arduino pin 6 is going HI/LO sending by shiftOut a byte to 74HC595 pin 14 (data input). OK it works fine, but how? I read the Motorola PDF and tried to make sense out of their timing charts, but can't quite suss it out. Just how does shifOut physically send/format the data byte and how does the IC interpret the HI/LO input transitions (or lack of transition for a 0 bit)? How are the HI/LO transitions timed? If pin 6 goes HI it's a 1 bit, but how does it interpret pin 6 LO as a 0 bit? For how long is pin 10 set to HI by shiftOut? I can assume the Arduino timing is controlled by the 16MHz crystal, but what controls the IC timing or does it even matter? Obviously I am confused...

digitalWrite(LATCH,LOW);//tell the IC to unlatch the outputs

shiftOut(DATA,CLOCK,MSBFIRST,a);//send data string of bits on pin 6; transition pin 10 HI to clear IC register and write new byte into the IC register, data binary bit string sent most significant bit first, binary value of byte

digitalWrite(LATCH,HIGH);//latch the IC outputs

//Binary Quiz Game

#define DATA 6
#define LATCH 8
#define CLOCK 10

int number=0;
int answer=0;

void setup() 
{
  pinMode(DATA,OUTPUT);
  pinMode(LATCH,OUTPUT);
  pinMode(CLOCK,OUTPUT);
  Serial.begin(9600);
  randomSeed(analogRead(0));
  displayNumber(0);  
}

void displayNumber(byte a)
{
  digitalWrite(LATCH,LOW);
  shiftOut(DATA,CLOCK,MSBFIRST,a);
  digitalWrite(LATCH,HIGH);
}

void getAnswer()
{
  int i=0;
  Serial.flush();

  while (Serial.available()==0)
  {
   //do nothing 
  }

  while (Serial.available()>0)
  {
   answer=answer*10;
   i=Serial.read()-'0';
   answer=answer+i;
   delay(5);
  }

  Serial.print("You Entered: ");
  Serial.println(answer);
}

void checkAnswer()
{
  if (answer==number)
  {
    Serial.print("Correct! ");
    Serial.print(answer,BIN);
    Serial.print(" equals ");
    Serial.println(number);
    Serial.println();
  }

  else
  {
    Serial.print("Incorrect, ");
    Serial.print(answer,BIN);
    Serial.print(" equals ");
    Serial.println(number);
    Serial.println();
  }

  answer=0;
  delay(10000);
}
void loop() 
{
  number=random(256);
  displayNumber(number);
  Serial.println("What is the binary # in base10? ");
  getAnswer();
  checkAnswer();
}

How are the HI/LO transitions timed?

They're referenced against the clock signal.

AWOL:
They're referenced against the clock signal.

LO, HI one tick,LO unless instructed to latch HI and stay HI until instructed to go LO and stay LO until instructed to go HI.

At 16 MHz that's 63 nanoseconds per tick. Can the 595 respond that fast? I seem to remember the 555 timer needing a 10 millisecond signal duration to detect it.

So what is the duration of the transition signal and how is it set?

Good to 25MHz, IIRC.

Why not check the datasheet?

I don't really see what a 555 is being used for here.

Using shiftOut(), the clock speed will be a very small fraction of 16MHz. When shiftOut() is used, the data is sent out by a small piece of code. This is relatively slow, but has the advantage that any pins can be chosen as DATA and CLOCK.

Most Arduino have a piece of built-in hardware for this purpose, which is much faster, but requires the use of fixed pins for DATA and CLOCK. On Uno, for example, the clock can be up to 8MHz (slower speeds can be selected) and pins 11 and 13 (I think) must be used for DATA and CLOCK. This piece of hardware is called the SPI bus. There is a standard SPI library to allow you to use it easilly.

The basic logic element in a 595 is know as an edge triggered D-Type flip flop. It has basically three connections a data and a clock input, and a data output.

When a falling edge is given to its clock input the logic level on the input is transferred to its output. If you have a chain of these where the output of one is connected to the data input of the other and all the clock inputs are wired together, then you can fill it with a bit pattern by changing the input and giving it a clock, over and over. The result is you can output any bit pattern you want.

Now to stop you seeing the bit pattern sliding over all the pins there is another simpler type of flip flop between the output of each flip flop in the chain and the pin on the outside of the chip. This is called a level triggers D-Type flip flop. Here when the clock is high the output is exactly what is on the input, in other words it follows it. When the clock is low the output can not change no matter what the input does. The clock of this set of flip flops is called the latch, which is why you close the latch during shifting out the data pattern and open it when you want the data pattern to appear on the pins of the chip.

Both types of flip flops are made from a few logic gates of either the NAND or the NOR type. If you are bothered how these gates can be turned into the two types of flip flop please ask again, although this might be more information than you want, or can stand.