Forums

S12E128 EEPROM emulation code

Started by Bruce McMillan October 9, 2003
List mates,
As a follow up to discussions on this list re E128 and it's lack of
EEPROM, I've uploaded code code to provide 1KB of EEPROM emulation.
File is: E128_EEPROM_EMULATION.ASM
Code is derived from the original Serial Uploader written by Gordon.

Brief description follows:
**********************************************************************
* S12E128 Simple EEPROM EMULATION
* 1KB of S128 Flash is used as byte-writable EEPROM. This flash sector
* is written to RAM at program startup, and is wrtten to as RAM during
* program execution, then the RAM block is written to Flash as part of
* program shutdown. Writing of Flash is done by copying about 200B of
* relocatable code to RAM and executing from there. 1KB of RAM needs
* to be dedicated to this task.
* Flash is guaranteed for 10,000 erase-program cycles. So this
* code is suitable for applications where life-time power-ups is
* expected to be less than this number. Motorola Application note
* AN2302 addresses more sophisticated strategies that can extend
* this life.
* Bruce McMillan 9 October 2003
**********************************************************************

Hopefully we can show ourselves to be community-minded start to make
better use of the terrific resource that this list should be - by the
sharing of more code snippets.

tks
bruce.






That's great Bruce.

Here's a link to the file area for those that don't
know where it is..

http://groups.yahoo.com/group/68HC12/files/

Darren
> -----Original Message-----
> From: Bruce McMillan [mailto:] > List mates,
> As a follow up to discussions on this list re E128 and it's lack of
> EEPROM, I've uploaded code code to provide 1KB of EEPROM emulation.
> File is: E128_EEPROM_EMULATION.ASM
> Code is derived from the original Serial Uploader written by Gordon.
>
> Brief description follows:
> **********************************************************************
> * S12E128 Simple EEPROM EMULATION
> * 1KB of S128 Flash is used as byte-writable EEPROM. This flash sector
> * is written to RAM at program startup, and is wrtten to as RAM during
> * program execution, then the RAM block is written to Flash as part of
> * program shutdown. Writing of Flash is done by copying about 200B of
> * relocatable code to RAM and executing from there. 1KB of RAM needs
> * to be dedicated to this task.
> * Flash is guaranteed for 10,000 erase-program cycles. So this
> * code is suitable for applications where life-time power-ups is
> * expected to be less than this number. Motorola Application note
> * AN2302 addresses more sophisticated strategies that can extend
> * this life.
> * Bruce McMillan 9 October 2003
> **********************************************************************
>
> Hopefully we can show ourselves to be community-minded start to make
> better use of the terrific resource that this list should be - by the
> sharing of more code snippets.
>
> tks
> bruce.




--- In , "Bruce McMillan" <bruce_at_pocket_neurobics@y...> wrote:
> List mates,
> As a follow up to discussions on this list re E128 and it's lack of
> EEPROM, I've uploaded code code to provide 1KB of EEPROM emulation.
> File is: E128_EEPROM_EMULATION.ASM

Hi Bruce,

Following your example I have started a directory on the 256 chip.

The intention is to use it as a repository of usefull bits, found, written, begged, or borrowed.

For a start I have listed all manuals found on the net relating to the HC12, of course with accent on the 256.

Might save some poor sucker the time it took me to locate the things.

I have also used your post pointing to your uploaded file and uploaded my EEPROM routines as well.

My EE clock divider is unusual in the sence it uses code instead of Equates so can be used with option switches if you want to experiment with various Xtals, like me:-)

It also contains the filter code used to allow writing bytes, words or sectors to the EEPROM.
Bytes and words will be aligned and existing data will be preserved.
It is heavily commented, with some references to manuals.

Unfortunately I can't publish the NI serial link code, it seems copyrighted, dunno why, it can only be used with NI.

Also, sorry about the Klunker code, I am a 6800 man:-) Cheers,

Theo




Theo,
way to go!
Routines to write byte oriented data to eeprom - I'm sure code to do
this has been written time & time again because nobody has made the
effort to post to a repository.

I'm sure this will convince others of the value of contributing
(recognising that a few already have - CAN bootloader etc).

bruce
_________________________________
--- In , "theobee00" <yahoodump2@o...> wrote:
> --- In , "Bruce McMillan"
<bruce_at_pocket_neurobics@y...> wrote:
> > List mates,
> > As a follow up to discussions on this list re E128 and it's lack of
> > EEPROM, I've uploaded code code to provide 1KB of EEPROM emulation.
> > File is: E128_EEPROM_EMULATION.ASM
>
> Hi Bruce,
>
> Following your example I have started a directory on the 256 chip.
>
> The intention is to use it as a repository of usefull bits, found,
written, begged, or borrowed.
>
> For a start I have listed all manuals found on the net relating to
the HC12, of course with accent on the 256.
>
> Might save some poor sucker the time it took me to locate the things.
>
> I have also used your post pointing to your uploaded file and
uploaded my EEPROM routines as well.
>
> My EE clock divider is unusual in the sence it uses code instead of
Equates so can be used with option switches if you want to experiment
with various Xtals, like me:-)
>
> It also contains the filter code used to allow writing bytes, words
or sectors to the EEPROM.
> Bytes and words will be aligned and existing data will be preserved.
> It is heavily commented, with some references to manuals.
>
> Unfortunately I can't publish the NI serial link code, it seems
copyrighted, dunno why, it can only be used with NI.
>
> Also, sorry about the Klunker code, I am a 6800 man:-) > Cheers,
>
> Theo