10-17-2008 03:09 AM
I write a function (not main function) I want to create this function as a dll document,when teststand use dll and run it .
the question is I want to use this function get result from instrument,But I don't confirm viscanf is right?
ViStatus _VI_FUNC Get_Frequency (ViSession instrSession, ViPReal64 frequency,ViString freqCommand)
{
ViStatus status = VI_SUCCESS;
ViChar buf[BUFFER_SIZE];
ViInt32 retCnt;
if(status=viPrintf(instrSession,"freqComamnd\n")<0)
return MT8820B_status;
if(status=viPrintf(instrSession,"*OPC?\n")<0)
return MT8820B_status;
if(=viScanf(instrSession, "f%",&frequency)<0)
return status
return MT8820B_status;
}
I use viscanf() like that,it's right? thank you
Solved! Go to Solution.
10-20-2008 12:00 AM
ViPReal64 frequency is allready a pointer to a floating point number. So you don't need the & operator in the call of viScanf.
It should read :
if(status =viScanf(instrSession, "f%",frequency)<0)
return status ;
10-20-2008 01:21 AM
10-20-2008 01:54 AM
You must use a pointer to ViReal64 inside your function Get_Frequency () to make use of it as an output parameter. When you call Get_Frequency() you can use the & operator there with frequency being a ViReal64 ( not a ViInt32 ) :
Get_Frequency (instrSession, &frequency, freqCommand )