21.07.2015 Views

M16C User Manual.pdf

M16C User Manual.pdf

M16C User Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

InterruptMitsubishi microcomputers<strong>M16C</strong> / 62 GroupSINGLE-CHIP 16-BIT CMOS MICROCOMPUTER4.3.3 Saving RegistersIn the interrupt sequence, only the contents of the flag register (FLG) and that of the program counter(PC) are saved in the stack area.First, the processor saves the four higher-order bits of the program counter, and 4 upper-order bits and 8lower-order bits of the FLG register, 16 bits in total, in the stack area, then saves 16 lower-order bits of theprogram counter. Figure 4.3.3 shows the state of the stack as it was before the acceptance of theinterrupt request, and the state the stack after the acceptance of the interrupt request.Save other necessary registers at the beginning of the interrupt routine using software. Using thePUSHM instruction alone can save all the registers except the stack pointer (SP).AddressMSBStack areaLSBAddressMSBStack areaLSBm – 4m – 4Program counter (PCL)[SP]New stackpointer valuem – 3m – 3Program counter (PCM)m – 2m – 2Flag register (FLGL)m – 1mm + 1Content of previous stackContent of previous stack[SP]Stack pointervalue beforeinterrupt occursm – 1mm + 1Flag register(FLGH)Programcounter (PCH)Content of previous stackContent of previous stackStack status before interrupt requestis acknowledgedStack status after interrupt requestis acknowledgedFigure 4.3.3. State of stack before and after acceptance of interrupt request498

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!