[Icc-mot] Re: memory sections

Wade A Smith warm38 at juno.com
Thu Jul 26 08:49:28 PDT 2007


 
On Wed, 25 Jul 2007 12:11:25 -0700 (PDT) icc-mot-request at imagecraft.com
writes:
> Date: Wed, 25 Jul 2007 10:44:15 +0300
> From: "Edward Karpicz" <ekarpicz at freemail.lt>
> Subject: Re: [Icc-mot] Re: memory sections
> 
> Wade A Smith wrote:
> 

> don't have to worry about how D64 EEPROM module is made. Simulated 
> or not 
> it's independent of main D64 flash.

"it's independent of main D64 flash" 
Good to know.  That helps my understanding.
 
<snip>

> Again, please forget this stupid "simulated" thing. Simulated or not 
Shoulda spelled it "stoopid" for emphasis.  8-)

<snip>

> OK here a sample of program - erase routines. They must work with 
> interrupts 
> enabled. Of course EEPROM is not readable while being programmed. So 
> your 
> interrupts shouldn't access EEPROM locations.
> 
> 
> 
> 1) EEPROM is remapped to 0x1000, see EEPROMInit function.
> 2) Make sure OSCCLOCK define specifies your crystal clock frequency 
> in kHz
> 
> ///////////////////////////////////////////////
> #include <mc9s12d64.h>

<snip>

> //
> // EEPROMSectorErase erases 4-byte eeprom sector at adr
> //
> void EEPROMSectorErase(short *adr)
> {
>    if( 1 & (int)adr)
>    {
>       //adr is misaligned. Signal error here and exit
>       return;
>    }
> 
>    // clear possible previous PVIOL and ACCERR errors
>    ESTAT &= (0x20 | 0x10);
> 
>    // latch EEPROM sector to be programmed
>    *adr = 0;
>    // write sector erase command to ECMD
>    ECMD = 0x40;
>    // start erasing
>    ESTAT &= 0x80;
> 
>    // wait until done
>    while ( !(ESTAT & 0x40));
> }

Edward,  what about setting 

    ECNFG = ECBEIE;

and exiting and letting the interrupt handler take care of the next step?
 That would be the ideal situation for us. That is what the HC11 code
does.
That gives me something to play with/experiment on.

Thanks for the code.  What I have does just about the same thing, but
there are some bad differences which makes my code not work. I'm working
to change those in light of your info and code.

Thanks bunches!

Now, back to head scratching and mumbling to myself....

wade smith



More information about the Icc-mot mailing list