EasyManua.ls Logo

Hioki 3541 - Page 156

Hioki 3541
194 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...
8.8 Sample Programs
150
(3) External Trigger Measurement 1
Measure and import according to external triggering of the 3541 (TRIG key or EXT I/O TRIG
terminal input), or by PC key input, and save measurements in a text file.
Private Sub MeasureTrigSubRS()
Dim recvstr As String 'Receiving char string
Dim i As Integer
MSComm1.Settings = "9600,n,8,1" 'Comm port setting
MSComm1.PortOpen = True 'Open a port
Open App.Path & "\data.csv" For Output As #1 'Open a text file for saving
MSComm1.Output = ":TRIG:SOUR EXT" & vbCrLf 'Select external triggering
MSComm1.Output = ":INIT:CONT OFF" & vbCrLf 'Continuous measurement OFF
For i = 1 To 10
MSComm1.Output = ":READ?" & vbCrLf 'Send ":READ?" to measure and import the
measurement
recvstr = "" 'From here on, continue receiving until an LF code
occurs
While Right(recvstr, 1) <> Chr(10)
recvstr = recvstr + MSComm1.Input
DoEvents
'To execute trigger measurement when a PC key is pressed,
'Create a key input check routine to set InputKey() = True when a key is pressed
If InputKey() = True Then
MSComm1.Output = "
TRG" & vbCrLf 'When key input occurs, send "TRG" to trigger
measurement
End If
Wend
recvstr = Left(recvstr, Len(recvstr) - 2) 'Delete the terminator (CR+LF)
Print #1, Str(i) & "," & recvstr 'Write to the file
Next
Close #1
MSComm1.PortOpen = False
End Sub

Table of Contents

Related product manuals