Programming Examples
12
Agilent InfiniiVision 7000A Series Oscilloscopes Programmer's Guide
841
'
' Where:
'
'
<header> = #800002048
(this is an example header)
'
' The "#8" may be stripped off of the header and the remaining
' numbers are the size, in bytes, of the waveform data block.
' The size can vary depending on the number of points acquired
' for the waveform which can be set using the
' ":WAVEFORM:POINTS" command.
You may then read that number
' of bytes from the oscilloscope; then, read the following NL
' character to terminate the query.
' Read waveform data.
ResultsArray = myScope.DoQueryIEEEBlock(":WAVeform:DATA?")
nBytes = ResultsArray.Length
Console.WriteLine("Read waveform data ({0} bytes).", nBytes)
' Make some calculations from the preamble data.
Dim fVdiv As Double = 32 * fYincrement
Dim fOffset As Double = fYorigin
Dim fSdiv As Double = fPoints * fXincrement / 10
Dim fDelay As Double = (fPoints / 2) * fXinc fXorigin
' Print them out...
Console.WriteLine("Scope Settings for Channel 1:")
Console.WriteLine("Volts per Division = {0:f}", fVdiv)
Console.WriteLine("Offset = {0:f}", fOffset)
Console.WriteLine("Seconds per Division = {0:e}", fSdiv)
Console.WriteLine("Delay = {0:e}", fDelay)
' Print the waveform voltage at selected points:
Dim i As Integer = 0
While i < nBytes
Console.WriteLine("Data point {0:d} = {1:f6} Volts at " + _
"{2:f10} Seconds", i, _
(CSng(ResultsArray(i)) - fYreference) * fYinc _
fYorigin, (CSng(i) - fXreference) * fXinc fXorigin)
i = i + (nBytes / 20)
End While
' SAVE_WAVE_DATA - saves the waveform data to a CSV format
' file named "waveform.csv".
If File.Exists("c:\scope\data\waveform.csv") Then
File.Delete("c:\scope\data\waveform.csv")
End If
Dim writer As StreamWriter = _
File.CreateText("c:\scope\data\waveform.csv")
For index As Integer = 0 To nBytes - 1
writer.WriteLine("{0:E}, {1:f6}", _
(CSng(index) - fXreference) * fXinc fXorigin, _
(CSng(ResultsArray(index)) - fYreference) * fYincrement _
+ fYorigin)
Next
writer.Close()
Console.WriteLine("Waveform data ({0} points) written to " + _
Содержание InfiniiVision 7000A Series
Страница 1: ...Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide...
Страница 34: ...34 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 1 What s New...
Страница 44: ...44 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 2 Setting Up...
Страница 58: ...58 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 3 Getting Started...
Страница 652: ...652 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 5 Commands by Subsystem...
Страница 750: ...750 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 8 Error Messages...
Страница 784: ...784 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 10 Synchronizing Acquisitions...
Страница 810: ...810 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 11 More About Oscilloscope Commands...
Страница 922: ...922 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide Index...