Design of digital frequency meter based on AT89S52

Publisher:科技创新实践者Latest update time:2013-10-12 Source: eefocusKeywords:AT89S52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
In the field of electronics, frequency is one of the most basic parameters, and has a very close measurement accuracy with the measurement schemes and measurement results of many other electrical parameters. Therefore, the measurement of frequency is particularly important, and the research on frequency measurement methods has received more and more attention. As a kind of measuring instrument, the frequency meter is often called an electronic counter. Its basic function is to measure the frequency and period of the signal. The application range of the frequency meter is very wide. It is not only used for general simple instrument measurement, but also widely used in teaching, scientific research, high-precision instrument measurement, industrial control and other fields. With the rapid development of microelectronics technology and computers, especially the emergence and development of single-chip microcomputers, traditional electronic measuring instruments have undergone major changes in principle, function, power consumption, reliability and other aspects. At present, there are various multifunctional, high-precision, high-frequency digital frequency meters on the market, but the price is not cheap. In order to meet the needs of practical work, this paper considers a frequency meter designed with a single-chip microcomputer (AT89 S52) as the control platform and a 1602ALED display as the display component. The entire design uses timing and counting methods to measure frequency, which is not only feasible, but also small in size, low in cost, low in power consumption, high in precision, automatic range conversion, strong in confidentiality, and simple in design, which greatly reduces the design cost and implementation complexity. The hardware circuit of the frequency meter is drawn with PRIT EL drawing software, and the single-chip microcomputer control program of the software part is written in assembly language using KELL-51 as the development tool, while the realization of the frequency meter uses Proteus simulation software for simulation and testing. Finally, through comprehensive debugging, all the required functions can be realized, which fully meets the requirements of this design.

1 Design Idea

Traditional frequency measuring instruments are large in size, consume a lot of energy, and are mainly operated manually. The biggest disadvantage is that they are not programmable. Their range conversion, data measurement, sampling control and processing cannot be controlled by program instructions, and they cannot be used as a micro-intelligent subsystem to interface with a large automatic control or test system. In view of these shortcomings, this frequency meter has made improvements in design. First, the square wave pulse after signal amplification and shaping is used as the control gate signal, and then the counter and latch are used to directly count the signals in different frequency ranges to complete the frequency division function. The divided signal is sent to the single-chip microcomputer by the interface circuit, and the single-chip microcomputer counts it. Finally, the counting result is converted into the original frequency value through calculation, and finally the value is displayed through the dynamic display circuit. The advantages are: the frequency meter fully realizes the software interface between the single-chip frequency meter, frequency sampling, and single-chip microcomputer, so that the selection of frequency measurement range, the measurement of frequency data, sampling, and the boundary conversion of coding and the conversion and storage of data can be automatically performed through the software programming of the single-chip microcomputer, thereby realizing the complete intelligence of frequency measurement and sampling, so that the system can independently constitute the core circuit of a micro-intelligent frequency measuring instrument, and can also be used as an intelligent subsystem in a large automatic control or test system. This system uses AT89S52 single-chip microcomputer as the control core, and sends the processed measured signal (the self-test signal output by CD4013 frequency division at the 30th pin of the single-chip microcomputer) to the single-chip microcomputer (P3.4 terminal), which is then processed by the single-chip microcomputer and the measured frequency value is displayed through the LCD display module. All systems are powered by AC220V-DC5V low ripple power supply module. The overall design idea can be represented by block diagram 1. The design includes 4 major modules: 1) system control module; 2) low ripple power supply module; 3) frequency division self-test module (external signal acquisition module); 4) LCD display module.

 

2 Hardware design

2.1 System control module

The system control adopts an 8-bit CMOS microcontroller AT89S52 manufactured by a high-performance and low-power process. It provides the following standard features: 4K bytes of program memory, 128 bytes of RAM, 32 I/O lines, 2 16-bit timers/counters, a 5-interrupt source and two-priority interrupt structure, a duplex serial port, on-chip oscillator and clock circuit, and the single-chip system circuit is shown in Figure 2. 2.2 Low ripple power supply module The power supply of this system is completely 220 V AC, which is rectified by diode bridge and filtered by capacitor, and then coordinated by 9014 and TOP46 to ensure a large and stable current. R2, D2, Q4, etc. ensure 5 V voltage, and the system has overcurrent protection inside to ensure that the output current does not exceed the maximum allowable value. When the output current reaches the maximum allowable value, it will automatically reduce the output current. It has an internal working area limit to prevent the voltage regulator from entering the unsafe area (the output tube voltage drop and output current are less than the specified value). The final output ripple is less than 4 MV 5 V voltage, ensuring that it is not affected by the power supply when testing the frequency. The power supply circuit is shown in Figure 3. 2.3 Frequency division self-test module In order to facilitate detection, this system uses the ALE (pin 30) of 89S52 to complete the self-test function. This function also requires the assistance of CD4060 (to complete 14 frequency division). CD4060 represents a 14-bit binary serial counter, and the pins and functions are omitted; CD4060 consists of an oscillator and 14-level binary counter bits. The structure of the oscillator can be RC or crystal oscillator circuit. When CR is high, the counter is cleared and the oscillator is invalid. All counter bits are master-slave triggers CP1 (and CP0) falling edge counters count in binary. The use of Schmitt triggers on the clock pulse line has no restrictions on the clock rise and fall time. Its circuit structure in the system is described in the overall simulation diagram below. According to the introduction of the system block diagram, the method of receiving sine waves, square waves, and triangle waves from the outside world and measuring the cycle is generally adopted. If you want to receive sine waves, square waves, and triangle waves from the outside world and measure them, you must go through the two processes of amplification (attenuator, amplifier) ​​and shaping (Schmitt trigger, follower) to convert them into standard measurement square waves and send them to the gate for counting. The amplification and shaping process is required because the input signal amplitude is uncertain, which may be large or small, so it is inconvenient to measure the input signal. If it is too large, the device may be burned, and if it is too small, the device may not be detected. Therefore, in the design, the input waveform should be considered to be amplified, limited, shaped, and impedance transformed (the impedance transformation of the emitter follower composed of the operational amplifier increases the input impedance). [page] 2.4 LCD display module 1602A LCD has the characteristics of low power consumption, long life, and large amount of displayed information, so it is widely used. In order to realize the display information required by the design, this article uses the 1602LCD liquid crystal module to realize the simple display of display information. For example, the score information is displayed in the form of code. Of course, a 128*64 LCD would provide better display effects, but for practicality and price considerations, this article uses a 1602A-LCD to meet the design requirements.













3 Software Design Flowchart

According to the design principle, its working process is a measurement method that directly displays the measured signal frequency with decimal numbers. In order to facilitate testing and reading, this design allows it to automatically shift gears, that is, a standard frequency (such as 100Hz) is designed at each gear (Hz, kHz). When measuring the signal, the single-chip microcomputer directly samples and compares it with the standard frequency, divides the gear interval, and displays it on the output. The main program flow in this design is shown in Figure 4. Some main programs: 4 Kell simulation results This design uses Proteus software to build a simulation circuit, and uses Kell software for software and hardware joint debugging. After debugging with Kell software, a HEX file is generated without error. At this time, the source program and the HEX file should be saved in the same directory, otherwise the simulation will go wrong. Then add the source program to the Source directory of the schematic diagram, double-click the AT89C52 chip, and add the HEX file to the directory. At this time, the generated file has been burned into the chip. If the program is correct and the hardware circuit is connected correctly, set the pulse frequency and input it into the simulation software. Click the simulation run button at the bottom left of the schematic design interface to get the final simulation result as shown in Figure 5. 5 Conclusion The digital frequency meter is a basic measuring instrument that uses digital display to display the frequency of the measured signal. Due to its high measurement speed, high accuracy and intuitive display, it can test a variety of physical quantities if equipped with appropriate sensors. Therefore, it is widely used in aerospace, electronics, measurement and control and other fields. With the rapid development of electronic technology, it will be more widely used in various fields. This paper successfully realized the design of the digital frequency meter by using the single-chip microcomputer AT89S52, Proteus simulation software and Kell simulation software. The comprehensive debugging results show that the design proposed in this paper has the advantages of small size, low cost, low power consumption and high accuracy compared with the traditional frequency measurement system, and is suitable for various measurement circuits.














Keywords:AT89S52 Reference address:Design of digital frequency meter based on AT89S52

Previous article:Design of Multifunctional Digital Control Current Source Based on AT89S52
Next article:Design and implementation of thyristor trigger circuit based on AT89C2051 single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 15:34

Design of MEMS Gyroscope Signal Acquisition and Processing System Based on AT89S52
MEMS (Micro Electron Mechanical System) gyroscope is an instrument that can accurately measure the orientation of an object. It is not only low-cost, small in size and light in weight, but also can be integrated with microelectronics processing circuits to achieve mechatronics. MEMS gyroscopes are suitable for appli
[Industrial Control]
Design of MEMS Gyroscope Signal Acquisition and Processing System Based on AT89S52
Design of voice broadcast multimeter based on single chip microcomputer
1. Introduction Multimeter is one of the most commonly used electrical measuring instruments. There are two main types in use, namely, analog pointer multimeter and digital multimeter. There is a common problem when using these two multimeters, that is, you must use your eyes to observe the measured point and the di
[Microcontroller]
Design of voice broadcast multimeter based on single chip microcomputer
Design of digital tachometer based on AT89S52 and CPLD
With the improvement of people's living standards, flowers are gradually favored by people, cultivating sentiment and purifying the air. Using a single-chip microcomputer, a home intelligent watering device is designed to realize automatic watering, saving manpower and facilitating people's business trips without affec
[Microcontroller]
Design of digital tachometer based on AT89S52 and CPLD
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号