Shift Register 74HC595 issue

Hi , I am trying to use two Shift Registers as described here :

lets say i wanna shift out this binary " 0000010000000001" which is 1025 Decimal.
when i use this code :

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST,1025);
digitalWrite(latchPin, HIGH);

the output is "0000000000000001" or one in decimal and when i change the code to:

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST,1025);
shiftOut(dataPin, clockPin, MSBFIRST,1025);
digitalWrite(latchPin, HIGH);

I could get the desired output. However, this wont work for different output. for example if i wanna have 1024 decimal or "0000010000000000" i couldn't get the output even by one time "shiftOut(dataPin, clockPin, MSBFIRST,1024);" or repeating it twice .
I would be really appreciate it if someone could help me.
Thanks in advance.

Shiftout only sends 1bytes worth of data to the IC.

8bits worth, the next time you use shiftout, 8 more bits get shifted into the first register any bits previously store get shifted out to the 2nd register.

So the trick is to get the high/low values and send it in 2 lots (16bits)

Thanks a lot .. That works .. didn't know that .
i wanna have : 1000000000111111 or 32831 in the output and i used this code which works great:

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST,128);
shiftOut(dataPin, clockPin, MSBFIRST,63);
digitalWrite(latchPin, HIGH);

Thanks for you help.

could also have:

int dataOut; // declare in pre-setup part of sketch

// then update in loop as needed:
dataOut = 0b1000000000111111;
// or 
dataOut = 32831;

// then send it out:
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, highByte (dataOut);
shiftOut(dataPin, clockPin, MSBFIRST, lowByte (dataOut);
digitalWrite(latchPin, HIGH);

Thanks a lot for your response CrossRoads.
I have a question .. if i use more than two 595, how should i change your code? for example for three 595 should it be like this?:

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, highByte (dataOut);
shiftOut(dataPin, clockPin, MSBFIRST, highByte (dataOut);
shiftOut(dataPin, clockPin, MSBFIRST, lowByte (dataOut);

digitalWrite(latchPin, HIGH);

That will send the same byte twice, is that what you want?
If the three bytes are to be unique, you could put the data into a 32-bit unsigned long, and break out the 8-bit chunks from there. Or just use three unique bytes:

digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, dataOut3;
shiftOut(dataPin, clockPin, MSBFIRST, dataOut2;
shiftOut(dataPin, clockPin, MSBFIRST, dataOut1;

digitalWrite(latchPin, HIGH);

well i meant 32bit output generally(or even more). this solution is the one which cjdelphi also suggested. However, what interested me about your code which makes me to ask a question was this part of it :

highByte (dataOut);
lowByte (dataOut);

that how this form could be used for more than 16 bit. so in this case for any length of bit i don't need to separate them in individual 8bit .

highByte and lowByte are just functions that someone wrote
http://arduino.cc/en/Reference/HighByte

There may be something that splits up unsigned long too.
Can also do it yourself, maybe something like this:
unsigned long 32bitWord;

byte bits7to0 = 0x000000FF & 32bitWord; // mask off 8 bits
32bitWord = 32bitWord >>8; // shift away 8 bits, upper 24 left
byte bits15to8 = 0x0000FF & 32bitWord; // mask off 8 bits
32bitWord = 32bitWord >>8; // shift away 8 bits, upper 16 left
byte bits23to9 = 0x00FF & 32bitWord; // mask off 8 bits
32bitWord = 32bitWord >>8; // shift away 8 bits, upper 8 left
byte bits31to24 = 0xFF & 32bitWord; //

Can mix that in with the SPI.transfers