Agilent Technologies 86100-90086 Sprinkler User Manual


 
2-10
Sample Programs
Sample C Programs
header_length = atoi (header_str);
/* read number of points - value in bytes */
bytes_read = read_IO (header_str,(long)header_length);
Acquired_length = atoi (header_str); /* number of bytes */
bytes_read = read_IO (data,Acquired_length); /* input waveform data */
bytes_read = read_IO (&term,1L); /* input termination character */
} /* end transfer_data () */
An example header resembles the following when the information is stripped off:
#510225
The left-most “5” defines the number of digits that follow (10225). The number “10225” is the
number of points in the waveform. The information is stripped off of the header to get the
number of data bytes that need to be read from the analyzer.
init.c - Converting Waveform Data
/*
* Function name: convert_data
* Parameters: none
* Return value: none
* Description: This routine converts the waveform data to time/voltage
* information using the values that describe the waveform. These values are
* stored in global arrays for use by other routines.
*/
void convert_data ( )
{
int i;
for (i = 0; i < Acquired_length; i++)
{
time_value[i] = ((i - xref) * xinc) + xorg;/* calculate time info */
volts[i] = ((data[i] - yref) * yinc) + yorg;/* calculate volt info */
}
} /* end convert_data ( ) */
The data values are returned as digitized samples (sometimes called quantization levels or q-
levels). These data values must be converted into voltage and time values.