03-21-2011 03:41 PM
What is so difficult about posting the actual VIs of what you have done and the C code? We can all go on guessing what might be wrong but seeing what you have been doing and want to do, would most likely have saved about 5 of the 7 posts in the last 15 minutes, and maybe given you a full fix already.
03-21-2011 03:42 PM
My Call Library Function is configured like in the image. For each variable....
03-21-2011 03:49 PM
Can you help me?
03-21-2011 03:51 PM
@Deutschrich wrote:
Can you help me?
Not without seeing what you have really done. What you have explained so far in many seperate posts looks a bit inconsistent and definitely doesn't show the entire picture. So post your C code that you used to create the DLL and the according VI source code. Then we can talk about actual things, not guessing what you might have done wrong.
03-21-2011 04:08 PM
Also, here is my c++ codes and my labview library
Sorry, but the forum don't let me to post the c++ code, then I made a screenshot of the codes.
thanks
03-21-2011 04:14 PM
also. With the two C++ codes I made a DLL. I already tested the code on the console before I made the DLL and that ran very good. I receive all my data from the buffer.
I called the DLL from Labview with the respective header file. I configured the variable as output pointers.
Good, I receive data from my device but on labview I see only data on my first variable while the others variable are still on "0"...
03-21-2011 04:16 PM - edited 03-21-2011 04:23 PM
Did you check in the C source level debugger what is actually in the other MiBuffer elements? From what I can see from the C code and the VI, the only explanation of what you claim to see in LabVIEW would be that the other MiBuffer elements read 0 too, and then you would have to check in your C code about how to initialize the device properly.
And I second Nathans recommendations. Using VISA might be not an option if you don't have the source code of the DLL or at least the command reference for the device, but all that copying and typecasting of data is really way to complicated. Such things should be passed as array, not as a series of individual and equal parameters.
03-21-2011 04:19 PM
My first thought is - if you're just trying to read from a serial port, why not use LabVIEW's built-in serial functions (in the VISA palette; if you don't have it, install NI-VISA) and save yourself all this trouble?
I don't understand why you're getting the behavior you're seeing, but you could simplify this a lot. Make your C++ function accept an array of chars. In LabVIEW, initialize an array of 18 U8 (use Initialize Array). Wire that to the Call Library Function Node, configured as an Array Data Pointer. In your C++ code, use that array directly to receive the serial port data. Avoid typecasting to integers, there's no need.
03-21-2011 04:24 PM
I tested the same code with debug on the console of visual studio. MiBuffer had all the data and I could show them on the console.
I say, The only thing what I changed of my code is the declaration of variables those I need on Labview. Instead of showing the variables (elements of my buffer) on console I save now each element in a variable which will be called on Labview.
Now I don't know how I can check from my debugger while Labview is running...
How can check it?
thanks
03-21-2011 04:27 PM
I already used VISA and I had problems ofr overrun...I posted my problem too and I can solve the problem. That's why I test now with c++ code because the device was tested with a Matlab and it run well. The C++ code can work similarity like Matlab...