9Programming Examples

varQueryResult = myScope.ReadIEEEBlock(BinaryType_UI1)

For lngI

= 0 To UBound(varQueryResult)

_

Step

(UBound(varQueryResult) / 20)

' 20 points.

If intBytesPerData = 2 Then

lngDataValue = varQueryResult(lngI) * 256 + _ varQueryResult(lngI + 1) ' 16-bit value.

Else

lngDataValue = varQueryResult(lngI) ' 8-bit value. End If

strOutput = strOutput + "Data point " + _ CStr(lngI / intBytesPerData) + ", " + _ FormatNumber((lngDataValue - lngYReference) * sngYIncrement + _ sngYOrigin) + " V, " + _

FormatNumber(((lngI / intBytesPerData - lngXReference) * _ dblXIncrement + dblXOrigin) * 1000000) + " us" + vbCrLf

Next lngI

MsgBox "Waveform data:" + vbCrLf + strOutput

'Make a delay measurement between channel 1 and 2. Dim dblChan1Edge1 As Double

Dim dblChan2Edge1 As Double Dim dblChan1Edge2 As Double Dim dblDelay As Double

Dim dblPeriod As Double Dim dblPhase As Double

'Query time at 1st rising edge on ch1. myScope.WriteString ":MEASURE:TEDGE? +1, CHAN1"

'Read time at edge 1 on ch 1.

dblChan1Edge1 = myScope.ReadNumber

'Query time at 1st rising edge on ch2. myScope.WriteString ":MEASURE:TEDGE? +1, CHAN2"

'Read time at edge 1 on ch 2.

dblChan2Edge1 = myScope.ReadNumber

'Calculate delay time between ch1 and ch2. dblDelay = dblChan2Edge1 - dblChan1Edge1

'Write calculated delay time to screen. MsgBox "Delay = " + vbCrLf + CStr(dblDelay)

'Make a phase difference measurement between channel 1 and 2.

'Query time at 1st rising edge on ch1.

myScope.WriteString ":MEASURE:TEDGE? +2, CHAN1"

'Read time at edge 2 on ch 1. dblChan1Edge2 = myScope.ReadNumber

'Calculate period of ch 1.

dblPeriod = dblChan1Edge2 - dblChan1Edge1

'Calculate phase difference between ch1 and ch2. dblPhase = (dblDelay / dblPeriod) * 360

586

Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Reference

Page 586
Image 586
Agilent Technologies 5000 Series manual 586