View Single Post
  #5   Report Post  
Old January 21st 05, 10:38 PM
Anthony Fremont
 
Posts: n/a
Default


"NM3R" wrote

Check out Mike Berg's website, he has an interesting modem detector
using zero-crossing principle.
http://www.ringolake.com/pic_proj/zcd/zcdmodem.html


I did something like this a few months ago on a 16F628. I was
attempting to build a line-powered caller-id box. I got it real close,
but could never quite get 100% copy on the data. I could get better
than 99%, but even one bit error is one too many. Since I couldn't use
an o-scope (no isolation transformer or probe set), I don't know for
sure what the problem was. I do know one thing, it was the busiest PIC
program I ever wrote. ;-) I really need a logic analyzer or DSO to
debug this thing. It's possible (due to a recent project having issues
that I resolved) that my bit errors were due solely to noise coming from
the LCD. Sometimes it would get the data copy perfect, but most of the
time there was 1 or 2 bit errors in the burst. Very occaisionally, you
couldn't make anything out. :-(

I used the CCP module and TMR1 to measure the width of the top-half of
the incoming sound. Based upon the width, I would toggle a PIC pin
effectively ouputing a 1200 baud serial stream on that pin. That didn't
look to good (0 vs 1 bit width distortion because of my technique), so I
retimed the bits using another timer (TMR2). I then fed that pin to
another pin that was a bit-banged serial receiver (RB0 int for start
bit, tmr0 for the rest) that stuffed the received bytes into a circular
queue. The main level code only looked for data to appear in the
circular buffer and then printed it on an LCD. 90% of the time was
spent in ISR routines. The whole thing consumed like 3mA. The PIC ran
at 4Mhz and 5V using a Zener diode for regulation. IME, 2400 BAUD would
not have been possible without using a higher speed crystal.

I have never tried sending modem tones from a PIC, but AIUI it's
entirely possible.