R8C/13 Group
7. Protection
7. Protection
In the event that a program runs out of control, this function protects the important registers so that they
will not be rewritten easily. Figure 7.1 shows the PRCR register. The following lists the registers protected
by the PRCR register.
• Registers protected by PRC0 bit: CM0, CM1, and OCD, HR0, HR1 registers
• Registers protected by PRC1 bit: PM0 and PM1 registers
• Registers protected by PRC2 bit: PD0 register
• Registers protected by PRC3 bit: VCR2 and D4INT registers
Set the PRC2 bit to “1” (write enabled) and then write to any address, and the PRC2 bit will be set to “0”
(write protected). The registers protected by the PRC2 bit should be changed in the next instruction after
setting the PRC2 bit to “1”. Make sure no interrupts will occur between the instruction in which the PRC2
bit is set to “1” and the next instruction. The PRC0,PRC1 and PRC3 bsits are not automatically set to “0”
by writing to any address. They can only be set to “0” in a program.
Protect register
b7 b6 b5 b4 b3 b2 b1 b0
Symbol
PRCR
Address
000A16
After reset
00XXX000
0
0
2
Bit symbol
PRC0
Bit name
Function
RW
RW
Enable write to CM0, CM1, OCD,
HR0, HR1 registers
Protect bit 0
0 : Write protected
1 : Write enabled
Enable write to PM0, PM1
registers
PRC1
Protect bit 1
RW
0 : Write protected
1 : Write enabled
Enable write to PD0 register
PRC2
PRC3
Protect bit 2
Protect bit 3
0 : Write protected
1 : Write enabled1
RW
RW
Enable write to VCR2, D4INT
registers
0 : Write protected
1 : Write enabled
Reserved bit
Reserved bit
When write, should set to “0”
When read, its content is “0”.
RW
RO
(b5-b4)
(b7-b6)
NOTES:
1. The PRC2 bit is set to “0” by writing to any address after setting it to “1”. Other bits are not set to “0”
by writing to any address, and must therefore be set to “0” in a program.
Figure 7.1 PRCR Register
Rev.1.20 Jan 27, 2006 page 44 of 205
REJ09B0111-0120