DTMF Out on the SX
skynugget
Posts: 172
has anyone ever gotten the sx28 to make dtmf tones in sx/b?
i found some VP AppNote about it, but its a bit over my head, lol
thanks!
i found some VP AppNote about it, but its a bit over my head, lol
thanks!
Comments
Take a look at the datasheets for:
MT8889C - Integrated DTMF Transciever (about $5?)
TCM5089N - Touchtone Generator (Jameco 32803, $5)
LM567 - Tone Decoder ($1) Althought you can wire several of these together to interpret DTMF signals, this is probably more useful for detecting a single tone.
CM8880 - PDIP20 DTMF Transciever
CD22202 - DTMF decoder
TelTone 8870 - http://www.boondog.com/tutorials/dtmf/dtmf.htm#Parts
Just a suggestion.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Don't worry, John Couture, because you can still help with the INTERRUPT.
pj allen, i would think square wave would throw out to much trash for a dtmf decoder to interpret.
here's the src and doc from the vp library, I'm thinking it can be modified to run in the interrupt. I guess i should finally start learning assembly.
Post Edited (skynugget) : 4/27/2010 2:02:35 PM GMT
http://forums.parallax.com/showthread.php?p=741247
2 notes to generate dtmf in the interrupt should be easy to implement - just a small increase to your interrupt.· I think Jon actually did a polyphonic version in the thread.
I've been able to do up to 4 simultaneous notes playing music the same time, using a similar concept.· I'm sure·more can be done, as most of the interrupt·I was using·to calculate note·durations for each track.
Use the filter circuit·(RC) shown in the piezo buzzer to smooth out the square wave.
Let us know if you have any questions and/or how it goes!
·
so far I've just been able to compare between a bs2's dtmfout using the PDB internal amp/speaker
pritty soon ill be able to get to a buddies scope and figure out whats up.
thanks for everyone's help thus far!
here is zee code, and pitch sheet
I didn't look at your code closely, but I saw you're dividing the pitch count by 2 in your excel sheet. Can you elaborate?
I did some calculations yesterday, and you should be able to get the pitches under 0.15% accuracy (there's only 1 pitch thats 0.14%, the rest are lower) but can't remember if it was at 20MHz or 50MHz.
The phone system specs has a variation of at least 1%, so you should be able to get pretty darn close.
DTMF_ISR:
IF PitchFlag1 = 1 THEN ' ok to play?
IF MyPitchCount1 = PitchCount1 THEN ' see if ready to toggle waveform
Piezo1 = ~Piezo1 ' togggle waveform
MyPitchCount1 = 0 ' reset waveform
ELSE
INC MyPitchCount1 ' inc counter
ENDIF
ENDIF
IF PitchFlag2 = 1 THEN ' ok to play?
IF MyPitchCount2 = PitchCount2 THEN ' see if ready to toggle waveform
Piezo2 = ~Piezo2 ' togggle waveform
MyPitchCount2 = 0 ' reset waveform
ELSE
INC MyPitchCount2 ' inc counter
ENDIF
ENDIF
Post Edited (Yendor) : 5/4/2010 8:05:01 PM GMT
i got a chance to check the output freqs on my mickey mouse frequency counter. here is what i came up with
WDATA 179 ' Freq: 697Hz Counts at 694hz
WDATA 162 ' Freq: 770Hz Counts at 766hz
WDATA 147 ' Freq: 852Hz Counts at 844hz
WDATA 133 ' Freq: 941Hz Counts at 933hz
WDATA 103 ' Freq: 1209Hz Counts at 1201hz
WDATA 92 ' Freq: 1336Hz Counts at 1315hz
WDATA 86 ' Freq: 1477Hz Counts at 1436hz
i tried tweaking the values to get them any closer, but the values on the sheet seem to be the closest...
back to the drawing board, doh!
http://www.datasheetarchive.com/datasheet-pdf/020/DSA00351816.html
your 694 to 697 is 0.4%, well within tolarance.
You can also reduce the interrupt cycle time for even more accuracy, just watch out for overflows
·
Also your counters are less than a byte, so you really don't have to use words. The code was based on the midi baud rate using a 200 cycle time. if that is all what your doing with you interrupt, you can reduce the cycles, increasing your frequency accuracy. Just make sure you update your calcuatios to reflect, and note the RTCC overflows. If you approach in this way, you can do # cycle counts or you can cheat by using the SxSim, and check mark the Check RTCC box. if you don't get an error message for a while, you're good to go.
Your next assignment is to duplicate caller id [noparse]:o[/noparse])
UPDATE:
here it is, all cleaned up, and ive added a simple "dial" routine for dialing strings.
special thanks to Yendor and JonnyMac one more time!
and as always, if you make it better, pleas share with the rest of the class.
Post Edited (skynugget) : 5/6/2010 6:59:40 PM GMT
Been away from the SX forum pretty much since the EOL announcement, and have largely shifted over to the Propeller. There I'm doing things in assembler because the SX made me comfortable with that, and someday perhaps I'll learn SPIN.
Anyhow, this DTMF issue rang a familiar pulse with me as I had been doing SX work in that domain a long time ago.
I wrote a dual channel tone generator that made two sine waves, and was able to digitally vary the phase between them. As you know, summing two sine waves of the same frequency generates a single sine wave of the same frequency but with an amplitude being a function of the phase.
Anyhow all of this led to me entering a Parallax contest in 2004/05 and used this code to demonstrate some other things. That software would be very easy to adapt to your needs of two sine waves at different frequency. The code was pretty simple. Looking back at the Parallax (old 2004/5) contest entries (I have two entries listed that year, so look for the correct one if you are interested), butt found that the formal write-up and code sections were no longer available.
If you are interested, I'd be prepared to dig out some of my archives from 10 years ago when I wrote that code, and post it here.
It is written in assembler, so if SX/B is a must, you'll have to do your own conversion.
Cheers,
Peter (pjv)
Source:http://wulfden.org/TheShoppe/misc.shtml
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
It may have to do with being square waves rather than sine waves.
[noparse][[/noparse]edit] below is Peter's dual sinewave info.
Post Edited (Yendor) : 5/10/2010 6:43:54 PM GMT
finally built my phone interface, and it seems the phone company doesn't like the tones as much as my dtmf decoder does. looks like square waves aren't going to work. hopefully i can wrap my head around peters code. thanks for posting!
Thanks for finding that contest entry of mine. I had not yet located my archive files, and now I don't need to. I hope it had been of some use or interest to you.
If skynugget decides to try and study it he'll be pleasantly surprised by its simplicity.
Cheers,
Peter (pjv)
I was able to port over the VP DTMF demo, and now I've got some DTMF on the scope! on one pin!
thanks again everyone.
UPDATE: here is the final code, telco approved! thanks again everyone. i suppose you could also use it for any frequency you can clock, the math to get the value is in the code.
Post Edited (skynugget) : 5/16/2010 9:15:43 PM GMT