- This topic has 4 replies, 5 voices, and was last updated 5 years, 6 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › 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); }
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.
can u write the code for the 1 with software interrupts….using TR1 and TR0 .????
thanx in advace
Can anyone provide me the full code of frequency counter using 8051.urgent please
Please visit link , there is project that mesure or count frequency https://www.engineersgarage.com/contribution/frequency-and-rpm-counter