I am working on a DDS microcontroller project in C, and I have some problems figuring out how to calculate linear interpolation to smooth out the output values. The program in its current form
uses the upper 8 bits of a 24-bit battery as an index for an array of 8-bit output values. I need to come up with a function that will take the middle and lower bytes of the battery and create a value between the "previous" and "next" value in the array. That would be easy enough on fast hardware, but since I use a microcontroller, I really need to avoid floating point operations or units!
With these limitations, I'm not sure that I need to get an 8-bit interpolation value from my two 8-bit input numbers and the bottom 2 bytes of the battery, which is the "distance" between the two value inputs. Thank you in advance for any advice!
EXPLANATION
DDS = Direct Digital Synthesis
in DDS, a waveform is generated from a lookup table using a phase accumulator. The phase accumulator typically contains an integer component and a fractional component. The integer component is used as an index in the lookup table. In simple DDS implementations, the fractional part is ignored, but to obtain higher quality, the fractional component is used to interpolate (usually only linear interpolation) between adjacent values of the lookup table. On the above question, we will consider how to effectively perform this linear interpolation between the two values of the lookup table for a given fraction, f, where 0 <= f < 1.
source
share