No part of this material may be reproduced or duplicated in any form or by any means without the written permission
of Seiko Epson. Seiko Epson reserves the right to make changes to this material without notice. Seiko Epson does not
assume any liability of any kind arising out of any inaccuracies contained in this material or due to its application or
use in any product or circuit and, further, there is no representation that this material is applicable to products requiring high level reliability, such as medical products. Moreover, no license to any intellectual property rights is granted by
implication or otherwise, and there is no representation or warranty that anything made in accordance with this material will be free from any patent or copyright infringement of a third party. This material or portions thereof may contain
technology or the subject relating to strategic products under the control of the Foreign Exchange and Foreign Trade
Law of Japan and may require an export license from the Ministry of Economy, Trade and Industry or other approval
from another government agency.
All brands or product names mentioned herein are trademarks and/or registered trademarks of their respective companies.
Appendix B Power Saving ............................................................................................ AP-25
B.1 Clock Control Power Saving ........................................................................................ AP-25
Appendix C Mounting Precautions ............................................................................... AP-28
Appendix D Initialization Routine ................................................................................. AP-31
Appendix E S1C17001 Mask ROM Code Development .............................................. AP-33
Appendix F Revision History ......................................................................................... AP-34
S1C17001 TECHNICAL MANUAL
EPSON
vii
Page 10
1 OVERVIEW
1 Overview
The S1C7001 is a 16-bit MCU featuring high-speed low-power operations, compact dimensions, wide address
space, and on-chip ICE. In addition to the S1C17 CPU core, it incorporates 32 Kbytes of ROM, 2 Kbytes of RAM,
a serial interface supporting various sensors such as UART, SPI, and I
8-bit timer, 16-bit timer, PWM & capture timer, clock timer, stopwatch timer, watchdog timer, and 28 general purpose input/output ports.
It allows 8.2 MHz high-speed operation at an operating voltage of just 1.8 V, and executes single commands using
a single clock with 16-bit RISC processing.
1.1 Features
The main features of the S1C17001 are listed below.
●Mask ROM code development Flash memory • S1C17704 (refer to Appendix E for details)
S1C17001 TECHNICAL MANUAL
EPSON
1
Page 11
1 OVERVIEW
1-2 Block Diagram
#TEST0–5
EXCL0–2
(P16, P07, P06)
SIN, SOUT, SCLK
(P23–25)
SDI, SDO, SPICLK
(P20–22)
(P14–15)
CPU Core S1C17
32 bits
1 cycle
Internal RAM
(2K bytes)
Internal ROM
(32K bytes)
Test circuit
I/O 1 (0x4000–)
Interrupt controller
PrescalerClock timer
8-bit timer
16-bit timer
UART
SPI
2
CSDA, SCL
I
16 bits
1–5 cycles
8/16 bits
1 cycle
8/16 bits
3 cycles
Interrupt system
Reset circuit
I/O 2 (0x5000–)
MISC register
Clock generator
8-bit OSC1 timer
Stopwatch timer
Watchdog timer
PWM & capture
Remote controller
Oscillator/
timer
I/O port/
I/O MUX
DCLK, DST2,
DSIO(P31–33)
#RESET
OSC1–2, OSC3–4
FOUT1(P13),
FOUT3(P30)
EXCL3(P27),
TOUT(P26)
REMI(P04),
REMO(P05)
P00–07, P10–17,
P20–27, P30–33
Figure 1.2.1: Block diagram
2
EPSON
S1C17001 TECHNICAL MANUAL
Page 12
1.3 Pins
A
1.3.1 Pinout Diagram
1 OVERVIEW
1 CornerA1 Corner
A
B
C
D
E
F
G
Top View
Index
Bottom View
A
B
C
D
E
F
G
76543211234567
Top View
234567
P05
REMO
P06
EXCL2
V
SS
REMI
P03
HVDDP02
P12
P11
#RESET
#TEST3
VSSP04
A
B
1
#TEST2
P07
EXCL1
P15
SCL
C
LVDDLVDD
D
DSIO
P33
E
TEST0P17
F
#TEST1P21
G
S1C17001 TECHNICAL MANUAL
P16
EXCL0
VSS
DST2
P32
#SPISS
SDO
P14
SDA
DCLK
P31
P20
SDI
HVDD
Figure 1.3.1.1: Pinout diagram (WCSP-48pin)
P01
P00
P22
SPICLK
P23
SIN
P24
SOUT
EPSON
P10
P13
FOUT1
P25
SCLK
VSS
OSC4
P27
EXCL3
VSS
#TEST4
OSC3
P26
TOUT
P30
FOUT3
OSC1
OSC2
#TEST5
3
Page 13
1 OVERVIEW
1.3.2 Pin Descriptions
Table 1.3.2.1: Pin descriptions
No.NameI/O Default statusFunction
1 VSS––Power supply pin (GND)
2 #TEST1II (Pull-Up)Test pin (fixed at High during normal operations)
3 #TEST2II (Pull-Up)Test pin (fixed at High during normal operations)
4 #TEST3II (Pull-Up)Test pin (fixed at High during normal operations)
5 #TEST4II (Pull-Up)Test pin (fixed at High during normal operations)
6 #TEST5II (Pull-Up)Test pin (fixed at High during normal operations)
7 OSC3IIOSC3 oscillator input pin (permits external clock input)
8 OSC4OOOSC3 oscillator output pin
13 TEST0II (Pull-Down) Test pin (fixed at Low during normal operations)
14 #RESETII (Pull-Up)Initial set input pin
15 DSIO/P33I/OI (Pull-Up)On-chip debugger data input/output pin*/ input/output port pin
16 DST2/P32I/OO(L)On-chip debugger status output pin* / input/output port pin
17 DCLK/P31I/OO(H)On-chip debugger clock output pin* / input/output port pin
18 P30/FOUT3 I/OI (Pull-Up)Input/output port pin*/ OSC3 division clock output pin
19 P27/EXCL3 I/OI (Pull-Up)Input/output port pin*/ T16E external clock input pin
20 P26/TOUTI/OI (Pull-Up)Input/output port pin*/ T16E PWM signal output pin
21 P25/SCLKI/OI (Pull-Up)Input/output port pin*/ UART clock input pin
22 P24/SOUTI/OI (Pull-Up)Input/output port pin*/ UART data output pin
23 P23/SINI/OI (Pull-Up)Input/output port pin*/ UART data input pin
24 P22/SPICLK I/OI (Pull-Up)Input/output port pin*/ SPI clock input/output pin
25 P21/SDOI/OI (Pull-Up)Input/output port pin*/ SPI data output pin
26 P20/SDII/OI (Pull-Up)Input/output port pin*/ SPI data input pin
27 P17/#SPISS I/OI (Pull-Up)Input/output port pin (with interrupt)*/ SPI slave select input pin
28 P16/EXCL0 I/OI (Pull-Up)Input/output port pin (with interrupt)*/ T16 Ch.0 external clock input pin
29 P15/SCLI/OI (Pull-Up)Input/output port pin (with interrupt)*/ I
30 P14/SDAI/OI (Pull-Up)Input/output port pin (with interrupt)*/ I
31 P13/FOUT1 I/OI (Pull-Up)Input/output port pin (with interrupt)*/ OSC1 clock output pin
32 P12I/OI (Pull-Up)Input/output port pin (with interrupt)
33 P11I/OI (Pull-Up)Input/output port pin (with interrupt)
34 P10I/OI (Pull-Up)Input/output port pin (with interrupt)
35 P07/EXCL1 I/OI (Pull-Up)Input/output port pin (with interrupt)*/ T16 Ch.1 external clock input pin
36 P06/EXCL2 I/OI (Pull-Up)Input/output port pin (with interrupt)*/ T16 Ch.2 external clock input pin
37 P05/REMOI/OI (Pull-Up)Input/output port pin (with interrupt)*/ Remote output pin
38 P04/REMII/OI (Pull-Up)Input/output port pin (with interrupt)*/ Remote input pin
39 P03I/OI (Pull-Up)Input/output port pin (with interrupt)
40 HV
DD––Power supply pin (HVDD+)
41 V
SS––Power supply pin (GND)
42 P02I/OI (Pull-Up)Input/output port pin (with interrupt)
43 P01I/OI (Pull-Up)Input/output port pin (with interrupt)
44 P00I/OI (Pull-Up)Input/output port pin (with interrupt)
45 LV
DD––Power supply pin (LVDD+)
46 V
SS––Power supply pin (GND)
47 LV
DD––Power supply pin (LVDD+)
48 V
SS––Power supply pin (GND)
Note: Pins appearing in bold and functions indicated by “*” are default settings.
2C clock output pin
2C data input/output pin
4
EPSON
S1C17001 TECHNICAL MANUAL
Page 14
2 CPU
2 CPU
The S1C17001 uses an S1C17 core as the core processor.
The S1C17 core is an original Seiko Epson 16-bit RISC processor.
It features low power consumption, high-speed operation, wide address space, main command single-clock execution, and gate-saving design. It is ideal for use in controllers or sequencers, in which 8-bit CPUs are widely used.
For detailed information on the S1C17 core, refer to the S1C17 Family S1C17 Core Manual.
2.1 S1C17 Core Features
Processor type
• Seiko Epson original 16-bit RISC processor
• 0.35 μm to 0.15 μm low-power CMOS process technology
Command set
• Code length Fixed 16-bit length
• Number of commands 111 basic commands (184 in total)
• Execution cycle Main commands executed in one cycle
• Immediate expansion commands Expansion of immediate to 24 bits
• Compact, high-speed command set optimized for development with C
Register set
• 24-bit general purpose register x 8
• 24-bit special register x 2
• 8-bit special register x 1
Memory space, buses
• Up to 16 Mbytes of memory space (24-bit address)
• Harvard architecture with separate command bus (16-bit) and data bus (32-bit)
Interrupt
• Supports reset, NMI, and 32 different types of external interrupt
• Irregular address interrupt
• Debug interrupt
• Reading vector from vector table and direct branching to interrupt processing routines
• Permits software interrupts using vector numbers (all vector numbers can be specified)
Power saving
• HALT (halt command)
• SLEEP (slp command)
S1C17001 TECHNICAL MANUAL EPSON
5
Page 15
2 CPU
2.2 CPU Registers
The S1C17 core contains eight general purpose registers and three special registers.
Special registers
Bit 23Bit 0
PC
SP
PSR
765IE4C3V2Z1N0
IL[2:0]
Figure 2.2.1: Registers
General purpose registers
Bit 23Bit 0
7
6
5
4
3
2
1
0
R7
R6
R5
R4
R3
R2
R1
R0
6
EPSON S1C17001 TECHNICAL MANUAL
Page 16
2 CPU
2.3 Command Set
The S1C17 core command codes are all 16-bit and fixed-length. Major commands are executed in a single cycle
using pipeline processing. For more information on the various commands, refer to the S1C17 Family S1C17 Core Manual.
Table 2.3.1: S1C17 core command list
TypeMnemonicFunction
Data transfer
ld.b
ld.ub
ld
ld.a
%rd,%rs
%rd,[%rb]
%rd,[%rb]+
%rd,[%rb]-
%rd,-[%rb]
%rd,[%sp+imm7]
%rd,[imm7]
[%rb],%rs
[%rb]+,%rs
[%rb]-,%rs
-[%rb],%rs
[%sp+imm7],%rs
[imm7],%rs
%rd,%rs
%rd,[%rb]
%rd,[%rb]+
%rd,[%rb]-
%rd,-[%rb]
%rd,[%sp+imm7]
%rd,[imm7]
%rd,%rs
%rd,sign7
%rd,[%rb]
%rd,[%rb]+
%rd,[%rb]-
%rd,-[%rb]
%rd,[%sp+imm7]
%rd,[imm7]
[%rb],%rs
[%rb]+,%rs
[%rb]-,%rs
-[%rb],%rs
[%sp+imm7],%rs
[imm7],%rs
%rd,%rs
%rd,imm7
%rd,[%rb]
%rd,[%rb]+
%rd,[%rb]-
%rd,-[%rb]
%rd,[%sp+imm7]
%rd,[imm7]
[%rb],%rs
[%rb]+,%rs
[%rb]-,%rs
-[%rb],%rs
[%sp+imm7],%rs
[imm7],%rs
%rd,%sp
%rd,%pc
%rd,[%sp]
%rd,[%sp]+
%rd,[%sp]-
%rd,-[%sp]
General purpose register (byte) ➔ General purpose register (sign extension)
Memory (byte) ➔ General purpose register (sign extension)
Memory address post-increment/post-decrement
A pre-decrement function can be used
Stack (byte) ➔ General purpose register (sign extension)
Memory (byte) ➔ General purpose register (sign extension)
General purpose register (byte) ➔ Memory
Memory address post-increment/post-decrement
A pre-decrement function can be used
General purpose register (byte) ➔ Stack
General purpose register (byte) ➔ Memory
General purpose register (byte) ➔ General purpose register (zero extension)
Memory (byte) ➔ General purpose register (zero extension)
Memory address post-increment/post-decrement
A pre-decrement function can be used
Stack (byte) ➔ General purpose register (zero extension)
Memory (byte) ➔ General purpose register (zero extension)
General purpose register (16 bits) ➔ General purpose register
Immediate ➔ General purpose register (sign extension)
Memory (16 bits) ➔ General purpose register
Memory address post-increment/post-decrement
A pre-decrement function can be used
Stack (16 bits) ➔ General purpose register
Memory (16 bits) ➔ General purpose register
General purpose register (16 bits) ➔ Memory
Memory address post-increment/post-decrement
A pre-decrement function can be used
General purpose register (16 bits) ➔ Stack
General purpose register (16 bits) ➔ Memory
General purpose register (24 bits)
Immediate ➔ General purpose register (zero extension)
Memory (32 bits) ➔ General purpose register (*1)
Memory address post-increment/post-decrement
A pre-decrement function can be used
Stack (32 bits) ➔ General purpose register (*1)
Memory (32 bits) ➔ General purpose register (*1)
General purpose register (32 bits, zero extension) ➔ Memory (*1)
Memory address post-increment/post-decrement
A pre-decrement function can be used
General purpose register (32 bits, zero extension) ➔ Stack (*1)
General purpose register (32 bits, zero extension) ➔ Memory (*1)
SP ➔ General purpose register
PC ➔ General purpose register
Stack (32 bits) ➔ General purpose register (*1)
Stack pointer post-increment/post-decrement
A pre-decrement function can be used
➔ General purpose register
S1C17001 TECHNICAL MANUAL EPSON
7
Page 17
2 CPU
TypeMnemonicFunction
Data transfer
Integer arithmetic
Logic operations
ld.a[%sp],%rs
add
add/c
add/nc
add
add.a
add.a/c
add.a/nc
add.a%sp,%rs
adc
adc/c
adc/nc
adc
sub
sub/c
sub/nc
sub
sub.a
sub.a/c
sub.a/nc
sub.a%sp,%rs
sbc
sbc/c
sbc/nc
sbc
cmp
cmp/c
cmp/nc
cmp
cmp.a
cmp.a/c
cmp.a/nc
cmp.a
cmc
cmc/c
cmc/nc
cmc
and
and/c
and/nc
and
or
or/c
or/nc
or
xor
xor/c
xor/nc
xor
not
not/c
not/nc
not
[%sp]+,%rs
[%sp]-,%rs
-[%sp],%rs
%sp,%rs
%sp,imm7
%rd,%rs
%rd,imm7
%rd,%rs
%rd,imm7
%sp,imm7
%rd,%rs
%rd,imm7
%rd,%rs
%rd,imm7
%rd,%rs
%rd,imm7
%sp,imm7
%rd,%rs
%rd,imm7
%rd,%rs
%rd,sign7
%rd,%rs
%rd,imm7
%rd,%rs
%rd,sign7
%rd,%rs
%rd,sign7
%rd,%rs
%rd,sign7
%rd,%rs
%rd,sign7
%rd,%rs
,sign7
%rd
General purpose register (32 bits, zero extension) ➔ Stack (*1)
Stack pointer post-increment/post-decrement
A pre-decrement function can be used
General purpose register (24 bits) ➔ SP
Immediate ➔ SP
Adds 16 bits between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Adds general purpose register and immediate 16 bits
Adds 24 bits between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Adds SP and general purpose register 24 bits
Adds general purpose register and immediate 24 bits
Adds SP and immediate 24 bits
Adds 16 bits with carry between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Adds general purpose register and immediate 16 bits with carry
Subtracts 16 bits between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Subtracts general purpose register and immediate 16 bits
Subtracts 24 bits between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Subtracts SP and general purpose register 24 bits
Subtracts general purpose register and immediate 24 bits
Subtracts SP and immediate 24 bits
Subtracts 16 bits with carry between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Subtracts general purpose register and immediate 16 bits with carry
Compares 16 bits between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Compares general purpose registers and immediate 16 bits
Compares 24 bits between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Compares general purpose registers and immediate 24 bits
Compares 16 bits with carry between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
Compares general purpose register and immediate 16 bits with carry
AND operation between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
AND operation for general purpose register and immediate
OR operation between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
OR operation for general purpose register and immediate
EXCLUSIVE OR between general purpose registers
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
EXCLUSIVE OR for general purpose register and immediate
NOT operation between general purpose registers (1 complement)
Supports conditional execution (/c: Executed when C = 1, /nc: Executed when
C = 0)
NOT operation for general purpose register and immediate (1 complement)
8
EPSON S1C17001 TECHNICAL MANUAL
Page 18
2 CPU
TypeMnemonicFunction
Shift & swap
Immediate extension
Conversion
Branch
System control
sr
sa
sl
swap
ext
cv.ab
cv.as
cv.al
cv.la
cv.ls
jpr
jpr.d
jpa
ipa.d
jrgt
jrgt.d
jrge
jrge.d
jrlt
jrlt.d
jrle
jrle.d
jrugt
jrugt.d
jruge
jruge.d
jrult
jrult.d
jrule
jrule.d
jreq
jreq.d
jrne
jrne.d
call
call.d
calla
calla.d
ret
ret.d
int
intl
reti
reti.d
brk
retd
nop
halt
slp
ei
di
%rd,%rs
%rd,imm7
%rd,%rs
%rd,imm7
%rd,%rs
%rd,imm7
%rd,%rs
imm13
%rd,%rs
%rd,%rs
%rd,%rs
%rd,%rs
%rd,%rs
sign10
%rb
imm7
%rb
sign7
sign7
sign7
sign7
sign7
sign7
sign7
sign7
sign7
sign7
sign10
%rb
imm7
%rb
imm5
imm5,imm3
Right logic shift (shift bit number specified by register)
Right logic shift (shift bit number specified by immediate)
Right operation shift (shift bit number specified by register)
Right operation shift (shift bit number specified by immediate)
Left logic shift (shift bit number specified by register)
Left logic shift (shift bit number specified by immediate)
Byte swap at 16-bit boundary
Extend operand for next command
Convert 8-bit coded data to 24 bits
Convert 16-bit coded data to 24 bits
Convert 32-bit data to 24 bits
Convert 24-bit data to 32 bits
Convert 16-bit data to 32 bits
PC-relative jump
Allows delayed branching
Absolute jump
Allows delayed branching
Conditional PC-relative jump Branch conditions: !Z & !(N ^ V)
Allows delayed branching
Conditional PC-relative jump Branch conditions: !(N ^ V)
Allows delayed branching
Conditional PC-relative jump Branch conditions: N ^ V
Allows delayed branching
Conditional PC-relative jump Branch conditions: Z | N ^ V
Allows delayed branching
Conditional PC-relative jump Branch conditions: !Z & !C
Allows delayed branching
Conditional PC-relative jump Branch conditions: !C
Allows delayed branching
Conditional PC-relative jump Branch conditions: C
Allows delayed branching
Conditional PC-relative jump Branch conditions: Z | C
Allows delayed branching
Conditional PC-relative jump Branch conditions: Z
Allows delayed branching
Conditional PC-relative jump Branch conditions: !Z
Allows delayed branching
PC-relative subroutine call
Allows delayed branching
Absolute subroutine call
Allows delayed branching
Return from subroutine
Allows delayed branching
Software interrupt
Software interrupt with interrupt level specification
Return from interrupt
Allows delayed branching
Debug interrupt
Return from debug processing
No operation
HALT
SLEEP
Permits interrupt
Prevents interrupt
*1: Command ld.a accesses 32-bit memory. When data is transferred from register to memory, 32 bits of data with
the first 8 bits set to 0 are written to memory. When data is read from memory, the first 8 bits are ignored.
*2: Coprocessor commands are reserved, since the S1C17001 does not include a coprocessor.
S1C17001 TECHNICAL MANUAL EPSON
9
Page 19
2 CPU
The codes used in this table are explained below.
Table 2.3.2: Code meanings
CodeDescription
%rs
%rd
%rb
[
]
%rb
[
]+
%rb
[
]-
%rb
-[
]
%sp
[%sp],[%sp+
imm7
]
[%sp]+
[%sp]-
-[%sp]
imm3,imm5,imm7,imm13
sign7,sign10
General purpose source register
General purpose destination register
Memory specified indirectly by general purpose register
Memory specified indirectly by general purpose register (with address postincrement)
Memory specified indirectly by general purpose register (with address postdecrement)
Memory specified indirectly by general purpose register (with address predecrement)
Stack pointer
Stack
Stack (with address post-increment)
Stack (with address post-decrement)
Stack (with address pre-decrement)
Immediate without code (number indicates bit length)
Immediate with code (number indicates bit length)
10
EPSON S1C17001 TECHNICAL MANUAL
Page 20
2 CPU
2.4 Vector Table
The vector table contains the vectors (processing routine start addresses) for interrupt processing routines. When an
interrupt occurs, the S1C17 core reads the vector corresponding to the interrupt and executes that processing routine.
The boot address for starting program execution must be written at the top of the vector table after resetting.
The S1C17001 vector table starts from address 0x8000. The vector table base address can be read from the TTBR
(vector table base register) at address 0xffff80.
Table 2.4.1 shows the S1C17001 vector table.
–(0xfffc00)Debug interruptbrk command etc.3
2 (0x02)0x8008NMIWatchdog timer overflow
3 (0x03)0x800creserved––
4 (0x04)0x8010P0 port interruptP00 to P07 port input High
5 (0x05)0x8014P1 port interruptP10 to P17 port input
6 (0x06)0x8018Stopwatch timer interrupt• Timer 100 Hz signal
7 (0x07)0x801cClock timer interrupt• Timer 32 Hz signal
8 (0x08)0x80208-bit OSC1 timer interruptCompare match
9 (0x09)0x8024
10 (0x0a)0x8028
11 (0x0b)0x802cPWM & capture timer interrupt• Compare A
The CPU operates using CCLK as a datum. For more information on CCLK, refer to “8.2 CPU Core Clock (CCLK)
Control.”
The time from one CCLK rise-up to the next forms 1 CCLK, defined as one bus cycle. As shown in Figure 3.1, the
number of cycles required for a single bus access depends on the peripheral circuits and memory. The number of
bus accesses also varies and depends on the CPU command (access size) and device size.
Table 3.1.1: Bus access numbers
Device sizeCPU access sizeBus access number
8 bits8 bits1
16 bits2
32 bits *4
16 bits8 bits1
16 bits1
32 bits *2
32 bits8 bits1
16 bits1
32 bits *1
∗First 8 bits of data for 32-bit data access
The first 8 bits of 32-bit data are written to memory as 0. The first 8 bits are ignored when read from memory. In-
terrupt processing stack operation involves reading and writing 32 bits with the PSR value in the first 8 bits and
the return address in the last 24 bits.
Bus cycle calculation example
Number of bus cycles when accessing internal peripheral circuit area 2 (8-bit device, 3 cycles) from CPU using
16-bit read/write command:
3 cycles x 2 bus accesses = 6 CCLK cycles
3.1.1 Access Size Restrictions
When programming, note that the modules listed below are subject to access size restrictions.
SPI, I2C
The SPI and I2C registers can be accessed only with 16-bit read/write commands.
All other modules can be accessed using 8-bit, 16-bit, and 32-bit commands. Where possible, we recommend
matching access to device size. Reading from non-essential registers may alter the state of peripheral circuits and
cause problems.
3.1.2 Command Execution Cycle Restrictions
In the event of any of the conditions listed below, command fetch and data access will not be performed simultaneously, and the command fetch cycle will be extended by the amount of access cycles for the areas in which data exists.
• If a command is executed for an internal ROM area while accessing internal ROM and internal peripheral circuit
area 2 (0x5000 onward) data
• If a command is executed for an internal RAM area while accessing internal RAM area data
14
EPSON S1C17001 TECHNICAL MANUAL
Page 24
3 MEMORY MAP AND BUS CONTROL
3.2 Internal ROM Area
3.2.1 Internal ROM
The 32 Kbyte area from address 0x8000 to 0xffff is ROM. This area can be used for writing application programs
and data. Address 0x8000 is defined as the vector table base address, and the vector table must be placed at the start
of this area (refer to “2.4 Vector Table”). ROM reads take 1 to 5 cycles.
3.2.2 ROM Read Access Cycle Settings
Set the IROM area read access cycles using FLCYC[2:0] (D[2:0]/MISC_FL register) to retain compatibility with
S1C17701. Normally, set FLCYC[2:0] to 0x4.
0x5320: ROM Control Register (MISC_FL)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
ROM
Control Register
(MISC_FL)
0x5320
D7–3 –reserved––– 0 when being read.
(8 bits)
D2–0 FLCYC[2:0] ROM read access cycleFLCYC[2:0]Read cycle 0x3 R/W
0x7–0x5
0x4
0x3
0x2
0x1
0x0
reserved
1 cycle
5 cycles
4 cycles
3 cycles
2 cycles
S1C17001 TECHNICAL MANUAL EPSON
15
Page 25
3 MEMORY MAP AND BUS CONTROL
3.3 Internal RAM Area
3.3.1 Internal RAM
The 2 Kbyte area from address 0x0 to 0x7ff is RAM. This RAM can be accessed in one cycle. In addition to storing
variables, it can also be used to copy command codes and execute them rapidly in RAM.
Note: The last 64 bytes of the internal RAM (0x7c0 to 0x7ff) are reserved for on-chip debugging. This
area should not be accessed by application programs when using debug functions (for example, during application development).
It can be used for applications in mass-produced products that do not require debugging.
16
EPSON S1C17001 TECHNICAL MANUAL
Page 26
3 MEMORY MAP AND BUS CONTROL
3.4 Internal Peripheral Circuit Area
The 1 Kbyte area starting at address 0x4000 and the 4 Kbyte area from 0x5000 are assigned for use as internal peripheral circuit I/O and control registers.
3.4.1 Internal Peripheral Circuit Area 1 (0x4000 onward)
The internal peripheral circuit area 1 starting at address 0x4000 is assigned for use as the following internal peripheral function I/O memory and can be accessed in a single cycle.
• Prescaler (PSC, 8-bit device)
• UART (UART, 8-bit device)
• 8-bit timer (T8F, 16-bit device)
• 16-bit timer (T16, 16-bit device)
• Interrupt controller (ITC, 16-bit device)
• SPI (SPI, 16-bit device)
2
• I
C (I2C, 16-bit device)
3.4.2 Internal Peripheral Circuit Area 2 (0x5000 onward)
The internal peripheral circuit area 2 starting at address 0x5000 is assigned for use as the following internal peripheral function I/O memory, and can be accessed in three cycles.
• Clock timer (CT, 8-bit device)
• Stopwatch timer (SWT, 8-bit device)
• Watchdog timer (WDT, 8-bit device)
• Oscillator circuit (OSC, 8-bit device)
• Clock generator (CLG, 8-bit device)
• 8-bit OSC1 timer (T8OSC1, 8-bit device)
• Input/output port & port MUX (P, 8-bit device)
• PWM & capture timer (T16E, 16-bit device)
• MISC register (MISC, 8-bit device)
• Remote controller (REMC, 8-bit device)
S1C17001 TECHNICAL MANUAL EPSON
17
Page 27
3 MEMORY MAP AND BUS CONTROL
3.4.3 I/O Map
The I/O map for the internal peripheral circuit area is shown below. For more information on control registers, refer
to the I/O register list in the Appendix or the corresponding peripheral circuit explanations.
Note: Addresses indicated as “Reserved” or blank unused peripheral circuit areas should not be ac-
cessed by application programs.
Table 3.4.3.1: I/O map (internal peripheral circuit area 1)
Peripheral circuit
Prescaler
(8-bit device)
UART (with IrDA)
(8-bit device)
8-bit timer
(with F mode)
(16-bit device)
16-bit timer Ch.0
(16-bit device)
16-bit timer Ch.1
(16-bit device)
16-bit timer Ch.2
(16-bit device)
Interrupt
controller
(16-bit device)
SPI
(16-bit device)
2
C
I
(16-bit device)
18
EPSON S1C17001 TECHNICAL MANUAL
AddressRegister nameFunction
0x4020PSC_CTLPrescaler Control RegisterPrescaler start/stop control
0x4021 to 0x403f ––Reserved
0x4100UART_STUART Status RegisterTransfer, buffer, and error status display
0x4101UART_TXDUART Transmit Data RegisterTransmission data
0x4102UART_RXDUART Receive Data RegisterReceived data
0x4103UART_MODUART Mode RegisterTransfer data format setting
0x4104UART_CTLUART Control RegisterData transfer control
0x4105UART_EXPUART Expansion RegisterIrDA mode setting
0x4106 to 0x411f ––Reserved
0x4200T8F_CLK8-bit Timer Input Clock Select RegisterPrescaler output clock selection
0x4202T8F_TR8-bit Timer Reload Data RegisterReload data setting
0x4204T8F_TC8-bit Timer Counter Data RegisterCounter data
0x4206T8F_CTL8-bit Timer Control RegisterTimer mode setting and timer RUN/STOP
0x4208 to 0x421f ––Reserved
0x4220T16_CLK016-bit Timer Ch.0 Input Clock Select Register Prescaler output clock selection
0x4222T16_TR016-bit Timer Ch.0 Reload Data RegisterReload data setting
0x4224T16_TC016-bit Timer Ch.0 Counter Data RegisterCounter data
0x4226T16_CTL016-bit Timer Ch.0 Control RegisterTimer mode setting and timer RUN/STOP
0x4228 to 0x423f ––Reserved
0x4240T16_CLK116-bit Timer Ch.1 Input Clock Select Register Prescaler output clock selection
0x4242T16_TR116-bit Timer Ch.1 Reload Data RegisterReload data setting
0x4244T16_TC116-bit Timer Ch.1 Counter Data RegisterCounter data
0x4246T16_CTL116-bit Timer Ch.1 Control RegisterTimer mode setting and timer RUN/STOP
0x4248 to 0x425f ––Reserved
0x4260T16_CLK216-bit Timer Ch.2 Input Clock Select Register Prescaler output clock selection
0x4262T16_TR216-bit Timer Ch.2 Reload Data RegisterReload data setting
0x4264T16_TC216-bit Timer Ch.2 Counter Data RegisterCounter data
0x4266T16_CTL216-bit Timer Ch.2 Control RegisterTimer mode setting and timer RUN/STOP
0x4268 to 0x427f ––Reserved
0x4300ITC_IFLGInterrupt Flag RegisterInterrupt occurrence status display/reset
0x4302ITC_ENInterrupt Enable RegisterMaskable interrupt permission/prohibition
0x4304ITC_CTLITC Control RegisterITC operation permission/prohibition
0x4306ITC_ELV0External Interrupt Level Setup Register 0P0/P1 port interrupt level and trigger mode
0x4314ITC_ILV3Internal Interrupt Level Setup Register 3SPI and I
0x4316 to 0x431f ––Reserved
0x4320SPI_STSPI Status RegisterTransfer and buffer status display
0x4322SPI_TXDSPI Transmit Data RegisterTransmission data
0x4324SPI_RXDSPI Receive Data RegisterReceived data
0x4326SPI_CTLSPI Control RegisterSPI mode and data transfer permission
0x4328 to 0x433f ––Reserved
0x4340I2C_ENI2C Enable RegisterI2C module enable
0x4342I2C_CTLI
0x4344I2C_DATI
0x4346I2C_ICTLI
0x4348 to 0x435f ––Reserved
2
C Control RegisterI2C control and transfer status display
2
C Data RegisterTransfer data
2
C Interrupt Control RegisterI2C interrupt control
setting
level and trigger mode setting
mode setting
trigger mode setting
level setting
interrupt level setting
setting
2
C interrupt level setting
setting
Page 28
Peripheral circuit
Clock timer
(8-bit device)
Stopwatch timer
(8-bit device)
Watchdog timer
(8-bit device)
Oscillator circuit
(8-bit device)
Clock generator
(8-bit device)
8-bit OSC1 timer
(8-bit device)
P port & port
MUX
(8-bit device)
3 MEMORY MAP AND BUS CONTROL
Table 3.4.3.2: I/O map (internal peripheral circuit area 2)
AddressRegister nameFunction
0x5000CT_CTLClock Timer Control RegisterTimer reset and RUN/STOP control
0x5001CT_CNTClock Timer Counter RegisterCounter data
0x5002CT_IMSKClock Timer Interrupt Mask RegisterInterrupt mask setting
0x5003CT_IFLGClock Timer Interrupt Flag RegisterInterrupt occurrence status display/reset
0x5004 to 0x501f ––Reserved
0x5020SWT_CTLStopwatch Timer Control RegisterTimer reset and RUN/STOP control
0x5021SWT_BCNTStopwatch Timer BCD Counter RegisterBCD Counter data
0x5022SWT_IMSKStopwatch Timer Interrupt Mask RegisterInterrupt mask setting
0x5023SWT_IFLGStopwatch Timer Interrupt Flag RegisterInterrupt occurrence status display/reset
0x5024 to 0x503f ––Reserved
0x5040WDT_CTLWatchdog Timer Control RegisterTimer reset and RUN/STOP control
0x5041WDT_STWatchdog Timer Status RegisterTimer mode setting and NMI status display
0x5042 to 0x505f ––Reserved
0x5060OSC_SRCClock Source Select RegisterClock source selection
0x5061OSC_CTLOscillation Control RegisterOscillation control
0x5062OSC_NFENNoise Filter Enable RegisterNoise filter ON/OFF
0x5063––Reserved
0x5064OSC_FOUTFOUT Control RegisterClock external output control
0x5065OSC_T8OSC1 T8OSC1 Clock Control Register8-bit OSC1 timer clock setting
0x5066 to 0x507f ––Reserved
0x5080CLG_PCLKPCLK Control RegisterPCLK feed control
0x5081CLG_CCLKCCLK Control RegisterCCLK division ratio setting
0x5082 to 0x509f ––Reserved
0x50c0T8OSC1_CTL 8-bit OSC1 Timer Control RegisterTimer mode setting and timer RUN/STOP
0x50c1T8OSC1_CNT 8-bit OSC1 Timer Counter Data RegisterCounter data
0x50c2T8OSC1_CMP 8-bit OSC1 Timer Compare Data RegisterCompare data setting
0x50c3T8OSC1_IMSK 8-bit OSC1 Timer Interrupt Mask RegisterInterrupt mask setting
0x50c4T8OSC1_IFLG 8-bit OSC1 Timer Interrupt Flag RegisterInterrupt occurrence status display/reset
0x50c5 to 0x50df ––Reserved
0x5200P0_INP0 Port Input Data RegisterP0 port input data
0x5201P0_OUTP0 Port Output Data RegisterP0 port output data
0x5202P0_IOP0 Port I/O Direction Control RegisterP0 port input/output direction selection
0x5203P0_PUP0 Port Pull-up Control RegisterP0 port pull-up control
0x5204––Reserved
0x5205P0_IMSKP0 Port Interrupt Mask RegisterP0 port interrupt mask setting
0x5206P0_EDGEP0 Port Interrupt Edge Select RegisterP0 port interrupt edge selection
0x5207P0_IFLGP0 Port Interrupt Flag RegisterP0 port interrupt occurrence status display/
0x5208P0_CHATP0 Port Chattering Filter Control RegisterP0 port chattering filter control
0x5209P0_KRSTP0 Port Key-Entry Reset Configuration Regis-
ter
0x520a to 0x520f ––Reserved
0x5210P1_INP1 Port Input Data RegisterP1 port input data
0x5211P1_OUTP1 Port Output Data RegisterP1 port output data
0x5212P1_IOP1 Port I/O Direction Control RegisterP1 port input/output direction selection
0x5213P1_PUP1 Port Pull-up Control RegisterP1 port pull-up control
0x5214––Reserved
0x5215P1_IMSKP1 Port Interrupt Mask RegisterP1 port interrupt mask setting
0x5216P1_EDGEP1 Port Interrupt Edge Select RegisterP1 port interrupt edge selection
0x5217P1_IFLGP1 Port Interrupt Flag RegisterP1 port interrupt occurrence status display/
0x5218 to 0x521f ––Reserved
0x5220P2_INP2 Port Input Data RegisterP2 port input data
0x5221P2_OUTP2 Port Output Data RegisterP2 port output data
0x5222P2_IOP2 Port I/O Direction Control RegisterP2 port input/output direction selection
0x5223P2_PUP2 Port Pull-up Control RegisterP2 port pull-up control
0x5224 to 0x522f ––Reserved
0x5230P3_INP3 Port Input Data RegisterP3 port input data
0x5231P3_OUTP3 Port Output Data RegisterP3 port output data
0x5232P3_IOP3 Port I/O Direction Control RegisterP3 port input/output direction selection
0x5233P3_PUP3 Port Pull-up Control RegisterP3 port pull-up control
0x5234 to 0x527f ––Reserved
0x52a0P0_PMUXP0 Port Function Select RegisterP0 port function selection
0x52a1P1_PMUXP1 Port Function Select RegisterP1 port function selection
0x52a2P2_PMUXP2 Port Function Select RegisterP2 port function selection
0x52a3P3_PMUXP3 Port Function Select RegisterP3 port function selection
0x52a4 to 0x52bf ––Reserved
reset
P0 port key entry reset setting
reset
S1C17001 TECHNICAL MANUAL EPSON
19
Page 29
3 MEMORY MAP AND BUS CONTROL
Peripheral circuit
PWM & capture
timer
(16-bit device)
MISC register
(8-bit device)
Remote controller
(8-bit device)
AddressRegister nameFunction
0x5300T16E_CAPWM Timer Compare Data A RegisterCompare data A setting
0x5302T16E_CBPWM Timer Compare Data B RegisterCompare data B setting
0x5304T16E_TCPWM Timer Counter Data RegisterCounter data
0x5306T16E_CTLPWM Timer Control RegisterTimer mode setting and timer RUN/STOP
0x5308T16E_CLKPWM Timer Input Clock Select RegisterPrescaler output clock selection
0x530aT16E_IMSKPWM Timer Interrupt Mask RegisterInterrupt mask setting
0x530cT16E_IFLGPWM Timer Interrupt Flag RegisterInterrupt occurrence status display/reset
0x530e to 0x531f ––Reserved
0x5320MISC_FLROM Control RegisterROM access condition setting
0x5321––Reserved
0x5322MISC_OSC1 OSC1 Peripheral Control RegisterOSC1 operation peripheral function setting
for debugging
0x5323 to 0x533f ––Reserved
0x5340REMC_CFGREMC Configuration RegisterTransfer selection and permission
0x5341REMC_PSCREMC Prescaler Clock Select RegisterPrescaler output clock selection
0x5342REMC_CARH REMC H Carrier Length Setup RegisterCarrier H section length setting
0x5343REMC_CARL REMC L Carrier Length Setup RegisterCarrier L section length setting
0x5344REMC_STREMC Status RegisterTransfer bit
0x5345REMC_LCNT REMC Length Counter RegisterTransfer data length setting
0x5346REMC_IMSK REMC Interrupt Mask RegisterInterrupt mask setting
0x5347REMC_IFLGREMC Interrupt Flag RegisterInterrupt occurrence status display/reset
0x5348 to 0x535f ––Reserved
20
EPSON S1C17001 TECHNICAL MANUAL
Page 30
3 MEMORY MAP AND BUS CONTROL
3.5 Core I/O Reserved Area
The 1 Kbyte area from 0xfffc00 to 0xffffff is used as the CPU core I/O area, and the following I/O registers are assigned.
Table 3.5.1: I/O map (Core I/O reserved area)
Peripheral circuit
S1C17 core I/O 0xffff80TTBRVector Table Base RegisterVector table base address display
For more information on TTBR, refer to “2.4 Vector Table”; and for more information on IDIR, refer to “2.5 Processor Information.”
For more information on DBRAM, refer to “22 On-chip Debugging (DBG).”
AddressRegister nameFunction
0xffff84IDIRProcessor ID RegisterProcessor ID display
0xffff90DBRAMDebug RAM Base RegisterDebugging RAM base address display
S1C17001 TECHNICAL MANUAL EPSON
21
Page 31
3 MEMORY MAP AND BUS CONTROL
This page intentionally left blank.
22
EPSON S1C17001 TECHNICAL MANUAL
Page 32
4 Power Supply Voltage
The S1C17001 operation power supply voltages are given below.
4 POWER SUPPLY VOLTAGE
Core voltage (LV
I/O voltage (HV
DD): 1.65 V to 2.7 V
DD): 1.65 V to 3.6 V
Supply voltages within the respective ranges to LV
The S1C17001 has two LV
DD pins, two HVDD pins, and five VSS pins. All must be connected to the + power supply
and GND. None should be left open.
DD and HVDD pins with the VSS pin as GND.
S1C17001 TECHNICAL MANUAL EPSON
23
Page 33
4 POWER SUPPLY VOLTAGE
This page intentionally left blank.
24
EPSON S1C17001 TECHNICAL MANUAL
Page 34
5 Initial Reset
5.1 Initial Reset Factors
Shown below are the three different initial reset factors for initializing S1C17001 internal circuits.
(1) External initial reset via #RESET pin
(2) External initial reset via P0 port (pins P00 to P03) key entry (set by software)
(3) Internal initial reset via watchdog timer (set by software)
Figure 5.1.1 illustrates the initial reset circuit configuration.
5 INITIAL RESET
#RESET
P00
P01
P02
P03
Chattering filter
circuit
Oscillation stabilization
standby circuit
Key reset
control circuit
P0KRST
Watchdog timer
WDTMD
Figure 5.1.1: Initial reset circuit configuration
Digital noise
filter
SRQ
Internal
reset
The CPU and peripheral circuits are initialized by initial reset factors. The CPU begins reset processing once the
factors are canceled.
This causes the reset vector to be read from the start of the vector table, and the program (initialization routine)
starting at that address to be executed.
5.1.1 #RESET pin
Initial resetting is possible by inputting external Low level to the #RESET pin.
To initialize the S1C17001 reliably, the #RESET pin must be maintained at Low level for at least the specified duration after the power supply voltage rises. (Refer to “24.5 AC Characteristics.”)
Initial resetting is canceled if the #RESET input changes from Low to High, and the CPU begins reset interrupt
processing.
The #RESET pin incorporates a pull-up resistance.
S1C17001 TECHNICAL MANUAL EPSON
25
Page 35
5 INITIAL RESET
5.1.2 P0 Port Key-Entry Reset
Initial resetting is possible by inputting external Low level simultaneously to the ports (P00 to P03) selected by
software. The ports can be selected by P0KRST[1:0] (D[1:0]/P0_KRST register).
∗P0KRST[1:0]: P0 Port Key-Entry Reset Configuration Bits in the P0 Port Key-Entry Reset Configuration
For example, initial reset is applied when input to the four ports P00 to P03 is Low level simultaneously if
P0KRST[1:0] is set to 0x3.
Note: • Make sure the specified ports are not simultaneously switched to Low during normal op-
erations when using the P0 port key-entry reset function.
• The P0 port key-entry reset function is enabled by software and cannot be used to perform
a reset at power-on.
• The P0 port key-entry reset function cannot be used in SLEEP state.
5.1.3 Reset by Watchdog Timer
The S1C17001 incorporates a watchdog timer to detect runaway CPU. If the watchdog timer is not reset by software every 4 seconds (with this failure indicating a runaway CPU), the timer overflows, generating an NMI or reset. A reset is generated by writing “1” to WDTMD (D1/WDT_ST register). (NMI is generated if WDTMD is 0.)
∗WDTMD: NMI/Reset Mode Select Bit in the Watchdog Timer Status (WDT_ST) Register (D1/0x5041)
For detailed information on the watchdog timer, refer to “17 Watchdog Timer (WDT).”
Note: • When using the reset function with the watchdog timer, to prevent accidental resetting, take
care to program so that the watchdog timer is reset every four seconds.
• The watchdog timer reset function is enabled by software and cannot be used to perform a
reset at power-on.
26
EPSON S1C17001 TECHNICAL MANUAL
Page 36
5 INITIAL RESET
5.2 Initial Reset Sequence
CPU startup waits for the oscillation stabilization standby time (1024/fosc3 seconds*) to expire after resetting is
cancelled via the #RESET pin at power-on. Figure 5.2.1 illustrates the sequence of operations after canceling the
initial reset. The CPU starts up in sync with the OSC3 clock after the reset is canceled.
*fosc3: OSC3 clock frequency
Note: The oscillation stabilization standby time does not include the oscillation start time. The time
may be longer than that shown between power-on or SLEEP cancellation and command execution.
OSC3 clock
#RESET
Reset cancellation
Internal data request
Internal data address
Figure 5.2.1: Sequence of operations after initial reset cancellation
Reset
cancellation
Oscillation
stabilization
standby time
Internal reset
cancellation
Boot vector
Boot operation start
S1C17001 TECHNICAL MANUAL EPSON
27
Page 37
5 INITIAL RESET
5.3 Initial Settings at Initial Resetting
The CPU internal register is initialized by initial resetting, as shown below.
R0 to R7: 0x0
PSR: 0x0 (interrupt level = 0, interrupt prohibited)
SP: 0x0
PC: Reset vector at start of vector table is loaded by reset processing.
The internal RAM and display memory should be initialized via software, since they are not initialized by initial
resetting.
The internal peripheral circuits are initialized in accordance with their particular specifications. They should be
reset via software, if necessary. For detailed information on initial values after initial resetting, refer to the I/O
register list in the Appendix or the respective peripheral circuit descriptions.
28
EPSON S1C17001 TECHNICAL MANUAL
Page 38
6 Interrupt Controller
6.1 ITC Configuration
The S1C17001 features the following 14 different types of hardware interrupts:
1. P00 to P07 input interrupt (8 types)
2. P10 to P17 input interrupt (8 types)
3. Stopwatch timer interrupt (3 types)
4. Clock timer interrupt (4 types)
5. 8-bit OSC1 timer interrupt (1 type)
6. PWM & capture timer interrupt (2 types)
7. 8-bit timer interrupt (1 type)
8. 16-bit timer Ch.0 interrupt (1 type)
9. 16-bit timer Ch.1 interrupt (1 type)
10. 16-bit timer Ch.2 interrupt (1 type)
11. UART interrupt (3 types)
12. Remote controller interrupt (3 types)
13. SPI interrupt (2 types)
2
14. I
C interrupt (2 types)
6 INITERRUPT CONTROLLER
The various interrupt circuits include interrupt flags to indicate an interrupt request from a neighboring module and
interrupt enable bits to permit/prohibit interrupts. The interrupt level (priority) for determining the processing order
when multiple interrupts occur simultaneously can be set separately for each interrupt circuit.
Each interrupt circuit includes the number of interrupt factors indicated in parentheses above. The respective peripheral module register controls the specific interrupt factor used to generate the interrupt request to the ITC. For
detailed information on interrupt factors and interrupt factor control, refer to the discussion of the peripheral module.
Figure 6.1.1 illustrates the interrupt system configuration.
S1C17 core
Interrupt
request
Interrupt
level
Vector
number
NMI
Interrupt controller
Interrupt
control
Watchdog timer
Debug signal
Reset signal
Interrupt flag
Interrupt enable bit
Interrupt level
Vector number
• • • • •
Interrupt flag
Interrupt enable bit
Interrupt level
Vector number
Figure 6.1.1: Interrupt system
Interrupt
request
Interrupt
request
Peripheral module
• •
Peripheral module
• •
Interrupt flag
Interrupt enable
Interrupt flag
Interrupt enable
• • • • • • •
Interrupt flag
Interrupt enable
Interrupt flag
Interrupt enable
Interrupt factor 1
Interrupt factor n
Interrupt factor 1
Interrupt factor n
S1C17001 TECHNICAL MANUAL EPSON
29
Page 39
6 INITERRUPT CONTROLLER
6.2 Vector Table
The vector table contains the vectors (processing routine start addresses) for interrupt processing routines. When
an interrupt occurs, the S1C17 core reads the vector corresponding to the interrupt and executes that processing
routine. The S1C17001 vector table starts from address 0x8000. The vector table base address can be read from the
TTBR register (0xffff80).
Table 6.2.1 shows the S1C17001 vector table.
–(0xfffc00)Debug interruptbrk command etc.3
2 (0x02)0x8008NMIWatchdog timer overflow
3 (0x03)0x800creserved––
4 (0x04)0x8010P0 port interruptP00 to P07 port input High
5 (0x05)0x8014P1 port interruptP10 to P17 port input
6 (0x06)0x8018Stopwatch timer interrupt• Timer 100 Hz signal
7 (0x07)0x801cClock timer interrupt• Timer 32 Hz signal
8 (0x08)0x80208-bit OSC1 timer interruptCompare match
9 (0x09)0x8024
10 (0x0a)0x8028
11 (0x0b)0x802cPWM & capture timer interrupt• Compare A
∗ ITEN: ITC Enable Bit in the ITC Control (ITC_CTL) Register (D0/0x4304)
If ITEN is 0, maskable interrupts will not occur, regardless of the other register settings.
6.3.2 Interrupt Request from Peripheral Module and Interrupt Flag
If an interrupt factor for a permitted interrupt occurs in a peripheral module, that module sends an interrupt request
signal to the ITC. This interrupt request signal causes the corresponding interrupt flag inside the ITC to be set to 1.
The interrupt flag is maintained at 1 until it is reset to 0, indicating that an interrupt request was received from the
peripheral module. The interrupt flag status can be read from the ITC_IFLG register (0x4300).
Table 6.3.2.1 shows the correspondence between interrupt factors and interrupt flags.
Table 6.3.2.1: Hardware interrupt factors and interrupt flags
Vector No.
4P0 port interrupt: P00 to P07 port inputEIFT0 (D0/ITC_IFLG register)
5P1 port interrupt: P10 to P17 port inputEIFT1 (D1/ITC_IFLG register)
C interrupt: Transmit buffer empty/Receive buffer fullIIFT7 (D15/ITC_IFLG register)
Hardware interrupt requestInterrupt flag
IIFT5 (D13/ITC_IFLG register)
The ITC generates interrupts to the S1C17 core using the interrupt flags.
If an interrupt flag is set to 1 with the interrupt permitted (refer to next section for details), the ITC sends the interrupt request, interrupt level, and vector number signals to the S1C17 core.
An interrupt flag set to 1 is reset by writing 1. The interrupt flag should be reset to 0 during the interrupt processing
routine. If the interrupt flag is not reset by the interrupt processing routine, the same interrupt will recur after the
interrupt processing routine has ended. (The interrupt is prohibited during interrupt processing and returned to the
permitted state on execution of the reti command after interrupt processing.)
Note however that the interrupt flags (EIFT0 to EIFT7) for interrupts set in the level trigger (refer to Section 6.3.5)
are not reset by writing 1. These interrupt flags are reset when the interrupt source sets the interrupt signal to inactive.
Refer to the interrupt source module section for detailed information on the conditions under which interrupt factors arise and individual module interrupt settings are made.
S1C17001 TECHNICAL MANUAL EPSON
31
Page 41
6 INITERRUPT CONTROLLER
6.3.3 Interrupt Permission/Prohibition
Sending an interrupt request to the S1C17 core requires first permitting the individual interrupts using the interrupt
enable bit inside the ITC_EN register (0x4302) corresponding to the interrupt flag. Setting the interrupt enable bit
to 1 permits interrupts, while setting it to 0 (default) prohibits interrupts. The interrupt enable bit does not affect the
interrupt flag. Interrupt flags for interrupt requests generated by a peripheral module will be set regardless of the
interrupt enable bit setting.
Table 6.3.3.1 shows the correspondence between interrupt enable bits and interrupt flags.
C interruptIIFT7 (D15/ITC_IFLG register)IIEN7 (D15/ITC_EN register)
Hardware interruptInterrupt flagInterrupt enable bit
Note: • To prevent generating unnecessary interrupts, always set the interrupt flags before
permitting interrupts by writing 1 to the interrupt enable bit.
• To generate an actual interrupt, the IE bit in the S1C17 core Processor Status Register (PSR)
must be set to 1, in addition to the interrupt enable bit. The S1C17 core will not accept
maskable interrupt requests if the IE bit is set to 0. In this case, interrupt requests from the
ITC will be retained and accepted after the IE bit is set to 1.
32
EPSON S1C17001 TECHNICAL MANUAL
Page 42
6 INITERRUPT CONTROLLER
6.3.4 Processing for Multiple Interrupts
The ITC ITC_ELVx and ITC_ILVx registers (0x4306 to 0x4314) set the interrupt levels (0 to 7) for the various interrupt factors.
The interrupt level can range from 0 to 7.
The interrupt level set is issued to the S1C17 core at the same time as an interrupt request from the ITC. This interrupt level is used in the S1C17 core to prohibit subsequent interrupts with the same or lower levels (refer to Section
6.3.6).
Initial resets reset all interrupt levels to 0. The S1C17 core rejects interrupt requests if the interrupt level is 0.
C interruptIILV7[2:0] (D[10:8]/ITC_ILV3 register)0x4314
The ITC uses the interrupt level when multiple interrupt factors occur simultaneously.
If multiple interrupts occur at the same time permitted by the interrupt enable bit, the ITC sends the interrupt request with the highest level set by the ITC_ELVx and ITC_ILVx registers to the S1C17 core.
If multiple interrupt factors with the same interrupt level occur simultaneously, the interrupt with the lowest vector
number is processed first. The other interrupts are held until all have been accepted by the S1C17 core in descending order of priority.
If an interrupt factor of higher priority occurs while the ITC outputs an interrupt request signal to the S1C17 core
(before acceptance by the S1C17 core), the ITC alters the vector number and interrupt level signal to the setting details of the most recent interrupt. The immediately preceding interrupt is held.
S1C17001 TECHNICAL MANUAL EPSON
33
Page 43
6 INITERRUPT CONTROLLER
6.3.5 Interrupt Trigger Modes
The ITC includes two trigger modes – pulse trigger mode and level trigger mode – which enable acceptance of interrupt requests setting the EIFT flag as pulse or level signals.
Trigger mode can be selected using the EITGx bits within the ITC_ELVx register (0x4306 to 0x4308). Setting the
EITGx bits to 1 selects the level trigger mode; setting them to 0 (default) selects pulse trigger mode.
Note: All EITGx bits should be set to 1 (level trigger mode) for the S1C17001.
The module setting the IIFT flag outputs a pulse signal only as the interrupt request to the ITC. No trigger mode
selector bit is provided.
Pulse trigger mode
In pulse trigger mode, the ITC samples the interrupt signal using the system clock rising edge. If a pulse High
period is detected, the ITC sets the interrupt flag (IIFTx) to 1 and stops sampling that interrupt signal. The ITC
resumes sampling of the interrupt signal after the application program resets the interrupt flag (IIFTx) to 0 (via
interrupt processing routine).
pclk
Interrupt signal from
interrupt source
Interrupt flag
within ITC
Figure 6.3.5.1: Pulse trigger mode
Reset when software writes 1 to interrupt flag
Note: The S1C17001 interrupts listed below are in pulse trigger mode. If an interrupt occurs, reset
the interrupt flag IIFTx (to 1) within the interrupt processing routine.
• 8-bit timer interrupt
• 16-bit timer Ch.0 interrupt
• 16-bit timer Ch.1 interrupt
• 16-bit timer Ch.2 interrupt
• UART interrupt
• Remote controller interrupt
• SPI interrupt
• I
2
C interrupt
34
EPSON S1C17001 TECHNICAL MANUAL
Page 44
6 INITERRUPT CONTROLLER
Level trigger mode
In level trigger mode, the ITC samples the interrupt signal continuously using the system clock rising edge. The interrupt flag (EIFTx) is set to 1 if High level is detected and is reset to 0 if Low level is subsequently detected. Since
interrupt flags (EIFTx) cannot be reset by writing 1 in this mode, the interrupt signal is held at High until the interrupt source module is accepted by the S1C17 core, and the interrupt signal must subsequently be cleared.
pclk
Interrupt signal from
interrupt source
Interrupt flag within ITC
Interrupt signal set to inactive by interrupt source
Figure 6.3.5.2: Level trigger mode
Note: The S1C17001 interrupts listed below are in level trigger mode. The interrupt flag within pe-
ripheral modules must be reset (to 1) within the interrupt processing routine rather than EIFTx
• P0 port interrupt
• P1 port interrupt
• Stopwatch timer interrupt
• Clock timer interrupt
• 8-bit OSC1 timer interrupt
• PWM & capture timer interrupt
For more information on interrupt flags for resetting, refer to the peripheral module descrip-
tion.
S1C17001 TECHNICAL MANUAL EPSON
35
Page 45
6 INITERRUPT CONTROLLER
6.3.6 S1C17 Core Interrupt Processing
Maskable interrupts for the S1C17 core occur when all of the following conditions are met:
• ITEN (D0/ITC_CTL register) has been set to 1.
∗ ITEN: ITC Enable Bit in the ITC Control (ITC_CTL) Register (D0/0x4304)
• The corresponding interrupt enable bit has been set to 1 for the interrupt factor.
• The PSR (S1C17 core internal processor status register) IE (interrupt enable) bit has been set to 1.
• The interrupt factor has a higher interrupt level set than that set for the PSR IL (interrupt level).
• No other interrupt factors having higher procedence (e.g., NMI) are present.
When an interrupt factor occurs, the corresponding interrupt flag is set to 1. This state is maintained until reset by
the program or hardware (for interrupts set in level trigger mode). The interrupt factor is not cleared even if the
conditions listed above remain unmet when the interrupt factor occurs. An interrupt occurs when the above conditions are met.
If multiple maskable interrupt factors occur simultaneously, the interrupt factor with the highest level becomes the
subject of the interrupt request to the S1C17 core. Interrupts with lower levels are held until the above conditions
are subsequently met.
The S1C17 core samples interrupt requests for each cycle. On accepting an interrupt request, the S1C17 core
switches to interrupt processing when execution of the current command is complete.
Interrupt processing involves the following steps:
(1) The PSR and current program counter (PC) value is moved to the stack.
(2) The PSR IE bit is reset to 0 (preventing subsequent maskable interrupts).
(3) The PSR IL is set to the received interrupt level. (The NMI does not affect interrupt levels.)
(4) The vector for the interrupt factor occurring is loaded to the PC to execute the interrupt processing routine.
When an interrupt is received, (2) prevents subsequent maskable interrupts. Setting the IE bit to 1 within the interrupt processing routine allows handling of multiple interrupts. In this case, IL is changed by (3), and only interrupts
with higher levels than those already being processed will be accepted.
Ending interrupt processing routines using a reti command returns the PSR to the state before the interrupt. The
program resumes processing following the command being executed at the time the interrupt occurred via the next
branch.
36
EPSON S1C17001 TECHNICAL MANUAL
Page 46
6 INITERRUPT CONTROLLER
6.4 NMI
The S1C17001 can generate NMIs (non-maskable interrupts) using the watchdog timer. The vector number for
NMIs is 2, and the vector address is set in the vector table initial address + 8 bytes. These interrupts take precedence over other interrupt factors and are accepted unconditionally by the S1C17 core.
For detailed information on generating NMIs, refer to “17 Watchdog Timer (WDT).”
S1C17001 TECHNICAL MANUAL EPSON
37
Page 47
6 INITERRUPT CONTROLLER
6.5 Software Interrupts
Interrupts can be generated via software with S1C17 core int imm5 or intl imm5 and imm3 commands. The vector
table vector number (0 to 31) is specified by the operand immediate imm5. With the intl command, imm3 can be
used to specify an interrupt level (0 to 7) for the PSR IL fields.
Details of the processor interrupt processing are the same as for when an interrupt generated by hardware occurs.
38
EPSON S1C17001 TECHNICAL MANUAL
Page 48
6 INITERRUPT CONTROLLER
6.6 HALT and SLEEP Mode Cancellation by Interrupt Factors
HALT and SLEEP modes are canceled by interrupt factors, and the CPU starts up.
The interrupt factors capable of starting the CPU and specific program execution details after CPU startup (whether
to branch into an interrupt processing routine) depend on the clock states in HALT and SLEEP modes.
For more information, refer to “B.1 Clock Control Power Saving” in Appendix B.
These are interrupt flags indicating the interrupt factor occurrence status.
1(R): Interrupt factor present
0(R): No interrupt factor (default)
1(W): Reset flag
0(W): Disabled
The interrupt flags are reset to 1 if an interrupt factor occurs in the peripheral modules.
An interrupt is generated to the S1C17 core provided the following conditions are met:
1. The corresponding interrupt enable bit is set to 1.
2. No other interrupt having requests higher priority levels have occurred.
3. The PSR IE bit was set to 1 (interrupt permitted).
4. The corresponding interrupt level setting bit has been set to a higher level than the S1C17 core interrupt level (IL).
2
C interrupt flag1 Cause of
interrupt
occurred
interrupt
occurred
0 Cause of
interrupt not
occurred
0 Cause of
interrupt not
occurred
0 R/W Reset by writing 1.
0 R/W Reset by writing 1 in
pulse trigger mode.
Cannot be reset by
software in level trigger mode.
The interrupt flags are set to 1 when an interrupt factor occurs regardless of the interrupt enable bit or
interrupt level setting bit states.
The interrupt flags must be reset and the PSR must be reset (by setting the IE bit to 1 or with the reti
command) to accept the next interrupt after interrupt occurrence.
An interrupt factor flag set to 1 is reset by writing 1.
Table 6.7.2: Hardware interrupt factors and interrupt flags
These are interrupt flags indicating the interrupt factor occurrence status.
1(R): Interrupt factor present
0(R): No interrupt factor (default)
1(W): Disabled
0(W): Disabled
Refer to the description for IIFT[7:0].
Note that these interrupts must be set to level trigger mode in the ITC_ELVx registers (0x4306 to
0x430c). To reset the interrupt flags, rather than writing 1 to the bit, set the interrupt flag to 1 within the
peripheral module.
Table 6.7.3: Hardware interrupt factors and interrupt flags
Interrupt flagHardware interrupt factor
EIFT0 (D0)P0 port interrupt: P00 to P07 port input
EIFT1 (D1)P1 port interrupt: P10 to P17 port input
EIFT2 (D2)Stopwatch timer interrupt: 100 Hz/10 Hz/1 Hz signal
EIFT3 (D3)Clock timer interrupt: 32 Hz/8 Hz/2 Hz/1 Hz signal
EIFT4 (D4)8-bit OSC1 timer interrupt: Compare match
EIFT7 (D7)PWM & capture timer interrupt: Compare A/Compare B match
Note: The interrupt flags are not reset even if maskable interrupt requests are accepted by the
S1C17 core and branched to interrupt processing routines. Note that returning from an interrupt processing routine using the reti command without resetting the interrupt flags using
the program will generate the same interrupt. Interrupt flags set to level trigger must be reset
by the control register within the peripheral module.
42
EPSON S1C17001 TECHNICAL MANUAL
Page 52
6 INITERRUPT CONTROLLER
0x4302: Interrupt Enable Register (ITC_EN)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
These bits permit or prohibit interrupt events.
1 (R/W): Interrupt permitted
0 (R/W): Interrupt prohibited (default)
Setting the interrupt enable bit to 1 permits interrupts. Setting it to 0 prohibits interrupts.
Even if interrupt prohibition has been set, the corresponding interrupt can still be used to cancel Stand-
by mode.
Table 6.7.4: Hardware interrupt factors and interrupt enable bits
Interrupt enable bitHardware interrupt factor
EIEN0 (D0)P0 port interrupt: P00 to P07 port input
EIEN1 (D1)P1 port interrupt: P10 to P17 port input
EIEN2 (D2)Stopwatch timer interrupt: 100 Hz/10 Hz/1 Hz signal
EIEN3 (D3)Clock timer interrupt: 32 Hz/8 Hz/2 Hz/1 Hz signal
EIEN4 (D4)8-bit OSC1 timer interrupt: Compare match
EIEN7 (D7)PWM & capture timer interrupt: Compare A/Compare B match
IIEN0 (D8)8-bit timer interrupt: Timer underflow
IIEN1 (D9)16-bit timer Ch.0 interrupt: Timer underflow
IIEN2 (D10)16-bit timer Ch.1 interrupt: Timer underflow
IIEN3 (D11)16-bit timer Ch.2 interrupt: Timer underflow
IIEN4 (D12)UART interrupt: Transmit buffer empty/Receive buffer full/Receive error
IIEN5 (D13)Remote controller interrupt: Data length counter underflow/Input rise-up/Input drop-
IIEN6 (D14)SPI interrupt: Transmit buffer empty/Receive buffer full
IIEN7 (D15)I
2
C interrupt enable1 Enable0 Disable0 R/W
able
off
2
C interrupt: Transmit buffer empty/Receive buffer full
0 R/W
S1C17001 TECHNICAL MANUAL EPSON
43
Page 53
6 INITERRUPT CONTROLLER
0x4304: ITC Control Register (ITC_CTL)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
0x4304
ITC Control
Register
(ITC_CTL)
D[15:1] Reserved
D0 ITEN: ITC Enable Bit
Permits interrupt control using the ITC.
1 (R/W): Permitted
0 (R/W): Prohibited (default)
D12 EITG1: P1 Port Interrupt Trigger Mode Select Bit
Selects P1 port interrupt trigger mode. This should be set to 1 for the S1C17001.
1 (R/W): Level trigger mode
0 (R/W): Pulse trigger mode (default)
In pulse trigger mode, the ITC samples interrupt signals using system clock rising edges. When the
In level trigger mode, the ITC samples interrupt signals using system clock rising edges. When High
0x4306
D15–13 –reserved––– 0 when being read.
(16 bits)
D12 EITG1P1 interrupt trigger mode1 Level0 Pulse0 R/W Be sure to set to 1.
D11 –reserved––– 0 when being read.
D10–8 EILV1[2:0] P1 interrupt level0 to 70x0 R/W
D7–5 –reserved––– 0 when being read.
D4 EITG0P0 interrupt trigger mode1 Level0 Pulse0 R/W Be sure to set to 1.
D3 –reserved––– 0 when being read.
D2–0 EILV0[2:0] P0 interrupt level0 to 70x0 R/W
pulse High period is detected, the ITC sets the interrupt flag (EIFTx) to 1 and stops sampling that interrupt signal. The ITC resumes interrupt signal sampling after the application program (interrupt processing routine) resets the interrupt flag (EIFTx) to 0.
level is detected, the interrupt flag (EIFTx) is set to 1 and is subsequently reset to 0 when Low level is
detected. Interrupt flags (EIFTx) cannot be reset by writing 1 in this mode. The interrupt signal must be
maintained at High until the interrupt source module is accepted by the S1C17 core, and the interrupt
signal must then be cleared.
D11 Reserved
D[10:8] EILV1[2:0]: P1 Port Interrupt Level Bits
Set the P1 port interrupt level (0 to 7). (Default: 0)
The S1C17 core does not accept interrupts with levels set lower than the PSR IL value.
The ITC uses the interrupt level when multiple interrupt factors occur simultaneously.
If multiple interrupts occur at the same time permitted by the interrupt enable bit, the ITC sends the in-
terrupt request with the highest level set by the ITC_ELVx and ITC_ILVx registers (0x4306 to 0x4314)
to the S1C17 core.
If multiple interrupt factors with the same interrupt level occur simultaneously, the interrupt with the
lowest vector number is processed first. The other interrupts are held until all have been accepted by the
S1C17 core in descending order of priority.
If an interrupt factor of higher priority occurs while the ITC outputs an interrupt request signal to the
S1C17 core (before acceptance by the S1C17 core), the ITC alters the vector number and interrupt level
signal to the setting details of the most recent interrupt. The immediately preceding interrupt is held.
D[7:5] Reserved
D4 EITG0: P0 Port Interrupt Trigger Mode Select Bit
Selects P0 port interrupt trigger mode. This should be set to 1 for the S1C17001.
1 (R/W): Level trigger mode
0 (R/W): Pulse trigger mode (default)
Refer to the EITG1 (D12) description.
D3 Reserved
D[2:0] EILV0[2:0]: P0 Port Interrupt Level Bits
Set the P0 port interrupt level (0 to 7). (Default: 0)
Refer to the EILV1[2:0] (D[10:8]) description.
D12 EITG3: Clock Timer Interrupt Trigger Mode Select Bit
Selects clock timer interrupt trigger mode. This should be set to 1 for the S1C17001.
1 (R/W): Level trigger mode
0 (R/W): Pulse trigger mode (default)
Refer to the ITC_ELV0 register (0x4306) EITG1 (D12) description.
Set the clock timer interrupt level (0 to 7). (Default: 0)
Refer to the ITC_ELV0 register (0x4306) EILV1[2:0] (D[10:8]) description.
D[7:5] Reserved
0x4308
D15–13 –reserved––– 0 when being read.
(16 bits)
D12 EITG3CT interrupt trigger mode1 Level0 Pulse0 R/W Be sure to set to 1.
D11 –reserved––– 0 when being read.
D10–8 EILV3[2:0] CT interrupt level0 to 70x0 R/W
D7–5 –reserved––– 0 when being read.
D4 EITG2SWT interrupt trigger mode1 Level0 Pulse0 R/W Be sure to set to 1.
D3 –reserved––– 0 when being read.
D2–0 EILV2[2:0] SWT interrupt level0 to 70x0 R/W
D4 EITG2: Stopwatch Timer Interrupt Trigger Mode Select Bit
Selects stopwatch timer interrupt trigger mode. This should be set to 1 for the S1C17001.
1 (R/W): Level trigger mode
0 (R/W): Pulse trigger mode (default)
Refer to the ITC_ELV0 register (0x4306) EITG1 (D12) description.
D4 EITG4: 8-bit OSC1 Timer Interrupt Trigger Mode Select Bit
Selects 8-bit OSC1 timer interrupt trigger mode. This should be set to 1 for the S1C17001.
1 (R/W): Level trigger mode
0 (R/W): Pulse trigger mode (default)
Refer to the ITC_ELV0 register (0x4306) EITG1 (D12) description.
Selects PWM & capture timer interrupt trigger mode. This should be set to 1 for the S1C17001.
1 (R/W): Level trigger mode
0 (R/W): Pulse trigger mode (default)
Refer to the ITC_ELV0 register (0x4306) EITG1 (D12) description.
Set the 16-bit timer Ch.0 interrupt level (0 to 7). (Default: 0)
The S1C17 core does not accept interrupts with levels set lower than the PSR IL value.
The ITC uses the interrupt level when multiple interrupt factors occur simultaneously.
If multiple interrupts occur at the same time permi tted by the interrupt enable bit, the ITC sends the in-
If multiple interrupt factors with the same interrupt level occur simultaneously, the interrupt with the
If an interrupt factor of higher priority occurs while the ITC outputs an interrupt request signal to the
D[7:3] Reserved
0x430e
D15–11 –reserved––– 0 when being read.
(16 bits)
D10–8 IILV1[2:0] T16 Ch.0 interrupt level0 to 70x0 R/W
D7–3 –reserved––– 0 when being read.
D2–0 IILV0[2:0] T8 interrupt level0 to 70x0 R/W
terrupt request with the highest level set by the ITC_ELVx and ITC_ILVx registers (0x4306 to 0x4314)
to the S1C17 core.
lowest vector number is processed first. The other interrupts are held until all have been accepted by the
S1C17 core in descending order of priority.
S1C17 core (before acceptance by the S1C17 core), the ITC alters the vector number and interrupt level
signal to the setting details of the most recent interrupt. The immediately preceding interrupt is held.
Set the I
Refer to the ITC_ILV0 register (0x430e) IILV1[2:0] (D[10:8]) description.
D[7:3] Reserved
D[2:0] IILV6[2:0]: SPI Interrupt Level Bits
Set the SPI interrupt level (0 to 7). (Default: 0)
Refer to the ITC_ILV0 register (0x430e) IILV1[2:0] (D[10:8]) description.
0x4314
D15–11 –reserved––– 0 when being read.
(16 bits)
D10–8 IILV7[2:0] I
D7–3 –reserved––– 0 when being read.
D2–0 IILV6[2:0] SPI interrupt level0 to 70x0 R/W
2
C Interrupt Level Bits
2
C interrupt level (0 to 7). (Default: 0)
2
C interrupt level0 to 70x0 R/W
52
EPSON S1C17001 TECHNICAL MANUAL
Page 62
6 INITERRUPT CONTROLLER
6.8 Precautions
• To prevent the recurrence of interrupts due to the same interrupt factor, always reset the interrupt flag before permitting interrupts, resetting PSR, or executing the reti command.
• The S1C17001 interrupts listed below are in level trigger mode.
- P0 port interrupt
- P1 port interrupt
- Stopwatch timer interrupt
- Clock timer interrupt
- 8-bit OSC1 timer interrupt
- PWM & capture timer interrupt
Make sure all EITGx bits within the ITC_ELVx registers (0x4306 to 0x430c) have been set to 1 (level trigger
mode).
The interrupt flag within peripheral modules must be reset (to 1) within the interrupt processing routine rather
than EIFTx. For more information on interrupt flags for resetting, refer to the peripheral module description.
S1C17001 TECHNICAL MANUAL EPSON
53
Page 63
6 INITERRUPT CONTROLLER
This page intentionally left blank.
54
EPSON S1C17001 TECHNICAL MANUAL
Page 64
7 OSCILLATOR CIRCUIT (OSC)
7 Oscillator Circuit (OSC)
7.1 OSC Module Configuration
The S1C17001 incorporates two internal oscillator circuits (OSC3 and OSC1). The OSC3 oscillator circuit generates the main clock (max. 8.2 MHz) for high-speed operation of the S1C17 core and peripheral circuits. The OSC1
oscillator circuit generates a sub-clock (typ. 32.768 kHz) for timer and low-power operations.
The OSC3 clock is selected as the system clock after initial resetting.
Oscillator circuit on/off switching and system clock selection (between OSC3 and OSC1) is controlled by software.
External clock output is also possible.
Figure 7.1.1 illustrates the clock system and OSC module configuration.
To reduce power consumption, control the clock in conjunction with processing and use standby mode. For more
information on reducing power consumption, refer to “Appendix B: Power Saving.”
S1C17001 TECHNICAL MANUAL EPSON
55
Page 65
7 OSCILLATOR CIRCUIT (OSC)
7.2 OSC3 Oscillator Circuit
The OSC3 oscillator circuit generates the main clock (max. 8.2 MHz) for high-speed operation of the S1C17 core
and peripheral circuits. The oscillator circuit can be either crystal- or ceramic-based. It also supports external clock
input.
Figure 7.2.1 illustrates the OSC3 oscillator circuit configuration.
When used as a crystal or ceramic oscillator circuit, a crystal oscillator (X’tal3) or ceramic oscillator (Ceramic)
and feedback resistor (R
should also be connected between the OSC3/OSC4 pins and V
the OSC4 pin and C
f) should be connected between the OSC3 and OSC4 pins. Two capacitors (CG3 and CD3)
SS. A drain resistor (Rd) should be connected between
D3, if required.
When used with external clock input, the OSC4 pin should be left free, and a clock with a duty ratio of 50% at
LV
DD level should be input to the OSC3 pin.
OSC3 oscillation on/off
The OSC3 oscillator circuit stops oscillating if OSC3EN (D0/OSC_CTL register) is set to 0 and starts oscillat-
ing if set to 1. The OSC3 oscillator circuit stops oscillating even in SLEEP mode.
∗ OSC3EN: OSC3 Enable Bit in the Oscillation Control (OSC_CTL) Register (D0/0x5061)
After initial resetting, OSC3EN is set to 1 and the OSC3 oscillator circuit is on. Since the OSC3 clock is used
as the system clock, the S1C17 core begins operating using the OSC3 clock.
56
EPSON S1C17001 TECHNICAL MANUAL
Page 66
7 OSCILLATOR CIRCUIT (OSC)
Stabilization wait time at start of OSC3 oscillation
The OSC3 oscillator circuit incorporates an oscillation stabilization wait timer to prevent malfunctions due
to unstable clock operations at the start of OSC3 oscillation—for example, when power is first turned on, on
awaking from SLEEP, or when the OSC3 oscillation circuit is turned on via software. The OSC3 clock is not
fed to the system until the time set for this timer has elapsed.
Four different oscillation stabilization wait times can be selected using the OSC3WT[1:0] (D[5:4]/OSC_CTL
register)
∗ OSC3WT[1:0]: OSC3 Wait Cycle Select Bits in the Oscillation Control (OSC_CTL) Register (D[5:4]/0x5061)
Table 7.2.2: OSC3 oscillation stabilization wait time settings
OSC3WT[1:0]Oscillation stabilization
wait time
0x3128 cycles
0x2256 cycles
0x1512 cycles
0x01,024 cycles
(Default: 0x0)
This is set to 1,024 cycles (OSC3 clock) after initial resetting. The CPU does not begin operating immediately after
resetting until this time has elapsed.
Note: The OSC3 oscillation start time depends on the oscillator and externally connected compo-
nents. The time should be set with an adequate oscillation stabilization wait time. Refer to the
typical oscillation start times specified in “24 Electrical Characteristics.”
S1C17001 TECHNICAL MANUAL EPSON
57
Page 67
7 OSCILLATOR CIRCUIT (OSC)
7.3 OSC1 Oscillator Circuit
The OSC1 oscillator circuit generates a (typ.) 32.768 kHz sub-clock.
The OSC1 clock is generally used as the timer operation clock (for the clock timer, stopwatch timer, watchdog timer, and 8-bit OSC1 timer). It reduces power consumption and can be used as the system clock instead of the OSC3
clock when no high-speed processing is required.
The oscillator circuit is crystal-based. The oscillator circuit also allows use of an external clock input.
Figure 7.3.1 illustrates the OSC1 oscillator circuit configuration.
CG1
CD1
VSS
X'tal1
Rd
OSC1
Rf
OSC2
(1) Crystal oscillator circuit
LVDD
OSC1
Oscillator circuit
control signal
SLEEP control
OSC1
OSC2
V
SS
(3) When not used
Figure 7.3.1: OSC1 oscillator circuit
V
SS
OSC1
External
clock
N.C.
OSC2
Low level
Oscillator circuit
control signal
SLEEP control
OSC1
Oscillator circuit
control signal
SLEEP control
(2) External clock input
When this is used as a crystal oscillator circuit, connect a crystal oscillator X’tal1 (typ. 32.768 kHz) and feedback
resistor (R
pins and V
f) between the OSC1 and OSC2 pins. Connect two capacitors (CG1 and CD1) between the OSC1/OSC2
SS. A drain resistor (Rd) should be connected between the OSC2 pin and CD1, if required.
When used with external clock (max. 100 kHz) input, the OSC2 pin should be left free, and a clock with a duty ratio of 50% at LV
If the OSC1 oscillator circuit is not used, connect the OSC1 pin to V
DD level should be input to the OSC1 pin.
SS while leaving the OSC2 pin open.
OSC1 oscillation on/off
The OSC1 oscillator circuit stops oscillating if OSC1EN (D1/OSC_CTL register) is set to 0 and starts oscillat-
ing if set to 1. The OSC1 oscillator circuit stops oscillating even in SLEEP mode.
∗ OSC1EN: OSC1 Enable Bit in the Oscillation Control (OSC_CTL) Register (D1/0x5061)
Stabilization wait time at start of OSC1 oscillation
The OSC1 oscillator circuit incorporates an oscillation stabilization wait timer to prevent malfunctions due
to unstable clock operations at the start of OSC1 oscillation—for example, when power is first turned on, on
awaking from SLEEP, or when the OSC1 oscillation circuit is turned on via software. The OSC1 clock does not
feed the system for a period of 256 cycles after the start of oscillation.
58
EPSON S1C17001 TECHNICAL MANUAL
Page 68
7 OSCILLATOR CIRCUIT (OSC)
7.4 System Clock Switching
The software can be used to select the OSC3 or OSC1 clocks as the system clock. If possible, you can reduce power consumption by stopping OSC3 oscillation after switching the system clock to OSC1.
The procedure is given below.
OSC3 to OSC1
1. If OSC1 oscillation is stopped, start oscillation by setting OSC1EN (D1/OSC_CTL register) to 1.
∗ OSC1EN: OSC1 Enable Bit in the Oscillation Control (OSC_CTL) Register (D1/0x5061)
2. Set CLKSRC (D0/OSC_SRC register) to 1 and switch the system clock from OSC3 to OSC1.
∗ CLKSRC: System Clock Source Select Bit in the Clock Source Select (OSC_SRC) Register (D0/0x5060)
3. If operation is not required for peripheral modules using OSC3 as an oscillation source, set OSC3EN (D0/
OSC_CTL register) to 0 to stop OSC3 oscillation.
∗ OSC3EN: OSC3 Enable Bit in the Oscillation Control (OSC_CTL) Register (D0/0x5061)
Note: • Switching the system clock from OSC3 to OSC1 immediately after starting OSC1 oscillation
will stop the system clock until the OSC1 clock starts up (for the OSC1 clock 256-cycle period).
• OSC3 oscillation cannot be stopped before switching the system clock to OSC1.
OSC1 to OSC3
1. Set the OSC3WT[1:0] (D[5:4]/OSC_CTL register) to an oscillation stabilization wait time (see Table 7.2.2)
at least as long as OSC3 oscillation start time. (Not necessary if already set.)
∗ OSC3WT[1:0]: OSC3 Wait Cycle Select Bits in the Oscillation Control (OSC_CTL) Register (D[5:4]/0x5061)
2. If the OSC3 oscillation is stopped, set OSC3EN (D0/OSC_CTL register) to 1 to start oscillation. After starting OSC3 oscillation, the OSC3 clock is not fed until the time set in OSC3WT[1:0] (D[5:4]/OSC_CTL register) has elapsed.
3. Set CLKSRC (D0/OSC_SRC register) to 0 to switch the system clock from OSC1 to OSC3.
4. If operation is not required for peripheral modules using OSC1 as an oscillation source, set OSC1EN (D1/
OSC_CTL register) to 0 to stop OSC1 oscillation.
Note: • Steps 1 and 2 are not required if the OSC3 oscillation circuit is already operating.
• The OSC3 oscillation start time depends on the oscillator and externally connected components. The time should be set with an adequate oscillation stabilization wait time. Refer to
the typical oscillation start times specified in “24 Electrical Characteristics.”
• OSC1 oscillation cannot be stopped before switching the system clock to OSC3.
S1C17001 TECHNICAL MANUAL EPSON
59
Page 69
7 OSCILLATOR CIRCUIT (OSC)
7.5 8-bit OSC1 Timer Clock Control
The OSC module consists of a division circuit for generating the 8-bit OSC1 timer operation clock and a device
for controlling the feed. The 8-bit OSC1 timer is a programmable timer that operates only using the OSC1 division
clock. For detailed information, refer to “14 8-bit OSC1 Timer (T8OSC1).”
OSC1 clock
Division circuit
(1/1 to 1/32)
Division ratio selectionOn/off control
Figure 7.5.1: 8-bit OSC1 timer clock control circuit
Gate
8-bit OSC1 timer
Clock division ratio selection
Select the OSC1 clock division ratio using T8O1CK[2:0] (D[3:1]/OSC_T8OSC1 register)
∗T8O1CK[2:0]: T8OSC1 Clock Division Ratio Select Bits in the T8OSC1 Clock Control (OSC_T8OSC1)
Register (D[3:1]/0x5065)
Table 7.5.1: T8OSC1 clock division ratio selection
The clock feed to the 8-bit OSC1 timer is controlled using T8O1CE (D0/OSC_T8OSC1 register).
The T8O1CE default setting is 0, which stops the clock feed. Setting T8O1CE to 1 sends the clock generated as
above to the 8-bit OSC1 timer. Stop the clock feed to reduce power consumption if 8-bit OSC1 timer operation
is not required.
∗ T8O1CE: T8OSC1 Clock Enable Bit in the T8OSC1 Clock Control (OSC_T8OSC1) Register (D0/0x5065)
60
EPSON S1C17001 TECHNICAL MANUAL
Page 70
7 OSCILLATOR CIRCUIT (OSC)
7.6 Clock External Output (FOUT3, FOUT1)
The OSC3 division clock (FOUT3) and OSC1 clock (FOUT1) can be output to devices outside the chip.
P30 port
OSC3 clock
OSC1 clock
Division circuit
(1/1 to 1/4)
Division ratio selection
Figure 7.6.1: Clock output circuit
FOUT3
Output circuit
On/off control P30 function selection
P13 port
FOUT1
Output circuit
On/off control
P13 function selection
FOUT3(P30)
FOUT1(P13)
FOUT3 output
FOUT3 is the OSC3 division clock.
Output pin setting
The FOUT3 output pin is combined with the P30 port. This functions as the P30 port pin by default, so the
pin function should be changed by writing 1 to P30MUX (D0/P3_PMUX register) if use is required for
FOUT3 output.
∗ P30MUX: P30 Port Function Select Bit in the P3 Port Function Select (P3_PMUX) Register (D0/0x52a3)
FOUT3 clock frequency selection
Three different clock output frequencies can be selected. Select the division ratio for the OSC3 clock using
FOUT3D[1:0] (D[3:2]/OSC_FOUT register).
∗ FOUT3D[1:0]: FOUT3 Clock Division Ratio Select Bits in the FOUT Control (OSC_FOUT) Register
Clock output control
The clock output is controlled using the FOUT3E (D1/OSC_FOUT register). Setting FOUT3E to 1 outputs
the FOUT3 clock from the FOUT3 pin. Setting it to 0 halts output.
∗FOUT3E: FOUT3 Output Enable Bit in the FOUT Control (OSC_FOUT) Register (D1/0x5064)
(D[3:2]/0x5064)
Table 7.6.1: FOUT3 clock division ratio selection
FOUT3D[1:0]Division ratio
0x3Reserved
0x2OSC3-1/4
0x1OSC3-1/2
0x0OSC3-1/1
(Default: 0x0)
FOUT3E
FOUT3 output (P30)
00
Figure 7.6.2: FOUT3 output
1
Note: Since the FOUT3 signal is asynchronized with FOUT3E writing, switching output on or off will
generate certain hazards.
S1C17001 TECHNICAL MANUAL EPSON
61
Page 71
7 OSCILLATOR CIRCUIT (OSC)
FOUT1 output
FOUT1 is the OSC1 clock.
Output pin setting
The FOUT1 output pin is combined with the P13 port. This functions as the P13 port pin by default, so the
pin function should be changed by writing 1 to P13MUX (D3/P1_PMUX register) if use is required for
FOUT1 output.
∗ P13MUX: P13 Port Function Select Bit in the P1 Port Function Select (P1_PMUX) Register (D3/0x52a1)
Clock output control
The clock output is controlled using the FOUT1E (D0/OSC_FOUT register). Setting FOUT1E to 1 outputs
the FOUT1 clock from the FOUT1 pin. Setting it to 0 halts output.
∗ FOUT1E: FOUT1 Output Enable Bit in the FOUT Control (OSC_FOUT) Register (D1/0x5064)
FOUT1E
FOUT1 output (P13)
00
Figure 7.6.3: FOUT1 output
1
Note: Since the FOUT1 signal is asynchronized with FOUT1E writing, switching output on or off will
generate certain hazards.
62
EPSON S1C17001 TECHNICAL MANUAL
Page 72
7 OSCILLATOR CIRCUIT (OSC)
7.7 RESET and NMI Input Noise Filters
Since accidental activation of RESET or NMI by noise in the S1C17 core input signal will cause unintended resetting or NMI processing, the OSC module incorporates noise filters operated by the system clock. The filters remove
noise from these signals before they reach the S1C17 core.
Separate noise filters are used for each signal. You can select to use or bypass them individually. All are active immediately after the initial resetting.
RESET input noise filter: Filters noise when RSTFE (D1/OSC_NFEN register) = 1; bypassed when RSTFE = 0
NMI input noise filter: Filters noise when NMIFE (D0/OSC_NFEN register) = 1; bypassed when NMIFE = 0
∗ RSTFE: Reset Noise Filter Enable Bit in the Noise Filter Enable (OSC_NFEN) Register (D1/0x5062)
∗ NMIFE: NMI Noise Filter Enable Bit in the Noise Filter Enable (OSC_NFEN) Register (D0/0x5062)
The noise filters operate using the system clock (OSC3 or OSC1 clock) divided to 1/8. When activated, they filter
out noise with pulses not exceeding two clock cycles.
This means the pulse width must be at least 16 cycles of the system clock to input as a valid signal.
Note: • All noise filters should normally be enabled.
• The S1C17001 does not feature external NMI input pins, but the watchdog timer NMI request signal passes through these filters.
S1C17001 TECHNICAL MANUAL EPSON
63
Page 73
7 OSCILLATOR CIRCUIT (OSC)
7.8 Control Register Details
Table 7.8.1 OSC register list
AddressRegister nameFunction
0x5060OSC_SRCClock Source Select RegisterClock source selection
0x5061OSC_CTLOscillation Control RegisterOscillation control
0x5062OSC_NFENNoise Filter Enable RegisterNoise filter on/off
0x5064OSC_FOUTFOUT Control RegisterClock external output control
0x5065OSC_T8OSC1 T8OSC1 Clock Control Register8-bit OSC1 timer clock setting
The OSC module registers are described in detail below. These are 8-bit registers.
Note: When data is written to the registers, the “Reserved” bits must always be written as 0 and not 1.
64
EPSON S1C17001 TECHNICAL MANUAL
Page 74
7 OSCILLATOR CIRCUIT (OSC)
0x5060: Clock Source Select Register (OSC_SRC)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
Clock Source
Select
Register
(OSC_SRC)
0x5060
D[7:1] Reserved
D0 CLKSRC: System Clock Source Select Bit
Selects the system clock source.
1 (R/W): OSC1
0 (R/W): OSC3 (default)
OSC3 is selected for normal (high-speed) operations. If the OSC3 clock is not required, OSC1 can be
set as the system clock and OSC3 stopped to reduce power consumption.
Note: If the system clock is switched from OSC3 to OSC1 immediately after starting OSC1 oscilla-
tion, the system clock will stop until the OSC1 clock starts up (for the OSC1 clock 256-cycle
period).
Table 7.8.2: OSC3 oscillation stabilization wait time settings
OSC3WT[1:0]Oscillation stabilization
wait time
0x3128 cycles
0x2256 cycles
0x1512 cycles
0x01,024 cycles
(Default: 0x0)
Note: The OSC3 oscillation start time depends on the oscillator and externally connected compo-
nents. The time should be set with an adequate oscillation stabilization wait time. Refer to the
typical oscillation start times specified in “24 Electrical Characteristics.”
Note: • The OSC1 oscillator circuit cannot be stopped if the OSC1 clock is being used as the sys-
tem clock.
• The OSC1 clock is not fed to the system for 256 cycles to prevent malfunctions immediately after OSC1 oscillation is started by changing the OSC1EN setting from 0 to 1.
FOUT3 clock division ratio select FOUT3D[1:0] Division ratio 0x0 R/W
0x3
0x2
0x1
0x0
reserved
OSC3-1/4
OSC3-1/2
OSC3-1/1
Table 7.8.3: FOUT3 clock division ratio selection
FOUT3D[1:0]Division ratio
0x3Reserved
0x2OSC3-1/4
0x1OSC3-1/2
0x0OSC3-1/1
(Default: 0x0)
Setting FOUT3E to 1 outputs the FOUT3 clock from the FOUT3 pin. Setting it to 0 stops the output.
The FOUT3 output pin is combined with the P30 port. This functions as the P30 port pin by default, so
the pin function should be changed by writing 1 to P30MUX (D0/P3_PMUX register) if use is required
for FOUT3 output.
∗P30MUX: P30 Port Function Select Bit in the P3 Port Function Select (P3_PMUX) Register
Setting FOUT1E to 1 outputs the FOUT1 clock from the FOUT1 pin. Setting it to 0 stops the output.
The FOUT1 output pin is combined with the P13 port. This functions as the P13 port pin by default, so
the pin function should be changed by writing 1 to P13MUX (D3/P1_PMUX register) if use is required
for FOUT1 output.
∗P13MUX: P13 Port Function Select Bit in the P1 Port Function Select (P1_PMUX) Register
(D3/0x52a1)
68
EPSON S1C17001 TECHNICAL MANUAL
Page 78
7 OSCILLATOR CIRCUIT (OSC)
0x5065: T8OSC1 Clock Control Register (OSC_T8OSC1)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
T8OSC1 Clock
Control Register
(OSC_T8OSC1
0x5065
)
D[7:4] Reserved
D[3:1] T8O1CK[2:0]: T8OSC1 Clock Division Ratio Select Bits
Select the OSC1 clock division ratio and set the 8-bit OSC1 timer operation clock.
D0 T8O1CE: T8OSC1 Clock Output Enable Bit
Permits or prohibits clock feed to the 8-bit OSC1 timer.
1 (R/W): Permitted (on)
0 (R/W): Prohibited (off) (default)
The T8O1CE default setting is 0, which stops the clock feed. Setting T8O1CE to 1 sends the clock
selected by the above bit to the 8-bit OSC1 timer. Stop the clock feed to reduce power consumption if
8-bit OSC1 timer operation is not required.
S1C17001 TECHNICAL MANUAL EPSON
69
Page 79
7 OSCILLATOR CIRCUIT (OSC)
7.9 Precautions
• The OSC3 oscillation start time depends on the oscillator and externally connected components. The time should
be set with an adequate OSC3 oscillation stabilization wait time. Refer to the typical oscillation start times specified in “24 Electrical Characteristics.”
• Switching the system clock from OSC3 to OSC1 immediately after starting OSC1 oscillation will stop the system clock until the OSC1 clock starts up (for the OSC1 clock 256-cycle period).
• The OSC3 oscillator circuit cannot be stopped if the OSC3 clock is being used as the system clock.
• The OSC1 oscillator circuit cannot be stopped if the OSC1 clock is being used as the system clock.
• Since the FOUT3/FOUT1 signal is asynchronized with FOUT3E/FOUT1E writing, switching output on or off
will generate certain hazards.
70
EPSON S1C17001 TECHNICAL MANUAL
Page 80
8 CLOCK GENERATOR (CLG)
8. Clock Generator (CLG)
8.1 Clock Generator Configuration
The clock generator controls the system clock feed to the S1C17 core and peripheral modules.
Figure 8.1.1 illustrates the clock system and CLG module configuration.
To reduce power consumption, control the clock in conjunction with processing and use standby mode. For more
information on reducing power consumption, refer to “Appendix B: Power Saving.”
S1C17001 TECHNICAL MANUAL EPSON
71
Page 81
8 CLOCK GENERATOR (CLG)
8.2 CPU Core Clock (CCLK) Control
The CLG module incorporates a clock gear to slow down the system clock to send to the S1C17 core. To reduce
power consumption, operate the S1C17 core with the slowest possible clock speed. The halt command can be executed to stop the clock feed from the CLG to the S1C17 core for power savings.
OSC3
OSC1
System clock
Gear selection
Cock gear
(1/1 to 1/8)
Figure 8.2.1: CCLK feed system
HALT
GateS1C17 core
CCLK
Clock gear settings
CCLKGR[1:0] (D[1:0]/CLG_CCLK register) is used to select the gear ratio to reduce system clock speeds.
∗
CCLKGR[1:0]: CCLK Clock Gear Ratio Select Bits in the CCLK Control (CLG_CCLK) Register (D[1:0]/0x5081
Table 8.2.1: CCLK gear ratio selection
CCLKGR[1:0]Gear ratio
0x31/8
0x21/4
0x11/2
0x01/1
(Default: 0x0)
Clock feed control
The CCLK clock feed is stopped by executing the halt command. Since this does not stop the system clock, pe-
ripheral modules will continue to operate.
HALT mode is cleared by resetting, NMI, or other interrupts. The CCLK feed resumes when HALT mode is
cleared.
Executing the slp command suspends system clock feed to the CLG, thereby halting the CCLK feed as well.
Clearing SLEEP mode with an external interrupt restarts the system clock feed and the CCLK feed.
For more information on system clock control, refer to “7. Oscillator Circuit (OSC).”
)
72
EPSON S1C17001 TECHNICAL MANUAL
Page 82
8.3 Peripheral Module Clock (PCLK) Control
The CLG module also controls the clock feed to peripheral modules.
The system clock is used unmodified for the peripheral module clock (PCLK).
Since the following peripheral modules are not operated using PCLK except for control register access,
PCLK is not required after setting the control register to start operations.
• Clock timer
• Stopwatch timer
• Watchdog timer
• 8-bit OSC1 timer
Note: Do not set PCKEN[1:0] to 0x2 or 0x1, since doing so will stop the operation of certain pe-
ripheral modules.
S1C17001 TECHNICAL MANUAL EPSON
75
Page 85
8 CLOCK GENERATOR (CLG)
0x5081: CCLK Control Register (CLG_CCLK)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
CCLK Control
Register
(CLG_CCLK
0x5081
)
D[7:2] Reserved
D[1:0] CCLKGR[1:0]: CCLK Clock Gear Ratio Select Bits
Select the gear ratio for reducing system clock speed and set the CCLK clock speed for operating the
S1C17 core. To reduce power consumption, operate the S1C17 core using the slowest possible clock
speed.
D7–2 –reserved––– 0 when being read.
(8 bits)
D1–0 CCLK-
GR[1:0]
CCLK clock gear ratio selectCCLKGR[1:0]Gear ratio0x0 R/W
0x3
0x2
0x1
0x0
1/8
1/4
1/2
1/1
Table 8.4.3: CCLK gear ratio selection
CCLKGR[1:0]Gear ratio
0x31/8
0x21/4
0x11/2
0x01/1
(Default: 0x0)
76
EPSON S1C17001 TECHNICAL MANUAL
Page 86
8 CLOCK GENERATOR (CLG)
8.5 Precautions
(1) The default settings enable PCLK feed to peripheral modules. To reduce power consumption, stop the clock
feed if the peripheral modules listed below are not used.
Peripheral modules operated using PCLK
• Prescaler (PWM & capture timer, remote controller, P port)
• UART
• 8-bit timer
• 16-bit timer Ch.0 to 2
• Interrupt controller
• SPI
2
• I
C
• P port & port MUX
• PWM & capture timer
• MISC register
• Remote controller
Since the following peripheral modules are not operated using PCLK except for control register access, PCLK
is not required after setting the control register to start operations.
• Clock timer
• Stopwatch timer
• Watchdog timer
• 8-bit OSC1 timer
(2) Do not set PCKEN[1:0] (D[1:0]/CLG_PCLK register) to 0x2 or 0x1, since doing so will stop the operation of
certain peripheral modules.
∗ PCKEN[1:0]: PCLK Enable Bits in the PCLK Control (CLG_PCLK) Register (D[1:0]/0x5080)
S1C17001 TECHNICAL MANUAL EPSON
77
Page 87
8 CLOCK GENERATOR (CLG)
This page intentionally left blank.
78
EPSON S1C17001 TECHNICAL MANUAL
Page 88
9 PRESCALER (PSC)
9. Prescaler (PSC)
9.1 Prescaler Configuration
The S1C17001 incorporates a prescaler to generate a clock for timer operations. The prescaler generates 15 different frequencies by dividing the PCLK clock fed from the clock generator into 1/1 to 1/16K. The peripheral modules
to which the clock is fed include clock selection registers enabling selection of one as a count or operation clock.
8-bit timer
16-bit timer Ch.0
16-bit timer Ch.1
16-bit timer Ch.2
PWM & capture timer
Remote controller
P port
PCLK
Debug status
signal
PSC
1/1
1/2 1/4 1/8 1/16 1/32 1/64 1/128
1/256 1/512 1/1K 1/2K 1/4K 1/8K 1/16K
Figure 9.1.1: Prescaler
The prescaler is controlled by the PRUN bit (D0/PSC_CTL register). To operate the prescaler, write 1 to PRUN.
Writing 0 to PRUN stops the prescaler. Stopping the prescaler while the timer and interface module are halted enables the current consumption to be reduced. The prescaler is stopped immediately after initial resetting.
∗ PRUN: Prescaler Run/Stop Control Bit in the Prescaler Control (PSC_CTL) Register (D0/0x4020)
UART
SPI
2
C
I
Note: PCLK must be fed from the clock generator to use the prescaler.
The prescaler features another control bit, PRUND (D1/PSC_CTL register), which specifies prescaler operations
in Debug mode. Setting PRUND to 1 also operates the prescaler in Debug mode. Setting it to 0 stops the prescaler
once the S1C17 core switches to Debug mode. Set PRUND to 1 if the timer and interface module are to be used
during debugging.
∗ PRUND: Prescaler Run/Stop Setting Bit in Debug Mode in the Prescaler Control (PSC_CTL) Register (D1/0x4020)
S1C17001 TECHNICAL MANUAL EPSON
79
Page 89
9 PRESCALER (PSC)
9.2 Control Register Details
Table 9.2.1: Prescaler register
AddressRegister nameFunction
0x4020PSC_CTLPrescaler Control RegisterPrescaler start/stop control
The prescaler register is an 8-bit register.
Note: When data is written to the registers, the “Reserved” bits must always be written as 0 and not 1.
0x4020: Prescaler Control Register (PSC_CTL)
Register name AddressBitNameFunctionSettingInit. R/WRemarks
Con-
0x4020
Prescaler
trol Register
(PSC_CTL)
D[7:2] Reserved
D1 PRUND: Prescaler Run/Stop Setting Bit for Debug Mode
Write 1 to PRUN to operate the prescaler. Write 0 to PRUN to stop the prescaler. To reduce current con-
sumption, stop the prescaler if the timer and interface module are already stopped.
80
EPSON S1C17001 TECHNICAL MANUAL
Page 90
9.3 Precautions
PCLK must be fed from the clock generator to use the prescaler.
9 PRESCALER (PSC)
S1C17001 TECHNICAL MANUAL EPSON
81
Page 91
9 PRESCALER (PSC)
This page intentionally left blank.
82
EPSON S1C17001 TECHNICAL MANUAL
Page 92
10 INPUT/OUTPUT PORT (P)
10 Input/Output Port (P)
10.1 Input/Output Port Configuration
The S1C17001 includes 28 input/output ports (P0[7:0], P1[7:0], P2[7:0], P3[3:0]) to allow software switching of
input/output direction. These share internal peripheral module input/output pins (with certain exceptions), but pins
not used for peripheral modules can be used as general purpose input/output ports.
Figure 10.1.1 illustrates the input/output port configuration.
Pull-up enable
PxPUy
Input/output direction selection
PxIOy
Peripheral module I/O control
Function selection
PxyMUX
Output data
Internal data bus
PxOUTy
Peripheral module output
Peripheral module input
Figure 10.1.1: Input/output port configuration
HVDD
Pxy
VSS
The P0 and P1 ports can generate input interrupts.
The P0[3:0] port can be used for key entry resets. (For more information, refer to “5.1.2 P0 Port Key Entry Reset.”)
Note: The PCLK clock must be fed from the clock generator to access the input/output port.
The prescaler output clock is also needed to operate the P0 port chattering filter. Switch on
the prescaler when using this function.
S1C17001 TECHNICAL MANUAL EPSON
83
Page 93
10 INPUT/OUTPUT PORT (P)
10.2 Input/Output Pin Function Selection (Port MUX)
The input/output port pins share peripheral module input/output pins (with certain exceptions). Each pin can be set
for use as an input/output port or for peripheral modules via the corresponding port function selection bits for each
port. Pins not used for peripheral modules can be used as general purpose input/output ports.
Resetting the input/output port pins (Pxx) resets them to their default functions (pin function 1 in Table 10.2.1).
Pins P06, P07, and P16 can also be used as 16-bit timer external clock input pins by setting them to input mode.
Note, however, that no port function selection bits are available, since they are simultaneously set to function as
general purpose input ports.
For information on functions other than the input/output ports, refer to the discussion of the peripheral modules indicated in parentheses. The sections below discuss port functions with the pins set as general purpose input/output
ports.
84
EPSON S1C17001 TECHNICAL MANUAL
Page 94
10 INPUT/OUTPUT PORT (P)
10.3 Data Input/Output
The input/output ports permit selection of the data input/output direction for each bit using PxIO[7:0] (Px_IO register).
∗ P0IO[7:0]: P0[7:0] Port I/O Direction Select Bits in the P0 Port I/O Direction Control (P0_IO) Register (D[7:0]/0x5202)
∗ P1IO[7:0]: P1[7:0] Port I/O Direction Select Bits in the P1 Port I/O Direction Control (P1_IO) Register (D[7:0]/0x5212)
∗ P2IO[7:0]: P2[7:0] Port I/O Direction Select Bits in the P2 Port I/O Direction Control (P2_IO) Register (D[7:0]/0x5222)
∗ P3IO[3:0]: P3[3:0] Port I/O Direction Select Bits in the P3 Port I/O Direction Control (P3_IO) Register (D[3:0]/0x5232)
The input/output direction for the port selecting the peripheral module function is controlled by the peripheral module. The PxIO[7:0] setting is ignored.
Data input
When set to input mode, PxIO[7:0] is set to 0 (default). The input/output port set to input mode switches to
high-impedance state, and functions as the input port. If pull-up is enabled by the Px_PU register, the port will
be pulled up.
In input mode, the input pin state can be read out directly from PxIN[7:0] (Px_IN register). The value read will
be 1 when the input pin is at High (HV
∗ P0IN[7:0]: P0[7:0] Port Input Data Bits in the P0 Port Input Data (P0_IN) Register (D[7:0]/0x5200)
∗ P1IN[7:0]: P1[7:0] Port Input Data Bits in the P1 Port Input Data (P1_IN) Register (D[7:0]/0x5210)
∗ P2IN[7:0]: P2[7:0] Port Input Data Bits in the P2 Port Input Data (P2_IN) Register (D[7:0]/0x5220)
∗ P3IN[3:0]: P3[3:0] Port Input Data Bits in the P3 Port Input Data (P3_IN) Register (D[3:0]/0x5230)
Data output
When set to output mode, PxIO[7:0] is set to 1. The input/output port set to output mode functions as the output
port, while the port pin outputs High (HV
Low (V
SS) level if written as 0. Note that the port will not be pulled up in output mode even if pull-up is en-
abled by the Px_PU register.
∗ P0OUT[7:0]: P0[7:0] Port Output Data Bits in the P0 Port Output Data (P0_OUT) Register (D[7:0]/0x5201)
∗ P1OUT[7:0]: P1[7:0] Port Output Data Bits in the P1 Port Output Data (P1_OUT) Register (D[7:0]/0x5211)
∗ P2OUT[7:0]: P2[7:0] Port Output Data Bits in the P2 Port Output Data (P2_OUT) Register (D[7:0]/0x5221)
∗ P3OUT[3:0]: P3[3:0] Port Output Data Bits in the P3 Port Output Data (P3_OUT) Register (D[3:0]/0x5231)
DD) level and 0 when it is at Low (VSS) level.
DD) level if PxOUT[7:0] (Px_OUT register) is written as 1 and outputs
Writing to PxOUT[7:0] is possible without affecting pin status, even in input mode.
S1C17001 TECHNICAL MANUAL EPSON
85
Page 95
10 INPUT/OUTPUT PORT (P)
10.4 Pull-up Control
The input/output port contains a pull-up resistor, which you can choose to use or not use individually for each bit
using the PxPU[7:0] (Px_PU register).
∗ P0PU[7:0]: P0[7:0] Port Pull-up Enable Bits in the P0 Port Pull-up Control (P0_PU) Register (D[7:0]/0x5203)
∗ P1PU[7:0]: P1[7:0] Port Pull-up Enable Bits in the P1 Port Pull-up Control (P1_PU) Register (D[7:0]/0x5213)
∗ P2PU[7:0]: P2[7:0] Port Pull-up Enable Bits in the P2 Port Pull-up Control (P2_PU) Register (D[7:0]/0x5223)
∗ P3PU[3:0]: P3[3:0] Port Pull-up Enable Bits in the P3 Port Pull-up Control (P3_PU) Register (D[3:0]/0x5233)
Setting PxPU[7:0] to 1 (default) enables the pull-up resistor and pulls up the port pin in input mode. It will not be
pulled up if set to 0.
The PxPU[7:0] setting is disabled in output mode, and the pin is not pulled up.
Input/output ports that are not used should be set with pull-up enabled.
This pull-up setting is also enabled for ports for which the peripheral module function has been selected.
A delay will occur in the waveform rise-up depending on time constants such as pull-up resistance and pin load
capacitance if the port pin is switched from Low level to High level by the internal pull-up resistor. An appropriate
wait time must be set for the input/output port loading. The wait time set should be a value not less than that calculated from the following equation.
Wait time = R
R
C
IN x (CIN + load capacitance on board) x 1.6 [s]
IN: pull-up resistance maximum value
IN: pin capacitance maximum value
86
EPSON S1C17001 TECHNICAL MANUAL
Page 96
10.5 Input Interface Level
The S1C17001 input interface level is pegged to the CMOS mute level.
10 INPUT/OUTPUT PORT (P)
S1C17001 TECHNICAL MANUAL EPSON
87
Page 97
10 INPUT/OUTPUT PORT (P)
10.6 P0 Port Chattering Filter Function
The P0 port includes a chattering filter circuit for key entry, which you can select to use or not use (and for which
you can select a verification time if used) individually for the four P0[3:0] and P0[7:4] ports using P0CFx[2:0]
(P0_CHAT register).
∗ P0CF1[2:0]: P0[3:0] Chattering Filter Time Select Bits in the P0 Port Chattering Filter Control (P0_CHAT)
∗ P0CF2[2:0]: P0[7:4] Chattering Filter Time Select Bits in the P0 Port Chattering Filter Control (P0_CHAT)
Note: • The chattering filter verification time refers to the maximum pulse width that can be filtered.
Generating an input interrupt requires a minimum input time of the verification time and a
maximum input time of twice the verification time.
• Input interrupts will not be accepted for a transition into SLEEP mode with the chattering
filter left on. The chattering filter should be set off (no verification time) before executing the
slp command.
• P0 port interrupts must be blocked when P0_CHAT register (0x5208) settings are being
changed. Changing the setting while interrupts are permitted may generate inadvertent P0
interrupts.
• A phenomenon may occur in which the internal signal oscillates due to the time elapsed
until the signal reaches the threshold value if the input signal rise-up/drop-off time is delayed. Since input interrupts will malfunction under these conditions, the input signal riseup/drop-off time should normally be set to 25 ns or less.
88
EPSON S1C17001 TECHNICAL MANUAL
Page 98
10 INPUT/OUTPUT PORT (P)
10.7 Port Input Interrupt
Ports P0 and P1 include input interrupt functions.
Select which of the 16 ports are to be used for interrupts based on requirements. You can also select whether interrupts are generated for either the rising edge or falling edge of input signals.
Figure 10.7.1 illustrates the port input interrupt circuit configuration.
Chattering filter
P00
P0CF1[2:0]
Interrupt edge selection
P0EDGE0
Interrupt enable
P0IE0
• • •
Interrupt flag
P0IF0
P0 port
interrupt
request
(to ITC)
P07
P10
P17
P0CF2[2:0]
P0EDGE7
P0IE7
P1EDGE0
P1IE0
P1EDGE7
P1IE7
• • •
P0IF7
P1IF0
P1 port
interrupt
request
(to ITC)
P1IF7
Figure 10.7.1: Port input interrupt circuit configuration
Interrupt port selection
Select the port generating an interrupt using PxIE[7:0] (Px_IMSK register).
∗ P0IE[7:0]: P0[7:0] Port Interrupt Enable Bits in the P0 Port Interrupt Mask (P0_IMSK) Register (D[7:0]/0x5205)
∗ P1IE[7:0]: P1[7:0] Port Interrupt Enable Bits in the P1 Port Interrupt Mask (P1_IMSK) Register (D[7:0]/0x5215)
Setting PxIE[7:0] to 1 enables interrupt generation by the corresponding port. Setting to 0 (default) disables in-
terrupt generation.
The interrupt controller must also be set to actually generate an interrupt. For more information on making in-
terrupt controller settings, refer to “6. Interrupt Controller (ITC).”
Interrupt edge selection
Port input interrupts can be generated at either the rising edge or falling edge of the input signal. Select the edge
used to generate interrupts using PxEDGE[7:0] (Px_EDGE register).
∗ P0EDGE[7:0]: P0[7:0] Port Interrupt Edge Select Bits in the P0 Port Interrupt Edge Select (P0_EDGE)
∗ P1EDGE[7:0]: P1[7:0] Port Interrupt Edge Select Bits in the P1 Port Interrupt Edge Select (P1_EDGE)
Setting PxEDGE[7:0] to 1 generates port input interrupts at the input signal falling edge. Setting it to 0 (default)
generates interrupts at the rising edge.
S1C17001 TECHNICAL MANUAL EPSON
Register (D[7:0]/0x5206)
Register (D[7:0]/0x5216)
89
Page 99
10 INPUT/OUTPUT PORT (P)
Interrupt flags in P port module
The ITC is able to accept interrupt requests for both P0 and P1 port interrupts, and the P port module contains
interrupt flags PxIF[7:0] corresponding to the individual 16 ports to enable individual control of the 16 P0[7:0]
and P1[7:0] port interrupts. Setting the corresponding PxIE[7:0] to 1 sets PxIF[7:0] to 1 at the specified edge
(rising or falling edge) of the input signal. A P0 or P1 port interrupt request signal is also output to the ITC at
the same time. This interrupt request signal causes the P0/P1 port interrupt flag inside the ITC to be set to 1.
Meeting the ITC and S1C17 core interrupt conditions generates an interrupt.
∗ P0IF[7:0]: P0[7:0] Port Interrupt Flags in the P0 Port Interrupt Flag (P0_IFLG) Register (D[7:0]/0x5207)
∗ P1IF[7:0]: P1[7:0] Port Interrupt Flags in the P1 Port Interrupt Flag (P1_IFLG) Register (D[7:0]/0x5217)
The following processing is needed to manage the interrupt factor occurrence state using the P port module in-
terrupt flags.
1. Set the ITC P0 and P1 interrupt trigger mode to level trigger mode.
2. Reset the P port module interrupt flag PxIF[7:0] within the interrupt processing routine after the interrupt occurs (this also resets the ITC interrupt flag).
PxIF[7:0] is reset by writing as 1.
Note: To prevent generating unnecessary interrupts, reset the relevant PxIF[7:0] before permitting
interrupts for the required port using PxIE[7:0] (Px_IMSK register).
Port interrupt ITC register
A P0 or P1 port interrupt signal is output to the ITC if the port for which interrupts are permitted as previously
set detects the specified edge of an input signal.
The interrupt level and interrupt permission should be set for the ITC register in order to generate a port inter-
rupt.
Table 10.7.1 illustrates the port interrupt ITC control bits.
The relevant ITC interrupt flag is set to 1 when the P0 or P1 port interrupt signal is activated. When the inter-
rupt enable bit corresponding to that interrupt flag is set to 1, the ITC sends an interrupt request to the S1C17
core. To block port interrupts, set the interrupt enable bit to 0. The interrupt flag is set to 1 by the P0 or P1 port
interrupt signal regardless of the interrupt enable bit setting (even if set to 0).
The interrupt level setting bit sets the port interrupt level (0 to 7). The P0 port takes precedence if the same in-
terrupt level is set.
As previously mentioned, the port interrupt trigger mode setting bit must always be set to 1 (level trigger).
The S1C17 core accepts interrupts when all of the following conditions are met:
• Interrupt enable bit is set to 1
• The PSR (S1C17 core internal processor status register) IE (interrupt enable) bit is set to 1.
• The port interrupt has a higher set interrupt level than the PSR IL (interrupt level).
• No other interrupt factors having higher precedence (e.g., NMI) are present.
For more information on these interrupt control registers and procedures for when an interrupt occurs, refer to “6
Interrupt Controller (ITC).”
90
EPSON S1C17001 TECHNICAL MANUAL
Page 100
Interrupt vector
The port interrupt vector numbers and vector addresses are as shown below.
Table 10.7.2: Port interrupt vectors
PortVector numberVector address
P04 (0x04)0x8010
P15 (0x05)0x8014
10 INPUT/OUTPUT PORT (P)
S1C17001 TECHNICAL MANUAL EPSON
91
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.