基于AVR单片机的网络智能家居系统.docx
《基于AVR单片机的网络智能家居系统.docx》由会员分享,可在线阅读,更多相关《基于AVR单片机的网络智能家居系统.docx(86页珍藏版)》请在三一办公上搜索。
1、 密级: 无 硕 士 学 位 论 文 论文题目基于AVR单片机的网络智能家居系统作者姓名 王璋 指导教师 杨枨 副教授 学科(专业) 软件工程 所在学院 软件学院 提交日期 2008-05-20 A Dissertation Submitted to Zhejiang University for the Degree of Master of EngineeringTITLE: Net Smart Home System Based on MCU AVR Author: Wang ZhangSupervisor: Professor Yang ChengSubject: Software P
2、rojectCollege: College of Software TechnologySubmitted Date: May 20, 2008 摘要本课题来自本文作者为宁波某公司开发的智能门禁系统的改进版本。项目的原始要求是做一个普通的楼房门禁系统,用户可以通过该系统进行呼叫、接听、开门等操作。在项目开发后期,投资商提出为下一步开发作出研发性的要求。其具体要求为:在原来的基础上,对通讯方案和功能作出重大的改动。把原来的近距离通讯改为远程通讯;简单的呼叫功能改为智能远程控制;用户的界面采用最常用的PC机。这样就使得系统拥有了更高的科技性和实用性,并且具有挑战性,项目的可持续发展能力得到了显著
3、的提高。本课题的主要工作分以下三个部分:1) 下位机的功能模块:下位机采用AVR单片机作为核心部件,担当智能家居系统主控制器的中央处理部件。在本系统中采用28引脚的ATmega8L。它体积小,价格低,速度又和其它芯片一样快,非常适合做小型的开发。把网络通讯芯片连接到AVR单片机的SPI口上,通过高速的串行通讯来交换网络传输的数据。在本系统中使用新颖的ENC28J60芯片作为网络通讯器件,该器件功能全面,接口方便,有着先天的优势。用AVR的普通引脚模拟一个USB的通讯端口,作为从器件和PC机进行通讯,用来对智能家居系统主控制器的初始化配置。由于不使用额外的芯片,在功耗上、成本上、尺寸上,都可以进
4、行一定程度的压缩。2) 下位机和上位机的通讯模块:硬件上:使用ENC28J60快速以太网通讯芯片作为通讯模块的设备,连接到AVR单片机,通过SPI接口来进行通讯。软件上:ENC28J60芯片是一块底层的芯片,工作在链路层。所以,它的通讯最基本单位为MAC帧,用户需要自行编写驱动程序来对其进行控制。在封装好MAC帧以后,再进行ARP地址解析协议的编写,然后加入IP包、UDP包。总共进行三层驱动的封装。3) 上位机的功能模块:PC机上需要完成的工作须要和下位机的功能一一对应,主要制作的是串口和USB通讯两个模块。串口模块制作相对简单。USB模块需要编制Windows驱动程序,工作相当冗长,且没有太
5、多的扩展价值,所以使用国际通用的驱动程序。即使如此,USB驱动程序的理解和使用,仍然是需要展开研究的一个单独功能块。另外,在硬件驱动完备的情况下,还需要制作应用软件的开发。在制作成功的情况下,本系统被杭州环亚多媒体公司所采纳,将其应用到智能小区和博物馆建设中去,已经得到了用户的充分认可和接受,完全达到了用户预期的效果。在具体应用中,对智能化小区和博物馆管理,起到了高效、廉价的双重作用。我们会按用户的实际需求变更而开发更多、更具体的产品。本系统无论从理论上还是实际上,都满足了客户的研发和实际需要,从理论角度讲,本系统采用了一系列高效率、低成本的策略,使得系统的拥有很高的理论价值;从实际出发,该系
6、统只要进行包装整合,就可以成为一种产品,其低廉的价格,可以被广大群众所接受。关键词智能家居,JTAG,ISP,UDP数据报AbstractThe author of this topic from a company in Ningbo for the development of intelligent access control systems to improve the version. The original requirements of the project is to do an ordinary building access control systems, user
7、s can make calls through the system to receive, opened the door, and other operations. In the latter part of project development, investment made to develop a research and development for the next step of the request. Its specific requirements for: the original on the basis of the communications pro
8、grammes and functions to make significant changes. The original close-up communications to remote communications; simple call to function smart remote control, the user interface using the most commonly used PC. This makes the system has a higher technology and practicality, and challenging, the pro
9、jects capacity for sustainable development has been significantly improved. The main topic of this work points the following three parts: 1) The crew of the functional modules: The crew used AVR microcontroller as the core components, intelligent home systems play a main controller of the central pr
10、ocessing components. In the system used in 28-pin ATmega8L. Its small size, low prices, speed is as fast and other chips, is suitable for small-scale development. The network communications chip connected to the AVR microcontroller on the SPI mouth, through high-speed serial communication network to
11、 exchange data transmission. In the system used in the new chip as the ENC28J60 network communications devices, the device features a comprehensive and convenient interface, has inherent advantages. AVR with a simulation of the ordinary pin USB communications ports, as from the device and PC communi
12、cations, intelligent home systems for the main controller of the initial configuration. As the non-use of additional chips, in power consumption, cost, size, can be a certain degree of compression. 2) The crew and the host computer communication modules: Hardware: the use of ENC28J60 Fast Ethernet c
13、ommunications chips as communications equipment modules, connected to the AVR microcontroller, through the SPI interface for communication. Software: ENC28J60 the bottom of the chip is a chip, working in the link layer. Therefore, its the most basic unit of communication MAC frame, users need to pre
14、pare drivers to gain control over it. MAC in the frame after a good package, and ARP ARP for the preparation, and then join the IP packet, UDP packets. A total of a three-tier driver package. 3) PC function modules: On a PC needs to be done to the crew and the function of one-to-one, is mainly produ
15、ced by the two serial and USB communications module. Serial production of relatively simple modules. USB module requires the preparation of Windows drivers, lengthy work, and do not have much of the expansion of value, so use international drivers. Even so, USB drivers understanding and use of resea
16、rch is still needed a separate function block. In addition, hardware drivers complete the circumstances, also need to produce application software development. In the production of successful cases, Hangzhou, round-the system was adopted by the multi-media companies, its application to the Intellige
17、nt Community and the building of the museum, the user has been fully recognized and accepted, the user fully met the desired results. In specific applications, the Intelligent Community and museum management, played a highly efficient, low-cost dual role. We will change the users actual needs and th
18、e development of more and more specific products. Whether the system in theory or in practice, to meet the clients R & D and actual needs, from the theoretical point of view, this system uses a series of high efficiency, low-cost strategy, making the system has a high theoretical value from the real
19、ity Starting the system for as long as the packaging integration, can become a product, its low price, can be accepted by the masses.Key words: Smart Home, JTAG, ISP, UDP diagram目录摘要iAbstractiii图目录IV第1章 绪论11.1 研究背景11.1.1 智能家居系统的国内外现状21.1.2 智能家居系统的一般解决方案31.1.3 基于网络的智能家居系统41.2 研究内容51.3 研究目标71.4 本文结构组织
20、71.5 本章小结8第2章 系统框架和AVR核心板开发92.1 系统总体框架和接口设计92.2 AVR单片机介绍102.3 选用AVR单片机的原因112.4 AVR调试工具ATmega16/32 核心板开发112.5 本章小结16第3章 基于ENC28J60的网络模块设计173.1 引言173.2 相关工作173.3 ENC28J60芯片介绍173.3.1 ENC28J60芯片概述173.3.2 ENC28J60外部连接方案203.4 网络模块开发方案253.5 底层驱动方案293.5.1 ENC28J60存储器构成293.5.2 ENC28J60控制寄存器303.5.3 以太网缓冲器313.
21、5.4 PHY和MII寄存器323.5.5 SPI通讯接口323.5.6 ENC20J60底层驱动的编程接口333.6 UDP数据报封装353.6.1 TCP/IP协议简介353.6.2 网络接口层设计363.6.3互联网层设计403.6.4传输层设计443.7 本章小结46第4章 USB数据通讯方案474.1 引言474.2 相关工作474.3 USB的功能以及工作方式474.3.1 USB功能简介474.3.2 USB数据传输细节484.3.3 USB开发方案介绍494.4 下位机软硬件开发514.4.1 下位机硬件系统514.4.2 下位机软件系统534.5 上位机软件开发以及驱动应用5
22、54.5.1 上位机软件开发框架554.5.2 USB驱动程序应用554.5.3 USB应用程序开发574.7 本章小结58第5章 外部设备驱动方案595.1 引言595.2 相关工作595.3 外围设备的继电器驱动方案595.3.1 继电器简介595.3.2 继电器的单片机驱动方案605.4 红外数据收发方案605.5 本章小结61第6章 系统实现和测试626.1 引言626.2 相关工作626.3 AVR单片机核心板的测试636.4 ENC28J60网络通讯板的测试646.5 USB通讯模块的测试676.6 继电器和红外模块的测试686.7 本章小结69第7章 总结与展望707.1 本文完
23、成的主要研究工作707.2 本文的主要贡献以及创新点707.3 进一步的研究工作71参考文献72攻读硕士学位期间主要的研究成果75致谢76图目录图2.1 系统总体框架和接口设计图9图2.2 系统复位电路图12图2.3 晶振电路图13图2.4 JTAG仿真接口电路图14图2.5 基于AVR的ATmega32单片机核心板15图2.6 核心板对外接口15图3.1 ENC28J60芯片图18图3.2 典型的ENC28J60外部接口方案图20图3.3 外部晶振连接图21图3.4 磁性元件、端接元件和其它外部元件图22图3.5 I/O电平转换图23图3.6 LED工作方式配置图24图3.7 LED工作方式
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 AVR 单片机 网络 智能家居 系统
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-1667684.html