ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

VB6.0开发的计算机串口通讯程序1

2020-02-22 09:54:52  阅读:395  来源: 互联网

标签:VB 通讯 tx Caption 0.0 Label VB6.0 串口 Height


VB6.0开发的计算机串口通讯程序1 下面介绍几个使用VB6.0开发的计算机串口通讯程序,这些程序可以自动发送16进制字符,并接收这些字符。这些程序可以在链接:

  https://pan.baidu.com/s/1-SMLa3UwbxArwY3QRNtswg
提取码:hdze 下载微云文件分享:ⅤB串囗下载地址:   https://share.weiyun.com/5ok9T9o
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form mn_form
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
ClientHeight = 9795
ClientLeft = 45
ClientTop = 615
ClientWidth = 12735
FillColor = &H00E0E0E0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 9795
ScaleWidth = 12735
StartUpPosition = 2 '屏幕中心
WindowState = 2 'Maximized
Begin ComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 2
Top = 0
Width = 12735
_ExtentX = 22463
_ExtentY = 847
ButtonWidth = 714
ButtonHeight = 688
Appearance = 1
ImageList = "ImageList1"
_Version = 327682
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 8
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "校时"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "轮询"
Object.Tag = ""
ImageIndex = 2
Style = 1
EndProperty
BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "定值"
Object.Tag = ""
ImageIndex = 3

EndProperty
BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "设定"
Object.Tag = ""
ImageIndex = 4
EndProperty

BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "分闸"
Object.Tag = ""
ImageIndex = 5
EndProperty
BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "合闸"
Object.Tag = ""
ImageIndex = 6
EndProperty
BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "内存"
Object.Tag = ""
ImageIndex = 7
Style = 1
EndProperty
BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.Tag = ""
Style = 3
MixedState = -1 'True
EndProperty
EndProperty
OLEDropMode = 1
Begin VB.Frame Frame1
Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 375
Left = 9480
TabIndex = 3
Top = 0
Width = 5895
Begin VB.TextBox RAM_addr1th
Alignment = 2 'Center
Appearance = 0 'Flat
ForeColor = &H00800000&
Height = 375
Left = 2400
TabIndex = 9
Text = "0"
Top = 0
Width = 735
End
Begin VB.VScrollBar RAM_VScroll1
Height = 375
Left = 3120
Max = 1216

SmallChange = 32
TabIndex = 8
Top = 0
Width = 255
End
Begin VB.VScrollBar SN_VScroll
Height = 375
Left = 4440
Max = 199
TabIndex = 7
Top = 0
Value = 1
Width = 255

End
Begin VB.TextBox SN_Text
Alignment = 2 'Center
Appearance = 0 'Flat
ForeColor = &H00800000&
Height = 360
Left = 3960
TabIndex = 6
Text = "01"
Top = 0
Width = 495
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
BeginProperty Font
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 360
ItemData = "Star_M6.frx":0000
Left = 4920
List = "Star_M6.frx":000A
TabIndex = 4
Text = "COM1"
Top = 0
Width = 975
End
End
End
Begin VB.PictureBox disp_pic
BackColor = &H00161602&
ForeColor = &H0000FFFF&
Height = 5895
Left = 120
ScaleHeight = 5835
ScaleWidth = 10035
TabIndex = 10
Top = 3600
Width = 10095
End
Begin ComctlLib.StatusBar StatusBar1

Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 5
Top = 9540
Width = 12735
_ExtentX = 22463
_ExtentY = 450
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 2
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Alignment = 2
Object.Width = 1411
MinWidth = 1411
Object.Tag = ""
EndProperty
BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7}

Alignment = 2
Object.Width = 1411
MinWidth = 1411
Object.Tag = ""
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "System"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Timer T_05s00
Interval = 500
Left = 600
Top = 480
End
Begin MSCommLib.MSComm MSComm1
Left = 1080
Top = 480
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 2
DTREnable = 0 'False
InputLen = 1
RThreshold = 1
ParitySetting = 2
InputMode = 1
End
Begin VB.Label disp_area
BackColor = &H00161602&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700

Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 3015
Left = 120
TabIndex = 11
Top = 480
Width = 10095
End
Begin ComctlLib.ImageList ImageList1
Left = 0
Top = 480
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 20
ImageHeight = 20
MaskColor = 12632256
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 7
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":001A
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}

Picture = "Star_M6.frx":0334
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":064E
Key = ""
EndProperty
BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0968
Key = ""
EndProperty
BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0C82
Key = ""
EndProperty
BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0F9C
Key = ""
EndProperty
BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":12B6
Key = ""
EndProperty

EndProperty
End
Begin VB.Label rx_data
BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 1935
Left = 10320
TabIndex = 1
Top = 1560
Width = 5295
End
Begin VB.Label tx_data
BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 1068
Left = 10320
TabIndex = 0
Top = 480
Width = 5292
End
Begin VB.Menu mu_sys

Caption = "系统[&S] "
Begin VB.Menu sys_set
Caption = "设定"
End
Begin VB.Menu mu_quit
Caption = "退出"
End
End
Begin VB.Menu compt
Caption = "元件[&C] "
End
Begin VB.Menu AC_ch
Caption = "通道[&F] "
End
Begin VB.Menu op
Caption = "操作[&O] "
End
Begin VB.Menu help
Caption = "帮助[&H]"
End
End
Attribute VB_Name = "mn_form"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim V_1, V_1_real, V_1_Image, V_2, V_2_real, V_2_Image, V_1_m6, v_ric, tp00, tp01 As Single


Public num_rxright, num_sent, rx_CRC, T_pos


Sub Send(ByVal Cmd As Integer)

Dim k(0) As Byte
tx_data.Caption = ""
If Cmd = 4 Then T_pos = &H178: Cmd = 3 Else T_pos = RAM_VScroll1.Value
tx_b(3) = Array(SN_VScroll.Value, 3, T_pos \ 256, T_pos Mod 256, &H0, &H40, 0, 0, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0)
tx_b(Cmd)(0) = SN_VScroll.Value: tx_b(Cmd)(1) = Cmd
If Cmd = 16 Then Lenth = tx_b(Cmd)(5) * 2 + 7 Else Lenth = 6
Sum = &HFFFF
For i = 0 To Lenth - 1
If tx_b(Cmd)(i) < 0 Then tx_b(Cmd)(i) = 256 + tx_b(Cmd)(i)
k(0) = tx_b(Cmd)(i)
Sum = Sum Xor (k(0) And &HFF)
If Sum < 0 Then Sum = 65536 + Sum
For j = 0 To 7
If (Sum And 1) = 1 Then
Sum = Int(Sum \ 2): Sum = Sum Xor &HA001
If Sum < 0 Then Sum = 65536 + Sum
Else
Sum = Int(Sum \ 2)
End If
Next
MSComm1.Output = k: tx_data.Caption = tx_data.Caption + hexbyt(Int(k(0))) + " "
Next
If Sum < 0 Then Sum = 65536 + Sum
k(0) = (Sum Mod 256): tx_data.Caption = tx_data.Caption + hexbyt(Int(k(0))) + " "
MSComm1.Output = k
k(0) = (Sum \ 256): tx_data.Caption = tx_data.Caption + hexbyt(Int(k(0))) + " "
MSComm1.Output = k
rx_data = "": rx_CRC = &HFFFF
End Sub


Private Sub Combo1_Click()
p = Combo1.ListIndex + 1
If p > 0 And p < 3 Then Call Close_OpenPort(Int(p))
End Sub


Private Sub AC_ch_Click()
Factor_Seting.Visible = True

tx_REQ = 3
End Sub


Private Sub compt_Click()
Comptform.Visible = True
End Sub


Private Sub Form_Load()
Call Close_OpenPort(1)
Call MakeToolbarFlat(Toolbar1)
sys_set.Visible = True
For i = 0 To 8

tx_b(i) = Array(&H68, &H3, &H3, &H68, &H20, &H93, &H83, &H85, &H0, &H30 + Second(Time) Mod 10, &H0, &H30 + Second(Time) Mod 10, &H0, &H41 + Second(Time) Mod 10, &H0, &H61 + Second(Time) Mod 10, 0, 0, 0, 0, 1, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 1, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 1, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 1, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 1, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1)
Next
tx_REQ = 3: num_rxright = 0: num_sent = 0


End Sub


Private Sub Form_Unload(Cancel As Integer)
Unload controlform
Unload Comptform
Unload Factor_Seting
Unload Me
End Sub


Private Sub MSComm1_OnComm()
Dim temp As Variant


MSComm1.InputLen = 1


While MSComm1.InBufferCount <> 0
temp = MSComm1.Input
If rx_ptr < 150 Then
If rx_ptr = 3 Then rx_data.Caption = rx_data.Caption + vbCr
rx_b(rx_ptr) = temp(0): rx_data.Caption = rx_data.Caption + hexbyt(Int(temp(0))) + " "
rx_ptr = rx_ptr + 1
rx_CRC = rx_CRC Xor (temp(0) And &HFF)
If rx_CRC < 0 Then rx_CRC = 65536 + rx_CRC
For j = 0 To 7
If (rx_CRC And 1) = 1 Then
rx_CRC = Int(rx_CRC \ 2)
rx_CRC = rx_CRC Xor &HA001
If rx_CRC < 0 Then rx_CRC = 65536 + rx_CRC
Else
rx_CRC = Int(rx_CRC \ 2)
End If
Next
End If
Wend
End Sub


Private Sub op_Click()
controlform.Visible = True
End Sub


Private Sub RAM_VScroll1_Change()
RAM_addr1th.Text = strhex(RAM_VScroll1.Value)
End Sub


Private Sub SN_VScroll_Change()
SN_Text.Text = Str(SN_VScroll.Value) '站号调整与显示
End Sub


Private Sub sys_set_Click()
s_set.Visible = True
End Sub


Private Sub T_05s00_Timer()
mn_form.Caption = " X200测试 " + Format(Date, " yyyy-mm-dd ") + Format(Time, "hh:mm:ss ") '标题刷新


If rx_CRC = 0 Then

Call Process
num_rxright = (num_rxright + 1) Mod 10000 '显示接收正确次数
StatusBar1.Panels(2) = Str(num_rxright)
End If


Call Send(tx_REQ) '发送默认命令
If tx_REQ <> 3 Then tx_REQ = 3


num_sent = (num_sent + 1) Mod 10000
StatusBar1.Panels(1) = Str(num_sent) '显示召唤次数
rx_ptr = 0
End Sub


Sub Close_OpenPort(port As Byte)
On Error Resume Next ' 改变错误处理的方式。
Err.Clear
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False


MSComm1.CommPort = port
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True


If Err.Number <> 0 Then
msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox msg, , "Error", Err.HelpFile, Err.HelpContext
End If
End Sub


Public Sub Process()
If (T_pos < 410) Then
disp_area.Caption = ""
For i = 0 To 63
D_int(i) = b_i(rx_b(4 + i * 2), rx_b(3 + i * 2))
If D_int(i) >= 0 Then
disp_area.Caption = disp_area.Caption + Format(D_int(i), " 00000 ")
Else
disp_area.Caption = disp_area.Caption + "-" + Format(-D_int(i), "00000 ")
End If
If (i Mod 8) = 7 Then disp_area.Caption = disp_area.Caption + vbCr + " "
Next
sindraw (0)
End If
If T_pos = &H80 Then
'For i = 0 To 7
'Factor_Seting.AC_data(i).Caption = Format(b_i(rx_b(4 + i * 2), rx_b(3 + i * 2)) / 100, "0.00")
Factor_Seting.AC_data(1).Caption = Format(b_i(rx_b(8), rx_b(7)) / 100, "0.00")
Factor_Seting.AC_data(0).Caption = Format(b_i(rx_b(16), rx_b(15)) / 100, "0.00")
Factor_Seting.AC_data(3).Caption = Format(b_i(rx_b(24), rx_b(23)) / 100, "0.00")
Factor_Seting.AC_data(2).Caption = Format(b_i(rx_b(32), rx_b(31)) / 1000 * 38, "0.00")
Factor_Seting.AC_data(5).Caption = Format(b_i(rx_b(40), rx_b(39)) / 1000 * 38, "0.00")

Factor_Seting.AC_data(4).Caption = Format(b_i(rx_b(102), rx_b(101)) / 1000, "0.00")

Factor_Seting.AC_data(7).Caption = Format(b_i(rx_b(104), rx_b(103)) / 1000, "0.00")
'Factor_Seting.AC_data(7).Caption = Format(b_i(rx_b(6 + i * 2), rx_b(5 + i * 2)) / 100, "0.00")
'Next
End If
If T_pos = &H178 Then
For i = 0 To 7
If rx_b(3 + i) < 128 Then Factor_Seting.VScroll1(i).Value = -rx_b(3 + i) Else Factor_Seting.VScroll1(i).Value = 256 - rx_b(3 + i)
Next
End If
End Sub


Public Sub sindraw(ByVal ch As Integer)
disp_pic.Cls
xsc = (disp_pic.Width - 200) / 32: ysc = (disp_pic.Height - 200) / 1280: xax = disp_pic.Height / 2


disp_pic.Line (xsc, xax)-(disp_pic.Width - xsc, xax), RGB(128, 128, 128)
disp_pic.Line (xsc, 100)-(xsc, disp_pic.Height - 100), RGB(128, 128, 128)


If T_pos < &H60 Then
For i = 1 To 31
disp_pic.Line (i * xsc, D_int((i - 1) Mod 16) * ysc + xax)-((i + 1) * xsc, D_int(i Mod 16) * ysc + xax), RGB(250, ch * 50, 0)
disp_pic.Line (i * xsc, D_int((i - 1) Mod 16 + 16) * ysc + xax)-((i + 1) * xsc, D_int(i Mod 16 + 16) * ysc + xax), RGB(250, ch * 50, 200)
disp_pic.Line (i * xsc, D_int((i - 1) Mod 16 + 32) * ysc + xax)-((i + 1) * xsc, D_int(i Mod 16 + 32) * ysc + xax), RGB(210, 150, 220)
disp_pic.Line (i * xsc, D_int((i - 1) Mod 16 + 48) * ysc + xax)-((i + 1) * xsc, D_int(i Mod 16 + 48) * ysc + xax), RGB(150, ch * 50, 100)


Next
Else
For i = 1 To 31
disp_pic.Line (i * xsc, xax)-((i + 1) * xsc, xax), RGB(250, ch * 50, 0)
disp_pic.Line (i * xsc, 16 * ysc + xax)-((i + 1) * xsc, 16 * ysc + xax), RGB(250, ch * 50, 200)
disp_pic.Line (i * xsc, 32 * ysc + xax)-((i + 1) * xsc, 32 * ysc + xax), RGB(210, 150, 220)
disp_pic.Line (i * xsc, 48 * ysc + xax)-((i + 1) * xsc, 48 * ysc + xax), RGB(150, ch * 50, 100)
Next
End If
End Sub
VERSION 5.00
Begin VB.Form Comptform
Caption = "元件设定"

ClientHeight = 4005
ClientLeft = 60
ClientTop = 345
ClientWidth = 3330
LinkTopic = "Form1"
ScaleHeight = 4005

ScaleWidth = 3330
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo3
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
ItemData = "Compt.frx":0000
Left = 840
List = "Compt.frx":0031
TabIndex = 8
Text = "1"
Top = 600
Width = 2175
End
Begin VB.CommandButton Command2
Caption = "下装"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 7
Top = 3360
Width = 1575
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
DataField = "类型"
DataSource = "Data1"
BeginProperty Font
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 360
ItemData = "Compt.frx":0068
Left = 1440
List = "Compt.frx":0087
TabIndex = 6

Text = "跳闸"
Top = 2640
Width = 1575
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
BackColor = &H00FFFFFF&
DataField = "定值1"
DataSource = "Data1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700

Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 315
Index = 0
Left = 840
TabIndex = 5
Text = "1.0 "
Top = 1200
Width = 972
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
DataField = "定值1比例"
DataSource = "Data1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 315
Index = 0
Left = 2400
TabIndex = 4
Text = "200"
Top = 1200
Width = 615
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
DataField = "定值2比例"
DataSource = "Data1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False

Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 315
Index = 1
Left = 2400
TabIndex = 3
Text = "100"
Top = 1680
Width = 615
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
BackColor = &H00FFFFFF&
DataField = "定值2"
DataSource = "Data1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False

Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 315
Index = 1
Left = 840
TabIndex = 2
Text = "1.0 "
Top = 1680
Width = 972
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
DataField = "定值3比例"
DataSource = "Data1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 315
Index = 2
Left = 2400
TabIndex = 1
Text = "1"
Top = 2160
Width = 615
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
BackColor = &H00FFFFFF&
DataField = "定值3"
DataSource = "Data1"
BeginProperty Font

Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 315
Index = 2
Left = 840
TabIndex = 0
Text = "1.0 "
Top = 2160
Width = 972
End
Begin VB.Label Label2
Caption = "元 件"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 120
TabIndex = 12
Top = 720
Width = 855
End
Begin VB.Label Label2

Caption = "定 值"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 120
TabIndex = 11
Top = 1200
Width = 855
End
Begin VB.Label Label2
Caption = "时 限"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2

Left = 120
TabIndex = 10
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "参数1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 120
TabIndex = 9
Top = 2160
Width = 855
End
End
Attribute VB_Name = "Comptform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim hcd(32) As Byte


Private Sub Command2_Click()
If Combo1.ListIndex < 0 Then Combo1.ListIndex = 1
hcd(6) = &HFF: hcd(7) = &HFF: hcd(8) = &H66: hcd(9) = &H66
hcd(12) = &HFF: hcd(13) = &HFF: hcd(14) = &H12: hcd(15) = &H34
If Combo1.ListIndex = 1 Then
hcd(8) = &HA5: hcd(9) = &H5A
ElseIf Combo1.ListIndex = 2 Then
hcd(8) = &H5A: hcd(9) = &HA5
ElseIf Combo1.ListIndex = 4 Then
hcd(6) = &H0: hcd(7) = &H1
ElseIf Combo1.ListIndex = 5 Then

hcd(6) = &H0: hcd(7) = &H2
ElseIf Combo1.ListIndex = 6 Then
hcd(6) = &H0: hcd(7) = &H3
ElseIf Combo1.ListIndex = 7 Then
hcd(6) = &H0: hcd(7) = &H55
ElseIf Combo1.ListIndex = 8 Then
hcd(6) = &H0: hcd(7) = &HAA
End If
For i = 0 To 2
temp = Val(Text2(i).Text) * Val(Text3(i).Text)
hcd(i * 2) = temp \ 256: hcd(i * 2 + 1) = temp Mod 256 'para0-2
Next


hcd(10) = &H34: hcd(11) = &HDA
For i = 0 To 4
hcd(10) = hcd(10) Xor hcd(i * 2): hcd(11) = hcd(11) Xor hcd(i * 2 + 1)
Next
If Combo3.Text = 15 Then
i = (Combo3.Text + 1) * 8 + &H100
Else

i = (Combo3.Text - 1) * 8 + &H100
End If
tx_b(16) = Array(&H8, &H10, i \ 256, i Mod 256, 0, &H8, &H10, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)


For i = 7 To 7 + 32: tx_b(16)(i) = hcd(i - 7): Next
tx_REQ = 16
End Sub
VERSION 5.00
Begin VB.Form controlform
Caption = "操作"
ClientHeight = 1995
ClientLeft = 60
ClientTop = 345
ClientWidth = 5430
LinkTopic = "Form1"
ScaleHeight = 1995
ScaleWidth = 5430
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton J_ctrl
Caption = "校时"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 5
Left = 4200
TabIndex = 5
Top = 1320
Width = 735
End
Begin VB.CommandButton J_ctrl
Caption = "清除电度"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty

Height = 375
Index = 4
Left = 2160
TabIndex = 4
Top = 1320
Width = 1095
End
Begin VB.CommandButton J_ctrl
Caption = "复归"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False

Strikethrough = 0 'False
EndProperty
Height = 375
Index = 3
Left = 360
TabIndex = 3
Top = 1320
Width = 735
End
Begin VB.CommandButton J_ctrl
Caption = "停车"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 4200
TabIndex = 2
Top = 360
Width = 735
End
Begin VB.CommandButton J_ctrl
Caption = "启动B"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 2280
TabIndex = 1
Top = 360
Width = 735
End
Begin VB.CommandButton J_ctrl
Caption = "启动A"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 360
TabIndex = 0
Top = 360
Width = 735
End
End

Attribute VB_Name = "controlform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub J_ctrl_Click(Index As Integer)
If Index < 5 Then '继电器
tx_b(16) = Array(0, 0, &H0, &HD2, &H0, &H1, &H2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
tx_b(16)(7) = (Index + 1) * 17
tx_b(16)(8) = (Index + 1) * 17
' tx_b(16)(14 + 8) = 40
Else '校时
ts = d_BCD(Second(Time)): tm = d_BCD(Minute(Time)): th = d_BCD(Hour(Time))
dd = d_BCD(Day(Date)): dM = d_BCD(Month(Date)): dY = d_BCD(Year(Date) Mod 100)
tx_b(16) = Array(0, 0, &H0, &HD8, &H0, &H4, &H8, dY, dM, dd, th, tm, ts, &H12, &H34, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
End If
tx_REQ = 16 '0x10 命令
End Sub


VERSION 5.00
Begin VB.Form Factor_Seting
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 3 'Fixed Dialog
Caption = "通道校正系数"
ClientHeight = 2400
ClientLeft = 1980
ClientTop = 4365
ClientWidth = 11895
BeginProperty Font
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Factor_seting.frx":0000
ScaleHeight = 2400
ScaleWidth = 11895
Begin VB.CommandButton Command1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 9840
Picture = "Factor_seting.frx":0342

Style = 1 'Graphical

TabIndex = 1
Top = 600
Width = 375
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 7
Left = 5880
TabIndex = 42
Text = "0.0"
Top = 1200
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 6
Left = 5880
TabIndex = 41
Text = "0.0"
Top = 720
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 5
Left = 5880
TabIndex = 40
Text = "0.0"
Top = 240
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 4
Left = 1080
TabIndex = 39
Text = "0.0"
Top = 240
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 3
Left = 1080
TabIndex = 38
Text = "0.0"
Top = 720
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 2
Left = 1080
TabIndex = 37
Text = "0.0"
Top = 1200
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 1
Left = 1080
TabIndex = 36
Text = "0.0"

Top = 1680
Width = 735
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 7
Left = 5520
TabIndex = 35
Top = 1320
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 6
Left = 5520
TabIndex = 34
Top = 840
Width = 255
End

Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 5
Left = 5520
TabIndex = 33
Top = 360
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 4
Left = 720
TabIndex = 32
Top = 360
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 3
Left = 720
TabIndex = 31
Top = 840
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 255
Index = 2
Left = 720
TabIndex = 30
Top = 1320
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 1
Left = 720
TabIndex = 29
Top = 1800
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 0
Left = 5520
TabIndex = 28
Top = 1800
Width = 255

End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 0
Left = 5880
TabIndex = 27
Text = "0.0"
Top = 1680
Width = 735
End
Begin VB.CommandButton command3
Caption = "计算"
Height = 495
Left = 10080
TabIndex = 26
Top = 1560
Width = 855
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 7
Left = 9240
Max = 127
Min = -127
TabIndex = 25
Top = 1200
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 6
Left = 9240
Max = 127
Min = -127
TabIndex = 24
Top = 720
Width = 255
End

Begin VB.VScrollBar VScroll1
Height = 345
Index = 5
Left = 9240
Max = 127
Min = -127
TabIndex = 23
Top = 240
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 4
Left = 4440
Max = 127
Min = -127
TabIndex = 22
Top = 240
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 3
Left = 4440
Max = 127
Min = -127
TabIndex = 21
Top = 720
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 2
Left = 4440

Max = 127
Min = -127
TabIndex = 20
Top = 1200
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 1
Left = 4440
Max = 127
Min = -127
TabIndex = 19
Top = 1680
Width = 255
End
Begin VB.CommandButton Command2
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 10560
Picture = "Factor_seting.frx":0874
Style = 1 'Graphical
TabIndex = 2
Top = 600
Width = 375
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 0
Left = 9240
Max = 127
Min = -127
TabIndex = 0
Top = 1680
Width = 255
End
Begin VB.Label Label9
Caption = "Ua"
Height = 255
Left = 360
TabIndex = 58
Top = 360
Width = 405
End

Begin VB.Label Label13
Caption = "Ipa"
Height = 255
Left = 5160
TabIndex = 57
Top = 360
Width = 405
End
Begin VB.Label Label12
Caption = "Ub"
Height = 255
Left = 360
TabIndex = 56
Top = 840
Width = 405
End
Begin VB.Label Label11
Caption = "Ia"

Height = 255
Left = 360
TabIndex = 55
Top = 1800
Width = 405
End
Begin VB.Label Label10
Caption = "Ipb"
Height = 255
Left = 5160
TabIndex = 54
Top = 840
Width = 405
End
Begin VB.Label Label8
Caption = "Uc"
Height = 255
Left = 360
TabIndex = 53
Top = 1320
Width = 405
End
Begin VB.Label Label7
Caption = "Ic"
Height = 255
Left = 5160
TabIndex = 52
Top = 1800
Width = 405
End
Begin VB.Label Label4
Caption = "Ipc"
Height = 255
Left = 5160
TabIndex = 51
Top = 1320
Width = 405
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 7
Left = 7800
TabIndex = 50
Top = 1200
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 6
Left = 7800
TabIndex = 49
Top = 720
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 5
Left = 7800
TabIndex = 48
Top = 240
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center

BackColor = &H80000005&

Caption = "0.0"
Height = 330
Index = 4
Left = 3000
TabIndex = 47
Top = 240
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 3
Left = 3000
TabIndex = 46
Top = 720
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 2
Left = 3000
TabIndex = 45
Top = 1200
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 1
Left = 3000
TabIndex = 44
Top = 1680
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 0
Left = 7800
TabIndex = 43
Top = 1680
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 7
Left = 8640
TabIndex = 18
Top = 1200
Width = 615
End
Begin VB.Label Factor_label

Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 6
Left = 8640
TabIndex = 17
Top = 720
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat

BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 5
Left = 8640
TabIndex = 16
Top = 240
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 4
Left = 3840
TabIndex = 15
Top = 240
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 3
Left = 3840
TabIndex = 14
Top = 720
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&

Height = 330
Index = 2
Left = 3840
TabIndex = 13
Top = 1200
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 1
Left = 3840
TabIndex = 12
Top = 1680
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 0
Left = 8640

TabIndex = 11
Top = 1680
Width = 615
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 7
Left = 6720
TabIndex = 10
Top = 1200
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 6
Left = 6720
TabIndex = 9
Top = 720
Width = 855
End
Begin VB.Label AC_data

Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 5
Left = 6720
TabIndex = 8
Top = 240
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 4
Left = 1920
TabIndex = 7
Top = 240
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 3
Left = 1920
TabIndex = 6
Top = 720
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&

BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 2
Left = 1920
TabIndex = 5
Top = 1200
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&

Height = 315
Index = 1
Left = 1920
TabIndex = 4
Top = 1680
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 0
Left = 6720
TabIndex = 3
Top = 1680
Width = 855
End
End
Attribute VB_Name = "Factor_Seting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub Command1_Click(Index As Integer)
Dim i, x As Single
tx_b(4) = Array(&HF0, 3, &H4, &HC0, &H0, &H40, 0, 0, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0)
tx_REQ = 4
End Sub


Private Sub Command2_Click(Index As Integer)
Dim i, sumL, sumH As Integer
tx_b(4) = Array(&H68, 28, 28, &H68, &H40, 0, 4, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
sumL = 0
sumH = 0
For i = 0 To 7
tx_b(4)(i + 8) = -VScroll1(Index * 8 + i).Value
If i Mod 2 = 0 Then
sumL = sumL Xor tx_b(4)(i + 8)
Else
sumH = sumH Xor tx_b(4)(i + 8)
End If
Next
tx_b(4)(20) = 0 'ID
tx_b(4)(21) = &HFF
sumL = sumL Xor tx_b(4)(20)
sumH = sumH Xor tx_b(4)(21)
tx_b(4)(22) = 0
tx_b(4)(23) = &H9A 'switch

sumL = sumL Xor tx_b(4)(22)
sumH = sumH Xor tx_b(4)(23)
tx_b(4)(24) = 255 - Abs(tx_b(4)(8)) 'para1 bk
tx_b(4)(25) = 255 - Abs(tx_b(4)(9))
tx_b(4)(26) = sumL Xor tx_b(4)(24)
tx_b(4)(27) = sumH Xor tx_b(4)(25)
tx_REQ = 4

End Sub


Private Sub Command3_Click()
Dim i As Integer
For i = 0 To 7
If Check0(i).Value = 1 Then
Label2(i).Caption = Format(((Text0(i).Text - AC_data(i).Caption) / AC_data(i).Caption * 100), "0.0")
VScroll1(i).Value = -Label2(i).Caption * 10 + VScroll1(i).Value
End If
Next i
Command2_Click (0)
End Sub


Private Sub Command4_Click()
Factor_Seting.Hide
End Sub


Private Sub Form_Load()
Dim i As Integer, keyName As String


For i = 0 To 7
keyName = "Text0(" & i & ")" & ".Text"
Text0(i).Text = GetSetting(App.Title, Me.Name, keyName, "0.00") '读取设置
Next i


tx_b(3) = Array(&H68, 4, 4, &H68, &H40, 0, 3, 11, 7, 7)
' End If
tx_REQ = 3


End Sub


Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer, keyName As String


For i = 0 To 7
keyName = "Text0(" & i & ")" & ".Text"
Call SaveSetting(App.Title, Me.Name, keyName, Me.Text0(i).Text) '存储设置
Next i
End Sub


Private Sub VScroll1_Change(Index As Integer)
Factor_label(Index).Caption = Format(-VScroll1(Index).Value / 10, " 0.0")
End Sub


'3号命令-上传系数定值 group10-12
Private Sub VScroll2_Change(Index As Integer)
Dim x As Single


x = VScroll2(Index).Value: x = x / 10: Text0(Index).Text = Format(x, "#0.0 ")


End Sub
VERSION 5.00
Begin VB.Form Factor_Seting
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 3 'Fixed Dialog
Caption = "通道校正系数"
ClientHeight = 3270
ClientLeft = 1980
ClientTop = 4365
ClientWidth = 11895
BeginProperty Font
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False

Picture = "Factor_seting_bk.frx":0000
ScaleHeight = 3270
ScaleWidth = 11895

Begin VB.VScrollBar VScroll1
Height = 345
Index = 15
Left = 2160
Max = 256
Min = -127
TabIndex = 66
Top = 5160
Value = 256
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 14
Left = 1920
Max = 256
Min = -127
TabIndex = 1
Top = 5160
Value = 87
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 13
Left = 1680
Max = 256
Min = -127
TabIndex = 65
Top = 5160
Value = 256
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 12
Left = 1440
Max = 127
Min = -127
TabIndex = 64
Top = 5160
Value = 1
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 11
Left = 1200
Max = 127
Min = -127
TabIndex = 63
Top = 5160
Value = 1
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 10
Left = 960
Max = 127
Min = -127
TabIndex = 62
Top = 5160
Value = 1
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 9
Left = 720
Max = 127
Min = -127

TabIndex = 61
Top = 5160
Value = 1
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 8
Left = 480
Max = 127
Min = -127
TabIndex = 60
Top = 5160
Value = 1

Width = 255
End
Begin VB.CommandButton Command1
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 9840
Picture = "Factor_seting_bk.frx":0342
Style = 1 'Graphical
TabIndex = 2
Top = 1200
Width = 375
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 7
Left = 5880
TabIndex = 43
Text = "0.0"
Top = 2640
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 6
Left = 960
TabIndex = 42
Text = "0.0"
Top = 4080
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 5
Left = 5880
TabIndex = 41
Text = "0.0"
Top = 1440
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 4
Left = 5880

TabIndex = 40
Text = "0.0"
Top = 2040
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 3
Left = 1080
TabIndex = 39
Text = "0.0"
Top = 2040
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 2
Left = 5880
TabIndex = 38
Text = "0.0"
Top = 840
Width = 735
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 1
Left = 1080

TabIndex = 37
Text = "0.0"
Top = 840
Width = 735
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 7
Left = 5520
TabIndex = 36
Top = 2760
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 6
Left = 600
TabIndex = 35
Top = 4200
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 5
Left = 5520
TabIndex = 34
Top = 1560
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 4
Left = 5520
TabIndex = 33
Top = 2160
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"

Height = 225
Index = 3
Left = 720
TabIndex = 32
Top = 2160
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 255
Index = 2
Left = 5520
TabIndex = 31
Top = 960
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 1
Left = 720
TabIndex = 30
Top = 960
Width = 255
End
Begin VB.CheckBox Check0
Caption = "Check1"
Height = 225
Index = 0
Left = 720
TabIndex = 29
Top = 1560
Width = 255
End
Begin VB.TextBox Text0
Alignment = 2 'Center
Height = 360
Index = 0
Left = 1080
TabIndex = 28
Text = "0.0"
Top = 1440
Width = 735
End
Begin VB.CommandButton command3
Caption = "计算"
Height = 495
Left = 10080
TabIndex = 27

Top = 2160
Width = 855
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 7
Left = 9240
Max = 127
Min = -127
TabIndex = 26
Top = 2640
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 6
Left = 4320
Max = 127
Min = -127
TabIndex = 25
Top = 4080
Width = 255
End
Begin VB.VScrollBar VScroll1

Height = 345
Index = 5
Left = 9240
Max = 127
Min = -127
TabIndex = 24
Top = 1440
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 4
Left = 9240
Max = 127
Min = -127
TabIndex = 23
Top = 2040
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 3
Left = 4440
Max = 127
Min = -127
TabIndex = 22
Top = 2040
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 2
Left = 9240
Max = 127
Min = -127
TabIndex = 21
Top = 840
Width = 255
End
Begin VB.VScrollBar VScroll1
Height = 345
Index = 1
Left = 4440
Max = 127
Min = -127
TabIndex = 20
Top = 840
Width = 255
End
Begin VB.CommandButton Command2
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 10560
Picture = "Factor_seting_bk.frx":0874

Style = 1 'Graphical
TabIndex = 3
Top = 1200
Width = 375
End
Begin VB.VScrollBar VScroll1
Height = 345

Index = 0
Left = 4440
Max = 127
Min = -127
TabIndex = 0
Top = 1440
Width = 255
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "校正系数"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 7
Left = 8640
TabIndex = 74
Top = 360
Width = 975
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "推荐系数"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 6
Left = 7680
TabIndex = 73
Top = 360
Width = 855
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "实测值"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 5
Left = 6720
TabIndex = 72
Top = 360

Width = 735
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "标准值"

BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 4
Left = 5880
TabIndex = 71
Top = 360
Width = 735
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "校正系数"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 3
Left = 3840
TabIndex = 70
Top = 360
Width = 975
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "推荐系数"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 2880
TabIndex = 69
Top = 360
Width = 855
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "实测值"

BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 1920
TabIndex = 68
Top = 360
Width = 735
End
Begin VB.Label Label1

Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "标准值"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 1080
TabIndex = 67
Top = 360
Width = 735
End
Begin VB.Label Label9
Caption = "Ib"
Height = 255
Left = 360
TabIndex = 59
Top = 1560
Width = 405
End
Begin VB.Label Label13
Caption = "Ia"
Height = 255
Left = 360
TabIndex = 58
Top = 960
Width = 405
End
Begin VB.Label Label12
Caption = "Uab"
Height = 255
Left = 5040
TabIndex = 57
Top = 960
Width = 405
End
Begin VB.Label Label11
Caption = "U0"
Height = 255
Left = 240
TabIndex = 56
Top = 4200
Width = 405
End
Begin VB.Label Label10
Caption = "Ic"
Height = 255

Left = 360
TabIndex = 55
Top = 2160
Width = 405
End
Begin VB.Label Label8
Caption = "Ija"
Height = 255
Left = 5040
TabIndex = 54
Top = 2160
Width = 405
End
Begin VB.Label Label7
Caption = "Ijc"
Height = 255
Left = 5040
TabIndex = 53
Top = 2760
Width = 405
End
Begin VB.Label Label4
Caption = "Ubc"
Height = 255
Left = 5040
TabIndex = 52
Top = 1560
Width = 405
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 7

Left = 7800
TabIndex = 51
Top = 2640
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 6
Left = 2880
TabIndex = 50
Top = 4080
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 5
Left = 7800
TabIndex = 49
Top = 1440
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 4
Left = 7800
TabIndex = 48
Top = 2040
Width = 615
End

Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 3
Left = 3000
TabIndex = 47
Top = 2040
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 2
Left = 7800
TabIndex = 46
Top = 840
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 1
Left = 3000
TabIndex = 45
Top = 840
Width = 615
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H80000005&
Caption = "0.0"
Height = 330
Index = 0
Left = 3000
TabIndex = 44
Top = 1440
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&

BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 7
Left = 8640
TabIndex = 19
Top = 2640
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 6

Left = 3720
TabIndex = 18
Top = 4080
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 5
Left = 8640
TabIndex = 17
Top = 1440
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 4
Left = 8640
TabIndex = 16
Top = 2040
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 3
Left = 3840
TabIndex = 15
Top = 2040
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 2
Left = 8640
TabIndex = 14

Top = 840
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat

BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 1
Left = 3840
TabIndex = 13
Top = 840
Width = 615
End
Begin VB.Label Factor_label
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "0.0 "
ForeColor = &H00800000&
Height = 330
Index = 0
Left = 3840
TabIndex = 12
Top = 1440
Width = 615
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 7
Left = 6720
TabIndex = 11
Top = 2640
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 6
Left = 1800
TabIndex = 10
Top = 4080
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 5
Left = 6720

TabIndex = 9
Top = 1440
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single

Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 4
Left = 6720
TabIndex = 8
Top = 2040
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 3
Left = 1920
TabIndex = 7
Top = 2040
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 2
Left = 6720
TabIndex = 6
Top = 840
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 1
Left = 1920
TabIndex = 5
Top = 840
Width = 855
End
Begin VB.Label AC_data
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00404000&

BorderStyle = 1 'Fixed Single
Caption = "000.00 "
ForeColor = &H0000FFFF&
Height = 315
Index = 0
Left = 1920
TabIndex = 4
Top = 1440
Width = 855
End
End
Attribute VB_Name = "Factor_Seting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim hcd(32) As Integer
Option Explicit


Private Sub Command1_Click(Index As Integer)
tx_b(4) = Array(&HF0, 3, &H1, &H78, &H0, &H40, 0, 0, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0)
tx_REQ = 4
End Sub

Private Sub Command2_Click(Index As Integer)
Dim i, sumH, sumL As Integer
tx_b(16) = Array(&H8, &H10, &H1, &H78, 0, &H8, &H10, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
For i = 0 To 7
hcd(i) = -VScroll1(i).Value
Next
hcd(10) = &H34: hcd(11) = &HDA
For i = 0 To 4
hcd(10) = hcd(10) Xor hcd(i * 2): hcd(11) = hcd(11) Xor hcd(i * 2 + 1)
Next
hcd(12) = &HFF: hcd(13) = &HFF: hcd(14) = &H12: hcd(15) = &H34
For i = 7 To 7 + 32: tx_b(16)(i) = hcd(i - 7): Next
tx_REQ = 16
End Sub


Private Sub Command3_Click()
Dim i As Integer
For i = 0 To 7
If Check0(i).Value = 1 And AC_data(i).Caption <> 0 Then
Label2(i).Caption = Format(((Text0(i).Text - AC_data(i).Caption) / AC_data(i).Caption * 100), "0.0")
' If Abs(Val(Label2(i).Caption)) < 12 Then VScroll1(i).Value = -Val(Label2(i).Caption) * 10 + VScroll1(i).Value
End If
Next i
End Sub


Private Sub VScroll1_Change(Index As Integer)
Factor_label(Index).Caption = Format(-VScroll1(Index).Value / 10, " 0.0")
End Sub
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"

Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form mn_form
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
ClientHeight = 9795
ClientLeft = 45
ClientTop = 615
ClientWidth = 12735
FillColor = &H00E0E0E0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 9795
ScaleWidth = 12735
StartUpPosition = 2 '屏幕中心
WindowState = 2 'Maximized
Begin ComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 2

Top = 0
Width = 12735
_ExtentX = 22463
_ExtentY = 847
ButtonWidth = 714
ButtonHeight = 688
Appearance = 1
ImageList = "ImageList1"
_Version = 327682
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 8
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "校时"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "轮询"
Object.Tag = ""
ImageIndex = 2
Style = 1
EndProperty
BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "定值"
Object.Tag = ""
ImageIndex = 3
EndProperty
BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7}

Object.ToolTipText = "设定"
Object.Tag = ""
ImageIndex = 4
EndProperty
BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "分闸"
Object.Tag = ""
ImageIndex = 5
EndProperty
BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "合闸"
Object.Tag = ""
ImageIndex = 6
EndProperty
BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.ToolTipText = "内存"
Object.Tag = ""
ImageIndex = 7
Style = 1
EndProperty
BeginProperty Button8 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.Tag = ""
Style = 3
MixedState = -1 'True
EndProperty
EndProperty
OLEDropMode = 1
Begin VB.Frame Frame1

Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 375
Left = 9480
TabIndex = 3
Top = 0
Width = 5895
Begin VB.TextBox RAM_addr1th
Alignment = 2 'Center
Appearance = 0 'Flat
ForeColor = &H00800000&
Height = 375
Left = 2400
TabIndex = 9
Text = "0"
Top = 0
Width = 735
End
Begin VB.VScrollBar RAM_VScroll1
Height = 375
Left = 3120
Max = 1216
SmallChange = 32
TabIndex = 8
Top = 0

Width = 255
End
Begin VB.VScrollBar SN_VScroll
Height = 375
Left = 4440
Max = 199
TabIndex = 7
Top = 0
Value = 1
Width = 255
End
Begin VB.TextBox SN_Text
Alignment = 2 'Center
Appearance = 0 'Flat
ForeColor = &H00800000&
Height = 360
Left = 3960
TabIndex = 6
Text = "01"
Top = 0
Width = 495
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
BeginProperty Font
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 360
ItemData = "Star_M6.frx":0000
Left = 4920

List = "Star_M6.frx":000A
TabIndex = 4
Text = "COM1"
Top = 0
Width = 975
End
End
End
Begin VB.PictureBox disp_pic
BackColor = &H00161602&
ForeColor = &H0000FFFF&
Height = 5895
Left = 120
ScaleHeight = 5835
ScaleWidth = 10035
TabIndex = 10
Top = 3600
Width = 10095
End
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 255
Left = 0

TabIndex = 5
Top = 9540
Width = 12735
_ExtentX = 22463
_ExtentY = 450
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 2
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Alignment = 2
Object.Width = 1411
MinWidth = 1411
Object.Tag = ""
EndProperty
BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Alignment = 2
Object.Width = 1411
MinWidth = 1411
Object.Tag = ""
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "System"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Timer T_05s00
Interval = 500
Left = 600
Top = 480
End
Begin MSCommLib.MSComm MSComm1
Left = 1080
Top = 480
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 2
DTREnable = 0 'False
InputLen = 1
RThreshold = 1
ParitySetting = 2
InputMode = 1
End

Begin VB.Label disp_area
BackColor = &H00161602&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False

Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 3015
Left = 120
TabIndex = 11
Top = 480
Width = 10095
End
Begin ComctlLib.ImageList ImageList1
Left = 0
Top = 480
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 20
ImageHeight = 20
MaskColor = 12632256
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 7
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":001A
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0334
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":064E
Key = ""
EndProperty
BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0968
Key = ""
EndProperty
BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0C82
Key = ""
EndProperty
BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":0F9C
Key = ""
EndProperty
BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "Star_M6.frx":12B6

Key = ""
EndProperty
EndProperty
End
Begin VB.Label rx_data

BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 1935
Left = 10320
TabIndex = 1
Top = 1560
Width = 5295
End
Begin VB.Label tx_data
BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 1068
Left = 10320
TabIndex = 0
Top = 480
Width = 5292
End
Begin VB.Menu mu_sys
Caption = "系统[&S] "
Begin VB.Menu sys_set
Caption = "设定"
End
Begin VB.Menu mu_quit
Caption = "退出"
End
End
Begin VB.Menu compt
Caption = "元件[&C] "
End
Begin VB.Menu AC_ch
Caption = "通道[&F] "
End
Begin VB.Menu op
Caption = "操作[&O] "
End
Begin VB.Menu help
Caption = "帮助[&H]"
End
End
Attribute VB_Name = "mn_form"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim V_1, V_1_real, V_1_Image, V_2, V_2_real, V_2_Image, V_1_m6, v_ric, tp00, tp01 As Single


Public num_rxright, num_sent, rx_CRC, T_pos


Sub Send(ByVal Cmd As Integer)
Dim k(0) As Byte
tx_data.Caption = ""

If Cmd = 4 Then T_pos = &H178: Cmd = 3 Else T_pos = RAM_VScroll1.Value

tx_b(3) = Array(SN_VScroll.Value, 3, T_pos \ 256, T_pos Mod 256, &H0, &H40, 0, 0, Hour(Time), Minute(Time), Second(Time), 0, 0, 0, 0)
tx_b(Cmd)(0) = SN_VScroll.Value: tx_b(Cmd)(1) = Cmd
If Cmd = 16 Then Lenth = tx_b(Cmd)(5) * 2 + 7 Else Lenth = 6
Sum = &HFFFF
For i = 0 To Lenth - 1
If tx_b(Cmd)(i) < 0 Then tx_b(Cmd)(i) = 256 + tx_b(Cmd)(i)
k(0) = tx_b(Cmd)(i)
Sum = Sum Xor (k(0) And &HFF)
If Sum < 0 Then Sum = 65536 + Sum
For j = 0 To 7
If (Sum And 1) = 1 Then
Sum = Int(Sum \ 2): Sum = Sum Xor &HA001
If Sum < 0 Then Sum = 65536 + Sum
Else
Sum = Int(Sum \ 2)
End If
Next
MSComm1.Output = k: tx_data.Caption = tx_data.Caption + hexbyt(Int(k(0))) + " "
Next
If Sum < 0 Then Sum = 65536 + Sum
k(0) = (Sum Mod 256): tx_data.Caption = tx_data.Caption + hexbyt(Int(k(0))) + " "
MSComm1.Output = k
k(0) = (Sum \ 256): tx_data.Caption = tx_data.Caption + hexbyt(Int(k(0))) + " "
MSComm1.Output = k
rx_data = "": rx_CRC = &HFFFF
End Sub


Private Sub Combo1_Click()
p = Combo1.ListIndex + 1
If p > 0 And p < 3 Then Call Close_OpenPort(Int(p))
End Sub

 

标签:VB,通讯,tx,Caption,0.0,Label,VB6.0,串口,Height
来源: https://www.cnblogs.com/zgdcnyhl/p/12344247.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有