MB91460M Series
28
DS07-16613-2E
Write to registers which include a status flag (1)
Be careful not to accidentally clear a status flag, when writing into registers which include a status flag (especially
the interrupt request flag).
Take notice that a flag of a status bit is not cleared and the control bit is set to the expected value at writing.
When overwriting the control bit structured by multiple bits simultaneously, it is not possible to use the bit
manipulation instruction. As a result, it is necessary to access data with usual byte/half word/word when writing
to both a control bit and a status flag simultaneously. At this time, be careful not to accidentally clear other bits
(bits in a status flag).
Almost all registers shown below include multiple control bits and status flags.
TBCR
OSCR
TCCS0, TCCS1
ICS01
TMCSR0, TMCSR1, TMCSR2, TMCSR3
PCN0, PCN1, PCN2, PCN3, PCN4, PCN5
ADCSL0, ADCSL1
Note: It is not necessary to take special care when overwriting a single bit by the bit manipulation instruction.
Write to registers which include a status flag (2)
Take notice that actual access will be delayed when writing into registers which include a status flag (especially
the interrupt request flag).
This is because data is written via multiple busses.
For example, when the program exits the interrupt routine after clearing the interrupt request flag, the interrupt
flag may be cleared after accepting the RETI instructions. In this case, the interrupts may be accepted again
because some of the interrupt requests are left at the time of returning from the interrupt routine.
To adjust any discord between this register address and instruction execution, read synchronous registers
(RBSYNC, CBSYNC0/1, and MBSYNC) along with the area where written registers exist.
Adjustment at every writing makes a bus data band width narrow. Therefore, we recommend to adjust only if
necessary. For example, when continuous writing is executed, adjustment at the last writing will be enough.
The table below shows the correspondence between a target area and a synchronous register.
Register name
Target area
RBSYNC
0x0000-0x01FF, 0x0280-0x037D, 0x0400-0x063F, 0x0C00-0x0FFF
(Peripheral function on R-bus)
CBSYNC0/1
0xC000-0xFFFF (CAN on D-bus)
MBSYNC
0x6000-0x6FFF (MediaLB, I2S and FIFO buffer on F-bus)