C source program design of AT89C51 microcontroller frequency meter

Publisher:静静思索Latest update time:2023-06-20 Source: elecfansKeywords:AT89C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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


Keywords:AT89C51 Reference address:C source program design of AT89C51 microcontroller frequency meter

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

Design of drip detection system based on AT89C51 microcontroller
1. System Overview The modules used in the system include AT89C51 microcontroller + 8-bit common anode digital tube + 74HC245 driver + button + small light alarm The system uses the AT89C51 microcontroller as the main control. The timing time is displayed through the digital tube. The timing time can be set throug
[Microcontroller]
Design of drip detection system based on AT89C51 microcontroller
Design of Decimal Calculator Based on AT89C51
This system uses AT89C51 single-chip microcomputer as the controller to realize the four-digit "+", "-", "*", "/" operation. The operation result is displayed through the digital tube and has a clearing function. AT89C51 has the following features: 40 pins, 4k BytesFlash on-chip program memory, 128 bytes of random acc
[Microcontroller]
Design of Decimal Calculator Based on AT89C51
Automatic counting and thread trimming system made by AT89C51
ORG 0000H AJMP PLAY ORG 001BH AJMP JONG PLAY: MOV P1, #0FFH: Program initialization MOV P2, #00H MOV 70H, #00H MOV 71H, #00H MOV 72H, #00H MOV 73H, #00H MOV 74H, #00H MOV 75H, #00H MOV 76H, #00H MOV 77H, #00H MOV R1, #00H MOV R2, #00H MOV TMOD, #50H MOV TL1, #0FFH MOV TH1, #0FFH SETB TR1 SETB ET1 SETB OF ;/////////
[Microcontroller]
Design of fully automatic sun tracking system using AT89C51 microcontroller as intelligent unit
introduction With the rapid development of social economy, the energy problems faced by mankind have become more and more prominent. Solar energy, as a clean energy, has undoubtedly received widespread attention from all countries. Under the same conditions, the greater the light intensity, the greater the solar cell
[Microcontroller]
Design of fully automatic sun tracking system using AT89C51 microcontroller as intelligent unit
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
Guess you like

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号