?? 燈的測(cè)試.frm
字號(hào):
TabIndex = 20
Top = 600
Width = 600
End
Begin VB.CommandButton Command7
Caption = "全綠"
Height = 400
Left = 2520
TabIndex = 19
Top = 600
Width = 600
End
Begin VB.CommandButton Command9
Caption = "全亮"
Height = 400
Left = 3360
TabIndex = 18
Top = 600
Width = 600
End
Begin VB.CommandButton Command10
Caption = "全滅"
Height = 400
Left = 4200
TabIndex = 17
Top = 600
Width = 600
End
Begin VB.Label Label1
Caption = "A"
Height = 375
Index = 0
Left = 240
TabIndex = 77
Top = 1200
Width = 375
End
Begin VB.Label Label1
Caption = "B"
Height = 375
Index = 2
Left = 240
TabIndex = 76
Top = 1800
Width = 375
End
Begin VB.Label Label1
Caption = "C"
Height = 375
Index = 3
Left = 240
TabIndex = 75
Top = 2400
Width = 375
End
Begin VB.Label Label1
Caption = "D"
Height = 375
Index = 4
Left = 240
TabIndex = 74
Top = 3000
Width = 375
End
Begin VB.Label Label1
Caption = "E"
Height = 375
Index = 5
Left = 240
TabIndex = 73
Top = 3600
Width = 375
End
Begin VB.Label Label1
Caption = "F"
Height = 375
Index = 6
Left = 240
TabIndex = 72
Top = 4200
Width = 375
End
Begin VB.Label Label1
Caption = "G"
Height = 375
Index = 7
Left = 240
TabIndex = 71
Top = 4800
Width = 375
End
Begin VB.Label Label1
Caption = "H"
Height = 375
Index = 8
Left = 240
TabIndex = 70
Top = 5400
Width = 375
End
End
Begin VB.CommandButton Command6
Caption = "雙色燈直觀測(cè)試"
Height = 375
Left = 3600
TabIndex = 15
Top = 6240
Width = 1695
End
Begin VB.CommandButton Command4
Caption = "三色燈直觀測(cè)試"
Height = 375
Left = 3600
TabIndex = 14
Top = 5520
Width = 1695
End
Begin VB.TextBox Text1
Height = 270
Index = 0
Left = 1440
MaxLength = 15
TabIndex = 8
Top = 2520
Width = 1935
End
Begin VB.CommandButton Command5
Caption = "發(fā)送"
Default = -1 'True
Height = 375
Left = 3840
TabIndex = 7
Top = 2520
Width = 855
End
Begin VB.TextBox Text4
Height = 270
Left = 960
MaxLength = 4
TabIndex = 6
Top = 720
Width = 615
End
Begin VB.CommandButton Command2
Caption = "初始化"
Height = 375
Left = 4080
TabIndex = 5
Top = 840
Width = 855
End
Begin VB.CommandButton Command11
Caption = "廣播命令"
Height = 375
Left = 4920
TabIndex = 4
Top = 2520
Width = 975
End
Begin VB.TextBox Text2
Height = 270
Left = 1200
MaxLength = 4
TabIndex = 3
Top = 4200
Width = 615
End
Begin VB.TextBox Text6
Height = 270
Left = 3240
MaxLength = 4
TabIndex = 2
Top = 4200
Width = 615
End
Begin VB.CommandButton Command12
Caption = "修改地址"
Height = 375
Left = 4200
TabIndex = 1
Top = 4080
Width = 975
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "燈的測(cè)試.frx":4494
Left = 2760
List = "燈的測(cè)試.frx":44A7
TabIndex = 0
Text = "19200"
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "發(fā)送數(shù)據(jù):"
Height = 255
Index = 1
Left = 360
TabIndex = 13
Top = 2520
Width = 1095
End
Begin VB.Label Label8
Caption = "地址:"
Height = 255
Left = 360
TabIndex = 12
Top = 840
Width = 615
End
Begin VB.Label Label9
Caption = "數(shù)據(jù):"
Height = 375
Left = 2040
TabIndex = 11
Top = 840
Width = 735
End
Begin VB.Label Label2
Caption = "原地址:"
Height = 255
Left = 360
TabIndex = 10
Top = 4200
Width = 855
End
Begin VB.Label Label6
Caption = "新地址:"
Height = 255
Left = 2400
TabIndex = 9
Top = 4200
Width = 975
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public inttime As Integer '發(fā)送時(shí)間間隔
Public strset As String
Dim myarray(12) As String
Public intport As Integer '串行口號(hào)
Private Sub Command1_Click()
If Text4.Text = "" Then '判斷地址是否為四位
MsgBox ("請(qǐng)輸入芯片的地址")
Else
Dim n3 As Integer
Dim i As Integer, s3 As String, s2 As String, s1 As String
Dim myarray1(8) As String
'將8位數(shù)據(jù)和4位地址的ASC碼累加并取其后兩位
For i = 1 To 8
myarray1(i) = "1" '1是代表紅
s2 = s2 + myarray1(i)
n3 = n3 + Asc(myarray1(i))
Dim j As Integer
For j = 1 To 39
Option1(j).Value = False
Next
Next
For i = 1 To 4
n3 = n3 + Asc(Mid(Trim(Text4.Text), i, 1))
Next
n3 = n3 + Asc("$")
s3 = Right(Hex(n3), 2)
'發(fā)送數(shù)據(jù)
If Not Form1.MSComm1.PortOpen Then
MsgBox ("請(qǐng)先選擇串口后,再執(zhí)行此操作")
Else
s1 = Text4.Text
Form1.MSComm1.Output = "UU$" + s1 + s2 + s3
End If
End If
Text3.Text = "UU$" + s1 + s2 + s3 + Chr$(13) + Chr$(10) + Text3.Text
End Sub
Private Sub Command10_Click()
If Text4.Text = "" Then
MsgBox ("請(qǐng)輸入芯片的地址")
Else
Dim n3 As Integer
Dim i As Integer, s3 As String, s2 As String, s1 As String
Dim myarray1(8) As String
For i = 1 To 8
myarray1(i) = "0"
s2 = s2 + myarray1(i)
n3 = n3 + Asc(myarray1(i))
Dim j As Integer
For j = 1 To 39
Option1(j).Value = False
Next
Next
For i = 1 To 4
n3 = n3 + Asc(Mid(Trim(Text4.Text), i, 1))
Next
n3 = n3 + Asc("$")
s3 = Right(Hex(n3), 2)
If Not Form1.MSComm1.PortOpen Then
MsgBox ("請(qǐng)先選擇串口后,再執(zhí)行此操作")
Else
s1 = Text4.Text
Form1.MSComm1.Output = "UU$" + s1 + s2 + s3
End If
End If
Text3.Text = "UU$" + s1 + s2 + s3 + Chr$(13) + Chr$(10) + Text3.Text
End Sub
Private Sub Command11_Click()
If Not Form1.MSComm1.PortOpen Then
MsgBox ("請(qǐng)先選擇串口后,再執(zhí)行此操作")
Else
Form1.MSComm1.Output = "UUg13333d" ' 向串口發(fā)送廣播命令
End If
End Sub
Private Sub Command12_Click()
If Len(Trim(Text2.Text)) < 4 Then '判斷舊地址的位數(shù)是否為四位,如果不是高位補(bǔ)0,
m1 = 4 - Len(Trim(Text2.Text))
Dim d As Integer, sss As String
For d = 1 To m1
sss = sss + "0"
Next
Text2.Text = sss + Trim(Text2.Text)
End If
If Len(Trim(Text6.Text)) < 4 Then '判斷新地址的位數(shù)是否為四位,如果不是高位補(bǔ)0
m1 = 4 - Len(Trim(Text6.Text))
sss = ""
For d = 1 To m1
sss = sss + "0"
Next
Text6.Text = sss + Trim(Text6.Text)
End If
Dim n1 As Integer, n2 As Integer
Dim i As Integer, s As String
Dim myarray() As String
'將舊地址和新地址都讀取到myarray()數(shù)組中,并且將每位數(shù)據(jù)的ASC碼值累加到n2中
ReDim myarray(8)
For i = 1 To 4
myarray(i) = Mid(Trim(Text2.Text), i, 1)
n2 = n2 + Asc(myarray(i))
Next
For i = 5 To 8
myarray(i) = Mid(Trim(Text6.Text), i - 4, 1)
n2 = n2 + Asc(myarray(i))
Next
'累加兩個(gè)%的ASC碼值并取其低位字節(jié)
n2 = n2 + Asc("%")
n2 = n2 + Asc("%")
s = Right(Hex(n2), 2)
'發(fā)送
If Not Form1.MSComm1.PortOpen Then
MsgBox ("請(qǐng)先選擇串口后,再執(zhí)行此操作")
Else
Form1.MSComm1.Output = "UU%" + Text2.Text + Text6.Text + "%" + s
End If
Text4.Text = Text6.Text
End Sub
Private Sub Command13_Click()
Frame1.Visible = False
Frame10.Visible = False
Frame23.Visible = True
End Sub
Private Sub Command14_Click()
If Text4.Text = "" Then
MsgBox ("請(qǐng)輸入芯片的地址")
Else
Dim n3 As Integer
Dim i As Integer, s3 As String, s2 As String, s1 As String
Dim myarray1(6) As String
'將8位數(shù)據(jù)和4位地址的ASC碼累加并取其后兩位
For i = 1 To 6
myarray1(i) = "A"
s2 = s2 + myarray1(i)
n3 = n3 + Asc(myarray1(i))
Dim j As Integer
For j = 1 To 47
Option2(j).Value = False
Next
Next
For i = 1 To 4
n3 = n3 + Asc(Mid(Trim(Text4.Text), i, 1))
Next
n3 = n3 + Asc("$")
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -