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 Nov 21 2019, 12:30 PM
raj2555
how to interface 8051 microcontroller with NRF24L01+ module
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html

Downloads

Comments

auwal
Tue Nov 19 2019, 03:13 PM
ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM
DeepakBGattani
Mon Nov 11 2019, 01:31 PM
Jeanbusatta
Sun Nov 10 2019, 04:42 AM
mdayaz
Sat Nov 09 2019, 03:41 PM
baoyen123
Fri Nov 08 2019, 10:06 AM
xiwang
Fri Nov 08 2019, 07:28 AM

Online

Guests: 42, Members: 0 ...

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

Members: 38105
Newest member: auwal
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 19 2019, 10:44 PM
The 8051 has too little memory to do anything us...
ilylily07 Avatar
Posted By ilylily07
Mon Nov 18 2019, 09:54 AM
0v7670 camera interfacing with stc 8051.using asse...
Jeanbusatta Avatar
Posted By Jeanbusatta
Sun Nov 10 2019, 04:43 AM
ty, really needed it
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Oct 22 2019, 05:18 AM
wimac Avatar
Posted By wimac
Mon Oct 21 2019, 09:18 AM
I’ve been following this thread and looking at the...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:09 PM
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 03:02 PM
sir, when i on display ,sometime 3rd display is no...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sun Oct 20 2019, 02:53 PM
sir, when i on display ,sometime 3rd display is no...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 20 2019, 12:21 AM
Your code seems okay on my simulationTry my code o...
s_dinesh40@yahoo.com Avatar
Posted By [email protected]
Sat Oct 19 2019, 07:13 PM
please find video attachment. 3rd & 4th displa...