Chapter 9
123
Measurement Applications (Sample Programs)
Reading Measurement Results in Binary Format Using *TRG Command
9.
M
easu
rem
ent
Applica
tio
ns
(S
amp
le
Prog
ra
ms)
Example 9-7
Reading Measurement Results in Binary Format using *TRG Command
Sub Example7()
'===================================
' Configuration
'===================================
Dim defrm As Long 'Session to Default Resource Manager
Dim Agte4981a As Long 'Session to instrument
Dim Res() As Double
Dim Nop As Long, i As Integer, j As Integer, k As Integer
Const TimeOutTime = 30000
On Error GoTo ErrorHandler
'===================================
' Open Instrument
'===================================
ErrorCheck viOpenDefaultRM(defrm)
Call SelectMode(defrm, Agte4981a)
ErrorCheck viSetAttribute(Agte4981a, VI_ATTR_TMO_VALUE,
TimeOutTime)
'===================================
' Setup Start
'===================================
ErrorCheck viVPrintf(Agte4981a, "SYST:PRES;*CLS" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, "FORM REAL" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, "APER:TIME 6" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, "TRIG:SOUR BUS" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, "CALC1:COMP OFF" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, "INIT:CONT OFF" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, "INIT" + vbLf, 0)