HT46R4A
When executing instructions requiring jumps to
non-consecutive addresses such as a jump instruction,
a subroutine call, interrupt or reset, etc., the
microcontroller manages program control by loading the
required address into the Program Counter. For condi-
tional skip instructions, once the condition has been
met, the next instruction, which has already been
fetched during the present instruction execution, is dis-
carded and a dummy cycle takes its place while the cor-
rect instruction is obtained.
data nor part of the program space, and is neither be
read nor written to. The activated level is indexed by the
Stack Pointer, SP, and can neither be read nor written
to. At a subroutine call or interrupt acknowledge signal,
the contents of the Program Counter are pushed onto
the stack. At the end of a subroutine or an interrupt rou-
tine, signaled by a return instruction, RET or RETI, the
Program Counter is restored to its previous value from
the stack. After a device reset, the Stack Pointer will
point to the top of the stack.
The lower byte of the Program Counter, known as the
Program Counter Low register or PCL, is available for
program control and can be read nor written to. By trans-
ferring data directly into this register, a short program
jump can be executed directly, however, as only this low
byte is available for manipulation, the jumps are limited
to the present page of memory, that is 256 locations.
When such program jumps are executed it should also
be noted that a dummy cycle will be inserted.
If the stack is full and an enabled interrupt takes place,
the interrupt request flag will be recorded but the ac-
knowledge signal will be inhibited. When the Stack
Pointer is decremented, by RET or RETI, the interrupt
will be serviced. This feature prevents stack overflow al-
lowing the programmer to use the structure more easily.
However, when the stack is full, a CALL subroutine in-
struction can still be executed which will result in a stack
overflow. Precautions should be taken to avoid such
cases which might cause unpredictable program
branching.
The lower byte of the Program Counter is fully accessi-
ble under program control. Manipulating the PCL might
cause program branching, so an extra cycle is needed
to pre-fetch. Further information on the PCL register can
be found in the Special Function Register section.
P
r
o
g
r
a
m
C
o
u
n
t
e
r
T
o
p
o
f
S
t
a
c
k
S
S
S
t
t
t
a
a
a
c
c
c
k
k
k
L
L
L
e
e
e
v
v
v
e
e
e
l
l
l
1
2
3
Stack
S
t
a
c
k
P
r
o
g
r
a
m
P
o
i
n
t
e
r
This is a special part of the memory which is used to
save the contents of the Program Counter only. The
stack is organised into 6 levels and is neither part of the
M
e
m
o
r
y
B
o
t
t
o
m
o
f
S
t
a
c
k
S
t
a
c
k
L
e
v
e
l
N
Program Counter Bits
Mode
b11
0
b10
0
b9
0
b8
0
b7
0
b6
0
b5
0
b4
0
b3
0
b2
0
b1
0
b0
0
Initial Reset
External Interrupt
0
0
0
0
0
0
0
0
0
1
0
0
Timer/Event Counter 0
Overflow
0
0
0
0
0
0
0
0
1
0
0
0
Timer/Event Counter 1
Overflow
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
A/D Converter Interrupt
Skip
Program Counter + 2
Loading PCL
PC11 PC10 PC9 PC8 @7
@6
#6
@5
#5
@4
#4
@3
#3
@2
#2
@1
#1
@0
#0
Jump, Call Branch
Return from Subroutine
#11
#10
#9
S9
#8
S8
#7
S7
S11 S10
S6
S5
S4
S3
S2
S1
S0
Program Counter
Note: PC11~PC8: Current Program Counter bits
@7~@0: PCL bits
#11~#0: Instruction code address bits
S11~S0: Stack register bits
The Program Counter is 12 bits wide, i.e. from b11~b0.
Rev. 1.00
7
November 28, 2007