counting pulses without using counters in 89c51 microcontrol

Status
Not open for further replies.

vijiembed

Newbie level 5
Joined
Jul 8, 2008
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
Hai friends,
I need an urgent help.
Pl help me.
Actually, i gave a sensor output pulse to a single IO pin.
I want to count how many pulses entered within a single second without using couner.
Is it possible in AT89c51 microcontroller or AT89c55wd microcontroller.
Pl help me...
Thanks in advance...


VIJI.R
 

Re: counting pulses without using counters in 89c51 microcon

connect the signal to interrupt.
in the ISR just increment the software variable and exit. use assembly for fast response.
hock
 

Re: counting pulses without using counters in 89c51 microcon

Hai friend,
Actually, i try to write the code for counting pulses without using timers.
The code is shown below.
Pl check it.



sbit x=P1^5; //the pulse is given to this pin
void sensor()
{
unsigned char i=1275,j=1000,k=0;
x=0;
delay();
while(j)
{
while(i)
{
if(x==1)
{
k=k+1; //k has the no of pulses
x=0;
}
i--;
}
j--;
}



Pl check it.
Thanks in advance.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…