EasyManua.ls Logo

Anritsu MF2412B - Page 137

Anritsu MF2412B
177 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Section 5 GPIB
5-34
2) Program example using Visual Basic
Sub SAMP1 ()
ADRS%=8
Cls
Call SendIFC(0) : Interface clear
If ibsta% And EERR Then
Call ERRMSG(ADRS%, "Error: IFC")
End If
Call DevClear(0, ADRS%) : Device clear
If ibsta% And EERR Then
Call ERRMSG(ADRS%, "Error: DCL")
End If : Specifies presets, status clear, and terminator
Call Send(0,ADRS%, "*RST;*CLS;TRM 1", NLend)
If ibsta% And EERR Then
Call ERRMSG(ADRS%, "Error: SENDING COMMAND")
End If
Call Send(0, ADRS%, "*ESE2 1", NLend) : Permits measurement end event status
Call Send(0, ADRS%, "SMP 9;RES 3", NLend) : Sets sample rate of 1 s and resolution of 1 Hz
Call Send(0, ADRS%, "CLS;*TRG",NLend) : Status clear and trigger command
For I%=1 To 10
FREQ$=Space$(20)
Call Serpoll(ADRS%) : Serial polling
Call Send(0, ADRS%, "MCW?", NLend) : Reads frequency measurement value
Call Receive(0, ADRS%, FREQ$, STOPend)
Print FREQ$ : Displays frequency measurement value
Next I%
Call ibonl(ADRS%, 0)
End Sub
Sub Serpoll(ADR%) : Serial polling routine
Do
Call ReadStatusByte(0, ADR%, Status%)
If ibsta% And EERR Then
Call ERRMSG(ADRS%, "Error: could not read status byte. ")
End If
Loop Until (Status% And &H4)=&H4
Call Send(0, ADR%, "*CLS", NLend)
End Sub

Table of Contents