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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:58:09+00:00 2026-05-20T18:58:09+00:00

Im writing some C/asm program for the AVR MCU. Im still learning as I

  • 0

Im writing some C/asm program for the AVR MCU. Im still learning as I go so I hope I have made some sort of mistake in my code.

I have a buffer volatile unsigned char suart_0_rx_buffer[SUART_0_BUF_SIZE+1]; in my C code that I am accessing in my asm code as below. All I want to do is store a byte s0_Rxbyte in the buffer and increment the pointer s0_index every time. ‘s0_Rxbyte` is always a non zero value.


suart_0_wr_buf_2:  ldi     s0_z_low, lo8(suart_0_rx_buffer)
                   ldi     s0_temp1, hi8(suart_0_rx_buffer)
                   add     s0_z_low, s0_index
                   adc     s0_z_high,s0_temp1
suart_0_wr_buf_3:  st      Z+, s0_Rxbyte
                   inc     s0_index
                   clr     s0_temp1
                   st      Z, s0_temp1

If I try and print the contents in a loop in my C code I am getting absolutely nothing.

I didnt want to attach everything here because it will be cluttered.

So does anyone see any problems with the asm code above ?

  • 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-20T18:58:10+00:00Added an answer on May 20, 2026 at 6:58 pm

    Managed to figure it out in the end. It was a case of a simple error in the assembly code that caused it write an incorrect location in the SRAM.

    suart_0_wr_buf_2:  clr     s0_temp1
                       ldi     s0_z_low, lo8(suart_0_rx_buffer)
                       ldi     s0_z_high, hi8(suart_0_rx_buffer)
                       add     s0_z_low, s0_index
                       adc     s0_z_high, s0_temp1
    suart_0_wr_buf_3:  st      Z+, s0_Rxbyte
                       inc     s0_index
                       st      Z, s0_temp1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have begun writing some code for a library I need. The following code
I'm writing some code to do some stuff and I'm pretty sure its not
While writing some aysnc controllers in ASP.NET MVC2, I ran up against a situation
I'm writing some software which will manage a few hundred small systems in the
I am writing some unit tests using visual studio 2008 professional edition. I learned
I've writing some Exchange 2010 Unified Messaging automation scripts. I'm trying to automate the
I am writing a RFID device driver and encounter an compiling error below: [root@localhost
I have a array with values based on a specific player and I want
I have an insert statement that was deadlocking using linq. So I placed it
Greetings! I've been fooling around (a bit) with C# and its assemblies. And so

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.