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

  • Home
  • SEARCH
  • 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 8924973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:15+00:00 2026-06-15T07:34:15+00:00

Here is the code that I have. I am unable to test it right

  • 0

Here is the code that I have. I am unable to test it right now, so I’m just wondering if someone can verify that this will take the full str string and send each character individually to TXREG

char str [10];
int n;
n = sprintf(str, "%u%% %u\n", Duty_Cycle, DAC_Output);
transmit_uart(str);                    // Send the value

And here is the transmit_uart() method.

void transmit_uart(const char *value) {
    for(int i = 0; value[i] != '\0'; i++) {
        while(TXIF == 0) {}
        TXREG = value[i];
    }
}

So this should send something like

50% 128

Every time I call transmit_uart() with a string formatted the way I have it up there.

UPDATE: I was able to test it yesterday, and this did in fact work! Thanks for all the help!

  • 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-15T07:34:16+00:00Added an answer on June 15, 2026 at 7:34 am

    Although I haven’t personally loaded it onto an MCU and tested it, yes, that looks fine as long as TXIF does what it looks like.

    You really should use snprintf or a larger buffer. This is one case where overflowing the integer (as in simply having too large a value, or any negative value) would cascade into buffer overflow.

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

Sidebar

Related Questions

I have no idea what this means. But here is the code that it
Here is the code that I have for my cell of my UITableView: forKeys:[NSArray
Here's the c# code that I have: private double get806Fees (Loan loan) { Loan.Fee.Items
enter code here I have a ListView that have a different Layout XML for
Here is the piece of code that I have used for Java 5.0 TreeSet<Integer>
I have some code here that uses bitsets to store many 1 bit values
I have the following code here that won't run on ARC since it combines
I have a piece of code here that does not work despite me using
Basic question here - I have many lines of code that look something like:
Here's the code for a simple page I have that is not working: <head>

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.