📄 dkcs.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "调试"
ClientHeight = 4605
ClientLeft = 1140
ClientTop = 3225
ClientWidth = 8745
LinkTopic = "Form1"
ScaleHeight = 4605
ScaleWidth = 8745
Begin VB.TextBox Text11
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2760
TabIndex = 30
Top = 3240
Width = 3975
End
Begin VB.TextBox Text6
BackColor = &H00E0E0E0&
Height = 270
Left = 1440
TabIndex = 29
Top = 2880
Width = 5415
End
Begin VB.TextBox Text2
BackColor = &H00FFFFC0&
Height = 270
Left = 1440
TabIndex = 28
Top = 2520
Width = 5415
End
Begin VB.Timer Timer1
Interval = 200
Left = 6960
Top = 960
End
Begin VB.ComboBox Combo4
Height = 300
ItemData = "DKCS.frx":0000
Left = 1440
List = "DKCS.frx":000A
TabIndex = 25
Text = "正序"
Top = 2040
Width = 2055
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "DKCS.frx":001A
Left = 1440
List = "DKCS.frx":002D
TabIndex = 24
Text = "com1"
Top = 600
Width = 1935
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "DKCS.frx":004F
Left = 5160
List = "DKCS.frx":0059
TabIndex = 23
Text = "首位"
Top = 1680
Width = 1695
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "DKCS.frx":0069
Left = 5160
List = "DKCS.frx":0073
TabIndex = 22
Text = "ASCII"
Top = 2040
Width = 1695
End
Begin VB.TextBox Text10
Height = 270
Left = 5160
TabIndex = 21
Text = "7"
Top = 1320
Width = 1695
End
Begin VB.TextBox Text9
Height = 270
Left = 5160
TabIndex = 17
Text = "8"
Top = 960
Width = 1695
End
Begin VB.TextBox Text8
Height = 270
Left = 5160
TabIndex = 15
Text = "1200,n,7,1"
Top = 600
Width = 1695
End
Begin VB.TextBox Text7
Height = 270
Left = 5160
TabIndex = 13
Text = "长治维特"
Top = 240
Width = 1695
End
Begin VB.TextBox Text5
Height = 270
Left = 1440
TabIndex = 11
Text = "61"
Top = 1680
Width = 1935
End
Begin VB.TextBox Text4
Height = 270
Left = 1440
TabIndex = 10
Text = "1"
Top = 1320
Width = 1935
End
Begin VB.TextBox Text3
Height = 270
Left = 1440
TabIndex = 5
Text = "200"
Top = 960
Width = 1935
End
Begin VB.CommandButton Command2
Caption = "停止测试"
Height = 375
Left = 1320
TabIndex = 2
Top = 3480
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "开始测试"
Height = 375
Left = 240
TabIndex = 1
Top = 3480
Width = 975
End
Begin VB.TextBox Text1
Height = 270
Left = 1440
TabIndex = 0
Text = "1"
Top = 240
Width = 1935
End
Begin MSCommLib.MSComm MSComm1
Left = 6960
Top = 240
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 3
DTREnable = -1 'True
InBufferSize = 2048
BaudRate = 1200
DataBits = 7
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "测试数据:"
Height = 180
Left = 240
TabIndex = 27
Top = 3000
Width = 900
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "原始数据:"
Height = 180
Left = 240
TabIndex = 26
Top = 2640
Width = 900
End
Begin VB.Label Label12
Caption = "输出格试:"
Height = 255
Left = 3720
TabIndex = 20
Top = 2040
Width = 1095
End
Begin VB.Label Label11
Caption = "首/末位读数:"
Height = 255
Left = 3720
TabIndex = 19
Top = 1680
Width = 1095
End
Begin VB.Label Label10
Caption = "读数长度:"
Height = 255
Left = 3720
TabIndex = 18
Top = 1320
Width = 855
End
Begin VB.Label Label9
Caption = "数据长度:"
Height = 255
Left = 3720
TabIndex = 16
Top = 960
Width = 975
End
Begin VB.Label Label8
Caption = "串行口参数:"
Height = 255
Left = 3720
TabIndex = 14
Top = 600
Width = 1095
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "类型名称:"
Height = 180
Left = 3720
TabIndex = 12
Top = 240
Width = 900
End
Begin VB.Label Label6
Caption = "正/反序读数"
Height = 255
Left = 240
TabIndex = 9
Top = 2040
Width = 1215
End
Begin VB.Label Label5
Caption = "标志位"
Height = 255
Left = 240
TabIndex = 8
Top = 1680
Width = 855
End
Begin VB.Label Label4
Caption = "读数起始位:"
Height = 180
Left = 240
TabIndex = 7
Top = 1320
Width = 1500
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "时钟参数:"
Height = 180
Left = 240
TabIndex = 6
Top = 960
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "串口编号:"
Height = 180
Left = 240
TabIndex = 4
Top = 600
Width = 900
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "类型编号:"
Height = 255
Left = 240
TabIndex = 3
Top = 240
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public DK As Boolean
Private Sub Command1_Click()
Timer1.Interval = Text3.Text
MSComm1.Settings = Text8.Text ''''串行口参数:
MSComm1.CommPort = Val(Right(Combo3.Text, 1)) ''串口编号
MSComm1.PortOpen = True
DK = True
Command1.Enabled = False
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
MSComm1.PortOpen = False
DK = False
Command1.Enabled = True
Command2.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Interval = Text3.Text
If MSComm1.PortOpen = False Then
Command2.Enabled = False
Else
Command1.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
If DK = True Then
Text2.Text = MSComm1.Input
a = Chr(Text5.Text)
a = InStr(1, Text2.Text, Chr(Text5.Text)) + 1
If a > 0 Then
b = Mid(Text2.Text, a, Val(Text10.Text))
Text6.Text = b
If Combo4.Text = "反序" Then
For i = Len(b) To 1 Step -1
c = c + Mid(b, i, 1)
Next i
Text6.Text = c
End If
End If
End If
Text11.Text = Val(Text6.Text)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -