programming EEPROM during interrupts

Started by Wade A Smith September 20, 2004
I'm working with the 912D60A.

We have a communicatioin process running all the time. But every few
hours
we need to backup some data to EEPROM. On the HC11E20 we do the
following

set up the erase for the byte in EEPROM
set up Timer4 to fire off in 10milliSec
return to main loop

TOC4 interrupt hander (HC11 code)
PPROG = 0; /* turn OFF programming voltage */
if (EEAction != programEE)
{
EEAction = erasingEE;
PPROG = EELAT;
*EEDest = *EESrc; /* move byte (0,Y) into EElocation (0,X) */
PPROG = EELAT+EEPGM; /* turn on programming vlotage */
TOC4 = TCNT + TIM10MS; /* intr in 10 millisec */
TFLG1 = TOC4FLAG; /* clear TOC4 interrupt flag */
}
else /* EEAction == erasingEE */
{
if (byte_count == 0)
{
EEAction = finishedEE;
asm(" PSHX");
asm(" LDX #REGBASE ; END OF THE PROCESS");
asm(" BCLR TMSK1,X #$10 ; DISABLE TOC4 INTERRUPT");
asm(" PULX");
return; /* RTI */
}
EEAction = programEE;
PPROG = BYTE+ERASE+EELAT; /* 0x16 */
*EEDest = *EESrc; /* move byte (0,Y) into EElocation (0,X) */
PPROG = BYTE+ERASE+EELAT+EEPGM /* 0x17 */
TOC4 = TCNT + TIM10MS; /* intr in 10 millisec */
TFLG1 = TOC4FLAG; /* clear TOC4 interrupt flag */
} /* end if else */
return; /* RTI */

This works just fine.
Now, I try the same thing on the 12D60A and it doesnt seem to program
anything.
At start up, before interrupts are enabled, we do some calculations and
write the
results to EEPROM calling a 10milliSec delay loop. That works.

Anyone have some code to do the same from an interrupt?

wade