EasyManua.ls Logo

Keysight 34972A - Page 262

Keysight 34972A
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6 Application Programs
262 Keysight 34970A/34972A User’s Guide
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 GPIB 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

Table of Contents

Related product manuals