.setdata Method (Previously .set)

Function:

Writes data into the EEPROM.

Syntax:

stor.setdata(byref datatoset as string, startaddr as word) as byte

Returns:

Actual number of bytes written into the EEPROM.

See Also:

stor. Object, stor.getdata, stor.size


Part

Description

datatoset

Data to write into the EEPROM.

startaddr

Starting address in the EEPROM from which the data will be stored (addresses are counted from 1, if you set this parameter to 0 it will be interpreted as 1).


Details

The operation has completed successfully if the value returned by this method equals the length of the datatoset string. If this is not the case, then the write has (partially) failed and there may be two reasons for this: a physical EEPROM failure or an invalid startaddr (too close to the end of the memory to save the entire string).

Notice that when stor.setdata executes, an offset equal to the value of stor.base is added to startaddr. For example, if stor.base returns 9 and you do stor.setdata("ABC",1), then you will actually be reading the data starting from physical EEPROM location 9. If you set stor.base to 1, you will be able to access the EEPROM right from the physical address 1.

By default, stor.base is set in such a way as to allow access to the EEPROM starting from the address just above the special configuration area of your device — for details on what this area actually stores, see your device's platform documentation (for example, the EM1000's is here). By setting stor.base to 1, you are allowing access to the special configuration area.

A tip note icon.With Tibbo BASIC/C release V2, this method had to be renamed from .set to .setdata. This is because the period (".") separating "stor" from "setdata" is now a "true" part of the language (i.e., it is recognized as a syntax unit, not just part of identifier). Hence, Tibbo BASIC/C sees "stor" and "set" as separate entities and "set" is a reserved word that can't be used.


.setdata Method (Previously .set)

Details