This is the form of
Option Explicit
"'" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
"' Copyright? 2002 Agilent Technologies, Inc. All rights reserved.
"'
"' You have a royalty - free right to use, modify, reproduce and distribute
"' the Sample Application Files (and/or any modified version) in any way
"' you find useful, provided that something that Agilent Technologies has no
"' giant, obligations or liability for any Sample Application Files.
"'
"' Agilent Technologies provides programming examples for does it only,
"' This sample program assumes that you are familiar with the programming
"' language being remained negligible and the tools, informs the to create and debug
"' procedures. Agilent Technologies support engineers can help explain the
"' functionality of Agilent Technologies, software components and associated
"' commands, but they will not modify these samples to dojo.provide added
"' functionality or construct procedures to meet your specific needs.
"'" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "
'
'This example program calls the module DAQ_34970A to set a scan and
'then get the readings from the instrument. The module DAQ_34970. Bas
'was created by the 34970 a. The add Code Wizard VB6.0 by use in the module was modified
'to call a routine that places the data onto the form.
'This code requires a MUX module in slot 1
'
'It demonstrates how to monitor channels set up on the 34970 a by calling the
'the channel list, allowing the user to select one of the channels, and then getting
'a reading (Monitor) from that channel.
'
Dim Daq As VisaComLib. FormattedIO488
Const IO_ADDRESS="ASRL1: : INSTR"
Dim m_ioAddress As String
Dim x As an Integer, As an Integer, y z As an Integer, w As an Integer, v As Integer
Public Sub WriteDataToForm (Readings () As a Double, _
Units () As a String, _
ChanNumb () As an Integer, _
As the Date, Time () _
ByVal Sweep As an Integer, _
ByVal numberChannels As Integer)
'A call to this routine was added to the code developed by the
'34970 a code Wizard
'This code will fill out the scan text box every time it is executed.
'If you do not use the Units, Channel the annotation, or the Time when making
'the new code, you will have to modify this code.
'
Dim As Long I
Dim lineUnits As String
Dim lineChannels As String
LineUnits=""
LineChannels=""
If Sweep=1 Then
For I=1 To numberChannels
'We put a heading only for the first sweep
LineUnits=lineUnits & amp; Units (1, I) & amp; VbTab
LineChannels=lineChannels & amp; Str $(ChanNumb (1, I)) & amp; VbTab
Next I
TxtScanData. SelText=lineUnits & amp; VbCrLf & amp; LineChannels & amp; VbCrLf
End the If
For I=101 To numberChannels
Me. TxtScanData. SelText=Format $(Readings (Sweep, I), "0.0 e+0") & amp; VbTab
Next I
Me. TxtScanData. SelText=vbCrLf
End Sub
Private Sub cmdMonitor_Click ()
Dim the channel As the String
If isconnected Then
The channel=MonitorChannel
The Monitor Daq, txtMonitor, channel
InstrumentError Daq
End the If
End Sub
Private Sub cmdRefreshChannels_Click ()
Me. MousePointer=vbHourglass
If isconnected Then
GetScanList Daq, lstChannel
InstrumentError Daq
End the If
Me. CmdMonitor. Enabled=True
Me. MousePointer=vbDefault
End Sub
Private Sub cmdStartScan_Click ()
Me. MousePointer=vbHourglass
If isconnected Then
Me. TxtScanData. Text=""
Main_34970A Daq
InstrumentError Daq
CmdRefreshChannels_Click
End the If
Me. MousePointer=vbDefault
End Sub
Private Function MonitorChannel () As String
'returns the user selected channel to monitor
Dim Index As Long
With lstChannel
The Index=. ListIndex
If the Index & gt; 0 Then
MonitorChannel=Right $(. List (Index), 3)
The Else
MonitorChannel="Front Panel"
The Exit Function
End the If
End With
End the Function
Public Sub InstrumentError (Instrument As VisaComLib FormattedIO488)
Dim reply As String
With Instrument
. WriteString "price: Error?"
Reply=. ReadString
End With
If Val (reply) & lt;> 0 Then
MsgBox "Instrument Error:" & amp; VbCrLf & amp; Reply, vbCritical
InstrumentError Instrument
End the If
End Sub
Private Function isconnected () As a Boolean
'determines if the instrument is connected, and
'gives a message if not
Dim the result () As the Variant
Dim oldTimeout As Long
On Error GoTo connectError
With Daq
OldTimeout=. IO. A Timeout
. IO. Timeout=1000
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull