Dear Sir,
I am using ADUC841 microcontroller from Analog devices,which consists of 8052 core.In this it is having 4Kbytes of Flash data memory.I wrote the routines as mentioned in application note for writing the data in Flash.But the data is not storing in Flash.So,please send me some guidelines for writing the data in Flash.
Thanking you,
Yours sincerely, Shivakumar Manda
Well, if you wrote the code according to the datasheet, did you also see the note that the bytes in the flash must be erased before new data can be written to them ?
Also, what is the point of the calls to sleep() ?
Seems like the calls to sleep are to allow time for the flash programming operation to occur. Erases are very slow; writes are not that bad, but still slow.
I haven't checked the data sheet, but most flash parts have a way to check to see if an operation is complete, rather than just waiting the worst-case time. I'm usually a little more comfortable with that sort of handshake than a hard-coded delay. But sleeping for longer than the worst-case time spec'd in the datasheet should work.
Seems like the calls to sleep are to allow time for the flash programming operation to occur.
It seems like that to me too, but I was asking for an answer from the OP - if he wrote his code according to the datasheet, then he should have noticed that it is not necessary to manually wait for anything when writing to the flash - the CPU will idle automatically until the write operation finishes. When the next instruction after the write command executes, the write operation is already over.
(Yes, this means that the chip may well spend several milliseconds doing nothing, including not responding to interrupts)
chip may well spend several milliseconds doing nothing, including not responding to interrupts Yes, we should not think about flash like about operational memory. It is hard drive on chip and as hard drive it is slow.