file: twob_rec.html
20 Jun 2003

2B_OZONECPU FLASH Record Format - Firmware Version 2.60

FLASH records are written once per logging interval (once per minute typically). The FR command reads records one at a time, beginning at record 1 unless a different record number is entered at the prompt. Output formatting is verbose and somewhat self-explanatory. The final line STAT: follows the format of the last 5 values of the D command, with elapsed sample time in minutes, an indicator of 1 if the PSI is analyzing, 0 if it's not, then three HEX bytes of system status, maincpu status, and ozone (PSI) status. See the C structure below for the bit values of the 3 status bytes.

The FB command can be used to look at the raw HEX values in the FLASH card in 512 byte blocks, in 16 lines of 32 bytes each. The first 256 blocks of the FLASH card are reserved and currently UNUSED on the 2B OZONECPU. The raw block location that corresponds to the first data record is Block 257. If you enter 257 at the FB command prompt, you will actually see the raw values of the first 16 records shown by the FR command, since the record size conveniently is 32 bytes. The record format follows the C structure below.


See the 2B OZONE File Conversion Guide for info on converting both binary files (from the FLASH card) and HEX files (captured from the R command).


Note the following:
All integers are 2 bytes, stored MS byte first
All floats are IEEE-754 Single-Precision float standard, stored mantissa first:

i.e. memory address 0,1,2,3 => MMMMMMMM MMMMMMMM EMMMMMMM SEEEEEEE
where:


/* OZONE 32 byte data record structure for storage in FLASH */
struct OZONE_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 system powerup */

   float ozone;             /* 2B ozone value in ppbv */
   float cell_temp;         /* 2B cell temperature in degrees C */
   float cell_pressure;     /* 2B cell pressure in mbar */

   float wsavg;                    /* wind speed m/s */
   unsigned char rain_detect;      /* rain detector 1 = RAIN */

   unsigned char spare2;
   unsigned short curr_elapsed;    /* elapsed minutes on the current sample */

   unsigned char system_status;  /* status byte:
                                bit 0 - sample_OK 
                                bit 1 - WIND speed OK
                                bit 2 - NOT raining - RAIN OK
                                bit 3 - ZERO checking
                                bit 4 - OZONE analyzing
                                bit 5 - XMET OK
                                bit 6 - INLET open
                                bit 7 - OUTLET open
                                */

   unsigned char maincpu_status;  /* status byte:

                                bit 0 - zero power 
                                bit 1 - wndrain power
                                bit 2 - inlet power
                                bit 3 - outlet power
                                bit 4 - OZONE power
                                bit 5 - unused
                                bit 6 - unused
                                bit 7 - unused
                                */

   unsigned char OZONE_status;  /* status byte for OZONE (see OZONE data protocol)

                                bit 0 - CELL temperature OK = 1
                                bit 1 - CELL pressure OK = 1
                                bit 2 - unused
                                bit 3 - unused
                                bit 4 - unused
                                bit 5 - unused
                                bit 6 - unused
                                bit 7 - unused
                                */

   unsigned short used;   /* set to 0xA5A5 upon record write */
   };