LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a pointer parameter for DLL

Solved!
Go to solution

Hi Guys:

 

I am little lost on how to execute below for my call library function node, please give me your best shot and thank you in advance:

GetHardwareInfo

This function takes a pointer to an array of bytes which will be loaded with three values:


1. I2C frequency (note that the value returned is the I2C frequency divided by 2)

2. 3.3V Power Output State (0 = ‘On’ and 1=’Off’)

3. 5V Power Output State (0 = ‘On’ and 1=’Off’)

 

C/C++:
int
GetHardwareInfo(uchar *HardwareData);

 

Regards,

Joey

0 Kudos
Message 1 of 18
(3,332 Views)

LV_Pass_Pointer.png

 

 

GetValueByPointer.xnode

 

C:\Program Files (x86)\National Instruments\LabVIEW 2012\vi.lib\Utility\importsl\GetValueByPointer

- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 2 of 18
(3,323 Views)

@ZhuoCao wrote:

GetHardwareInfo

This function takes a pointer to an array of bytes which will be loaded with three values:


An array of bytes is an array of 8-bit values (U8 or I8). Configure the Call Library node for that parameter as an array of U8, passed by Array Data Pointer.

0 Kudos
Message 3 of 18
(3,317 Views)

Hello:

 

How do I pass the (uchar *Hardwaredata) into the DLL?  It is suppose to be a pointer value, I am not sure how to set it up.  What value do I connect to it in the block diagram, is it a string input?

 

untitled.JPG 

0 Kudos
Message 4 of 18
(3,301 Views)

Hi,

 

snippl.png

 

cfg.png

 

For more, go : Help - Find examples, then Search, type DLL and open Call DLL example !

0 Kudos
Message 5 of 18
(3,290 Views)

No need to typecast to a string, just pass the array directly:

Array to DLL.png

0 Kudos
Message 6 of 18
(3,278 Views)

Or some other of those many methods left 🙂

0 Kudos
Message 7 of 18
(3,272 Views)

Thanks for all the support guys, unfortunately I tried both methodologies and still having error 1097 for passing the string pointer and the u8 array pointer. See below, am I missing anything else?  I made two queries to the DLL and able to get the correct values back so I know I am connected to the DLL.

 

untitled2.JPG

 

untitled.JPG

0 Kudos
Message 8 of 18
(3,264 Views)

Do you have the function code, especially the part where it operates the input *uchar ?

0 Kudos
Message 9 of 18
(3,260 Views)

No I don't, I will contact vendor below and see if I get more details on the function call.

 

http://www.i2ctools.com/products.html

0 Kudos
Message 10 of 18
(3,258 Views)