Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-94 Programming Guide
To Use Limits to Filter Data Before Measuring Statistics (Turbo
C) (Continued)
IOEOI(isc,state); /* Enable use of EOI */
sendhp(":FUNC 'FREQ 1'"); /* Make a frequency measurement */
sendhp(":FREQ:ARM:STAR:SOUR IMM"); /* These 3 lines enable */
sendhp(":FREQ:ARM:STOP:SOUR TIM"); /* time arming with a .001 */
sendhp(":FREQ:ARM:STOP:TIM .001"); /* second gate time */
sendhp(":STAT:OPER:ENABLE 256"); /* Computing statistics bit in
Operation Status register */
sendhp(":STAT:OPER:NTR 256"); /* When statistics are complete, */
sendhp(":STAT:OPER:PTR 0"); /* the bit will go from high to low
so a negative transition is
needed to enable the bit that is
summarized in the Status Byte
register. */
sendhp("*SRE 128"); /* This is the bit from the Operation
Status register that is summarized
in the Status Byte Register */
sendhp(":CALC3:LFIL:STAT ON"); /* Enable statistics filter */
sendhp(":CALC3:LFIL:LOWER 1 MHz"); /* Set lower limit to 1 MHz */
sendhp(":CALC3:LFIL:UPPER 2 MHz"); /* Set upper limit to 2 MHz */
sendhp(":CALC3:AVER ON"); /* Enable statistics */
sendhp(":CALC3:AVER:COUNT 50"); /* Use 50 measurements for stats */
sendhp(":CALC2:LIM:STAT ON"); /* Enable limit testing. This must
happen in order to see limit
graph */
sendhp(":CALC2:LIM:LOWER 1 MHz"); /* Set lower limit */
sendhp(":CALC2:LIM:UPPER 2 MHz"); /* Set upper limit */
sendhp(":CALC2:LIM:DISP GRAPH"); /* Display limit graph */
/* Waiting for the measurement to complete */
printf("Waiting for measurement to complete\n");
sendhp(":INIT:CONT ON"); /* Start making measurements */
do
{
IOSTATUS(isc,condition,&status); /* Check status byte */
delay(200); /* Wait 200 milliseconds */
}
while (status!=1); /* if =1 then measurement complete */
/* Measurement is complete, get the data */