Hi,
On the 9S08Dx series there is both EEPROM and Flash EPROM.
As the clever reader, you have discovered that it is the same kind of memory behind those two words.
The algorithms for erasing/programming the two memories is the same.
The difference is that the memories are divided into sectors, where the Flash part has 768 byte and the EEPROM can be either 4 or 8 byte sectors.
The Flash and the EEPROM are totally independant of each other. So it is quite easy to erase/write something in the EEPROM. The same thing applies to the Flash EPROM, but you must be sure that you have put the erase/programming code in the EEPROM.
If the EEPROM is full of variables, the classic solution with the code copied into the stack of RAM should be used. Ofcourse you can use static buffers to store the RAM copies in, but it takes some valuable space.
Why does it take 20 mS to erase either a 768 byte or a 4 byte sector?
I think that the EEPROM is much faster, but that when building the hardware, the one time solution turned out to be simpler.
As all timing is handled by built-in logic, it is quite simple to run and debug the code. You can single-step thru all the code without beeing afraid of burning up some memory.
But, remember that when erasing/programming the Flash EPROM, interrupts are not allowed.
If an interrupt is running it will destroy the data that is stored in the Flash EPROMs input buffer.
Regards,
Ake