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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:12:58+00:00 2026-06-05T14:12:58+00:00

How can I do this in AVR assembly? I have 2 numbers (Little endian)

  • 0

How can I do this in AVR assembly?

I have 2 numbers (Little endian) in different reg.

# Number 1
LDI R16 0x…
LDI R17 0x…
LDI R18 0x…
LDI R19 0x…
# Number 2
LDI R20 0x…
LDI R21 0x…
LDI R22 0x…
LDI R23 0x…

I want to add them together and save the result to R20 – R23.

  • 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-06-05T14:13:00+00:00Added an answer on June 5, 2026 at 2:13 pm

    Regarding the “math” behind it: It’s just the same as in the decimal system:

    When adding two single digit numbers, two cases have to be considered. Either the sum of the two is a new single digit number (5+4 = 9), or an ‘overflow’ occurs and another digit is required (5+6 = 11). Note that for any two numbers (in any base, be it 10, 2, 256 or whatever) of n digits length the sum of the two will always be lower than two times the lowest number of n+1 digits length; let i and j be numbers (base 10) of, e.g., length 1, that is, both are between 0 and 9, inclusive. As 10 is the lowest number of length n+1 = 2, their sum will always be lower than 2 x 10.

    When adding two numbers, there may be no overflow or there may be an overflow of exactly 1. The carry bit stores this overflow from the last arithmetic operation; it’s either 0 or 1.

    So, when adding your two numbers of 4x 8 bit each (which can be seen as 4 ‘digits’ base 256), there will be no overflow to be considered for the first addition, hence only ADD; ADD can be regarded as an operation for x = x + y + 0. After the first addition however there may be an overflow which needs to be taken into account, which is done by using ADDC; ADDC represents the operation of x = x + y + carry, where carry can only be 0 or 1 as mentioned above. After all digits have been added, the last addition may have caused an overflow again which will be reflected in the carry bit afterwards and can be evaluated to possibly react to the overflow of the numberrange, like:

    x = x + y;
    
    if ( carry == 1 ) {
      error "The sum is too big for the datatype of x";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can this little function return valid HTML? function HtmlSanitizer(text) { return text.replace(/&(?!\s)|</g, function (s)
Can this attribute be changed dynamically in Java code? android:layout_marginRight I have a TextView
can anyone please explain this code? #include <avr/io.h> #include <avr/interrupt.h> #include <avr/signal.h> char n
can this array of numbers sequence be represented in less characters (excluding whitespace) than
Can this MS-Access query be improved? i.e. the SELECT TOP 1 col FROM Table2
Can this be done quickly in jQuery before I start looping through them? Or
Can this be done? It seems like this should be possible. In general, I
Can this be done in JavaScript? type == 1 ? function1() : function2();
Can this be simplified to a one liner? Feel free to completely rewrite it
Can this method work? public String sayHello(){ return Hello.jsp?name= + laala; } I am

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.