毕业论文——汽车尾灯控制电路设计_第1页
毕业论文——汽车尾灯控制电路设计_第2页
毕业论文——汽车尾灯控制电路设计_第3页
毕业论文——汽车尾灯控制电路设计_第4页
免费预览已结束,剩余14页可下载查看

下载本文档

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

文档简介

1 引言在日新月异的21世纪里,电子产品得到了迅速发展。许多电器设备都趋于人性化、智能化,这些电器设备大部分都含有CPU控制器或者是单片机。单片机以其高可靠性、高性价比、低电压、低功耗等一系列优点,近几年得到迅猛发展和大范围推广,广泛应用于工业控制系统、通讯设备、日常消费类产品和玩具等。并且已经深入到工业生产的各个环节以及人民生活的各个方面,如车间流水线控制、自动化系统等、智能型家用电器(冰箱、空调、彩电)等。用单片机来控制的小型电器产品具有便携实用,操作简单的特点。本文设计的汽车尾灯控制电路属于小型智能电子产品。利用单片机进行控制,实时时钟芯片进行记时,外加掉电存储电路和显示电路。此设计具有相当重要的现实意义和实用价值。2 系统概述本设计以AT89S52单片机为核心,构成单片机控制电路,完成对它们的自动调整和掉电保护。人机接口由四个按键来实现,用这四个按键对汽车左转,右转,停车和检测进行控制。软件控制程序实现所有的功能。整机电路使用+5V稳压电源,可稳定工作。系统框图如图2-1所示,其软硬件设计简单,可广泛应用于长时间工作的系统中。人机接口显示电路软件控制程序电源电路单片机控制电路图2-1 系统框图3 方案选择 由于汽车尾灯控制电路的种类比较多,因此方案选择在设计中是至关重要的。正确地选择方案可以减小开发难度,缩短开发周期,降低成本,更快地将产品推向市场。3.1 方案1基于AT89S52单片机的汽车尾灯控制电路设计直接用AT89S52单片机来实现汽车尾灯控制电路设计。AT89S52是一种带8K字节闪烁可编程可擦除只读存储器的低电压,高性能CMOS 8位微处理器,俗称单片机。单片机的可擦除只读存储器可以反复擦写1000余次。由于将多功能8位CPU和闪烁存储器组合在单个芯片中,ATMEL的AT89S52是一种高效微控制器,为很多嵌入式控制系统提供了一种灵活性高且价廉的方案。用单片机来实现汽车尾灯控制电路设计,无须外接其他芯片,充分利用了单片机的资源。3.2 方案2基于电子元件的汽车尾灯控制电路设计 用电子元件接的汽车尾灯控制电路,电路复杂,接点较多,电路稳定性差。 汽车左右和刹车仿真电路开关控制电路译码电路74138显示驱动电路记数电路74161R1R2R3 L1L2L3脉冲产生电路555汽车尾灯控制电路设计总体框图4 系统硬件电路的设计按照系统设计功能的要求,初步确定设计系统由主控模块、键盘接口模块、显示模块共3个模块组成,电路系统构成框图如图4-1所示。主控芯片使用52系列AT89S52单片机,(89S52)主控模块时钟电路键扫描电路晶体管显示存储电路图4-1 汽车尾灯控制电路系统构成框图4.1 系统核心部分闪电存储型器件AT89S524.1.1 AT89S52具有下列主要性能5: 8KB可改编程序Flash存储器(可经受1000次的写入/擦除周期) 全静态工作:0Hz24MHz三级程序存储器保密1288字节内部RAM32条可编程I/O线2个16位定时器/计数器6个中断源可编程串行通道片内时钟振荡器4.1.2 AT89S52的引脚及功能AT89S52单片机的管脚说明如图4-2所示。图4-2 AT89S52的管脚(1) 主要电源引脚 VCC 电源端 GND 接地端(2) 外接晶体引脚XTAL1和XTAL2 XTAL1 接外部晶体的一个引脚。在单片机内部,它是构成片内振荡器的反相放大器的输入端。当采用外部振荡器时,该引脚接收振荡器的信号,既把此信号直接接到内部时钟发生器的输入端。 XTAL2 接外部晶体的另一个引脚。在单片机内部,它是上述振荡器的反相放大器的输出端。采用外部振荡器时,此引脚应悬浮不连接。(3) 控制或与其它电源复用引脚RST、ALE/PROG、/PSEN和/EA/VPP RST 复位输入端。 当振荡器运行时,在该引脚上出现两个机器周期的高电平将使单片机复位。 ALE/PROG 当访问外部存储器时,ALE(地址锁存允许)的输出用于锁存地址的低位字节。即使不访问外部存储器,ALE端仍以不变的频率(此频率为振荡器频率的1/6)周期性地出现正脉冲信号。因此,它可用作对外输出的时钟,或用于定时目的。然而要注意的是:每当访问外部数据存储器时,将跳过一个ALE脉冲。在对Flash存储器编程期间,该引脚还用于输入编程脉冲(/PROG)6。 /PSEN 程序存储允许(/PSEN)输出是外部程序存储器的读选通信号。当AT89S52/LV52由外部程序存储器取指令(或常数)时,每个机器周期两次/PSEN有效(既输出2个脉冲)。但在此期间内,每当访问外部数据存储器时,这两次有效的/PSEN信号将不出现。/EA/VPP 外部访问允许端。要使CPU只访问外部程序存储器(地址为0000HFFFFH),则/EA端必须保持低电平(接到GND端)。当/EA端保持高电平(接VSS端)时,CPU则执行内部程序存储器中的程序。(4) 输入/输出引脚 P0.0 P0.7、P1.0P1.7、P2.0 P2.7 和P3.0P3.7P0端口(P0.0 P0.7) P0是一个8位漏极开路型双向I/O端口。作为输出口用时,每位能以吸收电流的方式驱动8个TTL输入,对端口写1时,又可作高阻抗输入端用。P1端口(P1.0 P1.7) P1是一个带有内部上拉电阻的8位双向I/O端口。P1的输出缓冲器可驱动(吸收或输出电流方式)4个TTL输入。对端口写1时,通过内部的上拉电阻把端口拉到高电位,这时可用作输入口。作输入口时,因为有内部的上拉电阻,那些被外部信号拉低的引脚会输出一个电流。 P2端口 (P2.0P2.7) P2是一个带有内部上拉电阻的8位双向I/O端口。P2的输出缓冲器可驱动(吸收或输出电流方式)4个TTL输入。对端口写1时,通过内部的上拉电阻把端口拉到高电位,这时可用作输入口。P2作输入口使用时,因为有内部的上拉电阻,那些被外部信号拉低的引脚会输出一个电流。P3端口(P3.0P3.7) P3口管脚是8个带内部上拉电阻的双向I/O口,可接收输出4个TTL门电流。当P3口写入“1”后,它们被内部上拉为高电平,并用作输入。作为输入,由于外部下拉为低电平,P3口将输出电流,这是由于上拉的缘故。P3口也可作为AT89S52的一些特殊功能,这些特殊功能见表4-17。表4-1 P3端口的特殊功能 端口引脚 兼 用 功 能 P3.0RXD (串行输入口) P3.1TXD (串行输出口) P3.2/INT0 (外部中断0) P3.3/INT1 (外部中断1) P3.4T0 ( 定时器0的外部输入) P3.5T1 (定时器1的外部输入) P3.6/WR (外部数据存储器写选通) P3.7/RD (外部数据存储器读选通)4.5 键盘电路本设计共采用按键4个,分别与单片机的P2.0、P2.1、P2.2、P2.3口相连,分别对应汽车左转,汽车右转,刹车和检测的功能。7 结论本设计硬件电路较简单,所用器件较少,电路中使用了AT89S52单片主要芯片,实现了预计功能。在对芯片的管脚功能和用法有充分的了解后,根据设计要求设计硬件电路,然后通过软件编程,用按键进行控制,用发光二极管进行显示。汽车尾灯控制电路可以正常显示汽车的左转,右转,停车和检测功能,基本完成了预期要实现的目标。参考文献1康华光主编,电子技术基础(数字部分),高等教育出版社2标准集成电路数据手册TTL电路,电子工业出版社致 谢不知不觉,六周的毕业设计结束了。我的毕业论文已整理完毕,电路调试进展良好。毕业设计的完成意味着我的大学学习生活即将结束,从此我将进入一个新的人生旅途、开始一段崭新的生活工作。在此,我衷心地感谢所有在我做毕业设计期间帮助过我的人。 首先我要感谢我的指导老师李杰的大力帮助和支持。在整个设计过程当中,李老师在大局上指导我毕业设计的每一进程,还在百忙中抽空为我答疑解难,帮我分析讲解毕业设计中所遇到的问题。不仅如此,李老师还无私的给我提供了丰富的学习资源和良好的学习环境,为我的毕业设计带来了很大方便。同时在我完成毕业设计的过程中提供了很多指导性的意见,使我受益匪浅。另外,李老师渊博的学识、严谨的治学态度和为人给了我很大的教育,这些将使我终身受益。在此,我衷心感谢李老师给予我的帮助和教育。此外,我还要感谢夏九和李国华同学给予我的无私的帮助,他们在程序编写和调试过程中给予了我莫大的帮助。在此,我真诚地感谢他们。最后,我要感谢我的母校天津工程师范学院,在校期间,这里给我留下了美好的回忆。特别是在我即将踏上工作岗位的同时,毕业设计整个过程给了我这样一个锻炼的机会,使我加深了对以前知识的理解和巩固,拓宽了知识面,也提高了我对所学知识的综合应用能力。我要对母校说:母校有我三五载,我爱母校一万年。祝愿母校的将来更美好!附录1:汽车尾灯控制电路设计电路原理图附录2 主程序 org 00h ajmp start ORG 001BH ;定时器T1中断程序入口 LJMP time1 ;跳至INTT1执行 org 0030hstart: mov TMOD,#10h mov IE,#88h MOV TH1,#00h MOV TL1,#00h mov r7,#03h; setb TR1turn: jnb p2.0,is_key jnb p2.1,is_key jnb p2.2,is_key jnb p2.3,is_key orl p1,#0ffh;is_key : jb p2.3,no_check; anl p1,#0c0h; jmp turnno_check: jmp turntime1: push acc mov TH1,#010h mov TL1,#00h jb p2.0,left djnz r7,return mov r7,#3 xrl p1,#3fhleft: jb p2.1,right dec r7; cjne r7,#6,next1; mov p1,#0fbhnext1: cjne r7,#3,next2; mov p1,#0fdh;next2: cjne r7,#0,right; mov p1,#0feh mov r7,#9;right: jb p2.2,return dec r7; cjne r7,#6,next11; mov p1,#0f7hnext11: cjne r7,#3,next21; mov p1,#0efh;next21: cjne r7,#0,return; mov p1,#0dfh mov r7,#9;return: pop acc reti end英文资料及中文翻译6 TRANSMISSIONS OF DIGITAL DATA: INTERFACES AND MODEMS(From Introduction to Data Communications and Net Working, Behrouz Forouzan)Once we have encoder our information into a format that can be transmitted, the next step is to investigate the transmission process itself. Information-processing equipment such as PCs generate encoded signals but ordinarily require assistance to transmit those signals over a communication link. For example, a PC generates a digital signal but needs an additional device to modulate a carrier frequency before it is sent over a telephone line. How do we relay encoded data from the generating device to the next device in the process? The answer is a bundle of wires, a sort of mini communication link, called an interface.Because an interface links two devices not necessarily made by the same manufacturer, its characteristics must be defined and standards must be established. Characteristics of an interface include its mechanical specifications (how many wires are used to transport the signal); its electrical specifications (the frequency, amplitude, and phase of the expected signal); and its functional specifications (if multiple wires are used, what does each one do?). These characteristics are all described by several popular standards and are incorporated in the physical layer of the OSI model.6.1 DIGITAL DATA TRANSMISSIONOf primary concern when considering the transmission of data from one device to another is the wiring. And of primary concern when considering the wiring is the data stream. Do we send one bit at a time, or do we group bits into larger groups and, if so, how? The transmission of binary data across a link can be accomplished either in parallel mode or serial mode. In parallel mode, multiple bits are sent with each clock pulse. In serial mode, one bit is sent with each clock pulse. While there is only one way to send parallel data, there are two subclasses of serial transmission: synchronous and asynchronous (see Figure 6-1).Parallel TransmissionBinary data, consisting of 1s and 0s, may be organized into groups of n bits each. Computers produce and consume data in groups of bits much as we conceive of and use spoken language in the form of words rather than letters. By grouping, we can send data n bits at a time instead of one. This is called parallel transmission. Data transmissionParallelSerialSynchronousAsynchronousFigure 6-1Data transmission The mechanism for parallel transmission is a conceptually simple one: use n wires to send n bits at one time. That way each bit has its own wire, and all n bits of one group can be transmitted with each clock pulse from one device to another. Figure 6-2 shows how parallel transmission works for n=8.Typically the eight wires are bundled in a cable with a connector at each end.Sender ReceiverWe need eight liness8 bit synchronouslyFigure 6-2Parallel transmissionThe advantage of parallel transmission is speed. All else being equal, parallel transmission can increase the transfer speed by a factor of n over serial transmission. But there is a significant disadvantage: cost. Parallel transmission requires n communication lines (wires in the example) just to transmit the data stream. Because this is expensive, parallel transmission is usually limited to short distances, up to a maximum of say 25 feet.Serial TransmissionIn serial transmission one bit follows another, so we need only one communication channel rather than n to transmit data between two communicating devices .The advantage of serial over parallel transmission is that with only one communication channel, serial transmission reduces the cost of transmission over parallel by roughly a factor of n.Since communication within devices is parallel, conversion devices are required at the interface between the sender and the line (parallel-to-parallel).Serial transmission occurs in one of two ways: asynchronous or synchronous.Asynchronous TransmissionAsynchronous transmission is so named because the timing of a signal is unimportant. Instead, information is received and translated by agreed-upon patterns. As long as those patterns are followed, the receiving device can retrieve the information without regard to the rhythm in which it is sent. Patterns are based on grouping the bit stream into bytes. Each group, usually eight bits, is sent along the link as a unit. The sending system handles each group independently, relaying it to the link whenever ready, without regard to a timer. Without a synchronizing pulse, the receiver cannot use timing to predict when the next group will arrive. To alert the receiver to the arrival of a new group, therefore, an extra bit is added to the beginning of each byte. This bit, usually a 0, is called the start bit. To let the receiver know that the byte is finished, one or more additional bits are appended to the end of the byte. These bits, usually 1s, are called stop bits. By this method, each byte is increased in size to at least 10 bits, of which 8 are information and 2 or more are signals to the receiver. In addition, the transmission of each byte may then be followed by a gap of varying duration. This gap can be represented either by an idle channel or by a stream of additional stop bits.In asynchronous transmission we send one start bit (0) at the beginning and one or more stop bits (1s) at the end of each byte. There may be a gap between each byte. The start and stop bits and the gap alert the receiver to the beginning and end of each byte and allow it to synchronize with the data stream. This mechanism is called asynchronous because, at the byte level, sender and receiver do not have to be synchronized. But within each byte, the receiver must still be synchronized with the incoming bit stream. This is, some synchronization is required, but only for the duration of a single byte. The receiving device resynchronizes at the onset of each new byte. When the receiver detects a start bit, it sets a timer and begins counting bits as they come in. after n bits the receiver looks for a stop bit. As soon as it detects the stop bit, it ignores any received pulses until it detects the next start bit.Asynchronous here means “asynchronous at the byte level,” but the bits are still synchronized; their durations are the same.The addition of stop and start bits and the insertion of gaps into the bit stream make asynchronous transmission slower than forms of transmission that can operate without the addition of control information. But it is cheap and effective, two advantages that make it an attractive choice for situations like low-speed communication. For example, the connection of a terminal to a computer is a natural application for asynchronous transmission. A user types only one character at a time, types extremely slowly in data processing terms, and leaves unpredictable gaps of time between each character.Synchronous TransmissionIn synchronous transmission, the bit stream is combined into longer “frames,” which may contain multiple bytes. Each byte, however, is introduced onto the transmission link without a gap between it and the next one. It is left to the receiver to separate the bit stream into bytes for decoding purposes. In other words, data are transmitted as an unbroken string of 1s and 0s, and the receiver separates that string into the bytes, or characters, it needs to reconstruct the information.In synchronous transmission we send bits one after another without start/stop bits or gaps. It is the responsibility of the receiver to group the bits.Without gaps and start/stop bits, there is no built-in mechanism to help the receiving device adjust its bit synchronization in midstream. Timing becomes very important, therefore, because the accuracy of the received information is completely dependent on the ability of the receiving device to keep an accurate count of the bits as they come in. The advantage of synchronous transmission is speed. With no extra bits or gaps to introduce at the sending end and remove at the receiving end and, by extension, with fewer bits to move across the link, synchronous transmission is faster than asynchronous transmission is faster than asynchronous transmission. For this reason, it is more useful for high-speed applications like the transmission of data from one computer to another. Byte synchronization is accomplished in the data link layer.6.2 DTE-DCE INTERFACAt this point we must clarify two terms important to computer networking: data terminal equipment (DTE). There are usually four basic functional units involved in the communication of data: a DTE and DCE on one end and a DCE and DTE on the other end. The DTE generates the data and passes them, along with any necessary control characters, to a DCE. The DCE does the job of converting the signal to a format appropriate to the transmission medium and introducing it onto the network link. When the signal arrives at the receiving end, this process is reversed.Data Terminal Equipment (DTE)Data terminal equipment (DTE) includes any unit that functions either as a source of or as a destination for binary digital data. At the physical layer, if can be a terminal, microcomputer, computer, printer, fax machine, or any other device that generates or consumes digital data. DTEs do not often communicate directly with one another, they generate and consume information but need an intermediary to be able to communicate. Think of a DTE as operating the way your brain does when you talk. Lets say you have an idea that you want to communicate to a friend. Your brain creates the idea but cannot transmit that idea to your friends brain by itself. Unfortunately or fortunately, we are not a species of mind readers. Instead, your brain passes the idea to your vocal chords and mouth, which convert it to sound waves that can travel through the air or over a telephone line to your friends ear and from there to his or her brain, where it is converted back into information. In this model, your brain and your friends brain are DTEs. Your vocal chords and mouth are your DCE. His or her ear is also a DCE. The air or telephone wire is your transmission medium.A DTE is any device that is a source of or destination for binary digital data.Data Circuit-Terminating Equipment (DCE)Data circuit-terminating equipment (DCE) includes any functional unit that transmits or receives data in the form of an analog or digital signal through a network. At the physical layer, a DCE takes data generated by a DTE, converts them to an appropriate signal, and then introduces the signal onto the telecommunication link. Commonly used DCEs at this layer include modems . In any network, a DTE generates digital data and passes it to a DCE; the DCE converts the data to a form acceptable to the transmission medium and sends the converted signal to another DCE on the network. The second DCE takes the signal off the line, converts it to a form usable by its DTE, and delivers it. To make this communication possible, both the sending and receiving DCEs must use the same encoding method, much the way that if you want to communicate to someone who understands only Japanese, you must speak Japanese. The two DTEs do not need to be coordinated with each other, but each of them must be coordinated with its own DCE and the DCEs must be coordinated so that data translation occurs without loss of integrity.A DCE is any device that transmits or receives data in the form of an analog or digital signal through a network.6 数字数据传输:接口和调制解调器(选自数据通信与网络, Behrouz Forouzan著)我们将信息编码成可以传输的格式,下一步就是探讨传输过程了。信息处理设备如个人计算机能生成编码信号,通常还需要其它设备协助才能将这些信号在通信链路上传输。例如一台PC机产生数字信号,在将信号通过电话线发送之前,还需要一台附加设备来调制载波频率。在这过程中,我们怎样才能把数据从产生它的设备传送到下一个设备呢?解决办法是使用一捆导线,成为一种为通信链路,或叫接口。因为接口连接的两个设备有可能不是一个厂家生产的,所以必须规定接口的特性并建立标准。接口特性包括机械规范(使用多少条导线来传输信号)、电气规范(预期信号的频率、振幅和相位)以及功能规范(如果使用多条导线,每条导线的功能是什么?)。这些特性在一些常用标准中都有描述并且被集成到了OSI7层模型的物理层中。6.1数字数据传输数据传输并行传输串行传输同步传输异步传输从一个设备向另一个设备发送数据主要考虑的是配线方式。对于配线问题主要考虑的因素是数据流。我们是否一次只发送一个比特,或是将比特成组发送以及如何成组?通过链路传输二进制数据可以采用并行模式或串行模式。在并行模式中,在每个时钟脉冲到来时多个比特被同时发送。在串行模式中,每个时钟脉冲只发送一个比特。尽管只有一种发送并行数据的方法,串行传输却有两个子类:同步方式和异步方式(参见图6-1)。 图6-1 数据传输6.1.1 并行传输由0和1组成的二进制值可以组成n比特的位组。计算机使用和生成以比特为单位的数据,就像我们在英语会话时用词而不是一个个的字母来交流一样。通过分组,我们可以一次发送n个比特而不是一个比特。这称为并行传输。从概念上说,并行传输的机制很简单:一次使用n条导线来传输n个比特。这种方式下,每个比特都使用专门的线路,而一组中的n个比特就可以在每个时钟脉冲从一个设备传输到另一个设备。图6-2显示了n=8时并行传输的工作状况。通常八根导线被捆成一根电缆,两端都有连接头。8个比特一起发送 接收方需要8条线s发送方 图6-2 并行传输并行传输的优势在于速度。当其它因素相同时,并行传输将比串行传输的速度快n倍

温馨提示

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

评论

0/150

提交评论