1、毕业设计(论文)材料之二(2)安徽工程大学机电学院本科毕业设计(论文)开题报告题目: 基于单片机路灯控制系统设计 课 题 类 型: 设计 实验研究 论文 学 生 姓 名: 学 号: 专 业 班 级: 教 学 单 位: 指 导 教 师: 开 题 时 间: 年 3月 13 日开题报告内容与规定一、本课题内容及研究意义1、论文研究目和意义如今,照明电路数量越来越多,使得路灯用电量占都市用电量比重越来越大,在用电高峰期时,电网超负荷运营,电网电压都低于额定值,在用电低谷期供电电压又高于额定值,当电压高时不但影响照明设备使用寿命,并且耗电量也大幅增长,当低谷时,照明设备有不能正常工作。因此,对都市路灯设
2、计已经成为了当务之急,特别是半夜之后车流量急剧减少时,应当恰当关闭路灯,节约用电。但是国内既节能又能延长路灯寿命技术相比国外却是落后了,因而路灯控制系统设计对于都市发展至关重要。本论文旨在设计一套对外界光线和电压信号采集来控制路灯自动启停以及智能调压控制系统,它能对路灯进行稳压、调压、自启动并延长路灯寿命作用。2、论文研究内容本设计可以通过对外界光线和电压信号采集来控制路灯自动启停以及智能调压从而减少都市路灯照明耗电量,又对输入电压进行稳压调节来提高用电效率。规定学生独立选取芯片、设计电路、编制程序、调试、完毕整个系统功能。重要内容如下:(1) 依照控制技术特点,进行路灯系统设计整体研究与设计
3、。(2) 针对光线和电压信号采集,采用数据采集技术。(3) 通过按键可对有关参数值进行设立,从而实现对不同步间进行不同开灯模式。(4) 当电压符合额定电压时,系统自动进行稳压。(5) 在半夜之后减少电压以调节路灯亮度,实现调压。二、本课题研究现状和发展趋势当前,路灯系统普通采用钠灯、水银灯、金卤灯等灯具。此类灯具备发光效率高、光色好、安装简易等长处,被广泛使用,但同步也存在着诸如:功率因子低、对电压规定严格、耗电量大等缺陷。国内当前大某些都市都采用全夜灯方式进行照明,普遍存在问题有两点:一方面由于后半夜行人稀少,采用全夜灯方式挥霍太大,因而,有地方采用前半夜全亮,后半夜全灭照明方式;有地方在后
4、半夜采用亮一隔一或亮一隔二节能办法,此种方式虽然节约了电费支出,却带来了社会治安和交通安全问题,不利于都市安全问题。另一方面,在后半夜因行人稀少,而应当减少路灯亮度,以避免光源污染,影响居民晚间休息。但由于后半夜是用电低谷期,电力系统电压升高,路灯反而比白天更亮了。这不但导致了能源挥霍,还大大影响了设备和灯具使用寿命。当前,路灯照明广泛采用高压钠灯,其设计寿命在1小时以上,在正常状况下至少可用3年,但是由于超压使用,当前路灯使用寿命仅仅只有1年左右,有甚至只有几种月,导致维护和材料极大挥霍。较高电压不但不能让负载设备更好工作,并且还会导致发热及过早损坏,还会导致不必要电费开支。并且,国内绝大多
5、数地区路灯关开灯都是采用人工控制或者定期控制,这样也有许多不利之处:若采用人工控制,则路灯开关存在着一定不拟定性,同步也占用了一定人力资源;定期控制则存在着夏冬季白黑昼时间不同状况,使得天还没黑路灯就开,天还没亮路灯就灭状况,大大影响了人们寻常出生活。本设计通过使用AT89C51单片机对系统进行智能控制,使系统达到自动启停及智能调压。近年来,随着科技不断发展,各种路灯控制器也被不断研究出来。其中,美国和日本重要集中在研究紧凑型荧光灯和镇流器荧光灯两个方面。而国内当前市场上有各种路灯节能控制产品,能达到一定节能效果,但就功能和效果上还不能尽如人意,重要有如下几种状况:第一种,采用自耦变压器及磁饱
6、和电抗器降压技术。其局限性是由于反映速度较慢,用电高峰时电压降到非稳定区容易导致灯光闪灭,不能自动调节,同步如果电压突然升高,则会对灯具导致损坏,相对来说稳压效果较差;第二种是采用电子器件构成可控硅式设备。该设备重要采用简朴相控技术,局限性之处是元器件较容易发热损坏。而为了更好达到控制目,当前国内外都开始采用智能控制方式,如光控、声控、时控等,国外甚至开始采用太阳能供能光控方式来控制路灯,基本可以达到完全自给自足效果。综上所述,将来智能路灯控制必将向着更安全、更环保、更节能、更高效率方向发展。三、 本课题研究方案及工作筹划1、设计方案本次课程设计是由传感器通过外界光信号强弱来产生电压信号,再由
7、单片机控制实现路灯自动启停及智能稳压。本设计通过使用AT89C51单片机芯片来设计电路,编制程序,仿真,调试,完毕整个系统功能。整个控制系统重要涉及四个模块:信号采集模块、数据解决模块、稳压模块和控制模块。2、技术路线设计规定采集输入电压信号,通过A/D转换后输入控制器,当外界光信号强度低于一定数值时,通过软启动启动路灯。当光信号强度高于一定数值时,通过软启动关闭路灯,并将采集输入电压信号,与已设定原则电压值进行比较,并对输入电压进行稳压,再通过时钟电路对路灯亮度进行调节,在半夜之后对路灯亮度进行减少,最后达到节电稳压。技术方案如下图:光敏电阻A/D转换器外部光线强度继电器驱动AT89C51单
8、片机电压放大报警LED显示键盘控制三端稳压器路灯3、核心问题(1)信号采集电路设计该模块需要检测环境光变化,依照环境光明暗进行路灯开关自动控制。基于此规定采用由光敏电阻构成分压电路进行检测。光敏电阻器又称光导管,特性是在特定光照射下,其阻值迅速减小,可用于检测可见光。在不同光强下,光敏电阻电阻值会发生明显变化,光敏电阻器是运用半导体光电效应制成一种电阻值随入射光强弱而变化电阻器;入射光强,电阻减小,入射光通过检测不同光强下电阻值变化量来控制路灯开和关。(2)稳压模块设计通过采集三端稳压器输出电压并将该电压与设定电压进行比较,进而调节输出电压大小,达到稳压目。本设计使用美国国家半导体公司三端可调
9、正稳压器集成电路LM317。(3)时钟电路设计为实现路灯对电压进行智能补偿,从而达到智能调压,本设计采用美国DALLAS公司实时时钟电路DS1302,该芯片一种高性能、低功耗、带RAM实时时钟电路,它可以对年、月、日、周日、时、分、秒进行计时,具备闰年补偿功能,工作电压为2.5V5.5V。采用三线接口与CPU进行同步通信,并可采用突发方式一次传送各种字节时钟信号或RAM数据。DS1302内部有一种318用于暂时性存储数据RAM寄存器。此外该芯片有备份电源引脚,可以在断电后仍能工作,以保证时钟精确性。3、时间安排(1) .2.20.2.29 查阅有关资料,理解设计任务书。(2) .3.1 .4.
10、1 搜索资料,完毕开题报告。(3) .4.1 .4.20 硬件调试,排除故障直至满足设计规定。(4) .4.20.5.10 软件调试,排除故障直至满足设计规定。(5) .5.10.5.30 整顿资料,按规定撰写论文,完毕草稿。(6) .6.1.6.20 论文整定,最后定稿,准备答辩。四、重要参照文献1 查兵,崔浩.单片机原理J.中华人民共和国高新技术,1期2 李健,蒋全胜,任灵芝.智能路灯控制系统设计J.工业控制计算机,6期3 金仁贵.单片机应用系统开发办法J.电脑知识与技术:学术交流,12期4 严怀龙.基于单片机数据采集系统J.广西轻工业,6期5 王虎城,周晋军,皮依标,叶振华. 基于光传感
11、器和单片机校园路灯控制系统设计J.科技广场,1期6 王立红. 基于单片机智能路灯控制系统J. 网络财富,6期7 王皑,佘丹妮. 基于单片机模仿路灯控制系统设计J. 仪表技术,11期8 张毅刚.单片机原理及应用M.高等教诲出版社,9 阎石.数字电子技术基本M.高等教诲出版社,10 童诗白,华成英.模仿电子技术基本M.高等教诲出版社,11 程德福,林君.智能仪器M.机械工业出版社,12 刁鸣.惯用电路模块分析与设计指引M.清华大学出版社,13 Xu Jun,Peng Yonglong,Li Yabi. Study of Energy-saving Solar Street Light Using
12、LED Based on MCU-controlled (J). Test & measurement technology. ,(10):29-3114 LIU Lianhao,A new street lamp controller design (J). Computing Technology and Automation,1997,(4):61-6315 ZHANG Liqun,Single-chip single board controller from time to time in the street lamp factory control (J). Applicatio
13、n of Energy Technologies,1998,(4):33-3416 The Introduction of AT89C51英文原文:(From:The Introduction of AT89C51)The Introduction of AT89C51DescriptionThe AT89C51 is a low-power,high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device
14、 is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versati
15、le 8-bit CPU with Flash on a monolithic chip,the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.Function characteristicThe AT89C51 provides the following standard features:4K bytes of Flash,128 bytes of RAM
16、,32 I/O lines,two 16-bit timer/counters,a five vector two-level interrupt architecture,a full duplex serial port,on-chip oscillator and clock circuitry. In addition,the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes.
17、 The Idle Mode stops the CPU while allowing the RAM,timer/counters,serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.Pin DescriptionVCC:Supply voltage.GND:Gr
18、ound.Port 0Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port,each pin can sink eight TTL inputs. When 1s are written to port 0 pins,the pins can be used as highimpedance inputs.Port 0 may also be configured to be the multiplexed loworder address/data bus during accesses to ext
19、ernal program and data memory. In this mode P0 has internal pullups.Port 0 also receives the code bytes during Flash programming,and outputs the code bytes during programverification. External pullups are required during programverification.Port 1Port 1 is an 8-bit bi-directional I/O port with inter
20、nal pullups.The Port 1 output buffers can sink/source four TTL inputs.When 1s are written to Port 1 pins they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pullups.Port 1
21、 also receives the low-order address bytes during Flash programming and verification.Port 2Port 2 is an 8-bit bi-directional I/O port with internal pullups.The Port 2 output buffers can sink/source four TTL inputs.When 1s are written to Port 2 pins they are pulled high by the internal pullups and ca
22、n be used as inputs. As inputs,Port 2 pins that are externally being pulled low will source current,because of the internal pullups.Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses. In this appl
23、ication,it uses strong internal pullupswhen emitting 1s. During accesses to external data memory that use 8-bit addresses,Port 2 emits the contents of the P2 Special Function Register.Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.
24、Port 3Port 3 is an 8-bit bi-directional I/O port with internal pullups.The Port 3 output buffers can sink/source four TTL inputs.When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 3 pins that are externally being pulled low will
25、source current (IIL) because of the pullups.Port 3 also serves the functions of various special features of the AT89C51 as listed below:Port 3 also receives some control signals for Flash programming and verification.RSTReset input. A high on this pin for two machine cycles while the oscillator is r
26、unning resets the device.ALE/PROGAddress Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming.In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequen
27、cy,and may be used for external timing or clocking purposes. Note,however,that one ALE pulse is skipped during each access to external Data Memory.If desired,ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set,ALE is active only during a MOVX or MOVC instruction. Oth
28、erwise,the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.PSENProgram Store Enable is the read strobe to external program memory.When the AT89C51 is executing code from external program memory,PSEN is activated twice each mac
29、hine cycle,except that two PSEN activations are skipped during each access to external data memory.EA/VPPExternal Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note,however,that if lock bit
30、1 is programmed,EA will be internally latched on reset.EA should be strapped to VCC for internal program executions.This pin also receives the 12-volt programming enable voltage(VPP) during Flash programming,for parts that require12-volt VPP.XTAL1Input to the inverting oscillator amplifier and input
31、 to the internal clock operating circuit.XTAL2Output from the inverting oscillator amplifier.Oscillator CharacteristicsXTAL1 and XTAL2 are the input and output,respectively,of an inverting amplifier which can be configured for use as an on-chip oscillator,as shown in Figure 1.Either a quartz crystal
32、 or ceramic resonator may be used. To drive the device from an external clock source,XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2.There are no requirements on the duty cycle of the external clock signal,since the input to the internal clocking circuitry is through a di
33、vide-by-two flip-flop,but minimum and maximum voltage high and low time specifications must be observed. Figure 1. Oscillator Connections Figure 2. External Clock Drive ConfigurationIdle ModeIn idle mode,the CPU puts itself to sleep while all the onchip peripherals remain active. The mode is invoked
34、 by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset.It should be noted that when idle is terminated by a hard ware reset,the device normally resumes pro
35、gram execution,from where it left off,up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event,but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle i
36、s terminated by reset,the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory.Power-down ModeIn the power-down mode,the oscillator is stopped,and the instruction that invokes power-down is the last instruction executed. The on-chip RAM an
37、d Special Function Registers retain their values until the power-down mode is terminated. The only exit from power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must b
38、e held active long enough to allow the oscillator to restart and stabilize.Program Memory Lock BitsOn the chip are three lock bits which can be left unprogrammed (U) or can be programmed (P) to obtain the additional features listed in the table below.When lock bit 1 is programmed,the logic level at
39、the EA pin is sampled and latched during reset. If the device is powered up without a reset,the latch initializes to a random value,and holds that value until reset is activated. It is necessary that the latched value of EA be in agreement with the current logic level at that pin in order for the de
40、vice to function properly.译文:AT89C51简介描述AT89C51是一种低电压,高性能CMOS 8位单片机带有4K字节可重复擦写程序存储器(PENROM)。这种器件采用ATMEL公司高密度、不容易丢失存储技术生产,并且可以与MCS-51系列单片机兼容。片内具有8位中央解决器和闪烁存储单元,有较强功能AT89C51单片机可以被应用到控制领域中。功能特性AT89C51提供如下功能原则:4K字节闪烁存储器,128字节随机存取数据存储器,32个I/O口,2个16位定期/计数器,1个5向量两级中断构造,1个串行通信口,片内震荡器和时钟电路。此外,AT89C51还可以进行0HZ
41、静态逻辑操作,并支持两种软件节电模式。闲散方式停止中央解决器工作,可以容许随机存取数据存储器、定期/计数器、串行通信口及中断系统继续工作。掉电方式保存随机存取数据存储器中内容,但震荡器停止工作并禁止其他所有部件工作直到下一种复位。引脚描述VCC:电源电压 GND:地P0口P0口是一组8位漏极开路双向I/O口,即地址/数据总线复用口。作为输出口时,每一种管脚都可以驱动8个TTL电路。当“1”被写入P0口时,每个管脚都可以作为高阻抗输入端。P0口还可以在访问外部数据存储器或程序存储器时,转换地址和数据总线复用,并在这时激活内部上拉电阻。P0口在闪烁编程时,P0口接受指令,在程序校验时,输出指令,需
42、要接电阻。P1口P1口一种带内部上拉电阻8位双向I/O口,P1输出缓冲级可驱动4个TTL电路。对端口写“1”,通过内部电阻把端口拉到高电平,此时可作为输入口。由于内部有电阻,某个引脚被外部信号拉低时输出一种电流。闪烁编程时和程序校验时,P1口接受低8位地址。P2口P2口是一种内部带有上拉电阻8位双向I/O口,P2输出缓冲级可驱动4个TTL电路。对端口写“1”,通过内部电阻把端口拉到高电平,此时,可作为输入口。由于内部有电阻,某个引脚被外部信号拉低时会输出一种电流。在访问外部程序存储器或16位地址外部数据存储器时,P2口送出高8位地址数据。在访问8位地址外部数据存储器时,P2口线上内容在整个运营
43、期间不变。闪烁编程或校验时,P2口接受高位地址和其他控制信号。P3口P3口是一组带有内部电阻8位双向I/O口,P3口输出缓冲故可驱动4个TTL电路。对P3口写如“1”时,它们被内部电阻拉到高电平并可作为输入端时,被外部拉低P3口将用电阻输出电流。P3口除了作为普通I/O口外,更重要用途是它第二功能,如下表所示:端口引脚第二功能P3.0RXDP3.1TXDP3.2INT0P3.3INT1P3.4T0P3.5T1P3.6WRP3.7RDP3口还接受某些用于闪烁存储器编程和程序校验控制信号。RST复位输入。当震荡器工作时,RET引脚浮现两个机器周期以上高电平将使单片机复位。ALE/当访问外部程序存储
44、器或数据存储器时,ALE输出脉冲用于锁存地址低8位字节。虽然不访问外部存储器,ALE以时钟震荡频率1/16输出固定正脉冲信号,因而它可对输出时钟或用于定期目。要注意是:每当访问外部数据存储器时将跳过一种ALE脉冲时,闪烁存储器编程时,这个引脚还用于输入编程脉冲。如果必要,可对特殊寄存器区中8EH单元D0位置禁止ALE操作。这个位置后只有一条MOVX和MOVC指令ALE才会被应用。此外,这个引脚会薄弱拉高,单片机执行外部程序时,应设立ALE无效。PSEN程序储存容许输出是外部程序存储器读选通信号,当AT89C51由外部程序存储器读取指令时,每个机器周期两次PSEN 有效,即输出两个脉冲。在此期间
45、,当访问外部数据存储器时,这两次有效PSEN 信号不浮现。EA/VPP外部访问容许。欲使中央解决器仅访问外部程序存储器,EA端必要保持低电平。需要注意是:如果加密位LBI被编程,复位时内部会锁存EA端状态。如EA端为高电平,CPU则执行内部程序存储器中指令。闪烁存储器编程时,该引脚加上+12V编程容许电压VPP,固然这必要是该器件是使用12V编程电压VPP。XTAL1:震荡器反相放大器及内部时钟发生器输入端。XTAL2:震荡器反相放大器输出端。时钟震荡器AT89C51中有一种用于构成内部震荡器高增益反相放大器,引脚XTAL1和XTAL2分别是该放大器输入端和输出端。这个放大器与作为反馈元件片外
46、石英晶体或陶瓷谐振器一起构成自然震荡器。 外接石英晶体及电容C1,C2接在放大器反馈回路中构成并联震荡电路。对外接电容C1,C2虽然没有十分严格规定,但电容容量大小会轻微影响震荡频率高低、震荡器工作稳定性、起振难易程序及温度稳定性。如果使用石英晶体,咱们推荐电容使用30PF10PF,而如果使用陶瓷振荡器建议选取40PF10PF。顾客也可以采用外部时钟。采用外部时钟电路如图示。这种状况下,外部时钟脉冲接到XTAL1端,即内部时钟发生器输入端,XTAL2则悬空。由于外部时钟信号是通过一种2分频触发器后作为内部时钟信号,因此对外部时钟信号占空比没有特殊规定,但最小高电平持续时间和最大低电平持续时间应
47、符合产品技术条件规定。内部振荡电路外部振荡电路闲散节电模式AT89C51有两种可用软件编程省电模式,它们是闲散模式和掉电工作模式。这两种方式是控制专用寄存器PCON中PD和IDL位来实现。PD是掉电模式,当PD=1时,激活掉电工作模式,单片机进入掉电工作状态。IDL是闲散等待方式,当IDL=1,激活闲散工作状态,单片机进入睡眠状态。如需要同步进入两种工作模式,即PD和IDL同步为1,则先激活掉电模式。在闲散工作模式状态,中央解决器CPU保持睡眠状态,而所有片内外设仍保持激活状态,这种方式由软件产生。此时,片内随机存取数据存储器和所有特殊功能寄存器内容保持不变。闲散模式可由任何容许中断祈求或硬件复位终结。终结闲散工作模式办法有两种,一是任何一条被容许中断事件被激活,IDL被硬件清除,即刻终结闲散工作模式。程序会一方面影响中断,进入中断服务程序,执行完中断服务程序,并紧随RETI指令后,下一条要执行指令就是使单片机进入闲散工作模式,那条指令背面一条指令。二是通过硬件复位也可将闲散工作模式终结。需要注意是:当由硬件复位来终结闲散工作模式时,中央解决器CPU普通是从激活空闲模式那条指令下一条开始继续执行程序,要完毕内部复位操作,硬件复位脉冲要保持两个机器周期有效,在这种状况下,内部禁止中央解决器CPU访问片内RAM,而容许访问其她端口,为了避免也许对端口产生意外写