}
void lcd_delay(uchar x) { uint i,j; for(i=x;i>0;i--) for(j=10;j>0;j--); }
void main() { init_lcd(); trig=0; //首先拉低脉冲输入引脚 TMOD=0x01; //定时器0,定时器1,16位工作方式 IT0=0; //由高电平变低电平,触发外部中断 //ET1=1; //打开定时器1中断 EX0=0; //关闭外部中断 EA=1; //打开总中断0 while(1) //程序循环 { uchar num=0,i; for(i=0;i<20;i++) { EA=0; trig=0; trig_delay(); trig=1; //产生一个20us的脉冲,在Trig引脚 while(echo==0); //等待Echo回波引脚变高电平 succeed_flag=0; //清测量成功标志 EX0=1; //打开外部中断 TH0=0; //定时器1清零 TL0=0; //定时器1清零 TR0=1; //启动定时器1 EA=1; while(TH0 < 30);//等待测量的结果,周期65.535毫秒(可用中断实现) TR0=0; //关闭定时器1 EX0=0; //关闭外部中断 if(succeed_flag==1) { xx=((tH*256+tL)*340.0*12.0/11.0592/10000.0/2.0)*10; //微秒的单位除以58等于厘米 } //为什么除以58等于厘米, Y米=(X秒*344)/2
18
display(); // X秒=( 2*Y米)/344 ==》X秒=0.0058*Y米 ==》厘米=微秒/58 if(xx<200) num++; if(succeed_flag==0) { xx=0; //没有回波则清零 } } if(num>12) { baojing=0; num=0; } else { baojing=1; num=0; } } }
//*************************************************************** //外部中断0,用做判断回波电平
INTO_() interrupt 0 // 外部中断是0号 {
tH =TH0; //取出定时器的值 tL =TL0; //取出定时器的值
succeed_flag=1; //至成功测量的标志 EX0=0; //关闭外部中断 }
//****************************************************************
结论
本次毕业设计硬件上完成了一个89c52单片机的单通道语音信号处理平台的设计,并在此平台上用单片机汇编语言进行软件设计,经过测试,基本满足设计目标,可以完成各项基本功能。本系统开发空间大,接口方便,使用灵活,便于用户扩展功能。当然,由于时间关系,本次设计的系统也有某些不太完善的地方,如光敏电阻的使用,也不能实现调节光度和压缩浪费大量空间,有待进一步改善。
本文探索并实现了多功能视力保护器设计的完整过程。,该系统具有很高的使用价值,很好地达到了设计的目的;
19
本文创新点:1.发展了利用单片机设计视力保护器的思想,增加了单片机在现实生活中的应用。利用光敏电阻电路产生脉冲,通过辅助坐直传感器帮组学生坐直进而校正其视力,简单方便且不会产生系统稳定性方面的问题。
2.尽可能发挥系统优势,可以方便向其他功能扩展,也就是利用平台优势可以衍生更多功能。
参考文献
[1] 家庭电子1998年合订本.[J]1999. 212-214
[2] 康华光.电子技术基础模拟部分.[M]北京:高等教育出版社,2005.1-20 [3] 康华光.电子技术基础数字部分.[M]北京:高等教育出版社,2005.40-60 [4] 电子工艺实习.[J]成都,2003.1-23 [5] 电子技术实验.[J] 成都, 2005.1-20
[6] 电子线路设计实验测试第二版.[M]武汉:华中科大出版社, 2002.1-40
[7] 赵健.实用声光电及无线电遥控电路300例.[J]北京:中国电力出版社,2005.90-100 [8] 郑浩,高静.怎样用万用电表检测电子元器件修订本.[J] 北京:人民邮电出版社,2005.32-66
[9]全新实用电路集粹编辑委员会编著.全新实用电路集粹. [M]北京:机械工业出版社,2006.56-74
[10] 王新贤.通用集成电路速查手册第二版.[M] 山东科学技术出版社,22-57
[11] The Institute of Electrical and Electronics Engineers,Inc.IEEE Std 802.3,2000 edition,2000.44-94
20
致 谢
伴随论文的完稿,紧张而又充实的大学生活也将随之结束,回忆在唐山师院的学习生活,感触颇深。可以说,唐山的学习经历使我学到了许多更加珍贵的东西,这对我今后的学习工作和人生道路的选择很有意义。
我的毕业论文撰写工作自始至终都是在崔乃忠老师全面、具体的指导下进行的。崔乃忠老师知识渊博、待人热情,经常与我交流自己的想法,尽最大努力给予了我多方面指导。崔乃忠老师严谨的治学态度和对工作兢兢业业、一丝不苟的精神将永远激励和鞭策我认真学习、努力工作。
在和崔老师探讨问题过程中,崔老师的谆谆教导使我受益匪浅。在论文的写作过程中,老师提出了许多宝贵的意见,并不辞辛苦多次加以修改。从他身上,我不仅学到了科学的学习方式,还培养了不断追求创新的思维方式,同时教育了我要耐心的去干任何一件事,而不是急于求成。在此,我要向我的老师致以最衷心的感谢和深深的敬意。
同时也感谢太军君老师和杨俊锋老师的关心和帮助,他们在论文开题答辩过程中提出了很多宝贵的意见和建议。
最后,衷心地感谢在百忙之中评阅论文和参加答辩的各位老师。
21
Student to use visual design of
protection
Liu panshi Directed by Vice-prof.Cui Naizhong
Abstract: This paper presents a Multi-functional Sight protector based on Single-chip.
Discussed the 89c52-based single-chip hardware circuit and software design. And hardware based on this sensor alarm circuits, light intensity alarm circuit and alarm circuit from time to time. At present, single-chip microcomputer to control a variety of theoretical and practical application of system design is a cause for widespread concern. This paper introduces the development of SCM as well as the vision of the development of protective device, and control circuitry 89c52. This paper describes the use of c language programming methods have a pulse, and the use of single-chip timing function and assembly language to achieve the method from time to time. SCM can be a profound experience of the principles and design. Details of the hardware components of the system and its role, given the entire system software flowchart flow chart and some subroutines. Introduced the technology and promote the value of prospects. But the system still need to be put forward to solve some of the problems, and gives a possible way to solve these problems and methods. The design of ultrasonic technology as the main theory. Specific vision for the protection of the theory and hardware design of the study.
Based on the laboratory's existing hardware platforms, the study aims to complete multi-functional vision for the protection of the hardware development and design and complete the corresponding hardware production. Its content is divided into two parts : the right vision for the protection of the hardware design and production of hardware. In the design of the existence of effective ways to protect and enhance vision for accurate circuit debugging difficult. In hardware design, based on ultrasonic technology of multi-circuit protection of eyesight, ultrasonic receiver through the first right to receive the ultrasonic signal modulation output. achieve sound and light control circuit theory study a certain significance.
22
This paper describes the design based on the ultrasonic transmitter and receiver technology for the protection of multi-functional vision. Practice has proven through the vision Protection feasible good reliability and convenient. In this paper, and hope that through the electronic hardware production and theoretical research, for the latter part of the further design multifunctional vision for the protection and take reasonable measures to enhance the effectiveness of protection vision to provide reliable and effective source of data and information based.
Keywords: Sensor alarm light intensity alarm timer c language Ultrasonic
23