beautypg.com

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

Page 275

background image

GPIB Program Examples

WM-RCM-E Rev D

ISSUED: February 2005

269

Dim DeviceAddress As String
‘ Read the device address from cell 2D, and use it to connect the PC to
the DSO.
DeviceAddress = Worksheets("Sheet1").Cells(2, 4).Value
Call o.MakeConnection(DeviceAddress)
‘ Set the DSO into remote control mode.
Call o.SetRemoteLocal(1)
' Set TimeOut to 3 seconds instead of the default, which is 10 seconds.
Call o.SetTimeOut(3)

Dim ErrorFound, GetOut, Waiting As Boolean
Dim Row, Column, Counter, LoopTotal, TCounter, FCounter, TestLength As
Integer
Dim HoldOff, NewTime, XTime, StartRow As Single
Dim ControlDatum, NextData, NextNextData, Query, Quit, ReStart As String
' Column containg the remote control commands.
Column = 3: StartRow = 10
' Cell(2,6) is the cell containing the row for restart after a pause.
' It is empty when starting from top of the list of commands, which is
' Cell(StartRow,Column).

If Worksheets("Sheet1").Cells(2, 6).Value < 1 Then

Row = StartRow

Else

Row = Worksheets("Sheet1").Cells(2, 6).Value

End

If


Query = "?": Quit = "quit"
' Set exit flag, error flag and waiting flag to false.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.

' Execute the command line LoopTotal times.

For Counter = 1 To LoopTotal

' Continue with loop only if no error was found in the loop.

If ErrorFound = False Then

' Send data to instrument.

If Len(NextData) > 1 Then Call o.WriteString(NextData, 1)

' Erase contents of cell ready for response from instrument.

Worksheets("Sheet1").Cells(Row, Column + 2).Value = ""

If LoopTotal > 1 Then

' Show progress in cell.

Worksheets("Sheet1").Cells(Row, Column + 1).Value = Counter

End If