LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

viPrintf get parameter

Solved!
Go to solution

I must write a GPIB command viprintf(),and the parameter get from user. the bleow useing viPrintf is right?

 if(InstrumentName_status=viPrintf(instrSession,"TPCSTEMP",stepsize,"\n":smileywink:<0)        //is right to use 
        return InstrumentName_status; 

there "TPCSTEMP" is a GPIB command ,stepsize is a parameter which ueser define .

and this is not main function,just a son function as a DLL document!

  thank you!

0 Kudos
Message 1 of 3
(3,803 Views)
Solution
Accepted by topic author sean_tan

Yes I think the return code (VISA status code) will be stored in InstrumentName_status, but this code writing is not good. Ideally storing the return value to a variable and IF condition statement must be separated.

 

InstrumentName_status = viPrintf(instrSession,"....");

if( InstrumentName_status < 0 ) {

  ... 

}

 

Plus, this viPrintf call does not reflect the given parameter because there is no "%" identifier. You should write as

 

InstrumentName_status = viPrintf(instrSession,"TPCSTEMP %d\n", (int)stepsize);

 

 

Message 2 of 3
(3,786 Views)
thanks I know, I forgot d%.thanks caution!
0 Kudos
Message 3 of 3
(3,782 Views)