
248
Chapter 6 Application Programs
Example Programs for Excel 7.0
’ 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
34970A Refresh UG.book Page 248 Wednesday, February 17, 2010 12:34 PM
Содержание 34970A
Страница 16: ...16 34970A Refresh UG book Page 16 Wednesday February 17 2010 12 34 PM ...
Страница 20: ...34970A Refresh UG book Page 20 Wednesday February 17 2010 12 34 PM ...
Страница 21: ...1 1 Quick Start 34970A Refresh UG book Page 21 Wednesday February 17 2010 12 34 PM ...
Страница 39: ...2 2 Front Panel Overview 34970A Refresh UG book Page 39 Wednesday February 17 2010 12 34 PM ...
Страница 59: ...3 3 System Overview 34970A Refresh UG book Page 59 Wednesday February 17 2010 12 34 PM ...
Страница 87: ...4 4 Features and Functions 34970A Refresh UG book Page 87 Wednesday February 17 2010 12 34 PM ...
Страница 217: ...5 5 Error Messages 34970A Refresh UG book Page 217 Wednesday February 17 2010 12 34 PM ...
Страница 240: ...240 Chapter 5 Error Messages Plug In Module Errors 34970A Refresh UG book Page 240 Wednesday February 17 2010 12 34 PM ...
Страница 241: ...6 6 Application Programs 34970A Refresh UG book Page 241 Wednesday February 17 2010 12 34 PM ...
Страница 254: ...254 34970A Refresh UG book Page 254 Wednesday February 17 2010 12 34 PM ...
Страница 255: ...7 7 Tutorial 34970A Refresh UG book Page 255 Wednesday February 17 2010 12 34 PM ...
Страница 324: ...324 34970A Refresh UG book Page 324 Wednesday February 17 2010 12 34 PM ...