DATA EEPROM

Top  Previous  Next

The AT89S8252 has a built in 2Kbytes flash EEPROM.

You can use this to store data.

Two statements are provided : WRITEEEPROM and READEEPROM.

 

WRITEEEPROM var [, address ]

 

var

Any BASCOM variable name.

Address

The address of the EEPROM where to write the data to.

Ranges from 0 to 2047.

When you omit the address the address will be assigned automatically. You can view the assigned address in the report file.

 

READEEPROM var [, address ]

 

var

Any BASCOM variable name.

Address

The address of the EEPROM where to read the data from.

Ranges from 0 to 2047.

You can omit the address when you have written a value before with the WRITEEEPROM var statement.

Because in that case the compiler knows about the address because it is assigned by the compiler.

 

Example

Dim S As String * 15 , S2 As String * 10

S = "Hello" : S2 = "test"

 

Dim L As Long

L = 12345678

Writeeeprom S

Writeeeprom S2                          'write strings

Writeeeprom L                           'write long

 

S = "" : S2 = "" : L = 0                'clear variables

Readeeprom L : Print L

Readeeprom S : Print S

Readeeprom S2 : Print S2

End