
2-5
Sample Programs
C Programming Examples
* Return value: none
* Description: This routine performs automatic measurements of volts
* peak-to-peak and period on the acquired data. It also demonstrates
* two methods of error detection when using automatic measurements.
*/
void auto_measurements ( )
{
float period, vpp;
unsigned char vpp_str[16];
unsigned char period_str[16];
int bytes_read;
/*
* Error checking on automatic measurements can be done using one of two methods.
* The first method requires that you turn on results in the Measurements
* subsystem using the command :MEASure:SEND ON. When this is on, the analyzer
* will return the measurement and a result indicator. The result flag is zero
* if the measurement was successfully completed, otherwise a non-zero value is
* returned which indicates why the measurement failed. See the Programmer's Manual
* for descriptions of result indicators.
* The second method simply requires that you check the return value of the
* measurement. Any measurement not made successfully will return with the value
* +9.999E37. This could indicate that either the measurement was unable to be
* performed, or that insufficient waveform data was available to make the
* measurement.
* METHOD ONE - turn on results to indicate whether the measurement completed
* successfully. Note that this requires transmission of extra data from the scope.
*/
write_IO (":MEASure:SEND ON");
/* turn results on */
/* query -- volts peak-to-peak channel 1*/
write_IO (":MEASure:VPP? CHANnel1");
bytes_read = read_IO (vpp_str,16L);
/* read in value and result flag */
if (vpp_str[bytes_read-2] != '0')
printf ("Automated vpp measurement error with result %c\n", vpp_str[bytes_read-2]);
else
printf ("VPP is %f\n", (float)atof (vpp_str));
write_IO (":MEASure:PERiod? CHANnel1");
/* period channel 1 */
bytes_read = read_IO (period_str,16L);
/* read in value and result flag */
if (period_str[bytes_read-2] != '0')
printf ("Automated period measurement error with result %c\n", period_str [bytes_read-2]);
else
printf ("Period is %f\n", (float) atof (period_str));
/* METHOD TWO - perform automated measurements and error checking with :MEAS:SEND OFF */
period = (float) 0;
Summary of Contents for 86100A
Page 18: ...1 14 Introduction Status Reporting Figure 1 4 Status Reporting Data Structures...
Page 19: ...1 15 Introduction Status Reporting Status Reporting Data Structures continued...
Page 94: ...2 40 Sample Programs BASIC Programming Examples...
Page 124: ...4 16 Root Level Commands VIEW...
Page 132: ...5 8 System Commands TIME...
Page 140: ...6 8 Acquire Commands SWAVeform RESet...
Page 152: ...7 12 Calibration Commands STATus...
Page 192: ...11 12 Display Commands SSAVer...
Page 202: ...12 10 Function Commands VERTical RANGe...
Page 203: ...13 AREA 13 2 DPRinter 13 2 FACTors 13 3 IMAGe 13 3 PRINters 13 4 Hardcopy Commands...
Page 316: ...21 12 TDR TDT Commands Rev A 05 00 and Below STIMulus...
Page 332: ......