⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbaud.frm

📁 51单片机波特率计算工具运用VB 60设计包括完整的vb源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Baud Rate Calculator"
   ClientHeight    =   3525
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3510
   Icon            =   "Frmbaud.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3525
   ScaleWidth      =   3510
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "EXIT"
      Height          =   315
      Left            =   1725
      TabIndex        =   10
      Top             =   2745
      Width           =   1005
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Calculate"
      Height          =   315
      Left            =   480
      TabIndex        =   9
      Top             =   2760
      Width           =   960
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1155
      Style           =   2  'Dropdown List
      TabIndex        =   7
      Top             =   1815
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   390
      Left            =   1170
      TabIndex        =   5
      Top             =   1260
      Width           =   1695
   End
   Begin VB.OptionButton Option1 
      Caption         =   "SMOD =0"
      Height          =   270
      Index           =   1
      Left            =   2220
      TabIndex        =   3
      Top             =   900
      Width           =   945
   End
   Begin VB.OptionButton Option1 
      Caption         =   "SMOD =1"
      Height          =   255
      Index           =   0
      Left            =   1110
      TabIndex        =   2
      Top             =   885
      Width           =   975
   End
   Begin VB.TextBox Text1 
      BeginProperty DataFormat 
         Type            =   0
         Format          =   "0"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   1033
         SubFormatType   =   0
      EndProperty
      Height          =   390
      Left            =   1200
      TabIndex        =   1
      Top             =   315
      Width           =   1695
   End
   Begin VB.Label Label6 
      Height          =   330
      Left            =   75
      TabIndex        =   12
      Top             =   3180
      Width           =   3405
   End
   Begin VB.Label Label5 
      Height          =   315
      Left            =   1245
      TabIndex        =   11
      Top             =   2325
      Width           =   1605
   End
   Begin VB.Label Label4 
      Caption         =   "Timer Value:"
      Height          =   255
      Left            =   0
      TabIndex        =   8
      Top             =   2355
      Width           =   1170
   End
   Begin VB.Label Label3 
      Caption         =   "Work Mode"
      Height          =   210
      Left            =   60
      TabIndex        =   6
      Top             =   1905
      Width           =   1020
   End
   Begin VB.Label Label2 
      Caption         =   "Baud rate"
      Height          =   240
      Left            =   75
      TabIndex        =   4
      Top             =   1320
      Width           =   930
   End
   Begin VB.Label Label1 
      Caption         =   "Fosc(kHz)"
      Height          =   255
      Left            =   105
      TabIndex        =   0
      Top             =   405
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim fosc
Dim baud
Dim Temp1 As Integer
Dim Temp2 As Single
Dim hexbyte
Dim WorkMode As Integer


Dim TimerValue As Integer


If Text1.Text <> "" And Text2.Text <> "" Then
fosc = Val(Text1.Text)
baud = Val(Text2.Text)
WorkMode = Combo1.ListIndex

If WorkMode = 1 Or WorkMode = 3 Then

         If Option1(0).Value = True Then

          Temp2 = (fosc * 1000) / (baud * 192)
          Temp1 = 256 - CInt(Temp2)

        Else
          Temp2 = (fosc * 1000) / (384 * baud)
          Temp1 = 256 - CInt(Temp2)
       End If
Else
          Temp1 = 0
End If

Else
MsgBox Label1.Caption & " And " & Label2.Caption & " can not empty!!!", vbInformation, "Info......"
Exit Sub
End If
Label5.Caption = "0x" & Hex(Temp1)

End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Combo1.AddItem "Mode 0", 0
Combo1.AddItem "Mode 1", 1
Combo1.AddItem "Mode 2", 2
Combo1.AddItem "Mode 3", 3

Combo1.ListIndex = 1
Option1(0).Value = True
Text1.Text = "12000"
Text2.Text = "9600"
Label6.Caption = "Supported by: Andy liu 2008-7-3"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -