2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩9頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、<p><b>  中文2055字</b></p><p>  GSM模塊收發(fā)中文短消息的關(guān)鍵技術(shù)</p><p>  手機短消息服務(wù)SMS(Short Message Service)是全球移動通信系統(tǒng)GSM(Global System for Mobile Communi-cation)的一項基本業(yè)務(wù),它利用信令信道傳輸,不用撥號建立連接,直接把要發(fā)的信

2、息加上目的地址發(fā)送到短消息服務(wù)中心(service center),由短消息服務(wù)中心再發(fā)給最終的信宿,是目前應(yīng)用最廣泛的一種通信方案。目前,隨著手機的廣泛使用,SMS服務(wù)以其傳遞信息方便快捷、價格低廉而越來越受人們的關(guān)注,已經(jīng)廣泛地應(yīng)用于監(jiān)控定位系統(tǒng)、無線報警、遠程維護及數(shù)據(jù)信息查詢等各個領(lǐng)域。</p><p>  本文針對單片機通過串口發(fā)送AT指令控制GSM無線收發(fā)模塊,實現(xiàn)在不支持中文編碼的Text(文本)模

3、式下接收中文短消息的軟硬件設(shè)計進行了研究,并利用數(shù)控模擬開關(guān)CD4052實現(xiàn)了單片機多個串口的擴展。 </p><p>  1 短消息基本原理介紹</p><p>  1.1 GSM模塊介紹</p><p>  目前,市場上GSM模塊種類很多,但功能、用法基本相同。本文中使用了Siemens公司生產(chǎn)的TC35i模塊。該模塊與GSM2/2兼容,提供 雙頻(GSM900

4、/GSM1800)和RS232數(shù)據(jù)接口,外部提供9針串口及話柄接口(支持語音),如圖1所示;通過AT命令來傳輸數(shù)據(jù)、語音和短消息等,方便用戶開發(fā)和設(shè)計。</p><p>  1.2 短消息AT指令</p><p>  AT指令用于由終端設(shè)備(TE)或數(shù)據(jù)終端設(shè)備(DTE),發(fā)送到終端適配器(TA)或數(shù)據(jù)電路終接設(shè)備(DCE)。設(shè)備通過發(fā)送AT命令來控制移動臺,并與GSM網(wǎng)絡(luò)業(yè)務(wù)進行交互。通

5、過AT命令可進行呼叫、短信、電話本、數(shù)據(jù)業(yè)務(wù)、補充業(yè)務(wù)等方面的控制。本文中由單片機發(fā)送AT指令來控制GSM模塊接收和發(fā)送手機短消息。</p><p>  常用短消息相關(guān)AT指令及說明如表1所列。</p><p>  1.3 收發(fā)短消息的模式</p><p>  目前,接收和發(fā)送SMS信息常用的模式主要有兩種:Text(文本)模式和PDU(Protocol Data

6、Unit,協(xié)議數(shù)據(jù)單元)模式。</p><p><b>  (1)Text模式</b></p><p>  Text 模式是純文本方式,可使用不同的字符集。該模式下信息傳送和接收的編碼比較簡單,但國內(nèi)手機Text模式下不支持收發(fā)中文漢字字符的手機短消息。本文通過編碼轉(zhuǎn)換實現(xiàn)了GSM模塊在Text模式下收發(fā)中文短信息。</p><p><b

7、>  (2)PDU模式</b></p><p>  PDU模式被所有手機支持,可發(fā)送中英文短信。PDU模式下可采用3種編碼方式,分別是7位、8位和UCS2編碼,分別用于發(fā)送普通的ASC Ⅱ字符、數(shù)據(jù)消息和Unicode字符。按照GSM07.05協(xié)議規(guī)定,手機短信息中的漢字編碼均采用Unicode碼。</p><p>  如表2所列,PDU模式中畫橫線部分依次為短信息中心號

8、碼、發(fā)送短信方手機號碼以及發(fā)送短信的日期和時間。其代碼表示為將實際數(shù)據(jù)兩兩顛倒,例如實際短信息中心號碼應(yīng)為“8613800311500”。短信內(nèi)容“你好!”均為Unicode字符“4F60597D0021”。其他各項的具體說明見參考文獻。</p><p>  經(jīng)研究比較發(fā)現(xiàn),所要提取的短信信息包括手機號碼、時間和短信內(nèi)容。在Text模式下時間和日期均為ASCII碼,可直接讀取,只需將內(nèi)容中漢字部分的Unicode

9、碼轉(zhuǎn)換成國標碼;而在PDU模式下除漢字編碼轉(zhuǎn)換外,還需將號碼、時間部分編碼進行兩兩顛倒的轉(zhuǎn)換,才能得到所需的正確信息。故在系統(tǒng)設(shè)計中將GSM模塊設(shè)為Text模式,更能簡化程序設(shè)計。</p><p>  2 Unicode碼到GB2312碼的轉(zhuǎn)換</p><p>  由于Unicode編碼和GB2312編碼之間沒有一一對應(yīng)的線性轉(zhuǎn)換關(guān)系,用單片機控制代碼轉(zhuǎn)換只能采用查表方法實現(xiàn),因此,需要建

10、立Unicode碼和GB碼之間轉(zhuǎn)換的對照。中文簡體漢字有7 464個,一個漢字占2個字節(jié),因此對照表需要29 856(7 464×4)的存儲空間。本設(shè)計中選擇P89V51RD型單片機,該芯片提供的1 KB RAM可以滿足存儲多條短信的要求。</p><p>  單片機通過串口與模塊連接后,發(fā)送讀取第一條新短消息指令:“AT+CMGR=1”。提取模塊接收的短消息后,先判斷其內(nèi)容是否為ASCII碼。若為AS

11、CII碼,則無需轉(zhuǎn)換直接讀取;否則,通過查表法查找其對應(yīng)的漢字GB碼,實現(xiàn)不同編碼間的轉(zhuǎn)換。轉(zhuǎn)換流程如圖2所示。</p><p>  提取信息內(nèi)容的部分程序如下:</p><p>  采用二分查找法,其最壞查找次數(shù)為lg2(n+1),對照表的長度n為7 464,故最壞查找次數(shù)約為13次。也就是說,一個中文編碼轉(zhuǎn)換最多經(jīng)過13次比較查找即可完成,單片機控制能夠?qū)崟r完成。</p>

12、<p>  3 單片機多串口的實現(xiàn)</p><p>  51系列單片機一般只有一個串行通路,通過串口與GSM模塊連接后,則不能再連接其他串口設(shè)備;而一些串口擴展芯片成本較高,連接也較麻煩。本方法利用數(shù)控模擬開關(guān)CD4052來做多串口擴展器,成本低廉而且接線簡單。其引腳排列如圖3所示。</p><p>  CD4052具有4個獨立的通道數(shù)據(jù)選擇器,有A、B兩個輸入端和一個禁止輸入

13、INH,通過A、B的4種二進制組合狀態(tài)來選擇4對通道中的一對。</p><p>  本設(shè)計中,A、B分別占用P2.0和P2.1口,P2=0x01則選通模塊串口,P2=0x02則接通其他串口設(shè)備。當INH為1時,所有通道均關(guān)閉。X、Y分別連接單片機的RXD和TXD,則可將一個串口擴展為4個,具體接線方法如圖4所示。</p><p>  CD4052實際上是2個一分四的數(shù)據(jù)分配器,所擴展的串口

14、均是全雙工異步工作模式,具有很高的工作速度,方便地實現(xiàn)了一片單片機多個串口的擴展能力。以Siemens公司的TC35i GSM模塊為編程對象,通過P89 V51單片機進行控制,構(gòu)建了實際系統(tǒng),實現(xiàn)了編程過程以及系統(tǒng)串口擴展等,有效地接收并完成中文短消息代碼的轉(zhuǎn)換,驗證了上述構(gòu)建思路的可行性和正確性。</p><p>  單片機控制GSM模塊在Text模式下接收手機中文短信息,其編碼轉(zhuǎn)換格式較為簡單,并有較高的轉(zhuǎn)換

15、速率。對于終端接收中英文信息的項目,采用本文所研究的單片機控制GSM模塊收發(fā)短消息技術(shù),實現(xiàn)簡單,成本較低,可直接嵌套使用。另外,經(jīng)擴展后單片機可同時與其他串行設(shè)備相連,例如與串行打印機相連,即可直接打印出手機信息內(nèi)容。在車輛監(jiān)控系統(tǒng)、倉庫監(jiān)控系統(tǒng)及儀器數(shù)據(jù)遠傳等方面,也能很好地結(jié)合本技術(shù)。</p><p>  GSM module to send and receive Chinese SMS key tech

16、nologies</p><p>  Mobile phone short message service SMS (Short Message Service) is a global system for mobile communications GSM (Global System for Mobile Communi-cation) of a basic business, which uses sig

17、naling channel transmission, do not set up dial-up connection, directly to the information issued to increases on the destination address is sent to the Short Message Service Center (service center), from the Short Messa

18、ge Service Center and then the final letter sent to places, are currently the most widely u</p><p>  In this paper, single-chip through the serial port to send AT commands to control GSM wireless transceiver

19、 modules, realize do not support Chinese encoding in the Text (text) mode to receive Chinese SMS hardware and software design of the study and use of numerical control analog switches CD4052 realize more than a single-ch

20、ip serial port expansion.</p><p>  1 Introduce the basic principles of short message</p><p>  1.1 GSM Module Introduction</p><p>  At present, the market, many different types of

21、GSM modules, but the function, usage is basically the same. In this paper, the use of the Siemens company TC35i module.The module with GSM2/2 compatible,providing dual-band and RS232 data interface, an external provider

22、and making themselves laughing stocks in 9-pin serial interface (support of voice), as shown in Figure 1; through the AT command to transmit data, voice and SMS and so on, user-friendly development and design.</p>

23、<p>  1.2 SMS AT command</p><p>  AT commands used by the terminal equipment (TE) or data terminal equipment (DTE), is sent to the terminal adapter (TA) or data circuit terminating equipment (DCE).Dev

24、ice by sending AT commands to control the mobile station, and with the GSM network to interact.Through the AT command to make calls, text messaging, phone book, data operations, such as the replenishment of the operation

25、al aspects of control. Singlechip Send this article by AT commands to control the GSM module to receive and send m</p><p>  Commonly used SMS related AT commands and explanations such as listed in Table 1.&l

26、t;/p><p>  1.3 Message resumption model</p><p>  At present, the receive and send SMS messages commonly used model has two main: Text (text) mode and PDU (Protocol Data Unit, Protocol Data Unit) m

27、ode.</p><p>  (1) Text Mode</p><p>  Text mode is text-only mode, you can use different character sets. The mode of information transmission and reception of the coding is relatively simple, bu

28、t the domestic mobile phone does not support Text mode to send and receive Chinese characters characters mobile phone short message. In this paper, encoding conversion realize the GSM module in the Text mode to send and

29、receive Chinese text messages.</p><p>  (2) PDU mode</p><p>  PDU Mode Supported by all mobile phone, you can send the message in both English and Chinese. PDU mode using three kinds of encodin

30、g, respectively, are 7, 8 and UCS2 encoding, respectively, used for sending ordinary ASC Ⅱ characters, data messages and Unicode characters. GSM07.05 agreement in accordance with the provisions of mobile phone text messa

31、ges in Chinese characters are encoded using Unicode code.</p><p>  Such as set out in Table 2, PDU mode draw some horizontal line followed by short message center number, send text messages to mobile numbers

32、 and send the message date and time. Its code will express the actual data for the 22 reversed, for example, the actual short message center number should be "8613800311500." Message content "Hello!"

33、Unicode characters are "4F60597D0021". Other specific description see references.</p><p>  After studying the comparison showed that the message to extract information including cell phone numbers,

34、 time and message content. In Text mode, time and date are the ASCII code, can be directly read, just the content part of the Unicode code characters into GB codes; PDU mode in addition to Chinese character encoding conv

35、ersion, the need to number, the time portion code 22 to reverse the conversion to get the correct information. Therefore, in system design will be set to Text mode GSM module</p><p>  2 Unicode code conversi

36、on code to the GB2312</p><p>  Because of Unicode encoding and no-one correspondence between the GB2312 encoding conversion of the linear relationship between the MCU control code conversion can only look-up

37、 table method, therefore, necessary Unicode code and set up between the GB code conversion control. Chinese Simplified Chinese characters, 7 464, representing a 2-byte characters, the table required 29 856 (7 464 ×

38、4) of storage space. This design choice P89V51RD-type single-chip, the chip provided by 1 KB RAM memory to me</p><p>  Single-chip with the module through the serial port connected, sending the first to read

39、 new SMS commands: "AT + CMGR = 1". Extraction module to receive the short message, the first to determine whether its content is for ASCII code. If the ASCII code, you do not need to read the conversion direct

40、ly; Otherwise, search through the look-up table method of its corresponding Chinese character GB code, realize the conversion between different coding. Conversion process as shown in Figure 2.</p><p>  Extra

41、ction of information content of some of the procedures are as follows:</p><p>  Using binary search method, the worst number of search lg2 (n +1), the length of table n to 7 464, so the worst is about 13 tim

42、es the number of search. In other words, a Chinese coding conversion after up to 13 times compared to complete search, single-chip real-time control can be completed.</p><p><b>  .</b></p>

43、<p>  3 Singlechip realize the many serial</p><p>  51 Series MCU general there is only one serial channel, through the serial port connected with the GSM module is not longer connected to other serial

44、 equipment; and some higher-cost serial expansion of the chip, connecting more trouble. This method is the use of numerical control analog switches CD4052 do many serial expander, low-cost and easy wiring. Its pin shown

45、in figure 3.</p><p>  CD4052 has four independent channel data selector, has A, B two inputs and a ban on the importation of INH, through A, B of the four kinds of binary combination of state of four pairs o

46、f channels to choose one of the right.</p><p>  This design, A, B, respectively, occupied by P2.0 and P2.1 I, P2 = 0x01 while strobe module serial port, P2 = 0x02 is connected to other serial devices. When I

47、NH for 1, all channels are closed. X, Y, respectively, to connect MCU RXD and TXD, a serial port may be extended to 4, the specific wiring method shown in Figure 4.</p><p>  CD4052 are in fact two sub-four-o

48、ne data distributor, the expansion of full-duplex asynchronous serial ports are working mode of high speed, easy to realize a more than a single-chip serial port expansion capacity. Siemens company to TC35i GSM module fo

49、r the programming object, through the P89 V51 single-chip control, build the actual systems, the realization of the programming process and system, such as serial port expansion, effectively receive and complete the Chin

50、ese short message code conv</p><p>  GSM single-chip control module in the Text mode mobile phone to receive text messages in Chinese, the encoding format conversion relatively easy, and have a higher conver

51、sion rate.For the terminal to receive information in both English and Chinese projects, this paper studied the use of single-chip control module resumption Message GSM technology, the realization of simple, lower cost, c

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論