Protect Register Control Register: A Complete Guide

Find out about the Protect Register Control Register and its essential role in preventing unintended modifications in microcontrollers.

* Question

What is the register protected by the PRCR register?

* Answer

The PRCR (Protect Register Control Register) in many microcontroller architectures, such as Renesas RX and RL78 series, is used to control the protection of certain system registers from unintended modifications.

Registers Protected by PRCR

The PRCR register protects system-critical registers, including those responsible for power control, clock settings, and system configuration. The exact registers vary by microcontroller family, but commonly protected registers include:

System Clock Control Registers

  1. Controls clock sources, dividers, and oscillators.
  2. Example: SCKCR (System Clock Control Register)

PLL Control Registers

  1. Manages Phase-Locked Loop (PLL) settings.
  2. Example: PLLCR (PLL Control Register)

Low Power Mode Control Registers

  1. Regulates sleep, stop, and deep sleep modes.
  2. Example: SBYCR (Standby Control Register)

Voltage and Power Management Registers

  1. Handles power modes and supply voltage monitoring.
  2. Example: LVDCR (Low Voltage Detection Control Register)

Watchdog Timer Control Register

  1. Protects watchdog timer settings from accidental changes.
  2. Example: WDTR (Watchdog Timer Register)

How PRCR Works

  • The PRCR register must be unlockedbefore modifying protected registers.
  • Once changes are made, PRCR should be locked againto prevent accidental overwrites.
  • Typically, writing specific unlock codesto PRCR allows access.

Example PRCR Unlock/Lock Sequence

PRCR = 0xA500;  // Unlock protected registers

SCKCR = 0x2100; // Modify system clock settings

PRCR = 0xA500;  // Lock protected registers again

By protecting critical registers, PRCR ensures system stability and prevents accidental misconfigurations that could lead to system failures.