EasyManuals Logo

HP 34970A User Manual

HP 34970A
429 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #324 background imageLoading...
Page #324 background image
Sub makeDataTable(Channel As Integer, columnIndex As Integer)
’ This routine will take the parsed data in row ’1’ for a channel and put it into a
’ table. ’Channel’ determines the row of the table and ’columnIndex’ determines the
’ column (scan sweep count).
’ The number of comma-delimited fields returned per channel is determined by the
’ FORMat:READing commands. The number of fields per channel is required to locate
’ the data in row 1. In this example, there are three cells (fields) per channel.
’ Set up the heading while scanning the first channel.
If Channel = 1 Then
’ Label the top of the data column and time stamp column
Cells(4, columnIndex * 2) = "Scan " & Str(columnIndex)
Cells(4, columnIndex * 2).Font.Bold = True
Cells(3, columnIndex * 2 + 1) = "time stamp"
Cells(4, columnIndex * 2 + 1) = "min:sec"
End If
’ Get channel number, put in column ’A’ for first scan only
If columnIndex = 1 Then
Cells(Channel + 4, 1) = Cells(1, 3)
End If
’ Get the reading data and put into the column
Cells(Channel + 4, columnIndex * 2) = Cells(1, 1)
’ Get the time stamp and put into the column to the right of data; to convert relative
’ time to Excel time, divide by 86400.
Cells(Channel + 4, columnIndex * 2 + 1) = Cells(1, 2) / 86400
Cells(Channel + 4, columnIndex * 2 + 1).NumberFormat = "mm:ss.0"
End Sub
Function ConvertTime(TimeString As String) As Date
’ This routine will take the string returned from the SYSTem:TIME:SCAN? command and
’ return a number compatible with the Excel format. When loaded into a cell, it can
’ be formatted using the Excel ’Format’ menu.
Dim timeNumber As Date ’ Decimal or time portion of the number
Dim dateNumber As Date ’ Integer or date portion of the number
Cells(1, 1).ClearContents
Cells(1, 1) = TimeString
Range("a1").TextToColumns Destination:=Range("a1"), comma:=True
dateNumber = DateSerial(Cells(1, 1), Cells(1, 2), Cells(1, 3))
timeNumber = TimeSerial(Cells(1, 4), Cells(1, 5), Cells(1, 6))
ConvertTime = dateNumber + timeNumber
End Function
Sub GetErrors()
’ Call this routine to check for instrument errors. The HP-IB address variable
’ ’VISAaddr’ must be set.
Dim DataString As String
OpenPort
SendSCPI "SYSTEM:ERROR?" ’ Read one error from the error queue
Delay (0.1)
DataString = GetSCPI()
MsgBox DataString
ClosePort
End Sub
7
Chapter 7 Application Programs
Example Programs for Excel 7.0
327

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP 34970A and is the answer not in the manual?

HP 34970A Specifications

General IconGeneral
BrandHP
Model34970A
CategorySwitch
LanguageEnglish

Related product manuals