Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Programming Guide 3-95
To Use Limits to Filter Data Before Measuring Statistics (Turbo
C) (Continued)
IOSPOLL(ctr,&status); /* Serial poll counter for status */
puts("Transferring and processing data");
sendhp(":INIT:CONT OFF"); /* Set counter to Run */
sendhp(":CALC3:AVERAGE:TYPE MIN;:CALC3:DATA?");
IOENTERS(ctr,minimum,&length); /* Get the data from the counter */
sendhp(":CALC3:AVERAGE:TYPE MAX;:CALC3:DATA?");
IOENTERS(ctr,maximum,&length); /* Get the data from the counter */
sendhp(":CALC3:AVERAGE:TYPE MEAN;:CALC3:DATA?");
IOENTERS(ctr,mean,&length); /* Get the data from the counter */
sendhp(":CALC3:AVERAGE:TYPE SDEV;:CALC3:DATA?");
IOENTERS(ctr,sdev,&length); /* Get the data from the counter */
printf("Mean frequency = %s",mean);
printf("Minimum frequency = %s",minimum);
printf("Maximum frequency = %s",maximum);
printf("Standard deviation = %s",sdev);
printf("Press a key to continue\n");
getch();
}
/* Function to send command to HP 53131A */
void sendhp(hpib_cmd)
char *hpib_cmd;
{
char hpcmd[80]; /* Variables used by function */
int length;
strcpy(hpcmd,hpib_cmd);
length=strlen(hpcmd);
error=IOOUTPUTS(ctr,hpcmd,length); /* Send command to HP 53131A */
if (error!=0)
printf("Error during HP-IB: %d Command %s\n",error,hpcmd);
}