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 6793393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:05:43+00:00 2026-05-26T18:05:43+00:00

I’m trying to code a digital ringing filter on an AVR microncontroller, and I

  • 0

I’m trying to code a digital ringing filter on an AVR microncontroller, and I am having some trouble with the implementation of the state diagram in fixed point arithmetic. Here’s a picture of the signal flow I am attempting to write code for:enter image description here

Edit: (I believe the equation for T_c above should be e^[-1/(F_s*D)] )

Here’s what I have so far. I have a routine called smultfix that does a fixed point signed multiply on two 8 bit signed integers and returns a 16 bit signed product. F_c and T_c are 8 bit signed binary fractions. “Output” and the intermediate step at the junction of T_c’s input and the delay element, z1, are treated as 16 bit binary fractions. So I have:

(assume F_c and T_c are defined elsewhere)

int8_t generateSample()
{
    static int16_t z1 = 0x7FFF;  //initialize first delay element to max positive value
    static int16_t output;
    int8_t byteOutput = 0;
    int8_t bytez1 = 0;

    bytez1 = (z1 & 0xFF00)>>8; //make z1 into an eight bit signed binary fraction for    
                               //multiplication

    output = (smultfix(bytez1,F_c)<<1) + output; //calculate output, shift product
                                                 //left once to 
                                                 //remove double sign bit

    byteOutput = (output & 0xFF00)>>8;          //generate output byte

    z1 = (-(smultfix(byteOutput,F_c)<<1)) - \
            (smultfix(bytez1,T_c)<<1) //generate intermediate                
                                                             //product z1
    return byteOutput;  
}

Unfortunately, I seem to have just created a poor random number generator, as this code generates a lot of garbage filling up my output buffer! If someone could point out where I might be going wrong, or if they have an implementation idea that would be better, it would be much appreciated.

  • 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-26T18:05:43+00:00Added an answer on May 26, 2026 at 6:05 pm

    The code is actually correct – but the sign of the equation for T_c should indeed be positive rather than negative. It’s shown as being negative in the first edition of the book, and it seems that this image was taken from the second edition of the book, in which the equation was corrected. If T_c is evaluated with a negative exponential, there will be increasing oscillations, but if it is positive the oscillations will decrease, which is what we want. Having T_c negative and flipping the sign of the subtraction on the second to last line also works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.