file: asimet_processing.html
09 Apr 2002

ASIMET Binary Data Processing for Modules with FLASH memory

ASIMET instrument modules with FLASH memory 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 acdquired. 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 and the C compiler. Note that the WND module uses these same formats internally, but performs a data packing step to save storage space before writing data to FLASH memory. In either case, a conversion step is required to restore the data to human-readable ASCII engineering units.

The individual FLASH memory record formats are provided with each ASIMET module command set; refer to the 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 will compile under gcc for Linux or the DJGPP gcc package for DOS.

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

Under gcc for DOS, as follows:
gcc -o wndasc.exe 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.met 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.met is left untouched.