hi all,
I am trying to use a 16-bit timer to get the time between rising edges on an input pin. I am going to use the capture/compare mode. What I am stuck on is the C syntax to ge the 16-bit timer value ie: I want to calculate the time in seconds (or milliseconds) using:
Timer elapsed time (s) = (Capture value -Start value)*Prescale/Sys Clock frequency (Hz)
where the Cature and Start values are the 16-bit values made from the high and low 8-bit values. What would the code look like?
float fElapsedTime = ( ??? - ??? )*64/18432000;
Also, how do I get the reverse (load values into the timer high and low reload registers) based on a time ie say 0.025s...
Sorry about the newb question...
Rob
I am trying to use a 16-bit timer to get the time between rising edges on an input pin. I am going to use the capture/compare mode. What I am stuck on is the C syntax to ge the 16-bit timer value ie: I want to calculate the time in seconds (or milliseconds) using:
Timer elapsed time (s) = (Capture value -Start value)*Prescale/Sys Clock frequency (Hz)
where the Cature and Start values are the 16-bit values made from the high and low 8-bit values. What would the code look like?
float fElapsedTime = ( ??? - ??? )*64/18432000;
Also, how do I get the reverse (load values into the timer high and low reload registers) based on a time ie say 0.025s...
Sorry about the newb question...
Rob