arduino uno & 74HC165 shift register

hello arduino bossesssss-- i need help... i want to convert PARALLEL 8 bit which are coming continuously from ARDUINO [0 TO 7] PINS to serial 8 bit using 74hc165 shift register.... so please if u can give me some instruction about how to write code for this problem.... thank you very much.....i didn't play with shift register before.... :frowning:

what have you tried so far?

just start to learn basic about 74hc165...... thanks

How about googling for 'arduino 74hc165? First hit http://playground.arduino.cc/Code/ShiftRegSN74HC165N

You may use a 74hc165 shift register if you insist, but the Arduino has built-in SPI which can do this task without external parts.

If you are interested, see http://www.arduino.cc/en/Reference/ShiftOut

and

http://www.arduino.cc/en/Reference/SPI

thanks boss........ but i am not so good in coding... .... :cry:

Suit yourself.

I just thought that

shiftOut(dataPin, clockPin, bitOrder, value)

OR

receivedVal = SPI.transfer(val)

was a lot easier than the code lines that it will take you to output 8 bits to 8 I/O pins, use an additional I/O pin to latch this into the 74hc165, then use yet another I/O pin to clock this out of the 74hc165 serially.

It is not even a tradeoff between coding complexity and wiring complexity. shiftOut is simpler in both coding AND in wiring.

Good Luck!

Confused.
Did anybody read OP's history.
I think OP is trying to digitize voice fom a microphone that is attached to an analogue input.
Then spread it over 8 output pins ??, before changing it to serial with an external chip.
I think the serial chip has to modulate a laser.
Isn't it easier to just 'Serial.print' the data to the laser?
Leo..

vaj4088:
You may use a 74hc165 shift register if you insist, but the Arduino has built-in SPI which can do this task without external parts.

If you are interested, see http://www.arduino.cc/en/Reference/ShiftOut

and

http://www.arduino.cc/en/Reference/SPI

... and what's he going to connect the SPI pins to ?

lastchancename wrote

... and what's he going to connect the SPI pins to ?

That's a good question. If there is a reason he has to connect "it" to a 74hc165 and not to the Arduino's SPI pins, he has not provided an explanation.