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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:40:28+00:00 2026-06-14T04:40:28+00:00

I want to manipulate some bits of a register directly using its physical address.

  • 0

I want to manipulate some bits of a register directly using its physical address. However I couldn’t find a way to make this. I saw some posts about setting bit masks but I find them too confusing.

My registers physical address is: 0x4A10005C

I want to manipulate its bit which was between 18-16 bits. I want to set 0x3 inside those bits.

I will be really glad if you guys can provide an answer or a way to do it. Thanks.

  • 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-14T04:40:30+00:00Added an answer on June 14, 2026 at 4:40 am

    You can just define a pointer to the register and then use normal C bitwise operations to manipulate the individual bits:

    volatile uint32_t * const my_register = (uint32_t *) 0x4A10005C;
                                  // set up a pointer to the register
    
    uint32_t val = *my_register;  // read register
    
    val &= ~(0x7 << 16);          // clear bits 16..18
    
    val |= (0x3 << 16);           // set bits 16..18 to 0x03 (i.e. set bits 16 and 17)
    
    *my_register = val;           // write register
    

    (The above assumes that you are talking about three bits within the register, bits 16, 17 and 18, and that you want to set bit 18 to zero and bits 16 and 17 to 1.)

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

Sidebar

Related Questions

I am posting some data using ajax. I want to manipulate that data and
I have some images (generated elsewhere), that I want to manipulate and enhance using
I am using lxml to manipulate some existing XML documents, and I want to
Say I want to manipulate some files on a floppy drive or a USB
I want to manipulate HTML using a custom view engine like this: protected override
I am using OpenXML SDK ver 2 to manipulate some word documents. The documents
I want to manipulate data in excel with some complex functions. It seems that
I am using Word Automation to manipulate some documents (yuk!). I am using this
I want to manipulate feed which contains frequently updated (with time) contents using feed
I want to manipulate and animate some BitmapData to create a swirl effect such

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.