2003-06-08 04:45 AM
calculating time period between two pulses
2003-06-04 11:28 PM
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, arup2003-06-05 12:22 AM
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.
2003-06-08 04:45 AM
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