基于单片机的电子指南针设计
摘要:指南针是我国的四大发明之一,早期的指南针采用了磁化指针和方位盘的组合方式,这样的指南针携带起来很不方便,且指示灵敏度上有一定不足,准确性很差。本文通过对电子指南针基本工作原理的研究分析,采用磁阻(GMR)传感器采集某一方向磁场强度,然后通过MCU控制器对其进行处理并显示上传,达到了显示当前所指方向的目的。实际测试指南针模块精度达到1度,能够在LCD上显示当前方位,并能通过键盘控制上传数据到上位机。这样的指南针精度更高,更智能,在大大提高了精度的同时,也降低了成本和设计难度。并且本课题针对电子指南针的各个功能部件对电子指南针的关键部分做了详细的研究。采用单片机做为系统的核心控制芯片,而单片机的接口是数字信号的,想要它能够处理地球的磁场状况,必须要把磁场信号转化成电信号,然后经过D/A转换,把模拟的电信号转化成单片机可以处理的数字信号。把所得的数字信息通过主控制器进行处理,然后用人机界面表现出来,供我们来读取和应用。
关键字:单片机 指南针 传感器 液晶显示 磁场
Design Of Electronic Compass Based On Single Chip Microcomputer
Abstract: Compass is one of the four great inventions of China, the early compass magnetized pointer is adopted and the combination of the bearing plate, the compass is not very convenient to carry, and is said to have insufficient display sensitivity, accuracy is poor. This article through the analysis of the basic working principle of the electronic compass, the magnetic resistance (GMR) sensors to collect a certain direction magnetic field strength, and then through the MCU controller to deal with the upload and display, achieved the goal that displays the current pointed direction. Actual test precision of the compass module 1 degree, can be displayed on LCD and the current position, and can through the keyboard control to upload data to the PC. This compass accuracy is higher, more intelligent, in greatly improved the accuracy at the same time, also reduces the cost and difficulty of design. And this topic to electronic compass of each functional unit of a key part of the electronic compass made a detailed research. By single chip microcomputer as the core of the system control chip, and single chip microcomputer interface is digital signals, want it to deal with the earth’s magnetic field, magnetic field signals must be converted into electrical signals, then through the D/A conversion, the analog signals into A single chip can handle digital signals. The digital information processing through the main controller, and then the machine interface of choose and employ persons, for we to read and use.
Keywords:MCU compass sensor LCD magnetic fields
目录
第1章 绪论…………………………………………………………………………………………………. 1
1.1 电子指南针的原理以及发展背景………………………………………………………. 1
1.2 电子指南针的研究现状…………………………………………………………………….. 2
1.3 电子指南针的设计要求…………………………………………………………………….. 3
第2章 总体设计方案…………………………………………………………………………………… 5
2.1 系统基本方案设计……………………………………………………………………………. 5
2.2 磁阻传感器………………………………………………………………………………………. 6
2.3 磁场信号的采集和处理…………………………………………………………………….. 7
第3章 相关物理量的介绍……………………………………………………………………………. 9
3.1 磁场…………………………………………………………………………………………………. 9
3.2 磁感应强度………………………………………………………………………………………. 9
3.3 磁通量……………………………………………………………………………………………… 9
3.4 磁场方向………………………………………………………………………………………….. 9
3.5 磁感线……………………………………………………………………………………………. 10
3.6 地磁场……………………………………………………………………………………………. 10
第4章 系统电路的设计……………………………………………………………………………… 12
4.1 主控制器电路模块………………………………………………………………………….. 12
4.2 串口通信电路模块………………………………………………………………………….. 14
4.3 指南针和接口电路模块…………………………………………………………………… 15
4.4 实时时钟电路模块………………………………………………………………………….. 17
4.5 液晶显示电路模块………………………………………………………………………….. 18
第5章 系统程序的设计……………………………………………………………………………… 19
5.1程序设计思路与功能描述………………………………………………………………… 19
5.1.1 主监控程序……………………………………………………………………………. 19
5.1.2 实时时钟驱动………………………………………………………………………… 20
5.2 测试结果………………………………………………………………………………………… 20
第6章 结束语……………………………………………………………………………………………. 22
致谢……………………………………………………………………………………………………………. 23
参考文献…………………………………………………………………………………………………….. 24
附录……………………………………………………………………………………………………………. 26