cancel
Showing results for 
Search instead for 
Did you mean: 

calculating time period between two pulses

mailtoarup
Associate II
Posted on June 08, 2003 at 13:45

calculating time period between two pulses

3 REPLIES 3
mailtoarup
Associate II
Posted on June 05, 2003 at 08:28

hai ,

i want to calculate time period between pulses.my micro (st72f264)

will receive continuous cf pulse from AD7751 in pin no:7.now pls tell me how to clculate time period....and how do i find measured time in sec/usec/msec.......i mean in which register will it be stored.....

thanks,

arup

itsmejatinus
Associate II
Posted on June 05, 2003 at 09:22

This can be easily done by using the input capture function. Refer 72264 datasheet. You can select the desired timer frequency and accordingly calculate the time between two pulses.IC1HR and IC1LR holds the counter value.Hope it would help.

mailtoarup
Associate II
Posted on June 08, 2003 at 13:45

helloi was going thro' the example program called in_capt.asm in st7software library..

i have some query......

1)

Now that i have connected PB7 externally to input capture pin1(PB0) of St72F264 in my demo board(Indart-st72f264)....so we r generating software interrupt thro program(by making pb7 low

and high).is not it??

so there is no need to modify MISCR registerei0/ei1....is it so???

2)

now how can i calculate the exact time period between two pulses...

During first rising edge of the pulse go to interrupt routine and take the TAACR value into TAIC1R registerand for next rising edge it does the same thing.now what will be the elapsed time??how can i calculate that????do i need to subtract two consecutive TAIC1R vale(other wise value register) to compute elapsed time period .is there any possibility for timer to overflow??

And i noticed one thing when i run this program in step by step

mode it does not goto timer interrupt routine...what's the reason...?

3)

now as i said in my privios query in this thread .....I want to measure pulses which will come with time period of 562msec or above(approx.. thro physical observation).in this case if i use 8MHz crystal ..my f(cpu)=8/2=4MHz..and

f(timer)=fcpu/2.....(timer will over flow after 32.768msec)///.>

=fcpu/4....(timer will over flow after 65.536msec

=fcpu/8.....(timer will over flow after 131.072msec)

so timer will surely overflow....so what modificatiom i should do in the program.in that case how will i calculate the exact time....how

can i proceed.

pls help me with code if posible...

thanks

arup