hpibdv.bas

来自「HP GPIB的VB和C语言库文件,参考范例.」· BAS 代码 · 共 52 行

BAS
52
字号

'  hpibdv.bas
Sub Main ()
   Dim dvm As Integer
   Dim sw As Integer
   Dim res As Double
   Dim i As Integer
   Dim argcount As Integer

   ' Open the multimete and switch sessions
   dvm = iopen("hpib7,9,3")
   sw = iopen("hpib7,9,14")
   Call itimeout(dvm, 10000)
   Call itimeout(sw, 10000)

   ' Set up trigger
   argcount = ivprintf(sw, "TRIG:SOUR BUS" + Chr$(10)) 

   ' Set up scan list
   argcount = ivprintf(sw, "SCAN (@100:103)" + Chr$(10)) 

   argcount = ivprintf(sw, "INIT" + Chr$(10)) 

   ' Display form1 and print voltage measurements
   form1.Show

   For i = 1 To 4
      ' Take a measurement
      argcount = ivprintf(dvm, "MEAS:VOLT:DC?" + Chr$(10)) 

      ' Read the results
      argcount = ivscanf(dvm, "%lf", res)

      ' Print the results
      form1.Print "Result is " + Format(res)

      ' Trigger to close channel
      argcount = ivprintf(sw, "TRIG" + Chr$(10)) 
   Next i

   ' Close the voltmeter session
   Call iclose(dvm)

   ' Close the switch session
   Call iclose(sw)

   ' Tell SICL to cleanup for this task
   Call siclcleanup

End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?