Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3225416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:20:12+00:00 2026-05-17T16:20:12+00:00

I’m working on a microcontroller DDS project in C and am having some trouble

  • 0

I’m working on a microcontroller DDS project in C and am having some trouble figuring out how to compute a linear interpolation to smooth the output values. The program as it stands now
uses the top 8 bits of a 24 bit accumulator as an index to an array of 8 bit output values. I need to come up with a function that will take the middle and lower byte of the accumulator and generate a value in between the “previous” and “next” value in the array. This would be straightforward enough on fast hardware, but since I’m using a microcontroller I really need to avoid doing any floating point operations or divisions!

With those restrictions, I’m not certain of a way to go about getting an 8 bit interpolated value from my two 8 bit input numbers and the lower 2 byes of the accumulator, which represents the “distance” between the two input values. Thanks in advance for any advice!

CLARIFICATION

DDS = Direct Digital Synthesis

in DDS a waveform is generated from a lookup table using a phase accumulator. The phase accumulator usually contains an integer component and a fractional component. The integer component is used as an index into the lookup table. In simple DDS implementations the fractional part is ignored, but for higher quality output the fractional component is used to interpolate (usually just linear interpolation) between adjacent lookup table values. For the above question we are looking at how to efficiently perform this linear interpolation between two lookup table values for a given fraction, f, where 0 <= f < 1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:20:13+00:00Added an answer on May 17, 2026 at 4:20 pm

    Assuming you have a table of waveform values (either one quadrant or four quadrants, it doesn’t matter) then one possible optimisation is to store the delta values betwen successive table values. I.e. if you have e.g. N = 256 and a waveform table LUT[N] then you also have a table of delta values, LUT_delta[N]. The relationship between the two precomputed tables is LUT_delta[i] = LUT[i+1] - LUT[i]. So instead of looking up two consecutive table values, LUT[i] and LUT[i+1], subtracting these to get the delta, then doing the interpolation, you just look up the first table value, LUT[i], and the delta, LUT_delta[i] and then calculate the interpolated value. This requires the same number of table lookups, but fewer math operations. You should be able to do the interpolation with a single multiply-accumulate instruction if you’re using a DSP, otherwise it’s a multiply + scale + add on a general purpose CPU. Also if you interleave the LUT and LUT_delta values you may be able to look up LUT[i] and LUT_delta[i] with a single read and then unpack the two values.

    Pseudo-code:

    extract integer LUT index, i, from accumulator // just need a shift for this
    extract fractional part of accumulator, f // mask or subtract to get f
    get p = LUT[i] // lookup waveform value
    get delta = LUT_delta[i] // lookup delta
    calculate p_interp = p + p_delta * f // single multiply-accumulate instruction on most DSPs - need scaling on general purpose CPUs
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.