Memory Organization; Registers - Abov MC80F0304 User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

MC80F0304/08/16

8. MEMORY ORGANIZATION

gram memory and Data Memory. 4K bytes program memory can
The MC80F0304/0308/0316 has separate address spaces for Pro-
Data memory can be read and written to up to 256 bytes including
the stack area.
only be read, not written to.

8.1 Registers

This device has six registers that are the Program Counter (PC),
Generally, SP is automatically updated when a subroutine call is
a Accumulator (A), two index registers (X, Y), the Stack Pointer
executed or an interrupt is accepted. However, if it is used in ex-
(SP), and the Program Status Word (PSW). The Program Counter
cess of the stack area permitted by the data memory allocating
consists of 16-bit register.
configuration, the user-processed data may be lost.
The stack can be located at any position within 1C0
the internal data memory. The SP is not initialized by hardware,
H
to 1FF
H
of
A
ACCUMULATOR
requiring to write the initial value (the location with which the use
X
X REGISTER
of the stack starts) by using the initialization routine. Normally,
Y
Y REGISTER
the initial value of "FF
H
" is used.
SP
STACK POINTER
Stack Address (1C0
H
~ 1FF
)
H
PCH
PCL
PROGRAM COUNTER
Bit 15
01
H
8 7
SP
Bit 0
PSW
PROGRAM STATUS WORD
C0
H
~FF
H
Hardware fixed
Figure 8-1 Configuration of Registers
Accumulator: The Accumulator is the 8-bit general purpose reg-
Note: The Stack Pointer must be initialized by software be-
ister, used for data operation such as transfer, temporary saving,
cause its value is undefined after Reset.
and conditional judgement, etc.
Example: To initialize the SP
The Accumulator can be used as a 16-bit register with Y Register
LDX
#0FFH
as shown below.
TXSP
; SP ← FFH
Program Counter: The Program Counter is a 16-bit wide which
Y
consists of two 8-bit registers, PCH and PCL. This counter indi-
Y
A
cates the address of the next instruction to be executed. In reset
state, the program counter has reset routine address (PC
:0FF
,
A
PC
:0FE
L
H
).
H
H
Two 8-bit Registers can be used as a "YA" 16-bit Register
Program Status Word: The Program Status Word (PSW) con-
tains several bits that reflect the current state of the CPU. The
Figure 8-2 Configuration of YA 16-bit Register
PSW is described in Figure 8-3 . It contains the Negative flag, the
Overflow flag, the Break flag the Half Carry (for BCD opera-
X, Y Registers: In the addressing mode which uses these index
registers, the register contents are added to the specified address,
tion), the Interrupt enable flag, the Zero flag, and the Carry flag.
which becomes the actual address. These modes are extremely ef-
[Carry flag C]
fective for referencing subroutine tables and memory tables. The
This flag stores any carry or borrow from the ALU of CPU after
data transfer functions, and they can be used as simple accumula-
index registers also have increment, decrement, comparison and
an arithmetic operation and is also changed by the Shift Instruc-
tors.
tion or Rotate Instruction.
Stack Pointer: The Stack Pointer is an 8-bit register used for oc-
[Zero flag Z]
currence interrupts and calling out subroutines. Stack Pointer
This flag is set when the result of an arithmetic operation or data
identifies the location in the stack to be accessed (save or restore).
transfer is "0" and is cleared by any other result.
32
November 4, 2011 Ver 2.12

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents