I am receiving an FSK signal to a microcontroller and I need to demodulate this signal.
The signal I am receiving is similar to the orange one depicted in my figure but it is a sine wave not a square wave.
View attachment 68637
I need to convert this signal to zeros and ones. I know a basic method that measures the period using a zero crossing comparator and then calculate the frequency. That's fine.
I know that the high frequency is 15Khz and low frequency is 10khz and data rate is 1KHZ. My question is when should I sample the signal?
A clear answer is every 1ms. I can use a timer and for every 1ms I have to measure the period. but what if the timer has an error, let's say +-1us, then after 1000 bits, I may have an error. My timer (clock) may have an accumulated error and I might read faster or slower than it should be?
What can I do to adjust my timer (clock)?
The signal I am receiving is similar to the orange one depicted in my figure but it is a sine wave not a square wave.
View attachment 68637
I need to convert this signal to zeros and ones. I know a basic method that measures the period using a zero crossing comparator and then calculate the frequency. That's fine.
I know that the high frequency is 15Khz and low frequency is 10khz and data rate is 1KHZ. My question is when should I sample the signal?
A clear answer is every 1ms. I can use a timer and for every 1ms I have to measure the period. but what if the timer has an error, let's say +-1us, then after 1000 bits, I may have an error. My timer (clock) may have an accumulated error and I might read faster or slower than it should be?
What can I do to adjust my timer (clock)?