English
Language : 

HD64F38024HV Datasheet, PDF (120/684 Pages) Renesas Technology Corp – Hardware Manual Renesas 8-Bit Single-Chip Microcomputer H8 Family/H8/300L Super Low Power Series
Section 3 Exception Handling
3.4 Application Notes
3.4.1 Notes on Stack Area Use
When word data is accessed in the LSI, the least significant bit of the address is regarded as 0.
Access to the stack always takes place in word size, so the stack pointer (SP: R7) should never
indicate an odd address. Use PUSH Rn (MOV.W Rn, @–SP) or POP Rn (MOV.W @SP+, Rn) to
save or restore register values.
Setting an odd address in SP may cause a program to crash. An example is shown in figure 3.6.
SP →
SP →
PC H
PC L
SP →
R1L
PC L
H'FEFC
H'FEFD
H'FEFF
BSR instruction
MOV. B R1L, @−R7
SP set to H'FEFF
Stack accessed beyond SP Contents of PCH are lost
[Legend]
PCH: Upper byte of program counter
PCL: Lower byte of program counter
R1L: General register R1L
SP: Stack pointer
Figure 3.6 Operation when Odd Address is Set in SP
When CCR contents are saved to the stack during interrupt exception handling or restored when
RTE is executed, this also takes place in word size. Both the upper and lower bytes of word data
are saved to the stack; on return, the even address contents are restored to CCR while the odd
address contents are ignored.
Rev. 8.00 Mar. 09, 2010 Page 98 of 658
REJ09B0042-0800