毕业设计论文-pc机串口控制gsm模块收发短信系统设计内容摘要:

码并显示 读取状态显示 结束 输入信息编号 按删除键 送删除 AT 指令 删除状态提示 结束 准备 成功删除信息 ? 打开串口 ? 送读取 AT 指令 10 图 7端口设计状态图 图 8信息读取状态图 图 9 信息删除状态图 11 图 10 信息发送状态报告 3) 短信中心的号码可接使用 SIM 卡中的号码 ,而不需要用户输入。 有一条“ AT+CSCA”指令,可用于设置或查询服务中心号码。 若 SIM卡中已存在此号码,有两种解决办法: 一是用“ AT+CSCA。 ”指令查询出来,然后自动将此号码写到 PDU 的 SCA 中; 二是 PDU 的 SCA 字段只写一个“ 00”:即“ 08 91 68 31 „„” “ 00”。 4) 可用“ AT+CSCA=xxxxxxxx”指令设置服务中心号码。 5)在编写程序过程中需要注意到, 为了防止手机因过于繁忙而出错,要采取一定的方法让手机有充分的时间处理发送和接收及删除等操作。 而 VB 里自带的 Sleep()函数正是为此而设计 的,设置不同参数值可改变 其 等待的时间,这样就 可以避免因为 手机过于繁忙 而出现程序处理错误和系统死机等情况。 6)由于设计系统模块需要提供 +5V、 +12V 和 12V 三路电源,在设计电源时,要注意把这三路电源的地线做成公共地线,即把它们的地线连通。 7)在程序设计过程中,用到了 等内置组件,如果运行该应用程序的机器上没有这些组件,程序将无法正常运行,为了解决这一问题,可以通过把相关的程序和组件进行打包,从而形成程序安装包。 8) 总结: 本 论文主要论述了个人计算机通过串口通信控制 GSM 模块进行短信息接收和发送的工作原理以及相应的程序设计过程 , 着重分析了 GSM AT指令及其用法和 PDU 编码解码的原理规则及相应的实现函数 , 还详细描述了PDU 模式下短信息的发送过程和窗体初始化、短信息发送、短信息读取和删除等功能模块的程序流图。 在整个设计工作过程中,从多方面学习了 GSM 模块收发短信息等基本功能的工作原理以及如何利用 VB 实现串口通信编程,掌握了 PDU 编码解码的原理和实现过程,并加深了计算机串口开发应用的认识。 参考文献 : [1]龚建伟 , 熊光明 . Visual C++/Turbo C 串口通信 编程实践 [M]. 北京: 电子工业出版社, 2020 年。 [2]求是科技 . Visual C++ Visual Basic 串并口开发技术工程应用实例导航 [M]. 北京: 人民邮电出版社,2020。 [3]刘炳文 . Visual Basic 程序设计教程(第二版) [M]. 北京: 清华大学出版社, 2020。 12 [4]北京达盛科技有限公司 . Techshine(使用说明书 电子电气综合实训系统 )[M]. 26~27。 System Design of PC’s Serial Port Controlling GSM Module to Send and Receive Short Messages Xiao Linfa Abstract: The SMS(Short Message Service) which has more and more been much accounted of the system developers and system operators is the value that a basic business of the GSM work. We can develop various applications that foreground is considerable using the GSM work as the work to transmit datas wireless . This text just discusses the programmer of that PC‟s serial port controls the GSM module to realize Chinese or English short message‟s sending and receiving, which can realize measuer datas‟ sending or receiving, memory and dealing on the personal puter through the GSM work. And bat around the message format of PDU mode and programmer of Chinese message‟s coding and decoding. Key words: Short Message Service; PC‟s serial port; GSM module; AT mands;PDU coding and decoding 13 附:系统源程序 39。 全局变量声明 Dim portno As Integer 39。 端口号 Dim baudrate As Long 39。 波 特率 Const prex = 0891 39。 定义全局静态变量 Const midx = 0011000D91 Const sufx = 000801 Private Const EM_LINESCROLL = amp。 HB6 39。 39。 发送信息 Private Declare Function SendMessage Lib user32 Alias SendMessageA (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long 39。 Sleep 函数 (延时功能 ) Private Declare Sub Sleep Lib kernel32 (ByVal dwMilliseconds As Long) 39。 GetWindowTextW39。 指明这是一个 Unicode API (ASSIIunicode) Private Declare Function GetWindowText Lib user32 Alias GetWindowTextW (ByVal hwnd As Long, ByVal lpString As Long, ByVal cch As Long) As Long 39。 = StrConv(StrConv(, vbUnicode), vbFromUnicode) Private Sub NewSMSeting() 39。 检测新信息 If = False Then = True End If = AT+CNMI=1,1,0,0,1 + vbCr = True End Sub Private Function telc(num As String) As String 39。 把电话号码转换成 Unicode 码 Dim tl As Integer Dim ltem, rtem, ttem As String Dim ti As Integer ttem = tl = Len(num) If tl 11 And tl 13 Then MsgBox 电话号码有误 ! amp。 tl Exit Function End If If tl = 11 Then 14 tl = tl + 2 num = 86 amp。 num End If For ti = 1 To tl Step 2 ltem = Mid(num, ti, 1) rtem = Mid(num, ti + 1, 1) If ti = tl Then rtem = F ttem = ttem amp。 rtem amp。 ltem Next ti telc = ttem End Function 39。 将 UNICODE 转换中文 Public Function Unicode2AscII(ByVal s As String) On Error Resume Next Dim i As Integer Dim r As String For i = 1 To Len(s) Step 4 r = r + ChrB(amp。 H amp。 Mid(s, i + 2, 2)) amp。 ChrB(amp。 H amp。 Mid(s, i, 2)) Next Unicode2AscII = r End Function Public Function AscII2Unicode(ByVal CS As String) 39。 把信息转换成 Unicode 码 Dim Length As Integer Dim temp As String Dim i As Integer Dim tempO As String Dim tempN As String tempN = tempO = CS Length = Len(tempO) For i = 1 To Length If AscW(Mid(CS, i, 1)) = 0 And AscW(Mid(CS, i, 1)) 12。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。