LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

U16 U32 output and input from dll using call library node function

Solved!
Go to solution

I have the problem that i need to send data and get data from and to  functions in a dll. However i having problems with getting the data, not sure if is arrays or not, from the manual the two are descrided as below.

 

--------------------------------------------------------------------------------------------------------

short CVICDECL MSA_read_data(short mod_no, unsigned long from,
unsigned long to, unsigned long * buf, short add);

--------------------------------------------------------------------------------------------------------

Input parameters:

     mod_no                     module number (0 - 3)

     from                          1st address to read (0 – POINTS_NO - 1)

     to                               last address to read (from – POINTS_NO - 1)

     *buf                          pointer to data buffer to be filled

     add                            1 – add read values to the buffer, 0 – rewrite buffer contents

Return value:                 0  no errors, <0   error code (see msa_def.h)

 

 

And.

 

--------------------------------------------------------------------------------------------------------

short CVICDECL MSA_fill_memory(short mod_no, unsigned long from, unsigned long to, unsigned short fill_value);

--------------------------------------------------------------------------------------------------------

Input parameters:

     mod_no                     module number (0 - 3)

     from                          1st address to fill (0 – POINTS_NO - 1)

     to                               last address to fill ( from  – POINTS_NO - 1)

     fill value                    value written to the MSA memory

Return value:                 0  no errors, <0 error code (see msa_def.h)

The procedure is used to fill a specified part of the memory of the MSA module ‘mod_no’ with the value ‘fill_value’.

 

 

However i´m not sure if the *buf should be a U32 pointer to an array or if the U16 fill value should be an array or a just a number?

 

my dll sofare is attached. 

 

 

0 Kudos
Message 1 of 6
(2,785 Views)

In png format

Download All
0 Kudos
Message 2 of 6
(2,771 Views)
Solution
Accepted by topic author DK_AA

@DK_AA wrote:

However i´m not sure if the *buf should be a U32 pointer to an array or if the U16 fill value should be an array or a just a number?

 

my dll sofare is attached. 


*buf should be a pointer to an array (configure the parameter in the Call Library dialog as an array, passed by pointer). That array must already have been allocated in LabVIEW (for example using Initialize Array) to the correct size. You can wire an array constant on the input side and wire the output to an indicator; don't use a local variable.

 

The U16 fill value is a scalar, not an array.

 

There is no need for the local variables, and the sequence structures are probably unnecessary as well. Please post your entire VI (or set of VIs) if you want more detailed suggestions.

Message 3 of 6
(2,751 Views)

There is some more info on using pointers to DLL in LabVIEW here:

 

Passing and Receiving Pointers with C/C++ DLLs from LabVIEW

https://decibel.ni.com/content/docs/DOC-9080

Message 4 of 6
(2,730 Views)

Thanks, Really helpfull, stange i didn't pop-up when i search ni.com home page and google. Should be put in content help in the program:) 

0 Kudos
Message 5 of 6
(2,706 Views)

That did the trick:) thanks

0 Kudos
Message 6 of 6
(2,705 Views)