Programming Examples
ibwrite(instrument, “*ESE 1;*SRE 32");
// On the safe side: Check that setup was OK, all commands correctly spelled etc
ibwrite(instrument, ”syst:err?");
ibrd(instrument, buf, 100L); buf[ibcnt]=0; printf(“Setup error: %s\n”, buf);
// Measure 1000 samples
Start = clock();
ibwrite(instrument, “INIT;*OPC”);
// Wait for completion
ibwait(instrument, RQS);
/* Read status and event registers to clear them */
ibrsp(instrument, &Status);
ibwrite(instrument, “*ESR?”);
ibrd(instrument, buf, 100L);
ibwrite(instrument, “FETC:ARR? 1000");
ibrd(instrument, bigbuf, 30000L);
if (ibcnt >0) {
pbuf = bigbuf;
for (i=0; i<1000; i++) {
for (j=0; pbuf[j]!=’,’ && pbuf[j]!=’\0’; j++);
pbuf[j]=’\0’;
if (i%50 == 0) printf(”Result %d: %s\n", i, pbuf);
pbuf+=j+1;
}
}
Stop = clock();
printf (“Block measurement: %d samples/s\n”, 10000 * 1000 / (Stop - Start));
do {
ibwrite(instrument, “syst:err?”);
ibrd(instrument, buf, 100L); buf[ibcnt]=0;
printf(“End error: %s\n”, buf);
} while (atoi(buf)!=0);
ibonl(instrument, 0);
}
/********************
* Support functions *
********************/
void ibwrite(int instrument, const char *string) {
ibwrt(instrument, (char*) string, strlen(string));
}
void sleep (long mswait) {
time_t EndWait = clock() + mswait * (CLOCKS_PER_SEC/1000);
while (clock() < EndWait);
}
FCA3000, FCA3100, MCA3000 Series Programmer Manual
4-5
Summary of Contents for FCA3000 Series
Page 2: ......
Page 8: ...Preface iv FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Page 9: ...Getting Started ...
Page 10: ......
Page 14: ...Using the USB Interface 1 4 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Page 15: ...Syntax and Commands ...
Page 16: ......
Page 26: ...Command Syntax 2 10 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Page 135: ...Status and Events ...
Page 136: ......
Page 156: ...Status and Events 3 20 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Page 157: ...Programming Examples ...
Page 158: ......
Page 179: ...Appendices ...
Page 180: ......
Page 181: ...Appendix A Character Set FCA3000 FCA3100 MCA3000 Series Programmer Manual A 1 ...
Page 182: ...Appendix A Character Set A 2 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...
Page 188: ...Appendix D Reserved Words D 2 FCA3000 FCA3100 MCA3000 Series Programmer Manual ...