?? sy10-01.frm
字號:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8175
ClientLeft = 60
ClientTop = 375
ClientWidth = 11400
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 545
ScaleLeft = 5
ScaleMode = 0 'User
ScaleWidth = 760
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command7
Caption = "打開串口"
Height = 495
Left = 1320
TabIndex = 15
Top = 7440
Width = 1215
End
Begin MSCommLib.MSComm MSComm1
Left = 360
Top = 0
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 2
DTREnable = -1 'True
RThreshold = 2
BaudRate = 2400
InputMode = 1
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9600
TabIndex = 14
Top = 7320
Width = 1335
End
Begin VB.Frame Frame4
Caption = "頻率(KHz)"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 9480
TabIndex = 13
Top = 7080
Width = 1575
End
Begin VB.OptionButton Option3
Caption = "脈沖波信號"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9600
TabIndex = 11
Top = 5880
Width = 1215
End
Begin VB.OptionButton Option2
Caption = "三角波信號"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9600
TabIndex = 10
Top = 5520
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "正弦波信號"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9600
TabIndex = 9
Top = 5160
Width = 1215
End
Begin VB.Frame Frame3
Caption = "波形信號選擇"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1935
Left = 9480
TabIndex = 8
Top = 4920
Width = 1575
End
Begin VB.CommandButton Command6
Caption = "-"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9720
TabIndex = 7
Top = 3960
Width = 1095
End
Begin VB.CommandButton Command5
Caption = "+"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9720
TabIndex = 6
Top = 3360
Width = 1095
End
Begin VB.Frame Frame2
Caption = "振幅調整"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1695
Left = 9480
TabIndex = 5
Top = 3000
Width = 1575
End
Begin VB.CommandButton Command4
Caption = "-"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9720
TabIndex = 4
Top = 1800
Width = 1095
End
Begin VB.Frame Frame1
Caption = "周期調整"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1815
Left = 9480
TabIndex = 2
Top = 720
Width = 1575
Begin VB.CommandButton Command3
Caption = "+"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 3
Top = 360
Width = 1095
End
End
Begin VB.CommandButton Command1
Caption = "退出"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3960
TabIndex = 1
Top = 7440
Width = 1215
End
Begin VB.PictureBox Graph1
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 6165
Left = 360
Picture = "sy10-01.frx":0000
ScaleHeight = 6105
ScaleWidth = 8475
TabIndex = 0
Top = 840
Width = 8535
End
Begin VB.Label Label4
Caption = "Design by huayun TEC 0595-22905399"
Height = 495
Left = 11520
TabIndex = 18
Top = 9480
Width = 2295
End
Begin VB.Label Label3
Height = 255
Left = 6000
TabIndex = 17
Top = 7560
Width = 1455
End
Begin VB.Label Label2
Height = 375
Left = 7560
TabIndex = 16
Top = 7560
Width = 2775
End
Begin VB.Image Image1
Height = 1500
Left = 11520
Picture = "sy10-01.frx":15CF
Top = 7800
Width = 3000
End
Begin VB.Label Label1
Caption = "黎明職業大學機電工程系"
BeginProperty Font
Name = "仿宋_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3000
TabIndex = 12
Top = 240
Width = 3855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a As Single '振幅
Dim pi As Single
Dim f As Single
Dim t As Single
Dim d As Single '每格的uS數
Dim j As Integer '波形信號選擇
Dim outbyte(0 To 2) As Byte
Dim outbyte3(1 To 1) As Byte
Dim inbyte() As Byte
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
disp
End Sub
Private Sub Command3_Click()
d = d + 10
Label2.Caption = ""
End Sub
Private Sub Command4_Click()
If (d - 10) = 0 Then
Label2.Caption = "調整過限制"
d = 10
Else
d = d - 10
Label2.Caption = ""
End If
End Sub
Private Sub Command5_Click()
If a >= 20 Then
Exit Sub
Else
a = a + 0.5
End If
disp
End Sub
Private Sub Command6_Click()
If a <= 0 Then
Else
a = a - 0.5
End If
disp
End Sub
Private Sub Command7_Click()
If Command7.Caption = "打開串口" Then
Command7.Caption = "關閉串口"
On Error GoTo lp
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
Else
Command7.Caption = "打開串口"
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
End If
Exit Sub
lp: MsgBox ("端口無效,重新選擇端口!")
Exit Sub
End Sub
Private Sub Form_Load()
j = 1
b = 1
d = 50
pi = 3.14
a = 10
Cls
Graph1.Scale (-12.56, 20)-(12.56, -20) ' 定義坐標系
End Sub
Private Sub MSComm1_OnComm()
Dim p As Integer
Select Case MSComm1.CommEvent
Case comEvReceive
inbyte = MSComm1.Input
For p = LBound(inbyte) To UBound(inbyte)
If p = 0 Then
h8 = inbyte(p)
Else
l8 = inbyte(p)
End If
Next p
t = (h8 * 256 + l8) / 16000
f = 1 / t
Text1.Text = Format(f, "###.###")
Graph1.Scale (-(7 * d / 1000), 20)-((7 * d / 1000), -20) ' 定義坐標系
Label3.Caption = d / 2 & "uS/div"
disp
End Select
End Sub
Private Sub Option1_Click()
j = 1
End Sub
Private Sub Option2_Click()
j = 2
End Sub
Private Sub Option3_Click()
j = 3
End Sub
Private Sub Option4_Click()
j = 4
End Sub
Public Sub disp()
Graph1.Cls
Graph1.CurrentX = -(7 * d / 1000): Graph1.CurrentY = 0 ' 設置起點坐標
Dim i As Single
Dim b As Integer
Select Case j
Case 1
For i = -(7 * d / 1000) To (7 * d / 1000) Step 0.001
x = i: y = a * Sin(2 * pi * f * i) ' 設置下一點坐標
Graph1.Line -(x, y), RGB(255, 255, 255) ' 從當前點畫到下一點
Next i
Case 2
b = (4 * 7 * d / 1000) / t
Graph1.CurrentX = -(7 * d / 1000): Graph1.CurrentY = a ' 設置起點坐標
For i = 0 To b Step 1
Graph1.Line -(((-(7 * d / 1000) + i * t + t / 2)), -a), RGB(255, 255, 255)
Graph1.Line -(((-(7 * d / 1000) + i * t + t)), a), RGB(255, 255, 255)
Next i
Case 3
b = (4 * 7 * d / 1000) / t
Graph1.CurrentX = -(7 * d / 1000): Graph1.CurrentY = a ' 設置起點坐標
For i = 1 To b Step 1
Graph1.Line -(((-(7 * d / 1000) + i * t / 2)), a * (-1) ^ (i - 1)), RGB(255, 255, 255)
Graph1.Line -(((-(7 * d / 1000) + i * t / 2)), a * (-1) ^ i), RGB(255, 255, 255)
Graph1.Line -(((-(7 * d / 1000) + (i + 1) * t / 2)), a * (-1) ^ i), RGB(255, 255, 255)
Graph1.Line -(((-(7 * d / 1000) + (i + 1) * t / 2)), a * (-1) ^ (i - 1)), RGB(255, 255, 255)
Next i
End Select
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -