LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem transferring data from LabWindows/CVi to Test Stand

Hello

The example dll code is presented here, what it is doing is measuring the Ascii value of the 6th byte and then passing on the value to the Test Stand. I think it is something stupid on my part that I am not able to extract the data out of the byte and then convert it to byte and then pass onto Test Stand.
The process should be

Tx 16 bytes ------> Rx 24 bytes --------> Obtain desired byte( 6th in this particular case)----------> Transfer its Ascii value to a double (testmeasurement)------->Pass on that value of double to Test Stand.

I dont know where I am breaking the chain or if the chain is even wrong or there is another process of doing it. I am attaching the screen capture module from the function I am using in Test Stand. I am always getting the result to be a 0, no matter what I do. I am attaching the source code being used in this test to pass on the value. I have tried the code to work independently in the attached atest.prj but it is not working when i try to run it in Test Stand.


void __declspec(dllexport) __stdcall ADC_J3_1(double *measurement,
char reportText[1024], short *errorOccurred, long *errorCode, char errorMsg[1024])
{
int error = 0;
// ErrMsg errMsg = {'\0'};
// ERRORINFO errorInfo;

// REPLACE THE FOLLOWING WITH YOUR SPECIFIC TEST CODE
double testMeasurement = 5.0;
// double lowLimit;

char Rdbuf[23];
int i;

//--------------------------
// Write Data
//--------------------------
Wrtbuf[0]=0x41;
Wrtbuf[1]=0x02;
Wrtbuf[2]=0x00;
Wrtbuf[3]=0x00;
Wrtbuf[4]=0x00;
Wrtbuf[5]=0x00;
Wrtbuf[6]=0x00;
Wrtbuf[7]=0x00;
Wrtbuf[8]=0x00;
Wrtbuf[9]=0x00;
Wrtbuf[10]=0x00;
Wrtbuf[11]=0x00;
Wrtbuf[12]=0x00;
Wrtbuf[13]=0x00;
Wrtbuf[14]=chksum(Wrtbuf);
//Wrtbuf[15]=0x0D;
for (i=0; i<15; i++)
{
ComWrtByte (COMport,Wrtbuf[i]);
//DebugPrintf("%c",Wrtbuf[i]);
}
ComWrtByte (COMport,0x0D);
Delay(1);
//------------------------------
// Receive Data
//------------------------------

ComRd (COMport, Rdbuf, 24); // "Buf" is the string into which device response is stored

// Test lenght of response

if (strlen (Rdbuf) < 24) goto Error;
//TestResponse
//sprintf(&Rdbuf[6],"%s>%f",&testMeasurement);
//Scan(&Rdbuf[6],"%s>%f",&testMeasurement);
//Fmt(&Rdbuf[6], "%s>%f",testMeasurement);
//testMeasurement=Rdbuf[6];
//DebugPrintf("%x",Rdbuf[6]);
testMeasurement= strtod(&Rdbuf[6], NULL);

*measurement = testMeasurement;

// The following code shows how to access a property or variable via the TestStand ActiveX API
// To use this code you must add a parameter "CAObjHandle seqContextCVI" to this function and pass
// a sequence context to it.
// tsErrChk(TS_PropertyGetValNumber(seqContextCVI, &errorInfo,
// "Step.Limits.Low", 0, &lowLimit));

Error:
// FREE RESOURCES HERE

// If an error occurred, set the error flag to cause a run-time error in TestStand.
if (error < 0)
{
// *errorOccurred = TRUE;

// OPTIONALLY SET THE ERROR CODE AND STRING
// *errorCode = error;
// strcpy(errorMsg, errMsg);
}
}
0 Kudos
Message 1 of 2
(2,829 Views)
Hello,

It looks like this question got posted on two different threads. Please refer to this thread for information on this issue.

Regards,
Kevin L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,804 Views)