SW1002_user_manual_chi_20191017H.pdf - 第122页

118 󵤚󰾿󵪑󲪹 ' 󳆋󳎾󶑖󳧳󰷔󱝠󼵼󲘝󳄿󳥤󶑪󵉐󱬽󷸄󰶺󲮔󸄠 (OPEN) sp1.WriteLine (":OPEN") writer1.Close () sp1.Close () sp2.Close () sp1.Dispose () sp2.Dispose () End Sub End Class

100%1 / 166
117
󵤚󰾿󵪑󲪹
󰾫󵈾DM7276 󸑴󷝥󳆋󳎾󴐶󸢁
󱐕󱑇󸔒󸑃
COM󵱯󱜢󸑷󳍺 SW1001󰵹DM7276󼵼󴬭󱝠󲘇SLOT 1󵒹CH1 CH22󸑴󷝥󳆋󳎾󴐶󸢁
󰶺USB󳞟󼵼󰷳󱜴󰻅󸑴󷝥󰵹RS-232C 󵕲󱝛󵒹󸔒󷷵󸔒󸑃󷸄󱾋󲚪󲶎󵟂󷷪󸑷󳍺USB 󵒹 COM󶒙󱝀󼵼󰾫󵈾
󷸫COM󶒙󱝀󱙱󱜴󸑴󷝥󸔒󷷵󱜦󱾫󼵼USB 󳞟󵒹󸔒󷷵󸔠󲫟󴌶󳥤󲼒󰷑
Imports System.IO.Ports
'
󳆋󳎾󴐶󸢁󸡸󳭌
Public Class Form1
Private Sub Button1_Click (sender As Object, e As EventArgs) Handles Button1.Click
Dim sp1 As SerialPort
Dim sp2 As SerialPort
Dim writer1 As IO.StreamWriter
Dim unit_no As Integer
Dim ch_no As Integer
Dim ch_str As String
Dim recv_str As String
'
󸔒󸑃COM3󸑷󳍺SW1001
sp1 = New System.IO.Ports.SerialPort ("COM3", 9600, Parity.None, 8, StopBits.One)
sp1.NewLine = vbCrLf : sp1.ReadTimeout = 1000
'
󸔒󸑃COM4󸑷󳍺DM7276
sp2 = New System.IO.Ports.SerialPort ("COM4", 9600, Parity.None, 8, StopBits.One)
sp2.NewLine = vbCrLf : sp2.ReadTimeout = 1000
sp1.Open ()
sp2.Open ()
sp1.DiscardInBuffer ()
sp2.DiscardInBuffer ()
'
󳅨󲮔󷦴󱁃󲒹󵒹󳛓󰻞
writer1 = New IO.StreamWriter (Application.StartupPath + "\data.csv")
'
󲘝SLOT 1󷸄󰶺2󶑂󲮮󳍺󶑂
sp1.WriteLine (":SYST:MOD:WIRE:MODE 1,WIRE2")
sp1.WriteLine ("
*OPC?")
sp1.ReadLine ()
For unit_no = 1 To 1
For ch_no = 1 To 22
'
󵈱󳃮󵈾󰸶󳉸󲕂󸔒󸖥󵒹󲒷󵳘󰶯
ch_str = Format (unit_no, "00") + Format (ch_no, "00")
'
󸽼󱝗 (CLOSE) 󳉸󲕂󵒹󸔒󸖥󲪈󵴞󲲊󳕽󰽳󲔥󳃮
sp1.WriteLine (":CLOS " + ch_str)
sp1.WriteLine ("
*OPC?")
sp1.ReadLine ()
'
󱝣DM7276󱜅󸓑󱙁󴂄󴐶󸢁󱠑󰻂󲪈󳍺󳙑󴐶󸢁󱃪
sp2.WriteLine (":READ?")
recv_str = sp2.ReadLine ()
'
󲘝󴐶󸢁󳚩󳌙󱍘󱌇󱑍󳛓󰻞󰶦
writer1.WriteLine (ch_str + "," + recv_str)
Next
Next
8
118
󵤚󰾿󵪑󲪹
'󳆋󳎾󶑖󳧳󰷔󱝠󼵼󲘝󳄿󳥤󶑪󵉐󱬽󷸄󰶺󲮔󸄠 (OPEN)
sp1.WriteLine (":OPEN")
writer1.Close ()
sp1.Close ()
sp2.Close ()
sp1.Dispose ()
sp2.Dispose ()
End Sub
End Class
119
󵤚󰾿󵪑󲪹
󱑅󵈾BT3562 󴐶󸢁󱌼󸛉󵉐󸿗󼵼󱑅󵈾 DM7276󸑴󷝥OCV 󴐶󸢁
󱐕󱑇󸔒󸑃
COM󵱯󱜢󸑷󳍺 SW1001󰵹BT3562, DM7276󼵼󴬭󱝠󲘇SLOT 1󵒹CH1 CH11󸑴󷝥󱌼
󸛉󵉐󸿗󴐶󸢁󰵹OCV 󵒹󳆋󳎾󴐶󸢁
Imports System.IO.Ports
'
󳆋󳎾󴐶󸢁󸡸󳭌
Public Class Form1
Private Sub Button1_Click (sender As Object, e As EventArgs) Handles Button1.Click
Dim sp1 As SerialPort
Dim sp2 As SerialPort
Dim sp3 As SerialPort
Dim writer1 As IO.StreamWriter
Dim unit_no As Integer
Dim ch_no As Integer
Dim ch_str As String
Dim ir_str (50) As String
Dim ocv_str (50) As String
Dim i As Integer
'
󸔒󸑃COM3󸑷󳍺SW1001
sp1 = New System.IO.Ports.SerialPort ("COM3", 9600, Parity.None, 8, StopBits.One)
sp1.NewLine = vbCrLf : sp1.ReadTimeout = 1000
'
󸔒󸑃COM4󸑷󳍺BT3562
sp2 = New System.IO.Ports.SerialPort ("COM4", 9600, Parity.None, 8, StopBits.One)
sp2.NewLine = vbCrLf : sp2.ReadTimeout = 1000
'
󸔒󸑃COM5󸑷󳍺DM7276
sp3 = New System.IO.Ports.SerialPort ("COM5", 9600, Parity.None, 8, StopBits.One)
sp3.NewLine = vbCrLf : sp2.ReadTimeout = 1000
sp1.Open ()
sp2.Open ()
sp3.Open ()
sp1.DiscardInBuffer ()
sp2.DiscardInBuffer ()
sp3.DiscardInBuffer ()
'
󳅨󲮔󷦴󱁃󲒹󵒹󳛓󰻞
writer1 = New IO.StreamWriter (Application.StartupPath + "\data.csv")
'
󲘝SLOT 1󷸄󰶺4󶑂󲮮󳍺󶑂
sp1.WriteLine (":SYST:MOD:WIRE:MODE 1,WIRE4")
sp1.WriteLine ("
*OPC?")
sp1.ReadLine ()
'
󲘝BT3562󵒹󸑷󶑰󴐶󸢁󷸄󰶺OFF
sp2.WriteLine (":INIT:CONT OFF")
i = 0
For unit_no = 1 To 1
For ch_no = 1 To 11
'
󵈱󳃮󵈾󰸶󳉸󲕂󸔒󸖥󵒹󲒷󵳘󰶯
ch_str = Format (unit_no, "00") + Format (ch_no, "00")
'
󸽼󱝗 (CLOSE) 󳉸󲕂󵒹󸔒󸖥󲪈󵴞󲲊󳕽󰽳󲔥󳃮
sp1.WriteLine (":CLOS " + ch_str)
sp1.WriteLine ("
*OPC?")
sp1.ReadLine ()
'
󱝣BT3562󱜅󸓑󱙁󴂄󴐶󸢁󱠑󰻂󲪈󳍺󳙑󴐶󸢁󱃪
sp2.WriteLine (":READ?")
ir_str (i) = sp2.ReadLine ()
i = i + 1
Next
Next
8