Microchip 93lc56a and ST 93c56

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

The write code does not look right

     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); //sendind data
     digitalWrite(CHIP_SEL ,LOW);
     delay(100);
    low++;       //incrementing low address
   }

shiftOut(DATA_OUT,CLOCK,MSBFIRST,dataword);
dataword with out an index is a byte pointer, so it should only be printing the address value.
I think you must be using newer code, or are reading old data.

you may be wanting this:
shiftOut(DATA_OUT,CLOCK,MSBFIRST,dataword[ i ] );

and dataword is a null terminated string, so it contains 13 characters ( including the null ), your loop only writes 11.

hey

thanks for the reply
sorry i forget to code this ,now i have put in code and after that dataword [ i ] automatically comes up.this is a working code, works for 93lc56a but not work correctly for 93c56

thanks

Hi,

just change the read and write instructions as in documentation:

byte READ  = 0b110;
byte WRITE = 0b101;

BR.