Discussion in "8051 Discussion Forum" started by    desiato    Nov 28, 2007.
Wed Nov 28 2007, 05:59 AM
#1
im trying to interface at28c64b to 89c51
but its not working, please help
i must finish this within this week!

connection:
/ce->0
/oe(74hc737n)->0
P0->(d0-d7)(74hc737n)(q0-q7)->(a0-a7)(at28c64b)
P2->(a8-a12)(LE)(/we)(at28c64b /oe)

ill give the schamtic very soon.

this is the code



#include <REG52.H>
//13-bit address,8-bit input
#define MDATA P0
#define ADDR1 P0
#define ADDR2 P2

sbit LE  =              ADDR2^5; //   LE
sbit WE  =              ADDR2^6; //   /WE
sbit OE  =              ADDR2^7; //   /OE

sbit IO7 =              MDATA^7; // /data polling
sbit IO6 =              MDATA^6; // toggling bit

#define MASK_W 0xE0 //11100000B
#define MASK_R 0x60 //01100000B

//can write only 5ms after power on
void write_eep(unsigned short int addr,unsigned char dat){
    bit last_bit=dat^7;
    OE=1; //in
    WE=1; //r
    ADDR1=addr&0xff;
    ADDR2=(addr>
>
8)|MASK_W;
    LE=1; //latch-in on
    LE=0; //latch-in off
    WE=0;
    MDATA=dat;
    WE=1;
    WE=0;
    //wait for the write cycle to end
    while(IO7==last_bit);    
}

unsigned char read_eep(unsigned short int addr){
    WE=1; //read
    OE=0; //in
    ADDR1=addr&0xff;
    ADDR2=(addr>
>
8)|MASK_R;
    LE=1; //latch-in on    
    LE=0; //latch-in off
    OE=0; //out
    MDATA=0xff;
    //reset
    return MDATA;    
}

//hundreds thx




[ Edited Wed Nov 28 2007, 07:55 AM ]
Wed Nov 28 2007, 07:57 AM
#2
check what is the voltage required to write to that EEPROM. and i want to see the circuit too..
Wed Nov 28 2007, 10:04 AM
#3
thx

here is the circuit
Attachment


5v is needed to write.

let me know if anyone want anything about it.






[ Edited Wed Nov 28 2007, 10:13 AM ]
Wed Nov 28 2007, 10:53 AM
#4
I checked the datasheet, and i feel there is a problem with the write operation, at the end where you are doing DATA POLLING.

void write_eep(unsigned short int addr,unsigned char dat){
    bit last_bit=dat^7;
    OE=1; //in
    WE=1; //r
    ADDR1=addr&0xff;
    ADDR2=(addr>
>
8)|MASK_W;
    LE=1; //latch-in on
    LE=0; //latch-in off
    WE=0;
    MDATA=dat;
    WE=1;
//    WE=0;
// No need to make WE 0 as you are reading so OE has to be low
    OE = 0;
// See datasheet at "data polling waveform"
    //wait for the write cycle to end
    while(IO7==(~last_bit));
// As per the datasheet IO7 will have complement of last written data
// and so you wait till the IO7 is showing complement of last bit
// when the write cycle is complete the correct data will be shown.
    OE = 1;
}

I have made corrections according to whatever mentioned in the datasheet. Please check it and let me know.
Thu Nov 29 2007, 12:03 PM
#5
it doesn't seem to work and i'm trying to use a serial eeprom, at24c64a instead, but its still not working.
could anyone give me some sample code for at24c64a /24c64? i've been searching for long, but found none working. plz help
Thu Nov 29 2007, 12:17 PM
#6
why don't you try giving some delay of about 100 to 150ms instead of data polling, i think the main problem in your code is of that only.
  like this.
Fri Nov 30 2007, 07:12 AM
#7
you're right , i put some delay after the write function and it works, thx alot!
i was trying to make the code faster , so forgot delays


[ Edited Fri Nov 30 2007, 07:14 AM ]
Fri Nov 30 2007, 01:15 PM
#8
great... to know it worked.. remember.. hardware (the real thing) needs delay.. and software is always fast..
Fri Nov 30 2007, 08:51 PM
#9
o, the serial eeprom is not working again.....
i don't change any of its wires nor code, everything are in the same old place , and the code is the same old code, but the rom just doesn't work. i can't write anything into it. any idea?


[ Edited Fri Nov 30 2007, 08:52 PM ]
Fri Nov 30 2007, 08:55 PM
#10
i thought you are using parallel ROM?
check the WP (write protect) signal.. or loose connection :-s

Get Social

Information

Powered by e107 Forum System

Conversation

Thu Jun 11 2020, 06:27 AM
anudee
sir could please send the code for I2C and wifi interfacing with 8051
scena
Tue May 19 2020, 10:29 PM
Does anyone have microcontroller programming software for STC15F104W (core 8051, 4 k, 128 byte, 6 I/O pin, UART ... DIL8), that works?
Sat May 02 2020, 07:38 PM
Tamu Gurung
Hi I am looking for a assembly language program for a digital decimal counter. Time counts max limit of 2 mins starting from 2.00 mins and ending at 0.00. time is to be displayed on 4 7-segment LED displays. Edsim51 simulator to be used. Thanks
Wed Mar 25 2020, 01:39 PM
Tajammul
Sir kindly send the code file i2c for 8051
ExperimenterUK
Fri Mar 13 2020, 10:36 PM
@ Rohitnani,ABEBE..which project ?
Fri Mar 13 2020, 12:55 PM
ABEBE
how can get hadwere of this project
Rohitnani
Sat Mar 07 2020, 05:11 PM
Sir, Could you please send me the zip file input password....
Wed Feb 26 2020, 04:58 PM
Peter Parker
Is it possible to send multiple messages using only 1 GSM module?
Sat Feb 01 2020, 10:12 AM
Pearl Olin
Hello,
Wed Jan 22 2020, 06:16 PM
MINU CHAUDHARY
I m getting errors while simulation process during interfacing socket output and lcd... Can i get the report of ur project which is same as us.

Downloads

Comments

Mirza123
Thu Jun 25 2020, 03:46 PM
eunicelove124
Mon Jun 22 2020, 03:03 PM
cerouno
Tue Jun 16 2020, 05:10 PM
Marce
Sat Jun 13 2020, 09:43 PM
Davidthils
Thu May 21 2020, 12:44 PM
Jakeror
Thu May 21 2020, 01:28 AM
motorCar
Wed May 20 2020, 07:05 PM
Vordrync
Wed May 20 2020, 11:52 AM

Online

Guests: 35, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 01 2020, 11:07 PM
PS: I am a new learner thats why my question may s...
Mirza123 Avatar
Posted By Mirza123
Wed Jul 01 2020, 02:05 PM
Thanks for the assistance. I have read the data sh...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jul 01 2020, 10:12 AM
See section 15 (Ports) of the data sheet. ...
wimac Avatar
Posted By wimac
Tue Jun 30 2020, 10:05 AM
How did you know that it is not 8051. Mirza123It i...
Mirza123 Avatar
Posted By Mirza123
Tue Jun 30 2020, 08:39 AM
It seems ports on the AT89LP2052 is not like on th...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jun 30 2020, 08:34 AM
It seems ports on the AT89LP2052 are not like on t...
Mirza123 Avatar
Posted By Mirza123
Thu Jun 25 2020, 04:07 PM
Hello!i am trying to use AT89LP2052 ( AT89LP2052 h...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jun 17 2020, 09:42 PM
It is about capacitor? i should put it between Vcc...
cerouno Avatar
Posted By cerouno
Wed Jun 17 2020, 10:37 AM
Take another look at the power supply to the LCD.A...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Jun 17 2020, 02:01 AM
Take another look at the power supply to the LCD.A...