AN2690 Freescale Semiconductor / Motorola, AN2690 Datasheet - Page 6

no-image

AN2690

Manufacturer Part Number
AN2690
Description
Low Frequency EEPROM Emulation on the MC68HLC908QY4
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2690
Method 2 — Reset Forced Anywhere in Main Loop
Advantages of
Method 2
Disadvantages of
this Method 2
6
Low Frequency EEPROM Emulation on the MC68HLC908QY4
This method is more flexible than Method 1, but is also more complicated. It
allows the program to call the ProgEEprom command at any point within the
application, and then to return to the next instruction after the call, when
EEPROM programming is complete.
Before calling the ProgEEprom routine, any critical variables should be pushed
onto the stack. The ProgEEprom routine also stores the internal registers on
the stack, before jumping to the ForceRst function. The JSR instruction
automatically pushes the return address (instruction after JSR ForceRst), so
that the program can return to this point in the application after the
programming is complete. The ForceRst routine copies the current stack
pointer and a ForceRst code to predefined RAM locations, before forcing the
reset with an illegal opcode. See
When the application restarts after a forced reset, the previously stored data
registers should immediately be restored to the specific MCU registers. The
code retrieves the saved stack pointer from RAM and adjusts it to point to the
start of the copied data (see
Once the variables are restored and the other initialization performed, the
EEPROM emulation routine should be called.
The code then switches back to the external oscillator before returning to the
instruction following the forced reset. This is achieved by loading the original
Stack Pointer (use TXS instruction) and executing an RTS instruction, which
loads the PC with the address stored on the stack. This address is the address
of the instruction immediately following the JSR instruction that was executed
in the ProgEEpom routine. The process restores the contents of the internal
registers before executing a RTS, which returns to the main routine. See
Figure 3
Freescale Semiconductor, Inc.
For More Information On This Product,
Resumes code execution at the instruction after the forced reset
Current program status saved and restored
Additional RAM required to store program setup
Relatively long time to switch from internal oscillator to crystal
(approximately 125 ms)
All modules in reset condition.
for a general startup procedure.
Go to: www.freescale.com
Figure
Figure 2
3).
for details.
MOTOROLA

Related parts for AN2690