EasyManua.ls Logo

Pendulum CNT-90 - Page 57

Pendulum CNT-90
264 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
sprintf(Command, "CONF:%s", Args.Func);
if (WriteDev(Command) != VI_SUCCESS) Quit();
// Do a measurement to check if all is set up OK.
if (WriteDev("inp:lev:auto off;:inp:lev 0;:form:bord swap")
!= VI_SUCCESS) Quit();
if (WriteDev("form asc;:form:tinf on") != VI_SUCCESS)
Quit();
if (WriteDev("read?") != VI_SUCCESS) Quit();
if (ReadDev(Buffer, BUFSIZE, &ReadLength) != VI_SUCCESS)
Quit();
Buffer[ReadLength] = 0; // Null terminate.
if (sscanf(Buffer, "%lf", &Val) != 1)
QuitMsg("Failed to scan test measurement\n");
if ( CheckMeas(Val, Args) )
{
fprintf(stderr, "Bad result: %s = %g %s\n", Args.Func,
Val, (Args.bPeriod ? "s" : "Hz"));
sprintf(Command, "Connect a %lg Hz signal to A and try
again\n", Args.RefFreq);
QuitMsg(Command);
}
// Set the timeout for message-based communication (10 s)
if (viSetAttribute(Instr, VI_ATTR_TMO_VALUE, 10000) !=
VI_SUCCESS)
QuitMsg("Failed to set timeout\n");
// Set up for "infinite" number of measurements
printf("\n");
sprintf(Command, "trig:coun 1;:arm:coun inf");
if (WriteDev(Command) != VI_SUCCESS) Quit();
// set pacing. note: for freq:btb meas time is actual pacing
if ( Args.bPeriod )
sprintf(Command, "trig:sour tim;:trig:tim %lg",
Args.Pacing);
else
sprintf(Command, "sens:acq:aper %lg", Args.Pacing);
if (WriteDev(Command) != VI_SUCCESS) Quit();
// FORMat PACKed is the recommended format for maximum fetch
// speed and for best timestamp resolution.
sprintf(Command, "form pack;:form:tinf on;:disp:enab off");
if (WriteDev(Command) != VI_SUCCESS) Quit();
PrevTSVal = 0;
Failed = false;
Sleep(500);
// Start the measurement.
if (WriteDev("init") != VI_SUCCESS) Quit();
Programming Examples
Error Code 4-21

Table of Contents

Other manuals for Pendulum CNT-90

Related product manuals