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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:40:28+00:00 2026-05-13T21:40:28+00:00

I am working on the Firmware for an embedded USB project. The production programmer

  • 0

I am working on the Firmware for an embedded USB project. The production programmer I would like to use automatically writes the Serial Number into the device flash memory at a specified memory address. The programmer stores the serial number as Hex digits in a specified number of bytes. For example, if I tell it to store the serial number 123456 at address 0x3C00 my memory looks like this:

0x3C00  -  00
0x3C01  -  01
0x3C02  -  E2
0x3C03  -  40
//(123456 in Hex = 1E240)

The problem is, when my host application reads the serial number from the device it is looking for a unicode char array. So my serial number should be …

{ '1','0',
  '2','0',
  '3','0',
  '4','0',
  '5','0',
  '6','0'}

When the

So in my firmware, which I’m writing in C, is it possible to retrieve the hex serial number from flash, encode it into a unicode char array and store it in a variable in Ram?

  • 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-13T21:40:28+00:00Added an answer on May 13, 2026 at 9:40 pm

    If the serial number fits into 32 bits and the platform is big endian and supports Unicode, 32 bit ints and the standard C libraries then this is pretty straightforward as other answers have shown. If the platform has 32 bit ints and 8 bit chars but is little endian and/or doesn’t support Unicode, and if the serial number can vary in length, then the below may be useful, though it’s a little workmanlike.

    void extract_serial_number(unsigned char* address, unsigned int bytes, char* buffer) {
        unsigned int value = 0;
        char c, *start = buffer;
        while (bytes--) {                      /* read the serial number into an integer */
            value = value << 8;
            value |= *address++;
        }
        while (value > 0) {                    /* convert to 16 bit Unicode (reversed) */
            *buffer++ = '0' + value % 10;
            *buffer++ = '\0';
            value /= 10;
        }
        *buffer++ = '\0';
        *buffer++ = '\0';
        buffer -= 4;
        while (buffer > start) {               /* reverse the string */
            c = *buffer;
            *buffer = *start;
            *start = c;
            buffer -= 2;
            start += 2;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an embedded firmware project using U-Boot. We are required to have
I am working on some firmware for an embedded device that uses a 16
I am working on C firmware project. I have a union that is defined
I'm working in a Scrum project writing firmware code in C for an ASIC.
I am working a C firmware program for an embedded device. I want to
I am very new at C programming and I am working on a firmware
Working on a rather small, and simple layout, I decided to use Meyer's CSS
Working on a movie website and would love to find an API that I
Working on my first Rails project, I used Ryan Bates' Nifty-Generators to create the
I am working on the firmware for a device that uses an 8bit mcu

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.