毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

PC机串口控制GSM模块收发短信系统设计(流程图+源程序) 第2页

更新时间:2010-5-7:  来源:毕业论文
PC机串口控制GSM模块收发短信系统设计(流程图+源程序) 第2页
 If InStr(Backstring, "OK") Then
  
   Mobcomm.Output = "AT+CMGS=" + Str(ML) + Chr(13) + Chr(10)
  
   Else
   GoTo err
  ' Exit Sub
   End If
   Backstring = ""
 End If
Sleep (400)
If Mobcomm.InBufferCount > 0 Then
   Backstring = Mobcomm.Input
   Mobcomm.InBufferCount = 0
   Mobcomm.OutBufferCount = 0
    If InStr(Backstring, ">") Then
     
       Mobcomm.Output = MS + Chr(26)
    
    Else
      GoTo err
     '  Exit Sub
    End If
    Backstring = ""
End If
 Sleep (2000)
If Mobcomm.InBufferCount > 0 Then
   Backstring = Mobcomm.Input
   Mobcomm.InBufferCount = 0
   Mobcomm.OutBufferCount = 0
    If InStr(Backstring, "OK") Then
    MsgBox "信息发送成功!", vbOKOnly, "系统提示"
    Else
      
       GoTo err
    '   Exit Function
    End If
    Backstring = ""
End If
Sleep (1000)
Exit Sub
err:
 MsgBox "信息发送成功!", vbOKOnly, "系统提示"
 'MsgBox "传送出现错误,请重新发送!", vbOKOnly, "系统提示"
End Sub


Private Function Sendsms(num As String, msg As String) As Boolean  '短信发送
    Dim PDU, psmsc, pnum, pmsg, buf As String
    Dim Leng As String
    Dim Length As Integer
        Length = Len(msg)
        Length = 2 * Length
        Leng = Hex(Length)
    If Length < 16 Then Leng = "0" & Leng
       psmsc = Trim(telc("8613800758500"))
       pnum = Trim(telc(num))
       pmsg = Trim(StrConv(msg, vbUnicode))
       PDU = prex & psmsc & midx & pnum & sufx & Leng & pmsg
       Sleep (1)
       Call Portopen_Test
       Mobcomm.Output = "AT+CMGF=0" + vbCr
       Mobcomm.Output = "AT+CMGS=" & Str(15 + Length) + vbCr
       Sleep (500)
        If Mobcomm.InBufferCount > 0 Then
           Mobcomm.InputLen = 0
           buf = Mobcomm.Input
           If InStr(buf, ">") Then
              Mobcomm.Output = PDU & Chr$(26)
              buf = ""
           End If
        End If
        If Mobcomm.InBufferCount > 0 Then
           Mobcomm.InputLen = 0
           buf = Mobcomm.Input
              If InStr(buf, "OK") Then
               
                 buf = ""
                 Sendsms = True
              End If
        End If
End Function
Private Sub readsms(rnum As String)     '接收信息
 Mobcomm.Output = "AT+CMGF=1" + vbCr
 Mobcomm.Output = "AT+CMGR=" & rnum + vbCr
End Sub
Private Sub Command1_Click()
    myActiveX.Active = False
    myActiveX.ComPort = Combo1(1).Text   
    myActiveX.baudrate = Int(Val(Combo2(1).Text))
    MsgBox "设置端口号为:" & Combo1(1).Text & ",波特率为:" & Combo2(1).Text & tl
       myActiveX.Active = True
End Sub

Private Sub Command2_Click()

msg.Text = ""

End Sub

Private Sub Command3_Click()
     DebugText "================= SIM卡信息 ====================="
     DebugText "  SIM卡IMSI:  " + myActiveX.IMSI
     DebugText "  短信中心:   " + myActiveX.SCA
     DebugText "  所属网络:   " + myActiveX.Provider
     DebugText "  短信数目:   " + myActiveX.SMSMemUsed
     DebugText "  短信容量:   " + myActiveX.SMSMemTotal
 www.youerw.com = 0
Mobcomm.InputLen = 0
Sleep (100)
'Mobcomm.Output = "AT+CMGF=1" + vbCr
'Sleep (400)

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

PC机串口控制GSM模块收发短信系统设计(流程图+源程序) 第2页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。