The only strange things I see in the code now should not prevent it from working. You're probably right about the hardware (power) problem.
Notes:
CE was left LOW after readBytes(). Not a problem.
writeByte() was using the data pins in the opposite order from readByte(). Data would come out reversed but not zero.
You had a few places where a function called one function (setAddr()) or a small function was used in just one place. It's mostly a matter of style. You also had a few unnecessary temporary variables and casts.
Just to consolidate code a bit:
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
int bytePins[8] = {
2,3,4,5,6,7,9,10};
int CE = A2;
int OE = A1;
int WE = A0;
void setup() {
//set pins to output so you can control the shift register
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(CE, OUTPUT);
digitalWrite(CE, HIGH); // DISABLED (active low signal)
pinMode(OE, OUTPUT);
digitalWrite(OE, HIGH); // DISABLED (active low signal)
pinMode(WE, OUTPUT);
digitalWrite(WE, HIGH); // DISABLED (active low signal)
}
/* mode: INPUT or OUTPUT
OUTPUT: for writing out to memory
INPUT: for reading from memory */
void setBytePins(int mode){
for(int i=0 ; i < 8 ; i++){
pinMode(bytePins[i], mode);
}
}
void setAddr(unsigned short addr){
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, addr>>8);
shiftOut(dataPin, clockPin, MSBFIRST, addr);
digitalWrite(latchPin, HIGH);
}
void readBytes(unsigned char * buffer, unsigned short addr, int len){
setBytePins(INPUT);
digitalWrite(CE, LOW);
digitalWrite(OE, LOW);
for( int i=0 ; i < len ; i++){
buffer[i] = readByte(addr+i);;
}
digitalWrite(OE, HIGH);
digitalWrite(CE, HIGH);
}
unsigned char readByte(unsigned short addr){
setAddr(addr);
unsigned char b=0;
for( int i=0 ; i < 8 ; i++ ){
b |= digitalRead(bytePins[i]) << i;
}
return b;
}
void writeBytes(unsigned char * b, unsigned short addr, int len){
setBytePins(OUTPUT);
for( int i=0 ; i < len ; i++){
writeByte(b[i],addr+i);
}
}
void writeByte(unsigned char b, unsigned short addr){
setAddr(addr);
for(int i=0 ; i < 8 ; i++)
digitalWrite(bytePins[i], b & (1<<i) );
digitalWrite(CE, LOW);
digitalWrite(WE, LOW); // Initiate write
digitalWrite(WE, HIGH);
digitalWrite(CE, HIGH);
}
void loop() {
unsigned char in_byte[4] = {0xf1, 0x40, 0x41, 0xf0};
unsigned char out_byte[4] = {1, 2, 3, 4};
writeBytes(in_byte, 0x0000, 4);
readBytes(out_byte, 0x0000, 4);
Serial.print(out_byte[0], BIN);
Serial.print(" ");
Serial.print(out_byte[1], BIN);
Serial.print(" ");
Serial.print(out_byte[2], BIN);
Serial.print(" ");
Serial.println(out_byte[3], BIN);
delay(500);
}