User'S Manual: 8-Bit CMOS Microcontroller Revision 1
User'S Manual: 8-Bit CMOS Microcontroller Revision 1
User'S Manual: 8-Bit CMOS Microcontroller Revision 1
USER'S MANUAL
S3C9228/P9228
8-Bit CMOS
Microcontroller
Revision 1
S3C9228/P9228
8-BIT CMOS
MICROCONTROLLERS
USER'S MANUAL
Revision 1
Important Notice
The information in this publication has been "Typical" parameters can and do vary in different
carefully checked and is believed to be entirely applications. All operating parameters, including
accurate at the time of publication. Samsung "Typicals" must be validated for each customer
assumes no responsibility, however, for possible application by the customer's technical experts.
errors or omissions, or for any consequences
resulting from the use of the information contained Samsung products are not designed, intended, or
herein. authorized for use as components in systems
intended for surgical implant into the body, for other
Samsung reserves the right to make changes in its applications intended to support or sustain life, or for
products or product specifications with the intent to any other application in which the failure of the
improve function or design at any time and without Samsung product could create a situation where
notice and is not required to update this personal injury or death may occur.
documentation to reflect such changes.
Should the Buyer purchase or use a Samsung
This publication does not convey to a purchaser of product for any such unintended or unauthorized
semiconductor devices described herein any license application, the Buyer shall indemnify and hold
under the patent rights of Samsung or others. Samsung and its officers, employees, subsidiaries,
affiliates, and distributors harmless against all
Samsung makes no warranty, representation, or claims, costs, damages, expenses, and reasonable
guarantee regarding the suitability of its products for attorney fees arising out of, either directly or
any particular purpose, nor does Samsung assume indirectly, any claim of personal injury or death that
any liability arising out of the application or use of may be associated with such unintended or
any product or circuit and specifically disclaims any unauthorized use, even if such claim alleges that
and all liability, including without limitation any Samsung was negligent regarding the design or
consequential or incidental damages. manufacture of said product.
The S3C9228/P9228 Microcontrollers User's Manual is designed for application designers and programmers who
are using the S3C9228/P9228 microcontrollers for application development. It is organized in two main parts:
Two order forms are included at the back of this manual to facilitate customer order for S3C9228/P9228
microcontrollers: the Mask ROM Order Form, and the Mask Option Selection Form. You can photocopy these
forms, fill them out, and then forward them to your local Samsung Sales Representative.
S3C9228/P9228 MICROCONTROLLERS v
Table of Contents (Continued)
vi S3C9228/P9228 MICROCONTROLLERS
Table of Contents (Continued)
Chapter 11 Timer 1
One 16-Bit Timer Mode (Timer 1) ............................................................................................................ 11-1
Overview ......................................................................................................................................... 11-1
Function Description........................................................................................................................ 11-1
Two 8-Bit Timers Mode (Timer A and B) .................................................................................................. 11-4
Overview ......................................................................................................................................... 11-4
Function Description........................................................................................................................ 11-7
S3C9228/P9228 MICROCONTROLLERS ix
List of Figures
S3C9228/P9228 MICROCONTROLLERS xi
List of Figures (Continued)
16-1 Stop Mode Release Timing When Initiated by an External Interrupt.................................... 16-5
16-2 Stop Mode Release Timing When Initiated by a RESET..................................................... 16-6
16-3 Input Timing for External Interrupts..................................................................................... 16-8
16-4 Input Timing for RESET...................................................................................................... 16-9
16-5 Serial Data Transfer Timing................................................................................................ 16-9
16-6 Clock Timing Measurement at XIN ..................................................................................... 16-11
16-7 Clock Timing Measurement at XTIN ................................................................................... 16-12
16-8 Operating Voltage Range ................................................................................................... 16-13
13-1 Common and Segment Pins per Duty Cycle ....................................................................... 13-3
S3C9228/P9228 MICROCONTROLLERS xv
List of Programming Tips
Description Page
Number
1 PRODUCT OVERVIEW
Samsung's SAM88RCRI family of 8-bit single-chip CMOS microcontrollers offer fast and efficient CPU, a wide
range of integrated peripherals, and supports OTP device.
A dual address/data bus architecture and bit- or nibble-configurable I/O ports provide a flexible programming
environment for applications with varied memory and I/O requirements. Timer/counters with selectable operating
modes are included to support real-time operations.
S3C9228/P9228 MICROCONTROLLER
The S3C9228 can be used for dedicated control functions in a variety of applications, and is especially designed
for application with FRS or etc.
The S3C9228/P9228 single-chip 8-bit microcontroller is fabricated using an advanced CMOS process. It is built
around the powerful SAM88RCRI CPU core.
Stop and Idle power-down modes were implemented to reduce power consumption. To increase on-chip register
space, the size of the internal register file was logically expanded. The S3C9228/P9228 has 8K-byte of program
ROM, and 264-byte of RAM (including 16-byte of working register and 20-byte LCD display RAM).
Using the SAM88RCRI design approach, the following peripherals were integrated with the SAM88RCRI core:
— 7 configurable I/O ports including ports shared with segment/common drive outputs
— 10-bit programmable pins for external interrupts
— One 8-bit basic timer for oscillation stabilization and watch-dog functions
— Two 8-bit timer/counters with selectable operating modes
— Watch timer for real time
— 4 channel A/D converter
— 8-bit serial I/O interface
OTP
The S3C9228 microcontroller is also available in OTP (One Time Programmable) version. S3P9228
microcontroller has an on-chip 8K-byte one-time-programmable EPROM instead of masked ROM. The S3P9228
is comparable to S3C9228, both in function and in pin configuration.
1-1
PRODUCT OVERVIEW S3C9228/P9228
FEATURES
Package Type
• 44-pin QFP, 42-pin SDIP
1-2
S3C9228/P9228 PRODUCT OVERVIEW
BLOCK DIAGRAM
X IN XOUT
RESET XT IN XT OUT
TAOUT/ 8-Bit Timer/ Watchdog
16-Bit
P0.0 CounterA Timer
Timer/
T1CLK/ 8-Bit Timer/
Counter1 Basic Timer
P0.1 CounterB
P4.0-P4.7/
I/O Port 4 A/D Converter P1.0-P1.3/AD0-AD3
SEG4-SEG11
P5.0-P5.3/
SEG12-SEG15 I/O Port 5 I/O Port 6 P6.0-P6.3/COM3-COM0
P5.4-P5.7/
SEG16-SEG19/
COM7-COM4
1-3
PRODUCT OVERVIEW S3C9228/P9228
PIN ASSIGNMENTS
COM4/SEG19/P5.7
P0.0/TAOUT/INT
P0.1/T1CLK/INT
P0.3/BUZ/INT
COM0/P6.3
COM1/P6.2
COM2/P6.1
COM3/P6.0
P0.2/INT
P0.5
P0.4
44
43
42
41
40
39
38
37
36
35
34
P1.0/AD0/INT 1 33 COM5/SEG18/P5.6
P1.1/AD1/INT 2 32 COM6/SEG17/P5.5
P1.2/AD2/INT 3 31 COM7/SEG16/P5.4
P1.3/AD3/INT 4 30 SEG15/P5.3
VDD 5 S3C9228 29 SEG14/P5.2
VSS 6 28 SEG13/P5.1
XOUT 7 (44-QFP) 27 SEG12/P5.0
XIN 8 26 SEG11/P4.7
TEST 9 25 SEG10/P4.6
XTIN 10 24 SEG9/P4.5
XTOUT 11 23 SEG8/P4.4
12
13
14
15
16
17
18
19
20
21
22
RESET
SEG1/P2.0/SCK
SEG2/P3.1/INTP
SEG3/P3.0/INTP
P2.3
SEG4/P4.0
SEG5/P4.1
SEG6/P4.2
SEG7/P4.3
P2.2/SI
SEG0/P2.1/SO
1-4
S3C9228/P9228 PRODUCT OVERVIEW
COM1/P6.2 1 42 COM2/P6.1
COM0/P6.3 2 41 COM3/P6.0
P0.0/TAOUT/INT 3 40 COM4/SEG19/P5.7
P0.1/T1CLK/INT 4 39 COM5/SEG18/P5.6
P0.2/INT 5 38 COM6/SEG17/P5.5
P0.3/BUZ/INT 6 37 COM7/SEG16/P5.4
P1.0/AD0/INT 7 36 SEG15/P5.3
P1.1/AD1/INT 8 35 SEG14/P5.2
S3C9228
(42-SDIP)
P1.2/AD2/INT 9 34 SEG13/P5.1
P1.3/AD3/INT 10 33 SEG12/P5.0
VDD 11 32 SEG11/P4.7
VSS 12 31 SEG10/P4.6
XOUT 13 30 SEG9/P4.5
XIN 14 29 SEG8/P4.4
TEST 15 28 SEG7/P4.3
XTIN 16 27 SEG6/P4.2
XTOUT 17 26 SEG5/P4.1
RESET 18 25 SEG4/P4.0
P2.3 19 24 SEG3/P3.0/INTP
P2.2/SI 20 23 SEG2/P3.1/INTP
SEG0/P2.1/SO 21 22 SEG1/P2.0/SCK
1-5
PRODUCT OVERVIEW S3C9228/P9228
PIN DESCRIPTIONS
1-6
S3C9228/P9228 PRODUCT OVERVIEW
1-7
PRODUCT OVERVIEW S3C9228/P9228
VDD
Pull-Up
Resistor
VDD
Data
Output
Output
Disable
VSS
1-8
S3C9228/P9228 PRODUCT OVERVIEW
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain Enable
Data I/O
Output
Disable
External
Interrupt
Input
VDD
Pull-up
Resistor
Pull-up Enable
Open-Drain EN Circuit
Data I/O
Output Disable Type E
ADEN
ADSELECT
Data
To ADC
1-9
PRODUCT OVERVIEW S3C9228/P9228
VLC1
VLC2
VLC3
SEG/COM Out
Output
Disable
VLC4
VLC5
VSS
1-10
S3C9228/P9228 PRODUCT OVERVIEW
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain EN Enable
Data I/O
LCD Out EN
COM/SEG Circuit
Output Type H-23
Disable
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain EN Enable
Data I/O
LCD Out EN
COM/SEG Circuit
Output Type H-23
Disable
1-11
PRODUCT OVERVIEW S3C9228/P9228
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain EN Enable
Data I/O
Port
LCD Out EN Enable
(LMOD.5)
COM/SEG Circuit
Output Type H-23
Disable
1-12
S3C9228/P9228 ADDRESS SPACES
2 ADDRESS SPACES
OVERVIEW
A 16-bit address bus supports program memory operations. Special instructions and related internal logic
determine when the 16-bit bus carries addresses for program memory. A separate 8-bit register bus carries
addresses and data between the CPU and the internal register file.
The S3C9228 has 8K bytes of mask-programmable program memory on-chip. The S3C9228/P9228
microcontroller has 244 bytes general-purpose registers in its internal register file and the 20 bytes for LCD
display memory is implemented in the internal register file too. Fifty-six bytes in the register file are mapped for
system and peripheral control functions.
2-1
ADDRESS SPACES S3C9228/P9228
Program memory (ROM) stores program code or table data. The S3C9228 has 8K bytes of mask-programable
program memory. The program memory address range is therefore 0H-1FFFH. The first 2 bytes of the ROM
(0000H–0001H) are an interrupt vector address. The program reset address in the ROM is 0100H.
(Decimal) (Hex)
8,192 1FFFH
8K bytes
Internal
Program
Memory
Area
2 0002H
Interrupt
1 0001H
Vector
0 0000H
2-2
S3C9228/P9228 ADDRESS SPACES
REGISTER ARCHITECTURE
The upper 72 bytes of the S3C9228/P9228's internal register file are addressed as working registers, system
control registers and peripheral control registers. The lower 184 bytes of internal register file (00H–B7H) is called
the general purpose register space.
For many SAM88RCRI microcontrollers, the addressable area of the internal register file is further expanded by
the additional of one or more register pages at general purpose register space (00H–BFH). This register file
expansion is implemented by page 1 in the S3C9228/P9228. The page 1 (20 × 8 bits) is for LCD display register
and can be used as general-purpose registers.
FFH
Peripheral Control
Registers
E0H
DFH
72 Bytes of System Control
Common Area Registers
D0H
CFH
Working Registers
C0H
BFH
Peripheral Control
Registers
B8H
B7H
General Purpose
184 Bytes Register File
and Stack Area
~
3FH
General Purpose
Register File
64 Bytes 13H
LCD Display
Registers
00H 00H
(Page 0) (Page 1)
2-3
ADDRESS SPACES S3C9228/P9228
The SAM88RCRI register architecture provides an efficient method of working register addressing that takes full
advantage of shorter instruction formats to reduce execution time.
This16-byte address range is called common area. That is, locations in this area can be used as working registers
by operations that address any location on any page in the register file. Typically, these working registers serve
as temporary buffers for data operations between different pages.
The Register (R) addressing mode can be used to access this area
Registers are addressed either as a single 8-bit register or as a paired 16-bit register. In 16-bit register pairs, the
address of the first 8-bit register is always an even number and the address of the next register is an odd number.
The most significant byte of the 16-bit data is always stored in the even-numbered register; the least significant
byte is always stored in the next (+ 1) odd-numbered register.
Rn Rn + 1
2-4
S3C9228/P9228 ADDRESS SPACES
SYSTEM STACK
S3C9-series microcontrollers use the system stack for subroutine calls and returns and to store data. The PUSH
and POP instructions are used to control system stack operations. The S3C9228/P9228 architecture supports
stack operations in the internal register file.
STACK OPERATIONS
Return addresses for procedure calls and interrupts and data are stored on the stack. The contents of the PC are
saved to stack by a CALL instruction and restored by the RET instruction. When an interrupt occurs, the contents
of the PC and the FLAGS register are pushed to the stack. The IRET instruction then pops these values back to
their original locations. The stack address is always decremented before a push operation and incremented after
a pop operation. The stack pointer (SP) always points to the stack frame stored on the top of the stack, as shown
in Figure 2-4.
High Address
PCL
PCL
PCH
Top of
PCH
stack Top of
Flags
stack
Register location D9H contains the 8-bit stack pointer (SP) that is used for system stack operations. After a reset,
the SP value is undetermined.
Because only internal memory space is implemented in the S3C9228/P9228, the SP must be initialized to an 8-
bit value in the range 00H–B7H.
NOTE
In case a Stack Pointer is initialized to 00H, it is decreased to FFH when stack operation starts. This
means that a Stack Pointer access invalid stack area.
2-5
ADDRESS SPACES S3C9228/P9228
2-6
S3C9228/P9228 ADDRESSING MODES
3 ADDRESSING MODES
OVERVIEW
Instructions that are stored in program memory are fetched for execution using the program counter. Instructions
indicate the operation to be performed and the data to be operated on. Addressing mode is the method used to
determine the location of the data operand. The operands specified in SAM88RCRI instructions may be condition
codes, immediate data, or a location in the register file, program memory, or data memory.
The SAM88RCRI instruction set supports six explicit addressing modes. Not all of these addressing modes are
available for each instruction. The addressing modes and their symbols are as follows:
— Register (R)
— Indirect Register (IR)
— Indexed (X)
— Direct Address (DA)
— Relative Address (RA)
— Immediate (IM)
3-1
ADDRESSING MODES S3C9228/P9228
In Register addressing mode, the operand is the content of a specified register (see Figure 3-1). Working register
addressing differs from Register addressing because it uses a 16-byte working register space in the register file
and a 4-bit register within that space (see Figure 3-2).
8-bit Register
File Address dst OPERAND
Point to One
OPCODE
Rigister in Register
One-Operand File
Instruction
(Example) Value used in
Instruction Execution
Sample Instruction:
Register File
CFH
.
.
Program Memory .
4-Bit .
Working Register 4 LSBs
dst src OPERAND
Point to the
OPCODE
Woking Register
Two-Operand (1 of 16) C0H
Instruction
(Example)
Sample Instruction:
3-2
S3C9228/P9228 ADDRESSING MODES
In Indirect Register (IR) addressing mode, the content of the specified register or register pair is the address of
the operand. Depending on the instruction used, the actual address may point to a register in the register file, to
program memory (ROM), or to an external memory space (see Figures 3-3 through 3-6).
You can use any 8-bit register to indirectly address another register. Any 16-bit register pair can be used to
indirectly address another memory location.
8-Bit Register
File Address dst ADDRESS
Point to One
OPCODE
Rigister in Register
One-Operand File
Instruction
(Example) Address of Operand
used by Instruction
Sample Instruction:
3-3
ADDRESSING MODES S3C9228/P9228
Register File
Program Memory
REGISTER
Example
Instruction dst PAIR
References OPCODE Points to
Program Rigister Pair
16-Bit
Memory Address
Points to
Program Memory Program
Memory
3-4
S3C9228/P9228 ADDRESSING MODES
Register File
CFH
.
.
Program Memory
.
4-Bit .
Working 4 LSBs
dst src OPERAND
Register Point to the
Address OPCODE
Woking Register
(1 of 16) C0H
Sample Instruction:
Value used in OPERAND
OR R6, @R2 Instruction
3-5
ADDRESSING MODES S3C9228/P9228
Register File
CFH
.
.
Program Memory
.
4-Bit Working .
Register Address
dst src Register
Next 3 Bits Point Pair
OPCODE
Example Instruction to Working
Register Pair C0H
References either
(1 of 8) 16-Bit
Program Memory or
address
Data Memory
LSB Selects Program Memory points to
or program
Data Memory memory
or data
memory
Value used in
OPERAND
Instruction
Sample Instructions:
3-6
S3C9228/P9228 ADDRESSING MODES
Indexed (X) addressing mode adds an offset value to a base address during instruction execution in order to
calculate the effective operand address (see Figure 3-7). You can use Indexed addressing mode to access
locations in the internal register file or in external memory.
In short offset Indexed addressing mode, the 8-bit displacement is treated as a signed integer in the range of
–128 to +127. This applies to external memory accesses only (see Figure 3-8).
For register file addressing, an 8-bit base address provided by the instruction is added to an 8-bit offset contained
in a working register. For external memory accesses, the base address is stored in the working register pair
designated in the instruction. The 8-bit or 16-bit offset given in the instruction is then added to the base address
(see Figure 3-9).
The only instruction that supports Indexed addressing mode for the internal register file is the Load instruction
(LD). The LDC and LDE instructions support Indexed addressing mode for internal program memory, external
program memory, and for external data memory, when implemented.
Register File
~ ~
Value used in
Instruction
OPERAND
+
Program Memory ~ ~
Base Address
4 LSBs
Two-Operand dst src INDEX
Point to One of the
Instruction OPCODE
Woking Register
Example (1 of 16)
Sample Instruction:
3-7
ADDRESSING MODES S3C9228/P9228
Value used in
OPERAND
16-Bits Instruction
Sample Instructions:
LDC R4, #04H[RR2] ; The values in the program address (RR2 + #04H)
are loaded into register R4.
LDE R4,#04H[RR2] ; Identical operation to LDC example, except that
external program memory is accessed.
Figure 3-8. Indexed Addressing to Program or Data Memory with Short Offset
3-8
S3C9228/P9228 ADDRESSING MODES
XLH (OFFSET)
XLL (OFFSET) Register
4-Bit Working NEXT 3 Bits
dst src Pair
Register Address
OPCODE Point to Working
Register Pair 16-Bit
(1 of 8) address
added to
offset
LSB Selects
+
8-Bits 16-Bits
Program Memory
or
Data Memory
Sample Instructions:
Figure 3-9. Indexed Addressing to Program or Data Memory with Long Offset
3-9
ADDRESSING MODES S3C9228/P9228
In Direct Address (DA) mode, the instruction provides the operand's 16-bit memory address. Jump (JP) and Call
(CALL) instructions use this addressing mode to specify the 16-bit destination address that is loaded into the PC
whenever a JP or CALL instruction is executed.
The LDC and LDE instructions can use Direct Address mode to specify the source or destination address for
Load operations to program memory (LDC) or to external data memory (LDE), if implemented.
Program or
Data Memory
Memory
Address
Program Memory
Used
Sample Instructions:
3-10
S3C9228/P9228 ADDRESSING MODES
Program Memory
Next OPCODE
Program
Memory
Address
Used
Sample Instructions:
3-11
ADDRESSING MODES S3C9228/P9228
In Relative Address (RA) mode, a two's-complement signed displacement between – 128 and + 127 is specified
in the instruction. The displacement value is then added to the current PC value. The result is the address of the
next instruction to be executed. Before this addition occurs, the PC contains the address of the instruction
immediately following the current instruction.
Program Memory
Next OPCODE
Program Memory
Address Used
Current
PC Value
Displacement +
Current Instruction OPCODE Signed
Displacement Value
Sample Instructions:
In Immediate (IM) addressing mode, the operand value used in the instruction is the value supplied in the
operand field itself. Immediate addressing mode is useful for loading constant values into registers.
Program Memory
OPERAND
OPCODE
Sample Instruction:
LD R0,#0AAH
3-12
S3C9228/P9228 CONTROL REGISTERS
4 CONTROL REGISTERS
OVERVIEW
In this section, detailed descriptions of the S3C9228/P9228 control registers are presented in an easy-to-read
format. These descriptions will help familiarize you with the mapped locations in the register file. You can also
use them as a quick-reference source when writing application programs.
System and peripheral registers are summarized in Table 4-1. Figure 4-1 illustrates the important features of the
standard register description format.
Control register descriptions are arranged in alphabetical order according to register mnemonic. More information
about control registers is presented in the context of the various peripheral hardware descriptions in Part II of this
manual.
4-1
CONTROL REGISTERS S3C9228/P9228
4-2
S3C9228/P9228 CONTROL REGISTERS
4-3
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value x x x x x x 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
.6 Zero Flag
0 Operation result is a non-zero value
1 Operation result is zero
.5 Sign Flag
0 Operation generates positive number (MSB = "0")
1 Operation generates negative number (MSB = "1")
4-4
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – 0 0 0 0 0 0
Read/Write – – R/W R/W R R/W R/W R/W
4-5
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
.0 Clock Frequency Divider Clear Bit for Basic Timer and Timer/Counters (2)
0 No effect
1 Clear clock frequency dividers
NOTES
1. When "1" is written to BTCON.1, the basic timer counter value is cleared to "00H". Immediately following the write
operation, the BTCON.1 value is automatically cleared to "0".
2. When "1" is written to BTCON.0, the corresponding frequency divider is cleared to "00H". Immediately following the
write operation, the BTCON.0 value is automatically cleared to "0".
4-6
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-7
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value x x x x – – – –
Read/Write R/W R/W R/W R/W – – – –
4-8
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-9
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – 0 0 0 0 0 0
Read/Write – – R/W R/W R/W R/W R/W R/W
4-10
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – 0 0 0 0 0 0 0
Read/Write – R/W R/W R/W R/W R/W R/W R/W
4-11
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – 0 0 0 0 0 0 0
Read/Write – R/W R/W R/W R/W R/W R/W R/W
4-12
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 – 0
Read/Write – – – – R/W R/W – R/W
4-13
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-14
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-15
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-16
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-17
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-18
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-19
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-20
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-21
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-22
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-23
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-24
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – – – 0 0
Read/Write – – – – – – R/W R/W
4-25
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – – – 0 0
Read/Write – – – – – – R/W R/W
4-26
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – – – 0 0
Read/Write – – – – – – R/W R/W
4-27
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-28
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-29
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-30
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-31
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-32
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 –
Read/Write R/W R/W R/W R/W R/W R/W R/W –
4-33
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-34
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-35
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 –
Read/Write R/W R/W R/W R/W R/W R/W R/W –
.0 Bit 0
Not used for S3C9228/P9228
4-36
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – 0 0 0 0 0 0 –
Read/Write – R/W R/W R/W R/W R/W R/W –
4-37
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 –
Read/Write R/W R/W R/W R/W R/W R/W R/W –
4-38
S3C9228/P9228 INTERRUPT STRUCTURE
5 INTERRUPT STRUCTURE
OVERVIEW
The SAM88RCRI interrupt structure has two basic components: a vector, and sources. The number of interrupt
sources can be serviced through a interrupt vector which is assigned in ROM address 0000H–0001H.
VECTOR SOURCES
S1
0000H
S2
0001H
S3
Sn
NOTES:
1. The SAM88RCRI interrupt has only one vector address (0000H-0001H).
2. The number of Sn value is expandable.
Interrupt processing can be controlled in two ways: globally, or by specific interrupt level and source. The system-
level control points in the interrupt structure are therefore:
The system mode register, SYM (DFH), is used to enable and disable interrupt processing.
SYM.3 is the enable and disable bit for global interrupt processing, which you can set by modifying SYM.3. An
Enable Interrupt (EI) instruction must be included in the initialization routine that follows a reset operation in order
to enable interrupt processing. Although you can manipulate SYM.3 directly to enable and disable interrupts
during normal operation, we recommend that you use the EI and DI instructions for this purpose.
5-1
INTERRUPT STRUCTURE S3C9228/P9228
When the interrupt service routine has executed, the application program's service routine must clear the
appropriate pending bit before the return from interrupt subroutine (IRET) occurs.
INTERRUPT PRIORITY
Because there is not a interrupt priority register in SAM87RCRI, the order of service is determined by a sequence
of source which is executed in interrupt service routine.
"EI" Instruction
S Q
Execution Interrupt Pending
Register
RESET R
Source Vector
Interrupts Interrpt priority
Interrupt
is determind by
Source Cycle
software polling
Interrupt method
Enable
Global Interrupt
Control (EI, Di instruction)
5-2
S3C9228/P9228 INTERRUPT STRUCTURE
1. A source generates an interrupt request by setting the interrupt request pending bit to "1".
2. The CPU generates an interrupt acknowledge signal.
3. The service routine starts and the source's pending flag is cleared to "0" by software.
4. Interrupt priority must be determined by software polling method.
Before an interrupt request can be serviced, the following conditions must be met:
If all of the above conditions are met, the interrupt request is acknowledged at the end of the instruction cycle.
The CPU then initiates an interrupt machine cycle that completes the following processing sequence:
1. Reset (clear to "0") the global interrupt enable bit in the SYM register (DI, SYM.3 = "0")
to disable all subsequent interrupts.
2. Save the program counter and status flags to stack.
3. Branch to the interrupt vector to fetch the service routine's address.
4. Pass control to the interrupt service routine.
When the interrupt service routine is completed, an Interrupt Return instruction (IRET) occurs. The IRET restores
the PC and status flags and sets SYM.3 to "1"(EI), allowing the CPU to process the next interrupt request.
The interrupt vector area in the ROM contains the address of the interrupt service routine. Vectored interrupt
processing follows this sequence:
5-3
INTERRUPT STRUCTURE S3C9228/P9228
5-4
S3C9228/P9228 INTERRUPT STRUCTURE
5-5
INTERRUPT STRUCTURE S3C9228/P9228
As the following examples are shown, a load instruction should be used to clear an interrupt pending bit.
Examples:
5-6
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
OVERVIEW
The SAM88RCRI instruction set is designed to support the large register file. It includes a full complement of 8-
bit arithmetic and logic operations. There are 41 instructions. No special I/O instructions are necessary because
I/O control and data registers are mapped directly into the register file. Flexible instructions for bit addressing,
rotate, and shift operations complete the powerful data manipulation capabilities of the SAM88RCRI instruction
set.
REGISTER ADDRESSING
To access an individual register, an 8-bit address in the range 0-255 or the 4-bit address of a working register is
specified. Paired registers can be used to construct 16-bit program memory or data memory addresses. For
detailed information about register addressing, please refer to Section 2, "Address Spaces".
ADDRESSING MODES
There are six addressing modes: Register (R), Indirect Register (IR), Indexed (X), Direct (DA), Relative (RA), and
Immediate (IM). For detailed descriptions of these addressing modes, please refer to Section 3, "Addressing
Modes".
6-1
SAM88RI INSTRUCTION SET S3C9228/P9228
Load Instructions
CLR dst Clear
LD dst,src Load
LDC dst,src Load program memory
LDE dst,src Load external data memory
LDCD dst,src Load program memory and decrement
LDED dst,src Load external data memory and decrement
LDCI dst,src Load program memory and increment
LDEI dst,src Load external data memory and increment
POP dst Pop from stack
PUSH src Push to stack
Arithmetic Instructions
Logic Instructions
AND dst,src Logical AND
COM dst Complement
OR dst,src Logical OR
XOR dst,src Logical exclusive OR
6-2
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
6-3
SAM88RI INSTRUCTION SET S3C9228/P9228
The FLAGS register contains eight bits that describe the current status of CPU operations. Four of these bits,
FLAGS.4 – FLAGS.7, can be tested and used with conditional jump instructions;
FLAGS register can be set or reset by instructions as long as its outcome does not affect the flags, such as, Load
instruction. Logical and Arithmetic instructions such as, AND, OR, XOR, ADD, and SUB can affect the Flags
register. For example, the AND instruction updates the Zero, Sign and Overflow flags based on the outcome of
the AND instruction. If the AND instruction uses the Flags register as the destination, then simultaneously, two
write will occur to the Flags register producing an unpredictable result.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
FLAG DESCRIPTIONS
6-4
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
6-5
SAM88RI INSTRUCTION SET S3C9228/P9228
6-6
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
OPCODE MAP
LOWER NIBBLE (HEX)
– 0 1 2 3 4 5 6 7
U 0 DEC DEC ADD ADD ADD ADD ADD
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
P 1 RLC RLC ADC ADC ADC ADC ADC
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
P 2 INC INC SUB SUB SUB SUB SUB
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
E 3 JP SBC SBC SBC SBC SBC
IRR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
R 4 OR OR OR OR OR
r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
5 POP POP AND AND AND AND AND
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
N 6 COM COM TCM TCM TCM TCM TCM
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
I 7 PUSH PUSH TM TM TM TM TM
R2 IR2 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
B 8 LD
r1, x, r2
B 9 RL RL LD
R1 IR1 r2, x, r1
L A CP CP CP CP CP LDC
r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM r1, Irr2, xL
E B CLR CLR XOR XOR XOR XOR XOR LDC
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM r2, Irr2, xL
C RRC RRC LDC LD
R1 IR1 r1,Irr2 r1, Ir2
H D SRA SRA LDC LD LD
R1 IR1 r2,Irr1 IR1,IM Ir1, r2
E E RR RR LDCD LDCI LD LD LD LDC
R1 IR1 r1,Irr2 r1,Irr2 R2,R1 R2,IR1 R1,IM r1, Irr2, xs
X F CALL LD CALL LDC
IRR1 IR2,R1 DA1 r2, Irr1, xs
6-7
SAM88RI INSTRUCTION SET S3C9228/P9228
6-8
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
CONDITION CODES
The opcode of a conditional jump always contains a 4-bit field called the condition code (cc). This specifies under
which conditions it is to execute the jump. For example, a conditional jump with the condition code for "equal"
after a compare operation only jumps if the two operands are equal. Condition codes are listed in Table 6-6.
The carry (C), zero (Z), sign (S), and overflow (V) flags are used to control the operation of conditional jump
instructions.
6-9
SAM88RI INSTRUCTION SET S3C9228/P9228
INSTRUCTION DESCRIPTIONS
This section contains detailed information and programming examples for each instruction in the SAM88RCRI
instruction set. Information is arranged in a consistent format for improved readability and for fast referencing.
The following information is included in each instruction description:
6-10
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
ADC dst,src
Flags: C: Set if there is a carry from the most significant bit of the result; cleared otherwise.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Set if arithmetic overflow occurs, that is, if both operands are of the same sign and the
result is of the opposite sign; cleared otherwise.
D: Always cleared to "0".
H: Set if there is a carry from the most significant bit of the low-order four bits of the result;
cleared otherwise.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 12 r r
6 13 r lr
Examples: Given: R1 = 10H, R2 = 03H, C flag = "1", register 01H = 20H, register 02H = 03H, and register
03H = 0AH:
In the first example, destination register R1 contains the value 10H, the carry flag is set to "1",
and the source working register R2 contains the value 03H. The statement "ADC R1,R2" adds
03H and the carry flag value ("1") to the destination value 10H, leaving 14H in register R1.
6-11
SAM88RI INSTRUCTION SET S3C9228/P9228
ADD — Add
ADD dst,src
Flags: C: Set if there is a carry from the most significant bit of the result; cleared otherwise.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if both operands are of the same sign and the
result is of the opposite sign; cleared otherwise.
D: Always cleared to "0".
H: Set if a carry from the low-order nibble occurred.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 02 r r
6 03 r lr
Examples: Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
In the first example, destination working register R1 contains 12H and the source working register
R2 contains 03H. The statement "ADD R1,R2" adds 03H to 12H, leaving the value 15H in
register R1.
6-12
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
AND dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 52 r r
6 53 r lr
Examples: Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
In the first example, destination working register R1 contains the value 12H and the source
working register R2 contains 03H. The statement "AND R1,R2" logically ANDs the source
operand 03H with the destination operand value 12H, leaving the value 02H in register R1.
6-13
SAM88RI INSTRUCTION SET S3C9228/P9228
CALL dst
Operation: SP ¨ SP – 1
@SP ¨ PCL
SP ¨ SP –1
@SP ¨ PCH
PC ¨ dst
The current contents of the program counter are pushed onto the top of the stack. The program
counter value used is the address of the first instruction following the CALL instruction. The
specified destination address is then loaded into the program counter and points to the first
instruction of a procedure. At the end of the procedure the return instruction (RET) can be used to
return to the original program flow. RET pops the top of the stack back into the program counter.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 3 14 F6 DA
In the first example, if the program counter value is 1A47H and the stack pointer contains the
value 0B2H, the statement "CALL 1521H" pushes the current PC value onto the top of the stack.
The stack pointer now points to memory location 00H. The PC is then loaded with the value
1521H, the address of the first instruction in the program sequence to be executed.
If the contents of the program counter and stack pointer are the same as in the first example, the
statement "CALL @RR0" produces the same result except that the 49H is stored in stack location
01H (because the two-byte instruction format was used). The PC is then loaded with the value
1521H, the address of the first instruction in the program sequence to be executed.
6-14
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
CCF
Operation: C ¨ NOT C
The carry flag (C) is complemented. If C = "1", the value of the carry flag is changed to logic
zero; if C = "0", the value of the carry flag is changed to logic one.
Flags: C: Complemented.
No other flags are affected.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 EF
CCF
If the carry flag = "0", the CCF instruction complements it in the FLAGS register (0D5H), changing
its value from logic zero to logic one.
6-15
SAM88RI INSTRUCTION SET S3C9228/P9228
CLR — Clear
CLR dst
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 B0 R
4 B1 IR
Examples: Given: Register 00H = 4FH, register 01H = 02H, and register 02H = 5EH:
In Register (R) addressing mode, the statement "CLR 00H" clears the destination register 00H
value to 00H. In the second example, the statement "CLR @01H" uses Indirect Register (IR)
addressing mode to clear the 02H register value to 00H.
6-16
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
COM — Complement
COM dst
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always reset to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 60 R
4 61 IR
COM R1 → R1 = 0F8H
COM @R1 → R1 = 07H, register 07H = 0EH
In the first example, destination working register R1 contains the value 07H (00000111B). The
statement "COM R1" complements all the bits in R1: all logic ones are changed to logic zeros,
and vice-versa, leaving the value 0F8H (11111000B).
In the second example, Indirect Register (IR) addressing mode is used to complement the value
of destination register 07H (11110001B), leaving the new value 0EH (00001110B).
6-17
SAM88RI INSTRUCTION SET S3C9228/P9228
CP — Compare
CP dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 A2 r r
6 A3 r lr
Destination working register R1 contains the value 02H and source register R2 contains the value
03H. The statement "CP R1,R2" subtracts the R2 value (source/subtrahend) from the R1 value
(destination/minuend). Because a "borrow" occurs and the difference is negative, C and S are "1".
In this example, destination working register R1 contains the value 05H which is less than the
contents of the source working register R2 (0AH). The statement "CP R1,R2" generates C = "1"
and the JP instruction does not jump to the SKIP location. After the statement "LD R3,R1"
executes, the value 06H remains in working register R3.
6-18
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
DEC — Decrement
DEC dst
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if result is negative; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, dst value is –128(80H) and result value is
+127(7FH); cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 00 R
4 01 IR
DEC R1 → R1 = 02H
DEC @R1 → Register 03H = 0FH
In the first example, if working register R1 contains the value 03H, the statement "DEC R1"
decrements the hexadecimal value by one, leaving the value 02H. In the second example, the
statement "DEC @R1" decrements the value 10H contained in the destination register 03H by
one, leaving the value 0FH.
6-19
SAM88RI INSTRUCTION SET S3C9228/P9228
DI — Disable Interrupts
DI
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 8F
DI
If the value of the SYM register is 04H, the statement "DI" leaves the new value 00H in the
register and clears SYM.2 to "0", disabling interrupt processing.
6-20
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
EI — Enable Interrupts
EI
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 9F
EI
If the SYM register contains the value 00H, that is, if interrupts are currently disabled, the
statement "EI" sets the SYM register to 04H, enabling all interrupts (SYM.2 is the enable bit for
global interrupt processing).
6-21
SAM88RI INSTRUCTION SET S3C9228/P9228
IDLE
Operation:
The IDLE instruction stops the CPU clock while allowing system clock oscillation to continue. Idle
mode can be released by an interrupt request (IRQ) or an external reset operation.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc 1 4 6F – –
IDLE
6-22
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
INC — Increment
INC dst
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Set if arithmetic overflow occurred, that is dst value is +127(7FH) and result is –128(80H);
cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
dst | opc 1 4 rE r
r = 0 to F
opc dst 2 4 20 R
4 21 IR
Examples: Given: R0 = 1BH, register 00H = 0CH, and register 1BH = 0FH:
INC R0 → R0 = 1CH
INC 00H → Register 00H = 0DH
INC @R0 → R0 = 1BH, register 01H = 10H
In the first example, if destination working register R0 contains the value 1BH, the statement "INC
R0" leaves the value 1CH in that same register.
The next example shows the effect an INC instruction has on register 00H, assuming that it
contains the value 0CH.
In the third example, INC is used in Indirect Register (IR) addressing mode to increment the value
of register 1BH from 0FH to 10H.
6-23
SAM88RI INSTRUCTION SET S3C9228/P9228
IRET IRET
Flags: All flags are restored to their original settings (that is, the settings before the interrupt occurred).
Format:
IRET Bytes Cycles Opcode
(Normal) (Hex)
opc 1 6 BF
6-24
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
JP — Jump
JP cc,dst (Conditional)
JP dst (Unconditional)
Format: (1)
Bytes Cycles Opcode Addr Mode
(2) (Hex) dst
cc | opc dst 3 8 (3) ccD DA
cc = 0 to F
Examples: Given: The carry flag (C) = "1", register 00 = 01H, and register 01 = 20H:
The first example shows a conditional JP. Assuming that the carry flag is set to "1", the statement
"JP C,LABEL_W" replaces the contents of the PC with the value 1000H and transfers control to
that location. Had the carry flag not been set, control would then have passed to the statement
immediately following the JP instruction.
The second example shows an unconditional JP. The statement "JP @00" replaces the contents
of the PC with the contents of the register pair 00H and 01H, leaving the value 0120H.
6-25
SAM88RI INSTRUCTION SET S3C9228/P9228
JR — Jump Relative
JR cc,dst
The range of the relative address is +127, –128, and the original value of the program counter is
taken to be the address of the first instruction byte following the JR statement.
Format:
Bytes Cycles Opcode Addr Mode
(1) (Hex) dst
cc | opc dst 2 6 (2) ccB RA
cc = 0 to F
NOTE: In the first byte of the two-byte instruction format, the condition code and the opcode are each four
bits.
JR C,LABEL_X → PC = 1FF7H
If the carry flag is set (that is, if the condition code is true), the statement "JR C,LABEL_X" will
pass control to the statement whose address is now in the PC. Otherwise, the program instruction
following the JR would be executed.
6-26
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
LD — Load
LD dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
dst | opc src 2 4 rC r IM
4 r8 r R
6-27
SAM88RI INSTRUCTION SET S3C9228/P9228
LD — Load
LD (Continued)
Examples: Given: R0 = 01H, R1 = 0AH, register 00H = 01H, register 01H = 20H,
register 02H = 02H, LOOP = 30H, and register 3AH = 0FFH:
LD R0,#10H → R0 = 10H
LD R0,01H → R0 = 20H, register 01H = 20H
LD 01H,R0 → Register 01H = 01H, R0 = 01H
LD R1,@R0 → R1 = 20H, R0 = 01H
LD @R0,R1 → R0 = 01H, R1 = 0AH, register 01H = 0AH
LD 00H,01H → Register 00H = 20H, register 01H = 20H
LD 02H,@00H → Register 02H = 20H, register 00H = 01H
LD 00H,#0AH → Register 00H = 0AH
LD @00H,#10H → Register 00H = 01H, register 01H = 10H
LD @00H,02H → Register 00H = 01H, register 01H = 02, register 02H = 02H
LD R0,#LOOP[R1]→ R0 = 0FFH, R1 = 0AH
LD #LOOP[R0],R1→ Register 31H = 0AH, R0 = 01H, R1 = 0AH
6-28
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
LDC/LDE dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
1. opc dst | src 2 10 C3 r Irr
NOTES:
1. The source (src) or working register pair [rr] for formats 5 and 6 cannot use register pair 0–1.
2. For formats 3 and 4, the destination address 'XS [rr]' and the source address 'XS [rr]' are each one byte.
3. For formats 5 and 6, the destination address 'XL [rr] and the source address 'XL [rr]' are each two bytes.
4. The DA and r source values for formats 7 and 8 are used to address program memory; the second set of values, used in
formats 9 and 10, are used to address data memory.
6-29
SAM88RI INSTRUCTION SET S3C9228/P9228
LDC/LDE (Continued)
Examples: Given: R0 = 11H, R1 = 34H, R2 = 01H, R3 = 04H, R4 = 00H, R5 = 60H; Program memory
locations 0061 = AAH, 0103H = 4FH, 0104H = 1A, 0105H = 6DH, and 1104H = 88H. External
data memory locations 0061H = BBH, 0103H = 5FH, 0104H = 2AH, 0105H = 7DH, and
1104H = 98H:
NOTE: These instructions are not supported by masked ROM type devices.
6-30
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
LDCD/LDED dst,src
LDCD references program memory and LDED references external data memory. The assembler
makes ‘Irr’ an even number for program memory and an odd number for data memory.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 10 E2 r Irr
Examples: Given: R6 = 10H, R7 = 33H, R8 = 12H, program memory location 1033H = 0CDH, and
external data memory location 1033H = 0DDH:
6-31
SAM88RI INSTRUCTION SET S3C9228/P9228
LDCI/LDEI dst,src
LDCI refers to program memory and LDEI refers to external data memory. The assembler makes
'Irr' even for program memory and odd for data memory.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 10 E3 r Irr
Examples: Given: R6 = 10H, R7 = 33H, R8 = 12H, program memory locations 1033H = 0CDH and
1034H = 0C5H; external data memory locations 1033H = 0DDH and 1034H = 0D5H:
6-32
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
NOP — No Operation
NOP
Operation: No action is performed when the CPU executes this instruction. Typically, one or more NOPs are
executed in sequence in order to effect a timing delay of variable duration.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 FF
NOP
6-33
SAM88RI INSTRUCTION SET S3C9228/P9228
OR — Logical OR
OR dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 42 r r
6 43 r lr
Examples: Given: R0 = 15H, R1 = 2AH, R2 = 01H, register 00H = 08H, register 01H = 37H, and register
08H = 8AH:
In the first example, if working register R0 contains the value 15H and register R1 the value 2AH,
the statement "OR R0,R1" logical-ORs the R0 and R1 register contents and stores the result
(3FH) in destination register R0.
The other examples show the use of the logical OR instruction with the various addressing modes
and formats.
6-34
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
POP dst
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 8 50 R
8 51 IR
Examples: Given: Register 00H = 01H, register 01H = 1BH, SP (0D9H) = 0BBH, and stack register
0BBH = 55H:
In the first example, general register 00H contains the value 01H. The statement "POP 00H"
loads the contents of location 0BBH (55H) into destination register 00H and then increments the
stack pointer by one. Register 00H then contains the value 55H and the SP points to location
0BCH.
6-35
SAM88RI INSTRUCTION SET S3C9228/P9228
PUSH src
Operation: SP ¨ SP – 1
@SP ¨ src
A PUSH instruction decrements the stack pointer value and loads the contents of the source (src)
into the location addressed by the decremented stack pointer. The operation then adds the new
value to the top of the stack.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc src 2 8 70 R
8 71 IR
In the first example, if the stack pointer contains the value 0C0H, and general register 40H the
value 4FH, the statement "PUSH 40H" decrements the stack pointer from 0C0 to 0BFH. It then
loads the contents of register 40H into location 0BFH. Register 0BFH then contains the value 4FH
and SP points to location 0BFH.
6-36
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
RCF RCF
Operation: C ¨ 0
The carry flag is cleared to logic zero, regardless of its previous value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 CF
The instruction RCF clears the carry flag (C) to logic zero.
6-37
SAM88RI INSTRUCTION SET S3C9228/P9228
RET — Return
RET
Operation: PC ¨ @SP
SP ¨ SP + 2
The RET instruction is normally used to return to the previously executing procedure at the end of
a procedure entered by a CALL instruction. The contents of the location addressed by the stack
pointer are popped into the program counter. The next statement that is executed is the one that
is addressed by the new program counter value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 8 AF
The statement "RET" pops the contents of stack pointer location 0BCH (10H) into the high byte of
the program counter. The stack pointer then pops the value in location 0BDH (1AH) into the PC's
low byte and the instruction at location 101AH is executed. The stack pointer now points to
memory location 0BEH.
6-38
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
RL — Rotate Left
RL dst
7 0
C
Flags: C: Set if the bit rotated from the most significant bit position (bit 7) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 90 R
4 91 IR
Examples: Given: Register 00H = 0AAH, register 01H = 02H and register 02H = 17H:
In the first example, if general register 00H contains the value 0AAH (10101010B), the statement
"RL 00H" rotates the 0AAH value left one bit position, leaving the new value 55H (01010101B)
and setting the carry and overflow flags.
6-39
SAM88RI INSTRUCTION SET S3C9228/P9228
RLC dst
7 0
C
Flags: C: Set if the bit rotated from the most significant bit position (bit 7) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 10 R
4 11 IR
Examples: Given: Register 00H = 0AAH, register 01H = 02H, and register 02H = 17H, C = "0":
In the first example, if general register 00H has the value 0AAH (10101010B), the statement "RLC
00H" rotates 0AAH one bit position to the left. The initial value of bit 7 sets the carry flag and the
initial value of the C flag replaces bit zero of register 00H, leaving the value 55H (01010101B).
The MSB of register 00H resets the carry flag to "1" and sets the overflow flag.
6-40
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
RR — Rotate Right
RR dst
7 0
C
Flags: C: Set if the bit rotated from the least significant bit position (bit zero) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 E0 R
4 E1 IR
Examples: Given: Register 00H = 31H, register 01H = 02H, and register 02H = 17H:
In the first example, if general register 00H contains the value 31H (00110001B), the statement
"RR 00H" rotates this value one bit position to the right. The initial value of bit zero is moved to
bit 7, leaving the new value 98H (10011000B) in the destination register. The initial bit zero also
resets the C flag to "1" and the sign flag and overflow flag are also set to "1".
6-41
SAM88RI INSTRUCTION SET S3C9228/P9228
RRC dst
7 0
C
Flags: C: Set if the bit rotated from the least significant bit position (bit zero) was "1".
Z: Set if the result is "0" cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 C0 R
4 C1 IR
Examples: Given: Register 00H = 55H, register 01H = 02H, register 02H = 17H, and C = "0":
In the first example, if general register 00H contains the value 55H (01010101B), the statement
"RRC 00H" rotates this value one bit position to the right. The initial value of bit zero ("1")
replaces the carry flag and the initial value of the C flag ("1") replaces bit 7. This leaves the new
value 2AH (00101010B) in destination register 00H. The sign flag and overflow flag are both
cleared to "0".
6-42
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
SBC dst,src
f the result is the same as the sign of the source; cleared otherwise.
D: Always set to "1".
H: Cleared if there is a carry from the most significant bit of the low-order four bits of the result;
set otherwise, indicating a "borrow".
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 32 r r
6 33 r lr
Examples: Given: R1 = 10H, R2 = 03H, C = "1", register 01H = 20H, register 02H = 03H, and register
03H = 0AH:
In the first example, if working register R1 contains the value 10H and register R2 the value 03H,
the statement "SBC R1,R2" subtracts the source value (03H) and the C flag value ("1") from the
destination (10H) and then stores the result (0CH) in register R1.
6-43
SAM88RI INSTRUCTION SET S3C9228/P9228
SCF
Operation: C ¨ 1
The carry flag (C) is set to logic one, regardless of its previous value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 DF
SCF
6-44
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
SRA dst
7 6 0
C
Flags: C: Set if the bit shifted from the LSB position (bit zero) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 D0 R
4 D1 IR
Examples: Given: Register 00H = 9AH, register 02H = 03H, register 03H = 0BCH, and C = "1":
In the first example, if general register 00H contains the value 9AH (10011010B), the statement
"SRA 00H" shifts the bit values in register 00H right one bit position. Bit zero ("0") clears the C
flag and bit 7 ("1") is then shifted into the bit 6 position (bit 7 remains unchanged). This leaves the
value 0CDH (11001101B) in destination register 00H.
6-45
SAM88RI INSTRUCTION SET S3C9228/P9228
STOP
Operation:
The STOP instruction stops both the CPU clock and system clock and causes the microcontroller
to enter Stop mode. During Stop mode, the contents of on-chip CPU registers, peripheral
registers, and I/O port control and data registers are retained. Stop mode can be released by an
external reset operation or External interrupt input. For the reset operation, the RESET pin must
be held to Low level until the required oscillation stabilization interval has elapsed.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc 1 4 7F – –
STOP
6-46
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
SUB — Subtract
SUB dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 22 r r
6 23 r lr
Examples: Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
In the first example, if working register R1 contains the value 12H and if register R2 contains the
value 03H, the statement "SUB R1,R2" subtracts the source value (03H) from the destination
value (12H) and stores the result (0FH) in destination register R1.
6-47
SAM88RI INSTRUCTION SET S3C9228/P9228
TCM dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 62 r r
6 63 r lr
Examples: Given: R0 = 0C7H, R1 = 02H, R2 = 12H, register 00H = 2BH, register 01H = 02H, and register
02H = 23H:
In the first example, if working register R0 contains the value 0C7H (11000111B) and register R1
the value 02H (00000010B), the statement "TCM R0,R1" tests bit one in the destination register
for a "1" value. Because the mask value corresponds to the test bit, the Z flag is set to logic one
and can be tested to determine the result of the TCM operation.
6-48
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
TM dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always reset to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 72 r r
6 73 r lr
Examples: Given: R0 = 0C7H, R1 = 02H, R2 = 18H, register 00H = 2BH, register 01H = 02H, and register
02H = 23H:
In the first example, if working register R0 contains the value 0C7H (11000111B) and register R1
the value 02H (00000010B), the statement "TM R0,R1" tests bit one in the destination register for
a "0" value. Because the mask value does not match the test bit, the Z flag is cleared to logic zero
and can be tested to determine the result of the TM operation.
6-49
SAM88RI INSTRUCTION SET S3C9228/P9228
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always reset to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 B2 r r
6 B3 r lr
Examples: Given: R0 = 0C7H, R1 = 02H, R2 = 18H, register 00H = 2BH, register 01H = 02H, and register
02H = 23H:
In the first example, if working register R0 contains the value 0C7H and if register R1 contains the
value 02H, the statement "XOR R0,R1" logically exclusive-ORs the R1 value with the R0 value
and stores the result (0C5H) in the destination register R0.
6-50
S3C9228/P9228 CLOCK CIRCUITS
7 CLOCK CIRCUITS
OVERVIEW
The S3C9228 microcontroller has two oscillator circuits: a main clock, and a sub clock circuit. The CPU and
peripheral hardware operate on the system clock frequency supplied through these circuits. The maximum CPU
clock frequency, is determined by CLKCON register settings.
— Crystal, ceramic resonator, RC oscillation source (main clock only), or an external clock
— Oscillator stop and wake-up functions
— Programmable frequency divider for the CPU clock (fxx divided by 1, 2, 8, or 16)
— Clock circuit control register, CLKCON
— Oscillator control register, OSCCON
In this document, the following notation is used for descriptions of the CPU clock:
fx main clock
fxt sub clock
fxx selected system clock
7-1
CLOCK CIRCUITS S3C9228/P9228
XIN XTIN
XOUT XTOUT
32.768 kHz
XIN XTIN
XOUT
XTOUT
XIN
XOUT
7-2
S3C9228/P9228 CLOCK CIRCUITS
The two power-down modes, Stop mode and Idle mode, affect the system clock as follows:
— In Stop mode, the main oscillator is halted. Stop mode is released, and the oscillator started, by a reset
operation, by an external interrupt, or by an internal interrupt if sub clock is selected as the clock source
(When the fx is selected as system clock).
— In Idle mode, the internal clock signal is gated away from the CPU, but continues to be supplied to the
interrupt structure, timer A/B, and watch timer. Idle mode is released by a reset or by an external or
internal interrupts.
Stop Release
INT
Selector 1
fXX
Stop
OSCCON.3
Stop
OSCCON.0 OSCCON.2
Basic Timer
STOP OSC 1/8-1/4096 Timer/Counters
inst. Watch Timer
Frequency
Dividing LCD Controller
STPCON
Circuit
SIO
1/1 1/2 1/8 1/16 A/D Converter
CLKCON.4-.3 Selector 2
CPU
7-3
CLOCK CIRCUITS S3C9228/P9228
The system clock control register, CLKCON, is located in address D4H. It is read/write addressable and has the
following functions:
CLKCON register settings control whether or not an external interrupt can be used to trigger a Stop mode release
(This is called the “IRQ wake-up” function). The IRQ “wake-up” enable bit is CLKCON.7.
After a reset, the external interrupt oscillator wake-up function is enabled, the main oscillator is activated, and the
fx/16 (the slowest clock speed) is selected as the CPU clock. If necessary, you can then increase the CPU clock
speed to fx, fx/2, or fx/8 by setting the CLKCON, and you can change system clock from main clock to sub clock
by setting the OSCCON.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
Oscillator IRQ wake-up enable bit: Not used for S3C92228 (must keep always "0")
0 = Enable IRQ for main oscillator
wake-up function in power down Divide-by selection bits for
mode CPU clock frequency:
1 = Disable IRQ for main oscillator 00 = fxx/16
wake-up function in power down 01 = fxx/8
mode 10 = fXx/2
11 = fxx
7-4
S3C9228/P9228 CLOCK CIRCUITS
The oscillator control register, OSCCON, is located in address D3H. It is read/write addressable and has the
following functions:
OSCCON.0 register settings select Main clock or Sub clock as system clock.
After a reset, Main clock is selected for system clock because the reset value of OSCCON.0 is "0".
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
7-5
CLOCK CIRCUITS S3C9228/P9228
Data loadings in the oscillator control register, OSCCON, determine whether a main or a sub clock is selected as
the CPU clock, and also how this frequency is to be divided by setting CLKCON. This makes it possible to switch
dynamically between main and sub clocks and to modify operating frequencies.
OSCCON.0 select the main clock (fx) or the sub clock (fxt) for the system clock. OSCCON .3 start or stop main
clock oscillation, and OSCCON.2 start or stop sub clock oscillation. CLKCON.4–.3 control the frequency divider
circuit, and divide the selected fxx clock by 1, 2, 8, or 16.
For example, you are using the default system clock (normal operating mode and a main clock of fx/16) and you
want to switch from the fx clock to a sub clock and to stop the main clock. To do this, you need to set OSCCON.0
to "1", take a delay, and OSCCON.3 to "1" sequently. This switches the clock from fx to fxt and stops main clock
oscillation.
The following steps must be taken to switch from a sub clock to the main clock: first, set OSCCON.3 to "0" to
enable main system clock oscillation. Then, after a certain number of machine cycles has elapsed, select the
main clock by setting OSCCON.0 to "0".
2. This example shows how to change from sub clock to main clock:
7-6
S3C9228/P9228 CLOCK CIRCUITS
The STOP control register, STPCON, is located in address E0H. It is read/write addressable and has the
following functions:
After a reset, the STOP instruction is disabled, because the value of STPCON is "other values".
If necessary, you can use the STOP instruction by setting the value of STPCON to "10100101B".
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
7-7
CLOCK CIRCUITS S3C9228/P9228
NOTES
7-8
S3C9228/P9228 RESET and POWER-DOWN
SYSTEM RESET
OVERVIEW
During a power-on reset, the voltage at VDD goes to High level and the RESET pin is forced to Low level. The
RESET signal is input through a schmitt trigger circuit where it is then synchronized with the CPU clock. This
procedure brings S3C9228/P9228 into a known operating status.
To allow time for internal CPU clock oscillation to stabilize, the RESET pin must be held to Low level for a
minimum time interval after the power supply comes within tolerance. The minimum required oscillation
stabilization time for a reset operation is 1 millisecond.
Whenever a reset occurs during normal operation (that is, when both VDD and RESET are High level), the
RESET pin is forced Low and the reset operation starts. All system and peripheral control registers are then reset
to their default hardware values (see Table 8-1).
In summary, the following sequence of events occurs during a reset operation:
— All interrupts are disabled.
— The watchdog function (basic timer) is enabled.
— The P0.0–P0.3, P1, and P2.2–P2.3 are set to schmitt trigger input mode and all pull-up resistors are disabled
for the I/O port pin circuits.
— Peripheral control and data registers are disabled and reset to their default hardware values.
— The program counter (PC) is loaded with the program reset address in the ROM, 0100H.
— When the programmed oscillation stabilization time interval has elapsed, the instruction stored in ROM
location 0100H (and 0101H) is fetched and executed.
NOTE
To program the duration of the oscillation stabilization interval, you make the appropriate settings to the
basic timer control register, BTCON, before entering Stop mode. Also, if you do not want to use the basic
timer watchdog function (which causes a system reset if a basic timer counter overflow occurs), you can
disable it by writing '1010B' to the upper nibble of BTCON.
8-1
RESET and POWER-DOWN S3C9228/P9228
POWER-DOWN MODES
STOP MODE
Stop mode is invoked by the instruction STOP. In Stop mode, the operation of the CPU and main oscillator is
halted. All peripherals which the main oscillator is selected as a clock source stop also because main oscillator
stops. But the watch timer and LCD controller will not halted in stop mode if the sub clock is selected as watch
timer clock source. The data stored in the internal register file are retained in stop mode. Stop mode can be
released in one of three ways: by a system reset, by an internal watch timer interrupt (when sub clock is selected
as clock source of watch timer), or by an external interrupt.
Example: LD STOPCON,#10100101B
STOP
NOP
NOP
NOP
LD STOPCON,#00000000B
NOTES
1. Do not use stop mode if you are using an external clock source because XIN input must be restricted
internally to VSS to reduce current leakage.
2. In application programs, a STOP instruction must be immediately followed by at least three NOP
instructions. This ensures an adequate time interval for the clock to stabilize before the next
instruction is executed. If three or more NOP instructions are not used after STOP instruction,
leakage current could be flown because of the floating state in the internal bus.
3. To enable/disable STOP instruction, the STOPCON register should be written with
10100101B/other values before/after stop instruction.
8-2
S3C9228/P9228 RESET and POWER-DOWN
IDLE MODE
Idle mode is invoked by the instruction IDLE (opcode 6FH). In Idle mode, CPU operations are halted while some
peripherals remain active. During Idle mode, the internal clock signal is gated away from the CPU and from all
but the following peripherals, which remain active:
— Interrupt logic
— Basic timer
— Timer 1 (Timer A and B)
— Watch timer
— LCD controller
I/O port pins retain the mode (input or output) they had at the time Idle mode was entered.
1. Execute a reset. All system and peripheral control registers are reset to their default values and the contents
of all data registers are retained. The reset automatically selects the slowest clock (1/16) because of the
hardware reset value for the CLKCON register. If all external interrupts are masked in the IMR register, a
reset is the only way you can release Idle mode.
2. Activate any enabled interrupt — internal or external. When you use an interrupt to release Idle mode,
the 2-bit CLKCON.4/CLKCON.3 value remains unchanged, and the currently selected clock value is
used. The interrupt is then serviced. When the return-from-interrupt condition (IRET) occurs, the
instruction immediately following the one which initiated Idle mode is executed.
8-3
RESET and POWER-DOWN S3C9228/P9228
Table 8-1 list the values for CPU and system registers, peripheral control registers, and peripheral data registers
following a RESET operation in normal operating mode. The following notation is used in these table to represent
specific RESET values:
— A "1" or a "0" shows the RESET bit value as logic one or logic zero, respectively.
— An 'x' means that the bit value is undefined following RESET.
— A dash ('–') means that the bit is either not used or not mapped.
8-4
S3C9228/P9228 RESET and POWER-DOWN
8-5
RESET and POWER-DOWN S3C9228/P9228
NOTES
8-6
S3C9228/P9228 I/O PORTS
9 I/O PORTS
OVERVIEW
The S3C9228/P9228 microcontroller has seven bit-programmable I/O ports, P0-P6. Port 0 is 6-bit port, port 1,
port 2, and port 6 are 4-bit ports, port 3 is 2-bit port, and port 4 and port 5 are 8-bit ports. This gives a total of 36
I/O pins. Each port can be flexibly configured to meet application design requirements.
The CPU accesses ports by directly writing or reading port registers. No special I/O instructions are required. All
ports of the S3C9228/P9228 except P0.4 and P0.5 can be configured to input or output mode. All LCD signal pins
are shared with normal I/O ports.
Table 9-1 gives you a general overview of S3C9228 I/O port functions.
9-1
I/O PORTS S3C9228/P9228
Table 9-2 gives you an overview of the register locations of all seven S3C9228 I/O port data registers. Data
registers for ports 1, 2, 3, 4, 5, and 6 have the general format shown in Figure 9-1.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-2
S3C9228/P9228 I/O PORTS
PORT 0
Port 0 is an 6-bit I/O port with individually configurable pins. Port 0 pins are accessed directly by writing or
reading the port 0 data register, P0 at location E4H in page 0. P0.0-P0.3 can serve as inputs (with or without pull-
up), as outputs (push-pull or open-drain) or you can be configured the following functions.
When programming this port, please remember that any alternative peripheral I/O function you configure using
the port 0 control register must also be enabled in the associated peripheral module.
Port 0 Interrupt Enable, Pending, and Edge Selection Registers (P0INT, INTPND1.3-.0, P0EDGE)
To process external interrupts at the port 0 pins, three additional control registers are provided: the port 0
interrupt enable register P0INT (EDH, page 0), the port 0 interrupt pending bits INTPND1.3-.0 (D6H, page 0), and
the port 0 interrupt edge selection register P0EDGE (EEH, page 0).
The port 0 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending
condition when the interrupt service routine has been initiated. The application program detects interrupt requests
by polling the INTPND1.3-.0 register at regular intervals.
When the interrupt enable bit of any port 0 pin is "1", a rising or falling edge at that pin will generate an interrupt
request. The corresponding INTPND1 bit is then automatically set to "1" and the IRQ level goes low to signal the
CPU that an interrupt request is waiting. When the CPU acknowledges the interrupt request, application software
must the clear the pending condition by writing a "0" to the corresponding INTPND1 bit.
9-3
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-4
S3C9228/P9228 I/O PORTS
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-5
I/O PORTS S3C9228/P9228
PORT 1
Port 1 is an 4-bit I/O port with individually configurable pins. Port 1 pins are accessed directly by writing or
reading the port 1 data register, P1 at location E5H in page 0. P1.0-P1.3 can serve as inputs (with or without pull-
up), as outputs (push-pull or open-drain) or you can be configured the following functions.
When programming this port, please remember that any alternative peripheral I/O function you configure using
the port 1 control register must also be enabled in the associated peripheral module.
Port 1 Interrupt Enable, Pending, and Edge Selection Registers (P1INT, INTPND1.7-.4, P1EDGE)
To process external interrupts at the port 1 pins, three additional control registers are provided: the port 1
interrupt enable register P1INT (F1H, page 0), the port 1 interrupt pending bits INTPND1.7-.4 (D6H, page 0), and
the port 1 interrupt edge selection register P1EDGE (F2H, page 0).
The port 1 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending
condition when the interrupt service routine has been initiated. The application program detects interrupt requests
by polling the INTPND1.7-.4 register at regular intervals.
When the interrupt enable bit of any port 1 pin is "1", a rising or falling edge at that pin will generate an interrupt
request. The corresponding INTPND1 bit is then automatically set to "1" and the IRQ level goes low to signal the
CPU that an interrupt request is waiting. When the CPU acknowledges the interrupt request, application software
must the clear the pending condition by writing a "0" to the corresponding INTPND1 bit.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-6
S3C9228/P9228 I/O PORTS
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-7
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-8
S3C9228/P9228 I/O PORTS
PORT 2
Port 2 is an 4-bit I/O port with individually configurable pins. Port 2 pins are accessed directly by writing or
reading the port 2 data register, P2 at location E6H in page 0. P2.0-P2.3 can serve as inputs (with or without pull-
up), as outputs (push-pull or open-drain) or you can be configured the following functions.
When programming this port, please remember that any alternative peripheral I/O function you configure using
the port 2 control register must also be enabled in the associated peripheral module.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-9
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-10
S3C9228/P9228 I/O PORTS
PORT 3
Port 3 is an 2-bit I/O port with individually configurable pins. Port 3 pins are accessed directly by writing or
reading the port 3 data register, P3 at location E7H in page 0. P3.0-P3.1 can serve as inputs (with or without pull-
up, and high impedance input), as outputs (push-pull or open-drain) or you can be configured the following
functions.
Port 3 Interrupt Enable, Pending, and Edge Selection Registers(P3INT, INTPND2.5-.4, P3EDGE)
To process external interrupts at the port 3 pins, three additional control registers are provided: the port 3
interrupt enable register P3INT (F7H, page 0), the port 3 interrupt pending bits INTPND2.5-.4 (D7H, page 0), and
the port 3 interrupt edge selection register P3EDGE (F8H, page 0).
The port 3 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending
condition when the interrupt service routine has been initiated. The application program detects interrupt requests
by polling the INTPND2.5-.4 register at regular intervals.
When the interrupt enable bit of any port 3 pin is "1", a rising or falling edge at that pin will generate an interrupt
request. The corresponding INTPND2 bit is then automatically set to "1" and the IRQ level goes low to signal the
CPU that an interrupt request is waiting. When the CPU acknowledges the interrupt request, application software
must the clear the pending condition by writing a "0" to the corresponding INTPND2 bit.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-11
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-12
S3C9228/P9228 I/O PORTS
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-13
I/O PORTS S3C9228/P9228
PORT 4
Port 4 is an 8-bit I/O port with individually configurable pins. Port 4 pins are accessed directly by writing or
reading the port 4 data register, P4 at location E8H in page 0. P4.0-P4.7 can serve as inputs or as push-pull,
open-drain outputs. You can configure the following alternative functions with LCD port control register, LPOT:
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
9-14
S3C9228/P9228 I/O PORTS
PORT 5
Port 5 is an 8-bit I/O port with individually configurable pins. Port 5 pins are accessed directly by writing or
reading the port 5 data register, P5 at location E9H in page 0. P5.0-P5.7 can serve as inputs or as push-pull,
open-drain outputs. You can configure the following alternative functions with LCD port control register, LPOT:
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
P5.6/SEG18/COM5 P5.4/SEG16/COM7
P5.7/SEG19/COM4 P5.5/SEG17/COM6
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
9-15
I/O PORTS S3C9228/P9228
PORT 6
Port 6 is an 4-bit I/O port with individually configurable pins. Port 6 pins are accessed directly by writing or
reading the port 6 data register, P6 at location EAH in page 0. P6.0-P6.3 can serve as inputs or as push-pull,
open-drain outputs. You can configure the following alternative functions with LCD port control register, LPOT:
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
9-16
S3C9228/P9228 (Preliminary Spec) BASIC TIMER
10 BASIC TIMER
OVERVIEW
— As a watchdog timer to provide an automatic reset mechanism in the event of a system malfunction.
— To signal the end of the required oscillation stabilization interval after a reset or a stop mode release.
— Clock frequency divider (f xx divided by 4096, 1024, 128, or 16) with multiplexer
— 8-bit basic timer counter, BTCNT (DDH, read-only)
— Basic timer control register, BTCON (DCH, read/write)
10-1
BASIC TIMER S3C9228/P9228 (Preliminary Spec)
The basic timer control register, BTCON, is used to select the input clock frequency, to clear the basic timer
counter and frequency dividers, and to enable or disable the watchdog timer function. It is located in page 0,
address DCH, and is read/write addressable using Register addressing mode.
A reset clears BTCON to "00H". This enables the watchdog function and selects a basic timer clock frequency of
f xx/4096. To disable the watchdog function, you must write the signature code “1010B” to the basic timer register
control bits BTCON.7–BTCON.4.
The 8-bit basic timer counter, BTCNT (page 0, DDH), can be cleared at any time during normal operation by
writing a "1" to BTCON.1. To clear the frequency dividers for the basic timer input clock and timer counters, you
write a "1" to BTCON.0.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
10-2
S3C9228/P9228 (Preliminary Spec) BASIC TIMER
A reset whenever a basic timer counter overflow occurs. During normal operation, the application program must
prevent the overflow, and the accompanying reset operation, from occurring. To do this, the BTCNT value must
be cleared (by writing a "1" to BTCON.1) at regular intervals.
If a system malfunction occurs due to circuit noise or some other error condition, the BT counter clear operation
will not be executed and a basic timer overflow will occur, initiating a reset. In other words, during normal
operation, the basic timer overflow loop (a bit 7 overflow of the 8-bit basic timer counter, BTCNT) is always
broken by a BTCNT clear instruction. If a malfunction does occur, a reset is triggered automatically.
In stop mode, whenever a reset or an internal and an external interrupt occurs, the oscillator starts. The BTCNT
value then starts increasing at the rate of fxx/4096 (for reset), or at the rate of the preset clock source (for an
internal and an external interrupt). When BTCNT.3 overflows, a signal is generated to indicate that the
stabilization interval has elapsed and to gate the clock signal off to the CPU so that it can resume normal
operation.
1. During stop mode, a power-on reset or an internal and an external interrupt occurs to trigger the stop mode
release and oscillation starts.
2. If a power-on reset occurred, the basic timer counter will increase at the rate of fxx/4096. If an internal and an
external interrupt is used to release stop mode, the BTCNT value increases at the rate of the preset clock
source.
3. Clock oscillation stabilization interval begins and continues until bit 3 of the basic timer counter overflows.
4. When a BTCNT.3 overflow occurs, normal CPU operation resumes.
10-3
BASIC TIMER S3C9228/P9228 (Preliminary Spec)
RESET or STOP
Bit 1
fXX/1024
8-Bit Up Counter
fXX DIV MUX OVF
fXX/128 (BTCNT, Read-Only) RESET
fXX/16
Start the CPU (note)
R
Bit 0
NOTE: During a power-on reset operation, the CPU is idle during the required oscillation
stabilization interval (until bit 4 of the basic timer counter overflows).
10-4
S3C9228/P9228 TIMER 1
11 TIMER 1
The 16-bit timer 1 is used in one 16-bit timer or two 8-bit timers mode. If TACON.7 is set to "1", timer 1 is used
as a 16-bit timer. If TACON.7 is set to "0", timer 1 is used as two 8-bit timers.
OVERVIEW
The 16-bit timer 1 is an 16-bit general-purpose timer. Timer 1 has the interval timer mode by using the
appropriate TACON setting.
— Clock frequency divider (fxx divided by 512, 256, 64, 8, or 1, fxt, and T1CLK: External clock) with multiplexer
— 16-bit counter (TACNT, TBCNT), 16-bit comparator, and 16-bit reference data register (TADATA, TBDATA)
— Timer 1 match interrupt generation
— Timer 1 control register, TACON (page 0, BBH, read/write)
FUNCTION DESCRIPTION
The T1INT pending condition should be cleared by software when it has been serviced. Even though T1INT is
disabled, the application's service routine can detect a pending condition of T1INT by the software and execute
it's sub-routine. When this case is used, the T1INT pending bit must be cleared by the application sub-routine by
writing a "0" to the INTPND2.0 pending bit.
In interval timer mode, a match signal is generated when the counter value is identical to the values written to
the timer 1 reference data registers, TADATA and TBDATA. The match signal generates a timer 1 match
interrupt and clears the counter.
If, for example, you write the value 32H and 10H to TADATA and TBDATA, respectively, and 8EH to TACON,
the counter will increment until it reaches 3210H. At this point, the timer 1 interrupt request is generated, the
counter value is reset, and counting resumes.
11-1
TIMER 1 S3C9228/P9228
TACON is located in page 0, at address BBH, and is read/write addressable using register addressing mode.
A reset clears TACON to "00H". This sets timer 1 to disable interval timer mode, selects an input clock frequency
of fxx/512, and disables timer 1 interrupt. You can clear the timer 1 counter at any time during normal operation
by writing a "1" to TACON.3.
To enable the timer 1 interrupt, you must write TACON.7, TACON.2, and TACON.1 to "1".
To generate the exact time interval, you should write TACON.3 and INTPND2.0, which cleared counter and
interrupt pending bit. To detect an interrupt pending condition when T1INT is disabled, the application program
polls pending bit, INTPND.2.0. When a "1" is detected, a timer 1 interrupt is pending. When the T1INT sub-
routine has been serviced, the pending condition must be cleared by software by writing a "0" to the timer 1
interrupt pending bit, INTPND2.0.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
11-2
S3C9228/P9228 TIMER 1
BTCON.0 TACON.6-.4
R 1/512
Match Signal
Counter clear signal
TBDATA TADATA
Data Bus
NOTE: When one 16-bit timer mode (TACON.7 <- "1": Timer 1)
11-3
TIMER 1 S3C9228/P9228
OVERVIEW
The 8-bit timer A and B are the 8-bit general-purpose timers. Timer A and B have the interval timer mode by
using the appropriate TACON and TBCON setting, respectively.
— Enable the timer A (interval timer mode) and B operating (interval timer mode)
— Select the timer A and B input clock frequency
— Clear the timer A and B counter, TACNT and TBCNT
— Enable the timer A and B interrupt
11-4
S3C9228/P9228 TIMER 1
TACON and TBCON are located in page 0, at address BBH and BAH, and is read/write addressable using
register addressing mode.
A reset clears TACON to "00H". This sets timer A to disable interval timer mode, selects an input clock frequency
of fxx/512, and disables timer A interrupt. You can clear the timer A counter at any time during normal operation
by writing a "1" to TACON.3.
A reset clears TBCON to "00H". This sets timer B to disable interval timer mode, selects an input clock frequency
of fxx/512, and disables timer A interrupt. You can clear the timer B counter at any time during normal operation
by writing a "1" to TBCON.3.
To enable the timer A interrupt (TAINT) and timer B interrupt (TBINT), you must write TACON.7 to "0", TACON.2
(TBCON.2) and TACON.1 (TBCON.1) to "1". To generate the exact time interval, you should write TACON.3
(TBCON.3) and INTPND2.0 (INTPND2.1), which cleared counter and interrupt pending bit. To detect an interrupt
pending condition when TAINT and TBINT is disabled, the application program polls pending bit, INTPND2.0 and
INTPND2.1. When a "1" is detected, a timer A interrupt (TAINT) and timer B interrupt (TBINT) is pending. When
the TAINT and TBINT sub-routine has been serviced, the pending condition must be cleared by software by
writing a "0" to the timer A and B interrupt pending bit, INTPND2.0 and INTPND2.1.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
11-5
TIMER 1 S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
11-6
S3C9228/P9228 TIMER 1
FUNCTION DESCRIPTION
The timer A match interrupt pending condition (INTPND2.0) and the timer B match interrupt pending condition
(INTPND2.1) must be cleared by software in the application's interrupt service by means of writing a "0" to the
INTPND2.0 and INTPND2.1 interrupt pending bit.
Even though TAINT and TBINT are disabled, the application's service routine can detect a pending condition of
TAINT and TBINT by the software and execute it's sub-routine. When this case is used, the TAINT and TBINT
pending bit must be cleared by the application sub-routine by writing a "0" to the corresponding pending bit
INTPND2.0 and INTPND2.1.
In interval timer mode, a match signal is generated when the counter value is identical to the values written to
the timer A or timer B reference data registers, TADATA or TBDATA. The match signal generates corresponding
match interrupt and clears the counter.
If, for example, you write the value 20H to TADATA and 0EH to TACON, the counter will increment until it
reaches 20H. At this point, the timer A interrupt request is generated, the counter value is cleared, and counting
resumes and you write the value 10H to TBDATA, "0" to TACON.7, and 0EH to TBCON, the counter will
increment until it reaches 10H. At this point, TB interrupt request is generated, the counter value is cleared and
counting resumes.
11-7
TIMER 1 S3C9228/P9228
BTCON.0 TACON.6-.4
R 1/512
Match Signal
Counter Clear Signal
TADATA Register
Data Bus
NOTE: When two 8-bit timers mode (TACON.7 <- "0": Timer A)
11-8
S3C9228/P9228 TIMER 1
BTCON.0 TBCON.6-.4
R
1/512
Data Bus TBCON.3
1/256 M TBCON.2
(XIN or XTIN) LSB MSB
fxx DIV 1/64 Clear
U TBCNT
1/8 (8-Bit Up-Counter) R TBCON.1
X
1/1 Match
LSB MSB
TBDATA Buffer
Match Signal
Counter Clear Signal
TBDATA Register
Data Bus
NOTE: When two 8-bit timers mode (TACON.7 <- "0": Timer B)
11-9
TIMER 1 S3C9228/P9228
NOTES
11-10
S3C9228/P9228 WATCH TIMER
12 WATCH TIMER
OVERVIEW
Watch timer functions include real-time and watch-time measurement and interval timing for the system clock.
To start watch timer operation, set bit 1 of the watch timer control register, WTCON.1 to "1".
And if you want to service watch timer overflow interrupt, then set the WTCON.6 to “1”.
The watch timer overflow interrupt pending condition (INTPND2.3) must be cleared by software in the
application's interrupt service routine by means of writing a "0" to the INTPND2.3 interrupt pending bit.
After the watch timer starts and elapses a time, the watch timer interrupt pending bit (INTPND2.3) is
automatically set to "1", and interrupt requests commence in 3.91ms, 0.25, 0.5 and 1-second intervals by setting
Watch timer speed selection bits (WTCON.3 – .2).
The watch timer can generate a steady 0.5 kHz, 1 kHz, 2 kHz, or 4 kHz signal to BUZ output pin for Buzzer. By
setting WTCON.3 and WTCON.2 to "11b", the watch timer will function in high-speed mode, generating an
interrupt every 3.91 ms. High-speed mode is useful for timing events for program debugging sequences.
Also, you can select watch timer clock source by setting the WTCON.7 appropriately value.
The watch timer supplies the clock frequency for the LCD controller (fLCD ). Therefore, if the watch timer is
disabled, the LCD controller does not operate.
12-1
WATCH TIMER S3C9228/P9228
The watch timer control register, WTCON is used to select the input clock source, the watch timer interrupt time
and Buzzer signal, to enable or disable the watch timer function. It is located in page 0 at address DAH, and is
read/write addressable using register addressing mode.
A reset clears WTCON to "00H". This disable the watch timer and select fx/128 as the watch timer clock.
So, if you want to use the watch timer, you must write appropriate value to WTCON.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
12-2
S3C9228/P9228 WATCH TIMER
WTCON.7
WTCON.6 WT INT Enable BUZ (P0.3)
WTCON.6
WTCON.5
MUX
WTCON.4 WTINT
8 fW/64 (0.5 kHz)
WTCON.3 fW/32 (1 kHz)
fW/16 (2 kHz)
WTCON.2 fW/8 (4 kHz)
Enable/Disable
WTCON.1 Selector
INTPND2.3
Circuit
WTCON.0
fW/27
fW/213
Frequency
Clock fW fW/214
Dividing
Selector fW/215 (1 Hz)
32.768 kHz Circuit
fLCD = 2048 Hz
fxt fx/128
fX = Main clock (where fx = 4.19 MHz)
fxt = Sub clock (32,768 Hz)
fW = Watch timer frequency
12-3
WATCH TIMER S3C9228/P9228
NOTES
12-4
S3C9228/P9228 LCD CONTROLLER/DRIVER
13 LCD CONTROLLER/DRIVER
OVERVIEW
The S3C9228/P9228 microcontroller can directly drive an up-to-128-dot (16segments x 8 commons) LCD panel.
Its LCD block has the following components:
— LCD controller/driver
— Display RAM for storing display data
— 16 segment output pins (SEG0–SEG15)
— 8 common output pins (COM0–COM7)
— Internal resistor circuit for LCD bias
To use the LCD controller, bit 2 in the watch mode register WMOD must be set to 1 because LCDCK is supplied
by the watch timer.
The LCD mode control register, LMOD, is used to turn the LCD display on or off, to select LCD clock frequency,
to turn the COM signal output on or off, to select bias and duty, and to switch the port 3 high impedance or
normal I/O port. Data written to the LCD display RAM can be transferred to the segment signal pins automatically
without program control.
The LCD port control register, LPOT, is used to determine the LCD signal pins used for display output.
When a sub clock is selected as the LCD clock source, the LCD display is enabled even during main clock stop
and idle modes.
COM0-COM3
4
Data BUS
LCD
COM4/SEG19-
Controller/
COM7/SEG16
8 Driver 4
SEG0/P2.1-
SEG15/P5.3
16
13-1
LCD CONTROLLER/DRIVER S3C9228/P9228
Port 16
Latch
SEG15/P5.3
SEG
Control
Display
160 16
RAM MUX
or
(Page1)
4 Selector
SEG0/P2.1
Data BUS
LPOT
fLCD
COM COM7/SEG16/P5.4
Timing Control
Controller or
selector COM4/SEG19/P5.7
COM3/P6.0
Port 8 COM
Latch Control
COM0/P6.3
LCD
LMOD Voltage
Control
P3.1/INTP/SEG2
Port Port 3
Latch 2 Control
P3.0/INTP/SEG3
13-2
S3C9228/P9228 LCD CONTROLLER/DRIVER
COM0 b0
COM1 b1
COM2 b2
COM3 b3
100H 101H 102H 103H 111H 112H 113H
COM4 b4
COM5 b5
COM6 b6
COM7 b7
13-3
LCD CONTROLLER/DRIVER S3C9228/P9228
A LMOD is located in page 0, at address FEH, and is read/write addressable using register addressing mode. It
has the following control functions.
The LMOD register is used to turn the LCD display on/off, to select duty and bias, to select LCD clock, to control
port 3 high impedance/normal I/O port, and to turn the COM signal output on/off. Following a RESET, all LMOD
values are cleared to "0". This turns off the LCD display, select 1/3 duty and 1/3 bias, and select 256Hz for LCD
clock.
The LCD clock signal determines the frequency of COM signal scanning of each segment output. This is also
referred as the LCD frame frequency. Since the LCD clock is generated by watch timer clock (fw). The watch
timer should be enabled when the LCD display is turned on.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
13-4
S3C9228/P9228 LCD CONTROLLER/DRIVER
The LCD port control register LPOT is used to control LCD signal pins or normal I/O pins. Following a RESET, a
LPOT values are cleared to "0".
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
13-5
LCD CONTROLLER/DRIVER S3C9228/P9228
The common signal output pin selection (COM pin selection) varies according to the selected duty cycle.
The 19 LCD segment signal pins are connected to corresponding display RAM locations at page 1. Bits of the
display RAM are synchronized with the common signal output pins.
When the bit value of a display RAM location is "1", a select signal is sent to the corresponding segment pin.
When the display bit is "0", a 'no-select' signal to the corresponding segment pin.
13-6
S3C9228/P9228 LCD CONTROLLER/DRIVER
COM0 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
COM1 VDD
COM2 FR VSS
COM3
COM4 1 Frame
COM5
COM6
COM7 VDD
S S S S S
VLC1
E E E E E
G G G G G COM0 VLC2 (VLC3)
0 1 2 3 4 VLC4
VSS
VDD
VLC1
COM1 VLC2 (VLC3)
VLC4
VSS
VDD
VLC1
COM2 VLC2 (VLC3)
VLC4
VSS
VDD
VLC1
SEG0 VLC2 (VLC3)
VLC4
VSS
+ VDD
+ 1/4VLCD
SEG0-COM0 0V
- 1/4VLCD
-VLCD
13-7
LCD CONTROLLER/DRIVER S3C9228/P9228
SEG0
SEG1
0 1 2 3 0 1 2 3
VDD
COM0 VSS
1 Frame
COM1
COM2 VDD
VLC1(VLC2)
COM0
COM3 VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM1
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM2
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM3
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG0
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG1
VLC3(VLC4)
VSS
+ VLCD
+ 1/3 VLCD
COM0-SEG0 0V
- 1/3 V LCD
- VLCD
13-8
S3C9228/P9228 LCD CONTROLLER/DRIVER
0 1 2 0 1 2
VDD
COM0 VSS
1 Frame
VDD
COM1 VLC1(VLC2)
COM0
VLC3(VLC4)
COM2
VSS
VDD
VLC1(VLC2)
COM1
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM2
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG0
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG1
VLC3(VLC4)
VSS
+ VLCD
+ 1/3 VLCD
COM0-SEG0 0V
- 1/3 VLCD
- VLCD
13-9
LCD CONTROLLER/DRIVER S3C9228/P9228
NOTES
13-10
S3C9228/P9228 A/D CONVERTER
OVERVIEW
The 10-bit A/D converter (ADC) module uses successive approximation logic to convert analog levels entering at
one of the four input channels to equivalent 10-bit digital values. The analog input level must lie between the
AVREF and AVSS values. The A/D converter has the following components:
FUNCTION DESCRIPTION
To initiate an analog-to-digital conversion procedure, at first you must set with alternative function for ADC input
enable at port 1, the pin set with alternative function can be used for ADC analog input. And you write the
channel selection data in the A/D converter control register ADCON.4–.5 to select one of the four analog input
pins (AD0–3) and set the conversion start or enable bit, ADCON.0. The read-write ADCON register is located in
page 0, at address D0H. The pins which are not used for ADC can be used for normal I/O.
During a normal conversion, ADC logic initially sets the successive approximation register to 800H (the
approximate half-way point of an 10-bit register). This register is then updated automatically during each
conversion step. The successive approximation block performs 10-bit conversions for one input channel at a
time. You can dynamically select different channels by manipulating the channel selection bit value (ADCON.5–
4) in the ADCON register. To start the A/D conversion, you should set the enable bit, ADCON.0. When a
conversion is completed, ADCON.3, the end-of-conversion(EOC) bit is automatically set to 1 and the result is
dumped into the ADDATAH/ADDATAL register where it can be read. The A/D converter then enters an idle state.
Remember to read the contents of ADDATAH/ADDATAL before another conversion starts. Otherwise, the
previous result will be overwritten by the next conversion result.
NOTE
Because the A/D converter has no sample-and-hold circuitry, it is very important that fluctuation in the analog
level at the AD0–AD3 input pins during a conversion procedure be kept to an absolute minimum. Any change in
the input level, perhaps due to noise, will invalidate the result. If the chip enters to STOP or IDLE mode in
conversion process, there will be a leakage current path in A/D block. You must use STOP or IDLE mode after
ADC operation is finished.
14-1
A/D CONVERTER S3C9228/P9228
CONVERSION TIMING
The A/D conversion process requires 4 steps (4 clock edges) to convert each bit and 10 clocks to set-up A/D
conversion. Therefore, total of 50 clocks are required to complete an 10-bit conversion: When fxx/8 is selected
for conversion clock with an 4.5 MHz fxx clock frequency, one clock cycle is 1.78 us. Each bit conversion
requires 4 clocks, the conversion rate is calculated as follows:
4 clocks/bit × 10-bit + set-up time = 50 clocks, 50 clock × 1.78 us = 89 us at 0.56 MHz (4.5 MHz/8)
Note that A/D converter needs at least 25µs for conversion time.
The A/D converter control register, ADCON, is located at address D0H in page 0. It has three functions:
After a reset, the start bit is turned off. You can select only one analog input channel at a time. Other analog
input pins (AD0–AD3) can be selected dynamically by manipulating the ADCON.4–5 bits. And the pins not used
for analog input can be used for normal I/O function.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
14-2
S3C9228/P9228 A/D CONVERTER
In the ADC function block, the analog input voltage level is compared to the reference voltage. The analog input
level must remain within the range VSS to VDD.
Different reference voltage levels are generated internally along the resistor tree during the analog conversion
process for each conversion step. The reference voltage level for the first conversion bit is always 1/2 VDD.
BLOCK DIAGRAM
ADCON.2-.1
ADCON.4-5
(Select one input pin of the assigned pins)
Clock To ADCON.3
Selector (EOC Flag)
ADCON.0
(AD/C Enable)
M Analog
Input Pins - Successive
Comparator
AD0-AD3 U Approximation
(P1.0-P1.3) .. + Logic & Register
. X
ADCON.0
(AD/C Enable)
P1CON
(Assign Pins to ADC Input) Conversion Result
10-bit D/A VDD
(ADDATAH/ADDATAL,
Converter VSS D1H/D2H, Page 0)
14-3
A/D CONVERTER S3C9228/P9228
VDD
Analog AD0-AD3
Input Pin
(VSS ≤ ADC input ≤ VDD) C 101 S3C9228
Figure 14-4. Recommended A/D Converter Circuit for Highest Absolute Accuracy
14-4
S3C9228/P9228 SERIAL I/O INTERFACE
OVERVIEW
Serial I/O modules, SIO can interface with various types of external device that require serial data transfer. The
components of SIO function block are:
The SIO module can transmit or receive 8-bit serial data at a frequency determined by its corresponding control
register settings. To ensure flexible data transmission rates, you can select an internal or external clock source.
PROGRAMMING PROCEDURE
1. Configure the I/O pins at port (SCK/SI/SO) by loading the appropriate value to the P2CON register if
necessary.
2. Load an 8-bit value to the SIOCON control register to properly configure the serial I/O module. In this
operation, SIOCON.2 must be set to "1" to enable the data shifter.
3. For interrupt generation, set the serial I/O interrupt enable bit (SIOCON) to "1".
4. When you transmit data to the serial buffer, write data to SIODATA and set SIOCON.3 to 1, the shift
operation starts.
5. When the shift operation (transmit/receive) is completed, the SIO pending bit (INTPND2.2) are set to "1" and
SIO interrupt request is generated.
15-1
SERIAL I/O INTERFACE S3C9228/P9228
The control register for serial I/O interface module, SIOCON, is located at E1H in page 0. It has the control
setting for SIO module.
A reset clears the SIOCON value to "00H". This configures the corresponding module with an internal clock
source at the SCK, selects receive-only operating mode, and clears the 3-bit counter. The data shift operation
and the interrupt are disabled. The selected data direction is MSB-first.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
15-2
S3C9228/P9228 SERIAL I/O INTERFACE
The prescaler register for serial I/O interface module, SIOPS, are located at E3H in page 0.
The value stored in the SIO pre-scale register, SIOPS, lets you determine the SIO clock rate (baud rate) as
follows:
Baud rate = Input clock (fxx/4)/(Prescaler value + 1), or SCK input clock.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
SIOCON.4 SIOCON.2
(Edge Select) (Shift Enable)
M SIOCON.5
SCK (Mode Select)
SIOPS (E3H, page 0) U CLK 8-Bit SIO Shift Buffer
SO
fxx/2 8-bit P.S. 1/2 (SIODATA, E2H, page 0)
X
SIOCON.6
(LSB/MSB First
Mode Select)
8
SI
Data Bus
15-3
SERIAL I/O INTERFACE S3C9228/P9228
SCK
Transmit
SIO INT
Complete
Set SIOCON.3
Figure 15-4. Serial I/O Timing in Transmit/Receive Mode (Tx at falling, SIOCON.4 = 0)
SCK
Transmit
SIO INT
Complete
Set SIOCON.3
Figure 15-5. Serial I/O Timing in Transmit/Receive Mode (Tx at rising, SIOCON.4 = 1)
15-4
S3C9228/P9228 ELECTRICAL DATA
16 ELECTRICAL DATA
OVERVIEW
In this chapter, S3C9228/P9228 electrical characteristics are presented in tables and graphs. The information is
arranged in the following order:
16-1
ELECTRICAL DATA S3C9228/P9228
(TA = 25°C)
Parameter Symbol Conditions Rating Unit
Supply voltage VDD – – 0.3 to + 6.5 V
Input voltage VIN Ports 0–6 – 0.3 to VDD + 0.3 V
Output voltage VO – – 0.3 to VDD + 0.3 V
Output current High I OH One I/O pin active – 15 mA
All I/O pins active – 60
Output current Low I OL One I/O pin active + 30 mA
Total pin current for ports + 100
Operating TA – – 25 to + 85 °C
temperature
Storage TSTG – – 65 to + 150 °C
temperature
16-2
S3C9228/P9228 ELECTRICAL DATA
16-3
ELECTRICAL DATA S3C9228/P9228
NOTES:
1. Supply current does not include current drawn through internal pull-up resistors, LCD voltage dividing resistors, and
ADC.
2. IDD1 and IDD2 include power consumption for subsystem clock oscillation.
3. IDD3 and IDD4 are current when main system clock oscillation stops and the subsystem clock is used.
4. IDD5 is current when main system clock and subsystem clock oscillation stops.
16-4
S3C9228/P9228 ELECTRICAL DATA
(TA = – 25 °C to + 85 °C)
Parameter Symbol Conditions Min Typ Max Unit
Data retention supply VDDDR – 2.0 – 5.5 V
voltage
Data retention supply IDDDR Stop mode, TA = 25 °C – – 1 µA
current VDDDR = 2.0 V
Idle Mode
(Basic Timer Active)
~
~
Stop Mode
Normal
Data Retention Mode Operating Mode
~
~
VDD
VDDDR
Execution of 0.8 VDD
STOP Instruction
tWAIT
Figure 16-1. Stop Mode Release Timing When Initiated by an External Interrupt
16-5
ELECTRICAL DATA S3C9228/P9228
RESET Oscillation
Occurs Stabilization
TIme
~
~
Stop Mode
Normal
~ Data Retention Mode Operating Mode
VDD
~
VDDDR
Execution of
STOP Instrction
RESET
0.8 VDD
16-6
S3C9228/P9228 ELECTRICAL DATA
16-7
ELECTRICAL DATA S3C9228/P9228
tINTL tINTH
16-8
S3C9228/P9228 ELECTRICAL DATA
tRSL
RESET
0.2 VDD
tKCY
tKL tKH
SCK
0.8VDD
0.2VDD
tSIK tKSI
0.8VDD
SI
0.2VDD
tKSO
SO Output Data
16-9
ELECTRICAL DATA S3C9228/P9228
XOUT
XOUT
XOUT
XOUT
XOUT
16-10
S3C9228/P9228 ELECTRICAL DATA
1/fx
tXL tX
XIN VDD-0.1 V
0.1 V
16-11
ELECTRICAL DATA S3C9228/P9228
1/fxt
tXTL tXTH
XTIN
VDD-0.1 V
0.1 V
16-12
S3C9228/P9228 ELECTRICAL DATA
2 MHz 8 MHz
400 kHz
1 2 6
2.7 5.5
Supply Voltage (V)
16-13
ELECTRICAL DATA S3C9228/P9228
NOTES
16-14
S3C9228/P9228 MECHANICAL DATA
17 MECHANICAL DATA
OVERVIEW
The S3C9228/P9228 microcontroller is currently available in a 42-pin SDIP and 44-pin QFP package.
15.24
42-SDIP-600
- 0 .1
.05
5
0.2+0
#1 #21
5.08 MAX
0.2
39.50 MAX
3.50 ±
39.10 ± 0.2
0.51 MIN
3.30 ± 0.3
0.50 ± 0.1
17-1
MECHANICAL DATA S3C9228/P9228
13.20 ± 0.3
0-8
10.00 ± 0.2 + 0.10
0.15 - 0.05
10.00 ± 0.2
13.20 ± 0.3
0.80 ± 0.20
#44
#1 + 0.10
0.35 - 0.05
0.05 MIN
0.80 (1.00)
2.05 ± 0.10
2.30 MAX
17-2
S3C9228/P9228 S3P9228 OTP
18 S3P9228 OTP
OVERVIEW
The S3P9228 single-chip CMOS microcontroller is the OTP (One Time Programmable) version of the S3C9228
microcontroller. It has an on-chip OTP ROM instead of masked ROM. The EPROM is accessed by serial data
format.
The S3P9228 is fully compatible with the S3C9228, both in function and in pin configuration. Because of its
simple programming requirements, the S3P9228 is ideal for use as an evaluation chip for the S3C9228.
COM4/SEG19/P5.7
P0.0/TAOUT/INT
P0.1/T1CLK/INT
P0.3/BUZ/INT
COM0/P6.3
COM1/P6.2
COM2/P6.1
COM3/P6.0
P0.2/INT
P0.5
P0.4
44
43
42
41
40
39
38
37
36
35
34
P1.0/AD0/INT 1 33 COM5/SEG18/P5.6
P1.1/AD1/INT 2 32 COM6/SEG17/P5.5
SDAT/P1.2/AD2/INT 3 31 COM7/SEG16/P5.4
SCLK/P1.3/AD3/INT 4 30 SEG15/P5.3
VDD/VDD 5 S3C9228 29 SEG14/P5.2
VSS/VSS 6 28 SEG13/P5.1
XOUT 7 (44-QFP) 27 SEG12/P5.0
XIN 8 26 SEG11/P4.7
VPP/TEST 9 25 SEG10/P4.6
XTIN 10 24 SEG9/P4.5
XTOUT 11 23 SEG8/P4.4
12
13
14
15
16
17
18
19
20
21
22
SEG1/P2.0/SCK
SEG0/P2.1/SO
SEG2/P3.1/INTP
SEG3/P3.0/INTP
SEG4/P4.0
SEG5/P4.1
SEG6/P4.2
SEG7/P4.3
RESET/RESET
P2.2/SI
P2.3
RESET
18-1
S3P9228 OTP S3C9228/P9228
COM1/P6.2 1 42 COM2/P6.1
COM0/P6.3 2 41 COM3/P6.0
P0.0/TAOUT/INT 3 40 COM4/SEG19/P5.7
P0.1/T1CLK/INT 4 39 COM5/SEG18/P5.6
P0.2/INT 5 38 COM6/SEG17/P5.5
P0.3/BUZ/INT 6 37 COM7/SEG16/P5.4
P1.0/AD0/INT 7 36 SEG15/P5.3
P1.1/AD1/INT 8 35 SEG14/P5.2
S3C9228
(42-SDIP)
SDAT/P1.2/AD2/INT 9 34 SEG13/P5.1
SCLK/P1.3/AD3/INT 10 33 SEG12/P5.0
VDD/VDD 11 32 SEG11/P4.7
VSS/VSS 12 31 SEG10/P4.6
XOUT 13 30 SEG9/P4.5
XIN 14 29 SEG8/P4.4
VPP/TEST 15 28 SEG7/P4.3
XTIN 16 27 SEG6/P4.2
XTOUT 17 26 SEG5/P4.1
RESET /RESET 18 25 SEG4/P4.0
P2.3 19 24 SEG3/P3.0/INTP
P2.2/SI 20 23 SEG2/P3.1/INTP
SEG0/P2.1/SO 21 22 SEG1/P2.0/SCK
18-2
S3C9228/P9228 S3P9228 OTP
When 12.5 V is supplied to the VPP(TEST) pin of the S3P72C8, the EPROM programming mode is entered.
The operating mode (read, write, or read protection) is selected according to the input signals to the pins listed in
Table 17-3 below.
18-3
S3P9228 OTP S3C9228/P9228
NOTES:
1. Supply current does not include current drawn through internal pull-up resistors, LCD voltage dividing resistors, and
ADC.
2. IDD1 and IDD2 include power consumption for subsystem clock oscillation.
3. IDD3 and IDD4 are current when main system clock oscillation stops and the subsystem clock is used.
4. IDD5 is current when main system clock and subsystem clock oscillation stops.
18-4
S3C9228/P9228 S3P9228 OTP
2 MHz 8 MHz
400 kHz
1 2 6
2.7 5.5
Supply Voltage (V)
18-5
S3P9228 OTP S3C9228/P9228
NOTES
18-6
S3C9228/P9228 DEVELOPMENT TOOLS
19 DEVELOPMENT TOOLS
OVERVIEW
Samsung provides a powerful and easy-to-use development support system in turn key form. The development
support system is configured with a host system, debugging tools, and support software. For the host system, any
standard computer that operates with MS-DOS as its operating system can be used. One type of debugging tool
including hardware and software is provided: the sophisticated and powerful in-circuit emulator, SMDS2+, for
S3C7, S3C8, S3C9 families of microcontrollers. The SMDS2+ is a new and improved version of SMDS2.
Samsung also offers support software that includes debugger, assembler, and a program for setting options.
SHINE
Samsung Host Interface for In-Circuit Emulator, SHINE, is a multi-window based debugger for SMDS2+. SHINE
provides pull-down and pop-up menus, mouse support, function/hot keys, and context-sensitive hyper-linked
help. It has an advanced, multiple-windowed user interface that emphasizes ease of use. Each window can be
sized, moved, scrolled, highlighted, added, or removed completely.
SAMA ASSEMBLER
The Samsung Arrangeable Microcontroller (SAM) Assembler, SAMA, is a universal assembler, and generates
object code in standard hexadecimal format. Assembled program code includes the object code that is used for
ROM data and required SMDS program control data. To assemble programs, SAMA requires a source file and
an auxiliary definition (DEF) file with device specific information.
SASM86
The SASM86 is an relocatable assembler for Samsung's S3C9-series microcontrollers. The SASM86 takes a
source file containing assembly language statements and translates into a corresponding source code, object
code and comments. The SASM86 supports macros and conditional assembly. It runs on the MS-DOS operating
system. It produces the relocatable object code only, so the user should link object file. Object files can be linked
with other object files and loaded into memory.
HEX2ROM
HEX2ROM file generates ROM code from HEX file which has been produced by assembler. ROM code must be
needed to fabricate a microcontroller which has a mask ROM. When generating the ROM code (.OBJ file) by
HEX2ROM, the value “FF” is filled into the unused ROM area up to the maximum ROM size of the target device
automatically.
TARGET BOARDS
Target boards are available for all S3C9-series microcontrollers. All required target system cables and adapters
are included with the device-specific target board.
19-1
DEVELOPMENT TOOLS S3C9228/P9228
IBM-PC AT or Compatible
RS-232C SMDS2+
Target
PROM/OTP Writer Unit Application
System
Probe
Adapter
BUS
Trace/Timer Unit
POD TB9228
SAM8 Base Unit Target
Board
EVA
Power Supply Unit Chip
19-2
S3C9228/P9228 DEVELOPMENT TOOLS
The TB9228 target board is used for the S3C9228 microcontroller. It is supported by the SMDS2+ development
system.
+
C11
VCC
R1
D1
C1
U2
R7
C20
R8
Y1
GND
T1T2 T3T4
25 CB+ R5 R4
C3
C4
C5
C6
C7
20 J1
C10
C9
J101 J102
30 20 10 1 42SDIP 44QFP
1 42 1 44
160
T16 40
CN1 50 150 T15
T14 5 5 40
T13
60 140
10 T12
T11 35
70 130 T10
T9 10 10 35
80
30
90 100 110 120 15 30
15
1 C14
51
25
76 26 20 25
21 22
22 23
P2
SMDS2 SMDS2+
SM1347A
19-3
DEVELOPMENT TOOLS S3C9228/P9228
SMDS2/SMDS2+
The SMDS2/SMDS2+
To User_VCC
supplies VCC only to the target
Off On External
VCC Target board (evaluation chip). The
TB9228
System target system must have its
VSS own power supply.
VCC
SMDS2/SMDS2+
NOTE: The following symbol in the "To User_VCC" Setting column indicates the electrical short (off) configuration:
19-4
S3C9228/P9228 DEVELOPMENT TOOLS
SMDS2 SMDS2+
R/W R/W
Target
Board
SMDS2+
Table 19-3. Using Single Header Pins as the Input Path for External Trigger Sources
Target Board Part Comments
Ch2
You can connect an external trigger source to one of the two external
trigger channels (CH1 or CH2) for the SMDS2+ breakpoint and trace
functions.
IDLE LED
The Green LED is ON when the evaluation chip (S3E9220) is in idle mode.
STOP LED
The Red LED is ON when the evaluation chip (S3E9220) is in stop mode.
19-5
DEVELOPMENT TOOLS S3C9228/P9228
J101 J102
42-SDIP 44-QFP
19-6
S3C9228/P9228 DEVELOPMENT TOOLS
J101 J101
50-Pin DIP Connector
1 42 1 42
21 22 21 22
J102 J102
1 44 1 44
50-Pin Connector
50-Pin Connector
22 23 22 23
19-7
DEVELOPMENT TOOLS S3C9228/P9228
NOTES
19-8
S3C9228/P9228 PRODUCT OVERVIEW
1 PRODUCT OVERVIEW
Samsung's SAM88RCRI family of 8-bit single-chip CMOS microcontrollers offer fast and efficient CPU, a wide
range of integrated peripherals, and supports OTP device.
A dual address/data bus architecture and bit- or nibble-configurable I/O ports provide a flexible programming
environment for applications with varied memory and I/O requirements. Timer/counters with selectable operating
modes are included to support real-time operations.
S3C9228/P9228 MICROCONTROLLER
The S3C9228 can be used for dedicated control functions in a variety of applications, and is especially designed
for application with FRS or etc.
The S3C9228/P9228 single-chip 8-bit microcontroller is fabricated using an advanced CMOS process. It is built
around the powerful SAM88RCRI CPU core.
Stop and Idle power-down modes were implemented to reduce power consumption. To increase on-chip register
space, the size of the internal register file was logically expanded. The S3C9228/P9228 has 8K-byte of program
ROM, and 264-byte of RAM (including 16-byte of working register and 20-byte LCD display RAM).
Using the SAM88RCRI design approach, the following peripherals were integrated with the SAM88RCRI core:
— 7 configurable I/O ports including ports shared with segment/common drive outputs
— 10-bit programmable pins for external interrupts
— One 8-bit basic timer for oscillation stabilization and watch-dog functions
— Two 8-bit timer/counters with selectable operating modes
— Watch timer for real time
— 4 channel A/D converter
— 8-bit serial I/O interface
OTP
The S3C9228 microcontroller is also available in OTP (One Time Programmable) version. S3P9228
microcontroller has an on-chip 8K-byte one-time-programmable EPROM instead of masked ROM. The S3P9228
is comparable to S3C9228, both in function and in pin configuration.
1-1
PRODUCT OVERVIEW S3C9228/P9228
FEATURES
Package Type
• 44-pin QFP, 42-pin SDIP
1-2
S3C9228/P9228 PRODUCT OVERVIEW
BLOCK DIAGRAM
X IN XOUT
RESET XT IN XT OUT
TAOUT/ 8-Bit Timer/ Watchdog
16-Bit
P0.0 CounterA Timer
Timer/
T1CLK/ 8-Bit Timer/
Counter1 Basic Timer
P0.1 CounterB
P4.0-P4.7/
I/O Port 4 A/D Converter P1.0-P1.3/AD0-AD3
SEG4-SEG11
P5.0-P5.3/
SEG12-SEG15 I/O Port 5 I/O Port 6 P6.0-P6.3/COM3-COM0
P5.4-P5.7/
SEG16-SEG19/
COM7-COM4
1-3
PRODUCT OVERVIEW S3C9228/P9228
PIN ASSIGNMENTS
COM4/SEG19/P5.7
P0.0/TAOUT/INT
P0.1/T1CLK/INT
P0.3/BUZ/INT
COM0/P6.3
COM1/P6.2
COM2/P6.1
COM3/P6.0
P0.2/INT
P0.5
P0.4
44
43
42
41
40
39
38
37
36
35
34
P1.0/AD0/INT 1 33 COM5/SEG18/P5.6
P1.1/AD1/INT 2 32 COM6/SEG17/P5.5
P1.2/AD2/INT 3 31 COM7/SEG16/P5.4
P1.3/AD3/INT 4 30 SEG15/P5.3
VDD 5 S3C9228 29 SEG14/P5.2
VSS 6 28 SEG13/P5.1
XOUT 7 (44-QFP) 27 SEG12/P5.0
XIN 8 26 SEG11/P4.7
TEST 9 25 SEG10/P4.6
XTIN 10 24 SEG9/P4.5
XTOUT 11 23 SEG8/P4.4
12
13
14
15
16
17
18
19
20
21
22
RESET
SEG1/P2.0/SCK
SEG2/P3.1/INTP
SEG3/P3.0/INTP
P2.3
SEG4/P4.0
SEG5/P4.1
SEG6/P4.2
SEG7/P4.3
P2.2/SI
SEG0/P2.1/SO
1-4
S3C9228/P9228 PRODUCT OVERVIEW
COM1/P6.2 1 42 COM2/P6.1
COM0/P6.3 2 41 COM3/P6.0
P0.0/TAOUT/INT 3 40 COM4/SEG19/P5.7
P0.1/T1CLK/INT 4 39 COM5/SEG18/P5.6
P0.2/INT 5 38 COM6/SEG17/P5.5
P0.3/BUZ/INT 6 37 COM7/SEG16/P5.4
P1.0/AD0/INT 7 36 SEG15/P5.3
P1.1/AD1/INT 8 35 SEG14/P5.2
S3C9228
(42-SDIP)
P1.2/AD2/INT 9 34 SEG13/P5.1
P1.3/AD3/INT 10 33 SEG12/P5.0
VDD 11 32 SEG11/P4.7
VSS 12 31 SEG10/P4.6
XOUT 13 30 SEG9/P4.5
XIN 14 29 SEG8/P4.4
TEST 15 28 SEG7/P4.3
XTIN 16 27 SEG6/P4.2
XTOUT 17 26 SEG5/P4.1
RESET 18 25 SEG4/P4.0
P2.3 19 24 SEG3/P3.0/INTP
P2.2/SI 20 23 SEG2/P3.1/INTP
SEG0/P2.1/SO 21 22 SEG1/P2.0/SCK
1-5
PRODUCT OVERVIEW S3C9228/P9228
PIN DESCRIPTIONS
1-6
S3C9228/P9228 PRODUCT OVERVIEW
1-7
PRODUCT OVERVIEW S3C9228/P9228
VDD
Pull-Up
Resistor
VDD
Data
Output
Output
Disable
VSS
1-8
S3C9228/P9228 PRODUCT OVERVIEW
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain Enable
Data I/O
Output
Disable
External
Interrupt
Input
VDD
Pull-up
Resistor
Pull-up Enable
Open-Drain EN Circuit
Data I/O
Output Disable Type E
ADEN
ADSELECT
Data
To ADC
1-9
PRODUCT OVERVIEW S3C9228/P9228
VLC1
VLC2
VLC3
SEG/COM Out
Output
Disable
VLC4
VLC5
VSS
1-10
S3C9228/P9228 PRODUCT OVERVIEW
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain EN Enable
Data I/O
LCD Out EN
COM/SEG Circuit
Output Type H-23
Disable
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain EN Enable
Data I/O
LCD Out EN
COM/SEG Circuit
Output Type H-23
Disable
1-11
PRODUCT OVERVIEW S3C9228/P9228
VDD
Pull-up
VDD Resistor
Pull-up
Open-Drain EN Enable
Data I/O
Port
LCD Out EN Enable
(LMOD.5)
COM/SEG Circuit
Output Type H-23
Disable
1-12
S3C9228/P9228 ADDRESS SPACES
2 ADDRESS SPACES
OVERVIEW
A 16-bit address bus supports program memory operations. Special instructions and related internal logic
determine when the 16-bit bus carries addresses for program memory. A separate 8-bit register bus carries
addresses and data between the CPU and the internal register file.
The S3C9228 has 8K bytes of mask-programmable program memory on-chip. The S3C9228/P9228
microcontroller has 244 bytes general-purpose registers in its internal register file and the 20 bytes for LCD
display memory is implemented in the internal register file too. Fifty-six bytes in the register file are mapped for
system and peripheral control functions.
2-1
ADDRESS SPACES S3C9228/P9228
Program memory (ROM) stores program code or table data. The S3C9228 has 8K bytes of mask-programable
program memory. The program memory address range is therefore 0H-1FFFH. The first 2 bytes of the ROM
(0000H–0001H) are an interrupt vector address. The program reset address in the ROM is 0100H.
(Decimal) (Hex)
8,192 1FFFH
8K bytes
Internal
Program
Memory
Area
2 0002H
Interrupt
1 0001H
Vector
0 0000H
2-2
S3C9228/P9228 ADDRESS SPACES
REGISTER ARCHITECTURE
The upper 72 bytes of the S3C9228/P9228's internal register file are addressed as working registers, system
control registers and peripheral control registers. The lower 184 bytes of internal register file (00H–B7H) is called
the general purpose register space.
For many SAM88RCRI microcontrollers, the addressable area of the internal register file is further expanded by
the additional of one or more register pages at general purpose register space (00H–BFH). This register file
expansion is implemented by page 1 in the S3C9228/P9228. The page 1 (20 × 8 bits) is for LCD display register
and can be used as general-purpose registers.
FFH
Peripheral Control
Registers
E0H
DFH
72 Bytes of System Control
Common Area Registers
D0H
CFH
Working Registers
C0H
BFH
Peripheral Control
Registers
B8H
B7H
General Purpose
184 Bytes Register File
and Stack Area
~
3FH
General Purpose
Register File
64 Bytes 13H
LCD Display
Registers
00H 00H
(Page 0) (Page 1)
2-3
ADDRESS SPACES S3C9228/P9228
The SAM88RCRI register architecture provides an efficient method of working register addressing that takes full
advantage of shorter instruction formats to reduce execution time.
This16-byte address range is called common area. That is, locations in this area can be used as working registers
by operations that address any location on any page in the register file. Typically, these working registers serve
as temporary buffers for data operations between different pages.
The Register (R) addressing mode can be used to access this area
Registers are addressed either as a single 8-bit register or as a paired 16-bit register. In 16-bit register pairs, the
address of the first 8-bit register is always an even number and the address of the next register is an odd number.
The most significant byte of the 16-bit data is always stored in the even-numbered register; the least significant
byte is always stored in the next (+ 1) odd-numbered register.
Rn Rn + 1
2-4
S3C9228/P9228 ADDRESS SPACES
SYSTEM STACK
S3C9-series microcontrollers use the system stack for subroutine calls and returns and to store data. The PUSH
and POP instructions are used to control system stack operations. The S3C9228/P9228 architecture supports
stack operations in the internal register file.
STACK OPERATIONS
Return addresses for procedure calls and interrupts and data are stored on the stack. The contents of the PC are
saved to stack by a CALL instruction and restored by the RET instruction. When an interrupt occurs, the contents
of the PC and the FLAGS register are pushed to the stack. The IRET instruction then pops these values back to
their original locations. The stack address is always decremented before a push operation and incremented after
a pop operation. The stack pointer (SP) always points to the stack frame stored on the top of the stack, as shown
in Figure 2-4.
High Address
PCL
PCL
PCH
Top of
PCH
stack Top of
Flags
stack
Register location D9H contains the 8-bit stack pointer (SP) that is used for system stack operations. After a reset,
the SP value is undetermined.
Because only internal memory space is implemented in the S3C9228/P9228, the SP must be initialized to an 8-
bit value in the range 00H–B7H.
NOTE
In case a Stack Pointer is initialized to 00H, it is decreased to FFH when stack operation starts. This
means that a Stack Pointer access invalid stack area.
2-5
ADDRESS SPACES S3C9228/P9228
2-6
S3C9228/P9228 ADDRESSING MODES
3 ADDRESSING MODES
OVERVIEW
Instructions that are stored in program memory are fetched for execution using the program counter. Instructions
indicate the operation to be performed and the data to be operated on. Addressing mode is the method used to
determine the location of the data operand. The operands specified in SAM88RCRI instructions may be condition
codes, immediate data, or a location in the register file, program memory, or data memory.
The SAM88RCRI instruction set supports six explicit addressing modes. Not all of these addressing modes are
available for each instruction. The addressing modes and their symbols are as follows:
— Register (R)
— Indirect Register (IR)
— Indexed (X)
— Direct Address (DA)
— Relative Address (RA)
— Immediate (IM)
3-1
ADDRESSING MODES S3C9228/P9228
In Register addressing mode, the operand is the content of a specified register (see Figure 3-1). Working register
addressing differs from Register addressing because it uses a 16-byte working register space in the register file
and a 4-bit register within that space (see Figure 3-2).
8-bit Register
File Address dst OPERAND
Point to One
OPCODE
Rigister in Register
One-Operand File
Instruction
(Example) Value used in
Instruction Execution
Sample Instruction:
Register File
CFH
.
.
Program Memory .
4-Bit .
Working Register 4 LSBs
dst src OPERAND
Point to the
OPCODE
Woking Register
Two-Operand (1 of 16) C0H
Instruction
(Example)
Sample Instruction:
3-2
S3C9228/P9228 ADDRESSING MODES
In Indirect Register (IR) addressing mode, the content of the specified register or register pair is the address of
the operand. Depending on the instruction used, the actual address may point to a register in the register file, to
program memory (ROM), or to an external memory space (see Figures 3-3 through 3-6).
You can use any 8-bit register to indirectly address another register. Any 16-bit register pair can be used to
indirectly address another memory location.
8-Bit Register
File Address dst ADDRESS
Point to One
OPCODE
Rigister in Register
One-Operand File
Instruction
(Example) Address of Operand
used by Instruction
Sample Instruction:
3-3
ADDRESSING MODES S3C9228/P9228
Register File
Program Memory
REGISTER
Example
Instruction dst PAIR
References OPCODE Points to
Program Rigister Pair
16-Bit
Memory Address
Points to
Program Memory Program
Memory
3-4
S3C9228/P9228 ADDRESSING MODES
Register File
CFH
.
.
Program Memory
.
4-Bit .
Working 4 LSBs
dst src OPERAND
Register Point to the
Address OPCODE
Woking Register
(1 of 16) C0H
Sample Instruction:
Value used in OPERAND
OR R6, @R2 Instruction
3-5
ADDRESSING MODES S3C9228/P9228
Register File
CFH
.
.
Program Memory
.
4-Bit Working .
Register Address
dst src Register
Next 3 Bits Point Pair
OPCODE
Example Instruction to Working
Register Pair C0H
References either
(1 of 8) 16-Bit
Program Memory or
address
Data Memory
LSB Selects Program Memory points to
or program
Data Memory memory
or data
memory
Value used in
OPERAND
Instruction
Sample Instructions:
3-6
S3C9228/P9228 ADDRESSING MODES
Indexed (X) addressing mode adds an offset value to a base address during instruction execution in order to
calculate the effective operand address (see Figure 3-7). You can use Indexed addressing mode to access
locations in the internal register file or in external memory.
In short offset Indexed addressing mode, the 8-bit displacement is treated as a signed integer in the range of
–128 to +127. This applies to external memory accesses only (see Figure 3-8).
For register file addressing, an 8-bit base address provided by the instruction is added to an 8-bit offset contained
in a working register. For external memory accesses, the base address is stored in the working register pair
designated in the instruction. The 8-bit or 16-bit offset given in the instruction is then added to the base address
(see Figure 3-9).
The only instruction that supports Indexed addressing mode for the internal register file is the Load instruction
(LD). The LDC and LDE instructions support Indexed addressing mode for internal program memory, external
program memory, and for external data memory, when implemented.
Register File
~ ~
Value used in
Instruction
OPERAND
+
Program Memory ~ ~
Base Address
4 LSBs
Two-Operand dst src INDEX
Point to One of the
Instruction OPCODE
Woking Register
Example (1 of 16)
Sample Instruction:
3-7
ADDRESSING MODES S3C9228/P9228
Value used in
OPERAND
16-Bits Instruction
Sample Instructions:
LDC R4, #04H[RR2] ; The values in the program address (RR2 + #04H)
are loaded into register R4.
LDE R4,#04H[RR2] ; Identical operation to LDC example, except that
external program memory is accessed.
Figure 3-8. Indexed Addressing to Program or Data Memory with Short Offset
3-8
S3C9228/P9228 ADDRESSING MODES
XLH (OFFSET)
XLL (OFFSET) Register
4-Bit Working NEXT 3 Bits
dst src Pair
Register Address
OPCODE Point to Working
Register Pair 16-Bit
(1 of 8) address
added to
offset
LSB Selects
+
8-Bits 16-Bits
Program Memory
or
Data Memory
Sample Instructions:
Figure 3-9. Indexed Addressing to Program or Data Memory with Long Offset
3-9
ADDRESSING MODES S3C9228/P9228
In Direct Address (DA) mode, the instruction provides the operand's 16-bit memory address. Jump (JP) and Call
(CALL) instructions use this addressing mode to specify the 16-bit destination address that is loaded into the PC
whenever a JP or CALL instruction is executed.
The LDC and LDE instructions can use Direct Address mode to specify the source or destination address for
Load operations to program memory (LDC) or to external data memory (LDE), if implemented.
Program or
Data Memory
Memory
Address
Program Memory
Used
Sample Instructions:
3-10
S3C9228/P9228 ADDRESSING MODES
Program Memory
Next OPCODE
Program
Memory
Address
Used
Sample Instructions:
3-11
ADDRESSING MODES S3C9228/P9228
In Relative Address (RA) mode, a two's-complement signed displacement between – 128 and + 127 is specified
in the instruction. The displacement value is then added to the current PC value. The result is the address of the
next instruction to be executed. Before this addition occurs, the PC contains the address of the instruction
immediately following the current instruction.
Program Memory
Next OPCODE
Program Memory
Address Used
Current
PC Value
Displacement +
Current Instruction OPCODE Signed
Displacement Value
Sample Instructions:
In Immediate (IM) addressing mode, the operand value used in the instruction is the value supplied in the
operand field itself. Immediate addressing mode is useful for loading constant values into registers.
Program Memory
OPERAND
OPCODE
Sample Instruction:
LD R0,#0AAH
3-12
S3C9228/P9228 CONTROL REGISTERS
4 CONTROL REGISTERS
OVERVIEW
In this section, detailed descriptions of the S3C9228/P9228 control registers are presented in an easy-to-read
format. These descriptions will help familiarize you with the mapped locations in the register file. You can also
use them as a quick-reference source when writing application programs.
System and peripheral registers are summarized in Table 4-1. Figure 4-1 illustrates the important features of the
standard register description format.
Control register descriptions are arranged in alphabetical order according to register mnemonic. More information
about control registers is presented in the context of the various peripheral hardware descriptions in Part II of this
manual.
4-1
CONTROL REGISTERS S3C9228/P9228
4-2
S3C9228/P9228 CONTROL REGISTERS
4-3
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value x x x x x x 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
.6 Zero Flag
0 Operation result is a non-zero value
1 Operation result is zero
.5 Sign Flag
0 Operation generates positive number (MSB = "0")
1 Operation generates negative number (MSB = "1")
4-4
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – 0 0 0 0 0 0
Read/Write – – R/W R/W R R/W R/W R/W
4-5
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
.0 Clock Frequency Divider Clear Bit for Basic Timer and Timer/Counters (2)
0 No effect
1 Clear clock frequency dividers
NOTES
1. When "1" is written to BTCON.1, the basic timer counter value is cleared to "00H". Immediately following the write
operation, the BTCON.1 value is automatically cleared to "0".
2. When "1" is written to BTCON.0, the corresponding frequency divider is cleared to "00H". Immediately following the
write operation, the BTCON.0 value is automatically cleared to "0".
4-6
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-7
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value x x x x – – – –
Read/Write R/W R/W R/W R/W – – – –
4-8
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-9
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – 0 0 0 0 0 0
Read/Write – – R/W R/W R/W R/W R/W R/W
4-10
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – 0 0 0 0 0 0 0
Read/Write – R/W R/W R/W R/W R/W R/W R/W
4-11
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – 0 0 0 0 0 0 0
Read/Write – R/W R/W R/W R/W R/W R/W R/W
4-12
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 – 0
Read/Write – – – – R/W R/W – R/W
4-13
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-14
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-15
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-16
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-17
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-18
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-19
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-20
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-21
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-22
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-23
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-24
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – – – 0 0
Read/Write – – – – – – R/W R/W
4-25
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – – – 0 0
Read/Write – – – – – – R/W R/W
4-26
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – – – 0 0
Read/Write – – – – – – R/W R/W
4-27
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-28
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-29
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-30
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-31
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-32
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 –
Read/Write R/W R/W R/W R/W R/W R/W R/W –
4-33
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 0
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W
4-34
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – – – – 0 0 0 0
Read/Write – – – – R/W R/W R/W R/W
4-35
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 –
Read/Write R/W R/W R/W R/W R/W R/W R/W –
.0 Bit 0
Not used for S3C9228/P9228
4-36
S3C9228/P9228 CONTROL REGISTERS
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value – 0 0 0 0 0 0 –
Read/Write – R/W R/W R/W R/W R/W R/W –
4-37
CONTROL REGISTERS S3C9228/P9228
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 0 0 0 0 0 –
Read/Write R/W R/W R/W R/W R/W R/W R/W –
4-38
S3C9228/P9228 INTERRUPT STRUCTURE
5 INTERRUPT STRUCTURE
OVERVIEW
The SAM88RCRI interrupt structure has two basic components: a vector, and sources. The number of interrupt
sources can be serviced through a interrupt vector which is assigned in ROM address 0000H–0001H.
VECTOR SOURCES
S1
0000H
S2
0001H
S3
Sn
NOTES:
1. The SAM88RCRI interrupt has only one vector address (0000H-0001H).
2. The number of Sn value is expandable.
Interrupt processing can be controlled in two ways: globally, or by specific interrupt level and source. The system-
level control points in the interrupt structure are therefore:
The system mode register, SYM (DFH), is used to enable and disable interrupt processing.
SYM.3 is the enable and disable bit for global interrupt processing, which you can set by modifying SYM.3. An
Enable Interrupt (EI) instruction must be included in the initialization routine that follows a reset operation in order
to enable interrupt processing. Although you can manipulate SYM.3 directly to enable and disable interrupts
during normal operation, we recommend that you use the EI and DI instructions for this purpose.
5-1
INTERRUPT STRUCTURE S3C9228/P9228
When the interrupt service routine has executed, the application program's service routine must clear the
appropriate pending bit before the return from interrupt subroutine (IRET) occurs.
INTERRUPT PRIORITY
Because there is not a interrupt priority register in SAM87RCRI, the order of service is determined by a sequence
of source which is executed in interrupt service routine.
"EI" Instruction
S Q
Execution Interrupt Pending
Register
RESET R
Source Vector
Interrupts Interrpt priority
Interrupt
is determind by
Source Cycle
software polling
Interrupt method
Enable
Global Interrupt
Control (EI, Di instruction)
5-2
S3C9228/P9228 INTERRUPT STRUCTURE
1. A source generates an interrupt request by setting the interrupt request pending bit to "1".
2. The CPU generates an interrupt acknowledge signal.
3. The service routine starts and the source's pending flag is cleared to "0" by software.
4. Interrupt priority must be determined by software polling method.
Before an interrupt request can be serviced, the following conditions must be met:
If all of the above conditions are met, the interrupt request is acknowledged at the end of the instruction cycle.
The CPU then initiates an interrupt machine cycle that completes the following processing sequence:
1. Reset (clear to "0") the global interrupt enable bit in the SYM register (DI, SYM.3 = "0")
to disable all subsequent interrupts.
2. Save the program counter and status flags to stack.
3. Branch to the interrupt vector to fetch the service routine's address.
4. Pass control to the interrupt service routine.
When the interrupt service routine is completed, an Interrupt Return instruction (IRET) occurs. The IRET restores
the PC and status flags and sets SYM.3 to "1"(EI), allowing the CPU to process the next interrupt request.
The interrupt vector area in the ROM contains the address of the interrupt service routine. Vectored interrupt
processing follows this sequence:
5-3
INTERRUPT STRUCTURE S3C9228/P9228
5-4
S3C9228/P9228 INTERRUPT STRUCTURE
5-5
INTERRUPT STRUCTURE S3C9228/P9228
As the following examples are shown, a load instruction should be used to clear an interrupt pending bit.
Examples:
5-6
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
OVERVIEW
The SAM88RCRI instruction set is designed to support the large register file. It includes a full complement of 8-
bit arithmetic and logic operations. There are 41 instructions. No special I/O instructions are necessary because
I/O control and data registers are mapped directly into the register file. Flexible instructions for bit addressing,
rotate, and shift operations complete the powerful data manipulation capabilities of the SAM88RCRI instruction
set.
REGISTER ADDRESSING
To access an individual register, an 8-bit address in the range 0-255 or the 4-bit address of a working register is
specified. Paired registers can be used to construct 16-bit program memory or data memory addresses. For
detailed information about register addressing, please refer to Section 2, "Address Spaces".
ADDRESSING MODES
There are six addressing modes: Register (R), Indirect Register (IR), Indexed (X), Direct (DA), Relative (RA), and
Immediate (IM). For detailed descriptions of these addressing modes, please refer to Section 3, "Addressing
Modes".
6-1
SAM88RI INSTRUCTION SET S3C9228/P9228
Load Instructions
CLR dst Clear
LD dst,src Load
LDC dst,src Load program memory
LDE dst,src Load external data memory
LDCD dst,src Load program memory and decrement
LDED dst,src Load external data memory and decrement
LDCI dst,src Load program memory and increment
LDEI dst,src Load external data memory and increment
POP dst Pop from stack
PUSH src Push to stack
Arithmetic Instructions
Logic Instructions
AND dst,src Logical AND
COM dst Complement
OR dst,src Logical OR
XOR dst,src Logical exclusive OR
6-2
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
6-3
SAM88RI INSTRUCTION SET S3C9228/P9228
The FLAGS register contains eight bits that describe the current status of CPU operations. Four of these bits,
FLAGS.4 – FLAGS.7, can be tested and used with conditional jump instructions;
FLAGS register can be set or reset by instructions as long as its outcome does not affect the flags, such as, Load
instruction. Logical and Arithmetic instructions such as, AND, OR, XOR, ADD, and SUB can affect the Flags
register. For example, the AND instruction updates the Zero, Sign and Overflow flags based on the outcome of
the AND instruction. If the AND instruction uses the Flags register as the destination, then simultaneously, two
write will occur to the Flags register producing an unpredictable result.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
FLAG DESCRIPTIONS
6-4
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
6-5
SAM88RI INSTRUCTION SET S3C9228/P9228
6-6
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
OPCODE MAP
LOWER NIBBLE (HEX)
– 0 1 2 3 4 5 6 7
U 0 DEC DEC ADD ADD ADD ADD ADD
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
P 1 RLC RLC ADC ADC ADC ADC ADC
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
P 2 INC INC SUB SUB SUB SUB SUB
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
E 3 JP SBC SBC SBC SBC SBC
IRR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
R 4 OR OR OR OR OR
r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
5 POP POP AND AND AND AND AND
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
N 6 COM COM TCM TCM TCM TCM TCM
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
I 7 PUSH PUSH TM TM TM TM TM
R2 IR2 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM
B 8 LD
r1, x, r2
B 9 RL RL LD
R1 IR1 r2, x, r1
L A CP CP CP CP CP LDC
r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM r1, Irr2, xL
E B CLR CLR XOR XOR XOR XOR XOR LDC
R1 IR1 r1,r2 r1,Ir2 R2,R1 IR2,R1 R1,IM r2, Irr2, xL
C RRC RRC LDC LD
R1 IR1 r1,Irr2 r1, Ir2
H D SRA SRA LDC LD LD
R1 IR1 r2,Irr1 IR1,IM Ir1, r2
E E RR RR LDCD LDCI LD LD LD LDC
R1 IR1 r1,Irr2 r1,Irr2 R2,R1 R2,IR1 R1,IM r1, Irr2, xs
X F CALL LD CALL LDC
IRR1 IR2,R1 DA1 r2, Irr1, xs
6-7
SAM88RI INSTRUCTION SET S3C9228/P9228
6-8
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
CONDITION CODES
The opcode of a conditional jump always contains a 4-bit field called the condition code (cc). This specifies under
which conditions it is to execute the jump. For example, a conditional jump with the condition code for "equal"
after a compare operation only jumps if the two operands are equal. Condition codes are listed in Table 6-6.
The carry (C), zero (Z), sign (S), and overflow (V) flags are used to control the operation of conditional jump
instructions.
6-9
SAM88RI INSTRUCTION SET S3C9228/P9228
INSTRUCTION DESCRIPTIONS
This section contains detailed information and programming examples for each instruction in the SAM88RCRI
instruction set. Information is arranged in a consistent format for improved readability and for fast referencing.
The following information is included in each instruction description:
6-10
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
ADC dst,src
Flags: C: Set if there is a carry from the most significant bit of the result; cleared otherwise.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Set if arithmetic overflow occurs, that is, if both operands are of the same sign and the
result is of the opposite sign; cleared otherwise.
D: Always cleared to "0".
H: Set if there is a carry from the most significant bit of the low-order four bits of the result;
cleared otherwise.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 12 r r
6 13 r lr
Examples: Given: R1 = 10H, R2 = 03H, C flag = "1", register 01H = 20H, register 02H = 03H, and register
03H = 0AH:
In the first example, destination register R1 contains the value 10H, the carry flag is set to "1",
and the source working register R2 contains the value 03H. The statement "ADC R1,R2" adds
03H and the carry flag value ("1") to the destination value 10H, leaving 14H in register R1.
6-11
SAM88RI INSTRUCTION SET S3C9228/P9228
ADD — Add
ADD dst,src
Flags: C: Set if there is a carry from the most significant bit of the result; cleared otherwise.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if both operands are of the same sign and the
result is of the opposite sign; cleared otherwise.
D: Always cleared to "0".
H: Set if a carry from the low-order nibble occurred.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 02 r r
6 03 r lr
Examples: Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
In the first example, destination working register R1 contains 12H and the source working register
R2 contains 03H. The statement "ADD R1,R2" adds 03H to 12H, leaving the value 15H in
register R1.
6-12
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
AND dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 52 r r
6 53 r lr
Examples: Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
In the first example, destination working register R1 contains the value 12H and the source
working register R2 contains 03H. The statement "AND R1,R2" logically ANDs the source
operand 03H with the destination operand value 12H, leaving the value 02H in register R1.
6-13
SAM88RI INSTRUCTION SET S3C9228/P9228
CALL dst
Operation: SP ¨ SP – 1
@SP ¨ PCL
SP ¨ SP –1
@SP ¨ PCH
PC ¨ dst
The current contents of the program counter are pushed onto the top of the stack. The program
counter value used is the address of the first instruction following the CALL instruction. The
specified destination address is then loaded into the program counter and points to the first
instruction of a procedure. At the end of the procedure the return instruction (RET) can be used to
return to the original program flow. RET pops the top of the stack back into the program counter.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 3 14 F6 DA
In the first example, if the program counter value is 1A47H and the stack pointer contains the
value 0B2H, the statement "CALL 1521H" pushes the current PC value onto the top of the stack.
The stack pointer now points to memory location 00H. The PC is then loaded with the value
1521H, the address of the first instruction in the program sequence to be executed.
If the contents of the program counter and stack pointer are the same as in the first example, the
statement "CALL @RR0" produces the same result except that the 49H is stored in stack location
01H (because the two-byte instruction format was used). The PC is then loaded with the value
1521H, the address of the first instruction in the program sequence to be executed.
6-14
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
CCF
Operation: C ¨ NOT C
The carry flag (C) is complemented. If C = "1", the value of the carry flag is changed to logic
zero; if C = "0", the value of the carry flag is changed to logic one.
Flags: C: Complemented.
No other flags are affected.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 EF
CCF
If the carry flag = "0", the CCF instruction complements it in the FLAGS register (0D5H), changing
its value from logic zero to logic one.
6-15
SAM88RI INSTRUCTION SET S3C9228/P9228
CLR — Clear
CLR dst
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 B0 R
4 B1 IR
Examples: Given: Register 00H = 4FH, register 01H = 02H, and register 02H = 5EH:
In Register (R) addressing mode, the statement "CLR 00H" clears the destination register 00H
value to 00H. In the second example, the statement "CLR @01H" uses Indirect Register (IR)
addressing mode to clear the 02H register value to 00H.
6-16
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
COM — Complement
COM dst
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always reset to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 60 R
4 61 IR
COM R1 → R1 = 0F8H
COM @R1 → R1 = 07H, register 07H = 0EH
In the first example, destination working register R1 contains the value 07H (00000111B). The
statement "COM R1" complements all the bits in R1: all logic ones are changed to logic zeros,
and vice-versa, leaving the value 0F8H (11111000B).
In the second example, Indirect Register (IR) addressing mode is used to complement the value
of destination register 07H (11110001B), leaving the new value 0EH (00001110B).
6-17
SAM88RI INSTRUCTION SET S3C9228/P9228
CP — Compare
CP dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 A2 r r
6 A3 r lr
Destination working register R1 contains the value 02H and source register R2 contains the value
03H. The statement "CP R1,R2" subtracts the R2 value (source/subtrahend) from the R1 value
(destination/minuend). Because a "borrow" occurs and the difference is negative, C and S are "1".
In this example, destination working register R1 contains the value 05H which is less than the
contents of the source working register R2 (0AH). The statement "CP R1,R2" generates C = "1"
and the JP instruction does not jump to the SKIP location. After the statement "LD R3,R1"
executes, the value 06H remains in working register R3.
6-18
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
DEC — Decrement
DEC dst
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if result is negative; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, dst value is –128(80H) and result value is
+127(7FH); cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 00 R
4 01 IR
DEC R1 → R1 = 02H
DEC @R1 → Register 03H = 0FH
In the first example, if working register R1 contains the value 03H, the statement "DEC R1"
decrements the hexadecimal value by one, leaving the value 02H. In the second example, the
statement "DEC @R1" decrements the value 10H contained in the destination register 03H by
one, leaving the value 0FH.
6-19
SAM88RI INSTRUCTION SET S3C9228/P9228
DI — Disable Interrupts
DI
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 8F
DI
If the value of the SYM register is 04H, the statement "DI" leaves the new value 00H in the
register and clears SYM.2 to "0", disabling interrupt processing.
6-20
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
EI — Enable Interrupts
EI
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 9F
EI
If the SYM register contains the value 00H, that is, if interrupts are currently disabled, the
statement "EI" sets the SYM register to 04H, enabling all interrupts (SYM.2 is the enable bit for
global interrupt processing).
6-21
SAM88RI INSTRUCTION SET S3C9228/P9228
IDLE
Operation:
The IDLE instruction stops the CPU clock while allowing system clock oscillation to continue. Idle
mode can be released by an interrupt request (IRQ) or an external reset operation.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc 1 4 6F – –
IDLE
6-22
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
INC — Increment
INC dst
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Set if arithmetic overflow occurred, that is dst value is +127(7FH) and result is –128(80H);
cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
dst | opc 1 4 rE r
r = 0 to F
opc dst 2 4 20 R
4 21 IR
Examples: Given: R0 = 1BH, register 00H = 0CH, and register 1BH = 0FH:
INC R0 → R0 = 1CH
INC 00H → Register 00H = 0DH
INC @R0 → R0 = 1BH, register 01H = 10H
In the first example, if destination working register R0 contains the value 1BH, the statement "INC
R0" leaves the value 1CH in that same register.
The next example shows the effect an INC instruction has on register 00H, assuming that it
contains the value 0CH.
In the third example, INC is used in Indirect Register (IR) addressing mode to increment the value
of register 1BH from 0FH to 10H.
6-23
SAM88RI INSTRUCTION SET S3C9228/P9228
IRET IRET
Flags: All flags are restored to their original settings (that is, the settings before the interrupt occurred).
Format:
IRET Bytes Cycles Opcode
(Normal) (Hex)
opc 1 6 BF
6-24
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
JP — Jump
JP cc,dst (Conditional)
JP dst (Unconditional)
Format: (1)
Bytes Cycles Opcode Addr Mode
(2) (Hex) dst
cc | opc dst 3 8 (3) ccD DA
cc = 0 to F
Examples: Given: The carry flag (C) = "1", register 00 = 01H, and register 01 = 20H:
The first example shows a conditional JP. Assuming that the carry flag is set to "1", the statement
"JP C,LABEL_W" replaces the contents of the PC with the value 1000H and transfers control to
that location. Had the carry flag not been set, control would then have passed to the statement
immediately following the JP instruction.
The second example shows an unconditional JP. The statement "JP @00" replaces the contents
of the PC with the contents of the register pair 00H and 01H, leaving the value 0120H.
6-25
SAM88RI INSTRUCTION SET S3C9228/P9228
JR — Jump Relative
JR cc,dst
The range of the relative address is +127, –128, and the original value of the program counter is
taken to be the address of the first instruction byte following the JR statement.
Format:
Bytes Cycles Opcode Addr Mode
(1) (Hex) dst
cc | opc dst 2 6 (2) ccB RA
cc = 0 to F
NOTE: In the first byte of the two-byte instruction format, the condition code and the opcode are each four
bits.
JR C,LABEL_X → PC = 1FF7H
If the carry flag is set (that is, if the condition code is true), the statement "JR C,LABEL_X" will
pass control to the statement whose address is now in the PC. Otherwise, the program instruction
following the JR would be executed.
6-26
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
LD — Load
LD dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
dst | opc src 2 4 rC r IM
4 r8 r R
6-27
SAM88RI INSTRUCTION SET S3C9228/P9228
LD — Load
LD (Continued)
Examples: Given: R0 = 01H, R1 = 0AH, register 00H = 01H, register 01H = 20H,
register 02H = 02H, LOOP = 30H, and register 3AH = 0FFH:
LD R0,#10H → R0 = 10H
LD R0,01H → R0 = 20H, register 01H = 20H
LD 01H,R0 → Register 01H = 01H, R0 = 01H
LD R1,@R0 → R1 = 20H, R0 = 01H
LD @R0,R1 → R0 = 01H, R1 = 0AH, register 01H = 0AH
LD 00H,01H → Register 00H = 20H, register 01H = 20H
LD 02H,@00H → Register 02H = 20H, register 00H = 01H
LD 00H,#0AH → Register 00H = 0AH
LD @00H,#10H → Register 00H = 01H, register 01H = 10H
LD @00H,02H → Register 00H = 01H, register 01H = 02, register 02H = 02H
LD R0,#LOOP[R1]→ R0 = 0FFH, R1 = 0AH
LD #LOOP[R0],R1→ Register 31H = 0AH, R0 = 01H, R1 = 0AH
6-28
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
LDC/LDE dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
1. opc dst | src 2 10 C3 r Irr
NOTES:
1. The source (src) or working register pair [rr] for formats 5 and 6 cannot use register pair 0–1.
2. For formats 3 and 4, the destination address 'XS [rr]' and the source address 'XS [rr]' are each one byte.
3. For formats 5 and 6, the destination address 'XL [rr] and the source address 'XL [rr]' are each two bytes.
4. The DA and r source values for formats 7 and 8 are used to address program memory; the second set of values, used in
formats 9 and 10, are used to address data memory.
6-29
SAM88RI INSTRUCTION SET S3C9228/P9228
LDC/LDE (Continued)
Examples: Given: R0 = 11H, R1 = 34H, R2 = 01H, R3 = 04H, R4 = 00H, R5 = 60H; Program memory
locations 0061 = AAH, 0103H = 4FH, 0104H = 1A, 0105H = 6DH, and 1104H = 88H. External
data memory locations 0061H = BBH, 0103H = 5FH, 0104H = 2AH, 0105H = 7DH, and
1104H = 98H:
NOTE: These instructions are not supported by masked ROM type devices.
6-30
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
LDCD/LDED dst,src
LDCD references program memory and LDED references external data memory. The assembler
makes ‘Irr’ an even number for program memory and an odd number for data memory.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 10 E2 r Irr
Examples: Given: R6 = 10H, R7 = 33H, R8 = 12H, program memory location 1033H = 0CDH, and
external data memory location 1033H = 0DDH:
6-31
SAM88RI INSTRUCTION SET S3C9228/P9228
LDCI/LDEI dst,src
LDCI refers to program memory and LDEI refers to external data memory. The assembler makes
'Irr' even for program memory and odd for data memory.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 10 E3 r Irr
Examples: Given: R6 = 10H, R7 = 33H, R8 = 12H, program memory locations 1033H = 0CDH and
1034H = 0C5H; external data memory locations 1033H = 0DDH and 1034H = 0D5H:
6-32
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
NOP — No Operation
NOP
Operation: No action is performed when the CPU executes this instruction. Typically, one or more NOPs are
executed in sequence in order to effect a timing delay of variable duration.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 FF
NOP
6-33
SAM88RI INSTRUCTION SET S3C9228/P9228
OR — Logical OR
OR dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 42 r r
6 43 r lr
Examples: Given: R0 = 15H, R1 = 2AH, R2 = 01H, register 00H = 08H, register 01H = 37H, and register
08H = 8AH:
In the first example, if working register R0 contains the value 15H and register R1 the value 2AH,
the statement "OR R0,R1" logical-ORs the R0 and R1 register contents and stores the result
(3FH) in destination register R0.
The other examples show the use of the logical OR instruction with the various addressing modes
and formats.
6-34
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
POP dst
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 8 50 R
8 51 IR
Examples: Given: Register 00H = 01H, register 01H = 1BH, SP (0D9H) = 0BBH, and stack register
0BBH = 55H:
In the first example, general register 00H contains the value 01H. The statement "POP 00H"
loads the contents of location 0BBH (55H) into destination register 00H and then increments the
stack pointer by one. Register 00H then contains the value 55H and the SP points to location
0BCH.
6-35
SAM88RI INSTRUCTION SET S3C9228/P9228
PUSH src
Operation: SP ¨ SP – 1
@SP ¨ src
A PUSH instruction decrements the stack pointer value and loads the contents of the source (src)
into the location addressed by the decremented stack pointer. The operation then adds the new
value to the top of the stack.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc src 2 8 70 R
8 71 IR
In the first example, if the stack pointer contains the value 0C0H, and general register 40H the
value 4FH, the statement "PUSH 40H" decrements the stack pointer from 0C0 to 0BFH. It then
loads the contents of register 40H into location 0BFH. Register 0BFH then contains the value 4FH
and SP points to location 0BFH.
6-36
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
RCF RCF
Operation: C ¨ 0
The carry flag is cleared to logic zero, regardless of its previous value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 CF
The instruction RCF clears the carry flag (C) to logic zero.
6-37
SAM88RI INSTRUCTION SET S3C9228/P9228
RET — Return
RET
Operation: PC ¨ @SP
SP ¨ SP + 2
The RET instruction is normally used to return to the previously executing procedure at the end of
a procedure entered by a CALL instruction. The contents of the location addressed by the stack
pointer are popped into the program counter. The next statement that is executed is the one that
is addressed by the new program counter value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 8 AF
The statement "RET" pops the contents of stack pointer location 0BCH (10H) into the high byte of
the program counter. The stack pointer then pops the value in location 0BDH (1AH) into the PC's
low byte and the instruction at location 101AH is executed. The stack pointer now points to
memory location 0BEH.
6-38
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
RL — Rotate Left
RL dst
7 0
C
Flags: C: Set if the bit rotated from the most significant bit position (bit 7) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 90 R
4 91 IR
Examples: Given: Register 00H = 0AAH, register 01H = 02H and register 02H = 17H:
In the first example, if general register 00H contains the value 0AAH (10101010B), the statement
"RL 00H" rotates the 0AAH value left one bit position, leaving the new value 55H (01010101B)
and setting the carry and overflow flags.
6-39
SAM88RI INSTRUCTION SET S3C9228/P9228
RLC dst
7 0
C
Flags: C: Set if the bit rotated from the most significant bit position (bit 7) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 10 R
4 11 IR
Examples: Given: Register 00H = 0AAH, register 01H = 02H, and register 02H = 17H, C = "0":
In the first example, if general register 00H has the value 0AAH (10101010B), the statement "RLC
00H" rotates 0AAH one bit position to the left. The initial value of bit 7 sets the carry flag and the
initial value of the C flag replaces bit zero of register 00H, leaving the value 55H (01010101B).
The MSB of register 00H resets the carry flag to "1" and sets the overflow flag.
6-40
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
RR — Rotate Right
RR dst
7 0
C
Flags: C: Set if the bit rotated from the least significant bit position (bit zero) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 E0 R
4 E1 IR
Examples: Given: Register 00H = 31H, register 01H = 02H, and register 02H = 17H:
In the first example, if general register 00H contains the value 31H (00110001B), the statement
"RR 00H" rotates this value one bit position to the right. The initial value of bit zero is moved to
bit 7, leaving the new value 98H (10011000B) in the destination register. The initial bit zero also
resets the C flag to "1" and the sign flag and overflow flag are also set to "1".
6-41
SAM88RI INSTRUCTION SET S3C9228/P9228
RRC dst
7 0
C
Flags: C: Set if the bit rotated from the least significant bit position (bit zero) was "1".
Z: Set if the result is "0" cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Set if arithmetic overflow occurred, that is, if the sign of the destination changed during
rotation; cleared otherwise.
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 C0 R
4 C1 IR
Examples: Given: Register 00H = 55H, register 01H = 02H, register 02H = 17H, and C = "0":
In the first example, if general register 00H contains the value 55H (01010101B), the statement
"RRC 00H" rotates this value one bit position to the right. The initial value of bit zero ("1")
replaces the carry flag and the initial value of the C flag ("1") replaces bit 7. This leaves the new
value 2AH (00101010B) in destination register 00H. The sign flag and overflow flag are both
cleared to "0".
6-42
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
SBC dst,src
f the result is the same as the sign of the source; cleared otherwise.
D: Always set to "1".
H: Cleared if there is a carry from the most significant bit of the low-order four bits of the result;
set otherwise, indicating a "borrow".
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 32 r r
6 33 r lr
Examples: Given: R1 = 10H, R2 = 03H, C = "1", register 01H = 20H, register 02H = 03H, and register
03H = 0AH:
In the first example, if working register R1 contains the value 10H and register R2 the value 03H,
the statement "SBC R1,R2" subtracts the source value (03H) and the C flag value ("1") from the
destination (10H) and then stores the result (0CH) in register R1.
6-43
SAM88RI INSTRUCTION SET S3C9228/P9228
SCF
Operation: C ¨ 1
The carry flag (C) is set to logic one, regardless of its previous value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 DF
SCF
6-44
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
SRA dst
7 6 0
C
Flags: C: Set if the bit shifted from the LSB position (bit zero) was "1".
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result is negative; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 D0 R
4 D1 IR
Examples: Given: Register 00H = 9AH, register 02H = 03H, register 03H = 0BCH, and C = "1":
In the first example, if general register 00H contains the value 9AH (10011010B), the statement
"SRA 00H" shifts the bit values in register 00H right one bit position. Bit zero ("0") clears the C
flag and bit 7 ("1") is then shifted into the bit 6 position (bit 7 remains unchanged). This leaves the
value 0CDH (11001101B) in destination register 00H.
6-45
SAM88RI INSTRUCTION SET S3C9228/P9228
STOP
Operation:
The STOP instruction stops both the CPU clock and system clock and causes the microcontroller
to enter Stop mode. During Stop mode, the contents of on-chip CPU registers, peripheral
registers, and I/O port control and data registers are retained. Stop mode can be released by an
external reset operation or External interrupt input. For the reset operation, the RESET pin must
be held to Low level until the required oscillation stabilization interval has elapsed.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc 1 4 7F – –
STOP
6-46
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
SUB — Subtract
SUB dst,src
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 22 r r
6 23 r lr
Examples: Given: R1 = 12H, R2 = 03H, register 01H = 21H, register 02H = 03H, register 03H = 0AH:
In the first example, if working register R1 contains the value 12H and if register R2 contains the
value 03H, the statement "SUB R1,R2" subtracts the source value (03H) from the destination
value (12H) and stores the result (0FH) in destination register R1.
6-47
SAM88RI INSTRUCTION SET S3C9228/P9228
TCM dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always cleared to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 62 r r
6 63 r lr
Examples: Given: R0 = 0C7H, R1 = 02H, R2 = 12H, register 00H = 2BH, register 01H = 02H, and register
02H = 23H:
In the first example, if working register R0 contains the value 0C7H (11000111B) and register R1
the value 02H (00000010B), the statement "TCM R0,R1" tests bit one in the destination register
for a "1" value. Because the mask value corresponds to the test bit, the Z flag is set to logic one
and can be tested to determine the result of the TCM operation.
6-48
S3C9228/P9228 SAM88RCRI INSTRUCTION SET
TM dst,src
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always reset to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 72 r r
6 73 r lr
Examples: Given: R0 = 0C7H, R1 = 02H, R2 = 18H, register 00H = 2BH, register 01H = 02H, and register
02H = 23H:
In the first example, if working register R0 contains the value 0C7H (11000111B) and register R1
the value 02H (00000010B), the statement "TM R0,R1" tests bit one in the destination register for
a "0" value. Because the mask value does not match the test bit, the Z flag is cleared to logic zero
and can be tested to determine the result of the TM operation.
6-49
SAM88RI INSTRUCTION SET S3C9228/P9228
Flags: C: Unaffected.
Z: Set if the result is "0"; cleared otherwise.
S: Set if the result bit 7 is set; cleared otherwise.
V: Always reset to "0".
D: Unaffected.
H: Unaffected.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst src
opc dst | src 2 4 B2 r r
6 B3 r lr
Examples: Given: R0 = 0C7H, R1 = 02H, R2 = 18H, register 00H = 2BH, register 01H = 02H, and register
02H = 23H:
In the first example, if working register R0 contains the value 0C7H and if register R1 contains the
value 02H, the statement "XOR R0,R1" logically exclusive-ORs the R1 value with the R0 value
and stores the result (0C5H) in the destination register R0.
6-50
S3C9228/P9228 CLOCK CIRCUITS
7 CLOCK CIRCUITS
OVERVIEW
The S3C9228 microcontroller has two oscillator circuits: a main clock, and a sub clock circuit. The CPU and
peripheral hardware operate on the system clock frequency supplied through these circuits. The maximum CPU
clock frequency, is determined by CLKCON register settings.
— Crystal, ceramic resonator, RC oscillation source (main clock only), or an external clock
— Oscillator stop and wake-up functions
— Programmable frequency divider for the CPU clock (fxx divided by 1, 2, 8, or 16)
— Clock circuit control register, CLKCON
— Oscillator control register, OSCCON
In this document, the following notation is used for descriptions of the CPU clock:
fx main clock
fxt sub clock
fxx selected system clock
7-1
CLOCK CIRCUITS S3C9228/P9228
XIN XTIN
XOUT XTOUT
32.768 kHz
XIN XTIN
XOUT
XTOUT
XIN
XOUT
7-2
S3C9228/P9228 CLOCK CIRCUITS
The two power-down modes, Stop mode and Idle mode, affect the system clock as follows:
— In Stop mode, the main oscillator is halted. Stop mode is released, and the oscillator started, by a reset
operation, by an external interrupt, or by an internal interrupt if sub clock is selected as the clock source
(When the fx is selected as system clock).
— In Idle mode, the internal clock signal is gated away from the CPU, but continues to be supplied to the
interrupt structure, timer A/B, and watch timer. Idle mode is released by a reset or by an external or
internal interrupts.
Stop Release
INT
Selector 1
fXX
Stop
OSCCON.3
Stop
OSCCON.0 OSCCON.2
Basic Timer
STOP OSC 1/8-1/4096 Timer/Counters
inst. Watch Timer
Frequency
Dividing LCD Controller
STPCON
Circuit
SIO
1/1 1/2 1/8 1/16 A/D Converter
CLKCON.4-.3 Selector 2
CPU
7-3
CLOCK CIRCUITS S3C9228/P9228
The system clock control register, CLKCON, is located in address D4H. It is read/write addressable and has the
following functions:
CLKCON register settings control whether or not an external interrupt can be used to trigger a Stop mode release
(This is called the “IRQ wake-up” function). The IRQ “wake-up” enable bit is CLKCON.7.
After a reset, the external interrupt oscillator wake-up function is enabled, the main oscillator is activated, and the
fx/16 (the slowest clock speed) is selected as the CPU clock. If necessary, you can then increase the CPU clock
speed to fx, fx/2, or fx/8 by setting the CLKCON, and you can change system clock from main clock to sub clock
by setting the OSCCON.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
Oscillator IRQ wake-up enable bit: Not used for S3C92228 (must keep always "0")
0 = Enable IRQ for main oscillator
wake-up function in power down Divide-by selection bits for
mode CPU clock frequency:
1 = Disable IRQ for main oscillator 00 = fxx/16
wake-up function in power down 01 = fxx/8
mode 10 = fXx/2
11 = fxx
7-4
S3C9228/P9228 CLOCK CIRCUITS
The oscillator control register, OSCCON, is located in address D3H. It is read/write addressable and has the
following functions:
OSCCON.0 register settings select Main clock or Sub clock as system clock.
After a reset, Main clock is selected for system clock because the reset value of OSCCON.0 is "0".
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
7-5
CLOCK CIRCUITS S3C9228/P9228
Data loadings in the oscillator control register, OSCCON, determine whether a main or a sub clock is selected as
the CPU clock, and also how this frequency is to be divided by setting CLKCON. This makes it possible to switch
dynamically between main and sub clocks and to modify operating frequencies.
OSCCON.0 select the main clock (fx) or the sub clock (fxt) for the system clock. OSCCON .3 start or stop main
clock oscillation, and OSCCON.2 start or stop sub clock oscillation. CLKCON.4–.3 control the frequency divider
circuit, and divide the selected fxx clock by 1, 2, 8, or 16.
For example, you are using the default system clock (normal operating mode and a main clock of fx/16) and you
want to switch from the fx clock to a sub clock and to stop the main clock. To do this, you need to set OSCCON.0
to "1", take a delay, and OSCCON.3 to "1" sequently. This switches the clock from fx to fxt and stops main clock
oscillation.
The following steps must be taken to switch from a sub clock to the main clock: first, set OSCCON.3 to "0" to
enable main system clock oscillation. Then, after a certain number of machine cycles has elapsed, select the
main clock by setting OSCCON.0 to "0".
2. This example shows how to change from sub clock to main clock:
7-6
S3C9228/P9228 CLOCK CIRCUITS
The STOP control register, STPCON, is located in address E0H. It is read/write addressable and has the
following functions:
After a reset, the STOP instruction is disabled, because the value of STPCON is "other values".
If necessary, you can use the STOP instruction by setting the value of STPCON to "10100101B".
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
7-7
CLOCK CIRCUITS S3C9228/P9228
NOTES
7-8
S3C9228/P9228 RESET and POWER-DOWN
SYSTEM RESET
OVERVIEW
During a power-on reset, the voltage at VDD goes to High level and the RESET pin is forced to Low level. The
RESET signal is input through a schmitt trigger circuit where it is then synchronized with the CPU clock. This
procedure brings S3C9228/P9228 into a known operating status.
To allow time for internal CPU clock oscillation to stabilize, the RESET pin must be held to Low level for a
minimum time interval after the power supply comes within tolerance. The minimum required oscillation
stabilization time for a reset operation is 1 millisecond.
Whenever a reset occurs during normal operation (that is, when both VDD and RESET are High level), the
RESET pin is forced Low and the reset operation starts. All system and peripheral control registers are then reset
to their default hardware values (see Table 8-1).
In summary, the following sequence of events occurs during a reset operation:
— All interrupts are disabled.
— The watchdog function (basic timer) is enabled.
— The P0.0–P0.3, P1, and P2.2–P2.3 are set to schmitt trigger input mode and all pull-up resistors are disabled
for the I/O port pin circuits.
— Peripheral control and data registers are disabled and reset to their default hardware values.
— The program counter (PC) is loaded with the program reset address in the ROM, 0100H.
— When the programmed oscillation stabilization time interval has elapsed, the instruction stored in ROM
location 0100H (and 0101H) is fetched and executed.
NOTE
To program the duration of the oscillation stabilization interval, you make the appropriate settings to the
basic timer control register, BTCON, before entering Stop mode. Also, if you do not want to use the basic
timer watchdog function (which causes a system reset if a basic timer counter overflow occurs), you can
disable it by writing '1010B' to the upper nibble of BTCON.
8-1
RESET and POWER-DOWN S3C9228/P9228
POWER-DOWN MODES
STOP MODE
Stop mode is invoked by the instruction STOP. In Stop mode, the operation of the CPU and main oscillator is
halted. All peripherals which the main oscillator is selected as a clock source stop also because main oscillator
stops. But the watch timer and LCD controller will not halted in stop mode if the sub clock is selected as watch
timer clock source. The data stored in the internal register file are retained in stop mode. Stop mode can be
released in one of three ways: by a system reset, by an internal watch timer interrupt (when sub clock is selected
as clock source of watch timer), or by an external interrupt.
Example: LD STOPCON,#10100101B
STOP
NOP
NOP
NOP
LD STOPCON,#00000000B
NOTES
1. Do not use stop mode if you are using an external clock source because XIN input must be restricted
internally to VSS to reduce current leakage.
2. In application programs, a STOP instruction must be immediately followed by at least three NOP
instructions. This ensures an adequate time interval for the clock to stabilize before the next
instruction is executed. If three or more NOP instructions are not used after STOP instruction,
leakage current could be flown because of the floating state in the internal bus.
3. To enable/disable STOP instruction, the STOPCON register should be written with
10100101B/other values before/after stop instruction.
8-2
S3C9228/P9228 RESET and POWER-DOWN
IDLE MODE
Idle mode is invoked by the instruction IDLE (opcode 6FH). In Idle mode, CPU operations are halted while some
peripherals remain active. During Idle mode, the internal clock signal is gated away from the CPU and from all
but the following peripherals, which remain active:
— Interrupt logic
— Basic timer
— Timer 1 (Timer A and B)
— Watch timer
— LCD controller
I/O port pins retain the mode (input or output) they had at the time Idle mode was entered.
1. Execute a reset. All system and peripheral control registers are reset to their default values and the contents
of all data registers are retained. The reset automatically selects the slowest clock (1/16) because of the
hardware reset value for the CLKCON register. If all external interrupts are masked in the IMR register, a
reset is the only way you can release Idle mode.
2. Activate any enabled interrupt — internal or external. When you use an interrupt to release Idle mode,
the 2-bit CLKCON.4/CLKCON.3 value remains unchanged, and the currently selected clock value is
used. The interrupt is then serviced. When the return-from-interrupt condition (IRET) occurs, the
instruction immediately following the one which initiated Idle mode is executed.
8-3
RESET and POWER-DOWN S3C9228/P9228
Table 8-1 list the values for CPU and system registers, peripheral control registers, and peripheral data registers
following a RESET operation in normal operating mode. The following notation is used in these table to represent
specific RESET values:
— A "1" or a "0" shows the RESET bit value as logic one or logic zero, respectively.
— An 'x' means that the bit value is undefined following RESET.
— A dash ('–') means that the bit is either not used or not mapped.
8-4
S3C9228/P9228 RESET and POWER-DOWN
8-5
RESET and POWER-DOWN S3C9228/P9228
NOTES
8-6
S3C9228/P9228 I/O PORTS
9 I/O PORTS
OVERVIEW
The S3C9228/P9228 microcontroller has seven bit-programmable I/O ports, P0-P6. Port 0 is 6-bit port, port 1,
port 2, and port 6 are 4-bit ports, port 3 is 2-bit port, and port 4 and port 5 are 8-bit ports. This gives a total of 36
I/O pins. Each port can be flexibly configured to meet application design requirements.
The CPU accesses ports by directly writing or reading port registers. No special I/O instructions are required. All
ports of the S3C9228/P9228 except P0.4 and P0.5 can be configured to input or output mode. All LCD signal pins
are shared with normal I/O ports.
Table 9-1 gives you a general overview of S3C9228 I/O port functions.
9-1
I/O PORTS S3C9228/P9228
Table 9-2 gives you an overview of the register locations of all seven S3C9228 I/O port data registers. Data
registers for ports 1, 2, 3, 4, 5, and 6 have the general format shown in Figure 9-1.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-2
S3C9228/P9228 I/O PORTS
PORT 0
Port 0 is an 6-bit I/O port with individually configurable pins. Port 0 pins are accessed directly by writing or
reading the port 0 data register, P0 at location E4H in page 0. P0.0-P0.3 can serve as inputs (with or without pull-
up), as outputs (push-pull or open-drain) or you can be configured the following functions.
When programming this port, please remember that any alternative peripheral I/O function you configure using
the port 0 control register must also be enabled in the associated peripheral module.
Port 0 Interrupt Enable, Pending, and Edge Selection Registers (P0INT, INTPND1.3-.0, P0EDGE)
To process external interrupts at the port 0 pins, three additional control registers are provided: the port 0
interrupt enable register P0INT (EDH, page 0), the port 0 interrupt pending bits INTPND1.3-.0 (D6H, page 0), and
the port 0 interrupt edge selection register P0EDGE (EEH, page 0).
The port 0 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending
condition when the interrupt service routine has been initiated. The application program detects interrupt requests
by polling the INTPND1.3-.0 register at regular intervals.
When the interrupt enable bit of any port 0 pin is "1", a rising or falling edge at that pin will generate an interrupt
request. The corresponding INTPND1 bit is then automatically set to "1" and the IRQ level goes low to signal the
CPU that an interrupt request is waiting. When the CPU acknowledges the interrupt request, application software
must the clear the pending condition by writing a "0" to the corresponding INTPND1 bit.
9-3
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-4
S3C9228/P9228 I/O PORTS
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-5
I/O PORTS S3C9228/P9228
PORT 1
Port 1 is an 4-bit I/O port with individually configurable pins. Port 1 pins are accessed directly by writing or
reading the port 1 data register, P1 at location E5H in page 0. P1.0-P1.3 can serve as inputs (with or without pull-
up), as outputs (push-pull or open-drain) or you can be configured the following functions.
When programming this port, please remember that any alternative peripheral I/O function you configure using
the port 1 control register must also be enabled in the associated peripheral module.
Port 1 Interrupt Enable, Pending, and Edge Selection Registers (P1INT, INTPND1.7-.4, P1EDGE)
To process external interrupts at the port 1 pins, three additional control registers are provided: the port 1
interrupt enable register P1INT (F1H, page 0), the port 1 interrupt pending bits INTPND1.7-.4 (D6H, page 0), and
the port 1 interrupt edge selection register P1EDGE (F2H, page 0).
The port 1 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending
condition when the interrupt service routine has been initiated. The application program detects interrupt requests
by polling the INTPND1.7-.4 register at regular intervals.
When the interrupt enable bit of any port 1 pin is "1", a rising or falling edge at that pin will generate an interrupt
request. The corresponding INTPND1 bit is then automatically set to "1" and the IRQ level goes low to signal the
CPU that an interrupt request is waiting. When the CPU acknowledges the interrupt request, application software
must the clear the pending condition by writing a "0" to the corresponding INTPND1 bit.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-6
S3C9228/P9228 I/O PORTS
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-7
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-8
S3C9228/P9228 I/O PORTS
PORT 2
Port 2 is an 4-bit I/O port with individually configurable pins. Port 2 pins are accessed directly by writing or
reading the port 2 data register, P2 at location E6H in page 0. P2.0-P2.3 can serve as inputs (with or without pull-
up), as outputs (push-pull or open-drain) or you can be configured the following functions.
When programming this port, please remember that any alternative peripheral I/O function you configure using
the port 2 control register must also be enabled in the associated peripheral module.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-9
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-10
S3C9228/P9228 I/O PORTS
PORT 3
Port 3 is an 2-bit I/O port with individually configurable pins. Port 3 pins are accessed directly by writing or
reading the port 3 data register, P3 at location E7H in page 0. P3.0-P3.1 can serve as inputs (with or without pull-
up, and high impedance input), as outputs (push-pull or open-drain) or you can be configured the following
functions.
Port 3 Interrupt Enable, Pending, and Edge Selection Registers(P3INT, INTPND2.5-.4, P3EDGE)
To process external interrupts at the port 3 pins, three additional control registers are provided: the port 3
interrupt enable register P3INT (F7H, page 0), the port 3 interrupt pending bits INTPND2.5-.4 (D7H, page 0), and
the port 3 interrupt edge selection register P3EDGE (F8H, page 0).
The port 3 interrupt pending register bits lets you check for interrupt pending conditions and clear the pending
condition when the interrupt service routine has been initiated. The application program detects interrupt requests
by polling the INTPND2.5-.4 register at regular intervals.
When the interrupt enable bit of any port 3 pin is "1", a rising or falling edge at that pin will generate an interrupt
request. The corresponding INTPND2 bit is then automatically set to "1" and the IRQ level goes low to signal the
CPU that an interrupt request is waiting. When the CPU acknowledges the interrupt request, application software
must the clear the pending condition by writing a "0" to the corresponding INTPND2 bit.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-11
I/O PORTS S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-12
S3C9228/P9228 I/O PORTS
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
9-13
I/O PORTS S3C9228/P9228
PORT 4
Port 4 is an 8-bit I/O port with individually configurable pins. Port 4 pins are accessed directly by writing or
reading the port 4 data register, P4 at location E8H in page 0. P4.0-P4.7 can serve as inputs or as push-pull,
open-drain outputs. You can configure the following alternative functions with LCD port control register, LPOT:
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
9-14
S3C9228/P9228 I/O PORTS
PORT 5
Port 5 is an 8-bit I/O port with individually configurable pins. Port 5 pins are accessed directly by writing or
reading the port 5 data register, P5 at location E9H in page 0. P5.0-P5.7 can serve as inputs or as push-pull,
open-drain outputs. You can configure the following alternative functions with LCD port control register, LPOT:
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
P5.6/SEG18/COM5 P5.4/SEG16/COM7
P5.7/SEG19/COM4 P5.5/SEG17/COM6
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
9-15
I/O PORTS S3C9228/P9228
PORT 6
Port 6 is an 4-bit I/O port with individually configurable pins. Port 6 pins are accessed directly by writing or
reading the port 6 data register, P6 at location EAH in page 0. P6.0-P6.3 can serve as inputs or as push-pull,
open-drain outputs. You can configure the following alternative functions with LCD port control register, LPOT:
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
00 Input mode
01 Push-pull output mode
10 N-channel open-drain output mode
11 Input mode with pull-up
9-16
S3C9228/P9228 (Preliminary Spec) BASIC TIMER
10 BASIC TIMER
OVERVIEW
— As a watchdog timer to provide an automatic reset mechanism in the event of a system malfunction.
— To signal the end of the required oscillation stabilization interval after a reset or a stop mode release.
— Clock frequency divider (f xx divided by 4096, 1024, 128, or 16) with multiplexer
— 8-bit basic timer counter, BTCNT (DDH, read-only)
— Basic timer control register, BTCON (DCH, read/write)
10-1
BASIC TIMER S3C9228/P9228 (Preliminary Spec)
The basic timer control register, BTCON, is used to select the input clock frequency, to clear the basic timer
counter and frequency dividers, and to enable or disable the watchdog timer function. It is located in page 0,
address DCH, and is read/write addressable using Register addressing mode.
A reset clears BTCON to "00H". This enables the watchdog function and selects a basic timer clock frequency of
f xx/4096. To disable the watchdog function, you must write the signature code “1010B” to the basic timer register
control bits BTCON.7–BTCON.4.
The 8-bit basic timer counter, BTCNT (page 0, DDH), can be cleared at any time during normal operation by
writing a "1" to BTCON.1. To clear the frequency dividers for the basic timer input clock and timer counters, you
write a "1" to BTCON.0.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
10-2
S3C9228/P9228 (Preliminary Spec) BASIC TIMER
A reset whenever a basic timer counter overflow occurs. During normal operation, the application program must
prevent the overflow, and the accompanying reset operation, from occurring. To do this, the BTCNT value must
be cleared (by writing a "1" to BTCON.1) at regular intervals.
If a system malfunction occurs due to circuit noise or some other error condition, the BT counter clear operation
will not be executed and a basic timer overflow will occur, initiating a reset. In other words, during normal
operation, the basic timer overflow loop (a bit 7 overflow of the 8-bit basic timer counter, BTCNT) is always
broken by a BTCNT clear instruction. If a malfunction does occur, a reset is triggered automatically.
In stop mode, whenever a reset or an internal and an external interrupt occurs, the oscillator starts. The BTCNT
value then starts increasing at the rate of fxx/4096 (for reset), or at the rate of the preset clock source (for an
internal and an external interrupt). When BTCNT.3 overflows, a signal is generated to indicate that the
stabilization interval has elapsed and to gate the clock signal off to the CPU so that it can resume normal
operation.
1. During stop mode, a power-on reset or an internal and an external interrupt occurs to trigger the stop mode
release and oscillation starts.
2. If a power-on reset occurred, the basic timer counter will increase at the rate of fxx/4096. If an internal and an
external interrupt is used to release stop mode, the BTCNT value increases at the rate of the preset clock
source.
3. Clock oscillation stabilization interval begins and continues until bit 3 of the basic timer counter overflows.
4. When a BTCNT.3 overflow occurs, normal CPU operation resumes.
10-3
BASIC TIMER S3C9228/P9228 (Preliminary Spec)
RESET or STOP
Bit 1
fXX/1024
8-Bit Up Counter
fXX DIV MUX OVF
fXX/128 (BTCNT, Read-Only) RESET
fXX/16
Start the CPU (note)
R
Bit 0
NOTE: During a power-on reset operation, the CPU is idle during the required oscillation
stabilization interval (until bit 4 of the basic timer counter overflows).
10-4
S3C9228/P9228 TIMER 1
11 TIMER 1
The 16-bit timer 1 is used in one 16-bit timer or two 8-bit timers mode. If TACON.7 is set to "1", timer 1 is used
as a 16-bit timer. If TACON.7 is set to "0", timer 1 is used as two 8-bit timers.
OVERVIEW
The 16-bit timer 1 is an 16-bit general-purpose timer. Timer 1 has the interval timer mode by using the
appropriate TACON setting.
— Clock frequency divider (fxx divided by 512, 256, 64, 8, or 1, fxt, and T1CLK: External clock) with multiplexer
— 16-bit counter (TACNT, TBCNT), 16-bit comparator, and 16-bit reference data register (TADATA, TBDATA)
— Timer 1 match interrupt generation
— Timer 1 control register, TACON (page 0, BBH, read/write)
FUNCTION DESCRIPTION
The T1INT pending condition should be cleared by software when it has been serviced. Even though T1INT is
disabled, the application's service routine can detect a pending condition of T1INT by the software and execute
it's sub-routine. When this case is used, the T1INT pending bit must be cleared by the application sub-routine by
writing a "0" to the INTPND2.0 pending bit.
In interval timer mode, a match signal is generated when the counter value is identical to the values written to
the timer 1 reference data registers, TADATA and TBDATA. The match signal generates a timer 1 match
interrupt and clears the counter.
If, for example, you write the value 32H and 10H to TADATA and TBDATA, respectively, and 8EH to TACON,
the counter will increment until it reaches 3210H. At this point, the timer 1 interrupt request is generated, the
counter value is reset, and counting resumes.
11-1
TIMER 1 S3C9228/P9228
TACON is located in page 0, at address BBH, and is read/write addressable using register addressing mode.
A reset clears TACON to "00H". This sets timer 1 to disable interval timer mode, selects an input clock frequency
of fxx/512, and disables timer 1 interrupt. You can clear the timer 1 counter at any time during normal operation
by writing a "1" to TACON.3.
To enable the timer 1 interrupt, you must write TACON.7, TACON.2, and TACON.1 to "1".
To generate the exact time interval, you should write TACON.3 and INTPND2.0, which cleared counter and
interrupt pending bit. To detect an interrupt pending condition when T1INT is disabled, the application program
polls pending bit, INTPND.2.0. When a "1" is detected, a timer 1 interrupt is pending. When the T1INT sub-
routine has been serviced, the pending condition must be cleared by software by writing a "0" to the timer 1
interrupt pending bit, INTPND2.0.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
11-2
S3C9228/P9228 TIMER 1
BTCON.0 TACON.6-.4
R 1/512
Match Signal
Counter clear signal
TBDATA TADATA
Data Bus
NOTE: When one 16-bit timer mode (TACON.7 <- "1": Timer 1)
11-3
TIMER 1 S3C9228/P9228
OVERVIEW
The 8-bit timer A and B are the 8-bit general-purpose timers. Timer A and B have the interval timer mode by
using the appropriate TACON and TBCON setting, respectively.
— Enable the timer A (interval timer mode) and B operating (interval timer mode)
— Select the timer A and B input clock frequency
— Clear the timer A and B counter, TACNT and TBCNT
— Enable the timer A and B interrupt
11-4
S3C9228/P9228 TIMER 1
TACON and TBCON are located in page 0, at address BBH and BAH, and is read/write addressable using
register addressing mode.
A reset clears TACON to "00H". This sets timer A to disable interval timer mode, selects an input clock frequency
of fxx/512, and disables timer A interrupt. You can clear the timer A counter at any time during normal operation
by writing a "1" to TACON.3.
A reset clears TBCON to "00H". This sets timer B to disable interval timer mode, selects an input clock frequency
of fxx/512, and disables timer A interrupt. You can clear the timer B counter at any time during normal operation
by writing a "1" to TBCON.3.
To enable the timer A interrupt (TAINT) and timer B interrupt (TBINT), you must write TACON.7 to "0", TACON.2
(TBCON.2) and TACON.1 (TBCON.1) to "1". To generate the exact time interval, you should write TACON.3
(TBCON.3) and INTPND2.0 (INTPND2.1), which cleared counter and interrupt pending bit. To detect an interrupt
pending condition when TAINT and TBINT is disabled, the application program polls pending bit, INTPND2.0 and
INTPND2.1. When a "1" is detected, a timer A interrupt (TAINT) and timer B interrupt (TBINT) is pending. When
the TAINT and TBINT sub-routine has been serviced, the pending condition must be cleared by software by
writing a "0" to the timer A and B interrupt pending bit, INTPND2.0 and INTPND2.1.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
11-5
TIMER 1 S3C9228/P9228
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
11-6
S3C9228/P9228 TIMER 1
FUNCTION DESCRIPTION
The timer A match interrupt pending condition (INTPND2.0) and the timer B match interrupt pending condition
(INTPND2.1) must be cleared by software in the application's interrupt service by means of writing a "0" to the
INTPND2.0 and INTPND2.1 interrupt pending bit.
Even though TAINT and TBINT are disabled, the application's service routine can detect a pending condition of
TAINT and TBINT by the software and execute it's sub-routine. When this case is used, the TAINT and TBINT
pending bit must be cleared by the application sub-routine by writing a "0" to the corresponding pending bit
INTPND2.0 and INTPND2.1.
In interval timer mode, a match signal is generated when the counter value is identical to the values written to
the timer A or timer B reference data registers, TADATA or TBDATA. The match signal generates corresponding
match interrupt and clears the counter.
If, for example, you write the value 20H to TADATA and 0EH to TACON, the counter will increment until it
reaches 20H. At this point, the timer A interrupt request is generated, the counter value is cleared, and counting
resumes and you write the value 10H to TBDATA, "0" to TACON.7, and 0EH to TBCON, the counter will
increment until it reaches 10H. At this point, TB interrupt request is generated, the counter value is cleared and
counting resumes.
11-7
TIMER 1 S3C9228/P9228
BTCON.0 TACON.6-.4
R 1/512
Match Signal
Counter Clear Signal
TADATA Register
Data Bus
NOTE: When two 8-bit timers mode (TACON.7 <- "0": Timer A)
11-8
S3C9228/P9228 TIMER 1
BTCON.0 TBCON.6-.4
R
1/512
Data Bus TBCON.3
1/256 M TBCON.2
(XIN or XTIN) LSB MSB
fxx DIV 1/64 Clear
U TBCNT
1/8 (8-Bit Up-Counter) R TBCON.1
X
1/1 Match
LSB MSB
TBDATA Buffer
Match Signal
Counter Clear Signal
TBDATA Register
Data Bus
NOTE: When two 8-bit timers mode (TACON.7 <- "0": Timer B)
11-9
TIMER 1 S3C9228/P9228
NOTES
11-10
S3C9228/P9228 WATCH TIMER
12 WATCH TIMER
OVERVIEW
Watch timer functions include real-time and watch-time measurement and interval timing for the system clock.
To start watch timer operation, set bit 1 of the watch timer control register, WTCON.1 to "1".
And if you want to service watch timer overflow interrupt, then set the WTCON.6 to “1”.
The watch timer overflow interrupt pending condition (INTPND2.3) must be cleared by software in the
application's interrupt service routine by means of writing a "0" to the INTPND2.3 interrupt pending bit.
After the watch timer starts and elapses a time, the watch timer interrupt pending bit (INTPND2.3) is
automatically set to "1", and interrupt requests commence in 3.91ms, 0.25, 0.5 and 1-second intervals by setting
Watch timer speed selection bits (WTCON.3 – .2).
The watch timer can generate a steady 0.5 kHz, 1 kHz, 2 kHz, or 4 kHz signal to BUZ output pin for Buzzer. By
setting WTCON.3 and WTCON.2 to "11b", the watch timer will function in high-speed mode, generating an
interrupt every 3.91 ms. High-speed mode is useful for timing events for program debugging sequences.
Also, you can select watch timer clock source by setting the WTCON.7 appropriately value.
The watch timer supplies the clock frequency for the LCD controller (fLCD ). Therefore, if the watch timer is
disabled, the LCD controller does not operate.
12-1
WATCH TIMER S3C9228/P9228
The watch timer control register, WTCON is used to select the input clock source, the watch timer interrupt time
and Buzzer signal, to enable or disable the watch timer function. It is located in page 0 at address DAH, and is
read/write addressable using register addressing mode.
A reset clears WTCON to "00H". This disable the watch timer and select fx/128 as the watch timer clock.
So, if you want to use the watch timer, you must write appropriate value to WTCON.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
12-2
S3C9228/P9228 WATCH TIMER
WTCON.7
WTCON.6 WT INT Enable BUZ (P0.3)
WTCON.6
WTCON.5
MUX
WTCON.4 WTINT
8 fW/64 (0.5 kHz)
WTCON.3 fW/32 (1 kHz)
fW/16 (2 kHz)
WTCON.2 fW/8 (4 kHz)
Enable/Disable
WTCON.1 Selector
INTPND2.3
Circuit
WTCON.0
fW/27
fW/213
Frequency
Clock fW fW/214
Dividing
Selector fW/215 (1 Hz)
32.768 kHz Circuit
fLCD = 2048 Hz
fxt fx/128
fX = Main clock (where fx = 4.19 MHz)
fxt = Sub clock (32,768 Hz)
fW = Watch timer frequency
12-3
WATCH TIMER S3C9228/P9228
NOTES
12-4
S3C9228/P9228 LCD CONTROLLER/DRIVER
13 LCD CONTROLLER/DRIVER
OVERVIEW
The S3C9228/P9228 microcontroller can directly drive an up-to-128-dot (16segments x 8 commons) LCD panel.
Its LCD block has the following components:
— LCD controller/driver
— Display RAM for storing display data
— 16 segment output pins (SEG0–SEG15)
— 8 common output pins (COM0–COM7)
— Internal resistor circuit for LCD bias
To use the LCD controller, bit 2 in the watch mode register WMOD must be set to 1 because LCDCK is supplied
by the watch timer.
The LCD mode control register, LMOD, is used to turn the LCD display on or off, to select LCD clock frequency,
to turn the COM signal output on or off, to select bias and duty, and to switch the port 3 high impedance or
normal I/O port. Data written to the LCD display RAM can be transferred to the segment signal pins automatically
without program control.
The LCD port control register, LPOT, is used to determine the LCD signal pins used for display output.
When a sub clock is selected as the LCD clock source, the LCD display is enabled even during main clock stop
and idle modes.
COM0-COM3
4
Data BUS
LCD
COM4/SEG19-
Controller/
COM7/SEG16
8 Driver 4
SEG0/P2.1-
SEG15/P5.3
16
13-1
LCD CONTROLLER/DRIVER S3C9228/P9228
Port 16
Latch
SEG15/P5.3
SEG
Control
Display
160 16
RAM MUX
or
(Page1)
4 Selector
SEG0/P2.1
Data BUS
LPOT
fLCD
COM COM7/SEG16/P5.4
Timing Control
Controller or
selector COM4/SEG19/P5.7
COM3/P6.0
Port 8 COM
Latch Control
COM0/P6.3
LCD
LMOD Voltage
Control
P3.1/INTP/SEG2
Port Port 3
Latch 2 Control
P3.0/INTP/SEG3
13-2
S3C9228/P9228 LCD CONTROLLER/DRIVER
COM0 b0
COM1 b1
COM2 b2
COM3 b3
100H 101H 102H 103H 111H 112H 113H
COM4 b4
COM5 b5
COM6 b6
COM7 b7
13-3
LCD CONTROLLER/DRIVER S3C9228/P9228
A LMOD is located in page 0, at address FEH, and is read/write addressable using register addressing mode. It
has the following control functions.
The LMOD register is used to turn the LCD display on/off, to select duty and bias, to select LCD clock, to control
port 3 high impedance/normal I/O port, and to turn the COM signal output on/off. Following a RESET, all LMOD
values are cleared to "0". This turns off the LCD display, select 1/3 duty and 1/3 bias, and select 256Hz for LCD
clock.
The LCD clock signal determines the frequency of COM signal scanning of each segment output. This is also
referred as the LCD frame frequency. Since the LCD clock is generated by watch timer clock (fw). The watch
timer should be enabled when the LCD display is turned on.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
13-4
S3C9228/P9228 LCD CONTROLLER/DRIVER
The LCD port control register LPOT is used to control LCD signal pins or normal I/O pins. Following a RESET, a
LPOT values are cleared to "0".
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
13-5
LCD CONTROLLER/DRIVER S3C9228/P9228
The common signal output pin selection (COM pin selection) varies according to the selected duty cycle.
The 19 LCD segment signal pins are connected to corresponding display RAM locations at page 1. Bits of the
display RAM are synchronized with the common signal output pins.
When the bit value of a display RAM location is "1", a select signal is sent to the corresponding segment pin.
When the display bit is "0", a 'no-select' signal to the corresponding segment pin.
13-6
S3C9228/P9228 LCD CONTROLLER/DRIVER
COM0 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
COM1 VDD
COM2 FR VSS
COM3
COM4 1 Frame
COM5
COM6
COM7 VDD
S S S S S
VLC1
E E E E E
G G G G G COM0 VLC2 (VLC3)
0 1 2 3 4 VLC4
VSS
VDD
VLC1
COM1 VLC2 (VLC3)
VLC4
VSS
VDD
VLC1
COM2 VLC2 (VLC3)
VLC4
VSS
VDD
VLC1
SEG0 VLC2 (VLC3)
VLC4
VSS
+ VDD
+ 1/4VLCD
SEG0-COM0 0V
- 1/4VLCD
-VLCD
13-7
LCD CONTROLLER/DRIVER S3C9228/P9228
SEG0
SEG1
0 1 2 3 0 1 2 3
VDD
COM0 VSS
1 Frame
COM1
COM2 VDD
VLC1(VLC2)
COM0
COM3 VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM1
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM2
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM3
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG0
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG1
VLC3(VLC4)
VSS
+ VLCD
+ 1/3 VLCD
COM0-SEG0 0V
- 1/3 V LCD
- VLCD
13-8
S3C9228/P9228 LCD CONTROLLER/DRIVER
0 1 2 0 1 2
VDD
COM0 VSS
1 Frame
VDD
COM1 VLC1(VLC2)
COM0
VLC3(VLC4)
COM2
VSS
VDD
VLC1(VLC2)
COM1
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
COM2
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG0
VLC3(VLC4)
VSS
VDD
VLC1(VLC2)
SEG1
VLC3(VLC4)
VSS
+ VLCD
+ 1/3 VLCD
COM0-SEG0 0V
- 1/3 VLCD
- VLCD
13-9
LCD CONTROLLER/DRIVER S3C9228/P9228
NOTES
13-10
S3C9228/P9228 A/D CONVERTER
OVERVIEW
The 10-bit A/D converter (ADC) module uses successive approximation logic to convert analog levels entering at
one of the four input channels to equivalent 10-bit digital values. The analog input level must lie between the
AVREF and AVSS values. The A/D converter has the following components:
FUNCTION DESCRIPTION
To initiate an analog-to-digital conversion procedure, at first you must set with alternative function for ADC input
enable at port 1, the pin set with alternative function can be used for ADC analog input. And you write the
channel selection data in the A/D converter control register ADCON.4–.5 to select one of the four analog input
pins (AD0–3) and set the conversion start or enable bit, ADCON.0. The read-write ADCON register is located in
page 0, at address D0H. The pins which are not used for ADC can be used for normal I/O.
During a normal conversion, ADC logic initially sets the successive approximation register to 800H (the
approximate half-way point of an 10-bit register). This register is then updated automatically during each
conversion step. The successive approximation block performs 10-bit conversions for one input channel at a
time. You can dynamically select different channels by manipulating the channel selection bit value (ADCON.5–
4) in the ADCON register. To start the A/D conversion, you should set the enable bit, ADCON.0. When a
conversion is completed, ADCON.3, the end-of-conversion(EOC) bit is automatically set to 1 and the result is
dumped into the ADDATAH/ADDATAL register where it can be read. The A/D converter then enters an idle state.
Remember to read the contents of ADDATAH/ADDATAL before another conversion starts. Otherwise, the
previous result will be overwritten by the next conversion result.
NOTE
Because the A/D converter has no sample-and-hold circuitry, it is very important that fluctuation in the analog
level at the AD0–AD3 input pins during a conversion procedure be kept to an absolute minimum. Any change in
the input level, perhaps due to noise, will invalidate the result. If the chip enters to STOP or IDLE mode in
conversion process, there will be a leakage current path in A/D block. You must use STOP or IDLE mode after
ADC operation is finished.
14-1
A/D CONVERTER S3C9228/P9228
CONVERSION TIMING
The A/D conversion process requires 4 steps (4 clock edges) to convert each bit and 10 clocks to set-up A/D
conversion. Therefore, total of 50 clocks are required to complete an 10-bit conversion: When fxx/8 is selected
for conversion clock with an 4.5 MHz fxx clock frequency, one clock cycle is 1.78 us. Each bit conversion
requires 4 clocks, the conversion rate is calculated as follows:
4 clocks/bit × 10-bit + set-up time = 50 clocks, 50 clock × 1.78 us = 89 us at 0.56 MHz (4.5 MHz/8)
Note that A/D converter needs at least 25µs for conversion time.
The A/D converter control register, ADCON, is located at address D0H in page 0. It has three functions:
After a reset, the start bit is turned off. You can select only one analog input channel at a time. Other analog
input pins (AD0–AD3) can be selected dynamically by manipulating the ADCON.4–5 bits. And the pins not used
for analog input can be used for normal I/O function.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
14-2
S3C9228/P9228 A/D CONVERTER
In the ADC function block, the analog input voltage level is compared to the reference voltage. The analog input
level must remain within the range VSS to VDD.
Different reference voltage levels are generated internally along the resistor tree during the analog conversion
process for each conversion step. The reference voltage level for the first conversion bit is always 1/2 VDD.
BLOCK DIAGRAM
ADCON.2-.1
ADCON.4-5
(Select one input pin of the assigned pins)
Clock To ADCON.3
Selector (EOC Flag)
ADCON.0
(AD/C Enable)
M Analog
Input Pins - Successive
Comparator
AD0-AD3 U Approximation
(P1.0-P1.3) .. + Logic & Register
. X
ADCON.0
(AD/C Enable)
P1CON
(Assign Pins to ADC Input) Conversion Result
10-bit D/A VDD
(ADDATAH/ADDATAL,
Converter VSS D1H/D2H, Page 0)
14-3
A/D CONVERTER S3C9228/P9228
VDD
Analog AD0-AD3
Input Pin
(VSS ≤ ADC input ≤ VDD) C 101 S3C9228
Figure 14-4. Recommended A/D Converter Circuit for Highest Absolute Accuracy
14-4
S3C9228/P9228 SERIAL I/O INTERFACE
OVERVIEW
Serial I/O modules, SIO can interface with various types of external device that require serial data transfer. The
components of SIO function block are:
The SIO module can transmit or receive 8-bit serial data at a frequency determined by its corresponding control
register settings. To ensure flexible data transmission rates, you can select an internal or external clock source.
PROGRAMMING PROCEDURE
1. Configure the I/O pins at port (SCK/SI/SO) by loading the appropriate value to the P2CON register if
necessary.
2. Load an 8-bit value to the SIOCON control register to properly configure the serial I/O module. In this
operation, SIOCON.2 must be set to "1" to enable the data shifter.
3. For interrupt generation, set the serial I/O interrupt enable bit (SIOCON) to "1".
4. When you transmit data to the serial buffer, write data to SIODATA and set SIOCON.3 to 1, the shift
operation starts.
5. When the shift operation (transmit/receive) is completed, the SIO pending bit (INTPND2.2) are set to "1" and
SIO interrupt request is generated.
15-1
SERIAL I/O INTERFACE S3C9228/P9228
The control register for serial I/O interface module, SIOCON, is located at E1H in page 0. It has the control
setting for SIO module.
A reset clears the SIOCON value to "00H". This configures the corresponding module with an internal clock
source at the SCK, selects receive-only operating mode, and clears the 3-bit counter. The data shift operation
and the interrupt are disabled. The selected data direction is MSB-first.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
15-2
S3C9228/P9228 SERIAL I/O INTERFACE
The prescaler register for serial I/O interface module, SIOPS, are located at E3H in page 0.
The value stored in the SIO pre-scale register, SIOPS, lets you determine the SIO clock rate (baud rate) as
follows:
Baud rate = Input clock (fxx/4)/(Prescaler value + 1), or SCK input clock.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
SIOCON.4 SIOCON.2
(Edge Select) (Shift Enable)
M SIOCON.5
SCK (Mode Select)
SIOPS (E3H, page 0) U CLK 8-Bit SIO Shift Buffer
SO
fxx/2 8-bit P.S. 1/2 (SIODATA, E2H, page 0)
X
SIOCON.6
(LSB/MSB First
Mode Select)
8
SI
Data Bus
15-3
SERIAL I/O INTERFACE S3C9228/P9228
SCK
Transmit
SIO INT
Complete
Set SIOCON.3
Figure 15-4. Serial I/O Timing in Transmit/Receive Mode (Tx at falling, SIOCON.4 = 0)
SCK
Transmit
SIO INT
Complete
Set SIOCON.3
Figure 15-5. Serial I/O Timing in Transmit/Receive Mode (Tx at rising, SIOCON.4 = 1)
15-4
S3C9228/P9228 ELECTRICAL DATA
16 ELECTRICAL DATA
OVERVIEW
In this chapter, S3C9228/P9228 electrical characteristics are presented in tables and graphs. The information is
arranged in the following order:
16-1
ELECTRICAL DATA S3C9228/P9228
(TA = 25°C)
Parameter Symbol Conditions Rating Unit
Supply voltage VDD – – 0.3 to + 6.5 V
Input voltage VIN Ports 0–6 – 0.3 to VDD + 0.3 V
Output voltage VO – – 0.3 to VDD + 0.3 V
Output current High I OH One I/O pin active – 15 mA
All I/O pins active – 60
Output current Low I OL One I/O pin active + 30 mA
Total pin current for ports + 100
Operating TA – – 25 to + 85 °C
temperature
Storage TSTG – – 65 to + 150 °C
temperature
16-2
S3C9228/P9228 ELECTRICAL DATA
16-3
ELECTRICAL DATA S3C9228/P9228
NOTES:
1. Supply current does not include current drawn through internal pull-up resistors, LCD voltage dividing resistors, and
ADC.
2. IDD1 and IDD2 include power consumption for subsystem clock oscillation.
3. IDD3 and IDD4 are current when main system clock oscillation stops and the subsystem clock is used.
4. IDD5 is current when main system clock and subsystem clock oscillation stops.
16-4
S3C9228/P9228 ELECTRICAL DATA
(TA = – 25 °C to + 85 °C)
Parameter Symbol Conditions Min Typ Max Unit
Data retention supply VDDDR – 2.0 – 5.5 V
voltage
Data retention supply IDDDR Stop mode, TA = 25 °C – – 1 µA
current VDDDR = 2.0 V
Idle Mode
(Basic Timer Active)
~
~
Stop Mode
Normal
Data Retention Mode Operating Mode
~
~
VDD
VDDDR
Execution of 0.8 VDD
STOP Instruction
tWAIT
Figure 16-1. Stop Mode Release Timing When Initiated by an External Interrupt
16-5
ELECTRICAL DATA S3C9228/P9228
RESET Oscillation
Occurs Stabilization
TIme
~
~
Stop Mode
Normal
~ Data Retention Mode Operating Mode
VDD
~
VDDDR
Execution of
STOP Instrction
RESET
0.8 VDD
16-6
S3C9228/P9228 ELECTRICAL DATA
16-7
ELECTRICAL DATA S3C9228/P9228
tINTL tINTH
16-8
S3C9228/P9228 ELECTRICAL DATA
tRSL
RESET
0.2 VDD
tKCY
tKL tKH
SCK
0.8VDD
0.2VDD
tSIK tKSI
0.8VDD
SI
0.2VDD
tKSO
SO Output Data
16-9
ELECTRICAL DATA S3C9228/P9228
XOUT
XOUT
XOUT
XOUT
XOUT
16-10
S3C9228/P9228 ELECTRICAL DATA
1/fx
tXL tX
XIN VDD-0.1 V
0.1 V
16-11
ELECTRICAL DATA S3C9228/P9228
1/fxt
tXTL tXTH
XTIN
VDD-0.1 V
0.1 V
16-12
S3C9228/P9228 ELECTRICAL DATA
2 MHz 8 MHz
400 kHz
1 2 6
2.7 5.5
Supply Voltage (V)
16-13
ELECTRICAL DATA S3C9228/P9228
NOTES
16-14
S3C9228/P9228 MECHANICAL DATA
17 MECHANICAL DATA
OVERVIEW
The S3C9228/P9228 microcontroller is currently available in a 42-pin SDIP and 44-pin QFP package.
15.24
42-SDIP-600
- 0 .1
.05
5
0.2+0
#1 #21
5.08 MAX
0.2
39.50 MAX
3.50 ±
39.10 ± 0.2
0.51 MIN
3.30 ± 0.3
0.50 ± 0.1
17-1
MECHANICAL DATA S3C9228/P9228
13.20 ± 0.3
0-8
10.00 ± 0.2 + 0.10
0.15 - 0.05
10.00 ± 0.2
13.20 ± 0.3
0.80 ± 0.20
#44
#1 + 0.10
0.35 - 0.05
0.05 MIN
0.80 (1.00)
2.05 ± 0.10
2.30 MAX
17-2
S3C9228/P9228 S3P9228 OTP
18 S3P9228 OTP
OVERVIEW
The S3P9228 single-chip CMOS microcontroller is the OTP (One Time Programmable) version of the S3C9228
microcontroller. It has an on-chip OTP ROM instead of masked ROM. The EPROM is accessed by serial data
format.
The S3P9228 is fully compatible with the S3C9228, both in function and in pin configuration. Because of its
simple programming requirements, the S3P9228 is ideal for use as an evaluation chip for the S3C9228.
COM4/SEG19/P5.7
P0.0/TAOUT/INT
P0.1/T1CLK/INT
P0.3/BUZ/INT
COM0/P6.3
COM1/P6.2
COM2/P6.1
COM3/P6.0
P0.2/INT
P0.5
P0.4
44
43
42
41
40
39
38
37
36
35
34
P1.0/AD0/INT 1 33 COM5/SEG18/P5.6
P1.1/AD1/INT 2 32 COM6/SEG17/P5.5
SDAT/P1.2/AD2/INT 3 31 COM7/SEG16/P5.4
SCLK/P1.3/AD3/INT 4 30 SEG15/P5.3
VDD/VDD 5 S3C9228 29 SEG14/P5.2
VSS/VSS 6 28 SEG13/P5.1
XOUT 7 (44-QFP) 27 SEG12/P5.0
XIN 8 26 SEG11/P4.7
VPP/TEST 9 25 SEG10/P4.6
XTIN 10 24 SEG9/P4.5
XTOUT 11 23 SEG8/P4.4
12
13
14
15
16
17
18
19
20
21
22
SEG1/P2.0/SCK
SEG0/P2.1/SO
SEG2/P3.1/INTP
SEG3/P3.0/INTP
SEG4/P4.0
SEG5/P4.1
SEG6/P4.2
SEG7/P4.3
RESET/RESET
P2.2/SI
P2.3
RESET
18-1
S3P9228 OTP S3C9228/P9228
COM1/P6.2 1 42 COM2/P6.1
COM0/P6.3 2 41 COM3/P6.0
P0.0/TAOUT/INT 3 40 COM4/SEG19/P5.7
P0.1/T1CLK/INT 4 39 COM5/SEG18/P5.6
P0.2/INT 5 38 COM6/SEG17/P5.5
P0.3/BUZ/INT 6 37 COM7/SEG16/P5.4
P1.0/AD0/INT 7 36 SEG15/P5.3
P1.1/AD1/INT 8 35 SEG14/P5.2
S3C9228
(42-SDIP)
SDAT/P1.2/AD2/INT 9 34 SEG13/P5.1
SCLK/P1.3/AD3/INT 10 33 SEG12/P5.0
VDD/VDD 11 32 SEG11/P4.7
VSS/VSS 12 31 SEG10/P4.6
XOUT 13 30 SEG9/P4.5
XIN 14 29 SEG8/P4.4
VPP/TEST 15 28 SEG7/P4.3
XTIN 16 27 SEG6/P4.2
XTOUT 17 26 SEG5/P4.1
RESET /RESET 18 25 SEG4/P4.0
P2.3 19 24 SEG3/P3.0/INTP
P2.2/SI 20 23 SEG2/P3.1/INTP
SEG0/P2.1/SO 21 22 SEG1/P2.0/SCK
18-2
S3C9228/P9228 S3P9228 OTP
When 12.5 V is supplied to the VPP(TEST) pin of the S3P72C8, the EPROM programming mode is entered.
The operating mode (read, write, or read protection) is selected according to the input signals to the pins listed in
Table 17-3 below.
18-3
S3P9228 OTP S3C9228/P9228
NOTES:
1. Supply current does not include current drawn through internal pull-up resistors, LCD voltage dividing resistors, and
ADC.
2. IDD1 and IDD2 include power consumption for subsystem clock oscillation.
3. IDD3 and IDD4 are current when main system clock oscillation stops and the subsystem clock is used.
4. IDD5 is current when main system clock and subsystem clock oscillation stops.
18-4
S3C9228/P9228 S3P9228 OTP
2 MHz 8 MHz
400 kHz
1 2 6
2.7 5.5
Supply Voltage (V)
18-5
S3P9228 OTP S3C9228/P9228
NOTES
18-6
S3C9228/P9228 DEVELOPMENT TOOLS
19 DEVELOPMENT TOOLS
OVERVIEW
Samsung provides a powerful and easy-to-use development support system in turn key form. The development
support system is configured with a host system, debugging tools, and support software. For the host system, any
standard computer that operates with MS-DOS as its operating system can be used. One type of debugging tool
including hardware and software is provided: the sophisticated and powerful in-circuit emulator, SMDS2+, for
S3C7, S3C8, S3C9 families of microcontrollers. The SMDS2+ is a new and improved version of SMDS2.
Samsung also offers support software that includes debugger, assembler, and a program for setting options.
SHINE
Samsung Host Interface for In-Circuit Emulator, SHINE, is a multi-window based debugger for SMDS2+. SHINE
provides pull-down and pop-up menus, mouse support, function/hot keys, and context-sensitive hyper-linked
help. It has an advanced, multiple-windowed user interface that emphasizes ease of use. Each window can be
sized, moved, scrolled, highlighted, added, or removed completely.
SAMA ASSEMBLER
The Samsung Arrangeable Microcontroller (SAM) Assembler, SAMA, is a universal assembler, and generates
object code in standard hexadecimal format. Assembled program code includes the object code that is used for
ROM data and required SMDS program control data. To assemble programs, SAMA requires a source file and
an auxiliary definition (DEF) file with device specific information.
SASM86
The SASM86 is an relocatable assembler for Samsung's S3C9-series microcontrollers. The SASM86 takes a
source file containing assembly language statements and translates into a corresponding source code, object
code and comments. The SASM86 supports macros and conditional assembly. It runs on the MS-DOS operating
system. It produces the relocatable object code only, so the user should link object file. Object files can be linked
with other object files and loaded into memory.
HEX2ROM
HEX2ROM file generates ROM code from HEX file which has been produced by assembler. ROM code must be
needed to fabricate a microcontroller which has a mask ROM. When generating the ROM code (.OBJ file) by
HEX2ROM, the value “FF” is filled into the unused ROM area up to the maximum ROM size of the target device
automatically.
TARGET BOARDS
Target boards are available for all S3C9-series microcontrollers. All required target system cables and adapters
are included with the device-specific target board.
19-1
DEVELOPMENT TOOLS S3C9228/P9228
IBM-PC AT or Compatible
RS-232C SMDS2+
Target
PROM/OTP Writer Unit Application
System
Probe
Adapter
BUS
Trace/Timer Unit
POD TB9228
SAM8 Base Unit Target
Board
EVA
Power Supply Unit Chip
19-2
S3C9228/P9228 DEVELOPMENT TOOLS
The TB9228 target board is used for the S3C9228 microcontroller. It is supported by the SMDS2+ development
system.
+
C11
VCC
R1
D1
C1
U2
R7
C20
R8
Y1
GND
T1T2 T3T4
25 CB+ R5 R4
C3
C4
C5
C6
C7
20 J1
C10
C9
J101 J102
30 20 10 1 42SDIP 44QFP
1 42 1 44
160
T16 40
CN1 50 150 T15
T14 5 5 40
T13
60 140
10 T12
T11 35
70 130 T10
T9 10 10 35
80
30
90 100 110 120 15 30
15
1 C14
51
25
76 26 20 25
21 22
22 23
P2
SMDS2 SMDS2+
SM1347A
19-3
DEVELOPMENT TOOLS S3C9228/P9228
SMDS2/SMDS2+
The SMDS2/SMDS2+
To User_VCC
supplies VCC only to the target
Off On External
VCC Target board (evaluation chip). The
TB9228
System target system must have its
VSS own power supply.
VCC
SMDS2/SMDS2+
NOTE: The following symbol in the "To User_VCC" Setting column indicates the electrical short (off) configuration:
19-4
S3C9228/P9228 DEVELOPMENT TOOLS
SMDS2 SMDS2+
R/W R/W
Target
Board
SMDS2+
Table 19-3. Using Single Header Pins as the Input Path for External Trigger Sources
Target Board Part Comments
Ch2
You can connect an external trigger source to one of the two external
trigger channels (CH1 or CH2) for the SMDS2+ breakpoint and trace
functions.
IDLE LED
The Green LED is ON when the evaluation chip (S3E9220) is in idle mode.
STOP LED
The Red LED is ON when the evaluation chip (S3E9220) is in stop mode.
19-5
DEVELOPMENT TOOLS S3C9228/P9228
J101 J102
42-SDIP 44-QFP
19-6
S3C9228/P9228 DEVELOPMENT TOOLS
J101 J101
50-Pin DIP Connector
1 42 1 42
21 22 21 22
J102 J102
1 44 1 44
50-Pin Connector
50-Pin Connector
22 23 22 23
19-7
DEVELOPMENT TOOLS S3C9228/P9228
NOTES
19-8