
CHAPTER 3 CPU FUNCTION
User’s Manual U15905EJ2V1UD
84
(1) Setting data to special registers
Set data to the special registers in the following sequence:
<1>
Store the DMA transfer state.
<2>
Disable DMA operation.
<3>
Prepare data to be set to the special register in a general-purpose register.
<4>
Write the data prepared in <3> to the command register (PRCMD).
<5>
Write the setting data to the special register (by using the following instructions).
Store instruction (ST/SST instruction)
Bit manipulation instruction (SET1/CLR1/NOT1 instruction)
<6>
Insert NOP instructions (5 instructions).
<7>
Check if DMA transfer has ended between <1> and <2> above.
<8>
If DMA transfer has not ended and DMA operation is required, enable DMA operation.
[Example] With PSC register
ST.B
r11, PSMR[r0]
;
Set PSMR register.
<1>
LD.B
DCHCn[r0], r12
;
Store DMA transfer state.
ANDI
0xfe, r12, r13
;
<2>
ST.B
r13 , DCHCn [r0]
;
Disable DMA operation.
<3>
MOV
0x02 , r10
<4>
ST.B
r10 , PRCMD [r0]
;
Write PRCMD register.
<5>
ST.B
r10 , PSC [r0]
;
Set PSC register.
<6>
NOP
;
Dummy instruction
NOP
;
Dummy instruction
NOP
;
Dummy instruction
NOP
;
Dummy instruction
NOP
;
Dummy instruction
<7>
TST1
7, DCHCn[r0]
;
Check if DMA transfer has ended between <1> and <2>.
BNE
next
;
<8>
ST.B
r12 , DCHCn [r0]
;
Return DMA to the original state.
next :
(next instruction)
There is no special sequence to read a special register.
Cautions 1. When a store instruction is executed to store data in the command register, an interrupt is
not acknowledged. This is because it is assumed that steps <4> and <5> above are
performed by successive store instructions. If another instruction is placed between <4>
and <5>, and if an interrupt is acknowledged by that instruction, the above sequence may
not be established, causing malfunction.
2. Although dummy data is written to the PRCMD register, use the same general-purpose
register used to set the special register (<5> in Example) to write data to the PRCMD
register (<4> in Example). The same applies when a general-purpose register is used for
addressing.