68/317
4 - Architecture of the ST7 core
two addresses as is needed in a memory-to-memory data move, with or without alteration in
between. However, these registers may also be used to store temporary data.
4.2.2.4 Program Counter (PC)
The program counter is the register that controls the sequencing of the instructions. The pro-
gram is written as a series of instructions, and these instructions are stored in consecutive
cells of the program memory. The Program Counter contains the address of the next instruc-
tion to be executed. This instruction is read from memory, then executed, and the
PC
is incre-
mented so that it then points to the next instruction in the sequence.
It is possible to alter the contents of the
PC
while the program is executing. In this case, the
next instruction will not necessarily be the next in the sequence, but an instruction somewhere
else in memory. Changing the course of the program is called jumping or branching.
Jump and Branch are the names of instructions that actually change the contents of the
PC
by
setting it to a value specified with the instruction. Jumps may also be conditional, that is, the
jump instruction effectively alters the contents of the
PC
if certain conditions are met. These
conditions can be the values of one or more bits of the Condition Code Register. For example,
the
JREQ
instruction changes the
PC
to the specified address if the
Z
bit of the
CC
register is set,
otherwise the program continues in sequence.
Another kind of jump is the Subroutine Call, that first saves the address of the next instruction
in sequence (the one that follows the jump instruction) before jumping. A special instruction,
RET
urn, retrieves this address and puts it into the
PC
. The next instruction executed is once
again the one that follows the
CALL
instruction.
4.2.2.5 Stack Pointer (SP)
The stack is the part of the read-write memory where return addresses are stored by the
CALL
instructions and retrieved by the
RET
instruction.
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...