Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using NIGLOBAL.BAS AND VBIB-32.BAS IN VB6

I downloaded the sample programs and successfully ran DMMSimple
(Simple.vbp). Using the same functions that are used in DMMSimple,
ildev, ilclr, ilwrt and ilrd, I am unable to duplicate the success of these
functions using a program written with VB6. Should I use VB5 only when
I use these functions?
0 Kudos
Message 1 of 5
(5,763 Views)
You should be able to use ildev, ilclr, ilwrt, and ilrd in a Visual Basic
6.0 application without any problems. What sort of problems are you having?

Liz

"Steven Hedgepeth" wrote:
>>I downloaded the sample programs and successfully ran DMMSimple>(Simple.vbp).
Using the same functions that are used in DMMSimple, >ildev, ilclr, ilwrt
and ilrd, I am unable to duplicate the success of these>functions using a
program written with VB6. Should I use VB5 only when>I use these functions?
0 Kudos
Message 2 of 5
(5,763 Views)
The following code results in the DMM displaying the "remote" message but
the
return I receive for ValueStr is "" instead of the expected "Fluke, 45, 1234567,
x.x, Dx.x":
' The application writes the text in DMMCommand to the multimeter.
ilwrt Dev%, DMMCommand.Text, Len(DMMCommand.Text)
If (ibsta And EERR) Then
Call GPIBCleanup("Unable to write to device")
End If

' The application reads the ASCII string from the multimeter into
' the ValueStr variable.
ilrd Dev%, ValueStr, Len(ValueStr)
If (ibsta And EERR) Then
Call GPIBCleanup("Unable to read from device")
End If
Thank you for your help.


"Liz" wrote:
>>You should be able to use ildev, ilclr, ilwrt, and ilrd in a Visual Basic>6.0

application without any problems. What sort of problems are you having?>>Liz>>"Steven
Hedgepeth" wrote:>>>I downloaded the sample programs
and successfully ran DMMSimple>(Simple.vbp).> Using the same functions that
are used in DMMSimple, >ildev, ilclr, ilwrt>and ilrd, I am unable to duplicate
the success of these>functions using a>program written with VB6. Should
I use VB5 only when>I use these functions?>
0 Kudos
Message 3 of 5
(5,763 Views)
Oops, silly me. After I initialize ValueStr (ValueStr = Space(40)), it works
correctly. When will I ever learn?

"Steven Hedgepeth" wrote:
>>The following code results in the DMM displaying the "remote" message but>the>return
I receive for ValueStr is "" instead of the expected "Fluke, 45, 1234567,>x.x,
Dx.x":> ' The application writes the text in DMMCommand to the multimeter.>
ilwrt Dev%, DMMCommand.Text, Len(DMMCommand.Text)> If (ibsta And EERR)
Then> Call GPIBCleanup("Unable to write to device")> End If>>
' The application reads the ASCII string from the multimeter into> '
the ValueStr variable.> ilrd Dev%, ValueStr, Len(ValueStr)> If (ibsta
And EERR) Then> Call GPIBCleanup("Unable
to read from device")>
End If>Thank you for your help.>>>"Liz" wrote:>>>You
should be able to use ildev, ilclr, ilwrt, and ilrd in a Visual Basic>6.0>application
without any problems. What sort of problems are you having?>>Liz>>"Steven>Hedgepeth"
wrote:>>>I downloaded the sample programs>and successfully
ran DMMSimple>(Simple.vbp).> Using the same functions that>are used in DMMSimple,
>ildev, ilclr, ilwrt>and ilrd, I am unable to duplicate>the success of these>functions
using a>program written with VB6. Should>I use VB5 only when>I use these
functions?>
0 Kudos
Message 4 of 5
(5,763 Views)
Steven,

Congratulations of figuring out the problem! Yeah, it looks like you ran
into one of those gotchas with Visual Basic where you need to set aside space
for a buffer in Visual Basic before calling the ibrd (or ilrd) call.

If you run into problems like this again, you might check out the following
web page:

http://www.ni.com/support/gpib/langint/qth.htm

It has answers to some of the common questions like yours ("Why does the
read operation return an empty buffer?").

Regards,
Liz

"Steven Hedgepeth" wrote:
>>Oops, silly me. After I initialize ValueStr (ValueStr = Space(40)), it
works>correctly. When will I ever learn?>>"Steven Hedgepeth"
wrote:>>>The following code results in the DMM display
ing the "remote" message
but>the>return>I receive for ValueStr is "" instead of the expected "Fluke,
45, 1234567,>x.x,>Dx.x":> ' The application writes the text in DMMCommand
to the multimeter.>> ilwrt Dev%, DMMCommand.Text, Len(DMMCommand.Text)>
If (ibsta And EERR)>Then> Call GPIBCleanup("Unable to write to
device")> End If>> > ' The application reads the ASCII string from the
multimeter into> '>the ValueStr variable.> ilrd Dev%, ValueStr, Len(ValueStr)>
If (ibsta>And EERR) Then> Call GPIBCleanup("Unable to read from
device")> > End If>Thank you for your help.>>>"Liz"
wrote:>>>You>should be able to use ildev, ilclr, ilwrt, and ilrd in a Visual
Basic>6.0>application>without any problems. What sort of problems are you
having?>>Liz>>"Steven>Hedgepeth"> wrote:>>>I downloaded
the sample programs>and successfully>ran DMMSimple>(Simple.vbp).> Using the
same functions that>are used in DMMSimple,>>ildev, ilclr, ilwrt>
and ilrd,
I am unable to duplicate>the success of these>functions>using a>program written
with VB6. Should>I use VB5 only when>I use these>functions?>
0 Kudos
Message 5 of 5
(5,763 Views)