LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy untyped void * buffer over LabView struct equivalent

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 21 of 39
(1,483 Views)

My Call Library Function is configured like in the image. For each variable....

0 Kudos
Message 22 of 39
(1,482 Views)

Can you help me?

0 Kudos
Message 23 of 39
(1,472 Views)

 


@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.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 24 of 39
(1,464 Views)

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

Download All
0 Kudos
Message 25 of 39
(1,454 Views)

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"...

0 Kudos
Message 26 of 39
(1,454 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 27 of 39
(1,451 Views)

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.

Message 28 of 39
(1,444 Views)

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

0 Kudos
Message 29 of 39
(1,440 Views)

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...

0 Kudos
Message 30 of 39
(1,451 Views)