"ERASE 4K CODE BLOCK" fails on P89C51RD2BA

Started by markus_13, April 04, 2005, 04:37:11 AM

Previous topic - Next topic

markus_13

Hi to everybody,

I use a P89C51RD2BA , a 20.000MHz crystal and a
code thankfully inspired by the Keil Example, can be found here:
http://www.esacademy.com/faq/progs/flash.htm

I have a problem with the IAP Routine "ERASE 4K....".

The device seems to hang up somehow while it's doing the
ERASE of a given Block.

After Restart I see that the block is erased correctly, which is on the good side. The bad thing is, the following block is erased as well!!?
I'm not absolutely sure, but i think all following blocks are erased, accept block F!?

One idea is that the code in the example is written for the first generation (the ....H type)? Of course I've adjusted the block adresses and sizes.


Another idea was to ensure that Vcc, which is equal to Vpp on the board, is 5.0 V. That doesn't changed anything.

Can anybody give help please?

Thanx a lot!
markus

markus_13

ok....found the problem by myself:

I changed the Code Optimization Level for the Keil C-Compiler.
using "Reuse common entry code " instead of "Register Variables" fixed the problem.
m.