2-18
Sample Programs
Listings of the Sample Programs
acquire_data ( ); /* capture the data */
auto_measurements ( ); /* perform automated measurements on acquired data */
transfer_data ( ); /* transfer waveform data to the PC from scope */
convert_data ( ); /* convert data to time/voltage pairs */
store_csv ( ); /* store the time/voltage pairs as csv file */
close_IO ( ); /* close interface and device sessions */
/* note: routine found in sicl_IO.c or natl_IO.c */
} /* end main ( ) */
/*
* Function name: initialize
* Parameters: none
* Return value: none
* Description: This routine initializes the analyzer for proper
* acquisition of data. The instrument is reset to a known state and the
* interface is cleared. System headers are turned off to allow faster
* throughput and immediate access to the data values requested by queries.
* The analyzer time base, channel, and trigger subsystems are then
* configured. Finally, the acquisition subsystem is initialized.
*/
void initialize ( )
{
write_IO ("*RST"); /* reset scope - initialize to known state */
write_IO ("*CLS"); /* clear status registers and output queue */
write_IO (":SYSTem:HEADer OFF"); /* turn off system headers */
/* initialize time base parameters to center reference, 2 ms full-scale (200 us/div), and 20 us delay */
write_IO (":TIMebase:REFerence CENTer;RANGe 2e-3;POSition 20e-6");
/* initialize Channel1 1.6V full-scale (200 mv/div); offset -400mv */
write_IO (":CHANnel1:RANGe 1.6;OFFSet -400e-3");
/* initialize trigger info: channel1 signal on positive slope at 300mv */
write_IO (":TRIGger:SOURce FPANel;SLOPe POSitive");
write_IO (":TRIGger:LEVel-0.40");
/* initialize acquisition subsystem */
/* Real time acquisition - no averaging; record length 4096 */
write_IO (":ACQuire:AVERage OFF;POINts 4096");
} /* end initialize ( ) */
/*
* Function name: acquire_data
* Parameters: none
* Return value: none