Getting Started

Top  Previous  Next

Minimal steps

1. Add settings.tbs and settings.tbh files to your project (they are in current_library_set\settings\trunk).
2. Add the following to the includes section of the global.tbh file:


includepp "settings.xtxt"

include "settings\trunk\settings.tbh"


3. Create empty callback procedure bodies (presumably in the device.tbs, and according to declarations in settings.tbh):


sub callback_stg_error(byref stg_name_or_num as string,index as byte,status as en_stg_status_codes)

end sub


sub callback_stg_pre_get(byref stg_name_or_num as string,index as byte,byref stg_value as string)

end sub


sub callback_stg_post_set(byref stg_name_or_num as string, index as byte,byref stg_value as string)

end sub


4. Add an empty settings.xtxt file to your project. In the Add New File to Project dialog set the Type to Configuration File, and the Format to STG (Settings) Library.
5. Define desired settings through the configurator.
6. In the On_sys_init() event handler (or some other place you deem logical), add a call to the stg_start(). This function may fail, so check the returned status code.
7.Take care of setting initialization.


Additional Steps

1.By default, non-volatile settings are stored in the EEPROM. You can also store the settings on the flash disk. EEPROM offers limited (but usually sufficient) storage with a faster access, while the flash disk offers a virtually unlimited storage with a slower access. Go with the EEPROM whenever possible. If you want to use the flash disk, select Use Flash Disk option in the configurator; then set the desired Filename (this is the name of the file that will store setting values).
2. Set Redundancy to Non-volatile only to increase the reliability of settings by keeping two independent copies of their values. The penalty is in the reduced performance of the library (increased setting access time) and doubling of the EEPROM (or flash) memory storage needs (see Operation Details for explanation how memory is allocated for both copies).