How accurate does 7902.1Hz need to be?...
That's a 'approximate' cycle time of 126.54863896938788423330507080396uS... give or take a couple of digits...
Let's say your accuracy is +/- 1uS (you're running a 20MHz PIC and allowing for a handfull of instructions) that's worst case range of... 125usS to 127uS making 7874.01Hz to 8000Hz error window. with a 40MHz PIC and some really tight code you might reduce that to say +/- 100nS... that still gives an error of 126.4uS to 126.6uS namely 7898.89Hz to 7911.39Hz. What I'm trying to say is you'll be lucky to get within +/- 5Hz at that frequency.
Hmmmm... some things PICs on their own just aren't made to do.
Like another thread that had people wasting their lives getting a PIC to simulate a true Sine Wave... one of the joys of reading the forum is my coffee and morning laugh...
Bookmarks