摘要随着居民生活水平的不断提高,自行车不再仅仅是普通的运输、代步的工具,而是成为人们娱乐、休闲、锻炼的首选。自行车里程表能够满足人们最基本的需求,让人们能清楚地知道当前的速度、里程等物理量。主要阐述一种基于霍尔元件的自行车里程表的设计。以AT89C52单片机为核心,A44E霍尔传感器测转数,实现对自行车里程/速度的测量统计,采用24C02实现在系统掉电的时候保存里程信息,并能将自行车的里程数及速度用LED实时显示。文章详细介绍了自行车里程表的硬件电路和软件设计。硬件部分利用霍尔元件将自行车每转一圈的脉冲数传入单片机系统,然后单片机系统将信号经过处理送显示。软件部分用汇编语言进行编程采用模块化设计思想。该系统硬件电路简单,子程序具有通用性,完全符合设计要求。关键词:里程/速度;霍尔元件;单片机;LED显示-1-AbstractWiththedevelopingofpeople’slife,thebicycleisnotonlytheuniversaltooloftransportationandsubstituteforwalking,butbecomesthefirstchoiceofentertainmentingandexercising.Thebicyclemileage/speedcanfulfillthebasicneedofpeople’slife,sothattheycanlearnthespeedandthemileageofthebicycle.Inthesepaper,thebicyclemileage/speeddesignbasedontheHallelementiselaborated.ByAT89C52askernel,usingA44EHallelementtomeasurerevolution,themeasureandstatisticareachieved.Therangeinformationsaresavedby24C02whenthepowerisoff,thebicyclespeedcanbedisplayedonLED.Inthisarticle,thehardwarecircuitandsoftwaredesignofbicyclemileage/speedinstrumentareintroducedindetail.Aboutthehardware,thepulsenumberistransmittedofonecycleofthebicycleintoSingleChipMicrocomputersystem.ThenthesignalprocessedbySingleChipMicrocomputersystemissenttodisplayscream.Aboutthesoftware,inassemblelanguage,theprogramisdesignedinthemodeofmodules.Thesystemhassimplehardware,commonsub-program,andmeetthedemandofdesign.Keywords:Mileage/speed;Hallelement;SingleChipMicrocomputer;LED-2-目录第1章绪论..........................................................41.1课题产生的背景.............................................41.2课题的主要任务及内容.......................................4第2章自行车里程表总体方案设计......................................62.1任务分析与实现.............................................62.2自行车里程表硬件方案设计...................................62.3自行车里程表软件方案设计..................................10第3章自行车里程表硬件电路设计.....................................123.1概述......................................................123.2传感器及其测量系统........................................123.3芯片简介..................................................143.4单片机外围电路的设计......................................20第4章自行车里程表软件程序设计.....................................254.1概述......................................................254.2自行车里程表总体程序设计..................................254.3中断子程序的设计..........................................274.4数据处理子程序的设计......................................274.5显示子程序的设计..........................................30第5章系统调试与分析...............................................325.1自行车里程表系统调试......................................325.2调试故障及原因分析........................................33结论................................................................34参考文献............................................................35致谢...............................................................36附录Ⅰ自行车里程表硬件系统原理图....................