Agilent Technologies 34970A Switch User Manual


 
’ Set up the scan trigger parameters after configuring the channels in the scan list
’ using the CONFigure command. The following commands configure the scan interval.
SendSCPI "TRIG:COUNT " & Str$(numberScans)
SendSCPI "TRIG:SOUR TIMER"
SendSCPI "TRIG:TIMER " & Str$(ScanInterval)
Cells(2, 1) = "Start Time" ’ Put headings on spreadsheet
Cells(4, 1) = "Channel" ’ Put headings on spreadsheet
’ Start the scan and retrieve the scan start time
SendSCPI "INIT;:SYSTEM:TIME:SCAN?"
replyString = GetSCPI() ’ Put time into string variable
’ Convert the time to Excel format and put into cells B2 and C2
Cells(2, 2) = ConvertTime(replyString)
Cells(2, 3) = Cells(2, 2)
Cells(2, 3).NumberFormat = "d-mmm-yy" ’ Format for date
Cells(2, 2).NumberFormat = "hh:mm:ss" ’ Format for time
Range("a1:ba1").ClearContents ’ Clear out row 1
’ Step through the number of scan sweeps
For columnIndex = 1 To numberScans ’ Start of scan data
Do ’ Wait for instrument to put a reading in memory
SendSCPI "DATA:POINTS?" ’ Get the number of readings stored
points = Val(GetSCPI())
Loop Until points >= 1
’ Remove one reading at a time from memory
For Channel = 1 To numberChannels
SendSCPI "DATA:REMOVE? 1" ’ Request one reading from memory
Application.ScreenUpdating = False
’ Get readings from buffer and store in cell A1
Cells(1, 1) = GetSCPI()
’ Parse the string in cell A1 and put into row ’1’
Range("a1").TextToColumns Destination:=Range("a1"), comma:=True
’ Call routine to organize the data in row 1 into a table
makeDataTable Channel, columnIndex
Range("a1:ba1").ClearContents ’ Clear out row 1
Application.ScreenUpdating = True
Do ’ Wait for instrument to put another reading in memory
SendSCPI "DATA:POINTS?" ’ Get the number of readings stored
points = Val(GetSCPI())
Loop Until points >= 1 Or Channel >= numberChannels
Next Channel
Next columnIndex
ClosePort ’ Close communications on GPIB
End Sub
Continued on next page
Chapter 7 Application Programs
Example Programs for Excel 7.0
326