使用廉价器件的测电机转速电路

技术分类: 工业电子  微处理器与DSP  | 2007-11-19
来源:EDN | 作者:R García-Gil, J Castelló, and JM Espí, University of Valencia, Spain

  There δ=60/(tP×1024) rpm represents the resolution of the measured speed. To obtain a resolution of 1 rpm for this application, the fixed period you use as a timebase is 60/1024=58.59 msec. In this Design Idea, a low-cost microcontroller, the PIC16F873, IC1, from Microchip performs these operations. This microcontroller also drives the LCD, IC2, which shows the rotational speed in rotations per minute.

  In a similar fashion to the circuit in Reference 1, you apply the quadrature pulses of the encoder to IC1’s RB0/INT input, which ge

nerates a high-priority interrupt at the rising edge of the pulse. These interruptions allow you to compute nP by increasing a counter, which initializes after it reaches fixed period tP. Moreover, the microcontroller’s internal 8-bit timer, Timer 0, registers tP, which generates a tM (timer interruption) each 286 µsec for a clock frequency, fCLK, of 14.3 MHz: tM="4"×28/fCLK/4=286 µsec. This calculation means that fixing the timebase, tP, requires 205 timer interruptions (tP/tM). When the counter reaches this time, the count, nP, determines the rotational speed, according to the equation. Finally, this value appears on the screen of the LCD.

  In addition, a digital-to-analog conversion is necessary if the control system must measure the rotational speed. You can do this conversion without adding an expensive DAC by applying a PWM (pulse-width-modulation) output of the microcontroller to a lowpass filter comprising R2, R3, C4, C6, and IC3. The frequency of the PWM signal is 20 kHz, and the cutoff frequency of the lowpass filter is 160 Hz, which is much lower than the PWM frequency. In this design, the maximum duty cycle of the PWM signal corresponds to a rotational speed of 1500 rpm.

  You can download the source code for IC1’s program and assemble the software with MPLab from Microchip. You can alter constants within the software according to the encoder you use and your required resolution from the equation.

  Reference

  Jain, Abhishek, “Versatile digital speedometer uses few components,” EDN, May 12, 2005, pg 95.

  英文原文地址:http://www.edn.com/article/CA6495300.html

1】【2
加载中

对文章的评论

剩余字数:  

浏览该文章的用户还看过...

  • 文 章

  • 论 坛

  • 博 客

  • 小 组

设计资源与分销