There are many methods for measuring the frequency of periodic waves, but most of them are to calculate the frequency indirectly through measurement. This article introduces the use of the widely used MCS-51 series single-chip microcomputer to measure the frequency of periodic waves, and uses LED to intuitively display the frequency in digital form, realizing intelligent measurement and eliminating the trouble and errors of indirect frequency calculation. The article explains its measurement principle, design and implementation, introduces the main procedures, and conducts error analysis.
At present, single-chip microcomputers are widely used in many fields of national economic construction and daily life, and have become an indispensable and important tool for the modernization of measurement and control technology. This article adapts to this development trend and applies the MCS-51 series single-chip microcomputer to the measurement of periodic wave frequency, which is automatically displayed through the LED display, which brings great convenience to the frequency measurement.
Design Thoughts
Schmitt triggers are used to transform periodic signals with slowly changing edges, such as sine waves, triangle waves, or analog signals of any shape, into rectangular pulses of the same frequency. The number of external pulses within a certain period of time is measured by two 16-bit timers/counters inside the MCS-51 series microcontrollers. After processing, the frequency of the added signal is directly displayed through the LED. TO inside the microcontroller is used for timing, and Tl is used for counting (falling edge triggering). When a counting pulse comes, it counts once. When TO starts timing, T1 starts counting; when TO timing 1s is up, T1 stops counting. The block diagram is shown in the figure below.
hardware design
The hardware circuit for measuring frequency mainly consists of two parts: counting pulse forming circuit and counting display circuit. The counting pulse forming circuit uses a "555" timer to form a Schmitt trigger to transform the external periodic wave so that the output is a rectangular pulse. The circuit is shown in the figure above, and the counting display circuit is shown in the figure below, which mainly includes:
(1) An 89S02 single-chip microcomputer produced by INTEL with a crystal oscillator frequency of 12 MHz . Through software programming, its internal timer TO is set to time, and T1 counts the external pulses. Then the measurement result value is output through the PO port. The 89S02 has an 8K flash memory, which can store 90 to 100 field measurement data for playback and adjustment.
(2) 4-digit seven-segment common cathode LED display.
(3) Since the 4-bit common cathode dynamic scanning display is adopted, the segment code is provided by the PO port of 89S02, and the bit select line is provided by P2.0~P2.3 of the P2 port of 89S02. Since the input and output ports of 89S02 cannot provide enough sink current , G1~G4 are used to provide enough display current to the LED.
software design
The program for measuring frequency using MCS-51 single chip microcomputer mainly includes: initialization program, timing counting program, LED display program. The initialization program is omitted. The main program of timing counting:
Measuring range
The maximum measurement frequency under the above program is 255Hz. After proper adjustment of the program, the maximum measurement frequency can be 1/12 of the main frequency of 89S02, but under the premise of ensuring measurement accuracy, the maximum measurement frequency should be arranged below 1/100 of the main frequency.
Error Analysis
The maximum measurement frequency of the above program is 255Hz. Since the microcontroller has 2 to 6 machine cycles when responding to an interrupt, according to the maximum error calculation, 6-2=4 machine cycles, the interrupt response occurs 20 times in 1s, and the most unfavorable cumulative error time is 4×20=80 microseconds. Therefore, the maximum error under this program is 80/1000000=0.08/1000. This accuracy can fully meet the needs of on-site detection.
Previous article:An Example of Extended Application of MCS-51 Single-Chip Data Memory RAM
Next article:51 MCU floating point operation principle
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Review of SGP40] + Testing the sensor I2C communication with Arduino
- Analysis of the causes of high temperature failure of DCDC power modules
- Near Field Communication (NFC) Transceiver Reference Design
- In electromagnetic field simulation, what are the advantages and disadvantages of FDTD and FEM algorithms?
- Combining 51 code to analyze the programming ideas of RFID card reader
- X-NUCLEO-IKS01A3 sensor driver transplantation based on STM8S-DISCOVERY
- TMDSEVM572X development board link emulator
- [Sipeed LicheeRV 86 Panel Review] 3-System Burn-in Test
- STM32MP157A-DK1 Review - 2. MPU Functions
- [AB32VG1 development board review] OLED screen display driver