Discussion in "8051 Discussion Forum" started by    sks    Oct 31, 2011.
Tue Nov 15 2011, 12:49 am
#31
Hard work always payback
it depends on how hard you work... thats how you get paid.. Good Luck!! we will all wait for update
Wed Nov 16 2011, 02:49 am
#32
Hello Mr Ajay, Mr Majoka,and Mr Phil,
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

Wed Nov 16 2011, 03:07 am
#33


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 ?

Wed Nov 16 2011, 12:12 pm
#34
Dear Mr Phil,

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
Thu Nov 17 2011, 01:28 am
#35
Hi Mr Ajay,
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
Thu Nov 17 2011, 01:50 am
#36
your interrupt routine is wrong. see comments below.

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.
Thu Nov 17 2011, 02:04 am
#37
Thanks Mr Ajay.
I will modify the code and post.
Thanks
sks
Thu Nov 17 2011, 05:36 am
#38


"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 ]
Thu Nov 17 2011, 08:55 am
#39
Dear Mr Phil.
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
Sat Nov 19 2011, 10:55 pm
#40

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!

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am