文档介绍:基于单片机的电机测速系统
摘要:在工程实践中,经常会遇到各种需要测量转速的场合,例如在发动机、电动机、机床主轴等旋转设备的试验运转和控制中,常需要分时或连续测量、显示其转速及瞬时速度。为了能精确地测量转速,还要保证测量的实时性,要求能测得瞬时转速。本文介绍了一种基于STC89C52单片机的电机测速系统,该系统利用霍尔传感器采集脉冲信号,通过定时计数算法程序,将转速结果实时显示出来。C语言具有开放性和灵活性强的特点,编写起来比较易于上手,不像汇编语言那样局限。所以本次采用的是C语言编程来实现。
关键词:单片机,电机测速系统,霍尔传感器,定时
Abstract:In engineering practice often need to measure speed encounter various occasions. For example, At the engines, motors, machine tool spindles and other rotating equipment’s operation and control of the pilot often need frequent time-sharing or continuous measurements show its speed and instantaneous velocity. In order to accurately measure speed, ensure the real-time measurements and require instantaneous speed can be measured. This paper introduces a puter-based STC89C52 motor speed system, the system uses Hall sensor pulse signal collected through the timer counting algorithm programs, will speed the results of real-time display. C programming language has the openness and flexibility, strong features, and it’s difficult to write easy to fly. It is unlike the assembly language as limitations. So, this is the C programming language used to implement
Keyword:Single-chip,Motor Speed System,Hall sensor,Timing
目录
1 前言 1
2
2
2
方案选择 3
4
4
4
传感检测电路 5
6
主控器STC89C52的介绍 7
时钟电路 8
复位电路 9
数码显示电路 10
RS-232串行通信接口电路 11
MAX232介绍 11
12
4. 软件设计 14
14
T0定时中断程序设计 15
设计总结 17
参考文献 18
附录 19
附录1:电机测速系统总电路图 19
附录2:电机测速系统总程序代码 20
1 前言
随着科技的飞速发展,计算机应用技术日益渗透到社会生产生活的各个领域,而单片机的应用则起到了举足轻重的作用。单片机又称单片微控制器,就是把一个计算机系统集成到一个芯片上。它完整地包含了计算机内部的CPU(运算器、控制器)、程序存储器(相当于计算机的硬盘)、数据存储器(相当于计算机的内存)、输入输出端口等。虽然它的运算速度无法和计算机相比,但在一些实际的控制应用场合已经足够使用了。对于高等院校电子类和计算机类的学生,学习单片机是很重要的,而进行应用单片机的课程设计更是重中之重,将所学理论知识应用到实际,使更加全面的了解和掌握单片机的应用。
在工程实践中,经常会遇到各种需要测量转速的场合,例如在发动机、电动机、机床主轴等旋转设备的试验运转和控制中,常需要分时或连续测量、显示其转速及瞬时速度。为了能精确地测量转速,还要保证测量的实时性,要求能测得瞬时转速。本文提出一种基于STC89C52单片机实施电机转速测量的方法,利用霍尔传感器采