hey
this is my code for reading and writing from the microwire eeprom
int CLOCK =13;
int DATA_OUT =11;
int DATA_IN = 12;
int CHIP_SEL =10;
int high = 0x00,low = 0; //high and low address
byte dataword[]={"Hello world!"}; //data to send in eeprom
byte READ = 0b1100; //read instruction
byte WRITE = 0b1010; //write instruction
byte EWEN = 0b10011000; //erase write enable instruction
void setup(){
pinMode(CLOCK ,OUTPUT);
pinMode(DATA_OUT ,OUTPUT);
pinMode(DATA_IN ,INPUT);
pinMode(CHIP_SEL ,OUTPUT);
digitalWrite(CHIP_SEL ,LOW);
Serial.begin(9600);
}
void loop()
{
digitalWrite(CHIP_SEL ,HIGH);
shiftOut(DATA_OUT,CLOCK,MSBFIRST,EWEN); //sending EWEN instruction
shiftOut(DATA_OUT,CLOCK,MSBFIRST,0b0000); //the last 4 bits of EWEN ins
digitalWrite(CHIP_SEL ,LOW);
delay(10);
for(int i=0;i<=11;i++)
{
digitalWrite(CHIP_SEL ,HIGH);
shiftOut(DATA_OUT,CLOCK,MSBFIRST,WRITE); //sending WRITE instruction
shiftOut(DATA_OUT,CLOCK,MSBFIRST,low); //sending low address
shiftOut(DATA_OUT,CLOCK,MSBFIRST,dataword[i]); //sendind data
digitalWrite(CHIP_SEL ,LOW);
delay(100);
low++; //incrementing low address
}
low= 0;
for (int i=0;i<=11;i++)
{
digitalWrite(CHIP_SEL ,HIGH);
shiftOut(DATA_OUT,CLOCK,MSBFIRST,READ); //sending WRITE instruction
//shiftOut(dataout,clock,MSBFIRST,high); //sending high address
shiftOut(DATA_OUT,CLOCK,MSBFIRST,low); //sending low address
byte incoming = shiftIn(DATA_IN,CLOCK,MSBFIRST); //sendind data
delay(20);
digitalWrite(CHIP_SEL ,LOW);
low++; //incrementing low address
delay(2);
Serial.println(char(incoming));
}
while(1);
}
this program works fine for 93lc56a ,but when i connect ST 93c56 instead of Hello world! it write's
eHll oowlr!d just invert's the data between 1 and 2 position 3 and 4 position and so on . i don't know what's wrong,i have tied the org pin to ground for x8 organization and there is no org pin in 93lc56a microchip.
any help on this would greatly appreciated
have a great day all
thanks
