file: ozonecpu_rec.html
24 May 2004

OZONECPU FLASH Record Format - Firmware Version 2.26

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 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.


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

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

   float cpu_temp;                 /* PSI CPU temp from COM2 data */
   float steps_to_ref;             /* PSI valve position from COM2 data */
   float spare1;

   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:
                                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 - wndrain OK (i.e. comms OK)
                                bit 7 - inlet OK (comms OK)
                                */

   unsigned char OZONE_status;  /* status bytes from OZONE (see OZONE COM2 protocol)

                                bit 0 - CPU temp OK = 1
                                bit 1 - "STEPS_to_ref" value 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 */
   };