Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/11/05 13:40
Read: times


 
#94689 - A probable solution...
Responding to: ???'s previous message
Hi mahesh!

From your post I could make out that you are using timer 0 as input for the pulses. I'll give you a probable solution.(I haven't tried it practically, its just a theoretical solution.)

* Use timer 0 as a 16 bit counter to count external pulses.
* Use timer 1 as a 16 bit timer and configure it for a 100ms delay.
* Clear th0 and tl0 to 00h.
* Start timer 1.
* In the timer 1 ISR, obtain the value of th0 and tl0 registers.
* Now, this count is the number of pulses in 100ms i.e. 0.1sec. Hence, when multiplied the count by 10d it will give the frequency of the input signal.

IMPORTANT NOTE: The 8051 samples the T0 or T1 pin in S5,P2(State 5, Phase 2) of every machine cycle. So in order to increment the count by 1 in the counter the input to the T0 or T1 pin must be high for one machine cycle and low for one machine cycle. Thus, the minimum time period of the input signal should be two machine cycles.(i.e. maximum frequency that can be measured at the T0 or T1 pins is crystal frequency divided by 24.)
SOURCE OF ABOVE INFORMATION:
The 8051 microcontroller-Architecture, Programming and Applications.(Second Edition)
Author: Kenneth J Ayala

List of 13 messages in thread
TopicAuthorDate
A doubt in making timmer and a counter            01/01/70 00:00      
   Intel Application Note            01/01/70 00:00      
   Re            01/01/70 00:00      
   If you could            01/01/70 00:00      
      This is the code for timer n counter            01/01/70 00:00      
         Error message?            01/01/70 00:00      
            Kai dont u refer the code it is incompl            01/01/70 00:00      
               'org' and 'db'...            01/01/70 00:00      
   Look Up Table:            01/01/70 00:00      
      Oh            01/01/70 00:00      
   A probable solution...            01/01/70 00:00      
      HI Can I use the lookup table for Fract            01/01/70 00:00      
         Convert it !            01/01/70 00:00      

Back to Subject List