The transfer of data from the analyzer in binary form reduces the amount of data transferred and the transmission time. To enable binary data transfer, use the FORM: DATA command. The list of commands that support the transfer of binary data is given in the description of the FORM: DATA command.
Binary data is transmitted as a block having a header followed by data. Block format:
# |
8 |
<Data Size> |
<Binary Data> |
Where: # — the character '#',
8 — the character '8',
<Data Size> — 8 bytes, the symbolic representation of the number of bytes in binary data.
For example:
#800003216<Binary Data>
The VISA library has built-in tools for receiving binary data from the analyzer. The example assumes that the size of the array is sufficient to receive a number of elements equal to twice the number of points.
Example. Receiving binary data array in C/C ++:
double DataArray[1000]; ViUInt32 retCount; ... viPrintf(instr, "FORM:DATA REAL\n"); retCount = sizeof(DataArray) / sizeof(double); viQueryf(instr, "CALC:DATA:FDAT?\n", "%#Zb", &retCount, DataArray); // retCount now contains the actual number of elements read |
---|