Typical Visual BASIC
Example Program
Using Agilent SICL
The following is an example program written in Visual BASIC using the
Agilent Standard Instrument Control Library. The program:
–
sends commands to the AFG to generate an arbitrary waveform;
–
receives data from the AFG;
–
shows how to send coupled commands;
–
and performs error checking of the AFG.
Only program codes are given here. Refer to the actual program on the CD
to see the data that generates the form, buttons, etc.
’ ARBWAVE.FRM - This program generates a 100 points ramp. The data to generate
’ the ramp is transferred to the AFG as comma separated voltages
’ Instrument GPIB address
Const ShowAddr = "hpib7,9,10"
Dim Addr As Integer
Dim ChkName As String
Sub CheckError (SubName As String)
’ Check for any errors
Dim Actual As Long
Dim RdErr As String * 256
Dim Work As String
Dim ErrNum As Integer
Dim TempName As String
TempName = ChkName
ChkName = "CheckError"
’ Read error message
Call iwrite(Addr, ByVal "SYSTem:ERRor?" + Chr$(10), 14, 1, Actual)
Call iread(Addr, ByVal RdErr, 256, 0, Actual)
’ If error was detected
ErrNum = Val(RdErr)
If ErrNum <> 0 Then
’ Store message only into Work string
Work = Mid$(RdErr, 1, Actual - 1)
Work = Work + " - in Sub " + SubName
’ Enable and clear error list box
ShowErr.Enabled = True
ShowErr.Visible = True
ShowErr.Clear
Continued on Next Page
Chapter 1
Getting Started 33
Summary of Contents for E1445A
Page 2: ......
Page 14: ...Notes 12 Agilent E1445A User s Manual Contents...
Page 18: ...Notes 16 Agilent E1445A Arbitrary Function Generator User s Manual...
Page 19: ...Notes Agilent E1445A Arbitrary Function Generator User s Manual 17...
Page 20: ...Notes 18 Agilent E1445A Arbitrary Function Generator User s Manual...
Page 54: ...Notes 52 Getting Started Chapter 1...
Page 84: ...Notes 82 Generating Standard Waveforms Chapter 2...
Page 204: ...Notes 202 Arming and Triggering Chapter 5...
Page 432: ...Figure 9 1 E1445A Status Groups and Associated Registers 430 AFG Status Chapter 9...
Page 446: ...Notes 444 AFG Status Chapter 9...
Page 464: ...Notes 462 Agilent E1445A Specifications Appendix A...
Page 534: ...Notes 532 Agilent E1445A User s Manual Index...