Computer Operations
Computer Interface Commands and Operation
4
4-65
/*
* Scan and receive data
*/
fprintf(stdout,"\nMeasuring %s...\n",configStr);
for(index=0;index < 3;++index)
{ /* scan three times */
unsigned chanIndex; /* Channel counter */
asiputs(COM2,"*TRG",-2); /* trigger scan */
checkResponse(); /* get prompt */
asiputs(COM2,"SCAN_TIME?",-2); /* request time stamp for scan */
checkResponse(); /* get prompt */
/* receive time stamp for scan, and write to
data file */
asigets_timed(COM2,recvbuff,256,-2,TICKS_PER_SECOND*2);
fprintf(testdata,"%s\n",recvbuff);
for(chanIndex = 1; chanIndex <= numChannels; ++chanIndex)
{ /* get value scanned for each channel */
sprintf(sendbuff,"LAST? %d",chanIndex);
asiputs(COM2,sendbuff,-2); /* request value for channel */
checkResponse(); /* get prompt */
/* receive value for channel and write to
screen and data file */
asigets_timed(COM2,recvbuff,256,-2,TICKS_PER_SECOND*2);
fprintf(stdout,"Chan %d: %s, ",chanIndex,recvbuff);
fprintf(testdata,"%s,",recvbuff);
}
fprintf(stdout,"\n");
fprintf(testdata,"\n");
}
fprintf(stdout,"\n");
fprintf(testdata,"\n");
}
fclose(testdata);
exit(0);
}
op53_4f.eps

Figure 4-7. Sample Program (QuickC)(4 of 5)