Implement speed measurement using P89C51RC+IA and EMP7064S

Publisher:Lihua521Latest update time:2006-05-07 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Abstract: This article introduces a hardware circuit implementation method that applies the M/T method speed measurement principle and uses single-chip microcomputer P89C51RC+IA and EMP7064S to realize speed measurement. The implementation of the programmable device (EMP7064S) of the code disk pulse preprocessing circuit is also given.

    Keywords: code wheel speed measurement measurement time encoding pulse

Speed ​​measurement is an important part of the servo control system. So far, speed measurement can be divided into two categories: analog circuit speed measurement and digital circuit speed measurement. The development of microelectronics technology, the advancement of digital speed measurement technology, and the improvement of digital speed measurement performance have attracted people's attention to digital speed measurement.

With the development of microelectronics technology and the maturity of computer technology, digital speed measuring devices with computers as the core have emerged. Such a speed measuring device has a wide measuring range, flexible working methods, and wide adaptability, and has advantages that ordinary digital speed measuring devices cannot match. This article applies the M/T method speed measurement principle and uses PHILIPS P89C51RC+IA and ALTERAEPM7064S to achieve speed measurement.

1 Working principle of M/T measurement method

The key component used in digital speed measurement is the photoelectric encoder, commonly known as the code disk. The encoder is an angle sensor that converts the angle into a pulse train. The number of engraved lines m, the engraved line error ε and the electrical characteristics of the output signal are the main technical indicators of the code disk. The code disk outputs two rectangular pulse trains with a difference of 90°, and outputs m pulses per rotation. The rotational speed can be measured by measuring the frequency of the pulse train.

This article uses the M/T method to measure speed. This method requires a code disk pulse counter, a standard time counter, and a timer. The timer sets the measurement time Ts. Within the measurement time Ts, the code disk pulses and standard time signals are counted simultaneously. When the measurement time is up, a scheduled interrupt is generated. The microcontroller executes the interrupt program, reads the value of the code disk pulse counter and the standard time count, and calculates the rotation speed from the count value.

    Assume that the number of code disc markings is m, the code disc pulse frequency multiplication number is n, the standard time is TC (s), the code disc pulse count value is Cm, and the standard time count value is Ct, then the rotation speed ω=360Cm/mnTcCt(°/ s) .

2 EMP7064S implementation of code disk pulse preprocessing

In a digital speed measurement system using a code wheel, the processing of the code wheel signal includes frequency multiplication, output control and direction signal extraction.

2.1 Code disk pulse frequency multiplication circuit

Doubling the frequency of the code wheel output pulse is equivalent to increasing the number of code wheel markings, which can improve the measurement accuracy and improve the dynamic performance of the measurement. The size of the code disk pulse count value affects the size of the engraving error. For the same code disk, after the output signal is processed by the code disk pulse frequency multiplication circuit, the frequency increases, the count value of the code disk pulse within the same measurement time is large, and the error caused by the engraved line in the measurement results is small. At the same time, if the lower limit of the measurement time is fixed, the lower limit of the measurable rotation speed will be low. The pulse signal of up to 4 times the frequency can be obtained by pulse processing of the code disk. The processing circuit and timing relationship are shown in Figure 1.

2.2 Capture pulse output control circuit

In order to ensure the connectivity of the measurement, the code disk pulse counter and the standard time counter must count continuously, and the count values ​​of these two counters must be read continuously during the measurement process. In order to prevent the counter value from being unstable and misreading during the counting process, a counter with a capture function must be used. At the required moment, capture the count value into the register by capturing the signal, and then read the capture register, so that the read value is stable and reliable. In order to ensure that the read code disk pulse count value and the standard time count value are at the same time, the capture signal should be the same. This signal is the code disk pulse signal. In this way, it is only the basic condition to ensure that the two count values ​​read out are at the same time. If a new capture occurs during the process of reading out data, the data read out will not be at the same time, causing measurement errors. Therefore, after reading the data, you should use the capture flag to determine whether a new capture has occurred. If a new capture occurs, read again until no new capture occurs. In this method, if the output of the capture signal is not limited, when the frequency of the code disk output pulse is very high, the adjacent capture time will be short. When it is short to a certain extent and the capture time is less than the reading and judgment time of the program, the count value cannot be read, thus limiting the upper limit of the speed measurement. Controlling the capture pulse output is to increase the upper limit of speed measurement. The functional circuit and timing are shown in Figure 2. Among them, C is the capture signal, and Ctl is the output control signal, which is used to control the output of the code disk pulse Fm.

2.3 Direction signal extraction circuit

When measuring rotational speed, not only the magnitude of the speed but also the direction of the speed must be given. From the measurement principle used, it can be seen that the direction information cannot be obtained during the measurement process, and the rotation direction can only be obtained through the code wheel output pulse. Assume that when turning clockwise, A leads B by 90°; conversely, B leads A by 90°. According to this relationship, the direction signal can be obtained. The circuit and timing to implement this function are shown in Figure 3. D represents different levels representing different directions of rotation.

3. Composition of measurement system

A timer, a code disk pulse counter with capture function and a standard time counter with capture function are used in the measurement process. P89C51RC+IA has three timers TIME0~0 and a PCA programmable counting array. Among them, timer 2 and PCA array have count capture function. The measurement block diagram shown in Figure 4 is constructed according to the measurement method used. As can be seen from Figure 4, timer 2 is used to count code disk pulses, the PCA array is used to count standard time signals, and timer 1 is used to determine the measurement time, thus forming a basic measurement system. The measurement time is determined during measurement, thus forming a basic measurement system. The code disk pulse Fm (signal after frequency multiplication) and the standard time signal are counted simultaneously within the measurement time Ts. Timer 1 generates an interrupt every time Ts. Both Timer 2 and the PCA count array are captured on the falling edge. The values ​​of the capture register at time a and b are the counting values ​​of the counter at time ti and ti+1 respectively. Set the values ​​of timer 2 and PCA array capture register at time a and b to Cti, Cti+1 and Cmi, Cmi+1 respectively. Then the rotation speed is ω=[90 (Cmi+1-Cmi)/mTc(Cti+1-Cti)](°/s).

4 Software design

    For the system to work properly, it requires the cooperation of software. In addition to completing the hardware initialization of the system, the system software must also complete real-time control of the hardware circuit, perform input and output operations and data analysis on data, and perform corresponding processing based on the results of data analysis. Since this system is designed as a personal instrument using a PC ISA card, the structure of the measurement system is simplified, and the computing resources of the PC can be fully utilized to greatly increase the upper limit of speed measurement. A brief test program block diagram is shown in Figure 5.

This article introduces the digital measurement method based on the M/T method to implement rotational speed measurement for PHILIPS P89C51RC+IA and ALTERA EMP7064S. Due to the special structure of P89C51RC+IA microcontroller timer 2, PCA programmable counter capture function and the programmable function of EMP7064S, the circuit design is greatly simplified and the reliability of the system is improved. This instrument is made into a PC ISA card personal instrument, which can not only utilize the resources of the PC, but also simplify the measurement system. This design has been successfully used in the rate measurement of the simulated test turntable.

Reference address:Implement speed measurement using P89C51RC+IA and EMP7064S

Previous article:Development of mobile temperature data collector with infrared interface
Next article:Research on Microcomputer Keyboard Interface and Its Application in Instruments

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号