Chapter 3 Programming Your Universal Counter for Remote Operation

Elements of SCPI Commands

To Optimize Throughput (Turbo C) (Continued)

sendhp(":ROSC:SOURCE INT");

/* Use internal oscillator. If

 

you want to use an external

 

timebase, you must select it

 

and turn off the automatic

 

detection using:

 

:ROSC:EXT:CHECK OFF */

sendhp(":DIAG:CAL:INT:AUTO OFF");

/* Disable automatic interpolater

 

calibration. The most recent

 

calibration values are used in

 

the calculation of frequency */

sendhp(":DISP:ENABLE OFF");

/* Turn off the counter display */

sendhp(":HCOPY:CONT OFF");

 

sendhp(":CALC:MATH:STATE OFF");

/* Disable any post processing */

sendhp(":CALC2:LIM:STATE OFF");

 

sendhp(":CALC3:AVER:STATE OFF");

 

sendhp("*DDT #15FETC?");

/* Define the Trigger command. This

 

means the command FETC? does not

 

need to be sent for every

 

measurement, decreasing the

 

number of bytes transferred over

 

the bus */

sendhp(":INIT:CONT ON");

/* Put the counter in Run mode */

sendhp("FETCH:FREQ?");

/* Fetch the frequency to be */

IOENTER(ctr,&exp_freq);

/* for the expected frequency */

strcpy(destination,":FREQ:EXP1 ");

/* Copy string */

sprintf(&destination[strlen(destination)],"%e",exp_freq); /* Append

 

expected frequency value */

sendhp(destination);

/* Send the expected frequency */

 

/* This number must be within 10%

 

of the Ch 1 input frequency.

 

Using this greatly increases

 

throughput, but is not

 

recommended for signals that

 

change by more than 10% */

puts("Transferring and processing data\n");

for (i=1; i<=readings ;i++)

 

{

 

IOTRIGGER(ctr);

/* Trigger the counter and */

IOENTERS(ctr,freq[i],&length);

/* read the data */

}

 

printf("Measurement complete. Press a key to continue.\n"); getch();

}

Programming Guide

3-97