7.1 What Is Exception Handling?

The CPU sometimes shows special operation called "exception handling". Exception handling refers to the operation that moves execution not to the next instruction but to another program after the current instruction is completely executed if any exception handling source is generated while the CPU is executing the main routine. The program to which execution is moved by exception handling is referred to as an "exception handling routine".

Figure 7.1: Exception Handling Operation Overview

The H8/3048 has 42 types of exception handling sources, which are classified into one reset and 41 interrupts. Reset is mainly designed to start execution from a particular program after turning the microcomputer on. Interrupts are designed to move operation to an exception handling routine when an interrupt source is generated during program execution and return operation to the original program after the exception handling routine has been executed completely.

Figure 7.2: Types of Exception Handling Sources

Although what generates an exception handling source depends on the type, all types of exception handling routines employ the vector method. This method is designed to notify the CPU of the start address of an exception handling routine. The details are described in the following sections.