(2) Mesurer la résistance par une touche de l'ordinateur
Mesure et importe par l'entrée d'une touche sur l'ordinateur et sauvegarde les mesures dans un fichier texte.
Private Sub MeasureReadSub()
∗
Dim buffer As String
40
Dim recvstr As String
Dim pad As Integer
Dim gpibad As Integer
Dim timeout As Integer
Dim ud As Integer
Dim i As Integer
pad = 0
gpibad = 1
timeout = T10s
Call ibfind("gpib0", 0)
Call ibdev(pad, gpibad, 0, timeout, 1, 0, ud)
Call SendIFC(pad)
Open App.Path & "\data.csv" For Output As #1
Call Send(pad, gpibad, ":TRIG:SOUR IMM", NLend)
CCall Send(pad, gpibad, ":INIT:CONT OFF", NLend)
For i = 1 To 10
'Wait for PC key input
'Create a key input check routine to set InputKey() = True when a key is pressed
Do While 1
If InputKey() = True Then Exit Do
DoEvents
Loop
'After confirming key input, measure once, and read the measured value
Call Send(pad, gpibad, ":READ?", NLend)
Call Receive(pad, gpibad, buffer, STOPend)
recvstr = Left(buffer, InStr(1, buffer, Chr(10)) - 1)
Print #1, Str(i) & "," & recvstr
Next
Close #1
Call ibonl(pad, 0)
End Sub
'Receiving butter
'Receiving char string
'Controller access
'Device Address
'Timeout period
'State (unused)
'Board Address 0
'BT3562-01, BT3563-01 Address 1
'Timeout about 10s
'Initialize GP-IB
'Open a text file for saving
'Select internal triggering
'Continuous measurement OFF
'Send ":READ?" to measure and import the
measurement
'Receive
'Write to the file
HIOKI BT3562A960-05
8.8 Programmes d'échantillonnage
171
8