Who knows, you may have to do just that... I don't think a PIC even at 40MHz will be able to take sufficient samples of a single wave period for you to construct a good enough picture of the incomming waveform to analyse distortions. However, if those distortions are constant within the waveform, you could take a number of samples across several wave periods (eg ten measurements across each of ten wave periods, and each set of measurements is offset from the previous by a constant) and combine them to produce an average picture. Still not something that I would attempt with a PIC.
If you phase lock your incomming signal to a generated sinewave at 40kHz, you will easily be able to detect deviations from the norm by negative summation. A PIC could then handle the results. Example, if you have a 2-channel Oscilloscope, CH1 has your input frequency, CH2 contains a pure Sinewave at 40KHz 180 degrees out of phase with CH1. By adding the two traces, the resultant is the deviation of the incomming waveform from the reference.




Bookmarks