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

📄 frmmain.frm

📁 本系统利用串口和TC35来实现短信息的收发功能.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   5880
      TabIndex        =   17
      Top             =   5280
      Width           =   2670
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "THE COMMUNICATION TESTING PROGRAM OF TC35 FOR THE SMS"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000C0&
      Height          =   195
      Left            =   2040
      TabIndex        =   16
      Top             =   480
      Width           =   5505
   End
   Begin VB.Label Label6 
      Caption         =   "Label6"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3480
      TabIndex        =   14
      Top             =   5280
      Width           =   1815
   End
   Begin VB.Label Label5 
      Caption         =   "Label5"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1200
      TabIndex        =   13
      Top             =   5280
      Width           =   5895
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "Label4"
      Height          =   195
      Left            =   480
      TabIndex        =   12
      Top             =   600
      Width           =   480
   End
   Begin VB.Image Image1 
      Height          =   495
      Left            =   240
      Picture         =   "frmmain.frx":0937
      Stretch         =   -1  'True
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "SIMENS-TC35模块SMS测试程序"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   360
      Left            =   2280
      TabIndex        =   0
      Top             =   120
      Width           =   4995
   End
   Begin VB.Label Label7 
      Caption         =   "状态:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   15
      Top             =   5280
      Width           =   2535
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00FFC0C0&
      BackStyle       =   1  'Opaque
      Height          =   495
      Left            =   240
      Top             =   5160
      Width           =   8535
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim RECV_NUM As Integer
Dim KKK1, KKK2 As String
Dim FLAG As Integer
Private Sub Combo1_Click()
    If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
    If Combo1.Text = "" Then
        MSComm1.CommPort = 1
        KKK1 = "COM1"
    Else
        MSComm1.CommPort = Val(Mid(Combo1.Text, 4, 1))
        KKK1 = Combo1.Text
    End If
    If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
      
    KKK2 = "9600,n,8,1"
    
    Label5.Caption = KKK1
    Label6.Caption = KKK2
    
    
End Sub

Private Sub Combo2_Click()
    If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
    If Combo1.Text = "" Then
        MSComm1.Settings = "9600,n,8,1"
        KKK2 = "9600,n,8,1"
    Else
        MSComm1.Settings = Combo2.Text & ",n,8,1"
        KKK2 = Combo2.Text & ",n,8,1"
    End If
    If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
    Label5.Caption = KKK1
    Label6.Caption = KKK2
End Sub

Private Sub Command1_Click()
    Unload Me
End Sub

Private Sub Command10_Click()
    Text2.Text = "AT+CSMP=17,167,0,245"
End Sub

Private Sub Command11_Click()
    Text2.Text = "AT+CMGS=13910417095"
    
End Sub

Private Sub Command12_Click()
    Text2.Text = "AT+IPR=9600"
End Sub

Private Sub Command2_Click()
    Text1.Text = ""
    Frame3.Tag = 0
End Sub




Private Sub Command3_Click()
    Dim iLen As Integer
    Dim strData As String
    Dim i As Integer
    Dim temp As String
    Dim jj As Integer
    Dim KK As String
    
    Frame3.Tag = Val(Frame3.Tag) + 1
    Text1.Text = Text1.Text + Chr(13) + Chr(10) + Frame3.Tag + ")==========" + Text2.Text + Chr(13) + Chr(10)
    
    strData = Text2.Text
    iLen = Len(strData)
    
    For i = 1 To iLen
   
            temp = Mid(strData, i, 1)
            MSComm1.Output = temp
     
                
    Next i
    
    If FLAG = 1 Then MSComm1.Output = Chr(13)
    If FLAG = 2 Then MSComm1.Output = Chr(26)
        
    
End Sub


Private Sub Command4_Click()
    Text2.Text = "ATI"
End Sub

Private Sub Command5_Click()
    Text2.Text = "ATH"
End Sub

Private Sub Command6_Click()
    Text2.Text = "AT+CPIN?"
End Sub

Private Sub Command7_Click()
    Text2.Text = "AT+CSCA = +8613800100500"
End Sub

Private Sub Command8_Click()
    Text2.Text = "AT+CMGF=1"
End Sub

Private Sub Command9_Click()
    Text2.Text = "AT+CSMS=1"
End Sub

Private Sub Form_Load()
    Text1.Text = ""
    Text2.Text = ""

    Label4.Caption = Date
    
    RECV_NUM = 0
    KKK1 = "COM1"
    KKK2 = "9600,n,8,1"
    
    Label5.Caption = KKK1
    Label6.Caption = KKK2
    
    Combo1.Text = KKK1
    Combo2.Text = "9600"
    FLAG = 3
    If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
    End
End Sub

'110
'300
'600
'1200
'2400
'9600
'14400
'19200
'28800
'38400
'56000
'128000
'256000

Private Sub MSComm1_OnComm()
    Dim temp As Variant
    Dim KK As String
    Select Case MSComm1.CommEvent
        Case comEvReceive   ' Received RThreshold # of  ' chars.
            'RECV_NUM = RECV_NUM + 1
            'If RECV_NUM > 10 Then
            '    RECV_NUM = 0
            '    Text1.Text = Text1.Text + Chr(13) + Chr(10)
            'End If
            temp = MSComm1.Input
            KK = temp
            Text1.Text = Text1.Text + KK
            Text1.SelStart = Len(Text1.Text)
            Text1.SelLength = 0
        Case comEvSend   ' There are SThreshold number of
            
    
    End Select
End Sub

'MSComm1.Output = aa



Private Sub Option1_Click()
    FLAG = 1
End Sub

Private Sub Option2_Click()
    FLAG = 2
End Sub

Private Sub Option3_Click()
    FLAG = 3
End Sub

Private Sub Timer2_Timer()
    Command3_Click
    KK = KK + 1
    If KK > 100 Then Timer2.Enabled = False
End Sub

⌨️ 快捷键说明

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