Poll
Question: how to read and write 93c46
93c46 - 4 (66.7%)
93c56 - 2 (33.3%)
Total Voters: 6

Pages: [1]   Go Down
Author Topic: ATMEL 93c46  (Read 4503 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey
        i wanted to work with all the microwire eeprom available,till now 93c56 and 93c66 is done,but
having trouble with 93c46.
     
Code:
//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
 
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 652
Posts: 50868
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I voted for 93c56. Hope that helps.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Canton, Connecticut, United States, Planet Earth, SOL Galaxy, 3rd star on the left.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
To Infinity, And BEYOND!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//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);
}

Logged

Pages: [1]   Go Up
Jump to: