Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview dll returns default values when called from Visual Basic

All,
 
 I have created a vi to read 4 voltage rails and 2 differerential voltages for current draw readings across resistors. When I run this vi in labview I get the expected results from my UUT. I then setup the outputs on the connect pane and create a dll. When I call this dll from my Visual Basic app, the return values for the current/voltage readings are always the default values (i.e. 0). The dll returns the error code -2491 when call from VB as well.
 
This section of code is how I declare the dll in VB:
 
Public Declare Function ReadRails Lib "C:\0714Testset\DLL\GateDriver.dll" _
    (ByRef Current5V As Double, ByRef Current12V As Double, ByRef CTPSU As Double, _
    ByRef FAULT_OUT As Double, ByRef Rail5V As Double, ByRef UUT_SUPPLY As Double) _
    As Integer

I then call the dll using this function:

    error = ReadRails(Current5V, Current12V, CTPSU, fault, vcc, uutSupply)

I have also attached my vi.

Any ideas what causes this?

Thanks!


 
0 Kudos
Message 1 of 4
(3,142 Views)
Hi There,

On the front panel of the VI there is an Array control that is used to specify physical channels on the 2nd of 2 DAQmx Create Channel VIs. This Array needs to be populated in order for the VI to sucessfully run, but currently it's default value is unpopulated and I cannot see a corresponding connector on the connector pane that allows data to be passed into this array when called as a DLL. Could this be the issue here or is there something that I have missed with regards to your issue?

Best Regards,

Ian C
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 4
(3,094 Views)

Thanks for the reply, but I just fixed the problem this morning.

Just looking at my original post and I realize I've posted the wrong vi anyway!

0 Kudos
Message 3 of 4
(3,090 Views)
Ah right okay. I'm pleased it's all working. Best of luck with the rest of it.
 
Regards,
 
Ian

 
0 Kudos
Message 4 of 4
(3,087 Views)