duration of time between two front C code

Status
Not open for further replies.

MARWEN007

Junior Member level 2
Joined
Apr 16, 2011
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,481
Hey everyone, well I would calculate the time in seconds between my rising input signal is a square wave frequency of 50 Hz and amplitude 5V I found a good sample code in the index of peak I c compile knows not that solve my problem or is nn 't there any constraints or variables to modify the code if you like it give me your idea and your comment and your advice because I want the similer on isis and display whenever the time between the two fronts here's my code as you isis diagram on the board pinout please





 

To capture the time between two rising edges you only need one CCP (enable interrupts on CCP1):

1) Set the interrupt to occur on each rising edge.
2) On the first rising edge record the CCP_1 value into 'rise' variable.
3) On each subsequent interrupt: calculate the period as CCP_1 - rise; store the current CCP_1 value in 'rise'.
4) Repeat (3) as necessary.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…