ROM (program memory) capacity3968 × 16 bits (masked ROM)
CROM (character ROM) capacity1920 × 16 bits (included in ROM)
RAM (data memory) capacity336 × 4 bits (including the area that can be used for VRAM)
VRAM (video RAM) capacity224 × 4 bits (included in RAM)
Instruction execution time2 µs (when the 8-MHz crystal is used)
Stack level6 levels (stack operation possible)
Number of I/O portsNumber of input ports: 4
Number of output ports: 8
Number of I/O ports: 15
IDC (Image Display Controller)Number of characters in display: Up to 99 on a single screen
Remark Correct decimal conversion is not possible in the shaded area.
52
µ
PD17062
7.4 NOTES ON USING THE ALU
7.4.1 Notes on Using the Program Status Word for Operations
After an arithmetic operation has been performed on the program status word, the operation result is held
in the program status word.
The CY and Z flags of the program status word are usually set or reset according to the result of the
arithmetic operation. If the arithmetic operation is performed on the program status word itself, the result
of the operation is stored and a carry, borrow, or zero cannot be discriminated.
If the CMP flag is set, the result of the arithmetic operation is not stored and the CY and Z flags are set or
reset as usual.
7.4.2 Notes on Performing Decimal Operations
A decimal operation can be carried out only when the operation result is within the following ranges:
(1) The result of addition is between 0 and 19 in decimal.
(2) The result of subtraction is between 0 and 9 or –10 and –1 in decimal.
If a decimal operation exceeding the above ranges is performed, the CY flag is set, resulting in a value
greater than or equal to 1010B (0AH).
53
µ
PD17062
8. SYSTEM REGISTER (SYSREG)
“System register” is the generic name for those registers directly related to CPU control. System registers
are allocated at addresses 74H-7FH in data memory and can be referenced regardless of the bank specification.
The system register types are as follows:
Address register
Window register
Bank register
Memory pointer enable flag
Index register
Data memory row address pointer
General-purpose register pointer
Program status word
The address register specifies a program memory address. It is located at addresses 74H-77H. The
instructions used to manipulate the address register are indirect branch instructions (BR @AR, CALL @AR),
the table reference instruction (MOVT), and stack manipulation instructions (PUSH, POP).
An indirect branch is a branch to the program memory address specified by the contents of the address
register. Indirect branch instructions include BR @AR and CALL @AR.
Table reference is the transfer of the contents of the program memory address specified by the address
register to the DBF of data memory (BANK0 0DH-0FH). This is done by executing a MOVT instruction.
Stacks are manipulated using the PUSH and POP instructions. The PUSH instruction stores the contents
of the address register in the stack specified by the current stack pointer, and decrements the contents of the
stack pointer by 1. The POP instruction increments the contents of the stack pointer by 1, and loads the contents
of the stack specified by the current stack pointer into the address register.
µ
AR3 and AR2 of
register is the 256 steps of 0000H-00FFH.
PD17062 are fixed at 0. Hence, the program address that can be specified by the address
Fig. 8-2 Configuration of Address Register
AR3
(74H)
b30b20b10b00b30b20b10b00b3b2b1b0b3b2b1b0
AR15 (MSB)AR0 (LSB)
8.2 WINDOW REGISTER (WR)
The window register is a 4-bit register, mapped to address 78H of the system register. It is used for data
transfer together with the register file (RF), described later in this manual. All data in each register of the
register file is manipulated via the window register.
Data transfer between the window register and the register file is achieved by execution of the exclusive
PEEK WR, rf and POKE rf, WR instructions.
AR2
(75H)
AR1
(76H)
AR0
(77H)
55
µ
PD17062
8.3 BANK REGISTER (BANK)
The bank register specifies a data memory bank.
The bank register contains BANK0 upon reset. The two high-order bits of address 79H are consistently set
to 0.
Data memory is classified into three banks by the bank register. When a data memory manipulation
instruction is executed, it acts on the data memory in the bank specified by the bank register.
For example, to manipulate BANK1 data memory with BANK0 set as the current bank, the bank must first
be switched to BANK1 in the bank register.
However, system registers allocated to addresses 74H-7FH of data memory are not confined to the concept
of banks. The same system registers exist at addresses 74H-7FH of all banks. Executing MOV 78H, #0 in BANK1
and MOV 78H, #0 in BANK2 both result in writing 0 to address 78H of the system register. Therefore, system
register manipulation is not constrained to the concept of banks.
When an interrupt is accepted, BANK is saved.
Table 8-1 Specification of Data Memory Bank
Bank request
(BANK)
b3b2b1b0
0000BANK0
0001BANK1
0010BANK2
0011Not to be set
Data memory bank
8.4 MEMORY POINTER ENABLE FLAG (MPE)
The MPE specifies whether to specify the row address for execution of the MOV @r, M and MOV M, @r
instructions by the MPL, or to perform execution with the same address. When the MPE is set, the row address
is specified by the MPL. When the MPE is reset, the instruction is executed with same row address.
However, the address specified by the MPL is the row address of the currently specified bank.
56
µ
PD17062
8.5 INDEX REGISTER (IX) AND DATA MEMORY ROW ADDRESS POINTER (MP)
8.5.1 Configuration of Index Register and Data Memory Row Address Pointer
As shown in Fig. 8-1, the index register consists of 11 bits, including the three low-order bits, of 7AH (IXH)
of the system register, 7BH, and 7CH (IXM, IXL). The index register is used to indirectly specify a data memory
address.
The data memory row address pointer consists of 7 bits, including the three low-order bits of 7AH (MPH)
and 7BH (MPL).
This means that the seven high-order bits of the index register and data memory row address pointer are
shared.
The four high-order bits of the index register, i.e., the four high-order bits of the data memory row address
pointer (7AH b
2-b0, 7BH b3), of
µ
PD17062 are fixed at 0.
57
µ
PD17062
8.5.2 Functions of Index Register and Data Memory Row Address Pointer
When a data memory manipulation instruction is executed with the index enable flag (IXE) set to 1, the
index register ORs the data memory bank/address specified by the instruction and the contents of the index
register. Then, the index register executes the instruction in the data memory address indicated by the
operation result (in other words, the real address).
When a general-purpose register indirect transfer instruction (MOV @r, m and MOV m, @r) is executed
with the memory pointer enable flag set to 1, the data memory row address pointer executes the instruction,
regarding the indirect address bank specified by the general-purpose register and row address as being the
value of the data memory row address pointer.
Table 8-2 shows the modification of data memory and the indirect address by the index register and data
memory row address pointer.
All data memories are subject to modification by the index register and data memory row address pointer.
The following instructions are not subject to modification by the index register.
INCAR
INCIX
MOVTDBF, @AR
PUSHAR
POPAR
PEEKWR, rf
POKErf, WR
GETDBF, P
PUTp, DBF
BRaddr
BR@AR
RORCr
CALLaddr
CALL@AR
RET
RETSK
RETI
EI
DI
STOP0
HALTh
NOP
58
Table 8-2 Modification of Data Memory Address by Index Register and
Data memory address specified by mMIndirect transfer address specified by @r
@R
Bank
BANK
Row
address
Same as
above
Logical
(IX)
Same as
above
m
m, #n4
m, #n4
OR
Column
address
m
Bank
(BANK)m
Logical OR
(IXH)
Row
address
R
(MP)(R)
R
(IXM)
(MP)
Column
address
(R)
(R)
(R)
0
SKE
SKGE
SKLT
Comparison
SKNE
SKT
SKF
nation
Discrimi-
LD
ST
MOV
Transfer
rm
@ rm
m, #n4
m, #n
m, #n4
Indirect transfer address
M; Data memory address BANK ; Bank register
(M); Contents of data memory address(BANK) ; Contents of bank register
m; Data memory address excluding banks IX; Index register
m
R; Data memory row address(IX); Contents of index register
R; General-purpose register addressIXH ; Bits b
(R); Contents of general-purpose register addressIXM ; Bits b
r; General-purpose register column addressIXL ; Bits b
10-b8 of index register
7-b4 of index register
3-b0 of index register
RP; General-purpose register pointer MP; Data memory row address pointer
(RP); Contents of general-purpose register address(MP);
Contents of data memory row address pointer
59
µ
8.5.3 For MPE = 0 and IXE = 0 (Data Memory Not Modified)
As shown in Table 8-2, data memory addresses are not affected by the index register or data memory row
address pointer.
Example 1. When the row address of the general-purpose register is 0 for BANK0
ADD03H,11H
When the above instruction is executed, the contents of general-purpose register 03H and
data memory 11H are added and the result is stored in general-purpose register 03H. (See
Example 1 in Fig. 8-3).
Example 2. When the row address of the general-purpose register is 0 for BANK0
MOV05H,#8; 05H ← 8
MOV@05H, 34H; Register indirect transfer
When the above instruction is executed, the contents of the data memory at address 34H are
transferred to address 38H. This means that the MOV @ r, m instruction transfers the contents
of data memory m to the same row address (in the above case, 3) as m and the column address
(in the above case, 38H) specified by the contents (in the above case, 8) of general-purpose
register r. (See Example 2 in Fig. 8-3).
PD17062
Example 3. When the row address of the general-purpose register is 0 for BANK0
MOV0BH,#0EH; 0BH ← 0EH
MOV34H@0BH ; Register indirect transfer
When the above instruction is executed, the contents of the data memory are transferred from
address 3EH to 34H. This means that the MOV m, @r instruction transfers the contents at
the same row address (in the above case, 3) as data memory m and at the column address
(in the above case, 3EH) specified by the contents (in the above case, 0EH) of general-purpose
register r to m (See Example 3 in Fig. 8-3). The (transfer) source and (transfer) destination
are exactly opposite to those in example 2.
60
Fig. 8-3 Indirect Transfer of General-Purpose Register with MPE = 0 and IXE = 0
01 2 3 45 6 7 89 A B CD E F
Example 1. ADD03H,11H
0
1
2
3
4
Row address
5
6
7
Example 2. MOV @05H, 34H
Address generation of example 2
@ r,mMOV
05H 34H
µ
PD17062
Column address
8E
Specifies the destination
column address
Example 3. MOV 34H, @0BH
BankRow addressColumn address
R
M
(@ r)
0
0
0
0
3
3
Same as M
Specifies the source
column address
5
4
8
Contents of R
Generalpurpose
register
61
µ
PD17062
8.5.4 For MPE = 1 and IXE = 0 (Diagonal Indirect Transfer)
As shown in Table 8-2, the bank and row address of the data memory address in the indirect side specified
by the general-purpose register are set to the value of the data memory row address pointer only when a
general-purpose register indirect transfer instruction is executed.
Example 1. When the row address of the general-purpose register is 0 for BANK0
When the above instruction is executed, the contents of the data memory at address 34H are
transferred to address 58H of data memory. This means that the MOV @r, m instruction at
MPE = 1 transfers the contents of data memory m to the data memory whose bank and row
addresses are the values of the data memory row address pointer (in the above example,
BANK0, row address 5) and whose column address is specified (in the above case, 58H of
BANK0) by general-purpose register r (in the above case, 8). (See Example 1 in Fig. 8-4.)
Compared to MPE = 0 (Example 2 in Section 8.5.3), the bank and row address of the data
memory address in the indirect side specified by the general-purpose register can be
specified by the data memory row address pointer (in Example 2 of Section 8.5.3, the bank
and row address in the indirect side are the same as those of m). Therefore, specifying MPE
= 1 enables general-purpose register diagonal indirect transfer to be performed.
Similarly, the MOV m, @r instruction becomes as shown in Example 2.
Example 2. When the row address of the general-purpose register is 0 for BANK0
Fig. 8-4 Indirect Transfer of General-Purpose Register with MPE = 1 and IXE = 0
PD17062
Generalpurpose
register
01 2 3 45 6 7 89 A B CD E F
0
1
2
3
4
5
6
7
Address generation of example 1
@ r,mMOV
05H 34H
MP = 00101B
Column address
8E
Specifies the destination
column address
Example 1. MOV @05H, 34H
The bank and row address are set to 000101B, the value of the
data memory row address pointer.
BankRow addressColumn address
R
M
(@ r)
0
0
0 0 0 0
Example 2. MOV 3AH, @0BH
0
3
1 0 1
Value of MP
Specifies the source
column address
5
4
8
Contents of R
63
µ
PD17062
8.5.5 For MPE = 0 and IXE = 1 (Index Modification)
As shown in Table 8-2, when a data memory manipulation instruction is executed, the bank and row address
of the data memory specified directly by the instruction are ORed with the index register. Then, the instruction
is executed in the data memory address specified by the operation result (real address).
Example 1. When the row address of the general-purpose register is 0 for BANK0
When the above instruction is executed, the contents of the data memory at address 13H and
the contents of the general-purpose register at address 03H are added and the result stored
in the general-purpose register at address 03H.
This means that the ADD r, m instruction performs the OR operation on the address (in the
above case, 11H of BANK0) specified by m and the index register value (in the above case,
000000010B), the result becoming the real address (in the above case, 13H of BANK0). Then,
the instruction is executed at the real address. (See Fig. 8-5.)
Compared to IXE = 0 (Example 1 in Section 8.5.3), the address of the data memory specified
directly by the instruction is modified (OR operation) by the index register.
Example 2. To clear all bank data memories to 0
MOVIXL,#0;
MOVIXM,#0; IX ← 0
MOVIXH,#0;
LOOP:
ORPSW,#0001B ; IXE ← 1
MOV00H,#0; Sets data memory specified by IX to 0.
INCIX; IX ← IX + 1
ANDPSW,#1110B ; IXE ← 0; IXE is not modified by IX because the address
; is 7FH.
SKTIXM,#0111B ; Is row address 7 reached?
BRLOOP; LOOP if not 7
ADDIXM,#1; Specifies the next bank without clearing row address 7.
ADDC IXH,#0;
SKFIXM,#1000B ; Were banks cleared up to BANK2?
SKTIXH,#0001B ;
BRLOOP; LOOP unless cleared
64
Fig. 8-5 Data Memory Address Modification with IXE = 1
Column address
01 2 3 45 6
0
1
2
3
Row address
4
M
Specified
R
ADD r, m
by IX
Generalpurpose
register
µ
PD17062
65
µ
PD17062
8.6 GENERAL-PURPOSE REGISTER POINTER (RP)
The general-purpose register pointer points to the bank and row address of the general-purpose register.
However, since RPH of the µPD17062 is fixed at 0, only RPL (3 bits) can be specified. This means that 0
to 7 can be specified as a register pointer. Hence, in the
µ
PD17062, the row address of the general-purpose
register can be specified anywhere within BANK0.
8.7 PROGRAM STATUS WORD (PSWORD)
The program status word consists of a flag that indicates the result of operation by the ALU in the CPU and
a 5-bit flag that modifies the ALU function. PSWORD has a binary coded decimal (BCD) flag, compare (CMP)
flag, carry (CY) flag, zero (Z) flag, and index enable (IXE) flag. Fig. 8-6 shows the functions of these flags.
Fig. 8-6 Configuration of PSWORD
7EH7FH
b0b3b2b1b0
BCDCMPCYZIXE
Index
enable
flag
Zero flag
Carry flag
Compare
flag
When this flag is set, index modification is enabled.
When the arithmetic operation result is other than 0, this flag
is reset. The set condition differs according to the contents of
the CMP flag.
(1) When CMP = 0
The flag is set when the arithmetic operation result is 0.
(2) When CMP = 1
The flag is set when the result of the arithmetic operation
executed at Z = 1 is 0.
The carry flag is set when a carry occurs during the execution
of an addition instruction or when a borrow occurs during the
execution of a subtraction instruction. This flag is reset when
neither carry nor borrow occurs.
This flag is set when the least significant bit of the generalpurpose register is 1, in which the RORC instruction is executed.
The flag is reset when the bit is 0.
When this flag is set, the arithmetic operation result is not
stored into data memory.
The CMP flag is reset automatically when the SKT or SKF
instruction is executed.
66
BCD flag
When this flag is set, all arithmetic operations are executed in
decimal. When this flag is not set, all arithmetic operations are
executed in binary.
µ
PD17062
9. REGISTER FILE (RF)
The register file is a group of registers that mainly control the CPU peripheral circuits. The register file has
a capacity of 128 words × 4 bits. However, peripheral circuit addresses are actually allocated to the high-order
64 nibbles (00H-3FH) and addresses 40H-7FH of the currently selected bank of data memory to the low-order
64 nibbles (40H-7FH).
This means that 40H-7FH of each bank of data memory belongs to both the data memory address space
and the register file address space.
In the assembler, the control register file is allocated to 80H-BFH.
67
Column Address
Row
Address
Item01234567
Fig. 9-1 Configuration of Control Register (1/2)
µ
PD17062
(8)
(9)
0
Note
1
Note
Register
Symbol
Read/
Write
Register
Symbol
Read/
Write
IDCDMA
enable
register
I
D
C
D
M
A
E
N
R/W
Stack pointer
(SP)
(
(
(
S
S
S
P
P
P
2
1
0
0
000
R/WR
SYNC-
H
counter-gate
control
register
H
S
C
G
0
0
T
1
H
counter-gate
judge
register
H
H
S
S
C
C
G
G
00 0
T
O
0
S
T
T
SYNC-
PLL refer-
ence
clock select
register
P
P
P
L
L
L
L
L
L
R
R
R
F
F
F
C
C
C
K
K
K
3
2
1
P
L
L
R
F
C
K
0
INT
select
register
0
NC mode
I
I
N
N
T
T
N
N
C
C
M
M
D
D
2
1
I
N
T
N
C
M
D
0
R/WRR/WR/WR
CE pin level
judge register
000
Basic timer 0
carry flip-flop
judge register
M
000
C
E
B
T
0
C
Y
(A)
(B)
2
Note
3
Note
Register
Symbol
Read/
Write
Register
Symbol
Read/
Write
IDC CROM
bank
register
000
A/D converter
control
register
A
A
D
D
C
C
C
C
H
H
2
1
A
D
C
C
H
0
PLL-unlock-
A
D
C
C
000
M
P
flip-flop
judge
register
P
L
L
U
L
R/WRR/W
IDC enable
register
PLL-unlock-
flip-flop
sensibility
Port 1B bit
I/O select
register
Port 0B bit
I/O select
register
select register
C
R
O
M
0
B
N
K
00
I
D
C
E
N00
P
L
U
L
S
E
N
1
P
L
U
L
S
E
N
0
P
1
B
B
I
O
3
P
1
B
B
I
O
2
P
1
B
B
I
O
1
P
1
B
B
I
O
0
P
0
B
B
I
O
3
P
0
B
B
I
O
2
R/WR /WR/WR/WR/WR/W
P
0
B
B
I
O
1
group I/O
000
Port 0A bit
P
P
0
0
B
A
B
B
I
I
O
O
0
3
Port 1C
select
register
I/O select
register
P
P
0
0
A
A
B
B
I
I
O
O
2
1
P
1
C
G
I
O
P
0
A
B
I
O
0
Note The number in parenthesis is the address used when the assembler (AS17K) is used.
68
µ
Fig. 9-1 Configuration of Control Register (2/2)
89 A B C D E F
Serial I/O0
mode select
register
S
S
S
I
O
0
C
H
S
B
I
I
O
O
0
0
M
T
S
X
Timer 0
clock select
register
B
B
B
T
T
T
M
M
M
0
0
0
Z
C
C
X
K
K
1
2
B
T
M
0
C
K
0
Interrupt-
level judge
register
0
PD17062
I
I
N
N
T
T
V
N
S
C
0
Y
N
R/WR/W
Serial I/O0
wait control
register
S
S
S
B
A
C
K
Serial I/O0
status judge
S
I
O
0
S
F
8
S
I
I
I
O
O
O
0
0
0
N
W
W
W
R
R
T
Q
Q
1
0
R/WR/W
register
S
S
S
I
B
B
O
S
B
0
T
S
S
T
Y
F
9
R
Interrupt
edge
selection
register
I
E
G
V
0
S
Y
N
Interrupt
enable
register
I
I
P
P
V
S
S
I
Y
O
N
0
I
E
G
N
C
0
I
I
P
P
N
B
C
T
M
0
RR/W
Serial I/O0
interrupt
mode register
0
0
M
R/WR/WR
S
I
O
0
I
D
1
Serial I/O0
clock select
S
I
O
0
I
00
M
D
0
register
S
O
0
C
K
1
I
S
I
O
0
C
K
0
Interrupt
request
register
I
I
R
R
Q
Q
V
S
S
I
Y
O
N
0
I
I
R
R
Q
Q
B
N
T
C
M
0
69
Table 9-1 Peripheral Hardware Control Functions of Control Registers (1/5)
Control registerPeripheral hardware control functionAt reset
RegisterAd-
dress
Peripheral hardware
Read/
write
b3
b2
SymbolFunction outline
b1
b0
0
Fixed at 0
µ
PD17062
P
S
o
T
w
Set value
01
O
e
P
r
O
n
C
E
Stack pointer
(SP)
StackTimerInterrupt
Timer 0
clock select
register
01HR/W
09HR/W
(SP2)
(SP1)
Stack pointer
(3 bits are valid.)
(SP0)
BTM0ZXOn/off of zerocross circuit
BTM0CK2
BTM0CK1
Base clock setting of basic
timer 0 (internal/external)
Selects the pulse width of
interrupt accept pulse width
of the INT
NC
pin
ResetSet
Low levelHigh level
Low levelHigh level
0: Accepts with edge
1: 200 s 2: 400 s 3: 2 ms
µµ
4: 4 ms
011
000
000
Table 9-1 Peripheral Hardware Control Functions of Control Registers (2/5)
Control registerPeripheral hardware control functionAt reset
RegisterAd-
dress
Peripheral hardware
Read/
write
b3
b2
SymbolFunction outline
b1
b0
0
Fixed at 0
µ
PD17062
P
S
o
T
Set value
01
w
O
e
P
r
O
n
C
E
Interrupt edge
select register
Interrupt
permission
register
InterruptPinPLL frequency synthesizer
Interrupt
request
register
CE pin level
judge register
PLL reference
clock select
register
1FHR/W
2FHR/W
3FHR
07HR
13HR/W
IEGVSYN
0
IEGNC
IPSIO0
IPVSYN
IPBTM0
IPNC
IRQSIO0
IRQVSYN
IRQBTM0
IRQNC
0
0
0
CE
PLLRFCK3
PLLRFCK2
PLLRFCK1
PLLRFCK0
0
Sets the interrupt issue edge (V
Fixed at 0
Sets the interrupt issue edge (INTNC)
- Serial interface 0
- V
SYNC
signal
- Basic timer 0
- INT
NC
pin
- Serial interface 0
- V
SYNC
signal
- Basic timer 0
- INT
NC
pin
Fixed at 0
Detects the CE pin state
Fixed at 1
SYNC
Sets
the interrupt
permission of:
Sets
the interrupt
request
of:
)
Rising edgeFalling edge
Rising edgeFalling edge
Interrupt
disabled
No interrupt
request/
processing
in progress
Low levelHigh Level
2: 6.25 kHz 3: 12.5 kHz
6: 25 kHz
F:
Operation stopped (disabled state)
0, 1, 4, 5, 7-E: Setting disabled
Interrupt
enabled
Interrupt
request made
000
011
000
0– –
FF*
PLL unlock
flip-flop judge
register
PLL unlock
flip-flop
sensibility
select register
22HR
32HR/W
0
0
PLLUL
0
0
PLULSEN1
PLULSEN0
Remark *: Retains the previous state.
Fixed at 0
Detects the unlock flip-flop state
Fixed at 0
Sets the set delay time for
the unlock flip-flop
Locked stateUnlocked state
00 11
1.253.50.25
tototo
1.5 s 3.75 s 0.5 s
µµµ
01 01
Disabled
state
0**
00*
71
Table 9-1 Peripheral Hardware Control Functions of Control Registers (3/5)
Control registerPeripheral hardware control functionAt reset
RegisterAd-
Peripheral hardware
A/D converter
controll
register
A/D converterGeneral-purpose portSerial interface
dress
Read/
write
21H R/W
b3
b2
SymbolFunction outline
b1
b0
ADCCH2
ADCCH1
Selects the pin used as an
A/D converter
ADCCH0
ADCCMP
Detects the comparison result
0
Set value
01
0: AD0
2: AD2
4: AD4
1: AD1
3: AD3
5: AD5
6, 7: Not to be set
IN
< V
REF
V
VIN > V
µ
P
o
w
e
r
O
n
000
** * *
REF
PD17062
S
C
T
E
O
P
Port 1C group
I/O select
register
Port 1B bit I/O
select register
Port 0B bit I/O
select register
Port 0A bit I/O
select register
Serial I/O0
mode select
register
Serial I/O0
wait control
register
27H R/W
35H R/W
36H R/W
37H R/W
08H R/W
18H R/W
0
0
P1CGIO
P1BBIO3
P1BBIO2
P1BBIO1
P1BBIO0
P0BBIO3
P0BBIO2
P0BBIO1
P0BBIO0
P0ABIO3
P0ABIO2
P0ABIO1
P0ABIO0
SIO0CH
SB
SIO0MS
SIO0TX
SBACK
SIO0NWT
SIO0WRQ1
SIO0WRQ0
Fixed at 0
Sets I/O of port 1C (group I/O)
3
pin
P1B
P1B
2
pin
1
pin
P1B
P1B
0
pin
P0B
3
pin
P0B
2
P0B
P0B
P0A
P0A
P0A
P0A
pin
1
pin
0
pin
3
pin
2
pin
1
pin
0
pin
I/O setting
(bit I/O)
Sets the number of communication lines
Sets the communication method
Sets master/slave
Sets the transfer direction
Sets and detects acknowledge (I
2
C bus method)
Sets the wait permission
InputOutput
InputOutput
2-wire method3-wire method
Serial I/O method
Master operation Slave operation
ReceptionTransmission
Sets and detects 0 and 1
PermittedReleased
0110
Sets the wait mode
No
wait
0011
Data
wait
I2C bus method
(only for 2-wire method)
Acknowledge
wait
Address
wait
000
000
000
000
Remark *: Retains the previous state. **: Indefinite
72
Table 9-1 Peripheral Hardware Control Functions of Control Registers (4/5)
Control registerPeripheral hardware control functionAt reset
b3
RegisterAd-
dress
Peripheral hardware
Serial I/O0
status judge
register
28HR
Serial I/O0
Serial interfaceHorizontal synchronizing signal counter
interrupt
mode
38H R/W
register
Read/
write
b2
SymbolFunction outline
b1
b0
SIO0SF8
SIO0SF9
SBSTT
SBBSY
0
0
SIO0IMD1
SIO0IMD0
Detects the contents of clock
counter
Detects the number of clocks
(I2C bus method)
Detects the start condition
2
C bus method)
(I
Fixed at 0
Sets the interrupt condition
of serial interface 0
µ
PD17062
Set value
01
Resets when
the contents of
the clock counter
become 0 or 1
Resets when
the contents of
the clock counter
become 0 or 1
Resets when
the contents of
the clock counter
become 8
Resets when
the contents of
the clock counter
become 9
Sets up the start condition - 9th clock
Sets up the start condition stop condition
0011
7th
clock
8th
clock
7th clock
after occurrence of start
condition
Stop
condition
0110
S
C
P
o
T
E
w
O
e
P
r
O
n
000
** * *
0
Fixed at 0
Sets the internal clock of
serial interface 0
Fixed at 0
Serial I/O0
clock select
register
39H R/W
0
SIO0CK1
SIO0CK0
0
0
H
SYNC
counter
gate control
register
11H R/W
HSCGT1
Controls the H
counter gate
SYNC
HSCGT0
Detects open/close of the H
Fixed at 0
H
SYNC
counter
gate judge
register
12HR
HSCGOSTT
0
0
0
Remark *: Retains the previous state. **: Indefinite
SYNC
counter
0011
100
kHz
200
kHz
500
kHz
0110
00
Gate
close
01
Gate
open
1
1.69 ms
gate
open
0
Gate openGate close
1
MHz
1
Not to
be set
1
** * *
000
0––
73
Table 9-1 Peripheral Hardware Control Functions of Control Registers (5/5)
µ
PD17062
Control registerPeripheral hardware control function
RegisterAd-
Peripheral hardware
IDC DMA
enable
register
IDC
IDC CROM
bank register
IDC enable
register
dress
Read/
write
00HR/W
30HR/W
31HR/W
b3
b2
SymbolFunction outline
b1
b0
0
0
IDCDMAEN
0
0
0
0
CROMBNK
0
0
0
IDCEN
Fixed at 0
Sets the DMA mode permission
Fixed at 0
Fixed at 0
Selects the CROM bank
Fixed at 0
Turns the IDC display on/off
Set value
01
Not permittedPermitted
BANK0
(0800H-0BFFH)
Display onDisplay off
BANK1
(0C00H-0F7FH)
At reset
S
C
P
o
T
E
w
O
e
P
r
O
n
000
000
000
74
µ
PD17062
9.1 IDCDMAEN (00H, b1)
This flag must be set to enable the operation of IDC.
When the IDCDMAEN flag is set, the mode changes to DMA mode and IDC is enabled. In DMA mode, the
instruction cycle is seen as 12
00H
b3b
2
0IDCDMAEN00
µ
s. For details, see Chapter 20.
b
1
b
0
0
DMA prohibited mode (instruction cycle = 2 s)
1
DMA mode (instruction cycle = 12
9.2 SP (01H)
SP is a pointer that addresses the stack register.
01H
b3b2b1b0
0(SPb2)(SPb0)
(SPb1)
SP (stack pointer)
0
000
0
010
011
100
101
110
1
Level 6
Level 5
Level 4
Level 3
Level 2
Level 1
At reset
µ
µ
s)
111
Not to be set
75
µ
9.3 CE (07H, b0)
CE is a flag for reading the CE pin level.
The flag indicates 1 when a high level signal is input to the CE pin, or 0 when a low level signal is input.
07H
b3 b2b1 b0
00 CE
9.4 SERIAL INTERFACE MODE REGISTER (08H)
08H
b
3
SIO0CHSBSIO0TX
b
2
b
1
SIO0MS
0
CE pin low level
0
CE pin high level
1
b
0
PD17062
Transmission/reception setting
2-wire bus mode
CH0 serial I/O mode
0
CH1 serial I/O mode
2-wire bus mode
1
CH0 serial I/O mode
CH1 serial I/O mode
: RX (reception) mode
: SI mode
: P0A
3
used as a general-purpose port
: TX (transmission) mode
: SO mode
: P0A
3
used as an SO pin
Setting of serial interface clock direction
2-wire bus mode
0
Serial I/O mode
2-wire bus mode
1
Serial I/O mode
: Slave operation
: External clock operation
: Master operation
: Internal clock operation
Setting of serial interface mode
Serial I/O mode
0
2-wire bus mode
1
Setting of serial interface channel
Selects CH0
0
Selects CH1
1
76
9.5 BTM0MD (09H)
b
3
BTM0ZXBTM0CK2BTM0CK0
µ
PD17062
09H
b
2
b
1
b
0
BTM0CK1
Time base setting
TIMER INTTIMER CARRY
00000
1
010
011
100
101
110
111
5 ms
100 ms
20 ms
20 ms
5 ms
TMR
5/f
5 ms
6/f
TMR
s
s
Internal
Internal
Internal
Internal
Internal
External
Internal
External
100 ms
5 ms
100 ms
5 ms
5/f
TMR
5 ms
TMR
6/f
5 ms
s
s
Internal
Internal
Internal
Internal
External
Internal
External
Internal
Zerocross setting
Zerocross off
0
Zerocross on
1
9.6 INTVSYN (0FH, b
2)
The INTVSYN flag is used for reading the vertical synchronous signal level. When a high level signal is
input to the V
SYNC pin, the flag is set to 1. When a low level signal is input to the VSYNC pin , the flag is reset
to 0.
77
9.7 INTNC (0FH, b0)
The INT
NC flag is used for reading the INTNC pin state.
The flag indicates 1 when a high level signal is input to the INT
to the INT
NC pin.
0FH
b3b2b1b0
0INTVSYNINTNC
0
0
The INTNC pin is low level.
1
The INTNC pin is high level.
0
The VSYNC pin is low level.
1
The VSYNC pin is in the high level period.
µ
PD17062
NC pin, and 0 when a low level signal is input
9.8 HORIZONTAL SYNCHRONIZING SIGNAL COUNTER CONTROL (11H, 12H)
11H
b3b2b1b0
HSCGT3HSCGT2HSCGT0
12H
b3b1 b0
HSCGOSTT0
b
2
0
HSCGT1
Setting of horizontal synchronizing signal counter
Both bits are fixed at 0.
0
Input confirmation of gate open/close of
horizontal synchronizing signal counter
0
0
1
1
Gate close
0
Gate open
1
Gate open (1.69 ms interval)
0
Not to be set
1
78
0
1
Gate close
Gate open
9.9 PLL REFERENCE MODE SELECTION REGISTER (13H)
13H
b
3
PLLRFCK3PLLRFCK2PLLRFCK0
b
2
b
1
b
0
PLLRFCK1
µ
PD17062
Reference frequency f
0010
0011
0110
1111
0111
1010
1011
1110
9.10 SETTING OF INTNC PIN ACCEPTANCE PULSE WIDTH (15H)
15H
b
3
INTNCMD3INTNCMD2INTNCMD0
b
2
b
1
b
0
INTNCMD1
Setting of INT
r
setting
6.25 kHz
12.5 kHz
25 kHz
PLL disabled
Not to be set
Fixed at 1
NC
pin acceptance pulse width
000
001
010
011
100
Fixed at 0
Edge (no noise canceler)
s
200
µ
400 s
µ
2 ms
4 ms
79
9.11 TIMER CARRY (17H)
b3 b2b1b0
000
17H
BTM0CY
µ
PD17062
Exclusive flag for reading timer carry
9.12 SERIAL INTERFACE WAIT CONTROL (18H)
18H
b3b2b1b0
SBACKSIO0NWT SIO0WRQ1 SIO0WRQ0
Setting of wait timing
00
01
10
11
Does not waitDoes not wait
Waits when the clock falls with the contents
of the clock counter being 8
Waits when the clock falls with the contents
of the clock counter being 9
Waits when the clock falls with the contents
of the clock counter being 8 after detection
of the start condition
This flag is set according to the selected time base,
and reset when the timer carry is read.
2-wire bus modeSerial I/O mode
Waits when the contents of the
clock counter become 9
Waits when the contents of the
clock counter become 9
Not to be set
Wait setting
0
Forced wait
1
Wait released
Acknowledgement at 2-wire bus mode
9.13 IEGNC (1FH)
The IEGNC flag is used for selecting the interrupt detection edge of the INT
NC pin and VSYNC pin.
When the flag is set to 0, an interrupt occurs at a rising edge. When the flag is set to 1, an interrupt occurs
at a falling edge.
1FH
b
3
b
2
b
1
b
0
0IEGVSYNIEGNC
0
Interrupt occurs at the rising edge of the INT
0
1
Interrupt occurs at the falling edge of the INT
0
Interrupt occurs at the rising edge of the V
1
Interrupt occurs at the falling edge of the V
SYNC
SYNC
NC
NC
pin
pin
pin
pin
80
9.14 A/D CONVERTOR CONTROL (21H)
21H
b
3
ADCCH2ADCCH1ADCCMP
b
2
b
1
ADCCH0
b
0
A/D converter input channel select
µ
PD17062
0
0
0
0
1
1
1
1
9.15 PLL UNLOCK FLIP-FLOP JUDGE REGISTER (22H)
22H
b3b2b
00PLLUL
1
b
0
0
Detects the unlock flip-flop state
0
Unlock flip-flop = 0: PLL locked
1
Unlock flip-flop = 1: PLL unlocked
0
0
0
1
1
0
0
1
1
ADC0 select
1
1
0
1
0
1
0
1
select, shared with P1C
ADC
ADC2 select, shared with P0D
ADC3 select, shared with P1D
ADC4 select, shared with P0D
ADC5 select, shared with P0D
No corresponding channel
(not to be set)
3
0
1
2
3
81
9.16 PORT1C I/O SETTING (27H)
27H
µ
PD17062
b3b2b
00P1CGIO
1
b
0
0
9.17 SERIAL I/O0 STATUS REGISTER (28H)
28H
b3b2b1b0
SIO0SF8SIO0SF9SBBSY
SBSTT
P1C port I/O setting
0
P1C
1
, P1C2, P1C3: input port
1
P1C
1
, P1C2, P1C3: output port
Busy condition detection
0
Detects the stop condition
1
Detects the start condition
Start condition detection
0
Resets when the contents of the clock counter become 9
1
Detects the start condition
9 clock detection
0
Resets when the contents of the clock counter become 0 or 1
1
Sets when the contents of the clock counter become 9
8 clock detection
0
Resets when the contents of the clock counter become 0 or 1
1
Sets when the contents of the clock counter become 8
82
µ
PD17062
9.18 INTERRUPT PERMISSION FLAG (2FH)
This flag is used to enable interrupt for each interrupt cause. When the flag is set to 1, interrupt is enabled.
When the flag is set to 0, interrupt is disabled.
2FH
b3b2b1b0
IPSIO0IPVSYNIPNC
IPBTM0
9.19 CROM BANK SELECTION (30H)
30H
b3 b2b1b0
0
Interrupt from the INT
1
Interrupt from the INTNC pin enabled
0
Interrupt from the clock timer disabled
1
Interrupt from the clock timer enabled
Interrupt from the V
0
1
Interrupt from the VSYNC pin enabled
0
Interrupt from the serial interface disabled
1
Interrupt from the serial interface enabled
NC pin disabled
SYNC pin disabled
00CROMBNK
0
CROM address setting
0
CROM address 0800H-0BFFH
1
CROM address 0C00H-0F7FH
83
9.20 IDCEN (31H)
31H
b3 b2b1b0
00IDCEN
0
0
IDC operation prohibited (display off)
1
IDC operation start (display on)
9.21 PLL UNLOCK FLIP-FLOP DELAY CONTROL REGISTER (32H)
32H
b
3
PLULSEN3
b
2
b
1
b
0
PLULSEN2PLULSEN1PLULSEN0
µ
PD17062
Setting of the delay time of the reference frequency f
divided frequency f
0
0
1.25 to 1.5
0
1
1
3.5 to 3.75
1
0.25 to 0.5
0
Unlock flip-flop disable (always set)
1
N
required for setting the unlock flip-flop
s or more
µ
s or more
µ
s or more
µ
Fixed at 0
r
and
84
µ
PD17062
9.22 P1BBIOn (35H)
P1BBIOn specifies the PORT1B I/O. When P1BBIOn is set to 0, PORT1B becomes an input port. When
P1BBIOn is set to 1, PORT1B becomes an output port.
35H
b3b2b1b0
P1BBIO3P1BBIO2P1BBIO0
P1BBIO1
P1B
0 I/O setting
0
1
P1B
0
1
P1B
0
1
P1B
0
1
0 input port
P1B
P1B0 output port
1 I/O setting
P1B1 input port
P1B1 output port
2 I/O setting
P1B2 input port
P1B2 output port
3 I/O setting
P1B3 input port
P1B3 output port
9.23 P0BBIOn (36H)
P0BBIOn specifies the PORT0B I/O. When P0BBIOn is set to 0, PORT0B becomes an input port. When
P0BBIOn is set to 1, PORT0B becomes an output port.
36H
b
3
P0BBIO3P0BBIO2P0BBIO0
b
2
b
1
b
0
P0BBIO1
P0B
0
1
P0B
0
1
P0B
0
1
P0B
0
1
0
I/O setting
0
input port
P0B
P0B
0
output port
1
I/O setting
P0B
1
input port
P0B
1
output port
2
I/O setting
P0B
2
input port
P0B
2
output port
3
I/O setting
P0B
3
input port
P0B
3
output port
85
µ
9.24 P0ABIOn (37H)
P0ABIOn specifies the PORT0A I/O. When P0ABIOn is set to 0, PORT0A becomes an input port. When
P0ABIOn is set to 1, PORT0A becomes an output port.
37H
b
3
b
2
b
1
b
0
PD17062
P0ABIO3P0ABIO2P0ABIO0
P0ABIO1
P0A
0
1
P0A
0
1
P0A
0
1
P0A
0
1
0
I/O setting
0
input port
P0A
P0A
0
output port
1
I/O setting
P0A
1
input port
P0A
1
output port
2
I/O setting
P0A
2
input port
P0A
2
output port
3
I/O setting
P0A
3
input port
P0A
3
output port
9.25 SETTING OF INTERRUPT REQUEST GENERATION TIMING IN SERIAL INTERFACE MODE (38H)
38H
b
3
SIO0IMD3SIO0IMD2SIO0IMD0
b
2
b
1
b
0
SIO0IMD1
Fixed at 0
00
01
10
11
Interrupt request generated at rising edge of the 7th bit of the shift clock
Interrupt request generated at rising edge of the 8th bit of the shift clock
Interrupt request generated at rising edge of the 7th bit of the shift
clock immediately after the start condition is detected
Interrupt request generated when the stop condition is detected
Function
86
9.26 SHIFT CLOCK FREQUENCY SETTING (39H)
39H
b3b2b1b0
µ
PD17062
SIO0CK3SIO0CK2SIO0CK0
SIO0CK1
Internal clock frequency
00
01
10
11
Fixed at 0
100 kHz
200 kHz
500 kHz
1 MHz
9.27 IRQNC (3FH)
IRQNC is an interrupt request flag that indicates the interrupt request state.
When an interrupt request is generated, the flag is set to 1. When the request is accepted (interrupt is made),
the flag is reset to 0.
The interrupt request flag can be read and written by the program. Hence, if 1 is written, an interrupt by
software can be generated. If 0 is written, the interrupt hold status can be released. The IRQNC flag becomes
0 upon reset.
Flag nameBit position Interrupt source
IRQNCb0INTNC pin
IRQBTM0b1Clock timer
IRQVSYNb2VSYNC pin
IRQSIO0b3Serial interface
87
µ
10. DATA BUFFER (DBF)
The data buffer is used to transfer data to and from peripheral hardware and to reference tables.
10.1 DATA BUFFER STRUCTURE
10.1.1 Mapping of Data Buffer to Data Memory
Fig. 10-1 shows how the data buffer is mapped to data memory.
As shown in Fig. 10-1, the data buffer is allocated to addresses 0CH to 0FH of data memory BANK0 and
consists of 16 bits in a 4-word × 4-bit configuration.
Because the data buffer is mapped to data memory, it can be operated by data memory instructions.
Fig. 10-1 Data Buffer Map
Column address
0123456789ABCDEF
0
1
Data buffer
PD17062
2
3
4
Low address
5
6
7
7
Data memory
BANK0
BANK1
BANK2
7
System register
88
µ
PD17062
10.1.2 Data Buffer Structure
Fig. 10-2 shows the data buffer structure.
As shown in Fig. 10-2, the data buffer consists of 16 bits. Bit b0 of data memory address 0FH is the LSB,
and bit b
3 of data memory address 0CH bit 3 is the MSB.
Fig. 10-2 Data Buffer Structure
Data memory
Data buffer
Address
Bit
Bit
Symbol
Data
0CH0DH0EH0FH
b3 b2b1 b0 b3b2b1 b0 b3 b2b1 b0b3 b2b1 b0
b15 b14 b13 b12 b11 b10 b9 b8b7 b6b5 b4b3b2b1 b0
DBF3DBF2DBF1DBF0
M
S
B
Data
L
S
B
89
µ
10.2 FUNCTIONS OF DATA BUFFER
The data buffer provides the following two functions:
(1) Read constant data in program memory (to reference tables)
(2) Transfer data to and from peripheral hardware
Fig. 10-3 shows the relationship between the data buffer, peripheral hardware, and memory.
Table referencing is described in Section 10.3, and the peripheral hardware is described in Sections 10.4
to 10.6.
Fig. 10-3 Relationship Between Data Buffer, Peripheral Hardware, and Memory
Data buffer
PD17062
Program memory
(ROM)
Constant data
Internal
Table referencing
Peripheral address
01H
02H
03H
04H
05H-08H
40H
41H
Peripheral hardware
Image display controller (IDC)
A/D converter
Serial interface
Horizontal synchronizing signal
counter
6-bit D/A converter
Address register (AR)
PLL frequency synthesizer
90
µ
PD17062
10.3 DATA BUFFER AND TABLE REFERENCING
10.3.1 Table Referencing
Tables are referenced by reading the constant data from program memory into the data buffer. This is done
using the MOVT DBF, @AR instruction.
Therefore, if display data or other constant data is written to program memory in advance and a table
reference instruction is executed, writing of a complex data conversion program is unnecessary.
The MOVT instruction is described below.
A example program is given in Section 10.3.2.
MOVT DBF, @AR ; Reads the contents of the program memory addressed by the address register into the
data buffer as shown below.
Data buffer
DBF3DBF2DBF1DBF0
15b14b13b12b11b10b9b8b7b6b5b4b3b2b1b0
b
16
MOVT DBF, @ AR
Specifies the program memory address
Program memory
(ROM)
b15b14b13b12b11b10b9b8b7b6b5b4b3b2b1b
Constant data
0
When a table reference instruction is executed, the stack is used one level.
Because the address register (AR) has only eight valid bits, program memory available for table reference
is limited to 256 steps from address 0000H to address 00FFH.
See also Chapter 4 and Section 8.1.
91
10.3.2 Example Table Referencing Program
This section shows an example table referencing program.
Example
P0AMEM0.70H;
P0BMEM0.71H;
P0CMEM0.72H;
ORG0000H
START :
BRMAIN
DATA :
DW0001H; Constant data
DW0002H;
DW0004H;
DW0008H;
DW0010H;
DW0020H;
DW0040H;
DW0080H;
DW0100H;
DW0200H;
DW0400H;
DW0800H;
MAIN :
BANK0; Built-in macro
SET4P0ABIO3, P0ABIO2, P0ABIO1, P0ABIO0
SET4P0BBIO3, P0BBIO2, P0BBIO1, P0BBIO0
MOVRPL,#1110B; Sets general-purpose register to row address 7H of BANK0 .
MOVAR1,#(.DL.DATA SHR 4 AND 0FH)
MOVAR0,#(.DL.DATA SHR 0 AND 0FH)
; Sets address register to 0001H.
LOOP :
;
#
MOVTDBF,@AR; Transfers the contents of the ROM specified by AR to data
; buffer.
;
$
LDP0A,DBF2; Transfers the contents of data buffer to Port0A (70H),
LDP0B,DBF1; Port0B(71H), and Port0C (72H) port data registers.
LDP0C,DBF0
ADDAR0,#1; Increments the contents of data register by one.
ADDCAR1,#0
SKNEAR0,#0CH; Writes 0 in AR0 when the value of AR0 reaches 0CH.
MOVAR0,#0;
BRLOOP
µ
PD17062
92
µ
PD17062
This program sequentially reads the constant data stored at program memory addresses 0001H to 000CH
into the data buffer (#) and outputs the data to Port0A, Port0B, and Port0C ($).
The constant data is left-shifted one bit. As a result, a high-level data is sequentially output to the Port0A,
Port0B, and Port0C pins.
10.4 DATA BUFFER AND PERIPHERAL HARDWARE
10.4.1 How to Control Peripheral Hardware
The following peripheral hardware units transfer data via the data buffer:
• Image display controller
• A/D converter
• Serial interface
• Horizontal synchronizing signal counter
• 6-bit D/A converter
• Address register
• PLL frequency synthesizer
The peripheral hardware is controlled by setting the data in the peripheral hardware via the data buffer or
reading its data.
Each peripheral hardware unit is provided with a data transfer register called a peripheral register. An
address, called a peripheral address, is allocated to each peripheral hardware unit. Data transfer between the
data buffer and peripheral hardware can be performed by executing a GET or PUT instruction (dedicated to
the peripheral register) for the peripheral register.
The GET and PUT instructions are described below. The peripheral hardware and data buffer functions are
listed in Table 10-1.
GET DBF, p; Reads the data of the peripheral register at address p into the data buffer.
PUT p, DBF; Writes the data of the data buffer to the peripheral register at address p.
There are three types of peripheral registers: Write/read (PUT/GET), write only (PUT), and read only (GET).
Device operation when a GET or PUT instruction is executed for a write only (PUT only) or read only (GET
only) peripheral register is described below.
• When a read (GET) instruction is executed for a write only (PUT only) peripheral register, an undefined
value is returned.
• When a write (PUT) instruction is executed for a read only (GET only), it has no effect.
Be careful when using a 17K series assembler and emulator.
For details, see Section 10.6.
93
Table 10-1 Peripheral Hardware and Data Buffer Functions
µ
PD17062
Data buffer and data transfer
peripheral register
Peripheral hardware
Image displayIDC start posi- IDCORG01HPUT/GET87Sets the image display
controllertion settingcontroller display start
A/D converterA/D converterADCR02HPUT/GET84Sets the AD converter
Serial interfacePresettableSIO0SFR03HPUT/GET88Sets the serial out data
Horizontal syn-HSYNCHSC04HGET86Reads the value of the