LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Control ER-16 in Labwindows/cvi

Hi Mehar,

I have pointed out two problems that maybe can explain the difficulties your are founding in communicationg with your equipment.

First of all, "6th byte" -as you say- is actually Rdbuf[5]. Remember that a string is always zero-based (first byte is string[0]).

Second, to transfer a byte in a double you cannot use strtod: this function expects a zero-terminated string representation of a number (i.e. "123.45"): if in Rdbuf there is a value that cannot be interpreted as either a number, a sign or a period the function fails returning zero. To obtain what you want you can simply operate this way:

testMeasurement = (double)Rdbuf[5];


Last item, at least the first transmission to the device should still work if modified this way (simpler):

char txbuf[30];
strcpy (txbuf, "ATEST EQUIPMENT\r");
ComWrt (COMport, txbuf, strlen (txbuf));


I hope I have clarified your doubts
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 21 of 23
(1,132 Views)
Roberto,

testMeasurement = (double)Rdbuf[5];

It dint work for me. The problem lies in I think the value getting transferred to Test Stand. I dont know what is causing it. I think the value is not getting transferred somehow. but it is getting some value because I initialize it to 5 and it gives the value of 0 in Test Stand. I dont know why it is not getting the correct value. Thanks for all your help though I am just wondering what is causing it. The ATEST EQUIPMENT\r is working fine for me. Do you know of a way to debug a Labwindows/CVI DLL in Test Stand. I tried the one given on the website.

With lots of Regards

Mehar
0 Kudos
Message 22 of 23
(1,126 Views)
Unfortunately I cannot help you with TestStand since I have never used this tool. But you must discriminate what's going wrong on CVI side from the problem in interaction between the two environments.

You could for example put a breakpoint immediately after loading testMeasurement variable: when the program stops look in the variable window if testMeasurement has taken the correct value (single click on the variable and then press Shift+F7). If testMeasurement (as it should) has the correct value your problem is in interaction between the two environments but I cannot help you in this respect.

Maybe someone else with experience in connecting CVI and TestStand can help you from this momento on.

I wish you solve your problems soon
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 23 of 23
(1,122 Views)