This article is the C source program of the frequency meter based on the AT89C51 microcontroller. The main functions of this frequency meter are as follows:
1. Test function
It indicates all the test functions possessed by the digital frequency meter, generally including frequency measurement, period, accumulated pulse number, frequency ratio, time interval and self-comparison functions.
2. Measuring range
It describes the valid measurement ranges of different functions. For example, when measuring frequency, the measurement range is the frequency range of the measured signal when the digital frequency meter is under normal working conditions. It is generally expressed by the upper and lower limits of the frequency. Most of the low-end starts from 10Hz; the high-end varies depending on the frequency meter. different. Therefore, the high-end frequency is the basis for determining low, medium, and high-speed counters. When measuring the cycle, the measurement range is expressed by the maximum value and minimum value of the common cycle.
3. Input characteristics
Digital frequency meters generally have 2 to 3 input channels. When testing different items, the measured signals can be input to the instrument through different channels. Input characteristics are a set of characteristic parameters indicating that the digital frequency meter is connected to the signal source under test, and usually include the following aspects.
(1) Input sensitivity. Usually refers to the effective value of the minimum input voltage that the instrument can operate normally. The sensitivity of commonly used digital frequency meters is around 100mV.
(2) Maximum input voltage. Refers to the maximum input voltage value allowed by the instrument. If the measured signal exceeds this value, the instrument cannot guarantee normal operation and may even be damaged.
(3) Input coupling method. The instrument is configured with two coupling modes, AC and DC. When AC coupling is used, the signal to be measured is input through the DC blocking capacitor. When DC coupling is used, the signal to be measured directly enters the input circuit. AC coupling is suitable for measuring signals with DC level, and DC coupling is suitable for measuring low-frequency pulse or step square wave signals.
(4) Input impedance. In order to reduce the load on the signal source, digital frequency meters generally use high-frequency input impedance. Input impedance consists of two parts: input resistance and input capacitance.
4. Display and working mode
It indicates what can be displayed, the number of digits displayed, the display device used and the duration for displaying the measurement results after a measurement is completed. Some also explain that the electronic counter has a "non-memory" display mode or a "memory" display mode.
5. Output
There are several standard frequency signals that the instrument can directly output, and it can indicate the encoding method and output level of the output measurement data.
C language program
#include
#include
#define uchar unsigned char
#define uint unsigned int
fly temp[8]={0,0,0,0,0,0,0,0};
fly temp1[8]={0,0,0,0,0,0,0,0};
fly T1count,timecount,T1count1,timer,yushu,yushu1;
long fre,frx;
float zhou;
bit flag;
bit flag1;
void delay(flying);
bit result;
sbit ird=P1^1;
sbit id=P1^0;
sbit clr=P1^2;
sbit en=P1^5;
sbit rw=P1^6;
sbit rs=P1^7;
sbit rd=P3^7;
sbit kb=P1^3;
sbit kx=P1^4;
sbit A0=P3^6;
sbit A1=P3^7;
bit start;
flying code tab1[]=“fre: ”;
flying code tab2[]=“frx: ”;
void delay(flying z)
{
fly x,y;
for(x=z;x》0;x--)
for(y=110;y》0;y--);
}
guide_bz()
{
rs = 0;
rw = 1;
in = 1;
result = (bit)(P2&0x80);
in = 0;
return(result);
}
void write_com(uchar com)
{
while(bz_guide());
rs = 0;
rw = 0;
in = 0;
P2=with;
delay(5);
in = 1;
delay(5);
in = 0;
}
void write_dat(uchar dat)
{
while(bz_guide());
rs = 1;
rw = 0;
in = 0;
P2=that;
delay(5);
in = 1;
delay(5);
in = 0;
}
void init()
{
flying number;
in = 0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
write_com(0x80);
for (number=0; number
Previous article:Design and simulation implementation of multifunctional traffic light control system based on AT89C52
Next article:How many timers does the 52 microcontroller have? Comparison of 52 microcontroller timer 1 and 52 microcontroller timer 2 programs
Recommended ReadingLatest update time:2024-11-16 09:27
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
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