EasyManua.ls Logo

Hioki RM3542 - Page 164

Hioki RM3542
218 pages
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...
9.9 Sample Programs
158
External Trigger Measurement 2
Measure and import according to external triggering of the RM3542 (F4 [MANU] key or TRIG signal input),
and save measurements in a text file.
(The RM3542 imports the most recent measurement by trigger input timing with the continuous measurement
state)
Private Sub MeasureTrig2Sub()
Dim buffer As String 20 'Receiving buffer
Dim recvstr As String 'Receiving char string
Dim pad As Integer 'Controller Address
Dim gpibad As Integer 'Device Address
Dim timeout As Integer 'Timeout period
Dim ud As Integer 'State (unused)
Dim i As Integer
pad = 0 'Board Address 0
gpibad = 1 'RM3542 Address 1
timeout = T100s 'Timeout 100s (because of external trigger wait state)
Call ibfind("gpib0", 0) 'Initialize GP-IB
Call ibdev(pad, gpibad, 0, timeout, 1, 0, ud)
Call SendIFC(pad)
Open App.Path & "\data.csv" For Output As #1 'Open a text file for saving
Call Send(pad, gpibad, ":TRIG:SOUR IMM", NLend) 'Select internal triggering
Call Send(pad, gpibad, ":INIT:CONT ON", NLend) 'Continuous measurement ON
'Clear confirmation of External I/O TRIG input
Call Send(pad, gpibad, ":IO:IN?", NLend)
Call Receive(pad, gpibad, buffer, STOPend)
recvstr = Left(buffer, InStr(1, buffer, Chr(10)) - 1)
For i = 1 To 10
'Wait for External I/O TRIG input
Do While 1
Call Send(pad, gpibad, ":IO:IN?", NLend)
Call Receive(pad, gpibad, buffer, STOPend)
If Left(buffer, 1) = "1" Then Exit Do
DoEvents
Loop
Call Send(pad, gpibad, ":FETCH?", NLend) 'Send ":FETCH?" to import the most recent
measurement
Call Receive(pad, gpibad, buffer, STOPend) 'Receive
recvstr = Left(buffer, InStr(1, buffer, Chr(10)) - 1)
Print #1, Str(i) & "," & recvstr 'Write to the file
Next
Close #1
Call ibonl(pad, 0)
End Sub

Table of Contents

Other manuals for Hioki RM3542

Related product manuals