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

The Archive Base Latest Questions

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

I have some misunderstanding of the processor register concepts. There is a register with

  • 0

I have some misunderstanding of the processor register concepts. There is a register with address, let’s say, 0x0345678. This register is 32 bits wide/long(doesn’t matter right now, which word is the right one). As written in manual there is some kind of table/array:

Position   Value
 0          111111...10b
 1          111111...11b
 2          7A
 .......................
 7          3F7C

I have to access the value with position 2.
The first thing what I’ve done was:

#define REG 0x0345678

void somereadfunction()
{
   volatile unsigned int *pval = (volatile unsigned int *)REG;
   printf("%x", *(pval | 0x02));
}

And as you already guessed, it was the wrong assumption.

Another endeavor was this one:

    for(unsigned int i = 0; i < 3; i++)
    {
        printf("i: %d, res: 0x%08X", i, *((volatile unsigned int *)REG));
    } 

And it works. So, my question is, why and how? Does processor just switch the register value with some magic algorithm inside, written by another developer? I’m a bit confused about that. I know how to access the third bit of the register using some simple bit-wise operations, but I don’t understand, how, just by calling three times the register, we will get the right value?

Thank you beforehand for your answers.

ADDED: Processor is ARM 7. Used the i2c device.

  • 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:38:41+00:00Added an answer on June 5, 2026 at 2:38 pm

    Why?

    Because the people who built your hardware device (that is connected to your ARM processor) probably declared just a few addresses that “belong” to the device. Then, they noticed there was more data in the hardware than registers, and it was too late to change the manual, so they decided to have some registers hold multiple values.

    How?

    The hardware has an internal counter that counts read commands from the processor. Each time the processor wants to read from the register, hardware sends it another piece of data, indexed by the invisible internal counter, and increases the counter. The counter is 3-bit, so it counts 0, 1, …, 7, 0, 1, … etc.

    So if you want to read the data with index 2, you also have to read all other data elements (3, 4, 5, 6, and 7) to reset the invisible counter.

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

Sidebar

Related Questions

I have some XML which contains records and sub records, like this: <data> <record
I may have some misunderstanding regarding the use of the UINavigationControllerDelegate protocol. Here is
Does anyone have some code that will determine if an IP address (IPv4 or
I think I have some fundamental misunderstanding of how the Qt signal/slot mechanism works.
I have a similar post on this on StackOverflow but perhaps my misunderstanding is
I have some misunderstanding about the gslice function. Definition from MSDN states: gslice defines
I have some misunderstanding about the tellp and seekg functions. For example, when I
I have some files that are uuencoded, and I need to decode them, using
I have some files stored at amazon. all in private mode, and since I
I have some script in my default page that redirects users to language specific

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.