using shift registers without shiftOut? 74HC595

There is a video on youtube where a user hoocked up buttons to 2 serial-installed shift registers (total 16 outs) and displayed how the registers worked. Is it possible to use an arduino to control shift registers also without serial?

Reason asking is that I am using software serial and already have to handle reading and writing 3 different types of serial messages and I can not switch to another serial speed that seems to be needed to operate the 74HC595s with arduino

I think I may have been looking in an example on a different page where the serial was engaged. Weird. Anyways this is the guy: How Shift Registers Work! - YouTube

Serial is asynchronous. It lacks a clock signal to clock the 595.

Stuff about the 595

aarg:
Serial is asynchronous. It lacks a clock signal to clock the 595.

I don't know about that considering in order to read MIDI messages you need to set serial speed at 31,250 bits per second.

For the 74HC595 you don't use a serial port.

You use a data line and a clock line. This is called synchronous communication; on each clock tick on the clock line a bit is clocked into the (in this case) 74HC595.

With asynchronous communication (e.g. serial port), there is no clock line. In that case each device (sender and receiver) uses its own clock; the sender to send bits and the receiver to receive bits.

Example code from sparkfun: Experiment 14: Using a Shift Register

Ah, got it. Asynchronous communication works with pre defined data transfer speeds which need to be matched by the controller. With the shift registers you need to provide your own clock.

What I really meant in the original question is - arduino has a fiction within which you set the clock pin and data pins and that function controls the shift register. The guy in the video used simple push buttons which essentially just go high and low in arduino code terms. So what I meant was, can you drive the register by just manually pulling clock n data pins high and low instead of the shiftOut function?

Delta_G:
Yes, but you have to first understand how the shift register works. Read the link in reply #4.

Well read up on the shift registers from the data sheet and tutorials as well as videos: 1 or 0 enters the shift register memory bit via data; shift, moves the data to the next bit after which data needs to entire again and latch releases the data into the physical pins in simple terms. Along with other control pins. My main issue is that the shiftOut function outputs the data in binary as demonstrated by the example code where the shift register counts to 255 in binary using the shift register outputs.

I need to be able to set each pin individually by either writing their state in an array or a string and simply having a " for loop" go through each array or string position and write it to the shift register.

I need to be able to set each pin individually by either writing their state in an array or a string and simply having a " for loop" go through each array or string position and write it to the shift register.

Set the bits of a byte the way you want using the bitWrite() function and then use shiftOut() to send the byte to the shift register.

You can also set/clear bits in a byte using the bitwise operators & and | but you may find bitWrite() easier to begin with.

Having a byte variable that you manipulate by whatever means, and then shifting it is the typical way:

// start with a value
byte shiftVar = 0b00001111;

// shift it out:
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, shiftVar); // or SPI.transfer(shiftVar);
digitalWrite(latchPin, LOW);

manipulating the byte examples:
shiftVar = shiftVar & 0b11111011; // clear bit 2, leave rest alone, result is 0b00001011

shiftVar = shiftVar | 0b01000000; // set bit 6, leave rest alone, result is 0b01001011

// then shift it out same as above
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, shiftVar); // or SPI.transfer(shiftVar);
digitalWrite(latchPin, LOW);

UKHeliBob:
Set the bits of a byte the way you want using the bitWrite() function and then use shiftOut() to send the byte to the shift register.

You can also set/clear bits in a byte using the bitwise operators & and | but you may find bitWrite() easier to begin with.

bitWrite() That's what I needed!

this will let me set each bit of a byte. It's like having an 8 bit array. Thank you!

And thanks everyone else for clearing this up

Just outta curiosity, when you have 2 shift registers in series, do you just output another 8 bit byte value or do you have to make a 16 bit byte?

You output an array of bytes (one byte per register). They "ripple" out so that the first one sent ends up at the farthest away device.

Gotcha, thanks everyone. Karma fir everybody :stuck_out_tongue: