file: hassecflash.html
1 Oct 2009

CompactFLASH CARD STORAGE FORMAT - Hasse Rain

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

CompactFLASH card sectors of interest:

Description of Hasse Rain data file beginning at Sector 322

The CFLASH data file (yourname.DAT) consumes most of the CompactFLASH card. Each record is 512 bytes long, conveniently the same size as, and aligned with, a CompactFLASH sector. Each record contains the date and time written, 60 minutes of top1 drop counts, 60 minutes of top2 drop counts, 60 minutes of side drop counts, 60 minutes of error codes, 20 spare bytes, a flag which is set to 0xA5A5 when the record is written, and a 2 byte CRC of the previous 510 bytes. All data values are currently unsigned short only. The actual C language struct is reproduced here to show the format of the stored image.

struct HASSE_record
   {
   struct time_type time1;      /* 8 bytes of time */
   unsigned short drops_top1[60];    /* 60 minutes of top 1 drops count */
   unsigned short drops_top2[60];    /* 60 minutes of top 2 drops count */
   unsigned short drops_side[60];       /* 60 minutes of side drops count */
   unsigned char error[60];    /* 60 minutes of error codes - 5 = no error */
   unsigned char counter[60];  /* frame counter */
   unsigned char spare[20];
   unsigned short used;     /* set to 0xA5A5 upon record write */
   unsigned short hasse_CRC;  /* CRC of previous bytes (not used currently) */
   };

/* time structure */ struct time_type { unsigned char sec; unsigned char min; unsigned char hour; unsigned char dow; /* day of week - Sunday = 1 - not used */ unsigned char day; unsigned char mon; unsigned short year; };

Note that the time structure is NOT ANSI-compatible.

The offsets and sizes of the record components is shown below. Remember that the first Hasse Rain record is stored at Sector 322 in the CompactFLASH card.

   byte #  size    name          comment
     0      8       time        8 bytes of time
     8      2       drops_top1[0]    minute 0 top1 dropper counts
    10      2       drops_top1[1]    minute 1 top1 dropper counts
      .
      .
   126      2       drops_top1[59]   minute 59 top1 dropper counts
   128      2       drops_top2[0]    minute 0 top2 dropper counts
      .
      .
   246      2       drops_top2[59]   minute 59 top2 dropper counts
   248      2       drops_side[0]    minute 0 side dropper counts
      .
      .
   366      2       drops_side[59]   minute 59 side dropper counts
   368      1       error[0]         minute 0 error data
      .
   427      1       error[59]        minute 59 error data
   428      1       counter[0]       minute 0 frame counter
      .
   487      1       counter[59]      minute 59 frame counter
   488     20       reserved
   508      2       used flag set to A5A5h when record is written
   510      2       hasse_CRC      CRC of previous 510 bytes (not used currently)

Data is written to the FLASH card immediately following the acquisition of data at the rollover to the 59th minute of each hour. This is reflected in the time stamp on each record, typically 1 second into minute 59.


*** IMPORTANT NOTE ***

The byte order of the some numeric values stored by the HASSE45 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 (LITTLE-endian). The HASSE45 firmware stores shorts and longs with MS byte first in memory (BIG-endian).


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.


The CRC is NOT IMPLEMENTED.