HP 34970A User Manual page 323

Data acquisition / switch unit
Table of Contents

Advertisement

Chapter 7 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"
Cells(4, 1) = "Channel"
' Start the scan and retrieve the scan start time
SendSCPI "INIT;:SYSTEM:TIME:SCAN?"
replyString = GetSCPI()
' 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"
Cells(2, 2).NumberFormat = "hh:mm:ss"
Range("a1:ba1").ClearContents
' Step through the number of scan sweeps
For columnIndex = 1 To numberScans
Do
' Wait for instrument to put a reading in memory
SendSCPI "DATA:POINTS?"
points = Val(GetSCPI())
Loop Until points >= 1
' Remove one reading at a time from memory
For Channel = 1 To numberChannels
SendSCPI "DATA:REMOVE? 1"
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
Application.ScreenUpdating = True
Do
' Wait for instrument to put another reading in memory
SendSCPI "DATA:POINTS?"
points = Val(GetSCPI())
Loop Until points >= 1 Or Channel >= numberChannels
Next Channel
Next columnIndex
ClosePort
End Sub
326
' Put headings on spreadsheet
' Put headings on spreadsheet
' Put time into string variable
' Format for date
' Format for time
' Clear out row 1
' Start of scan data
' Get the number of readings stored
' Request one reading from memory
' Clear out row 1
' Get the number of readings stored
' Close communications on HP-IB
Continued on next page

Advertisement

Table of Contents
loading

Table of Contents