Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

I got a error msg "invild procedure or argument" when call ud% = ildev(, , , , , ) in VB 5.0 application

My application callS Dev% = ildev(0, 1, 0, T3s, 1, 0). Then Real time Error appears "invild procedure or argument" .


PC has installed MAX 2.0 (NI)

what is the solution for it?
0 Kudos
Message 1 of 10
(8,334 Views)
Generally that error means you are passing your function invalid values, but from what you posted everything looks fine to me. Have you tried running any of the shipping examples that use ildev? For example the Devquery example? You can usually find these examples in the following directory.

C:\Program Files\National Instruments\NI-488.2\Languages\Visual Basic

It would be interesting to see if the example has the same error.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 2 of 10
(8,323 Views)
Yes, I tried the example code from the Max 2.0 CD. The problem I found is the return value is not -1 or error msg if the function call could not find any GPIB device.
0 Kudos
Message 3 of 10
(8,316 Views)
Was it the ildev call in the example that was returning this error? Also, have you tried communicating with the device through other methods, such as through Measurement and Automation Explorer?

john m
Applications Engineer
0 Kudos
Message 4 of 10
(8,302 Views)
Yes, I used Max 2.0 to find devices and it works fine. the function call ildev returns no error messages if no device found.
0 Kudos
Message 5 of 10
(8,302 Views)
Out of curiosity, have you tried using the ibdev function instead to see if it has the same error?

john
0 Kudos
Message 6 of 10
(8,283 Views)
Yes, ibdev has the same error.
0 Kudos
Message 7 of 10
(8,281 Views)
Well, it looks like this isn't going to be solved by a quick solution. Could you resummarize for me exactly what is going on, including the version of NI-488.2 you are using, exactly what program you are running, and exactly what error you are obtaining? Also, you could run NI Spy in the background to obtain a Spy capture so we could know exactly what is going on at the driver level. Once we have all of these details, we can more accurately troubleshoot this issue.

john
0 Kudos
Message 8 of 10
(8,272 Views)
The code is here:

If RTV.bPS(0) = True Then
Call ibdev(0, 1, 0, T10s, 1, 0, RTV.nGpib1%)
Sleep (10)
If ibsta And EERR Then
Call MsgBox("GPIB Device 1 Setup Error!", vbCritical, "GPIB Error")
frmLogo.MSComm1.PortOpen = False
Sleep (50)
End
End If
End If

The condition expression "ibsta And EERR" was always FALSE, no matter the GPIB device is on or off of power.
0 Kudos
Message 9 of 10
(8,270 Views)
Hi Daloon,

In order to get a better idea of what is going on at the driver level, I'd love to see an NI Spy capture. NI Spy is a utility that logs all of the calls made to NI-488.2, NI-VISA, and many other National Instruments drivers. Here is a tutorial that discusses NI Spy:

NI Spy

Please take a Spy capture while your program is running and attach the file to your next post so that we can better troubleshoot what is going on behind the scenes. I look forward to continuing to assist you in this.

john
0 Kudos
Message 10 of 10
(8,259 Views)