Jump to content

PALABIYIK

Members
  • Posts

    3
  • Joined

  • Last visited

LabVIEW Information

  • Version
    LabVIEW 2009
  • Since
    2008

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

PALABIYIK's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you for you response. You were right. After making the changes you suggested, I managed to get the code working! Cheers!
  2. I have a Labview server application where the data, 1d fixed sized array, is sent to a specific port in my machine through Labview TCP/IP blocks. Now I am trying to pass this 1d array into my c++ code. To this end, I created a client vi and then I converted it into three Labview dlls; initialize, read and close. "Init" initializes the port, "read" supposedly reads the port and write the content of the port to an array called Myarray, and finally "close" closes the connection. I am calling read.dll in a while loop in c++. The read dll is supposed to read the port and return the 1d array at the port. I attached the pictures of server vi, init.vi , read vi and close.vi. When converting read.vi into Labview dll, I defined the output function parameter to be an Array Data Pointer. Labview-created header file for the read vi is attached here. In order to read the output of the read.dll file in c++, I am using the following code; int main(int argc, char* argv[]) { uInt32 a; double MyArray[8]; //Initialization of array a=Init(); //Calling the init.dll to initialize the port int i=0; while (i<100) { Read(a,MyArray,8); //Calling READ.DLL to read the 1d array at the port and write it to Myarray. std::cout << "The result is" << MyArray[2] << '\n'; \\PRINTING ONE MEMBER ON THE SCREEN to see if I managed to read the 1d array. i=i+1; } Close(a); // Calling close.dll to close the port return(1); } However, I can't see anything on the screen. I did this successfully for a double number. In that application, my server sends a double number, and I read this number with Labview read.dll on the vc++ side just fine. Now, I am trying to do the same with an array with the methodology defined above. I am wondering if there is anyone out there who can help me out with the problem. Thank you so much!! Kind Regards
  3. Hi; I have a basic client application with TCP IP blocks. The server side sends values and the client reads the values. I converted my client side into Labview dll and am calling it from my C++ application. My client dll is made up of three componnets: initialize, read and close. In my c++ code , first I call "initialize", then read the port in c++ while-loop continuously. However, since the server is in Labview, and the client is in c++, there is a difference in the rate of writing and reading data. Seems like I am writing (server side) faster than I read (client side) since when I change the value of a parameters to be sent by the server, I can see the change in the parameter on the client side after a couple of moments. However, my application dictates that I should read the value on the client side right away. In other words, I need to read the value of the parameter when it is called by the client and can ignore any intermediate values. I was wondering if there is anyone out there who can help with this. My idea is maybe I can create a buffer on the server side which collects the parameters. As soon as the client send " I am ready signal" I can write the whole content of the buffer to the port so that the client can read the buffer and pick the value that was written last to the port, which is the value that I am interested in. I am not sure if this would be the easiest way though... By the way, is there any way to know when the client requests info from the server. If I manage to pick up on that, then maybe I can count the number of loops between calls from my client to the server, and determine the amount of byte that has to be read by the client so that I can pick the value that I am interested from the whole data? I feel pretty frustrated and would appreciate any help! Kind Regards,
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.