Start stop timers using two different interupts

Status
Not open for further replies.
Hi All
I've had a look through google and cant quite find the answer. So please bear with me.

Im wanting to look at the phase difference between two voltage or current inputs. What i would like to do is half rectifiy two inputs and feed one into interupt one and another into intrupt two. And start and stop the timer based on the interupts rising . Im aware i can do this using comparators but would like to try this way because i'm not looking for phase angle between current and voltage im looking at trying to build a bridge circuit to tell me the difference between one instrument transformer and another.

The examples of found using timers are using the same interupt for the timer.

As this project is still at theoretical stage I dont have any code to share but if this is a possible way of doing it, i would appreaciate it if you could point me in a direction of some examples
 
Each interrupt can capture the timestamp when it fires, the main code can wait for these to change and take the
difference perhaps?
 
For comparing phases by time difference between two input channels the timer clocks must be synchronised, so you should use two Capture Compare channels connected to the same timer, on the other hand then they will share interrupts so some little code is needed to find out which or both channels has fired. Look in the code for FreqMeasure or FreqMeasureMulti to see a good example of the details of period measurement.
 
Status
Not open for further replies.
Back
Top