-----Original Message----- From: Tracy Smith To: PICLIST@MITVMA.MIT.EDU Date: Monday, November 15, 1999 5:54 PM Subject: Re: DTMF Tones? [Idea]How to produce sine wave >Actually, the table is not biggg. That's the beauty of >linear interpolation. See below. Sorry, I wasn't clear at this. I meant that interpolation may be omitted if the table is big enough to reduce jitter for DTMF frequencies. The question is how big. >Actually "some degradation" may not be acceptable. A >symmetrical triangle wave has odd harmonics whose >strengthes vary inversely to the square of the >harmonic number (e.g. the third harmonic is 1/9'th the >strength of the fundamental). A low pass filter would >be of no use since to generate 440Hz, you'd need to You forget the integration. It acts like LP filter (6 dB/octave) and is made digitally. Already, third harmonic magnitude A3 = 1/9 A1 (-19 dB, assuming 0 dB for the fundametal harmonic), and fifth A5 = 1/25 A1 (-28 dB). When integration is applied, higher harmonics will be further attenuated by 9.5 dB for the third one and by 14 dB for the fifth. Totally, the relative level of third harmonic is -28 dB and the fifth is -42 dB. As far as I know, required signal to noise ratio in this kind of systems is 20 dB. So integration solves the problem, isn't it? >block 1320Hz which would also block a few of the >higher frequency DTMF tones as well. Ideally, you want >to have to only block some very high frequency >carrier. For example, if you were using PWM with a >20kHz carrier to generate DTMF then you'd need to >block the 20kHz and pass (a maximum of) ~1600Hz. A >relatively simple 2'nd order low pass filter with >perhaps a cascaded 2'nd order notch (or band-stop) >would be sufficient. An LP filter should be used, of course, at the output stage of D/A or PWM. It's pass band should include all DTMF frequencies. >I just re-visited Scott's sine wave page: > >http://www.interstice.com/~sdattalo/technical/software/pic/picsine.html > >His table contains only 16 entries and (according to >the comments) can generate a new sample every 65 >instruction cycles. I see a way to knock 10 cycles >off. So to generate the two tones you'd need about 110 >cycles plus an additional overhead of perhaps 50 more >cycles. This'll give you a new sample at about a 30kHz >rate (for a 20Mhz pic). But you'd still need a way to >convert this to analog. So perhaps you'd could back >the generation frequency to 20kHz (or ~256 cycles) and >use an 8-bit pwm. I dont have time right now to look at this routine, have to go to school. It seems that this small table will require additional effort on calculation of mid points to get more accurate frequency. >Perhaps it's not obvious, but the triangle-to-sine >algorithm may also be viewed as a kind of a digital >filter, or more specifically the impulse response of a >digital filter. Consequently, you may wish to consider Yeah, this is a first order FIR filter with unitary coefficients. >other simple algorithms. (e.g. a 4'th order FIR filter >with binary coefficients or perhaps a 3'rd order IIR.) Simple? :) Second order FIR may be. But 3'rd order IIR - no, thanks. First order IIR is enough to generate sine waveform. It requires cumbersome multiplication. Bye for now. _ Nikolai Golovchenko, Electrical Engineering Student National Mining University of Ukraine www.nmuu.dp.ua Dnepropetrovsk, Ukraine E-mail: golovchenko@mail.ru