1、 目录目录 摘要摘要 1 abstract 2 1 数字时钟数字时钟. 3 1.1 单片机的基本知识. 3 1.1.1 数码管动态显示原理. 3 1.1.2 键盘扫描原理. 4 1.2 程序说明和流程图. 5 1.2.1 程序说明. 5 1.2.2 流程图. 6 1.3 调试与仿真. 8 2 2 数字温度计数字温度计. 9 2.1 总体设计框图. 9 2.2 温度采集部分的设计. 9 2.2.2 DS18B20 温度传感器与单片机的接口电路. 10 2.2.3 设计流程图. 12 2.4 读出温度子程序. 12 2.5 温度转换命令子程序. 13 2.6 计算温度子程序. 13 2.7 显示数
2、据刷新子程序. 14 2.8 调试与仿真. 14 3 数字频率计数字频率计. 15 3.1 数字频率计设计流程图. 15 3.2 软件控制部分. 15 3.3 数据显示电路. 16 3.4 软件设计流程图. 17 3.5 数字频率计的仿真. 18 4 串口通信串口通信. 19 4.1 单片机串行和并行通信. 19 4.2 串口通信设计框图. 21 4.3 调试与仿真. 23 5 心得与体会心得与体会. 24 6 实物焊接图实物焊接图. 25 附录附录 A A 程序结合实现功能切换程序结合实现功能切换 . 26 参考文献参考文献 37 1 摘要摘要 此次的设计单片机硬件和实现外围电路的方案,因为
3、已经有了电路板,重点 介绍以单片机 AT89C52 为控制核心,实现键盘显示电路、多功能数字时钟、实时 温度检测显示、频率测量的数字频率设计。时钟计数是利用单片机的定时器完成 的,利用 6 位 8 段数码管显示电路显示。测温采用温度传感器芯片采集温度,经 过各种转换和运算最后显示在数码管上。 测频的基本原理是采用在底频段直接测 频法,通过单片机定时器定时 1s 计算中断的次数,然后将次数通过转换显示在 数码管的各位,设计的频率计范围能够达到 1HZ50KHZ,满足所要求的频率范围, 测量精度较高。程序部分是通过看教材加以理解在和同学请教改编而成。 2 abstract The design o
4、f the single chip microcomputer hardware and realize the buffer circuit scheme, for there are already a circuit board, introduced AT89C52 single chip microcomputer to as control core, realize the keyboard display circuit, multi-function digital clock, and the real-time temperature test showed that,
5、the number of frequency measurement frequency design. The clock counting of the microcontroller timer is complete, using six 8 period of digital tube display circuit display. Temperature measuring the temperature sensor chip collection temperature, through a variety of transformation and operation f
6、inally displayed in the digital tubes. The basic principle of measuring frequency is adopted in the direct method of measuring frequency band, through the microcontroller timer timing 1 s calculation interrupt the number of times and then will be displayed in digital times through the conversion tube of everyone, the design of the frequency meter can reach 1 HZ range 50 KHZ, meet the required frequency range, has high accuracy. Parts of the program is see through the teaching materials are u