Agilent Technologies 86100-90086 Sprinkler User Manual


 
2-9
Sample Programs
Sample C Programs
init.c - Transferring Data to the PC
/*
* Function name: transfer_data
* Parameters: none
* Return value: none
* Description: This routine transfers the waveform conversion factors and
* waveform data to the PC.
*/
void transfer_data ( )
{
int header_length;
char header_str[8];
char term;
char xinc_str[32],xorg_str[32],xref_str[32];
char yinc_str[32],yref_str[32],yorg_str[32];
int bytes_read;
/* waveform data source channel 1 */
write_IO (":WAVeform:SOURce CHANnel1");
/* setup transfer format */
write_IO (":WAVeform:FORMat BYTE");
/* request values to allow interpretation of raw data */
write_IO (":WAVeform:XINCrement?");
bytes_read = read_IO (xinc_str,32L);
xinc = atof (xinc_str);
write_IO (":WAVeform:XORigin?");
bytes_read = read_IO (xorg_str,32L);
xorg = atof (xorg_str);
write_IO (":WAVeform:XREFerence?");
bytes_read = read_IO (xref_str,32L);
xref = atof (xref_str);
write_IO (":WAVeform:YINCrement?");
bytes_read = read_IO (yinc_str,32L);
yinc = atof (yinc_str);
write_IO (":WAVeform:YORigin?");
bytes_read = read_IO (yorg_str,32L);
yorg = atof (yorg_str);
write_IO (":WAVeform:YREFerence?");
bytes_read = read_IO (yref_str,32L);
yref = atof (yref_str);
write_IO (":WAVeform:DATA?"); /* request waveform data */
while (data[0] != ‘#’)
bytes_read = read_IO (data,1L); /* find the # character */
bytes_read = read_IO (header_str,1L); /* input byte counter */