1、 I 基于 STC89C52 单片机出租车计价器设计 摘 要 随着城市建设日益加快,象征着城市面貌的出租车行业也将加速发展。现在 各大中城市出租车行业都已普及自动计价器,所以计价器技术的发展有很好的前 景。尽管小城市尚未普及,但计价器的普及也是毫无疑问的,所以未来汽车计价 器的市场还是十分有潜力的。 出租车计价器是单片机的一种典型应用。基于单片机的计价器是由单片机和 外部电路组成。 包括检测模块, 控制模块, 人机模块。 里程检测模块由 A44E 构成, 控制模块包括 STC89C52 单片机和 AT24C02,人机模块包括独立键盘和 LED 动态 显示。 系统性能指标 1.设定价格; 2.显
2、示当前单价、行驶里程和总金额; 3.里程精确到 0.1 公里。 通过多次调试系统性能达到设计要求。 关键词:STC89C52,霍尔传感器 A44E ,I2C 总线,动态显示 II Design of Taximeter Based on STC89C52 ABSTRACT With the rapid development of city constriction, the taxi industry which symbolizes the cityscape also has an accelerated progress. Nowadays the automatic taximete
3、r has been widely used in taxi industry in many cites. Therefore, the development of automatic taximeter is doomed. Although automatic taximeter is not spread in some towns, there is no doubt that it would be popularized. Thus, in future the business of automatic taximeter is still potential. One ty
4、pical application of single chip computer is automatic taximeter. The hardware of this design is composed of single chip computer and peripheral circuits which consist of Detection Unit, Processing Unit and Human Computer Interaction Unit. The Detection Unit is based on Hall-effect sensor. The Proce
5、ssing Unit contains STC89C52 and AT24C02. Human Computer Interaction Unit is composed of keyboard and LED. The function of this system includes as follows: 1. Set the unit price; 2. Display the unit price, total amount and mileage. 3. Accuracy: 0.1km. After repeatedly debugging, the performance of t
6、his system is reached the design requirements. KEY WORDS: STC89C52, Hall-effect sensor, A44E, I2C Bus, Dynamic display III 目 录 前 言 1 第 1 章 系统工作原理 3 1.1 功能要求 . 3 1.2 基本原理 . 3 第 2 章 硬件设计 5 2.1 单片机最小系统单元. 5 2.2 霍尔传感器单元. 6 2.3 掉电存储单元. 8 2.4 键盘调整单元. 9 2.5 显示单元 .10 第 3 章 软件设计 .14 3.1 系统主程序14 3.2 里程计数中断程序15 3.3 中途等待中断程序15 3.4 计算程序 .17 3.5 显示程序 .18 3.6 键盘程序 .18 第 4 章 调试改进过程及运行结果分析21 4.1 动态扫描的调试和分析21 4.2 AT24C02 的编程与调试 21 4.3 按键查询功能的实现21 4.4 计算程序的分析与设计22 4.5 结果分析与性能改进23 4.6 计价器系统的仿真23 结 论 .26 谢 辞 .27