本科毕业论文-基于51单片机控制的红外报警器设计.doc_第1页
本科毕业论文-基于51单片机控制的红外报警器设计.doc_第2页
本科毕业论文-基于51单片机控制的红外报警器设计.doc_第3页
本科毕业论文-基于51单片机控制的红外报警器设计.doc_第4页
本科毕业论文-基于51单片机控制的红外报警器设计.doc_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

基于单片机控制的红外报警器设计一、选题背景及类型1.1背景现代社会智能化水平越来越高,给我们的生活带来了很大便利。人们对安全有了很高的要求,以前的机械报警器已经不能满足人们对安全的要求了,电子报警器代替了机械报警器,电子报警器安装方便,成本价格低,安全性高,已经走进人们的视野,在对于企业来讲,高端技术的应用能够给企业带来很高的利润,减少不必要的安全损失或者是财产损失;对于居民而言,生活水平的提高使大部分人都住进了楼房,安全问题就出现了,为了防止不必要的损失,加强自身财产的安全管理,使用报警器就是必然的了。这不仅加强了安全,而且还使得我们应用更方便、更经济,为此更准确与更经济的控制方式使我们一直追求的目标。单片机控制的红外线报警器就是一种比较实用而且价格实惠的报警器,在这方面的应用是比较好的。1.2报警器的分类报警器是一种为防止或预防某事件发生所造成的后果,以声音、光、气压等形式来提醒或警示我们应当采取某种行动的电子产品。分为两种报警器:机械报警器和电子报警器。随着科技的进步,机械式报警器越来越多地被先进的电子报警器代替,经常应用于系统故障、安全防范、交通运输、医疗救护、应急救灾、感应检测等领域,与社会生产密不可分。以下是常见的报警器。(1)气体报警器(2)烟雾报警器(3)燃气报警器(4)可燃性气体报警器(5)红外线报警器本文主要介绍的是红外线报警器,以下就着重说一下有关红外线报警器的一些知识。红外线报警器分为主动式和被动式两种。主动式红外线报警器,是报警器主动发出红外线,红外线碰到障碍物,就会反弹回来,被报警器的探头接收。如果探头监测到,红外线是静止不动的,也就是不断发出红线线又不断反弹的,那么报警器就不会报警。当有会动的物体触犯了这根看不见的红线的时候,探头就会检测到有异常,就会报警。 被动式报警器少了一项功能,就是发射红外线。物理学上告诉我们,当物体的温度高于0K的时候,就会发出红外线,换句话说任何物体都能发出红外线。而其后的原理,被动式报警器和主动式是一样的。 红外线报警器对温度敏感,温度越高的物体辐射出的红外线越强,当感应到环境中存在高出背景强度的辐射时,就触发反警。把报警主机通电放在固定位置,把报警探头挂在约2米高的地方,使其向前下方倾斜,以获得较高的灵敏度。接通电源,经过1分钟左右的延时后,报警器进入警戒状态,这时,若有人进入监控区,即刻报警。报警约1分钟,自动停止。然后重新处于警戒状态。主人进入时,首先按一下遥控器上的关机键,随着报警器一声“嘀”响,即关闭了报警器,进入警戒区也不再报警。当主人离开警戒区后,按一下开机键,随一声“嘀”响,报警器重处于警戒状态。遇到紧急情况,按一下紧急报警键,报警器即紧急报警。报警器内设有高,中,低三档灵敏度调整,用户可根据需要自行调整。二、硬件部分2.1DS18B20(温度传感器)的简介 基于单片机控制的红外报警器中的传感器是DS18B20(温度传感器),该传感器由DALLS半导公司生产的DS18B20型单线智能温度传感器,属于新一代适配微处理器的智能温度传感器,可广泛用于工业、民用、军事等领域的温度测量及控制仪测控系统和大型设备中。它具有体积小,接口方便,传输距离远等特点。下面主要是温度传感器的性能特点、内部结构及控制方法。2.1.1DS18B20性能特点(1)采用单总线专用技术,既可通过串行口线,也可通过其它I/O口线与微机接口,无须经过其它变换电路,直接输出被测温度值(9位二进制数,含符号位)。(2)测温范围为-55-+125,测量分辨率为0.0625。(3)内含64位经过激光修正的只读存储器ROM。(4)适配各种单片机或系统机。(5)用户可分别设定各路温度的上、下限。(6)内含寄生电源 。2.1.2DS18B20内部结构 DS18B20内部结构主要由四部分组成:64位光刻ROM(它是出厂前被光刻好的,它可以看作是该DS18B20的地址序列号。不同的器件地址序列号不同。),温度传感器,非挥发的温度报警触发器TH和TL,高速暂存器。DS18B20的管脚排列如图1所示。 图1DS18B20引脚分布图 2.1.3DS18B20控制方法 在硬件上,DS18B20与单片机的连接有两种方法,一种是Vcc接外部电源,GND接地,I/O与单片机的I/O线相连;另一种是用寄生电源供电,此时UDD、GND接地,I/O接单片机I/O。无论是内部寄生电源还是外部供电,I/O口线要接5K左右的上拉电阻。 DS18B20有六条控制命令,如表1所示: 指 令约定代码操 作 说 明 温度转换44H启动DS18B20进行温度转换 读暂存器BEH读暂存器9个字节内容 写暂存器4EH将数据写入暂存器的TH、TL字节 复制暂存器48H把暂存器的TH、TL字节写到E2RAM中 重新调E2RAMB8H把E2RAM中的TH、TL字节写到暂存器TH、TL字节 读电源供电方式B4H启动DS18B20发送电源供电方式的信号给主CPU CPU对DS18B20的访问流程是:先对DS18B20初始化,再进行ROM操作命令,最后才能对存储器操作,数据操作。DS18B20每一步操作都要遵循严格的工作时序和通信协议。如主机控制DS18B20完成温度转换这一过程,根据DS18B20的通讯协议,须经三个步骤:每一次读写之前都要对DS18B20进行复位,复位成功后发送一条ROM指令,最后发送RAM指令,这样才能对DS18B20进行预定的操作。2.21602液晶屏 液晶显示器以其微功耗、体积小、显示内容丰富、超薄轻巧的诸多优点,在袖珍式仪表和低功耗应用系统中得到越来越广泛的应用。液晶显示器可以分为两大类,一类是点阵型,另一类是字符型。点阵型通常面积较大,可以显示图形;而一般的字符型液晶只有两行,面积小,只能显示字符和一些简单的图形,简单易控制且成本低。与此同时1062液晶屏的实用性很高。下面简要的说明一下它的电气连接。1.1电气连接1602液晶屏采用标准的16脚接口,定义如下表2所示: 表2 1602液晶屏的引脚定义注: (1) 液晶显示偏压信号:是指用于驱动1602液晶屏上的像素点改变颜色所用的电压,此电压可能接近GND,本实验板所用的1602液晶是接近GND。 (2) 读写选择端是用于控制对液晶的读和写的信号,在本实验板内被直接连接在GND上,即采用只写不读的方式(只要在两次写中间加适当的延时即可)。第1脚:VSS为地电源。第2脚:VDD接5V正电源。第3脚:V0为液晶显示器对比度调整端,接正电源时对比度最弱,接地电源时对比度最高,对比度过高时会产生“鬼影”,使用时可以通过一个10K的电位器调整对比度。第4脚:RS为寄存器选择,高电平时选择数据寄存器、低电平时选择指令寄存器。第5脚:RW为读写信号线,高电平时进行读操作,低电平时进行写操作。当RS和RW共同为低电平时可以写入指令或者显示地址,当RS为低电平RW为高电平时可以读忙信号,当RS为高电平RW为低电平时可以写入数据。第6脚:E端为使能端,当E端由高电平跳变成低电平时,液晶模块执行命令。第714脚:D0D7为8位双向数据线。 第1516脚:空脚。图2 1602液晶屏2.3蜂鸣器蜂鸣器发声原理是电流通过电磁线圈,使电磁线圈产生磁场来驱动振动膜发声的,因此需要一定的电流才能驱动它,单片机IO引脚输出的电流较小,单片机输出的TTL电平基本上驱动不了蜂鸣器,因此需要增加一个电流放大的电路。实验板通过一个三极管Q1来放大驱动蜂鸣器。蜂鸣器的正极接到Q1的集电极C极上面,蜂鸣器的负极地,三极管发射极E极接电源VCC,基级B经过限流电阻R33后由单片机的P1.7引脚控制,当P1.7输出高电平时,三极管T1截止,没有电流流过线圈,蜂鸣器不发声当P17输出低电平时,三极管导通,这样蜂鸣器的电流形成回路,发出声音。因此,我们可以通过程序控制P1.7脚的电平来使蜂鸣器发出声音和关闭。程序中改变单片机P1.7引脚输出波形的频率,就可以调整控制蜂鸣器音调,产生各种不同音色、音调的声音。另外,改变P1.7输出电平的高低电平占空比,则可以控制蜂鸣器的声音大小。2.4stc89c51单片机2.4.1简介单片机又称单片微控制器,它不是完成某一个逻辑功能的芯片,而是把一个计算机系统集成到一个芯片上。概括的讲:一块芯片就成了一台计算机。它的体积小、质量轻、价格便宜、为学习、应用和开发提供了便利条件。同时,学习使用单片机了解计算机原理与结构的最佳选择.可以说,二十世纪跨越了三个“电”的时代,即电气时代、电子时代和现已进入的电脑时代。不过,这种电脑,通常是指个人计算机,简称PC机。它由主机、键盘、显示器等组成(如图1所示)。还有一类计算机,大多数人却不怎么熟悉。这种计算机就是把智能赋予各种机械的单片机(亦称微控制器,如图2所示)。顾名思义,这种计算机的最小系统只用了一片集成电路,即可进行简单运算和控制。因为它体积小,通常都藏在被控机械的“肚子”里。它在整个装置中,起着有如人类头脑的作用,它出了毛病,整个装置就瘫痪了。现在,这种单片机的使用领域已十分广泛,如智能仪表、实时工控、通讯设备、导航系统、家用电器等。各种产品一旦用上了单片机,就能起到使产品升级换代的功效,常在产品名称前冠以形容词“智能型”,如智能型洗衣机等。现在有些工厂的技术人员或其它业余电子开发者搞出来的某些产品,不是电路太复杂,就是功能太简单且极易被仿制。究其原因,可能就卡在产品未使用单片机或其它可编程逻辑器件上。在红外线报警器当中我们应用的单片机是stc89c51单片机,由它来控制报警器的运行。2.5红外对管红外对管是红外线发射管与光敏接收管,或者红外线接收管,或者红外线接收头配合在一起使用时候的总称。下面主要是对红外对管中红外线以及功能的说明。2.5.1红外线 在光谱中波长自0.76至400微米的一段称为红外线,红外线是不可见光线。所有高于绝对零度(-273.15)的物质都可以产生红外线。现代物理学称之为热射线。医用红外线可分为两类:近红外线与远红外线。 图3红外线发射管红外线发射管在LED封装行业中主要有三个常用的波段,如下850NM、875NM、940NM。根据波长的特性运用的产品也有很大的差异,850NM波长的主要用于红外线监控设备、875NM主要用于医疗设备、940NM波段的主要用于红外线控制设备。EG:红外线遥控器、光电开关、光电记数设备等。2.5.2功能说明(1)光敏接收管它是一个具有光敏特征的PN结,属于光敏三极管,具有单向导电性,因此工作时需加上反向电压。无光照时,有很小的饱和反向漏电流(暗电流)。此时光敏管不导通。当光照时,饱和反向漏电流马上增加,形成光电流,在一定的范围内它随入射光强度的变化而增大。(2)红外接收管功能与光敏接收管相似只是不受可见光的干扰,属于光敏二极管,只对红外线有反应。(3)红外线接收头就是在红外线接收管的基础上进行放大的信号的作用,类似与三极管的放大效果。三、软件部分3.1原理图与程序3.1.1原理图红外线报警器是由单片机最小系统以及其他元件组成的,单片机最小系统是其中不可缺少的,是其中的核心元件,下面是红外线报警器的原理图。 图4 红外线报警器原理图3.1.2以下是基于单片机控制红外线报警器的程序 #include#include#include #include LCD1602.h#include ds18b20.c#include 38khz.c#define uchar unsigned char#define uint unsigned intsbit OUT=P22;sbit P32=P32;uchar bInt0 = 0;uint mstcnt=0;uchar t,set;bit outflag;bit write=0;bit flag;bit flag2;bit TR1_flag; /控制蜂鸣器报警uchar code str0= system running ;uchar code str1= OK SA: . C;uchar code str2=wrong SA: . C;void init_timer0(void); void displayfun1(void);uchar ReadOneChar(void);void WriteOneChar(unsigned char dat);void ReadTemperature(void);void playalarm(void); void displayfun1(void)WriteCommandLCM(0x0c,1); DisplayListChar(0,0,str0);/DisplayListChar(0,1,str1); DisplayOneChar(11,1,temp1/10+0x30); DisplayOneChar(12,1,temp1%10+0x30);DisplayOneChar(14,1,temp2/10+0x30);void display() if(!TR1_flag) / 为0时显示OK,为1时显示WRONG DisplayListChar(0,1,str1); displayfun1(); delay_LCM(1000); else DisplayListChar(0,1,str2); displayfun1(); delay_LCM(1000); /*timer t0 initialization*/void init_timer1(void) TMOD=TMOD|0x12; TH1=0x3c; TL1=0xb0; EA=1; ET1=1; /TR1=1; void timer1(void) interrupt 3 using 0 TH1=0x3c; TL1=0xb0; /OUT = OUT; OUT = 1;/蜂鸣器长鸣 mstcnt+; if(mstcnt=400)/蜂鸣器响10秒 mstcnt=0; TR1 = 0;TR0 = 1; flag = 0; /停止报警,进入正常模式TR1_flag = 0;/切换显示OUT = 0;/*the main funtion*/ void main(void) int_mcu(); P1=0xff; / initialize p1delay_LCM(500); /500ms time delayinitLCM( ); /initialize LCDinit_timer1( ); /initialize Timer0 Init_DS18B20( ); /initialize Ds18b20DisplayListChar(0,0,str0);DisplayListChar(0,1,str1); /out_high();/测试输出38k载波 TR1_flag = 0; while (1) /TR0 = 1; if(!flag) /flag为0时正常显示,为1时执行报警 OUT = 0; TR0 = 1;TR1_flag = 0; ReadTemperature(); /read temperaturedisplay();/for(m=0;m8;m+) /读取P32状态8次,若有高电平则报警 / if(P32) delay_LCM(50); if(P32) flag = 1; flag2 = 1; TR1_flag = 1; else delay_LCM(100); / else if(flag2) TR0 = 0;/关定时器0,停止发送脉冲 TR1 = 1;/启动定时器1,蜂鸣器响 display(); flag2 = 0; 附录以下是红外线报警器的实物图图5红外线报警器实物为你提供优秀的毕业论文参考资料,请您删除以下内容,O(_)O谢谢!A large group of tea merchants on camels and horses from Northwest Chinas Shaanxi province pass through a stop on the ancient Silk Road, Gansus Zhangye city during their journey to Kazakhstan, May 5, 2015. The caravan, consisting of more than 100 camels, three horse-drawn carriages and four support vehicles, started the trip from Jingyang county in Shaanxi on Sept 19, 2014. It will pass through Gansu province and Xinjiang Uygur autonomous region, and finally arrive in Almaty, formerly known as Alma-Ata, the largest city in Kazakhstan, and Dungan in Zhambyl province. The trip will cover about 15,000 kilometers and take the caravan more than one year to complete. The caravan is expected to return to Jingyang in March 2016. Then they will come back, carrying specialty products from Kazakhstan A small art troupe founded six decades ago has grown into a household name in the Inner Mongolia autonomous region. In the 1950s, Ulan Muqir Art Troupe was created by nine young musicians, who toured remote villages on horses and performed traditional Mongolian music and dances for nomadic families. The 54-year-old was born in Tongliao, in eastern Inner Mongolia and joined the troupe in 1975.He says there are 74 branch troupes across Inner Mongolia and actors give around 100 shows every year to local nomadic people. I can still recall the days when I toured with the troupe in the early 80s. We sat on the back of pickup trucks for hours. The sky was blue, and we couldnt help but sing the folk songs, Nasun says. The vastness of Inner Mongolia and the lack of entertainment options for people living there, made their lives lonely. The nomadic people were very excited about our visits, Nasun recalls. We didnt have a formal stage. The audience just sat on the grass. Usually, the performances became a big party with local people joining in. For him, the rewarding part about touring isnt just about sharing art with nomadic families but also about gaining inspiration for the music and dance. Ulan Muqir literally translates as red burgeon, and todays performers of the troupe still tour the regions villages and entertain nomadic families, but their fame has spread around the world. On May 16 and 17, nearly 100 singers and dancers from the troupe performed at Beijings Poly Theater. Their show, titled Ulan Muqir on the Grassland, depicted the history and development of the art troupe. Being from the region allowed me to embrace the culture of Inner Mongolia and being a member of the troupe showed me where I belonged, Nasun, the art troupes president, who is also a renowned tenor, tells China Daily. During a tour in 1985, he went to a village and met an elderly local man, who told him a story about his friendship with a solider from Shenyang, capital of Northeast Chinas Liaoning province, decades ago. The solider gave the old man a handmade saddle when they bid farewell. The story inspired Nasun to write Carved Saddle, a song that later became one of his most popular numbers. Now, every year, Nasun recruits young singers and dancers for the troupe. The troupe has also designed a new repertoire, which is mostly based on the daily lives of Mongolian people, especially the lives of nomadic families, and has combined contemporary musical elements with folk songs of the region. Haimu, a 25-year-old khoomei (a local variant of overtone singing) singer, joined the troupe three years ago. Along with a six-member band, he performs fast songs and soft ones that he writesall while playing the horse-head fiddle.Although I learned the piano since childhood and grew up listening to various kinds of music, to me, the folk music of Inner Mongolia is the root, he says. Performing in remote villages is pleasant. I feel at home on the boundless grasslands, and the warm people there make me feel fulfilled. The first round of spring auction season in Beijing ended last week, but it failed to create much spring in the art market. Although two pieces of Chinese painting fetched more than 100 million yuan, the decline in trading volume and sale rate showed a downturn this year. In the “Grand View: Chinese Painting Highlight” session at China Guardian 2015 spring auctions, Pan Tianshous representative work Eagle, Rock and Flora hit a record auction price of 279 million yuan, while Li Kerans masterwork Jinggang Mountain fetched 126.5 million yuan, an unexpected high in recent years. However, the trading volume fells to 1.87 billion yuan from 2.22 billion yuan in the same period the year before. The Huangchen 2015 Spring Auctions, which recorded 42.5 million yuan in total sales, experienced the same. The section number went down to 5 from 12 compared to last year. According to expert Shao Jianwu, the art market did not attract much excitement this year due to the booming stock market and the persistent problems of forgery and fake deals. The two pieces of Chinese painting notched up high price this spring due to their own value not due to a revival in the market. The successful transaction of two works with a hammer price of more than 100 million yuan once again confirms that valuable and rare works of high quality always earn the long-lasting high price. Chinese painting and calligraphy is still the pillar of the market. However, the overall sales rate has dropped slightly, which reflects the demand for the ordinary auction goods has weakened,” said the president of China Guardians Hu Yanyan. Besides, the entry of new buyers also makes certain changes to the direction of purchasing. In a word, the overall market trend is very unpredictable. Although China Guardian 2015 Spring Auctions has achieved remarkable results, it does not mean that the market has walked out of the predicament. We still have to wait for the big economic boom to invigorate the art market.” Even so, the hot pursuit of some special items appeared this spring. A special session of China Guardian Spring Auctions titled “Fine GiltBronze Buddhist Images” achieved a great deal with total sales volume of 41.89 million yuan and 92 percent sale rate. The 5th Shamar Rinpoche Statue from 16-17th century of Tibet was sold for 5.06 million yuan. The Beijing Chengxuan Auctions featured almost 2,800 items of coins and stamps in three sessions with good sale rate. The Huachen Auctions also set a special session of photographs under the condition of large-scale decline of auction sessions. There was a palpable dull thud of disappointment that accompanied the return of the imperial entourage of Zhen Huan to her homeland. It followed a couple years of hushed excitement as Chinese fans were fed tidbits about their proud concubine who was supposed to conquer the high ground of the North American market. Zhen Huan is, of course, the title character of The Legend of Zhen Huan, a 2011 television series that swept China off its feet and later took other Asian countries by storm. Two years ago, it was reported that HBO, a premium cable service headquartered in the United States, was going to air it in North America after some modification. Now, a condensed version that provides English subtitles but no dubbing has finally been made available on Netflix for online streaming. This version, highly anticipated as a milestone in Chinas cultural foray overseas, has been widely panned by its home audience. Retitled Empresses in the Palace, the American version has been shortened from its original 76 episodes at 45 minutes each, to six 90-minute episodes. The quick pacing threw off many native viewers, who are accustomed to a more leisurely daytime-soap-style narrative rhythm. (Chinese TV stations would run two or three episodes every day.) I did not finish the full-length version and found the truncated one not difficult to follow. Whats lost, I believe, are the interesting setups and pauses that illuminate the Chinese art of storytelling. Much of the plot is still there. It is the flavor that was sacrificed. The American edition uses the framework of the Empress Dowager in her senior years reminiscing at the beginning and the end of each episode, hinting at whats to come and recapping the key points. This device, not used in the original, is culturally understandable but artistically mediocre. What puzzles me is the two new songs for the opening and end credits. They were written in English, but sung by Chinese with an uncomfortable accent. They were obviously designed to appeal to an English-speaking base, but do not jibe with the Chinese dialogue. Speaking of the dialogue, the English translation, picked apart by some Chinese, is too literal for my taste. I can imagine a typical American hit by a flurry of royal ranks, addresses and greetings, even multiple names and titles for the same person. The first half hour must be a swamp to wade through, very much like my experience of getting through a Tolstoy tome with its endless inflections of names transliterated into lengthy Chinese. I see the choice of verbatim translation as an effort for conveying exotica. It is fairly competent, with no error that I could detect, but fails to rise above words or capture the essence of the language. A cultural product usually crosses over to a foreign territory first by an emphasis on the commonalities. But whether inside or outside China, the temptation to sell it for the differences is just too great. Sure, the sumptuous sets and costumes are a big attraction, but the narrative technique has becomehow shall I put it?a bit anglicized, which is necessary for cultural export. Judging by the responses, this legend, which, contrary to the claim of the English trailer, is totally fictitious, has departed from China but not yet landed on American shores. I am a big fan of Ralph Waldo Emersons essay titled Self-Reliance. If youve not yet read it, I strongly encourage you to do so. In this essay, the venerable Emerson talks about eschewing the trappings of society and finding ones own path. He urges the reader to find rectitude and lead a moral life. He professes that, only by being self reliant

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论