Bird
0
0

Given the following code snippet, what is the value of RCC->APB1ENR after execution?

medium📝 Analysis Q13 of 15
ARM Architecture - Bus Architecture
Given the following code snippet, what is the value of RCC->APB1ENR after execution?
RCC->APB1ENR = 0x00000000;
RCC->APB1ENR |= (1 << 17);
RCC->APB1ENR |= (1 << 0);
A0x00000001
B0x00020001
C0x00010001
D0x00020000
Step-by-Step Solution
Solution:
  1. Step 1: Start with initial value

    RCC->APB1ENR is initially 0x00000000 (all bits cleared).
  2. Step 2: Set bit 17

    Setting bit 17 means adding 0x00020000 (1 shifted left 17 places).
  3. Step 3: Set bit 0

    Setting bit 0 adds 0x00000001.
  4. Step 4: Calculate final value

    0x00000000 + 0x00020000 + 0x00000001 = 0x00020001.
  5. Final Answer:

    0x00020001 -> Option B
  6. Quick Check:

    Bit 17 + bit 0 set = 0x00020001 [OK]
Quick Trick: Add hex values for each bit set to find final register value [OK]
Common Mistakes:
  • Confusing bit positions and hex values
  • Forgetting to combine both bits set
  • Using bitwise AND instead of OR

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes