2-36
Sample Programs
Listings of the Sample Programs
/*
* Function Name: initialize
* Paramters: none
* Returned value: none
* Description: This method sets up the channels and acquisition limits of the
* DCA
*/
void initialize()
{
write_IO("*RST");//reset the DCA
write_IO("*CLS");//clear the status registers
write_IO("SYSTem:MODE EYE");//switch to Eye/mask mode
write_IO("STOP");//stop acquistion
write_IO("CDISplay");//clear the display
write_IO("ACQuire:RUNTil WAVeforms,200");
//set the acquistion limit to 200 waveforms
write_IO("CHANnel1:FSELect 1");//choose filter #1 on channel 1
write_IO("CHANnel1:FILTer ON");//turn on the filter
write_IO("CHANnel3:FSELect 1");//choose filter #1 on channel 3
write_IO("CHANnel3:FILTer ON");//turn on the filter
}//initialize()
/*
* Funciton Name: acquireSerial
* Parameters: none
* Returned value: int - the time to acquire the data
* Description: This routine turns on channel 1, performs an autoscale, acquires
* 200 waveforms, performs a mask test, and then performs the measurements. The
* process is then repeated for channel 2.
*/
int acquire_serial()
{
printf("Serial Acquisition in progress\n");//status report
//decalrations
int start=clock(),stop;
char Msk_hits1[16],Crss_pct1[16],Ext_rat1[16],buff[32];
char Msk_hits2[16],Crss_pct2[16],Ext_rat2[16];
write_IO("CHANnel1:DISPlay ON");//turn on channel one
write_IO("RUN"); //start acquistion
write_IO("AUToscale"); //Autoscale
write_IO("*OPC?"); //query for completion
read_IO(buff,5); //read completion response
write_IO("MTESt:LOAD \"STM016_OC48.msk\"");//load OC-48 mask
write_IO("MTESt:START"); //start mask test
write_IO("MTESt:COUNt:FSAMples?");//query the number of failed samples
Msk_hits1[read_IO(Msk_hits1, 15)]=0;//get the number of mask hits