125
────────────────────────────────────────────────────
8.9 Sample Programs
────────────────────────────────────────────────────
(2) Turbo C++
Program List line
#include〈stdio.h 〉 1
#include〈stdlib.h〉
#include〈string.h〉
#include "windecl.h"
#define pad 0 5
#define addr 1
char buffer [100];
void main(void)
{ 10
int i;
char string [100]
FILE *outf;
ibfind("gpib0");
ibdev(pad,addr,0,T10s,1,0); 15
SendIFC(pad);
if((out=fopen("data.txt","wt"))==NULL) {
printf("Cannot open output file.¥n");
return;
} 20
for(i=0;i<10;i++) {
Trigger(pad,addr);
Send(pad,addr,":MEAS:RESI?",11,NLend);
Receive(pad,addr,&buffer[0],200,STOPend);
buffer[ibcnt−1 ]=¥0'; 25
itoa(i+1,&string [0],10);
fputs(&string[0],outf)
fputc(,',outfile);
fputs(&buffer [0],outf);
fputc(¥n',outf);
} 30
fclose(outfile);
ibonl(pad,0);
}
Comments
line
14 Initialize the GP-IB port
16 Initialize the interface
17 Open the data preservation file "data.txt"
21 Loop until getting the designated number of measurement value
22 Execute the measurement once
23 Getting the resistance measurement value
27 Save the measurement value to the file
32 Close the interface
33 Set the interface to the local state.