2-5
Sample Programs
Sample C Programs
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 ( ) */
init.c - Acquiring Data
/*
* Function name: acquire_data
* Parameters: none
* Return value: none
* Description: This routine acquires data according to the current
* instrument settings.
*/
void acquire_data ( )
{
/*
* The root level :DIGitize command is recommended for acquisition of new
* data when averaging is used. It will initialize data buffers, acquire new data, and ensure that
* acquisition criteria are met before acquisition of data is stopped. The
* captured data is then available for measurements, storage, or transfer
* to a PC. Note that the display is automatically turned off by the
* :DIGitize command and must be turned on to view the captured data.
*/
write_IO (":DIGitize CHANnel1");
write_IO (":CHANnel1:DISPlay ON"); /* turn on channel 1 display which is */
/* turned off by the :DIGitize command */
} /* end acquire_data ( ) */