Thanks for bearing with me....and keep those ideas coming! (to my knowledge there are no prescalers set anyhere in my code)
Ok, I think I know (in part) what the problem is....& I throw myself open to public ridicule.
My signal path is this...
Signal 1 -> Audio preamp->schmitt trigger-> comparator1 input pin
Signal2 -> Audio preamp-> all pass filter-> schmitt trigger-> comparator2 input pin
When dealing with phase shift - it's easier on the eye to work with sine waves on a scope (for me at least)....*but*, doh, I was aligning aformetnioned 'zer degrees phase shift' in sine wave form as viewed on the scope. Alas, it appears that becuase each of the signals is of different amplitude going into the schmitt tirrger, the schmitt triggers are erhm triggering at slightly different times wrt to one another - which translates itself into phase shift! (now I'm pretty sure I was checking at the input to the pic comparators the other night, so I'm bemused how this has only come to light)
I therefore need to modify my circuit to ensure that the signals feeding into the shcmitt are of exactly the same amplitude (preferable amplified to nice sharp edged square wavea) ....this should ensure they trigger at the same point
Ok, something else I've established tonight ....if I feed signal1 into both schmitt triggers & ultimately into both comparators (so, absolutely no phase shift in play whatsoever then!)....I get a constant count of 29....this stays at 29 no matter what the input frequency - would it therefore be safe to assume that that's how many clock cycles it takes for all of the interrupt routines, storing the counts etc to work?
So therefore my new plan of attack is.....rejig my 'feed' circuitry to ensure an identical signal feeds amplitude into both schmitt triggers....and then also subtract 29 from the comp2 count. (at my upper frequency of 1.5Khz...I get a comp1 count of about 3000...therefore 1%, hich in phase terms is an error of about 3.6 degrees - not ideal.)
Would using any other form of interrupts/hardware get this 'floor' count of 29 down? (faster processor, higher frequency oscillator - 40Mhz?)
Bookmarks