form1.frm
来自「CQUPT 毕业设计。 题目是usb数据采集系统的应用程序」· FRM 代码 · 共 149 行
FRM
149 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer1
Interval = 1
Left = 2880
Top = 360
End
Begin VB.CommandButton Command4
Caption = "写端点2"
Height = 375
Left = 3600
TabIndex = 4
Top = 2400
Width = 855
End
Begin VB.CommandButton Command3
Caption = "读端点2"
Height = 375
Left = 2520
TabIndex = 3
Top = 2400
Width = 855
End
Begin VB.CommandButton Command2
Caption = "写端点1"
Height = 375
Left = 1320
TabIndex = 2
Top = 2400
Width = 855
End
Begin VB.TextBox text1
Height = 495
Left = 600
TabIndex = 1
Text = "Text1"
Top = 1080
Width = 975
End
Begin VB.CommandButton Command1
Caption = "读端点1"
Height = 375
Left = 120
TabIndex = 0
Top = 2400
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cancel_Click()
End Sub
Private Sub FileOpen_Click()
End Sub
Private Sub Command1_Click()
Dim com(6) As Byte
com(0) = 1
com(1) = 2
com(2) = 3
com(3) = 4
com(4) = 5
com(5) = 6
Dim st As Integer
st = ReadPort1(com(0), 6)
End Sub
Private Sub Command2_Click()
Dim com(6) As Byte
com(0) = 1
com(1) = 3
com(2) = 5
com(3) = 7
com(4) = 5
com(5) = 9
Dim st As Integer
st = WritePort1(com(0), 6)
If st <> 0 Then
MsgBox ("写端点一失败!")
End If
End Sub
Private Sub Command3_Click()
Dim com(0) As Byte
Dim x As Single
Dim st As Integer
st = ReadPort2(com(0), 1)
x = com(0) * 19.88 / 1000
text1.Text = x
If st <> 0 Then
com(0) = 0
End If
End Sub
Private Sub Command4_Click()
Dim qq(64) As Byte
qq(0) = 9
qq(1) = 29
qq(2) = 99
qq(3) = 40
qq(4) = 78
qq(5) = 19
Dim tt As Integer
tt = WritePort2(qq(0), 64)
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
End Sub
Private Sub Timer1_Timer()
Dim com(0) As Byte
Dim x As Single
Dim st As Integer
st = ReadPort2(com(0), 1)
x = com(0) * 19.88 / 1000
text1.Text = x
If st <> 0 Then
com(0) = 0
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?