【毕业设计】基于单片机自行车测速系统设计-精品
基于单片机的自行车测速系统设计

基于单片机的自行车测速系统设计【摘要】本文主要是对测速系统的设计与应用进行了研究,以单片机为核心,利用A44E霍尔传感器设计出一种可以即时显示速度和路程的测速系统,并用液晶显示器LCD1602显示出来。
【关键词】传感器;单片机;即时测速1.前言随着人们对低碳生活的追求,特别是在交通拥挤的城市,自行车成为代步及休闲运动的工具。
因此爱好自行车运动的人十分需要一款能测速的装置,以便更好知道自己的运动情况。
2.总体设计整个系统是以单片机作为控制模块,其工作原理是:A44E霍尔传感器检测自行车的轮胎的运转情况,将不同的车速转变成不同的频率的脉冲信号输入到单片机进行处理和计算,最后把即时信息显示在LCD1602液晶显示器上,让人们清楚知道当前的速度、累计运动时间和路程等物理量,系统的总框图如图1所示。
我们先把磁铁放在自行车的车轮上,而霍尔传感器就放在车架,转动自行车的转轴,磁铁也就跟着一起转动,从而使霍尔传感器周围的磁场发生变化,传感器在磁钢经过时,产生一个脉冲低电压,记录自行车转动了一周。
将霍尔传感器的输出引脚与单片机的P3.2脚相连。
测速度的原理:定义测量的时间间隔为,自行车车轮转过的圈数。
假设车轮周长为,则速度为:,在中断子程序里调用时钟函数,实现时间的累加,最后在中断子程序里输出累计时间,速度和路程。
图1 测速系统总框图3.硬件选择整个系统包括了三大部分,分别是:传感器模块、单片机模块以及显示模块。
3.1 传感器的选择A44E霍尔开关集成电路应用霍尔效应原理,其输入为磁感应强度,输出是一个数字电压讯号,霍尔传感器A44E 在测速系统中的主要作用是对车轮转速信息进行采集。
它具有一致性好、性能稳定、可靠性高、响应速度快、安装简便,可和各种逻辑电路接口直接对接的特点。
3.2 单片机的选择本文选用的控制模块是AT89C52单片机,AT89C52是低电压,高性能CMOS 8位单片机,片内含8K bytes的可反复擦写的只读程序存储器(PEROM)和256 bytes 的随机存取数据存储器(RAM),与标准MCS-51指令系统及8052产品引脚兼容,片内置通用8位中央处理器(CPU)和Flash存储单元,功能强大,适合于复杂控制应用场合。
基于单片机设计的自行车速度测试系统毕业论文(很全--免费)

伴随着电子信息技术的发展,尤其是IC卡技术的广泛应用,人民的日常生活变得日益的方便和快捷。
IC卡是一个正蓬勃发展的边缘产业,一个与我们生活越来越密切的产业。
目前“一卡通”正在许多领域得到应用,如公交系统、税控管理、宾馆服务、医疗保险等。
在普及因特网和计算机的大潮涌来时,IC卡扮演着日益重要的角色。
IC卡读写器是IC卡与应用系统间的桥梁,在ISO国际标准中称之为接口设备IFD(Interface Device)。
IFD内的CPU通过一个接口电路与IC卡相连并进行通信。
IC卡接口电路是IC卡读写器中至关重要的部分,根据实际应用系统的不同,可选择并行通信、半双工串行通信和I2C通信等不同的IC卡读写芯片。
非接触式IC卡简介又称射频卡,成功地解决了无源(卡中无电源)和免接触这一难题,是电子器件领域的一大突破。
本文设计了单片机控制IC卡数据读写的软/硬件、LED显示以及与PC机之间的串口通信。
介绍了以单片机AT89C51为核心的IC卡系统的设计。
关键词:89C51单片机 IC卡 LED显示With the development of electronic information technology, especially the wide application of IC card technology, the people's daily lives become more convenient and faster. IC card is the edge of a booming industry, a life more closely with our industry. At present, "Card" is applied in many fields such as public transportation systems, tax management, hotel services, and medical insurance. Popularity of the Internet and computers in the coming tide of time, IC card to play an increasingly important role.IC card reader is a bridge between systems and applications, in the ISO international standard interface device called IFD (Interface Device). IFD within the CPU via an interface circuit and the IC card is connected and communicate. IC card interface IC card reader circuit is a vital part of the difference based on the actual application system, choose parallel communication, half-duplex serial communication, and I2C communications, such as different IC card reader chip. Introduction of non-contact IC card, also known as radio frequency card, successfully resolved the passive (no power supply card) and free access to this problem, the field of electronic devices is a major breakthrough.In this design, we discuss IC card data read and write MCU hardware / software,LED display, and with the serial communication between PC machine. Introduced to the AT89C51 microcontroller as the core of the design of IC card system.Keywords: 89C51 microcontroller IC card LED display摘要 (i)ABSTRACT........................................................... i i 引言.. (1)第1章概述 (3)1.1 单片机介绍 (3)1.1.1 片机发展历程 (3)1.1.2 单片机的发展趋势 (3)1.2 IC卡技术 (5)1.2.1 IC卡技术 (5)1.2.2 IC卡的技术特点 (5)1.3 LED显示屏技术 (6)第2章原理图 (8)2.1 系统原理框图的绘制 (8)2.1.1 Protel99软件的概述 (8)2.2 原理图 (9)2.3 方案论证 (10)第3章硬件部分介绍 (11)3.1 AT89C51单片机简介 (11)3.1.1 主要特性 (11)3.1.2 管脚说明 (11)3.1.3 晶振电路 (13)3.1.4 芯片擦除 (14)3.2 RS232串行接口 (14)3.3 SLE4442卡简介 (15)3.4 IC卡座 (15)3.5 外围电路 (17)3.6 软件系统 (20)第4章软件部分 (21)4.1 工作过程 (21)总结 (23)参考文献 (24)附录 (25)致谢 (38)引言伴随着电子信息技术的发展,尤其是IC卡技术的广泛应用,人民的日常生活变得日益的方便和快捷。
基于单片机的自行车测速系统设计

吉林大学珠海学院毕业论文基于单片机的自行车测速系统设计系别:专业名称:学生姓名:学号:指导教师姓名:【参考文献】[1]张友德,赵志英,涂时亮.单片微型机原理、应用与实验复旦大学出版社[2]程民利.基于霍尔传感器的高精度测速电路设计[J].电子设计工程,2013(8):109-111.[3]李胤昌,郑日荣. 基于PIC单片机的电动自行车控制系统设计[J]. 现代电子技术,2009,08:136-138.[4]张烨尔,吴继华,陈文达,闫庆军. 基于单片机的电动自行车制动系统设计[J]. 机械与电子,2013,10:41-43.[5] 秦业海,吕闯,任健祥,刘帅,平焕冉. 基于单片机的电动自行车刹车系统设计[J]. 数字技术与应用,2015,02:9.[6]董燕飞,董良师,王洪林. 基于单片机的自行车测速系统设计[J]. 科技广场,2009,09:189-190.[7]费凯成,汪木兰,陈巍. 基于MSP430单片机的太阳能LED自行车显示系统设计[J]. 信息与电脑(理论版),2011,11:80-81.[8]赵小兰,胡征,王培坤,林晓欢,庄衍竖,黄维沛. 多功能自行车码表设计[J]. 电子测试,2013,20:1-2.[9]郑隆举,李慧芳,王志全,石蕊. 基于单片机的电机测速系统设计[J]. 自动化与仪器仪表,2015,03:37-39.[10]董雨声,马松浩,汤庆威,胡福年. 便携式自行车功能仪的研究[J]. 电子设计工程,2015,22:61-63.[11]满宪金. 基于英飞凌XC866 MCU的大功率载货电动车控制系统设计与实现[D].中国海洋大学,2011.[12]冯荣彪,王国良,骆明儿. 基于单片机的激光测速系统设计[J]. 激光技术,2010,05:679-681+720.摘要随着社会的发展,人们对健康程度越加关注,常常通过骑自行车来锻炼身体,自行车不但是运动健身的良好方式,而且也是良好的交通工具。
基于单片机自行车测速系统设计 (2)

基于单片机自行车测速系统设计摘要随着居民生活水平的不断提高,自行车不再仅仅是普通的运输、代步的工具,而是成为人们娱乐、休闲、锻炼的首选。
自行车的速度里程表能够满足人们最基本的需求,让人们能清楚地知道当前的速度、里程等物理量。
本论文主要阐述一种基于霍尔元件的自行车的速度里程表的设计。
以 AT89C52 单片机为核心,A44E 霍尔传感器测转数,实现对自行车里程/速度的测量统计,采用 24C02 实现在系统掉电的时候保存里程信息,并能将自行车的里程数及速度用LED实时显示。
文章详细介绍了自行车的速度里程表的硬件电路和软件设计。
硬件部分利用霍尔元件将自行车每转一圈的脉冲数传入单片机系统,然后单片机系统将信号经过处理送显示。
软件部分用汇编语言进行编程,采用模块化设计思想。
该系统硬件电路简单,子程序具有通用性,完全符合设计要求。
关键词:里程/速度;霍尔元件;单片机;LED显示Bike speed system design based on single chipABSTRACTWith the developing of people’s life, the bicycle is not only th e universal tool of transportation and substitute for walking, but becomes the first choice of entertainment and exercising. The bicycle mileage/speed can fulfill the basic need of people’s life, so that they can learn the speed and the mileage of the bicy cle. In this paper, the bicycle mileage/speed design based on the Hall element is elaborated. By AT89C52 as kernel, using A44E Hall element to measure revolution, the measure and statistic are achieved. The range information is saved by 24C02 when the power is off, the bicycle speed can be displayed on LED. In this article, the hardware circuit and software design of bicycle mileage/speed instrument are introduced in detail. About the hardware, the pulse number is transmitted of one cycle of the bicycle into Single Chip Microcomputer system. Then the signal processed by Single Chip Microcomputer system is sent to display scream. About the software, in assemble language; the program is designed in the mode of modules. The system has simple hardware, common sub-program, and meets the demand of design..Keyword:Mileage / speed; Hall element; Single chip microcomputer; LED引言自行车被发明及使用到现在已有两百多年的历史,这两百年间人类在不断的尝试和研发过程中,将玩具式的木马车转换到今日各式新颖休闲运动自行车,自行车发展的目的也从最早的交通代步的工具转换成休闲娱乐运动的用途。
基于单片机的自行车测速系统设计与实现论文

桂林电子科技大学毕业设计(论文)报告用纸第1 页摘要随着社会的进步发展和环保意识的增强,能够锻炼身体,且能环保出行的自行车成了大众的宠儿。
随自行车的快速发展,人们对自行车的功能要求也越来越高。
自行车测速仪通过测量并显示出行时的日期、时间、温度、速度和里程数,能够较好的满足人们对自行车的基本需求。
本设计通过分析自行车测速仪的原理,基于STC89C52单片机和C语言,设计和实现了一种自行车测速系统。
该系统主要包括单片机数据处理、电机测速、温度测量、时钟计时、显示数据、按键控制七大功能模块。
在系统实现中,硬件部分以STC89C52单片机为处理核心,用红外对管传感器将车轮的转数转换为电脉冲,进行处理后送入单片机,通过测量电机转的圈数,经过数据处理得到速度和路程数。
软件部分采用C语言进行编程,实现系统的控制与显示。
本系统的实现达到了预期的设计目标。
关键词:自行车测速;STC89C52单片机;红外对管传感器;C语言AbstractWith the development of social progress and environmental protection consciousness, can physical exercise, andgreen travl bicycle ,became the darling of the public. With the rapid development of bicycle, the bicycle features people are increasingly high requirements. Bicycle speedometer can display the travel date, time, temperature, speed and mileage by measuring,to better me people's basic needs for bicycle.This design through the analysis of principles of bicycle speedometer, based on STC89C52 singlechip and C language,design and implementation of a bicycle speed system.The system includes a SCM data processing, motor speed, temperature measurement, timing, data shows,key control that seven major function module.In the system realization, The hardware part with STC89C52 SCM as core processor. Using the infrared tube sensor will wheel speed is converted into electrical pulses, processed into the microcontroller.By measuring the motor cycles,after data processing, we can know the speed and distance. The software using C language programming ,to realize the system control and display. The realization of this system reaches the expected design goal.Key words:Bicycle Tachometer ;STC89C52 single chip microcomputer; Infrared tube sensor; C language目录引言 (2)1 设计要求 (2)1.1 毕业设计题目 (2)1.2 设计的主要功能 (2)2 工作原理和系统结构 (3)3 硬件设计 (4)3.1 系统总电路图 (4)3.2 单片机控制处理模块 (4)3.3红外对管测速模块 (8)3.4 DS1302时钟芯片模块 (10)3.5 DS1302温度采集模块 (12)3.6 LCD显示模块 (14)3.7 电机驱动模块 (15)3.8 按键功能、供电和串口下载模块 (15)4 软件设计 (18)4.1 Keil uVision 4软件介绍 (18)4.2 程序设计思想与开发环境 (18)4.3 主程序设计 (19)4.4 各个模块程序设计 (19)4.4.1 红外对管测速模块程序设计 (19)4.4.2 DS18B20温度测量模块程序设计 (21)4.4.3 DS1302时钟芯片模块程序设计 (24)4.4.4 LCD12864显示模块程序设计 (27)5 系统测试 (28)5.1 硬件调试 (28)5.2 软件调试 (29)5.3 对实际电路进行测试 (29)6 总结 (31)致谢 (32)参考文献: (33)附录 (34)引言自行车是传统产业,具有100多年的历史,由于环保以及交通的问题,自行车再度成为世界各国特别是发达国家居民喜爱的交通、健身工具。
【毕业设计】基于单片机自行车测速系统设计-精品

基于单片机自行车测速系统设计摘要随着居民生活水平的不断提高,自行车不再仅仅是普通的运输、代步的工具,而是成为人们娱乐、休闲、锻炼的首选。
自行车的速度里程表能够满足人们最基本的需求,让人们能清楚地知道当前的速度、里程等物理量。
本论文主要阐述一种基于霍尔元件的自行车的速度里程表的设计。
以 AT89C52 单片机为核心,A44E 霍尔传感器测转数,实现对自行车里程/速度的测量统计,采用 24C02 实现在系统掉电的时候保存里程信息,并能将自行车的里程数及速度用LED实时显示。
文章详细介绍了自行车的速度里程表的硬件电路和软件设计。
硬件部分利用霍尔元件将自行车每转一圈的脉冲数传入单片机系统,然后单片机系统将信号经过处理送显示。
软件部分用汇编语言进行编程,采用模块化设计思想。
该系统硬件电路简单,子程序具有通用性,完全符合设计要求。
关键词:里程/速度;霍尔元件;单片机;LED显示Bike speed system design based on single chipABSTRACTWith the developing of people’s life, the bi cycle is not only the universal tool of transportation and substitute for walking, but becomes the first choice of entertainment and exercising. The bicycle mileage/speed can fulfill the basic need of people’s life, so that they can learn the speed and the mileage of the bicycle. In this paper, the bicycle mileage/speed design based on the Hall element is elaborated. By AT89C52 as kernel, using A44E Hall element to measure revolution, the measure and statistic are achieved. The range information is saved by 24C02 when the power is off, the bicycle speed can be displayed on LED. In this article, the hardware circuit and software design of bicycle mileage/speed instrument are introduced in detail. About the hardware, the pulse number is transmitted of one cycle of the bicycle into Single Chip Microcomputer system. Then the signal processed by Single Chip Microcomputer system is sent to display scream. About the software, in assemble language; the program is designed in the mode of modules. The system has simple hardware, common sub-program, and meets the demand of design..Keyword:Mileage / speed; Hall element; Single chip microcomputer; LED引言自行车被发明及使用到现在已有两百多年的历史,这两百年间人类在不断的尝试与研发过程中,将玩具式的木马车转换到今日各式新颖休闲运动自行车,自行车发展的目的也从最早的交通代步的工具转换成休闲娱乐运动的用途。
基于单片机自行车测速仪的设计毕业设计

基于单片机自行车测速仪的设计摘要本设计主要阐述一种基于单片机与霍尔传感器等元件的测速仪设计。
以AT89C51单片机为核心,实现对自行车里程、速度、时间、温度等参数的测量,并能简单的将里程及速度用LCD实时显示。
在本文中详细介绍了测速仪的硬件电路和软件设计。
硬件部分利用霍尔传感器将每秒内的脉冲数传入单片机系统,然后经单片机系统计算处理并将过处理结果送LCD显示。
软件的设计采用模块化结构,使程序的逻辑关系更加简洁。
使硬件在软件的控制下协调运作。
仿真,所设计的硬件电路及软件程序是正确的,实际的硬件电路中也基本上能够满足设计要求。
关键词:里程/速度,时间,温度,霍尔元件,单片机,LCDAbstractThis design mainly elaborated based on MCU and Hall element of speed instrument design. Take STC MCU as the core, Hall element speed, realizes to the bicycle mileage, speed, time, temperature measurement, and a simple bicycle mileage and speed with the LCD real time display. The hardware part using the Hall element will bike per second pulse number of incoming MCU system, and then by the single chip microcomputer system calculation processing and processing result to the LCD display. Program design in order to facilitate the expansion and the change, the software design uses the modular structure, make the logic relations more concise. Make hardware tocoordinatethe operation under the software control. Simulation experiments show that the designed hardware circuit and software program are correct, practical hardware circuit also basically can satisfy the design requirement, but due to the knowledge, in practice there are still some problems in the hardware circuit.Keywords: Mileage / speed,time, temperature, Hall element, MCU,LCD毕业设计(论文)原创性声明和使用授权说明原创性声明本人郑重承诺:所呈交的毕业设计(论文),是我个人在指导教师的指导下进行的研究工作及取得的成果。
基于单片机的自行车里程速度计设计 精品

基于单片机的自行车里程速度计设计摘要随着自行车行业和电子技术的发展,自行车里程速度计技术也在不断进步和提高,用户对自行车里程速度计的要求也越来越高,因此设计了自行车里程速度计。
本文主要研究了以单片机为基础的自行车里程速度器的设计。
采用STC89C52单片机为主要控制芯片,运用自行车车轮上的传感器进行计数,通过一定时间间隔对信号的采集,结合自行车本身车轮参数,经过单片机对采集信号进行分析计算,最终在液晶显示器LCD 上显示车辆行驶的里程和速度,同时运用其他按键分别自行车单里程计数,瞬时速度、最大速度和平均速度显示,具有超速报警。
该设计重点阐述了系统的工作原理、硬件构成、各部分的主要功能以及软件的结构和实现。
自行车里程速度计的设计本着安全、方便、节能、人性化的原则进行,可使现代生活显著提高。
关键词:自行车,STC89C52, LCD1602IBicycle mileage velocity meter based on MCUABSTRACTAlong with the development of the bicycle industry and electronic technology, bicycle speedometer technology is also in constant progress and improve, user demand for bicycle mileage is more and more is also high, so I chose bicycle mileage speedometer This article mainly introduced take the monolithic integrated circuit as the foundation rental car fare register design. Uses the 89C52 monolithic integrated circuit for the primary control chip, using the pressed key signal imitation rental car wheel counting signal, simultaneously utilizes other pressed keys to control the rental car movement to carry passengers separately/the spatial vehicle condition, the kilometer idea regulation/waiting time and the traveling schedule expense amount to the demonstration. The system used three groups of nixietubes, the utilization dynamic display technology has demonstrated the distance in kilometer, the standby period and the expense separately. Meanwhile carries on the design using the software programming to the monolithic integrated circuit timer, produces the waiting timed pulse signal.this article elaborated with emphasis system's principle of work, the hardware constitution, various part of major functions as well as software's structure and realizes.The mileage log system with STC89C52 as control core, using sensors to detect signals, by a certain time interval signal collection, in combination with itself, bicycle wheel parameters through single chip microcomputer for the analysis of the collected signal, finally displayed on the LCD screen LCD vehicle mileage and speed, overspeed alarm。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
基于单片机自行车测速系统设计摘要随着居民生活水平的不断提高,自行车不再仅仅是普通的运输、代步的工具,而是成为人们娱乐、休闲、锻炼的首选。
自行车的速度里程表能够满足人们最基本的需求,让人们能清楚地知道当前的速度、里程等物理量。
本论文主要阐述一种基于霍尔元件的自行车的速度里程表的设计。
以 AT89C52 单片机为核心,A44E 霍尔传感器测转数,实现对自行车里程/速度的测量统计,采用 24C02 实现在系统掉电的时候保存里程信息,并能将自行车的里程数及速度用LED实时显示。
文章详细介绍了自行车的速度里程表的硬件电路和软件设计。
硬件部分利用霍尔元件将自行车每转一圈的脉冲数传入单片机系统,然后单片机系统将信号经过处理送显示。
软件部分用汇编语言进行编程,采用模块化设计思想。
该系统硬件电路简单,子程序具有通用性,完全符合设计要求。
关键词:里程/速度;霍尔元件;单片机;LED显示Bike speed system design based on single chipABSTRACTWith the developing of people’s life, the bi cycle is not only the universal tool of transportation and substitute for walking, but becomes the first choice of entertainment and exercising. The bicycle mileage/speed can fulfill the basic need of people’s life, so that they can learn the speed and the mileage of the bicycle. In this paper, the bicycle mileage/speed design based on the Hall element is elaborated. By AT89C52 as kernel, using A44E Hall element to measure revolution, the measure and statistic are achieved. The range information is saved by 24C02 when the power is off, the bicycle speed can be displayed on LED. In this article, the hardware circuit and software design of bicycle mileage/speed instrument are introduced in detail. About the hardware, the pulse number is transmitted of one cycle of the bicycle into Single Chip Microcomputer system. Then the signal processed by Single Chip Microcomputer system is sent to display scream. About the software, in assemble language; the program is designed in the mode of modules. The system has simple hardware, common sub-program, and meets the demand of design..Keyword:Mileage / speed; Hall element; Single chip microcomputer; LED引言自行车被发明及使用到现在已有两百多年的历史,这两百年间人类在不断的尝试与研发过程中,将玩具式的木马车转换到今日各式新颖休闲运动自行车,自行车发展的目的也从最早的交通代步的工具转换成休闲娱乐运动的用途。
随着居民生活水平的不断提高,自行车不再仅仅是普通的运输、代步的工具,而是成为人们娱乐、休闲、锻炼的首选。
因此,人们希望自行车的功用更强大,能给人们带来更多的方便。
自行车里程速度表作为自行车的一大辅助工具也正是随着这个要求而迅速发展的,其功能也逐渐从单一的里程显示发展到速度、时间显示,甚至有的还具有测量骑车人的心跳、显示骑车人热量消耗等功能。
本设计采用了MCS-51系列单片机设计一种体积小、操作简单的便携式自行车的速度里程表,它能自动地显示当前自行车行走的距离及运行的速度。
第1章系统总方案论证与分析1课题主要任务及内容本课题主要任务是利用霍尔元件、单片机等部件设计一个可用LED数码管实时显示里程和速度的自行车的速度里程表。
本文主要介绍了自行车的速度里程表的设计思想、电路原理、方案论证以及元件的选择等内容,整体上分为硬件部分设计和软件部分设计。
本文首先扼要对该课题的任务进行方案论证,包括硬件方案和软件方案的设计;继而具体介绍了自行车的速度里程表的硬件设计,包括传感器的选择、单片机的选择、显示电路的设计;然后阐述了该自行车的速度里程表的软件设计,包括数据处理子程序的设计、显示子程序的设计;最后针对仿真过程遇到的问题进行了具体说明与分析,对本次设计进行了系统的总结。
具体的硬件电路包括AT89C52单片机的外围电路以及LED显示电路等。
软件设计包括:芯片的初始化程序、定时中断采样子程序、显示子程序等,软件采用汇编语言编写,软件设计的思想主要是自顶向下,模块化设计,各个子模块逐一设计。
2任务分析与实现本设计的任务是:以通用MCS-51单片机为处理核心,用传感器将车轮的转数转换为电脉冲,进行处理后送入单片机。
里程及速度的测量,是经过MCS-51的定时/计数器测出总的脉冲数和每转一圈的时间,再经过单片机的计算得出,其结果通过LED显示器显示出来。
本系统总体思路如下:假定轮圈的周长为L,在轮圈上安装m个永久磁铁,则测得的里程值最大误差为L/m。
经综合分析,本设计中取m=1。
当轮子每转一圈,通过开关型霍尔元件传感器采集到一个脉冲信号,并从引脚P3.2中断0端输入,传感器每获取一个脉冲信号即对系统提供一次计数中断。
每次中断代表车轮转动一圈,中断数n轮圈的周长为L的乘积为里程值。
计数器T1计算每转一圈所用的时间t,就可以计算出即时速度v。
当里程键按下时,里程指示灯亮,LED切换显示当前里程,与当速度键按下时,速度指示灯亮,LED切换显示当前速度。
要求达到的各项指标及实现方法如下:1. 利用霍尔传感器产生里程数的脉冲信号。
2. 对脉冲信号进行计数。
实现:利用单片机自带的计数器T1对霍尔传感器脉冲信号进行计数。
3. 对数据进行处理,要求用LED显示里程总数和即时速度。
实现:利用软件编程,对数据进行处理得到需要的数值。
最终实现目标:自行车的速度里程表具有里程、速度测试与显示功能,采用单片机作控制,显示电路可显示里程及速度。
3硬件方案设计测速,首先要解决是采样的问题。
使用单片机进行测速,可以使用简单的脉冲计数法。
只要转轴每旋转一周,产生一个或固定的多个脉冲,将脉冲送入单片机中进行计算,即可获得转速的信息。
常用的测速元件有霍尔传感器、光电传感器和光电编码器。
里程测量传感器的选择也有以下几种方案:使用光敏电阻对里程进行测量、利用编码器对车轮的圈数进行测量、利用霍尔传感器对里程进行测量、利用干簧管型传感器测量里程。
光敏电阻对光特别敏感,当白天行驶时,外界光源将导致光敏电阻发出错误信号;光敏电阻对环境的要求相当高,如果光敏或发光二极管被泥沙或灰尘所覆盖,光敏电阻就不能再进行准确测量;而编码器必须安装在车轴上,安装较为复杂;霍尔元件或干簧管不但不受天气的影响,即使被泥沙或灰尘覆盖也不会有影响,而且安装方便。
所以本设计采用霍尔元件对里程与速度进行测量,既简单易行,又经济适用。
使用霍尔传感器获得脉冲信号,其机械结构也可以做得较为简单,只要在转轴的齿轮盘上粘上一粒磁钢,霍尔元件固定在前叉上,当车子转动时霍尔元件靠近磁钢,就有信号输出,转轴旋转时,就会不断地产生脉冲信号输出。
如果在齿轮盘上粘上多粒磁钢,可以实现旋转一周,获得多个脉冲输出。
在粘磁钢时要注意,霍尔传感器对磁场方向敏感,粘之前可以先手动接近一下传感器,如果没有信号输出,可以换一个方向再试。
这种传感器不怕灰尘、油污,在工业现场应用广泛。
霍尔传感器是对磁敏感的传感元件,常用于信号采集的有A44E,该传感器是一个3端器件,外形与三极管相似,只要接上电源、地,即可工作,工作电压范围宽,使用非常方便。
A44E的外形如图1.1所示。
1-Vcc 2-GND 3-OUT图1.1 A44E外形图单片机由于将CPU、内存和一些必要的接口集成到一个芯片上,并且面向控制功能将结构作了一定的优化,所以它有一般芯片不具有的特点:1. 体积小、重量轻;2. 电源单一、功耗低;3. 功能强、价格低;4. 全部集成在一块芯片上,布线短、合理;5. 数据大部分在单片机内传送,运行速度快、抗干扰能力强、可靠性高。
目前,单片机被广泛的应用于测控系统、工业自动化、智能仪表、集成智能传感器、机电一体化产品、家用电器领域、办公自动化领域、汽车电子与航空航天器电子系统以及单片机的多机系统等领域。
在设计中选用的是AT89C52单片机。
图1.2 系统的原理框图4软件方案设计通过软件控制单片机的功能是单片机的主要特点和优点,程序的设计要考虑合理性和可读性,遵循模块化设计的原则,采用自顶向下的设计方法。
模块化设计使程序的可读性好、修改及完善方便。
软件设计包括主程序、行车过程中里程和速度计算子程序、延时子程序、中断服务子程序、显示子程序等等。
中断子程序是将传感器产生的信号接入外部中断0,将经过74LS74分频后的信号接入外部中断1,利用中断和定时器对分别对里程进行累加、每转一周的时间进行测量。
数据处理子程序是将进入单片机的脉冲信号与实际要显示值之间有一定的对应关系,经过软件编程显示所需要的值。
显示子程序是将数据处理的结果送显示器显示。
系统软件总体流程图如图1.3所示。
图 1.3 软件总体流程图第2章硬件电路设计2.1 概述自行车的速度里程表的硬件电路设计是基础部分,它包括信号的捕获、放大、整形,单片机的计算处理,数码管的实时显示和单片机外围基本电路的设计,两大主要器件就是传感器和单片机。
传感器是获取自然或生产领域中信息的关键器件,是现代信息系统和各种设备不可缺少的信息采集工具。