|
by Jamie
Pollock
Start ý Problem
Solving ý EEPROM Programming ý Some
Assemblyý ý Interfacing the LCD ý Sources
and PDF
EEPROM PROGRAMMING
Next, the problem of programming the
EEPROM exists. Because the bootloader program was written to relocate
our program in RAM, a few modifications enable us to relocate our
program into EEPROM. PCBUG11 could easily be used to perform this
function. I felt that understanding the function of the EEPROM made
it necessary to write the code myself.
Listing
2 is a robust version of the
bootloader with some special EEPROM modifications. This code helps
extend the EEPROM life by choosing which bytes need to be erased or
programmed. The EEPROM in the ý6811 has a finite programming lifetime
and this code utilizes Motorolaýs recommendations for extending the
EEPROM life to its maximum.
Basically, the code decides first if
the Source and the Target byte are the same. If they are, then it
skips the erasing and programming sections for the byte. Itýs amazing
how many times this actually occurs during development.
If the Target and Source are not the
same, the code decides if the Target byte needs to be erased first
(set to $FF). An EEPROM location in which the only changes are turning
1s into 0s doesnýt need the byte erased first. If the byte doesnýt
need to be erased, the code jumps to the programming section.
Finally, if the Source and Target byte
are sufficiently different, the erase code is executed followed by
the programming code. Special registers are modified during erasure
and programming. A good explanation of these functions and some example
code are given in the ý6811 reference manual.
This method is good for developing the
program. But, for the final product, the EEPROM will be entirely erased
then programmed.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |