Memory
MC68HC08AZ32A Data Sheet, Rev. 2
44
Freescale Semiconductor
NOTE
None of the bit locations are actually programmed more than once although
the byte was programmed eight times.
When this technique is utilized, a program/erase cycle is defined as multiple program sequences (up to
eight) to a unique location followed by a single erase operation.
2.7.2.1 Program/Erase Using AUTO Bit
An additional feature available for EEPROM program and erase operations is the AUTO mode. When
enabled, AUTO mode will activate an internal timer that will automatically terminate the program/erase
2.7.2.2 EEPROM Programming
The unprogrammed or erase state of an EEPROM bit is a 1. Programming changes the state to a 0. Only
EEPROM bytes in the non-protected blocks and the EENVR register can be programmed.
Use the following procedure to program a byte of EEPROM:
1.
Clear EERAS1 and EERAS0 and set EELAT in the EECR.(A)
NOTE
If using the AUTO mode, also set the AUTO bit during step 1.
2.
Write the desired data to the desired EEPROM address.(B)
3.
Set the EEPGM bit.(C) Go to Step 7 if AUTO is set.
4.
Wait for time, tEEPGM, to program the byte.
5.
Clear EEPGM bit.
6.
Wait for time, tEEFPV, for the programming voltage to fall. Go to Step 8.
7.
Poll the EEPGM bit until it is cleared by the internal timer.(D)
8.
Clear EELAT bits.(E)
NOTE
A. EERAS1 and EERAS0 must be cleared for programming. Setting the
EELAT bit configures the address and data buses to latch data for
programming the array. Only data with a valid EEPROM address will be
latched. If EELAT is set, other writes to the EECR will be allowed after a
valid EEPROM write.
Table 2-3. Example Selective Bit Programming Description
Description
Program Data
in Binary
Result
in Binary
Original state of byte (erased)
N/A
1111:1111
First event is recorded by programming bit position 0
1111:1110
Second event is recorded by programming bit position 1
1111:1101
1111:1100
Third event is recorded by programming bit position 2
1111:1011
1111:1000
Fourth event is recorded by programming bit position 3
1111:0111
1111:0000
Events five through eight are recorded in a similar fashion