Preliminary 23 Jan 2002 - Details TBD
The first 128K bytes of the FLASH card (bytes 0 - 131071) are used for the SEAS instrument results. These are the results read out by the FF command. The following C structure declaration describes the basic layout, at 26 bytes per record. Be sure to refer to the storage format info at the end of this document. MAXANALYZE is currently hard defined as 5.
/* this is the SEAS instrument results record structure; it holds the time of completion (when the record was written), the SEAS 2 and SEAS 3 concentration for this run, and the total elapsed time in minutes required to acquire this rain sample. Stored in first 128K page of FLASH card. */ struct SEAS_inst_record { unsigned char hour; unsigned char min; unsigned char day; unsigned char mon; unsigned short year; float SEAS2_concentration[MAXANALYZE]; float SEAS3_concentration[MAXANALYZE]; float SEAS2_blank[MAXANALYZE]; float SEAS3_blank[MAXANALYZE]; unsigned short curr_elapsed; unsigned short used; /* set to 0xA5A5 upon record write */ };
The remainder of the FLASH card (bytes 131072 to the end) are used for the SEAS sampling data records - i.e., the MET data and Status Bytes for each minute of operation. These are the results read out by the FR command. The following C structure declaration describes the basic layout, at 34 bytes per record. Again, be sure to refer to the storage format info at the end of this document.
/* SEAS 34 byte packed data record structure for storage in FLASH */ struct SEAS_metstat_record { unsigned char hour; /* time is not packed for ease of verifying */ unsigned char min; unsigned char day; unsigned char mon; unsigned char year; /* year is offset from 2000 (no good after year 2255 :-) */ unsigned short record; /* sequential record number from startup */ short we,wn; /* wind speed m/sec */ /* (short)(we * 100) ==> +/- 327.67 m/s */ unsigned short wsavg; /* (ushort)(wsavg * 100) ==> 0 - 655.35 m/s */ short rh; /* humidity %, deg C */ /* (short)(rh * 100) ==> +/- 327.67 %RH */ unsigned short th; /* (ushort)((th + 20.0) * 1000) ==> -20.000 to +45.535 degC */ short prlev; /* precipitation values */ /* (short)(prlev * 100) ==> +/-327.67 mm */ unsigned char curr_sample_num; /* number of sample currently in progress */ unsigned short curr_elapsed; /* elapsed minutes on the current sample */ unsigned char system_status; /* status byte */ unsigned char maincpu_status; /* status byte */ unsigned char inlet_status; /* status byte from inlet */ unsigned char SEAS2_status; /* status byte from SEAS (see SEAS comm protocol) */ unsigned char SEAS3_status; short bat1,bat2; /* misc. battery */ /* (short)(bat1 * 1000) ==> +/- 32.767 VDC */ unsigned char spare; unsigned short used; /* set to 0xA5A5 upon record write */ }; Note: bat1 and bat2 are not used currently.
Byte order of stored values
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. The firmware stores MS byte first in memory. This must be accounted for when processing the data.
BUT, note that single precision IEEE float values are little-endian, and thus compatible with Intel-based PC's.
Storage format for these float values is as follows:
byte addr +0 +1 +2 +3 contents MMMMMMMM MMMMMMMM EMMMMMMM SEEEEEEE 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)