file: twob_conversion.html
26 Jun 2003

Processing the Binary Data File with gcc


Converting FLASH card binary to comma-separated ASCII engineering units

To convert the binary file from the FLASH card to ASCII engineering units, run the following 2 programs. The twobswab program gets the various multi-byte binary values into the "little-endian" byte order expected by a PC; an intermediate byte-swapped binary file is created. This byte-swapped file is then converted to ASCII and formatted into comma-separated columns, one record per line.

For the example, the original FLASH card binary file is called ozone2.bin and all operations are assumed to run in the same directory as the conversion program executables.

  1. at the prompt, ./twobswab ozone2.bin ozone2.swb will do the byte swapping and create the intermediate file ozone2.swb
  2. at the prompt, ./twobasc ozone2.swb ozone2.asc will create the formatted ASCII file ozone2.asc

The format of each line (record) in the ASCII file corresponds to the order of values in the record format shown in the documentation, except that the "spare1", "spare2" and "used" values are not included.


Converting captured HEX dump data ('R' command output) to comma-separated ASCII engineering units

To convert the HEX dump file captured from the R command to ASCII engineering units, run the following program. The xxd program is a Linux utility to convert HEX dump files to binary. The binary file is then converted as above.

For the example, the original HEX dump file is called ozone2.hex and all operations are assumed to run in the same directory as the conversion program executables.

  1. at the prompt, xxd -r -p ozone2.hex ozone2.bin will convert the HEX file to binary
  2. at the prompt, ./twobswab ozone2.bin ozone2.swb will do the byte swapping and create the intermediate file ozone2.swb
  3. at the prompt, ./twobasc ozone2.swb ozone2.asc will create the formatted ASCII file ozone2.asc

The format of each line (record) in the ASCII file corresponds to the order of values in the record format shown in the documentation, except that the "spare2" and "used" values are not included.