Question: We want to use Timer 2 to log the time an INT 0 event occurs. When the INT 0 interrupt occurs we will write the
We want to use Timer to log the time an INT event occurs. When the INT
interrupt occurs we will write the value in TMR to a circular buffer. In the following assume a
PICFJGA microcontroller operating with a MHz instruction cycle clock, Fcy
a Show the code needed to initialize amd enable Timer with a ms period. Use the smallest
possible time increment. Timer should be assigned its natural priority.
b Show the definition and initialization of the element circular buffer, buffer, as well has the
front and back pointers.
c Code an INT interrupt service routine ISR which will grab the value in TMR as quickly
as possible, place it in the circular buffer, and update the pointers.
d Briefly describe how this scheme differs from using the input capture peripheral to log the time
of an event on a pin.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
