Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

frequency counter using 8051(with the help of external interrups:

5 posts / 0 new
Last post
HASSAN ALI
HASSAN ALI's picture
Offline
Last seen: 7 years 9 months ago
Joined: 25/03/2011 - 00:04
frequency counter using 8051(with the help of external interrups:

hii want a code of

                                "frequency counter"

that counts the incoming pulses following is the code having some mistakes which i dont know.

kindly anybody help me in this matter.

regards.

 

code is:

 

#include <AT89X51.h>
# define T1 P3_2
#define RS P0_0
#define RW P0_1
#define E P0_2
#define dataline P2
void Delay(unsigned int time)
{
    unsigned int i;
    unsigned int j;
    for(j=0;j<time;j++)
        for(i=0;i<127;i++)
        ;
}
 void lcddata(unsigned char j)
{
    dataline=j;
    RS=1;
    RW=0;
    E=1;
    Delay(10);
    E=0;
    Delay(50);
}
void lcdcmd(unsigned char j)
{
    dataline=j;
    RS=0;
    RW=0;
    E=1;
    Delay(10);
    E=0;
    Delay(50);
}

void Convert_Display(unsigned char value)
{
  unsigned char x,d1,d2,d3;
  x=value/10;
  d1=value%10;
  d2=x%10;
  d3=x/10;
      lcdcmd(0x38);
    lcdcmd(0x0E);
    lcdcmd(0x01);
    lcdcmd(0x06);
    lcdcmd(0x86);
      Delay(50);
        lcddata(d3+'0');
        Delay(50);
        lcddata(d2+'0');
         Delay(50);
        lcddata(d1+'0');
        Delay(50);
 }
 unsigned char value;
 void timer0() interrupt 0
     {    
            
           TH1=0;
          
          
        TL1=1;
        value=TL1;
     Convert_Display(value);
             TR0=1;
        TH1=1;    
               }
 void main(void)
         {T1=1;    

        IE=0x81;
    
        TMOD=0x06;
       

         IT0=1;
          EX0 = 1;   // Enable EX0 Interrupt
           
           EA = 1;    // Enable Global Interrupt Flag

       
        while(1);  }
               
    

   

Amit Joshi
Amit Joshi's picture
Offline
Last seen: 8 years 3 weeks ago
Joined: 18/11/2010 - 16:18
I think it is need to program

I think it is need to program TCON register by this controller can under stand the type of interrupt signal whether it is edge-trigger or level trigger.

spawns
spawns's picture
Offline
Last seen: 7 years 10 months ago
Joined: 08/08/2011 - 01:03
can u write the code for the

can u write the code for the 1 with software interrupts....using TR1 and TR0   .????

thanx in advace

Harshita
Harshita's picture
Offline
Last seen: 5 months 8 hours ago
Joined: 26/09/2018 - 13:42
Full code
Can anyone provide me the full code of frequency counter using 8051.urgent please
Vishal
Vishal's picture
Offline
Last seen: 3 months 2 weeks ago
Joined: 17/01/2019 - 12:17
frequency counter

Please visit link , there is project that mesure or count frequency https://www.engineersgarage.com/contribution/frequency-and-rpm-counter

Log in or register to post comments