![](http://datasheet.mmic.net.cn/370000/UPD17134ACT-xxx_datasheet_16740627/UPD17134ACT-xxx_43.png)
CHAPTER 4 PROGRAM MEMORY (ROM)
24
4.2 PROGRAM MEMORY USAGE
Program memory has the following two main functions:
(1) Storage of the program
(2) Storage of constant data
The program is made up of the instructions which operate the CPU (Central Processing Unit). The CPU executes
sequential processing according to the instructions stored in the program. In other words, the CPU reads each
instruction in the order stored by the program in program memory and executes it.
Since all instructions are 16-bit long words, each instruction is stored in a single address in program memory.
Constant data, such as display patterns, are set beforehand. The MOVT is used for reading constant data in
program memory to transfer data from program memory to the data buffer (DBF) in data memory. Reading the constant
data in program memory is called table reference.
Program memory is read-only (ROM: Read Only Memory) and therefore cannot be changed by any instructions.
4.2.1 Flow of the Program
The program is usually stored in program memory starting from address 0000H and executed sequentially one
address at a time. However, if for some reason a different kind of program is to be executed, it will be necessary to
change the flow of the program. In this case, the branch instruction (BR instruction) is used.
If the same program code is going to appear in a number of places, reproducing the code each time it needs to
be used will decrease the efficiency of the program. In this case, the program should be stored in only one place in
memory. Then, by using the CALL instruction, call the same program. Such a program is called a subroutine. As
opposed to a subroutine, code used during normal operation is called the main routine.
For cases completely unrelated to the flow of the program (in which a section of code is to be executed when a
certain condition arises), the interrupt function is used. Whenever a condition arises that is unrelated to the flow of
the program, the interrupt function can be used to branch the program to a prechosen memory location (called a vector
address).
Items (1) to (5) explain branching of the program using the interrupt function and instructions.
(1) Vector address
Table 4-2 shows the address to which the program is branched (vector address) when a reset or interrupt
occurs.
Table 4-2. Vector Address for the
μ
PD17134A Subseries
Vector address
Cause of the interrupt
0000H
Reset
0001H
Serial interface interrupt
0002H
Basic interval timer interrupt
0003H
Timer 1 interrupt
0004H
Timer 0 interrupt
0005H
External (INT) interrupt