I'm developing an audio frequency radio modem, and have a problem I was hoping some of the gurus here could help me with. I greatly appreciate any help that can be provided!
In short, the modem will be used across a wide temperature range. To prevent oscillator drift, I've include the ability for it to 'tune' itself. The sine wave output can't be used with the count function (it doesn't reach the threshold voltage required for a high-to-low transition). So to calibrate the frequency, an op amp is fed the sine wave in one input and a 2.5V reference is fed into the other input to construct a square wave. The "count" function is used on the square wav. The audio frequencies I'm sampling are between 1.5 and 3 kHz. I'm using a 16F628a with a 20MHz xtal. 'Tuning' is implemented by adjustment of digital pots that act as trimmers in the oscillator.
Attached is a basic schematic of how I'm implementing it.
It starts off working great, but after a few minutes, sometimes it starts returning count values of 0. My questions are: have I correctly implemented the sine-to-square wav converter for use with the 16F628a? Is porta.2 have some quirks that make it bad for use with the count function? Are the resistance values I'm using on either side of the op amp satisfactory?
Any help is greatly appreciated!
Thanks in advance!
Dave
Bookmarks