file: wxtcflash.html
28 Aug 2009

CompactFLASH CARD STORAGE FORMAT - WXT520 Weather Module

The following describes the data storage and record format of CompactFLASH memory cards used in ASIMET instrumentation with Ver4.xx and later firmware.

CompactFLASH card sectors of interest:

Description of WXT520 data file beginning at Sector 322

The CFLASH data file (yourname.DAT) consumes most of the CompactFLASH card. Each one-minute record is 202 bytes long and contains the following:

The actual C language struct is reproduced here to show the format of the stored image. All float values are IEEE single-precision as described below.

 /* this is the WXT520 1-minute record structure (202 bytes) */
 struct WXT_record
   {
   struct time_type time1;      /* 8 bytes of time */
   float Dm_dir_avg[11];
   float Sm_spd_avg[11];
   float speed_min;
   float speed_max;
   float compass_dir[11];
   float tilt_x_avg;
   float tilt_y_avg;
   float Ta_air_temp;
   float Ua_rel_humidity;
   float Pa_air_pressure;
   float Rc_rain_accum;
   float Rd_rain_duration;
   float Ri_rain_intensity;
   float Hc_hail_accum;
   float Hd_hail_duration;
   float Hi_hail_intensity;
   float Rp_rain_peak;
   float Hp_hail_peak;
   unsigned short used;     /* set to 0xA5A5 upon record write */
   };

* time structure */ struct time_type { unsigned char hour; unsigned char min; unsigned char sec; unsigned char day; unsigned char dow; /* day of week - NOT USED */ unsigned char mon; unsigned int year; };

Note that time structure is NOT ANSI-compatible.

Data is written to the Compact FLASH card every 10 minutes, immediately following the acquisition of data at the end of the 9th, 19th, 29th, 39th, 49th,and 59th minute of each hour.


*** IMPORTANT NOTE ***

The byte order of the some numeric values stored by the firmware is reversed relative to Intel-based PC's. (That is, a long integer (4 bytes) or short integer (2 bytes) stored by a PC will be LS byte first in memory, and floats with mantissa first). The firmware stores shorts and longs with MS byte first in memory. Also, single precision IEEE float values are big-endian. This must be accounted for when processing the data. See the float storage format below.


The "used" flag value is used to simplify finding the end of valid records the .DAT file; as each record is written, the "used" flag is set to A5A5h to provide a distinct pattern to search on for good records.


"float" 4 byte values are IEEE-754 single-precision float.

Storage format for these float values is as follows:

      byte addr      +0         +1           +2         +3
      contents     SEEEEEEE   EMMMMMMM    MMMMMMMM   MMMMMMMM

            where S => Sign bit;  1 = negative,  0 = positive
                  E => Exponent (2's comp) with offset 127 (decimal)
                  M => 23-bit normal mantissa (highest bit always 1 and
                           therefore not stored)