Go Down

Topic: ATMEL 93c46 (Read 5169 times) previous topic - next topic

raees

hey
        i wanted to work with all the microwire eeprom available,till now 93c56 and 93c66 is done,but
having trouble with 93c46.
     
Code: [Select]

//difining pins for eeprom   
int CLOCK =4;         
int DATA_OUT =3;
int DATA_IN = 2;
int CHIP_SEL =5;

int high = 0,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  = 0b10011;         //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
  digitalWrite(CHIP_SEL ,LOW);
  delay(10);
  for(int i=0;i<=13;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<=13;i++)
  {
    digitalWrite(CHIP_SEL ,HIGH);
    shiftOut(DATA_OUT,CLOCK,MSBFIRST,READ); //sending READ instruction
    shiftOut(DATA_OUT,CLOCK,MSBFIRST,low);   //sending low address
    byte incoming = shiftIn(DATA_IN,CLOCK,MSBFIRST); //sendind data
    digitalWrite(CHIP_SEL ,LOW);
    low++;       //incrementing low address
    Serial.println(char(incoming));
  }
  while(1);
}


this code works for 93c56 and 93c66 ,but when i plug 93c46 it doesn't write and read properly.
so anyone can tell me what changes should i do in order to make this code work for 93c46.
have a great day all
thanks

PaulS

I voted for 93c56. Hope that helps.

raees

but how did i make this code work for AT93c46 any one guys
thanks

gelfling6

I can't remember where I obtained it from, but there is a project out on the net, using the MEGA-2560, using higher digital pins instead of analog pins like everyone else has..     I'm going to try mixing the two, feeding the code from here , and hopefully, it'll work with the MEGA.
I've been pulling a LOT of 93C46's from various old network cards.. the problem with the project I found, it is writing immediately to the chip, which I don't want it to do.. I want to read the data contained on the EEPROM..

raint

Hi. I know this is really old topic. But there was very limited information about this chip online, so i want to update it for future readers.

I got it to work. So excited.

I based my code on your's. However made shiftout and shiftin my in my own functions since I wanted to understand spi better.  Also used string and chars to switch bits, because I'm more comfortable with them.

Code: [Select]

//defining pins for eeprom   
int CLOCK =9;         
int DATA_OUT =10;
int DATA_IN = 11;
int CHIP_SEL =8;

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 sendSer(String s){
  digitalWrite(CHIP_SEL,HIGH);
  int len = s.length();
 
  for (int i=0;i<len;i++){
    char c = s.charAt(i);
    if (c=='0')
      digitalWrite(DATA_OUT, LOW);
    else
      digitalWrite(DATA_OUT, HIGH);
    digitalWrite(CLOCK,HIGH);
    digitalWrite(CLOCK,LOW);
  }
    //needs little delay to work
    delay(10);
}
void recvSer(String s){
  digitalWrite(CHIP_SEL,HIGH);
  int len = s.length();
  for (int i=0;i<len;i++){
    char c = digitalRead(DATA_IN);
    Serial.print(c==LOW ? "0" : "1");
    digitalWrite(CLOCK,HIGH);
    digitalWrite(CLOCK,LOW);
  }
}

void loop(){

  digitalWrite(CHIP_SEL, HIGH);
  sendSer("00000100"); //sending EWEN instruction
  sendSer("1100000"); //
  digitalWrite(CHIP_SEL,LOW);
 
  digitalWrite(CHIP_SEL, HIGH);
  sendSer("00000101"); //sending WRITE instruction
  sendSer("0000001"); //sending Address
  sendSer("10001101"); //sending data
  digitalWrite(CHIP_SEL,LOW);
 
  digitalWrite(CHIP_SEL, HIGH);
  sendSer("00000110"); //sending READ instruction
  sendSer("0000001"); //sending Address
 
  //dummy zero that is sent at start of read
  digitalWrite(CLOCK,HIGH);
  digitalWrite(CLOCK,LOW);
 
  //receiving data... zeros is just to specify count.
  //no meaning in them... output is to serial
  recvSer("00000000");
  digitalWrite(CHIP_SEL,LOW);
 
  while(1);
}


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy