cancel
Showing results for 
Search instead for 
Did you mean: 

Using ST7 lite19B EEPROM in assembly

jps
Associate II
Posted on January 30, 2009 at 04:48

Using ST7 lite19B EEPROM in assembly

3 REPLIES 3
jps
Associate II
Posted on December 15, 2008 at 10:32

Hi,

I need to store some events (overtemp, under voltage,) in one byte and to be able to read this byte and to display these events at the next start-up (reset) of my card.

So I plan to upgrade from my usual ST7lite15B to a ST7lite19B and use the EEPROM to store this ''event'' byte.

is it possible to receive, from someone who already did that, an exemple in assembly on how write and read a byte in the EEPROM in assembly?

Do you think it's possible to store this ''event'' byte directly in Flash in assembly using my standard ST7 lite 15B?

Any idea is welcome

Regards

Whitebull

fggnrc
Associate II
Posted on December 17, 2008 at 06:04

Whitebull,

please see AN1324 section 4.1.4

That code should work for a ST7FLite19B...

As regards using flash as an EEPROM substitute, it's feasible but your data must be stored in Sector 1 which is the only flash portion that can be programmed while the microcontroller is running your code (see ST7Lite15B datasheet and IAP - in application programming - documentation).

regards,

EtaPhi

ciccio
Associate II
Posted on January 30, 2009 at 04:48

Hi,

I use C language.

I can reporto the .LST file generated by compiler.

C language:

EECSR |= BIT_1; // E2LAT = 1

EEPROM[INDICE_EEPROM] = MyVar;

EECSR |= BIT_0; // E2PGM = 1, inizio scrittura

while (EECSR & BIT_1) // attesa termine programmazione

{

RefreshWatchdog();

}

ASM generated (Hiware):

704: EECSR |= BIT_1; // E2LAT = 1

0682 1230 BSET 0x30,#1

705: EEPROM[INDICE_EEPROM] = MyVar;

0684 b601 LD A,MyVar:1

0686 be00 LD X,MyVar

0688 c70029 LD EEPROM:41,A

068b cf0028 LD EEPROM:40,X

709: EECSR |= BIT_0; // E2PGM = 1, inizio scrittura

06aa 1030 BSET 0x30,#0

710: while (EECSR & BIT_1) // attesa termine programmazione

06ac 2003 JRT *5 ;abs = 06b1

711: {

712: RefreshWatchdog();

06ae cd0770 CALL ProcSetup:1904

06b1 0230fa BTJT 0x30,#1,*-3 ;abs = 06ae

713: }

bye