file: asimet_CFprocessing.html
07 Sep 2007

ASIMET Binary Data Processing for Compact FLASH files

ASIMET instrument modules with Compact FLASH cards store the usual 1 minute data in 1 hour records written after the last 1 minute data of the hour (at minute 59) has been acquired. The one hour records are stored in binary format and except for the WND module, with the individual values corresponding to the internal binary storage formats of the DS87C530 microcontroller, the C compiler, and the requirements of the Compact FLASH card. Note that the WND module uses these same formats internally, but performs a data packing step to save storage space before writing data to Compact FLASH card. In either case, a conversion step is required to restore the data to human-readable ASCII engineering units.

The individual Compact FLASH record formats are provided with each ASIMET module command set; refer to the Compact FLASH record format for the particular instrument. C program source for binary to ASCII conversion is provide for each module. All C code compiles under gcc. Source is named v???asc.c, where ??? corresponds to the ASIMET module designator (HRH, for example, has vhrhasc.c source code for binary to ASCII conversion).

Due to the idiosyncracies of microprocessor and compiler design, some manipulation of the binary before processing may be required. In addition, PC's and workstations may differ. Source code for "byte-swapping" on PC's is included; you may need to modify (or possibly eliminate) this code for some non-PC hardware platforms. The included source is named v???swab.c, where ??? corresponds to the ASIMET module designator (HRH, for example, has vhrhswab.c source code for byte swapping the binary file before performing the binary to ASCII conversion).

The C source code and references

HOWTO build the executable files and process a data file

As noted, the source code is known to compile under gcc for Linux.

For example, under gcc for Linux, compile as follows:
gcc -o wndasc wndasc.c

To convert binary data files from the WND module to ASCII format, use the following commands to call the conversion programs (these calls assume the executable files are in the current directory):

./wndswab wnd021502.dat wnd021502.swb

./wndasc wnd021502.swb wnd021502.asc

The intermediate binary file wnd021502.swb is byte swapped for 80x86 (PC) processors (since Franklin C51 compiler byte-order is MS byte first in memory). The ASCII output file will be wnd021502.asc; the original file wnd021502.dat is left untouched.