Write n Read 24C04
it depends on how hard you work... thats how you get paid.. Good Luck!! we will all wait for update
Thanks for your confidence on me and guiding me in right direction.
Here is the code attached. i am writing 70 bytes of data in to 24c04 and read back.
I have simulated in proteus, yet to test in hardware. Please check and comment.
Please guide how to integrate this code with serial interrupt communication code,
which i have already have. I have attached both. Please guide me. (You can see the time of post)
Just guess how much time i am diverting/ devoting.
Thanks all
sks
I want to write a code to receive data from serial port and save those at RAM location starts from 30H, then write those data from RAM Locations into the EEPROM 24C64 (this process can be simultaneously done).sks
Writing to the 2404 takes at least 5mS ,so you have to limit the data rate
and/ or buffer the data.
After resetting the system or resetting the power, micro should read those saved data from 24C64 and write from 30H of RAM location until new data from serial port is received.
Can you guide me by writing a Pseudo code or Algorithm for this?sks
I don't understand what your system needs to do, so can't really help.
Can you tell us exactly what you are doing so we can give useful advice ?
Thanks for the quick replay.
"Can you tell us exactly what you are doing so we can give useful advice ?"
I am doing a LED Message Display project. For that i am writing code Module/part by Module/part. Right now, I am using Windows Hyper Terminal for inputting data. Those data should be displayed at port2 and simultaneously saved in eeprom.
After a power reset or failiure we are losing the data from buffer/ram, ok so the system should read the eeprom first and save those data in buffer for display.
I think i have described in details, Please suggest if any other way to do it.
"Writing to the 2404 takes at least 5mS ,so you have to limit the data rate and/ or buffer the data."
Sorry Phil, i don't understand the above line. Please clarify a little.
Thank you very much Phil.
sks
I just completed my 2nd code including serail interrupt with my ist code i had posted.
The write cycle does not stop after sending a stop condition ti I2C bus, i dont know why.
Please check and guide.
Thanks
sks
GETDATA: MOV R0,#50H GET: JNB RI,GET ;YOU CANNOT HAVE POLLING IN INTERRUPT ROUTINE MOV A,SBUF CJNE A,#0DH,SAVE CLR RI CLR F0 RETI SAVE: MOV @R0,A INC R0 CLR RI JMP GET
"Writing to the 2404 takes at least 5mS ,so you have to limit the data rate and/ or buffer the data."
Sorry Phil, i don't understand the above line. Please clarify a little.sks
to complete a write cycle on EEPROM, it takes a max of 10ms (see datasheet first page "Features") so what he is trying to say is that you need to keep data rate low so that your write operation completes before you try to write new data on memory.
Now to overcome this low datarate problem there is something like "Page Write" see datasheet for more information. In page write you can write 32 bytes (32k and 64k memories) together without sending a stop condition on i2c bus. and it takes the same amount of time to write 32 bytes as for 1 byte. so you can have manage dual buffer where one buffer can do reading and other buffer writes data reading from serial. so it is like a buffer exchange.
"Writing to the 2404 takes at least 5mS ,so you have to limit the data rate and/ or buffer the data."
Sorry Phil, i don't understand the above line. Please clarify a little.sks
In computer terms it takes a long time to write a byte into an eeprom.
As Ajay said, up to 10mS for the older ones so you must send bytes slowly
if you want to write them as they arrive.
This is not a problem typing into Hyperterminal, but is if you use
a proper text composing program.
I have attached pseudo code for one way to write your program.
It loads and displays the current message on reset.
To set a new message, type it in. The program saves each byte as you type it.
The display stops until you end the message with 0dh, then is displays the
new message.
I call routines called writeeprom and readeeprom.
These are basically your WRITE_DATA and WRITE_DATA used to r/w one byte at a time.
[ Edited Thu Nov 17 2011, 05:41 am ]
Thanks for elaborating things and posting a pseudo code. I will try to follow the same and write my fresh code.
I don't know whether i will pass or fail.
Thanks
sks
I don't know whether i will pass or fail.
sks
Do not think about result just do it.. keep faith in yourself... good luck!