ibwrite(counter, “*idn?”);
ibrd(counter, buf, 100L); buf[ibcnt]=0;
printf(“Counter identification string: %s\n”, buf);
printf(“Setup\n”);
if ((counter = ibdev(0, address, 0, T3s, 1, 0)) < 0) {
printf(“Could not connect to counter”);
exit(1);
}
// Reset counter to known state
ibwrite(counter, “*rst;*cls”);
ibwrite(counter, “*ESE 0; *SRE 0");
// Setup for frequency measurement
ibwrite(counter, “FUNC ‘per 1’”);
// Some settings...
ibwrite(counter, “INP:LEV:AUTO OFF;:INP:LEV .5;:inp:coup
dc”);
ibwrite(counter, “TRIG:COUNT 1;:ARM:COUNT 1");
ibwrite(counter, ”ACQ:APER 1e-7");
ibwrite(counter, “DISP:ENAB OFF”); // Disable display to
get maximum speed
ibwrite(counter, “FORMAT REAL;:FORMAT:TINF OFF”);
// Floating point output, no timestamps
ibwrite(counter, “FORMAT:BORDER swap”);
// Intel byte order on results
ibwrite(counter, “ARM:LAY2:SOUR BUS;:INIT:CONT ON”);
// Bus arming
sleep(100);
// On the safe side: Check that setup was OK, all commands
correctly spelled etc
do {
ibwrite(counter, “syst:err?”);
ibrd(counter, buf, 100L); buf[ibcnt]=0;
printf(“Setup error: %s\n”, buf);
} while (atoi(buf)!=0);
printf(“Start\n”);
// Measure 1000 samples
Start = clock();
for (i=0; i<1000; i++) {
ibtrg(counter); // Generate GET signal
Programming Examples
Fast Measurements (Ex. #3) 4-9