User manual

Table Of Contents
Part 2: Automation Programming Reference
Synchronization
Synchronization—or, more specifically, knowing when to read results—is critical when operating a digital
oscilloscope remotely (it is just as important for Automation as for GPIB remote control ). This is especially
true when working with an oscilloscope that uses a multithreaded architecture.
A classic problem seen in the majority of custom applications that control Teledyne LeCroy oscilloscopes
is that the scope is left to free-run in Auto-trigger mode, while simultaneously (and asynchronously) results
are queried.
Several techniques can be used to guarantee the synchronization and consistency of results, whether
they be waveform or parameter measurements, when using the Automation interface.
Synchronizing Triggers Using Timeouts
The Acquire method arms the acquisition system and waits a user-specified time for a trigger. The second
argument, an optional Boolean, specifies whether or not to force a trigger then return the value if a trigger
doesnt arrive within the allotted time period.
Note: The Acquire method is equivalent to setting the Trigger Mode to Single”, then executing
WaitUntilIdle.The return of the Boolean causes the method to function logically like a query and
requires it to be read into a variable, whether or not the returned value is actually displayed.
The following Excel VBA macro example demonstrates the use of a timeout, a useful technique for
ensuring synchronization.
Sub Button1_Click()
' Connect to the oscilloscope
Set app = CreateObject("LeCroy.XStreamDSO")
' Enable Standard Vertical parameters
app.Measure.MeasureMode = "StdVertical"
' Stop the free-running trigger and take a single acquisition
' Use a 10 second timeout in case the acquisition is not complete
app.Acquisition.TriggerMode = "Stopped"
Dim Acquired as Boolean
Acquired = app.Acquisition.Acquire (10, True)
' Read the first parameter value and transfer into the spreadsheet
' Display the Acquired value to show the oscilloscope has triggered
Cells(1, 3).Value = app.Measure.P1.Out.Result.Value
MsgBox Acquired
End Sub
2-39