Bird
0
0

Which of the following code snippets correctly disables the clock for Timer 3 (bit 1 in RCC->APB1ENR) without affecting other bits?

hard📝 Application Q15 of 15
ARM Architecture - Bus Architecture
You want to save power by disabling the clock for unused peripherals. Which of the following code snippets correctly disables the clock for Timer 3 (bit 1 in RCC->APB1ENR) without affecting other bits?
ARCC->APB1ENR ^= (1 << 1);
BRCC->APB1ENR |= (1 << 1);
CRCC->APB1ENR &= ~(1 << 1);
DRCC->APB1ENR = 0;
Step-by-Step Solution
Solution:
  1. Step 1: Understand disabling clock by clearing bit

    Disabling a peripheral clock requires clearing its bit in the RCC register.
  2. Step 2: Use bitwise AND with negation

    Using AND with the negation of (1 << 1) clears bit 1 without changing other bits.
  3. Step 3: Check other options

    ^= (1 << 1) toggles bit 1 (may enable or disable unpredictably), |= (1 << 1) sets bit 1 (enables clock), = 0 clears all bits (disables all clocks).
  4. Final Answer:

    RCC->APB1ENR &= ~(1 << 1); -> Option C
  5. Quick Check:

    Clear bit 1 with AND and negation to disable clock [OK]
Quick Trick: Clear bit with AND and negation to disable clock safely [OK]
Common Mistakes:
  • Using OR to disable instead of enable
  • Clearing all bits instead of one
  • Using XOR which toggles bits unpredictably

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes