beautypg.com

Gpib program examples – Teledyne LeCroy X-STREAM OSCILLOSCOPES Remote Control User Manual

Page 273

background image

GPIB Program Examples

WM-RCM-E Rev D

ISSUED: February 2005

267

The fragment below is the subroutine that reads waveform data from the DSO and places the values in column
I (9

th

column) of the spreadsheet.


Private Sub GetScaledWaveformButton_Click()
Dim o As Object ‘ Define variable o as an object.

‘ Equate object o with the ActiveDSO object LeCroy.ActiveDSOCtrl1.
Set o = CreateObject("LeCroy.ActiveDSOCtrl.1")

‘ Read the device address from cell 2C, and use it to connect the PC to
the DSO.
Dim deviceAddress As String
deviceAddress = Worksheets("Sheet1").Cells(2, 3).Value
Call o.MakeConnection(deviceAddress)
‘ Set the DSO into remote control mode.
Call o.SetRemoteLocal(1)

‘ Define an array of the size you need for your waveform data.
‘ Read the waveform data from the DSO into the array.
Dim waveArray
waveArray = o.GetScaledWaveform("C1", 500000, 0)

‘ Place the data into column I (9

th

column).

Dim i As Long

For i = 0 To UBound(waveArray)

Worksheets("Sheet1").Cells(i + 3, 9).Value = waveArray(i)

Next

i

End Sub
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.

‘ Release the control.
Call o.SetRemoteLocal(0)
Set o = Nothing
End Sub