SW1002_user_manual_chi_20191017H.pdf - 第123页

119 󵤚󰾿󵪑󲪹 󱑅󵈾 BT3562 󴐶󸢁󱌼󸛉󵉐󸿗󼵼󱑅󵈾 DM7276 󸑴󷝥 OCV 󴐶󸢁 󱐕󱑇󸔒󸑃 COM 󵱯󱜢󸑷󳍺 SW1001 󰵹 BT3562, DM7276 󼵼󴬭󱝠󲘇 SLO T 1 󵒹 CH1  CH11 󸑴󷝥󱌼 󸛉󵉐󸿗󴐶󸢁󰵹 OCV 󵒹󳆋󳎾󴐶󸢁 Impor ts System.IO .P orts ' 󳆋󳎾󴐶�…

100%1 / 166
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
120
󵤚󰾿󵪑󲪹
'󲘝SLOT 1󷸄󰶺2󶑂󲮮󳍺󶑂
sp1.WriteLine (":SYST:MOD:WIRE:MODE 1,WIRE2")
sp1.WriteLine ("
*OPC?")
sp1.ReadLine ()
i = 0
For unit_no = 1 To 1
For ch_no = 12 To 22 '2
󶑂󲮮󵒹CH12󵕲󲰳󰸶4󶑂󲮮󵒹CH1 SENSE
'
󵈱󳃮󵈾󰸶󳉸󲕂󸔒󸖥󵒹󲒷󵳘󰶯
ch_str = Format (unit_no, "00") + Format (ch_no, "00")
'
󸽼󱝗 (CLOSE) 󳉸󲕂󵒹󸔒󸖥󲪈󵴞󲲊󳕽󰽳󲔥󳃮
sp1.WriteLine (":CLOS " + ch_str)
sp1.WriteLine ("
*OPC?")
sp1.ReadLine ()
'
󱝣DM7276󱜅󸓑󱙁󴂄󴐶󸢁󱠑󰻂󲪈󳍺󳙑󴐶󸢁󱃪
sp3.WriteLine (":READ?")
ocv_str (i) = sp3.ReadLine ()
i = i + 1
Next
Next
'
󳆋󳎾󶑖󳧳󰷔󱝠󼵼󲘝󳄿󳥤󶑪󵉐󱬽󷸄󰶺󲮔󸄠 (OPEN)
sp1.WriteLine (":OPEN")
'
󲘝SLOT 1󵒹CH1 CH11 󵒹󴐶󸢁󳚩󳌙󱍘󱌇󱑍󳛓󰻞󰶦
i = 0
For unit_no = 1 To 1
For ch_no = 1 To 11
ch_str = Format (unit_no, "00") + Format (ch_no, "00")
writer1.WriteLine (ch_str + "," + ir_str (i) + "," + ocv_str (i) )
i = i + 1
Next
Next
writer1.Close ()
sp1.Close ()
sp2.Close ()
sp3.Close ()
sp1.Dispose ()
sp2.Dispose ()
sp3.Dispose ()
End Sub
End Class