收藏的精品资料精品中英文外文翻译基于单片机的汽车防盗报警系统设计定.doc
Based on monolithic integrated circuit automobile security alarm system designAbstract: Decodes the automobile security system using them on litchis integrated circuit interior resources realization jump code, it each time uses the remote control password all is changing, both enhanced the system security, and greatly reduced the cost.Keyword: Monolithic integrated circuit, Automobile security system , Code/decodeIntroductionIs unceasingly progressive along with the social economy and the high tech rapid development, in the routine work and the life, the automobile has become the people ideal transportation vehicle. But the following motor vehicle the case which robbed gradually is also in creased has created the pilot economical property loss. In order tore duce the automobile to rob the event the formation rate, for has the automobile the user to provide the safety control, simply develops one kind to be reliable, the ease of operation, can send out in the discovery normal condition to the pilot reports to the police the reminder and the security warning safety system has the practical significance. This article based on to the existing automobile security alarm system generalized analysis, develops one kind of brand-new security alarm system. This system has mainly used the jump code code/decoding principle, causes the overall system to be safer, greatly reduces password explaining rate.1. System principle of workThe automobile security alarm system the remote control which carries by the driver and installs in the automobile the controller two parts composes. The remote control and the controller all use eight CMOS which American AT-MEL Corporation produces the AVR monolithic integrated circuit, this series monolithic integrated circuit based on new simplifies instruction R the ISC structure, includes the service life most to be few is 1,000 time writes/scratches the circulation the Flash program memory, as well as the service life at least is 100,000time writes/scratches the circulation E the EPROM data-carrier storage, some 2 only have when the entire piece cleaning can clean the programming encryption locks the localization.1.1 System designThe automobile security examination uses the ultrasonic sensor. The ultrasonic sensor is composed by the ultrasonic wave transmission circuit and the supersonic reception electric circuit, in the automobile cab appropriate position, installs the ultrasonic wave launch/receiver, as well as switch electric circuit T1. When the automobile parks the vehicle owner person must leave the automobile, with remote control closed switch T1, the automobile alarm system sat garrisons the condition, around the system use ultrasonic wave examination vehicle obstacle. Launches the partial electric circuits likes chart 1 to show. When its P1 mouth P1.1, P1.2 to the D trig , the P1.0 control ultrasonic wave launch, are 0, the photo electricity coupler outputs the TP1 end is 1, the permission ultrasonic wave launch, launches/the receive ultrasonic wave in turn, the circulation repeatedly carries on. Simultaneously the monolithic integrated circuit interior counter starts to count. The steam distance between vehicles obstacle distance is the time which sends out through the sound navigation and ranging reflects spends determines and carries on the computation. The reflection signal causes the D trigger to produce interrupt request signal INT1,simultaneously stops counting, reads takes counts the value, calculates the actual distance after the formula, then carries on the comparison with the datum distance, if examines when the actual distance is bigger than reference value 80cm, does not carry on the accustom-optics to report to the police; If some people approach the automobile to enter the cab, the examination actual distance is smaller than or was equal to when reference value 80cm, through monolithic integrated circuit P2.2 and the P2.3 port, actuates the indicating lamp display circuit and the sound alarm circuit, sends out three two flash. And triggers a high level, the actuation is wire less signal transmission circuit.Chart 1 Ultrasonic wave transmission circuit1.2 Code/decoding principleThe present automobile remote control security system are many is usesVD5026/27, PT2262/72, HT12E/D and so on the general code/decodes the electric circuit, its password decided by the component address, each set of security systems use a fixed invariable password. Along with the micro processing technology development, through the receiver emote control transmitting message, may intercept this fixed password, moreover general arranges the decoding address to lose the person to carry the component size limit, its quantity is impossible too much, can obtain not repeatedly codes very is also limited, also can very quickly explain the password with the automatic scanner. Therefore, this kind of password fixed invariable automobile security system has received the serious threat. Decodes the automobile security system using the monolithic integrated circuit interior resources realization jump code, it each time uses the remote control password all is changing, with the password no longer duplicates uses, causes the interception password also is makes a futile effort, in addition, it may increase the enough many passwords figure, enhances the system resistance illegal scanning the ability. The remote control coding altogether has 12 bytes, separately by 3 bytes codes channels code, 3 bytes codes forewords number, 5 bytes jumps codes, 1 byte pressed key operation code is composed. Encoded front adds on logic in each byte 0 to take the outset position, encoded behind adds on a logical 1 achievement in each byte to stop the position, and in most front adds on several logic 1 to take the guidance signal, this constituted the serial coded signal which uses in to transmit. The code channel code uses in to express the remote control status; each set of systems use a fixed channel code. The code foreword number uses in to record the encoded order, its starting value is 0, the monolithic integrated circuit every time codes a time, the code foreword number upwardly counts time. The code channel code and the code foreword number deposits in monolithic integrated circuit EEPROM, guarantees them power cut the influence. The jump code is the systematic true password, it passes through the complex special algorithm by the code channel code and the code foreword number to extract, this special algorithm foreign security. The pressed key operation code by the pressed key which presses was decided, when "the hypothesis" the key is pressed down, its code decides as 0 1H; When "relieves" the key presses down, its code decides as 00H. Whether is the decoding confirms receive the code legitimate a series of operating process. Was confirmed the legitimate code needs to satisfy three conditions; (1) codes the channel code and the decoding channel code is same; (2) coded the foreword number to be bigger than the decoding foreword number (decoding foreword number to record on legitimately has used code foreword number, this condition might guarantee before has used code was invalid); (3) jumps the code to be equal to reuses the special algorithm to extract changes the code. After the monolithic integrated circuit confirmed receives is the legitimate code, writes the code foreword number in the decoding foreword number, and completes corresponding operation processing according to the operation code. The decoding channel code and the decoding foreword number also deposits in monolithic integrated circuit EEPROM, guards against because of power cut loses.1.3 Security reports to the police realizationIf will have robber Chen ZheRu the room, starts the automobile, after wrong password, then the automobile storage battery +12V voltage, the ignition electric current way ignition lock, the ignition outage, the engine extinguishes, again starts, will duplicate the above process, like this, the bandits and thieves always will not be able to start the automobile, will not be able to achieve its anticipated goal. The alarm circuit mainly is composed by the integrated block and the speaker and electronic switching SCR. Triode or the multiple-unit tube, are for enhance the electric circuit measure which the power but often uses, it has composed a current amplification factor very big equivalent transistor, total enlargement factor for these two enlargement factor product. SCR is the electronic switching which constitutes by the silicon-controlled rectifier, the electric capacity and the resistance constitution negative booster concurrently filter, provides +3 +4V to IC the voltage, IC is traces Draws up sound reports to the police the integrated circuit, the alarm apparatus by the SCR control, robs the vehicle thief once after the wrong password, then the storage battery electric current enters the security system besides a group, another group is started in the engine, after leads the engine work, natural contact output voltage, after the differentiating circuit, silicon-controlled rectifier SCR is triggered, also passes through the resistance to fall the pressure, the voltage adds in the IC power source input end, IC obtains the voltage output alarm, enlarges after the multiple-unit tube, Destroys moves the speaker to send out resoundingly reports to the police the sound. when static state, entire electric circuit does not consume the electricity.2. Software designThe alarm apparatus software design mainly divides into: Master routine (alarm apparatus initialization, key modulation and decoding); Alarm apparatus interrupt handling routine. This alarm apparatus installs on the automobile steering wheel. After installs, starts the alarm apparatus, the alarm apparatus automatically retards2030s to start to work, in order to lets use the person to have the enough time to lock the gate to leave the automobile. After the time delay the alarm apparatus enters the value to defend the active status, once the vehicle door is turned on or the windowpane hits garrulously, the oscillation pick-up examines the signal, time delay 20s starts to report to the police. The time delay goal is the master which causes the automobile is opening the gate to enter the vehicle internal energy closure alarm apparatus, in order to avoid reports to the police by mistake.2.1 Master routineThis part mainly completes to each severance entrance hypothesis, and reports to the police the depositing unit initialization to each fixed unit, establishes the special symbol value and to the pressed key interrupts processing. Master routine design diagram like chart 2 shows.Chart2 master routine frame chart2.2 Alarm apparatus interrupt handling routineThe burglar alarm disposal procedure uses time severance inquiry processing, each time severance, only is inquires each kind of control flag bit, controls each group output according to its condition. The procedure has not used has circulation processing the way, therefore time control conclusion, cannot eliminate controls the flag bit, only is repositions the scene, the waiting next time severance, again judges whether controls the conclusion.3. Concluding remarkUses automobile security alarm system cost which this kind of monolithic integrated circuit composes low, performance reliable, simultaneously settles the extension to be convenient. The use jump code code/decoding principle, causes the system to be safer, greatly reduces password explaining rate, will obtain the wide spread application in the future automobile security alarm system.基于单片机的汽车防盗报警系统设计摘要: 应用单片机内部资源实现的跳变编码/解码汽车防盗系统,它每次使用的遥控密码都在变化,既提高了系统的安全性,又大大降低了成本。关键词: 单片机 汽车防盗系统 编码/解码引言 随着社会经济的不断进步和高科技的飞速发展,在日常工作和生活中,汽车已成为人们理想的交通工具。但随之而来的机动车辆被盗的案件也逐渐增多,造成了驾驶员经济财产的损失。为了减少汽车被盗事件的发生率,给拥有汽车的用户提供安全保障,研制一种简单可靠、操作方便,能在发现不正常情况下给驾驶员发出报警提醒和防盗警报的安全系统具有实际意义。本文基于对现有汽车防盗报警系统的综合分析,开发出一种全新的防盗报警系统。该系统主要使用了跳变码的编码/解码原理,使得整个系统更加安全,大大降低密码破解率。1. 系统工作原理汽车防盗报警系统由司机携带的遥控器和安装在汽车内的控制器两部分组成。遥控器和控制器都用美国AT-MEL 公司生产的八位C MOS 型 AVR 单片机,该系列单片机基于新的精简指令R ISC 结构,含有使用寿命最少为1000 次写/擦循环的 Flash 程序存储器,以及使用寿命至少为 10万 次写/擦循环的E EPROM 数据存储器,有 2 位只有在整片擦除时才能擦除的编程加密锁定位。1.1总体设计汽车防盗的检测,采用超声波传感器。超声波传感器由超声波发射电路和超声波接收电路组成,在汽车驾驶室的适当位置,装设超声波发射/接收器,以及遥控开关电路T1。当汽车停放车主人要离开汽车时,用遥控器闭合开关T1,汽车报警系统处于设防状态,系统利用超声波检测车周围的障碍物。发射部分电路如图 1 所示。它的 P1 口的 P1.1、P1.2对 D 触发器初始化,P1.0 控制超声波发射,为 0时 ,光电耦合器输出TP1 端为 1,允许超声波发射,依次发射/接收超声波,循环反复进行。同时单片机内部的计数器开始计数。汽车距障碍物的距离是通过声纳发出到反射回来所花费的时间来测定并进行计算的。反射信号使 D 触发器产生一个中断请求信号INT1,同时停止计数,读取计数值,经公式计算出实际距离,然后与基准距离进行比较,如果检测的实际距离大于参考值80cm时 ,不进行声光报警;如果有人靠近汽车进入驾驶室,检测的实际距离小于或等于参考值 80cm时,通过单片机的P2.2 和P2.3 端口,驱动指示灯显示电路和声音报警电路,发出三声二闪光。并触发一个高电平,驱动无线信号发射电路。 图1 超声波发射电路 1.2 编码/解码原理目前的汽车遥控防盗系统多是使用 VD5026/27、PT2262/72、HT12E/D 等通用的编码/解码电路,其密码由器件的地址来决定,每套防盗系统使用一个固定不变的密码。随着微处理技术的发展,通过接收遥控发射信号,就可以截获到这一固定的密码,而且一般的编解码器的地址输人端受器件尺寸限制,其数量不可能太多,能得到的不重复编码也就很有限,用自动扫描器也能很快破解密码。因此,这类密码固定不变的汽车防盗系统已受到严重的威胁。应用单片机内部资源实现的跳变编码/解码汽车防盗系统,它每次使用的遥控密码都在变化,用过的密码不再重复使用,使得截获密码也是徒劳无功,此外,它可以增加足够多的密码位数,以提高系统抗击非法扫描的能力。遥控编码共有12个 字节,分别由3字 节编码通道码、3 字节编码序号码,5 字节跳变编码、1 字节按键操作代码组成。在每个字节编码的前面加上一位逻辑 0 作为起始位,在每个字节编码的后面加上一位逻辑 1 作为停止位,并在最前面加上几位逻辑1 作为引导信号,这就构成了用于发送的串行编码信号。编码通道用于表示遥控器的身份,每套系统使用一个固定的通道码。编码序号码于记录编码的次序,其初始值为0 ,单片机每编码一次,编码序号码就向上计数一次。编码通道码和编码序号码存放在单片机的 EEPROM中,确保它们不受停电影响。跳变编码是系统的真正密码,它由编码通道码和编码序号码经过复杂的特殊算法求出,该特殊算法对外保密。按键操作代码由被按的按键来决定,当“设定”键被按下时,其代码定为0 1H;当“解除”键被按下时,其代码定为 00H。解码是确认接收的编码是否合法的一系列操作过程。被确认合法的编码要满足三个条件;(1)编码通道码与解码通道码相同;(2)编码序号码大于解码序号码(解码序号码记录了上次合法使用过的编码序号码,该条件可保证以前使用过的编码无效);(3)跳变码等于重新用特殊算法求出的变码。当单片机确认收到的是合法编码后,就把编码序号码写到解码序号码中,并根据操作代码去完成相应的操作处理。解码通道码和解码序号码也存放在单片机的EEPROM中 ,以防因停电而丢失。1.3 防盗报警的实现若有盗车者入室,发动汽车,输入错误的密码后,则汽车电瓶的+12V 电压,点火电流途经点火开关,点火电流中断,发动机熄灭,再启动,将重复上述过程,这样,盗贼始终不能将汽车开动,不能达到其预期目的。报警电路主要由集成块及扬声器和电子开关SCR组成。其中三极管或复合管,是为了提高功率而常采用的电路措施,它组成了一个电流放大倍数很大的等效晶体管,总放大倍数为这两管放大倍数的乘积。SCR 是由可控硅构成的电子开关,电容和电阻构成降压器兼滤波器,给IC提供+3 +4V的电压,IC为摸拟声报警集成电路,报警器由SCR控制,盗车贼一旦按错密码后,则电瓶电流除一路进入防盗系统外,另一路是在发动机被启动,带动发动机工作后,其中性接点的输出电压,经微分电路,可控硅SCR被触发,又经电阻降压,电压加在IC 的电源输入端,IC获得电压输出报警信号,经复合管放大,推动扬声器发出响亮的报警声。而在静态时,整个电路不耗电。2. 软件设计报警器软件设计主要分为:主程序(报警器初始化、键控和解码);报警器中断处理程序。 该报警器安装在汽车方向盘上。安装好后,启动报警器,报警器自动延迟2030s开始工作,以便让使用人有足够的时间锁好门离开汽车。延时后报警器进入值守工作状态,一旦车门被打开或窗玻璃被敲碎,振动传感器检测到信号,延时 20s开始报警。延时的目的是使汽车的主人在开门进入车内能关闭报警器,以免误报警。图2 主程序框架图2.1 主程序这一部分主要完成对各中断入口的设定,对各锁定单元和报警存放单元的初始化,设定特殊的标志值及对按键的中断处理。主程序设计框图如图 2所 示。2.2 报警器中断处理程序防盗报警器的处理程序采用时间中断查询处理,每一次时间中断,仅是去查询各种控制标志位,根据它的状态来控制各路输出。程序没有采用有循环处理的方式,所以控制未结束时,不能清除控制标志位,仅是复位现场,等待下一次时间中断,再判断是否控制结束。3. 结语使用这种单片机组成的汽车防盗报警系统成本低、性能可靠,同时安转方便。使用跳变码的编码/解码原理,使得系统更加安全,大大降低密码破解率,在未来的汽车防盗报警系统中将得到广泛的应用。