Step 1: The Embryo

Top  Previous  Next

This step corresponds to test_stg_lib_1.

The embryonic project defines the settings and compiles correctly. It does nothing else.

 

The steps

We assume you are not going to type everything in from scratch and just open the test_agg_lib_1 project. Notice that...

1. Settings.tbs and settings.tbh are added to the project (from current_library_set\settings\trunk\). There is also a necessary line in global.tbh: include "settings\trunk\settings.tbh".
2. There is a settings.xtxt configuration file with type= configuration file, and format= Setting (STG) library. There is a line in global.tbh that is required for the configuration file to work correctly: includepp "settings.xtxt".
3. In the configuration file, Debug Printing is enabled. This allows you to "see what's going on". Don't forget to disable this later, after you've made sure that the library operates as expected.
4. There are empty callback procedures in device.tbs:

 - callback_stg_error();

 - callback_stg_pre_get();

 - callback_stg_post_set();

5. On_sys_init() calls stg_start() — this is required to make the library operational. Notice how we check the code returned by stg_start()!
6. All settings are defined, as on the screenshot shown here.

 

The result

Compile and run the project — you will see the output like this:

 

 

STG> ---START---

STG> Initialize RAM (volatile) settings...

STG> STG_RESTORE_MULTIPLE(), init_mode= RAM ONLY

STG> STG_SG()

STG> SET 'CPTN(255)' to '0' : OK

STG> STG_SG()

STG> SET 'PIP(255)' to '0' : OK

STG> RAM (volatile) settings initialized

STG> Number of settings: 6

STG> Non-volatile memory space required: 193

 

 

You see this printout because the Debug Printing option is enabled (checked).

 

This sample printout from the output pane shows that both RAM settings got initialized — it happens automatically because, obviously, RAM settings need initialization every time the program runs. As for our non-volatile settings, we are supposed to find a way to initialize them in some convenient way. Read on...