




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
基于 GSM 的门控及 SMS 报警系统设计- 软件设计1 The TC35i mold piece introductionCurrently, domestic already beginning usage of the GSM mold piece have a lot, and these of function, method of using difference not big.What this design adoption is a Siemens TC35 the TC35i of the series.On this kind of wireless mold piece function and TC35 and permit, design tightly packed, consumedly contracted the physical volume of customers product.The TC35i and GSM2/2 and permit,dual-band(GSM900/GSM1800), RS232 the data connect, should mold piece and radio frequency electric circuit and Ji take and integral whole, provide toward the customer standard of AT order connect, is data, speech, short news and fax provide fast, credibility, safety of deliver, convenience customer of application development and design. 2 Usely AT introductionThe follow is uselly the At. 3 The PDU code ruleSend out short news in common use Text and PDU(Protocol Data Unit, agreement data unit) mode currently.The usage Text mode receive and dispatch a message code simple, realization get up very easy, but the biggest weakness be to cant receive and dispatch Chinese message;But PDU mode not only support Chinese message, also the ability send out English message.The PDU mode receive and dispatch a message can the usage be 3 kinds of to code:7-bit, 8-bit and UCS2 code.7-the bit code to used for send out common of ASCII character list, 8-bit code Be usually used for sending out data news, UCS2 code used for sending out Unicode character list.General PDUs code is constitute by ABCDEFGHIJKLM 13. A:The address length of the message center, 216 enter to make number(one word stanza)B:The number type of the message center, 216 enter to make number. C:Message center number, B+C length will from the data decision in the A. D:Document head word stanza, 216 enter to make number. E:Information type, 216 enter to make number. F:Drive call number length, 216 enter to make number. G:Drive call number type, 216 enter to make number, take value together B. H:Drive call number, length from data within F decision. I:Agreement marking, 216 enter to make number. J:The data code a project, 216 enter to make number. K:Term of validity, 216 enter to make number. 基于 GSM 的门控及 SMS 报警系统设计- 软件设计L:Customer data length, 216 enter to make number. Usely ATAT instruction function AT+CMGC Send an SMS commend(issue a message order) AT+CMGD Delete SMS message (delete SIM card the information of the memory) AT+CMGF Select SMS message format(choice short news information format:0-PDU;1-文本) AT+CMGL List SMS message from preferred store(list short PDU/TEXT of the news format in the SIM card:In order to read 0REC UNREAD, oneREC READ in order to have already read, 2STOU NSENTs is a due-out, 3STOSENT is already hair, 4ALL is allAT+CMGR Read SMS message (read short news) AT+CMGS Send SMS message (the hair short news) AT+CMGW Write SMS message to memory (to write in the short news of due-out in the SIM memory) AT+CNMI New SMS message storage(the manifestation lately- receive short news) AT+CPMS Preferred SMS message storage (the choice short news memory) AT+CSCA SMS service center address(the choice short news memory) AT+CSCB Select cell broadcast message messages (choice beehive broadcasting information) AT+CSMP Set SMS text mode parameters(constitution short news text origin mode parameter) M:Customers data, its length from the data decision in the L.Enactment in J adoption UCS2 code, here is the Unicode character list of Chinese-English. 4 list slice the software of the machine and TC35i connect and control principleList slice the software of the machine and TC35i connect in fact be list slice the machine pass AT instruction control cellular phone of control technique, first constitution the TC35i mold piece of work mode:AT+CMGF=n, n=0 is a PDU mode;N=1 write an article this mode;Usually the constitution is a PDU mode, under this kind of mode, ability transmission or accept a transparent data.(customer from 基于 GSM 的门控及 SMS 报警系统设计- 软件设计definition data)AT+CMGR=n in order to read the short news data of the TC35i mold piece, the n is a short news number.AT+CMGL=n in order to list the short news in the TC35i mold piece, n=0 is the short news which read, n=a the short news which have been already read, n=2 short news which sent out, n=3 for have already send out of short news n=4 is all short news.AT+CMGD=the n is the short news which delete the TC35i mold piece and the n is a short news serial number. 5 RS-232 InterfaceRS-232 is one of the normally used interfaces at any time, it not only built in every PC-set, but also built in any types of computers which are from microcontroller to host computers, and equipment connected with them. The general usage of RS-232 is to connect a modern, the other arrangements with RS-232 interfaces include printer, data collection module, testing device and control loop. RS-232 can be also used in the simple link of any type of computer.RS-232 is designed to deal with the communication between two arrangements with distance limitation from 50 to 100ft, which depend on Potter rate and type of electric cable. Because of wide application of RS-232 port, its other usage is to link another type of adapter converted form the port.For example, a simple loop changes a RS-232 into a RS-485 port. The port can be link with several devices by means of a long lead. Non-equilibrium lead is used to linked to RS-232. Although non-equilibrium should something avoidable, it only refers to the electric property of the signal in lead. In a non-equilibrium lead, signal voltage is applied to another lead, all has another technical term “signal end”.Advantages in RS-232RS-232 is used everywhere. Every PC-set has one or more RS-232 ports. The renewed computers sustain other serial interfaces like USB. But RS-232 can do many things which USB cant do.In the micro-controller interface chip can be easily used to change into RS-232.The jointing distance can reach 50-100ft. Many external interfaces are not used for too long distance. The longest distance joint of USB can reach 16ft. The distance between parallel printer interface on the PC-set and the host computer can reach 10 to 15ft, or 30ft by using Type TEEE-1284B driver. But RS-232 can use the longer electric cable.If every RS-232 port is linked with a modern, Telephone network can used to send data in the rage of the world.For a double link, 3 leads are needed. A parallel circuit generally needs 8 data lines, two or more control signal lines and ground wires。It is more expensive if more leads and bigger connectors are used.Disadvantages in RS-232If one side of link needs parallel data, it has to transform serial into parallel data. But if it is easily realized a UART is used.Because of the serial port so useful, it is maybe harder to look for a free serial port PC-set may have many serial ports, but a system maybe cant distribute a sole breaking enquiring signal to every serial port. Most micro-controller only has one 基于 GSM 的门控及 SMS 报警系统设计- 软件设计hardware serial port.No more than 2 set in one link.The biggest designated transmitting rate of data is 2000bits/s.But many interface chip can surpass this numerical value, especially in the short distance link.A longer link needs a different interface.basic signals of the double RS-232 communication as follows:TD. Transform data DTE to DCE Its also called TX and TXD.RD. Transform data DCE to DTE Its also called RX and RXD.SG. Signal land. Its also called GND and SGND.VoltageLogic0 is a positive RS-232 voltage, the logic electric level of RS-232 is indicated with positive-negative, and not only use the positive voltage signal of the 5VTTL and CMOS logic to indicate. In the data logger(TD)of RS-232,a logic0 is defined equal to or higher than +5V, and a Logic1 defined equal to -5V or lower than -5V. In another word, signal use the negative logic, in this logic, the negative voltage is Logic1.Control signal uses the same voltage, but it uses positive logic. A positive voltage indicates this function is on and a negative voltage indicates this function is off.RS-232 interface chip transform these signals in reverse. In output pin of one UART, A logic1 datum or a off control signal is close to 5V, it produces negative voltage on the interface of RS-232.A logic0 datum or an on-control signal is close to 0V, it produces a positive voltage on the interface of RS-232.Because of the RS-232 receptor maybe at the end of a long electrical cable, when the signal reaches the receiver, its voltage is probably weaker or with the noise signal. In consideration of this circumstance minimum at the receiver should be lower than the voltage at the driver.An input higher than +3V on the RD are a Logic0, or on a control input is open. An input lower than -3V on the RD are a Logic1, or on a control input is off. According to this standard, input logic electrical level between -3V and +3V have no definitionNoise tolerable limitation or voltage tolerable limitation is difference output voltage and input voltage. The big voltage undulation from RS-232 lead to a noise tolerable limitation wider than logic5TTL. For example, even thought a output from RS-232 driver is the smallest +5V,its also be weaken in the receiver or the noise peak rise to 2V, and still is a effective Logic0.Many outputs from RS-232 have the wider voltage undulation : 9V and 12V are very common affairs. All these affairs can lead to a noise limitation. The biggest permitting voltage undulation is 15V, even though the receive must have no harm to deal with the voltage higher to 25V.The other two technical terms concern with RS-232 to be used is Mark and Space. Space is Logic0 and Mark is Logic1. These two technical terms which was used by the machine recording instrument to record binary data in many years ago, each of them are representation physical and blank.Clocking Limitation:TIA/EIA-232 including smallest and biggest clocking stipulate. All out the RS-基于 GSM 的门控及 SMS 报警系统设计- 软件设计232 interface chips all accord this stipulate.Appointed revolving speed limited the biggest Potter rate of interface.The revolving rate is measure to the rate of speed change when output cut-over voltage, and describe the change of instantaneous velocity in The advantage in limited the revolving is for improve signal quality by in the matter of fact to limited the problem which is due to voltage deflection, voltage deflection occur the signal in the long distance link which has high-speed rise and descend. There more detailed narrations to this problem are in capter10.But revolving velocity also limited to the biggest speed of a link. Under speed of 30V/s, a output need 0.3 s to cut-over time in 166 times.Actually, because the UART to read input data in near the middle of the digit, and also because many times consult clock in very accurate, usually can may use the digit width for cut-over time as short 5 to 10 time safety. Considered these conditions, some interface chips permitting 115kbps or more higher Potter rate, even though its infringe the suggestion this standard.Except for has a biggest cut-over velocity, RS-232 driver also must according the lowest standard to ensure the signal no stopover in the undefined area between the logical condition. To control signal other 40bps and the lower signal. Signal lines must spend time not surpass 1s in the transmit area between the effective Logic1 and Logic0.To other data and time signal this limitation place wide is 4% or under 20 bps is 2s. Frequencies of signal rise and descend also probably close to be equal.Transformation between 5V logical and RS-232Many micro-controllers have asynchronous serial ports, but their input and output rather to use 5V logic than to RS-232 voltage. To link 5V logic to a RS-232 port need to transform into RS-232 electrical level and transform from RS-232 electrical level into 5V logicTo use of 5V logic, I supposed to the use of electrical level of TTL or CMOS logic chips, these chips are supply electricity by a single +5V electrical, signal electrical level refer to grounding electrical level. Tables 6-2 indicate this. I also supposed to positive logic, in here, the logical high electric level is logic1.To TTL logic, a logical low output must below 0.4V, a logical low input must below 0.8V. A logical high output must be 2.4V at least and a logical high input must be 2V at least. To use of these logical electrical levels, an interface may have noise signal at 0.4V and not necessarily to make mistake.These logical electrical levels are used into TTL logic of early days standard 7400 series and other drivers series, including 74LS 74F and 74AL STTL. The NMOS technology early is used to make micro-controllers also use these helical electrical levels.Most CMOS chips definite different logical electrical levels and have wider noise tolerable. A logical low CMOS output below 0.1V and logical low input may higher to 20% electrical voltage, or to electrical voltage in 5V can reach to 1V. A logical high output to be 4.9V at least and logical high input must reach to electronically voltages 70% at least, or to 5V electrical input reach to 3.5V. To use of this series of logical electrical level, including 4000 series, 74HC and 74AC logic. 基于 GSM 的门控及 SMS 报警系统设计- 软件设计Some of CMOS chips have TTL compatible input and CMOS compatible output. Its make them can link with CMOS or TTL logic directly. The chips of follow to this usual practice including 74HC logic series and most of micro-controllers.基于 GSM 的门控及 SMS 报警系统设计- 软件设计1、 TC35i 模块介绍 目前,国内已经开始使用的 GSM 模块有很多,而且这些模块的功能、用法差别不大。本设计采用的是西 门子 TC35 系列的 TC35i 。这种无线模块功能上与 TC35 兼容,设计紧凑,大大缩小了用户产品的体积。TC35i 与 GSM2/2 兼容、双频(GSM900/GSM1800)、RS232 数据接口,该模块及射频电路和基带与一体,向用户提供标准的 AT 命令接口,为数据、 语音、短消息和传真提供快速、可靠、安全的传输,方便用户的应 用开发及设计。2、常用 AT 指令如下表所示为常用 At 指令:常用 AT 指令AT 指令 功 能 AT+CMGC Send an SMS commend(发出一条短信息命令) AT+CMGD Delete SMS message (删除 SIM 卡内存的信息) AT+CMGF Select SMS message format(选择短消息信息格式:0-PDU;1-文本) AT+CMGL List SMS message from preferred store(列出 SIM 卡中的短消息格式PDU/TEXT:0“REC UNREAD”为未读,1“REC READ”为已读,2“STOU NSENT”为待发, 3“STOSENT”为已发, 4“ALL”为全部 AT+CMGR Read SMS message (读短消息) AT+CMGS Send SMS message (发短消息 ) AT+CMGW Write SMS message to memory (向 SIM 内存中写入待发的短消息) AT+CNMI New SMS message storage(显示新收到的短消息) AT+CPMS Preferred SMS message storage (选择短消息内存) AT+CSCA SMS service center address(短消息中心地址) AT+CSCB Select cell broadcast message messages (选择蜂窝广播信息) AT+CSMP Set SMS text mode parameters(设置短消息文本模式参数) 3、 PDU 编码规则目前,发送短消息常用 Text 和 PDU(Protocol Data Unit,协议数据单元)模式。使用 Text 模式收 发短信代 码简单,实现起来十分容易,但最大的缺点是不能收发中文短信;而 PDU 模式不仅支持中文短信,也能发送英文短信。PDU 模式收发短信可以使用 3 种编码:7-bit、8-bit 和 UCS2 编码。 7-bit 编码用于发送普通的ASCII 字符,8-bit 编码通常用于发送数据消息, UCS2 编码用于发送 Unicode 字符。一般的 PDU 编码由 ABCDEFGHIJKLM 十三项组成。 A:短信息中心地址长度,2 位十六进制数(1 字节) 基于 GSM 的门控及 SMS 报警系统设计- 软件设计B:短信息中心号码类型, 2 位十六进制数。 C:短信息中心号码,B+C 的长度将由 A 中的数据决定。 D:文件头字节,2 位十六进 制数。 E:信息类型,2 位十六进制数。 F:被叫号码长 度, 2 位十六进制数。 G:被叫号码类型,2 位十六 进制数,取值同 B。 H:被叫号码,长度由 F 中的数据决定。 I:协议标识 ,2 位十六进制数。 J:数据编码方案,2 位十六进制数。 K:有效期, 2 位十六进制数。 L:用户数据长度,2 位十六 进制数。 M:用户数据,其长度由 L 中的数据决定。 J 中设定采用 UCS2 编码,这里是中英文的 Unicode 字符。 4 单片机与 TC35i 的软件接口及控制原理 单片机与TC35i的软件接口其实就是单片机通过AT指令控制手机的控制技术,首先设置TC35i模块的工作模式:AT+CMGF=n, n=0为PDU 模式;n=1为文本模式;通常设置为PDU模式,在这种模式下,能传送或接受透明数据(用户自定义数据)。AT+CMGR=n为读TC35i模块短消息数据,n为短消息号。AT+CMGL=n 为列出TC35i模块内的短消息,n=0是未读的短消息,n=1位已读的短消息,n=2位未发送的短消息,n=3为已发送的短消息n=4为所有短消息。AT+CMGD=n为删除TC35i模块的短消息,n为短消息编号。5 RS-232 串行接口RS-232 是在任何 时候都常用的接口之一。它不仅已经被内置于每台 PC,而且已被内置于从微控制器到主机的多种类型的电脑和与它们连接的设备。RS-232 的最通常得用处是连接到一个 Modem,其他拥 有 RS-232 接口的设备包括打印机,数据采集模块,测试装置和控制回路。你也可以将 RS-232 用在任何类型得计算机之间的简单连接中。RS-232 是设计 来处理两台 设备之间的通信的,距离限制为 50 到 100f,这决定于波特率和电缆类型。因 为 RS-232 端口被广泛应用,它的另一个用途是与一个将这个接口转换成另一种类型的适配器相连。例如,一个简单的回路将一个基于 GSM 的门控及 SMS 报警系统设计- 软件设计RS-232 端口转换 成一个 RS-485 端口,这个端口可以和多台 设备相连并且可以使用更长的导线连线。RS-232 连接使用非平衡 导线 。尽管一个非平衡的状态听起来像是一些应该避免的东西,在这里它仅仅 是指导线中的信号的电气特性。在一条非平衡导线中,信号电压加到一条导线上,所有的信号电压都使用一个公共的接地线。这种类型的接口的另一个术语是单端。特性RS-232 有几个优点: 它是无处不在的。每一台 PC 机都有一个或更多的 RS-232 端口。更新的计算机现在支持其他诸如 USB 这样的串行接口,但是 RS-232 可以做很多 USB 无法做的事情。 在微控制器中,接口芯片使得将一个 5V 串口转换成 RS-232 变得很容易。 连接距离可以达到 50 到 100ft。大多数的外 设接口都不会用于太长的距离。USB 连接最长可以达到 16ft,PC 机的并口打印机接口与主机的距离可以达到 10 到 15ft,或者利用 IEEE-1284B 型驱动器可以达到 30ft。但是 RS-232 可以使用更长的电缆。如果每一个 RS-232 端口与一个 Modem 相连,你可以使用电话网在世界范围内发送数据。 对于一个双向连接,你只需要 3 条导线。一个并行连接一般需要 8 条数据线,两条或者更多的控制信号线,和几条接地 线。所有的 导线和更大的连接器使得价格累计起来就比较高了。RS-232 的缺点包括以下这些: 如果连接的另一头需要并行数据,它不得不将这个串口数据转换成并行数据。但是利用一个 UART,这很容易实现。基于 GSM 的门控及 SMS 报警系统设计- 软件设计 串口是如此的有用,以至于寻找一个未用的串口可能会比较困难。PC 机可以有多个串口,但是一个系统可能无法为每一个串口分配一个唯一的中断请求信号。大多数的微控制器只有一个硬件串口。 在一个连接中不能有超过 2 台以上的设备。 指定的最大数据传输速率是每秒 20000 位。但是,很多接口芯片可以超过这个数值,尤其是在短程连接上。 很长的连接需要一个不同的接口。双向 RS-232 通信的 3 个基本信号如下:TD:将数据从 DCE 传输到 DCE 也被称作 TX 和 TXD。RD:将数据从 DCE 传输到 DTE。也被称作 RX 和 RXD。SG:信号地。也被称作 GND 和 SGND。电压RS-232 的 逻辑电平用正 负电压表示,而不是只用 5V TTL 和 CMOS 逻辑的正电压信号表示。在一个 RS-232 的数据输出(TD),一个逻辑 0 被定义为等于或者高于+5V,而一个逻辑 1 被定义为等于-5V 或者比低于-5V。 换言之,信号使用负逻辑,在这种逻辑中,负的电压为逻辑 1。控制信号使用相同的电压,但是使用的是正逻辑。一个正的电压表示这项功能为开,而一个负的电压表示这个功能为关。RS-232 接口芯片反向转换这些信号。在一个 UART 的输出引脚,一个 逻辑 1 数据位或者一个关控制信号接近于 5V,它在 RS-232 的接口产生一个负电压。一个逻辑 0 数据位或者一个开控制信号接近于 0V,它在 RS-232 接口产生一个正电压。因为一个 RS-232 接收器可能位于一条 长电线缆的末端,等到信号到达接收者的时候,它的电压可能已经削弱了或者加载了噪声信号。考
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 工业自动化与智能电网的融合探讨
- 工业遗产在旅游业中的利用与发展前景分析
- 工业遗产改造为文化创意产业园的实践案例研究
- 工业设计的趋势与前景分析
- 工业设计创新与趋势分析
- 工作环境改善与团队效率关系研究
- 工厂操作人员必须了解的版本更新质量要求
- 工程物流项目的高效安全管理模式及实施策略探讨
- 市场分析与预测方法在市场营销中的应用
- 工程项目管理中的数据化决策与汇报
- Java Web 程序设计(山东联盟)智慧树知到课后章节答案2023年下潍坊学院
- (完整版)四宫格数独题目204道(可直接打印)及空表(一年级数独题练习)
- 劳务派遣投标方案(完整技术标)
- 日内瓦公约(全文)
- 中建金属屋面施工方案完整版
- 支付清算系统参与者考试题库五
- 成麻五元算账一览表
- 部编版小学语文五年级下册第二单元易错点检测卷-(含答案)
- 数控铣床及加工中心编程与操作
- 最高法关于民间借贷的司法解释全文
- 甘肃省静疗知识大赛考试题库大全-上(选择、判断题部分)
评论
0/150
提交评论