毕业论文(设计)论文题目基于单片机的智能小车设计与制作姓名王鹰学号___07531046___专业07电子信息工程指导教师张浩职称教授中国·合肥二0一一年六月2目录1引言············································································································32设计思想、方案选择及设计任务的指标·······························································42.1设计思想·····························································································42.2方案设计比较与选择·············································································52.2.1遥控模块···················································································52.2.2障碍物检测模块··········································································62.3设计指标及技术参数·····················································错误!未定义书签。3硬件电路设计·······························································································73.1智能寻迹小车系统框图及概述·································································73.2智能小车系统硬件电路图及单元电路························································83.2.1系统的硬件电路总体设计······························································83.2.2分布单元电路设计与功能概述························································83.3单元电路设计小结···············································································134软件程序设计······························································································134.1·········································································································164.2·········································································································184.2.1程序状态指示灯模块···································································184.2.2流水灯演示模块·········································································184.2.3数码管及跑马灯模块···································································194.2.4按键中断查询模块······································································194.2.5话筒声音识别模块······································································194.2.6光敏电阻及蜂鸣器模块································································204.2.7红外反射与直流电机驱动模块·······················································204.2.8串口通信模块············································································214.3单元模块程序设计小结·········································································215实物运行与测试结果以及结论·········································································215.1小车的运行情况··················································································225.2小车的测试结果及分析·········································································225.3结论··································································································236结束语········································································································23参考文献········································································································23英文摘要········································································································25致谢············································································································25附录A:系统总原理图······················································································26附录B:部分程序清单······················································································27附录C:········································································································33附录D:········································································································343基于单片机的智能小车设计与制作王鹰摘要:基于近几年大学生电子大赛中关于小车的研究,对此根据嵌入式系统的应用,提出了提出了一种以8位单片机作为系统大脑能实现智能循线避障避悬崖小车的设计方法,通过主芯片的32个完全IO端口,对这些端口加以信号输入电路,控制电路和执行电路,并且利用红外探头技术检测障碍物和搜集地面信息,采用AT89S52单片机进行适时控制,实现智能循线避障以及避悬崖。智能小车采用前轮驱动,两轮各用一个电机执行,用MAX232芯片来控制,前方和底部探头采用红外发射管和红外接收管进行障碍物检测以及地面信息的采集。关键词:AT89S52,寻线,避障,避悬崖,流水灯1引言随着汽车工业的迅速发展,关于汽车的研究也就越来越受人关注。全国大学生电子大赛和省内电子大赛中几乎每次都有关于小车这方面的题目,全国各高校也都很重视该题目的研究,可见其研究意义很大。本设计就是在这样的背景下提出的,指导教师已经有充分的准备。本题目是结合科研项目而确定的设计类课题。设计的智能电动小车应该具有智能寻迹、避障、避悬崖等功能。根据题目的要求,确定如下方案:在已有线路板及元器件的基础上,将传感器改为红外探头,将前方底部的两个步进电机改为用LG9110驱动的电机,再编写一段程序,通过COM1端口将程序下载至线路板上的STC单片机芯片里,使得LED灯和数码管具有程序指示作用以及跑马灯流水灯的演示,并且实现小车的防撞、避悬崖和寻迹。本设计以AT89S52为主芯片,通过P0.0,P0.1,P0.2,P0.3分别控制LG9110电机驱动,来驱动电机1和电机2,。由电机的正转与反转来完成小车的前进,后退,左转,右转等功能的基本动作。在小车前进时如果前方有障碍物,由红外发射管发射的红外信号被反射给红外接收管,且将此信号经过P3.7传送入AT89S52中,主芯片通过内部的代码进行小车的绕行,同时主芯片将P3.7的信号状态通过P2.5的LED灯显示出来;小车行走时P3.5与P3.6的红外接收探头会进行路面检测,当走到悬崖处时,端口将会收到一个电平信号,此电平信号通过相应端4口传送入主芯片中,以此来控制小车后退然后左转以避开悬崖前进;另外通过代码还附有程序状态指示功能,蜂鸣器的报警功能,夜间自动照明等功能。第三代单片机包括了Intel公司发展MCS-51系列的新一代产品,如8xC152﹑80C51FA/FB﹑80C51GA/GB﹑8xC451﹑8xC452,还包括了Philips﹑Siemens﹑ADM﹑Fujutsu﹑OKI﹑Harria-Metra﹑ATMEL等公司以80C51为核心推出的大量各具特色﹑与80C51兼容的单片机。新一代的单片机的最主要的技术特点是向外部接口电路扩展,以实现Microcomputer完善的控制功能为己任,将一些外部接口功能单元如A/D﹑PWM﹑PCA(可编程计数器阵列)﹑WDT(监视定时器)﹑高速I/O口﹑计数器的捕获/比较逻辑等。这一代单片机中,在总线方面最重要的进展是为单片机配置了芯片间的串行总线,为单片机应用系统设计提供了更加灵活的方式。Philips公司还为这一代单片机80C51系列8xC592单片机引入了具有较强功能的设备间网络系统总线----CAN(ControllerAreaNetworkBUS)。新一代单片机为外部提供了相当完善的总线结构,为系统的扩展与配置打下了良好的基础。本设计就采用了比较先进的89S52为控制核心,89S52采用CHOMS工艺,功耗很低,因