Data File Format | ![]() ![]() ![]() |
Data File Format
This appendix describes
the file format of the data files generated by the functions performing
continuous data acquisition followed by storing the data to disk.
The data file includes
three parts, Header, ChannelRange (optional) and Data block. The file structure
is as the figure below:
Header
The header part
records the information related to the stored data and its total length
is 60 bytes. The data structure of the file header is as follows:
Header
Total Length: 60 bytes
Elements | Type | Size (bytes) | Comments |
ID | char | 10 | file ID
ex. ADLinkDAQ1 |
card_type | short | 2 | card Type
ex. Pci7250, Pci9112 |
num_of_channel | short | 2 | number of scanned channels
ex. 1, 2 |
channel_no | unsigned char | 1 | channel number where the
data read from (only available as the num_of_channel is 1)
ex. 0, 1 |
num_of_scan | long | 4 | the number of scan for
each channel
(total count / num_of_channel) |
data_width | short | 2 | the data width
0: 8 bits, 1: 16 bits, 2: 32 bits |
channel_order | short | 2 | the channel scanned sequence
0: normal (ex. 0-1-2-3) 1: reverse (ex. 3-2-1-0) 2: custom* (ex. 0, 1, 3) |
ad_range | short | 2 | the AI range code
Please refer to Appexdix B ex. 0 (AD_B_5V) |
scan_rate | double | 8 | The scanning rate of each
channel
(total sampling rate / num_of_channel) |
num_of_channel_range | short | 2 | The number of ChannelRange* structure |
start_date | char | 8 | The starting date of data
acquisition
ex. 12/31/99 |
start_time | char | 8 | The starting time of data
acquisition
ex. 18:30:25 |
start_millisec | char | 3 | The starting millisecond
of data acquisition
ex. 360 |
reserved | char | 6 | not used |
ChannelRange
The ChannelRange
part records the channel number and data range information related to the
stored data. This part consists of several channel & range units. The
length of each unit is 2 bytes. The total length depends on the value of
num_of_channel_range
(one element of the file header) and is calculated as the following formula:
Total Length = 2 * num_of_channel_range bytes
The data structure of each ChannelRange unit is as follows:
ChannelRange Unit
Length: 2 bytes
Elements | Type | Size (bytes) | Comments |
channel | char | 1 | scanned channel number
ex. 0, 1 |
range | char | 1 | the AI range code of channel
Please refer to Appexdix B ex. 0 (AD_B_5V) |
The last part is the data block. The data is written to file in 16-bit binary format, with the lower byte first (little endian). For example, the value 0x1234 is written to disk with 34 first followed by 12. The total length of the data block depends on the data width and the total data count.
The file is written in Binary format and can't be read in normal text editor. You can use any binary file editor to view it or the functions used for reading files, e.g. fread, to get the file information and data value. PCIS-DASK provides a useful utility DAQCvt for you to convert the binary file. The DAQCvt main window is as the figure below:
DAQCvt first translates the information stored in the header part and the ChannelRange part and then displays the corresponding information in the "Input File" frame of DAQCvt main window. After setting the properties (File Path, Format, …etc) of the converted file and push "Start Convert" button in the "Output File" frame, DAQCvt gets rid of header and ChannelRange parts and converts the data in data block according to the card type and the data width. Finally, DAQCvt writes the converted data to disk. You thus can use any text editor or Excel to view or analyze the accessed data.