Hi Pedro (Pedro Drummond), in <199801080045.AAA82450@out4.ibm.net> on Jan 8 you wrote: > In this project I am involved with, I have to send certain numbers through > the phone line. Since it is just a few numbers each time, I decided not to > use a modem chip, and just code my digits in 3 frequencies (440 Hz, 1400 Hz, > 2300 Hz) right out of the processor. > > Basically, what I do to send the code "32" is send 3 pulses (100 ms each) of > 1400 Hz, one pulse of 2300 Hz (same duration) as a separator, and then 2 > more pulses of 1400 Hz. Pulses are separated by a 100ms silence. Roughly, > that's what I am doing. Could not be simpler. > > Concerning the hardware, I have a strong clear signal going out and a > beautiful square wave at the receiver's opamp output. > > I am decoding these frequencies by measuring the pulse width. If the result > is the same for, say, 5 consecutive measurements, then the corresponding > frequency is validated. > > Well, it works great... in some phone lines. And not so great in others, > specially if both phones are separated by a greater distance. I don't know > why, but the decoder tends to miss some pulses in this situation. > > Why this is happening ? Someone told me that it would be better to fill the > 100 ms silences with some frequency, just to keep feeding signal to my > receiver's amplifier. > I don't think it makes much sense, though... First off, you might get by cheap and reliable by using a DTMF sender / receiver chip. Those cost only a few bucks and are targetted on reliable low bandwidth data communication via phone lines. If you really don't want to use one of these, and stay with your current setup... I think your problem is timing. A noisy phone line will cause you to count lots of fake pulses. Your setup requires 5 valid measurements continously, which might fail on such a line (if your frequency is low). You should add a low pass filter: sample the port pin several times and count the 1 and 0 bits. If there are more 1 bits, consider this like reading a 1. If there are more 0's, you've read a 0. A short noise spike won't hurt you anymore then. There are further options to improve your receiver. If you still have problems, you can send email and I'll tell you some more. Those require more programming effort, though.