0% found this document useful (0 votes)
445 views2 pages

Two Methods of Programming VISA GPIB in VB6

This document describes two methods for programming GPIB devices in Visual Basic 6 (VB6). The first method uses the VISA COM library to provide fine-grained control over communication with GPIB devices. The second method uses the VISA COM library in a simpler way that is easier to work with in VB6 but provides less control. Both methods initialize the VISA resource manager, open a connection to the GPIB device, send and receive commands using the GPIB interface.

Uploaded by

eux2
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
445 views2 pages

Two Methods of Programming VISA GPIB in VB6

This document describes two methods for programming GPIB devices in Visual Basic 6 (VB6). The first method uses the VISA COM library to provide fine-grained control over communication with GPIB devices. The second method uses the VISA COM library in a simpler way that is easier to work with in VB6 but provides less control. Both methods initialize the VISA resource manager, open a connection to the GPIB device, send and receive commands using the GPIB interface.

Uploaded by

eux2
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

I:\VISUAL_BASIC_PROGRAMMING\Two_methods_of_Programming_VISA_GPIB_in_VB6

' VISA GPIB driver methods using NI or Agilent GPIB drivers.


' For visual basic 6, VB6 or ExcelVBA or Excel VBA
Private Sub cmdRUN_Click()
' How to get the visacom driver working with the latest IVIfoundation
' drivers.
' ******************************************************************
' In project reference do not forget to add as a project reference
' VISA COM 3.0 Type Library
' ******************************************************************
' Using this method you get very fine grain control
Dim Result As String
Dim VGaddress As String
Dim ioMgr As VisaComLib.ResourceManager
Set ioMgr = New VisaComLib.ResourceManager
Dim VGb As VisaComLib.FormattedIO488
Set VGb = New VisaComLib.FormattedIO488
Rem VGaddress =
Rem VGadress = "visa://192.168.3.25/GPIB0::22::INSTR" ' Or
Rem VGadress = "GPIB0::2::INSTR"
Rem not valid for RS232 serial GPIB connections
VGaddress = Trim(Text_input.Text)
' trim the result from the text box to remove spaces
Label_output.Caption = "Talking to address :: " + VGaddress + vbLf
Set VGb.IO = ioMgr.Open(VGaddress)
VGb.IO.Timeout = 10000
VGb.WriteString ("*IDN?") ' write SCPI command to VISAGPIB Device
Label_output.Caption = Label_output.Caption + "Sending IEC bus command *IDN? "
+ vbLf
Result = VGb.ReadString ' READ SCPI command to VISAGPIB Device
Label_output.Caption = Label_output.Caption + "Information return by
instrument " + vbLf
Label_output.Caption = Label_output.Caption + Result + vbLf
VGb.IO.Close
End Sub

1 of 2
I:\VISUAL_BASIC_PROGRAMMING\Two_methods_of_Programming_VISA_GPIB_in_VB6

Private Sub cmdOther_method_click()


' This is the other method of access the VISA GPIB devices has less control
' but easier to work with in VB
' ******************************************************************
' In project reference do not forget to add as a project reference
' VISA COM 3.0 Type Library
' ******************************************************************
Dim rm As IResourceManager
Dim msg As IMessage
Dim Result As String
Dim VisaAddress As String
Rem VisaAdress = "visa://192.168.3.25/GPIB0::22::INSTR" ' Or
Rem VisaAdress = "GPIB0::2::INSTR"
Rem not valid for RS232 serial GPIB connections

VisaAddress = Trim(Text_input.Text)
' trim the result from the text box to remove spaces
Label_output.Caption = "Talking to address :: " + VisaAddress + vbLf
Set rm = CreateObject("VISA.GlobalRM")' Set visagpib connection
Set msg = rm.Open(VisaAdress, NO_LOCK, 2000, "") ' Timeout=2000mS max 3000mS
msg.Clear
msg.WriteString "*IDN?" & vbLf ' write SCPI command to VISAGPIB Device
Label_output.Caption = Label_output.Caption + "Sending IEC bus command *IDN? "
+ vbLf
Result = msg.ReadString(256) ' READ SCPI command to VISAGPIB Device
Label_output.Caption = Label_output.Caption + "Information return by
instrument " + vbLf
Label_output.Caption = Label_output.Caption + Result + vbLf
End Sub

2 of 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy