App Notes

Download zip archive

Key Ideas

  • Creating and modifying persistent data objects using DataStore.


The eMote .NOW comes with on-board flash memory that can created and modified be used to store and modify objects that are persistent across system restarts. Using the DataStore facility you can write one program that creates and stores data and another program that retrieves and exfiltrates it.


.NOW 1.0, eMote version 4.3_1.0.10.

Complexity Level

Fairly introductory. There is some complexity in the DataStore class itself.


Connect the eMote to your PC in the usual way and run the program. See the FAQ for details.


See the introduction to DataStore for an overview.

This app note illustrates how to store sensed data and later retrieve it for further processing. There are two phases. In the sensing phase, simulated sensors are read and the sum and count of the sensed data are saved using DataStore. If a sensor is sensed more than once, the stored value is retrieved and updated. In the processing phase, the values are retrieved and, in this app note, are compared with values saved in the program as confirmation.

During the sensing phase, a timer periodically samples data and stores it. When five different sensors have been sampled, the timer stops and AutoResetEvent is set that allows the main program to move into the processing phase.

In the processing phase, the program retrieves the data and checks it for accuracy.


In the app note, DataStore.DeleteAllData is used to initialize the storage. This marks existing data allocations as invalid but does not actually recover the space; this is left to the garbage collector. We could have used EraseAllData instead; see the introduction for further discussion.

In the processing phase, DataStore.ReadAllDatareferences is used to recover the data on the flash. In this app note we store the data for five sensors. To illustrate how ReadAllDataReferences work, we recover them in batches of two references, so that we will do this three times. When a null reference appears in the array of references, we have read them all.