09-27-2008 09:42 PM
I write a dll driver to test a source,I want to get the voltage from NGSM(the instrument of RS), and I use teststand to call dll which writen by CVI,
my question is what's the best way I can get the test result and show to user by teststand. the below code is right? when I used teststand to call this dll document,
I just get the result by parameter in TS.this way is a good meathod,and what shoud I do in teststand,I must set the" outputVoltageV" point to a object?
/*===========================================================================*/
/* Function: Read Voltage/Current Output */
/* Purpose: This function returns the actual output voltage and output */
/* current of the instrument. */
/*===========================================================================*/
ViStatus _VI_FUNC rsngsm_datReadOutput (ViSession instrSession,
ViPReal64 outputVoltageV, ViPReal64 outputCurrentA, ViPBoolean statusPeakCurrent)
{
ViStatus rsngsm_status = VI_SUCCESS;
ViChar buf[BUFFER_SIZE];
ViInt32 retCnt;
Fmt (buf, "%s<VOUT?;IOUT?;PEAK?");
if ((rsngsm_status = viWrite (instrSession, buf, NumFmtdBytes (), &retCnt)) < 0)
return rsngsm_status;
if ((rsngsm_status = viRead (instrSession, buf, 50, &retCnt)) < 0)
return rsngsm_status;
if (Scan(buf, "%s>%f[p2];%f[p2];%i[b2]", outputVoltageV, outputCurrentA, statusPeakCurrent) != 3)
return rsngsm_status;
return rsngsm_status;
}
Solved! Go to Solution.
09-29-2008 08:41 AM
sean_tan,
Yes, you just need to pass it a TestStand Numeric value (ex.; locals.number).
If you're using the CVI adapter, it might make more sense for you to use the Flexible DLL adapter for this type of function, as you're not using the standard tTestData and tTestError parameters. So that TestStand will properly recognize the function prototype, you want to make sure you include the type library from your function panel (you'll need to create one if you haven't already done so) in LabWindows/CVI's Target Settings -> Type Library.
Hope this helps.
-Jack