View Single Post
  #3   Report Post  
Old January 16th 05, 11:36 PM
Tim Wescott
 
Posts: n/a
Default

Joel Kolstad wrote:

wrote in message
oups.com...

I'm interested in building a FSK modem around a PIC microcontroller,
and am wondering how most FSK receivers convert the frequency to bits.



The cheap and sleazy route is what you see many people doing on PICs (and
similar) for DTMF detection: To detect a frequency F1, using your ADC's
digital output, multiply the digital word by sin(F1*t) and cos(F1*t).
Square and add the result, so that you have
(ADC_Out*sin(F1*t))^2+(ADC_Out*cos(F1*t))^2. Take the running average of
what you get, and use a threshold detector to decide whether or not that
frequency is prsent.

The 'cheap and sleazy' part of this comes in as follows:

1) Arrange the frequencies to be, e.g., F1 and F2=2*F1. Sample at 8*F1.
Now, all the sine and cosines become +/-1 -- no multiplier needed.
2) Use 'abs' rather than squaring the results -- no multiplier needed.

This isn't particularly robust (it fails rapidly if the input frequencies
are off -- the DTMF guys typically don't have to worry about this because
DTMF generation is very well controlled), but it gets the job done when you
have a relatively high SNR signal and it's very simple and fast to implement
since you've gotten rid of the multiplications.

For more narrowly spaced FSK detection, this still works, although you start
having to build up tables of sin/cosine values -- and perform the
multiplication. If you do have a hardware multiplier around in your
particular PIC, this is perhaps still the way to go. If not, you start
looking at what resources you do have... you can design more 'proper'
digital filters with coefficients of only +/-1 and zero, although sometimes
the implementation ends up being more CPU intensive than just doing software
multiplies.

Using a tool such as Matlab is very handy for trying our various
filtering/detectoin techniques prior to having to sit down and code up the
result in C or assembly for a system running in real time!

---Joel Kolstad


You could also do this by coding up the digital filters using only
shifts. This is not for the faint of heart if you haven't done DSP
before, but it can be done and should get you fairly good results. I'd
recommend prototyping the algorithm on a PC then making sure that you
have enough horsepower in your target processor before you start
building a board.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com