
9.9 Sample Programs
155
9
GP-IB Communications
(Using National Instruments GP-IB Board)
Simple Resistance Measurement
Imports measured values 10 times, and saves measurements in a text file.
Private Sub MeasureSub()
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 = T10s
'Timeout about 10s
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
For i = 1 To 10
Call Send(pad, gpibad, ":FETCH?", NLend)
'Send ":FETCH?" to import the most recent mea-
surement
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
Содержание RM3542
Страница 2: ......
Страница 6: ...Contents iv ...
Страница 16: ...Operating Precautions 10 ...
Страница 26: ...1 3 Screen Organization 20 ...
Страница 32: ...2 3 Turning the Power On and Off 26 ...
Страница 46: ...3 8 Confirming Faulty Measurements 40 ...
Страница 64: ...4 12 Compensating for Thermal EMF Offset Offset Voltage Compensation OVC 58 ...
Страница 84: ...6 4 Auto Exporting Measured Values at End of Measurement Data Output Function 78 ...
Страница 90: ...7 3 Printing 84 ...
Страница 172: ...9 10 Device Compliance Statement 166 ...
Страница 190: ...11 4 Disposing of the Instrument 184 ...
Страница 200: ...Appendix 5 Dimensional Diagram A10 Appendix 5 Dimensional Diagram ...
Страница 214: ...Index Index 4 ...
Страница 215: ......
Страница 216: ......
Страница 217: ......
Страница 218: ......