--- Nikolai Golovchenko wrote: > -----Original Message----- > >True, butt, if you incorporate the proper > >interpolation along with your look up table, then > the > >jitter effects are mitigated. Without any > >interpolation, the sinewave output from the look-up > >table is a stair-stepped waveform. The higher the > >update frequency, the smaller the steps and the > closer > >to a sine wave approximation. This 'stair-stepped' > > > This means a biggg table. Interesting, what size of > table will be sufficient > to minimize jitter enough for DTMF application. Actually, the table is not biggg. That's the beauty of linear interpolation. See below. > > >So the next step is first order interpolation. For > our > >application, this is linear interpolation between > >consecutive samples in the table. (For sampling > >theory, there are some subtle but important > >differences on the interpretation of a first-order > >hold.) Which is to say, if you need a sample that > is > >not (exactly) at one of the sample points in your > >table, then you approximate it by using linear > >interpolation. For example, suppose you had a table > >with 10 samples: f(i) is the function defined for i > >=0..9 . Now suppose you need f(2.25)? Well, using > >linear interpolation you'd approximate this: > > > >f(2.25) - f(2) f(3) - f(2) > >-------------- = ------------- > > 2.25 - 2 3 - 2 > > > >f(2.25) ~= f(2) + 0.25*(f(3) -f(2)) > > > > > Let me compare two methods of sine generation for > DTMF application: > 1)Triangle generation with subsequent integration. > 2)Phase accumalator&table with linear interpolation; > > The first method doesn't have table, instead, > triangle waveform is generated > using addition of a fixed step to the previous > sample. No need to use > interpolation means faster execution time. To > produce sine waveform > integration is used - some degradation in the > waveform, which is acceptable > in DTMF. As a result, the first method generates > efficiently jitter free, > sine waveform signal. 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 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. > > The second method has table, therefore it requires > more ROM; needs linear > interpolation - more computing time because of > multiplication. Result is the > same. > > > What do you think? 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. --------- 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 other simple algorithms. (e.g. a 4'th order FIR filter with binary coefficients or perhaps a 3'rd order IIR.) .lo ===== __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com