ps0315 PDF
ps0315 PDF
S3F94C8/S3F94C4
Product Specification
PS031501-0813
PRELIMINARY
ii
As used herein
Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b)
support or sustain life and whose failure to perform when properly used in accordance with instructions for
use provided in the labeling can be reasonably expected to result in a significant injury to the user. A criti-
cal component is any component in a life support device or system whose failure to perform can be reason-
ably expected to cause the failure of the life support device or system or to affect its safety or effectiveness.
Document Disclaimer
©2013 Zilog, Inc. All rights reserved. Information in this publication concerning the devices, applications,
or technology described is intended to suggest possible uses and may be superseded. ZILOG, INC. DOES
NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE
INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZILOG ALSO
DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED
IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED
HEREIN OR OTHERWISE. The information contained within this document has been verified according
to the general principles of electrical and mechanical engineering.
S3 and Z8 are trademarks or registered trademarks of Zilog, Inc. All other product or service names are the
property of their respective owners.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
iii
Revision History
Each instance in this document’s revision history reflects a change from its previous edi-
tion. For more details, refer to the corresponding page(s) or appropriate links furnished in
the table below.
Revision
Date Level Description Page
Aug 01 Original Zilog issue. A table of contents and PDF bookmarks will appear in the All
2013 next edition, due to be published on or before Winter 2013.
1 PRODUCT OVERVIEW
SAM88RCRI MICROCONTROLLERS
Samsung's SAM88RCRI series of 8-bit single-chip CMOS microcontrollers offers a fast and efficient CPU, a wide
range of integrated peripherals, and various programmable ROM sizes. Important CPU features include:
A address/data bus architecture and a large number of bit-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.
S3F94C8/F94C4 MICROCONTROLLER
The S3F94C8/F94C4 single-chip 8-bit microcontroller is designed for useful A/D converter application field. The
S3F94C8/F94C4 single-chip CMOS micro-controller is fabricated using a highly advanced CMOS process and is
based on Samsung's powerful SAM88RCRI CPU architecture. Stop and idle (power-down) modes were
implemented to reduce power consumption.
The S3F94C8 is a micro-controller with a 8-Kbyte multi-time-programmable Full Flash ROM embedded.
The S3F94C4 is a micro-controller with a 4-Kbyte multi-time-programmable Full Flash ROM embedded.
The S3C94C8/F94C4 is a versatile general-purpose microcontrollers that is ideal for use in a wide range of
electronics applications requiring simple timer/counter, PWM. In addition, the S3F94C8/F94C4 advanced CMOS
technology provides for low power consumption and wide operating voltage range.
Using the SAM88RCRI design approach, the following peripherals were integrated with the powerful core:
The S3F94C8/F94C4 microcontroller is ideal for use in a wide range of electronic applications requiring simple
timer/counter, PWM, ADC. They are currently available in 20 DIP Package, 20/16-pin SOP Package, 20 SSOP
Package and 16 TSSOP Package.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
2
FEATURES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
3
BLOCK DIAGRAM
P0.0/ADC0/INT0
XIN
OSC P0.1/ADC1/INT1
XOUT
P0.2/ADC2
Port 0
Port I/O and P0.3/ADC3
Interrupt Control
...
Basic
Timer P0.7/ADC7
Timer 0 P1.0
Port 1 P1.1
SAM88RCRI CPU P1.2
ADC0-ADC8 ADC
P2.0/T0
P2.1
Port 2
208 Byte
...
4/8 KB ROM
Register File P2.6/ADC8/CLO
P0.6/PWM PWM
IVC LVR
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
4
PIN ASSIGNMENTS
VSS 1 20 VDD
P2.3 8 13 P0.6/ADC6/PWM
P2.4 9 12 P0.7/ADC7
P2.5 10 11 P2.6/ADC8/CLO
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
VSS 1 16 VDD
P2.1 6 11 P0.4/ADC4
P2.2 7 10 P0.5/ADC5
P2.3 8 9 P0.6/ADC6/PWM
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
6
PIN DESCRIPTIONS
Table 1-2. S3F94C8/F94C4 Pin Descriptions
Pin Input/ Pin Description Pin Share
Name Output Type Pins
P0.0–P0.7 I/O Bit-programmable I/O port for Schmitt trigger input or E-1 ADC0–ADC7
push-pull output. Pull-up resistors are assignable by INT0/INT1/
software. Port0 pins can also be used as A/D converter PWM
input, PWM output or external interrupt input.
P1.0–P1.1 I/O Bit-programmable I/O port for Schmitt trigger input or E-2 XIN, XOUT
push-pull, open-drain output. Pull-up resistors or pull-down
resistors are assignable by software.
1
P1.2 I Schmitt trigger input port B RESET
P2.0–P2.6 I/O Bit-programmable I/O port for Schmitt trigger input or E –
push-pull, open-drain output. Pull-up resistors are ADC8/CLO
assignable by software. T0
XIN, XOUT – Crystal/Ceramic, or RC oscillator signal for system clock. P1.0–P1.1
nRESET I Internal LVR or external RESET B P1.2
VDD, VSS – Voltage input pin and ground –
CLO O System clock output port E P2.6
INT0–INT1 I External interrupt input port E-1 P0.0, P0.1
PWM O 14-Bit high speed PWM output E-1 P0.6
T0 O Timer0 match output E-1 P2.0
ADC0–ADC8 I A/D converter input E-1 P0.0–P0.7
E P2.6
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
7
PIN CIRCUITS
VDD
P-channel
IN IN
N-channel
Figure 1-4. Pin Circuit Type A Figure 1-5. Pin Circuit Type B (P1.2)
VDD
VDD
Pull-up
Enable
Data
Out Data
Circuit
Type C I/O
Output Output
DIsable Disable
Digital
Input
Figure 1-6. Pin Circuit Type C Figure 1-7. Pin Circuit Type D
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
8
VDD
Open-drain
Enable
Pull-up
P2CONH VDD enable
P2CONL
Alternative P-CH
Output M Data
U I/O
P2.x X
N-CH
Output Disable
(Input Mode)
Digital
Input
Analog Input
Enable
ADC
VDD
Pull-up
VDD enable
P0CONH
Alternative P-CH
Output M Data
U I/O
P0.x X
N-CH
Output Disable
(Input Mode)
Digital Input
Interrupt Input
Analog Input
Enable
ADC
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
VDD
Open-drain
Enable
Pull-up
VDD enable
P1.x
I/O
Output Disable
(Input Mode)
Pull-down
enable
Digital
Input
XIN
XOUT
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
10
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
11
2 ADDRESS SPACES
OVERVIEW
A 16-bit address bus supports program memory operations. A separate 8-bit register bus carries addresses and
data between the CPU and the internal register file.
The S3F94C8/F94C4 have 8-Kbytes and 4-Kbytes of multi-time-programmable full flash program memory: which
is configured as the Internal ROM mode, all of the 4K/8K internal program memory is used.
The S3F94C8/F94C4 microcontroller has 208 general-purpose registers in its internal register file. 32 bytes in the
register file are mapped for system and peripheral control functions.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
12
PROGRAM MEMORY (ROM)
The first 2-bytes of the ROM (0000H–0001H) are interrupt vector address.
Unused locations (0002H–00FFH except 3CH, 3DH, 3EH, and 3FH) can be used as normal program memory.
3CH, 3DH, 3EH, 3FH is used as smart option ROM cell.
(Decimal) (HEX)
8.191 1FFFH
(S3F94C8)
8-Kbyte
Program
Memory
(Flash)
4.095 0FFFH
(S3F94C4)
4-Kbyte
Program
Memory
(Flash)
256 0100H
Program Start
64 0040H
Smart option ROM cell
60 003CH
2 0002H
1 Interrupt Vector 0001H
0 0000H
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Smart Option 13
Smart option is the ROM option for starting condition of the chip.
The ROM addresses used by smart option are from 003CH to 003FH. The S3F94C8/F94C4 only use 003EH,
003FH. Not used ROM address 003CH, 003DH should be initialized to be initialized to 00H. The default values of
ROM 003EH, 003FH are FFH (LVR enable, internal RC oscillator).
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
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
14
) PROGRAMMING TIP — Smart Option Setting
; << Interrupt Vector Address >>
ORG 0000H
Vector 00H, INT_94C8 ; S3F94C8/F94C4 has only one interrupt vector
ORG 003CH
DB 00H ; 003CH, must be initialized to 0.
DB 00H ; 003DH, must be initialized to 0.
DB 0E4H ; 003EH, enable LVR (2.3 V)
DB 03H ; 003FH, Internal RC (3.2 MHz in VDD = 5 V)
ORG 0100H
RESET: DI
•
•
•
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
15
REGISTER ARCHITECTURE
The upper 64-bytes of the S3F94C8/F94C4’s internal register file are addressed as working registers, system
control registers and peripheral control registers. The lower 192-bytes of internal register file (00H–BFH) is called
the general purpose register space.
240 registers in this space can be accessed; 208 are available for general-purpose use.
In case of S3F94C8/F94C4 the total number of addressable 8-bit registers is 240. Of these 240 registers, 32 bytes
are for CPU and system control registers and peripheral control and data registers, 16 bytes are used as shared
working registers, and 192 registers are for general-purpose use.
For many SAM88RCRI microcontrollers, the addressable area of the internal register file is further expanded by
additional register pages at the general purpose register space (00H–BFH: page0). This register file expansion is
not implemented in the S3F94C8/F94C4, however.
The specific register types and the area (in bytes) that they occupy in the internal register file are summarized in
Table 2-1.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
16
FFH
Peripheral Control
Registers
64 Bytes of E0H
Common Area DFH
System Control
Registers
D0H
CFH
Working Registers
C0H
BFH
General Purpose
192 Bytes Register File
and Stack Area
~
00H
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
17
COMMON WORKING REGISTER AREA (C0H–CFH)
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. However, because the S3F94C8/F94C4 uses only
page 0, you can use the common area for any internal data operation.
The working register addressing mode and indirect register 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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
18
SYSTEM STACK
S3F9-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 S3F94C8/F94C4 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-5.
High Address
PCL
PCL
PCH
Top of
PCH
stack Top of
Flags
stack
Because only internal memory 192 bytes space is implemented in the S3F94C8/F94C4, the SP must be initialized
to an 8-bit value in the range 00H–0C0H.
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. We recommend that a stack pointer is initialized to
C0H to set upper address of stack to BFH.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
19
) PROGRAMMING TIP — Standard Stack Operations Using PUSH and POP
The following example shows you how to perform stack operations in the internal register file using PUSH and
POP instructions:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
20
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
21
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)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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 an 16-byte working register space in the register file
and an 4-bit register within that space (see Figure 3-2).
8-Bit Register
File Address dst OPERAND
Point to one
OPCODE
register 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
working register
Two-Operand (1 of 16) C0H
Instruction
(Example)
Sample Instruction:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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
register in register
file
One-Operand
Instruction (Example) Address of operand
used by instruction
Sample Instruction:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Register File
Program Memory
REGISTER
Example
Instruction dst PAIR
References OPCODE Point to
Program register pair
16-bit
Memory address
points to
Program Memory program
memory
Value used in
instruction OPERAND
Sample Instructions:
CALL @RR2
JP @RR2
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Register File
CFH
.
.
Program Memory .
.
4-Bit
Working 4 LSBs
dst src OPERAND
Register Point to the
Address OPCODE
working register
(1 of 16) C0H
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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 Program Memory
LSB Selects points to
or program
Data Memory memory
or data
memory
Value used in
instruction OPERAND
Sample Instructions:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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
– 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 ~ ~
X (OFFSET)
4 LSBs
Two-Operand dst src INDEX
Point to one of the
Instruction OPCODE
working register
Example (1 of 16)
Sample Instruction:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Value used in
OPERAND
16-Bit 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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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
+
16-Bit 16-Bit
Program Memory
or
Datamemory
Sample Instructions:
LDC R4, #1000H[RR2] ; The values in the program address (RR2 + #1000H)
are loaded into register R4.
LDE R4, #1000H[RR2] ; Identical operation to LDC example, except that
external program memory is accessed.
Figure 3-9. Indexed Addressing to Program or Data Memory with Long Offset
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Program Memory
Next OPCODE
Program
Memory
Address
Used
Sample Instructions:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
33
4 CONTROL REGISTERS
OVERVIEW
In this section, detailed descriptions of the S3F94C8/F94C4 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
36
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")
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
37
ADCON — A/D Converter Control Register F7H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
38
BTCON — Basic Timer Control Register DCH
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
39
CLKCON — Clock Control Register D4H
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 – – 0 0 – – –
Read/Write R/W – – R/W R/W – – –
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
40
FLAGS — System Flags Register D5H
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 – – – –
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
41
FMCON — Flash Memory Control Register ECH
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
Reset Value 0 0 0 0 – – – 0
Read/Write R/W R/W R/W R/W – – – R/W
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
42
FMSECH — Flash Memory Sector Address Register (High Byte) EEH
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
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
43
FMUSR — Flash Memory User Programming Enable Register EDH
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
44
P0CONH — Port 0 Control Register (High Byte) E6H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
45
P0CONL — Port 0 Control Register (Low Byte) E7H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
46
P0PND — Port 0 Interrupt Pending Register E8H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
47
P1CON — Port 1 Control Register E9H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
48
P2CONH — Port 2 Control Register (High Byte) EAH
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
49
P2CONL — Port 2 Control Register (Low Byte) EBH
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
50
PWMCON — PWM Control Register F3H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
51
PWMEX — PWM Extension Register F1H
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
52
STOPCON — STOP Mode Control Register E4H
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
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
53
T0CON — TIMER 0 Control Register D2H
Bit Identifier .7 .6 .5 .4 .3 .2 .1 .0
RESET Value 0 0 – – 0 – 0 0
Read/Write R/W R/W – – R/W – R/W R/W
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
54
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
55
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 an interrupt vector which is assigned in ROM address 0000H.
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: either globally, or by specific interrupt source.
The system-level control points in the interrupt structure are therefore:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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 respectively, by modifying SYM.3.
NOTE
The system initialization routine executed after a reset must always contain an EI instruction to globally
enable the interrupt structure.
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.
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 an interrupt priority register in SAM88RCRI, the order of service is determined by a sequence
of source which is executed in interrupt service routine.
Source Interrupts
Source Interrupts Enable
Interrpt priority
is determind by
software polling
method Vector
Interrupt
Cycle
Global Interrupt
Control (EI, DI instruction)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
— PWM overflow
— Timer 0 match
— P0.0 external interrupt
— P0.1 external interrupt
0000H PWMCON.1
0001H
P0PND.0 P0.0 External Interrupt
P0PND.1
SYM.3
(EI, DI) P0PND.2 P0.1 External Interrupt
P0PND.3
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
For each interrupt source there is one or more corresponding peripheral control registers that let you control the
interrupt generated by the related peripheral (see Table 5-1).
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
NOTES 60
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
61
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 Chapter 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 Chapter 3, "Addressing
Modes".
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Load Instructions
Arithmetic Instructions
Logic Instructions
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The flags register FLAGS 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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
RR Register pair or working register pair reg or RRp (reg = 0–254, even number only, where
p = 0, 2, ..., 14)
IR Indirect register or indirect working register @Rn or @reg (reg = 0–255, n = 0–15)
IRR Indirect register pair or indirect working @RRp or @reg (reg = 0–254, even only, where
register pair p = 0, 2, ..., 14)
XS Indexed (short offset) addressing mode #addr[RRp] (addr = range – 128 to + 127, where
p = 0, 2, ..., 14)
XL Indexed (long offset) addressing mode #addr [RRp] (addr = range 0–8191, where
p = 0, 2, ..., 14)
RA Relative addressing mode addr (addr = number in the range + 127 to – 128 that is
an offset relative to the address of the next instruction)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
OPCODE MAP
– 0 1 2 3 4 5 6 7
R 4 OR OR OR OR OR
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
OPCODE MAP
– 8 9 A B C D E F
U 0 LD LD JR LD JP INC
r1,R2 r2,R1 cc,RA r1,IM cc,DA r1
P 1 p p p p p p
P 2
E 3
R 4
N 6 IDLE
I 7 p p p p p p STOP
B 8 DI
B 9 EI
L A RET
E B IRET
C RCF
H D p p p p p p SCF
E E CCF
X F LD LD JR LD JP INC NOP
r1,R2 r2,R1 cc,RA r1,IM cc,DA r1
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
CONDITION CODES 69
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.
NOTES:
1. It indicates condition codes that are related to two different mnemonics but which test the same flag.
For example, Z and EQ are both true if the zero flag (Z) is set, but after an ADD instruction, Z would probably be used;
after a CP instruction, however, EQ would probably be used.
2. For operations involving unsigned numbers, the special condition codes UGE, ULT, UGT, and ULE must be used.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
INSTRUCTION DESCRIPTIONS 70
This section contains detailed information and programming examples for each instruction in the SAM87RI
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:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
71
ADC — Add with Carry
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.
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
72
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.
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
73
AND — Logical AND
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".
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
74
CALL — Call Procedure
CALL dst
Operation: SP m SP – 1
@SP m PCL
SP m SP –1
@SP m PCH
PC m 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
75
CCF — Complement Carry Flag
CCF
Operation: C mNOT 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
76
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
77
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".
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 60 R
4 61 IR
COM R1 o R1 = 0F8H
COM @R1 o 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).
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
78
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
79
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.
Format:
Bytes Cycles Opcode Addr Mode
(Hex) dst
opc dst 2 4 00 R
4 01 IR
DEC R1 o R1 = 02H
DEC @R1 o 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
80
DI — Disable Interrupts
DI
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 8F
DI
If the value of the SYM register is 08H, the statement "DI" leaves the new value 00H in the register
and clears SYM.3 to "0", disabling interrupt processing.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
81
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 08H, enabling all interrupts. (SYM.3 is the enable bit for global interrupt
processing.)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
82
IDLE — Idle Operation
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
NOP
NOP
NOP
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
83
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.
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 o R0 = 1CH
INC 00H o Register 00H = 0DH
INC @R0 o 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
84
IRET — Interrupt Return
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 10 BF
12
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
85
JP — Jump
JP cc,dst (Conditional)
JP dst (Unconditional)
Format: (1)
Bytes Cycles Opcode Addr Mode
(2) (Hex) dst
cc | opc dst 3 8 ccD DA
cc = 0 to F
NOTES:
1. The 3-byte format is used for a conditional jump and the 2-byte format for an unconditional jump.
2. In the first byte of the three-byte instruction format (conditional jump), the condition code and the
op code are both four bits.
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
86
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
(note) (Hex) dst
cc | opc dst 2 6 ccB RA
cc = 0 to F
NOTE: In the first byte of the two-byte instruction format, the condition code and the op code are each
four bits.
JR C,LABEL_X o 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
87
LD — Load
LD dst,src
Format:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
88
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 o R0 = 10H
LD R0,01H o R0 = 20H, register 01H = 20H
LD 01H,R0 o Register 01H = 01H, R0 = 01H
LD R1,@R0 o R1 = 20H, R0 = 01H
LD @R0,R1 o R0 = 01H, R1 = 0AH, register 01H = 0AH
LD 00H,01H o Register 00H = 20H, register 01H = 20H
LD 02H,@00H o Register 02H = 20H, register 00H = 01H
LD 00H,#0AH o Register 00H = 0AH
LD @00H,#10H o Register 00H = 01H, register 01H = 10H
LD @00H,02H o Register 00H = 01H, register 01H = 02, register 02H = 02H
LD R0,#LOOP[R1] o R0 = 0FFH, R1 = 0AH
LD #LOOP[R0],R1 o Register 31H = 0AH, R0 = 01H, R1 = 0AH
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
89
LDC/LDE — Load Memory
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
90
LDC/LDE — Load Memory
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:
LDC (note) @RR2,R0 ; 11H (contents of R0) is loaded into program memory
; location 0104H (RR2),
; working registers R0, R2, R3 o no change
LDE @RR2,R0 ; 11H (contents of R0) is loaded into external data memory
; location 0104H (RR2),
; working registers R0, R2, R3 o no change
LDC (note) #01H[RR4],R0 ; 11H (contents of R0) is loaded into program memory location
; 0061H (01H + 0060H)
LDE #01H[RR4],R0 ; 11H (contents of R0) is loaded into external data memory
; location 0061H (01H + 0060H)
LDC (note) 1105H,R0 ; 11H (contents of R0) is loaded into program memory location
; 1105H, (1105H) m 11H
LDE 1105H,R0 ; 11H (contents of R0) is loaded into external data memory
; location 1105H, (1105H) m 11H
NOTE: These instructions are not supported by masked ROM type devices.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
91
LDCD/LDED — Load Memory and Decrement
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:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
92
LDCI/LDEI — Load Memory and Increment
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:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
93
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
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
94
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".
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
95
POP — Pop From Stack
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
96
PUSH — Push To Stack
PUSH src
Operation: SP mSP – 1
@SP msrc
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
PUSH @40H o Register 40H = 4FH, register 4FH = 0AAH, stack register
0BFH = 0AAH, SP = 0BFH
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
97
RCF — Reset Carry Flag
RCF RCF
Operation: C m0
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
98
RET — Return
RET
Operation: PC m@SP
SP mSP + 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
10
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
99
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.
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
100
RLC — Rotate Left Through Carry
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.
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
101
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.
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".
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
102
RRC — Rotate Right Through Carry
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.
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".
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
103
SBC — Subtract With Carry
SBC dst,src
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
104
SCF — Set Carry Flag
SCF
Operation: C m1
The carry flag (C) is set to logic one, regardless of its previous value.
Format:
Bytes Cycles Opcode
(Hex)
opc 1 4 DF
SCF
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
105
SRA — Shift Right Arithmetic
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".
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
106
STOP — Stop Operation
STOP
Operation: The STOP instruction stops the 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 – –
halts all microcontroller operations. When STOPCON register is not #0A5H value, if you use STOP
instruction, PC is changed to reset address.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
107
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
108
TCM — Test Complement Under Mask
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".
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
109
TM — Test Under Mask
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".
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
110
XOR — Logical Exclusive OR
XOR 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".
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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
111
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
112
7 CLOCK CIRCUIT
OVERVIEW
By smart option (3FH.1 – .0 in ROM), user can select internal RC oscillator, external RC oscillator, or external
oscillator. In using internal oscillator, XIN (P1.0), XOUT (P1.1) can be used by normal I/O pins. An internal RC
oscillator source provides a typical 3.2 MHz or 0.5 MHz (in VDD = 5 V) depending on smart option.
An external RC oscillation source provides a typical 4MHz clock for S3F94C8/F94C4. An internal capacitor
supports the RC oscillator circuit. An external crystal or ceramic oscillation source provides a maximum 10 MHz
clock. The XIN and XOUT pins connect the oscillation source to the on-chip clock circuit. Simplified external RC
oscillator and crystal/ceramic oscillator circuits are shown in Figures 7-1 and 7-2. When you use external oscillator,
P1.0, P1.1 must be set to output port to prevent current consumption.
XIN
C1 XIN
R S3F94C8/F94C4
S3F94C8/F94C4
XOUT
C2 XOUT
To increase processing speed and to reduce clock noise, non-divided logic is implemented for the main oscillator
circuit. For this reason, very high-resolution waveforms (square signal edges) must be generated in order for the
CPU to efficiently process logic operations.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The two power-down modes, Stop mode and Idle mode, affect clock oscillation as follows:
— In Stop mode, the main oscillator "freezes", halting the CPU and peripherals. The contents of the register file
and current system register values are retained. Stop mode is released, and the oscillator started, by a reset
operation or by an external interrupt with RC-delay noise filter (for S3F94C8/F94C4, INT0–INT1).
— In Idle mode, the internal clock signal is gated off to the CPU, but not to interrupt control and the timer. The
current CPU status is preserved, including stack pointer, program counter, and flags. Data in the register file is
retained. Idle mode is released by a reset or by an interrupt (external or internally-generated).
The system clock control register, CLKCON, is located in location D4H. It is read/write addressable and has the
following functions:
The CLKCON register controls 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, and the fOSC/16 (the slowest clock speed)
is selected as the CPU clock. If necessary, you can then increase the CPU clock speed to fOSC, fOSC /2 or fOSC /8.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
114
Smart Option
(3F.1-0 in ROM) Stop
Instruction
CLKCON.4-.3
Internal RC
Oscillator (3.2MHz)
Oscillator
Stop
Internal RC
Oscillator (0.5 MHz)
Selected 1/2 M
MUX
External OSC U CPU Clock
Crystal/Ceramic 1/8 X
Oscillator Oscillator
Wake-up 1/16
External RC
Oscillator Noise
Filter
P2.6/CLO
CLKCON.7 P2CONH.6-.4
INT Pin
NOTE: An external interrupt (with RC-delay noise filter) can be used to release stop mode
and "wake-up" the main oscillator.
In the S3F94C8/F94C4, the INT0-INT1 external interrupts are of this type.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
115
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
116
SYSTEM RESET
OVERVIEW
By smart option (3EH.7 in ROM), user can select internal RESET (LVR) or external RESET. In using internal
RESET (LVR), nRESET pin (P1.2) can be used by normal I/O pin.
— by external power-on-reset
— by the external nRESET input pin pulled low
— by the digital watchdog peripheral timing out
— by Low Voltage Reset (LVR)
During a external power-on reset, the voltage at VDD is High level and the nRESET pin is forced to Low level. The
nRESET signal is input through a Schmitt trigger circuit where it is then synchronized with the CPU clock. This
brings the S3F94C8/F94C4 into a known operating status. To ensure correct start-up, the user should take care
that nRESET signal is not released before the VDD level is sufficient to allow MCU operation at the chosen
frequency.
The nRESET pin must be held to Low level for a minimum time interval after the power supply comes within
tolerance in order to allow time for internal CPU clock oscillation to stabilize. The minimum required oscillation
stabilization time for a reset is approximately 52.4 ms (@ 219/fOSC, fOSC = 10 MHz).
When a reset occurs during normal operation (with both VDD and nRESET at High level), the signal at the nRESET
pin is forced Low and the Reset operation starts. All system and peripheral control registers are then set to their
default hardware Reset values (see Table 8-1).
The MCU provides a watchdog timer function in order to ensure graceful recovery from software malfunction. If
watchdog timer is not refreshed before an end-of-counter condition (overflow) is reached, the internal reset will be
activated.
The on-chip Low Voltage Reset, features static Reset when supply voltage is below a reference value (Typ. 1.9,
2.3, 3.0, 3.6, 3.9 V). Thanks to this feature, external reset circuit can be removed while keeping the application
safety. As long as the supply voltage is below the reference value, there is a internal and static RESET. The MCU
can start only when the supply voltage rises over the reference value.
When you calculate power consumption, please remember that a static current of LVR circuit should be added a
CPU operating current in any operating modes such as Stop, Idle, and normal RUN mode when LVR enable in
Smart Option.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
117
Watchdog RESET
RESET
N.F
Comparator
VIN
+ When the VDD level
N.F is lower than VLVR
VREF
-
Longger than 1us
VDD
VREF BGR
NOTES:
1. The target of voltage detection level is the one you selected at smart option 3EH.
2. BGR is Band Gap voltage Reference
NOTE
To program the duration of the oscillation stabilization interval, you must 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.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
When the nRESET pin transiting from VIL (low input level of reset pin) to VIH (high input level of reset pin), the
reset pulse is generated.
VDD
XIN
R
nRESET XOUT
C
S3F94C8/F94C4
VSS
Notes:
1. R < 100Kohm is recommended to make sure that the voltage drop across R
does not violate the detection of reset pulse.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Smart Option
(3EH.7)
nRESET
MUX Internal nRESET
LVR nRESET
Watchdog nRESET
nRESET Input
RESET Operation
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
120
POWER-DOWN MODES
STOP MODE
Stop mode is invoked by the instruction STOP (opcode 7FH). In Stop mode, the operation of the CPU and all
peripherals is halted. That is, the on-chip main oscillator stops and the supply current is reduced to less than 4PA
except that the LVR(Low Voltage Reset) is enable. All system functions are halted when the clock "freezes", but
data stored in the internal register file is retained. Stop mode can be released in one of two ways: by a nRESET
signal or by an external interrupt.
NOTE: Before execute the STOP instruction, must set the STPCON register as “10100101b”.
Note that when Stop mode is released by an external interrupt, the current values in system and peripheral control
registers are not changed. When you use an interrupt to release Stop mode, the CLKCON.3 and CLKCON.4
register values remain unchanged, and the currently selected clock value is used. If you use an external interrupt
for Stop mode release, you can also program the duration of the oscillation stabilization interval. To do this, you
must put the appropriate value to BTCON register before entering Stop mode.
The external interrupt is serviced when the Stop mode release occurs. Following the IRET from the service routine,
the instruction immediately following the one that initiated Stop mode is executed.
IDLE MODE
Idle mode is invoked by the instruction IDLE (opcode 6FH). In Idle mode, CPU operations are halted while select
peripherals remain active. During Idle mode, the internal clock signal is gated off to the CPU, but not to interrupt
logic and timer/counters. 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 a slow clock (f OSC/16) because CLKCON.3
and CLKCON.4 are cleared to "00B". If interrupts are masked, a Reset is the only way to release Idle mode.
2. Activate any enabled interrupt, causing Idle mode to be released. When you use an interrupt to release Idle
mode, the CLKCON.3 and CLKCON.4 register values remain unchanged, and the currently selected clock
value is used. The interrupt is then serviced. Following the IRET from the service routine, the instruction
immediately following the one that initiated Idle mode is executed.
NOTES
1. Only external interrupts that are not clock-related can be used to release stop mode. To release Idle
mode, however, any type of interrupt (that is, internal or external) can be used.
2. Before enter the STOP or IDLE mode, the ADC must be disabled. Otherwise, the STOP or IDLE
current will be increased significantly.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
121
HARDWARE RESET VALUES
Table 8-1 lists the values for CPU and system registers, peripheral control registers, and peripheral data registers
following a Reset operation in normal operating mode.
— 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 a reset.
— A dash ("–") means that the bit is either not used or not mapped.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
123
) PROGRAMMING TIP — Sample S3F94C8/F94C4 Initialization Routine
;--------------<< Interrupt Vector Address >>
ORG 0000H
VECTOR 00H,INT_94C4 ; S3F94C8/F94C4 has only one interrupt vector
LD P0CONH,#10101010B ;
LD P0CONL,#10101010B ; P0.0–P0.7 push-pull output
LD P1CON,#00001010B ; P1.0–P1.1 push-pull output
LD P2CONH,#01001010B ;
LD P2CONL,#10101010B ; P2.0–P2.6 push-pull output
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
124
) PROGRAMMING TIP — Sample S3F94C8/F94C4 Initialization Routine (Continued)
;--------------<< Main loop >>
KEY_SCAN: NOP ;
x
x
x
RET
LED_DISPLAY: NOP ;
x
x
x
RET
JOB: NOP ;
x
x
x
RET
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
125
) PROGRAMMING TIP — Sample S3F94C8/F94C4 Initialization Routine (Continued)
;--------------<< Interrupt Service Routines >> ; Interrupt enable bit and pending bit check
NEXT_CHK1:
NEXT_CHK2:
NEXT_CHK3:
END_INT ; IRET
INT_TIMER0:
x ;
x
AND T0CON,#11110110B ; Pending bit clear
IRET ; Interrupt return
PWMOVF_INT:
x
x
AND PWMCON,#11110110B ; Pending bit clear
IRET ; Interrupt return
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
126
) PROGRAMMING TIP — Sample S3F94C8/F94C4 Initialization Routine (Continued)
;--------------< External interrupt0 service routine >
INT0_INT: x
x
AND P0PND,#11111110B ; INT0 Pending bit clear
IRET ; Interrupt return
INT1_INT: x
x
AND P0PND,#11111011B ; INT1 Pending bit clear
IRET ; Interrupt return
x
x
END ;
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
127
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
128
9 I/O PORTS
OVERVIEW
The S3F94C8/F94C4 has three I/O ports: with 18 pins total. You access these ports directly by writing or reading
port data register addresses.
All ports can be configured as LED drive. (High current output: typical 10 mA)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Table 9-2 gives you an overview of the port data register names, locations, and addressing characteristics. Data
registers for ports 0-2 have the structure shown in Figure 9-1.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
Pn.0
Pn.1
Pn.2
Pn.3
Pn.4
Pn.5
Pn.6
Pn.7
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PORT 0 130
Port 0 is a bit-programmable, general-purpose, I/O ports. You can select normal input or push-pull output mode. In
addition, you can configure a pull-up resistor to individual pins using control register settings.
It is designed for high-current functions such as LED direct drive. Part 0 pins can also be used as alternative
functions (ADC input, external interrupt input and PWM output).
Two control resisters are used to control Port 0: P0CONH (E6H) and P0CONL (E7H).
You access port 0 directly by writing or reading the corresponding port data register, P0 (E0H).
VDD
PWM M
U In/Out
P0 Data X
Output DIsable
(input mode)
D1
Input Data MUX
D0
Circuit type A
External Noise
Interrupt Input Filter
To ADC
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
131
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
132
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
133
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PORT 1 134
Port 1, is a 3-bit I/O port with individually configurable pins. It can be used for general I/O port (Schmitt trigger input
mode, push-pull output mode or n-channel open-drain output mode). In addition, you can configure a pull-up and
pull-down resistor to individual pin using control register settings. It is designed for high-current functions such as
LED direct drive.P1.0, P1.1 are used for oscillator input/output by smart option. Also, P1.2 is used for RESET pin
by smart option (LVR disable ).
NOTE: When P1.2 is configured as a general I/O port, it can be used only for Schmitt trigger input. P1.2 is also
shared with VPP pin for Flash Programming, so it have intrinsic internal pull-down resistor (about 300Kohm),
Please consider about the pull-down resistor when it used as I/O port.
One control register is used to control port 1: P1CON (E9H).You address port 1 bits directly by writing or reading
the port 1 data register, P1 (E1H). When you use external oscillator, P1.0, P1.1 must be set to output port to
prevent current consumption.
VDD
Pull-Up Register
(50 k: typical)
Pull-up
Enable
Open-Drain VDD
Smart option
P1 Data In/Out
MUX
Output DIsable
(input mode)
D1
Input Data MUX
D0
Circuit type A
XIN, XOUT or RESET
Pull-Down
Enable
Pull-Down Register
(50 k: typical)
135
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
NOTE: 1.When you use external oscillator, P1.0, P1.1 must be set to
output port to prevent current consumption.
2. when you enable LVR in smart option, P1.2(nRESET/VPP)
can be and can only be used as input port.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PORT 2 136
Port 2 is a 7-bit I/O port with individually configurable pins. It can be used for general I/O port (Schmitt trigger input
mode, push-pull output mode or N-channel open-drain output mode). You can also use some pins of port 2 ADC
input, CLO output and T0 clock output. In addition, you can configure a pull-up resistor to individual pins using
control register settings. It is designed for high-current functions such as LED direct drive.
You address port 2 bits directly by writing or reading the port 2 data register, P2 (E2H). The port 2 control register,
P2CONH and P2CONL is located at addresses EAH, EBH respectively.
VDD
CLO, T0 M
U In/Out
P0 Data X
Output DIsable
(input mode)
D1
Input Data MUX
D0
Circuit Type A
to ADC
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
137
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
NOTE: When noise problem is important issue, you had better not
use CLO output
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
138
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
139
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
140
MODULE OVERVIEW
The S3F94C8/F94C4 has two default timers: an 8-bit basic timer, one 8-bit general-purpose timer/counter, called
timer 0.
— 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.
Timer 0
Timer 0 has the following functional components:
— Clock frequency divider (fOSC divided by 4096, 256, 8, or fOSC) with multiplexer
— 8-bit counter (T0CNT), 8-bit comparator, and 8-bit data register (T0DATA)
— Timer 0 control register (T0CON)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
141
BASIC TIMER (BT)
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.
A Reset clears BTCON to "00H". This enables the watchdog function and selects a basic timer clock frequency of
fOSC/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, can be cleared during normal operation by writing a "1" to BTCON.1. To
clear the frequency dividers for both the basic timer input clock and the timer 0 clock, you write a "1" to BTCON.0.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
NOTE: When you write a 1 to BTCON.0 (or BTCON.1), the basic timer
divider (or basic timer counter) is cleared. The bit is then cleared
automatically to 0.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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 external interrupt occurs, the oscillator starts. The BTCNT value then starts
increasing at the rate of fOSC/4096 (for Reset), or at the rate of the preset clock source (for an external interrupt).
When BTCNT.7 is set, 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, an external power-on Reset or an external interrupt occurs to trigger the Stop mode
release and oscillation starts.
2. If an external power-on Reset occurred, the basic timer counter will increase at the rate of f OSC/4096. If 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 7 of the basic timer counter is set.
4. When a BTCNT.7 is set, normal CPU operation resumes.
Figure 10-2 and 10-3 shows the oscillation stabilization time on RESET and STOP mode release
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
143
0.8 V DD
VDD
Reset Release
Voltage
RESET
trst ~
~ RC
Internal
Reset
Release 0.8 V DD
Oscillator
(X OUT )
BTCNT
clock
BTCNT 10000000B
value
00000000B
t WAIT = (4096x128)/f OSC
NOTE: Duration of the oscillator stabilization wait time, t WAIT , when it is released by a
Power-on-reset is 4096 x 128/fOSC.
tRST ~
~ RC (R and C are value of external power on Reset)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
144
STOP
Instruction STOP Mode
Execution Release Signal
External
Interrupt
RESET
STOP
Release
Signal
Oscillator
(X OUT )
BTCNT
clock
10000000B
BTCNT
00000000B
Value tWAIT
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
145
) PROGRAMMING TIP — Configuring the Basic Timer
This example shows how to configure the basic timer to sample specification.
ORG 0000H
VECTOR 00H, INT_94C4 ; S3F94C8/F94C4 has only one interrupt vector
ORG 003CH
DB 00H ; 003CH, must be initialized to 0
DB 00H ; 003DH, must be initialized to 0
DB 0E7H ; 003EH, enable LVR (2.3 V)
DB 03H ; 003FH, internal RC (3.2 MHz in VDD = 5 V)
ORG 0100H
MAIN: x
LD BTCON, #02H ; Enable watchdog function
; Basic counter (BTCNT) clear
x
x
x
JR T, MAIN ;
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
146
TIMER 0
The timer 0 control register, T0CON, is used to select the timer 0 operating mode (interval timer) and input clock
frequency, to clear the timer 0 counter, and to enable the T0 match interrupt. It also contains a pending bit for T0
match interrupts.
A Reset clears T0CON to "00H". This sets timer 0 to normal interval timer mode, selects an input clock frequency
of fOSC /4096, and disables the T0 match interrupts. The T0 counter can be cleared at any time during normal
operation by writing a "1" to T0CON.3.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
T0CON.3
CLK Counter (T0CNT) R (clear)
Timer 0 counter clear
Match
Comparator PND T0INT
Interrupt Enable/Disable
NOTE: T0CON.3 is not auto-cleared, you must pay attention when clear pending bit
(refer to P10-12)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
148
Counter Clear
(T0CON.3)
Interrupt Request
(T0CON.0)
T0 Match Output
(P2.0)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
149
Bit 1
RESET or
STOP
Bit 0
Bits 7, 6 Data Bus
R 1/4096
1/256 T0CNT (D0H) Clear Bit 3
XIN DIV MUX (Read-Only)
1/8
1 Bit 1
Match
8-Bit Comparator Bit 0 IRQ0
P2.0
P2CONL.1-.0
T0DATA Buffer
Bit 3
Match Signal
T0DATA (D1H)
(Read/Write)
Basic Timer Control Register
NOTE: During a power-on Reset operation, the CPU is idle during the required oscillation stabilization interval
(until bit 7 the basic timer counter is set).
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
150
) PROGRAMMING TIP1 – Configuring Timer 0 (Interval Mode)
The following sample program sets Timer 0 to interval timer mode.
ORG 0000H
VECTOR 00H, INT_94C4 ; S3F94C8/F94C4 has only one interrupt vector
ORG 003CH
DB 00H ; 003CH, must be initialized to 0
DB 00H ; 003DH, must be initialized to 0
DB 0E7H ; 003EH, enable LVR (2.3 V)
DB 03H ; 003FH, internal RC (3.2 MHz in VDD = 5 V)
ORG 0100H
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
151
) PROGRAMMING TIP1 – Configuring Timer 0 (Interval Mode) (Continued)
LED_DISPLAY: NOP ;
x ;
x ;
x ;
RET ;
JOB: NOP ;
x ;
x ;
x ;
RET ;
x
x
x
AND T0CON, #11110110B ; Pending bit clear
IRET ;
x
x
END ;
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
152
OVERVIEW
This microcontroller has the PWM circuit. The PWM can be configured as one of these three resolutions:
These three resolutions are mutually exclusive; only one resolution can work at any time. And which resolution is
used is selected by PWMEX.1-.0.
The operation of all PWM circuit is controlled by a single control register, PWMCON.
The PWM counter is an incrementing counter. It is used by the PWM circuits. To start the counter and enable the
PWM circuits, you set PWMCON.2 to "1". If the counter is stopped, it retains its current count value; when re-
started, it resumes counting from the retained count value. When there is a need to clear the counter you set
PWMCON.3 to "1".
You can select a clock for the PWM counter by set PWMCON.6-.7. Clocks which you can select are fOSC /64,
fOSC /8, fOSC /2, fOSC /1.
FUNCTION DESCRIPTION
PWM
PWM Counter
The PWM counter is an incrementing counter comprised of a lower base counter and an upper extension counter.
To determine the PWM module's base operating frequency, the lower base counter is compared to the PWM
base data register value. In order to achieve higher resolutions, the extension bits of the upper counter can be
used to modulate the "stretch" cycle. To control the "stretching" of the PWM output duty cycle at specific intervals,
the extended counter value is compared with the value that you write to the module's extension bits.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PWM (duty) data consist of base data bits and extension data bits; determine the output value generated by the
PWM circuit. For each PWM resolution, the location of base data bits and extension data bits are different
combination of register PWMDATA (F2H), PWMDATA1 (F0H) and PWMEX (F1H):
PWMDATA1 .7 .6 .5 .4 .3 .2 .1 .0 LSB
F0H, Reset: 00H
Base 2 (for 14-bit PWM)
PWMDATA .7 .6 .5 .4 .3 .2 .1 .0 LSB
F2H, Reset: 00H
Base 0 (for 8-bit PWM) Ext 0 (for 8-bit PWM)
PWMEX .7 .6 .5 .4 .3 .2 .1 .0 LSB
F1H, Reset: 00H
Ext 1 (for 12/14-bit PWM) Base/Ext Co
ontrol
To program the required PWM output, you load the appropriate initialization values into the data registers
(PWMDATA) and the extension registers (PWMEX). To start the PWM counter, or to resume counting, you set
PWMCON.2 to "1".
A reset operation disables all PWM output. The current counter value is retained when the counter stops. When
the counter starts, counting resumes at the retained value.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The timing characteristic of PWM output is based on the f OSC clock frequency. The PWM counter clock value is
determined by the setting of PWMCON.6–.7.
The value in the extension counter is compared with the extension settings in the extension data bits. This
extension counter value, together with extension logic and the PWM module's extension bits, is then used to
"stretch" the duty cycle of the PWM output. The "stretch" value is one extra clock period at specific intervals, or
cycles (see Table 11-2).
If, for example, in 8-bit base + 6-bit extension mode, the value in the extension register is '04H', the 32nd cycle
will be one pulse longer than the other 63 cycles. If the base duty cycle is 50 %, the duty of the 32nd cycle will
therefore be "stretched" to approximately 51% duty. For example, if you write 80H to the extension register, all
odd-numbered cycles will be one pulse longer. If you write FCH to the extension register, all cycles will be
stretched by one pulse except the 64th cycle. PWM output goes to an output buffer and then to the corresponding
PWM output pin. In this way, you can obtain high output resolution at high frequencies.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Table 11-2. PWM output "stretch" Values for Extension Data bits Ext0 (PWMDATA.1–.0)
PWMDATA Bit (Bit1–Bit0) "Stretched" Cycle Number
00 –
01 2
10 1, 3
11 1, 2, 3
0H 40H 80H
PWM
4 MHz
Clock:
000000xxB
250 ns 250 ns
PWM 000001xxB
Data
Register
Values:
100000xxB
(PWMDATA) 8 us 8 us
111111xxB
250 ns
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
156
0H 40H
PWM Clock: 4 MHz
500 ns
000010xxB
PWMDATA
: 0000 1001B
Basic Extended
waveform waveform
1st 2nd 3th 4th 1st 2nd 3th 4th
0H 40H
4 MHz
750 ns
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Table 11-3. PWM output "stretch" Values for Extension Data bits Ext1 (PWMEX.7-.2)
PWMEX Bit "Stretched" Cycle Number
7 1, 3, 5, 7, 9, . . . , 55, 57, 59, 61, 63
6 2, 6, 10, 14, . . . , 50, 54, 58, 62
5 4, 12, 20, . . . , 44, 52, 60
4 8, 24, 40, 56
3 16, 48
2 32
0H 40H 80H
PWM
Clock: 4MHz
0H
PWMDATA1
Register 250ns 250ns
1H
Values:
20H 8 μs 8 μs
3FH
250ns
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
158
0H 40H
PWM
Clock: 4MHz
PWMDATA1
Register 500ns
2H
Values: 02H
0H 40H
4MHz
750ns
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
159
Table 11-4. PWM output "stretch" Values for Extension Data bits Ext1 (PWMEX.7-.2)
PWMEX Bit "Stretched" Cycle Number
7 1, 3, 5, 7, 9, . . . , 55, 57, 59, 61, 63
6 2, 6, 10, 14, . . . , 50, 54, 58, 62
5 4, 12, 20, . . . , 44, 52, 60
4 8, 24, 40, 56
3 16, 48
2 32
0H 100H 200H
PWM Cycle
Clock: 4MHz
Pulse
0H
PWMDATA1
Register 250ns 250ns
1H
Values:
EFH
250ns
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
160
0H 100H
PWM
Clock: 4MHz
PWMDATA1
Register 500ns
2H
Values: 02H
0H 100H
4MHz
750ns
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The control register for the PWM module, PWMCON, is located at register address F3H. PWMCON is used for all
three PWM resolutions. Bit settings in the PWMCON register control the following functions:
A reset clears all PWMCON bits to logic zero, disabling the entire PWM module.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The extension register for the PWM module, PWMEX, is located at register address F1H. PWMEX are used for
resolution selection and extension bits of 6+6 and 8+6 resolution. Bit settings in the PWMEX register control the
following functions:
— PWM Extension bits for 6+6 resolution and 8+6 resolution mode
— PWM resolution selection.
A reset clears all PWMEX bits to logic zero, choose 6+2 as default resolution, no extension.
Base data for 6+2 resolution Extension data for 6+2 resolution
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
163
fOSC/8 fOSC
fOSC/64 fOSC/2
PWMCON.6-.7 MUX
extension-bit base-bit
PENDING
OVFINT Counter Counter
PWMCON.0
PWMCON.1 PWMCON.2
"1" When base data > Counter
"0" When base data <= Counter
base-bit
Comparator
P0.6/PWM "1" When base data = Counter
base-bit Data
Extension Buffer
Control Logic
F1H
PWMCON.3 (clear)
base or extension up
counter overflow
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
164
) PROGRAMMING TIP — Programming the PWM Module to Sample Specifications
;--------------<< Interrupt Vector Address >>
ORG 003CH
DB 000H ; 003CH, must be initialized to 1.
DB 000H ; 003DH, must be initialized to 1.
DB 0FFH ; 003EH, Enable LVR (2.3)
DB 000H ; 003FH, External Crystal oscillator
MAIN: ;
x ;
x ;
x ;
x ;
JR t,MAIN ;
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
165
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
166
12 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 nine input channels to equivalent 10-bit digital values. The analog input level must lie between the VDD
and VSS values. The A/D converter has the following components:
To initiate an analog-to-digital conversion procedure, you write the channel selection data in the A/D converter
control register ADCON to select one of the nine analog input pins (ADCn, n = 0–8) and set the conversion start or
enable bit, ADCON.0. The read-write ADCON register is located at address F7H.
During a normal conversion, ADC logic initially sets the successive approximation register to 200H (the
approximate half-way point of a 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.7–4) in the ADCON
register. To start the A/D conversion, you should set a the enable bit, ADCON.0. When a conversion is completed,
ACON.3, the end-of-conversion (EOC) bit is automatically set to 1 and the result is dumped into the ADDATA
register where it can be read. The A/D converter then enters an idle state. Remember to read the contents of
ADDATA before another conversion starts. Otherwise, the previous result will be overwritten by the next
conversion result.
NOTE
Because the ADC does not use sample-and-hold circuitry, it is important that any fluctuations in the analog
level at the ADC0–ADC8 input pins during a conversion procedure be kept to an absolute minimum. Any
change in the input level, perhaps due to circuit noise, will invalidate the result.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The ADC module's input pins are alternatively used as digital input in port 0 and P2.6.
The A/D converter control register, ADCON, is located at address F7H. ADCON has four functions:
Only one analog input channel can be selected at a time. You can dynamically select any one of the nine analog
input pins (ADC0–ADC8) by manipulating the 4-bit value for ADCON.7–ADCON.4.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
NOTE:
1. Maximum ADC clock input = 4 MHz
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
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 bit conversion is always 1/2 VDD.
ADCON (F7H)
ADCON.0 (ADEN)
ADCON.7-.4
Control Clock ADCON.3
Circuit Selector (EOC Flag)
M ADCON.2-.1
ADC0/P0.0 U
L Successive
ADC1/P0.1 + Approximation
T -
ADC2/P0.2 I Circuit
P Analog
L Comparator
E
ADC7/P0.7
X
ADC8/P2.6 E
R
VDD Conversion Result
D/A Converter ADDATAH ADDATAL
VSS (F8H) (F9H)
To data bus
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
ADCON.0 1 169
50 ADC Clock
Conversion
Start
EOC
ADDATA ... 9 8 7 6 5 4 3 2 1 0
CONVERSION TIMING
The A/D conversion process requires 4 steps (4 clock edges) to convert each bit and 10 clocks to step-up A/D
conversion. Therefore, total of 50 clocks is required to complete a 10-bit conversion: With a 10 MHz CPU clock
frequency, one clock cycle is 400 ns (4/fxx). If each bit conversion requires 4 clocks, the conversion rate is
calculated as follows:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
1. Analog input must remain between the voltage range of VSS and VDD.
2. Configure the analog input pins to input mode by making the appropriate settings in P0CONH, P0CONL and
P2CONH registers.
3. Before the conversion operation starts, you must first select one of the nine input pins (ADC0–ADC8) by
writing the appropriate value to the ADCON register.
4. When conversion has been completed, (50 clocks have elapsed), the EOC flag is set to “1”, so that a check
can be made to verify that the conversion was successful.
5. The converted digital value is loaded to the output register, ADDATAH (8-bit) and ADDATAL (2-bit), and then
the ADC module enters an idle state.
6. The digital conversion result can now be read from the ADDATAH and ADDATAL register.
VDD
XIN
Analog
ADC0-ADC8
Input Pin
101 XOUT
S3F94C8/F94C4
VSS
Figure 12-5. Recommended A/D Converter Circuit for Highest Absolute Accuracy
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
ORG 003CH
DB 000H ; 003CH, must be initialized to 0
DB 000H ; 003DH, must be initialized to 0
DB 0FFH ; 003EH, enable LVR
DB 003H ; 003FH, internal RC oscillator
ORG 0100H
RESET: DI ; disable interrupt
LD BTCON,#10100011B ; Watchdog disable
x
x
x
LD P0CONH,#11111111B ; Configure P0.4–P0.7 AD input
LD P0CONL,#11111111B ; Configure P0.0–P0.3 AD input
LD P2CONH,#00100000B ; Configure P2.6 AD input
EI ; Enable interrupt
MAIN: x
x
x
CALL AD_CONV ; Subroutine for AD conversion
x
x
x
JR t, MAIN ;
NOP
; If you select conversion speed to fOSC/16
; at least one NOP must be included
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
INT_TIMER0: x ;
x ;
x ; Pending bit clear
IRET ;
x
x
END
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
NOTES 173
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
174
OVERVIEW
The S3F94C8/F94C4 has an on-chip flash memory internally instead of masked ROM. The flash memory is
accessed by instruction ‘LDC’. This is a sector erasable and a byte programmable flash. User can program the
data in a flash memory area any time you want. The S3F94C8/F94C04‘s embedded 8K/4K-byte memory has two
operating features as below:
— Tool Program Mode: Refer to the chapter 16. S3F94C8/F94C4 FLASH MCU
— User Program Mode
The S3F94C8/F94C4 flash memory consists of 64 sectors (S3F94C8) or 32sectors (S3F94C4). Each sector
consists of 128bytes. So, the total size of flash memory is 64 x128 (8KB) or 32x128 bytes (4KB). User can erase
the flash memory by a sector unit at a time and write the data into the flash memory by a byte unit at a time.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Table 13-1. Descriptions of Pins Used to Read/Write the Flash in Tool Program Mode
Main Chip During Programming
Pin Name Pin Name Pin No. I/O Function
P0.1 SDAT 18 (20-pin) I/O Serial data pin (output when reading, Input
14 (16-pin) when writing) Input and push-pull output port
can be assigned
P0.0 SCLK 19 (20-pin) I Serial clock pin (input only pin)
15 (16-pin)
RESET/P1.2 VPP 4 I Power supply pin for Tool mode entering
(indicates that MTP enters into the Tool
mode). When 11 V is applied, MTP is in Tool
mode.
VDD/VSS VDD/VSS 20 (20-pin), 16 (16-pin) I Logic power supply pin.
1 (20-pin), 1 (16-pin)
There are four kind functions in user program mode – programming, reading, sector erase, and one protection
mode (Hard lock protection).
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
FMCON register is available only in user program mode to select the flash memory operation mode; sector erase,
byte programming, and to make the flash memory into a hard lock protection.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
The bit 0 of FMCON register (FMCON.0) is a bit for the operation start of Erase and Hard Lock Protection.
Therefore, operation of Erase and Hard Lock Protection is activated when you set FMCON.0 to “1”. If you write
FMCON.0 to 1 for erasing, CPU is stopped automatically for erasing time (min.4ms). After erasing time, CPU is
restarted automatically. When you read or program a byte data from or into flash memory, this bit is not needed to
manipulate.
The FMUSR register is used for a safe operation of the flash memory. This register will protect undesired erase or
program operation from malfunctioning of CPU caused by an electrical noise. After reset, the user-programming
mode is disabled, because the value of FMUSR is “00000000B” by reset operation. If necessary to operate the
flash memory, you can use the user programming mode by setting the value of FMUSR to “10100101B”. The
other value of “10100101B”, user program mode is disabled.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
There are two sector address registers for the erase or programming flash memory. The FMSECL (Flash Memory
Sector Address Register Low Byte) indicates the low byte of sector address and FMSECH (Flash Memory Address
Sector Register High Byte) indicates the high byte of sector address. The FMSECH is needed for S3F94C8/F94C4
because it has 64/32 sectors.
One sector consists of 128-bytes. Each sector’s address starts XX00H or XX80H, that is, a base address of sector
is XX00H or XX80H. So bit .6-.0 of FMSECL don’t mean whether the value is ‘1’ or ‘0’. We recommend that it is
the simplest way to load the sector base address into FMSECH and FMSECL register. When programming the
flash memory, user should program after loading a sector base address, which is located in the destination
address to write data into FMSECH and FMSECL register. If the next operation is also to write one byte data, user
should check whether next destination address is located in the same sector or not. In case of other sectors, user
should load sector address to FMSECH and FMSECL Register according to the sector. (Refer to page 13-12
PROGRAMMING TIP — Programming)
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
NOTE: The High- Byte flash memory sector address pointer value is the
higher eight bits of the 16-bit pointer address.
MSB .7 .6 .5 .4 .3 .2 .1 .0 LSB
Don't Care
NOTE: The Low- Byte flash memory sector address pointer value is the
lower eight bits of the 16-bit pointer address.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
User can erase a flash memory partially by using sector erase function only in user program mode. The only unit
of flash memory to be erased in the user program mode is a sector.
The program memory of S3F94C8/F94C4 8K/4Kbytes flash memory is divided into 64/32 sectors. Every sector
has all 128-byte sizes. So the sector to be located destination address should be erased first to program a new
data (one byte) into flash memory. Minimum 4ms’ delay time for the erase is required after setting sector address
and triggering erase start bit (FMCON.0). Sector erase is not supported in tool program modes (MDS mode tool or
programming tool).
1FFFH (S3F94C8)
Sector 63
(128 byte)
1F7FH
Sector 32
(128 byte)
0FFFH (S3F94C4)
Sector 31
(128 byte)
0F7FH
007FH
Sector 0
(128 byte) 0000H
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Start
NOTES
1. If user erases a sector selected by Flash Memory Sector Address Register FMSECH and FMSECL,
FMUSR should be enabled just before starting sector erase operation. And to erase a sector, Flash
Operation Start Bit of FMCON register is written from operation stop ‘0’ to operation start ‘1’. That bit
will be cleared automatically just after the corresponding operation completed. In other words, when
S3F94C8/F94C4 is in the condition that flash memory user programming enable bits is enabled and
executes start operation of sector erase, it will get the result of erasing selected sector as user’s a
purpose and Flash Operation Start Bit of FMCON register is also clear automatically.
2. If user executes sector erase operation with FMUSR disabled, FMCON.0 bit, Flash Operation Start
Bit, remains 'high', which means start operation, and is not cleared even though next instruction is
executed. So user should be careful to set FMUSR when executing sector erase, for no effect on
other flash sectors.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
x
x
ERASE_ONESECTOR:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PROGRAMMING 181
A flash memory is programmed in one-byte unit after sector erase. The write operation of programming starts by
‘LDC’ instruction.
NOTE
In programming mode, it doesn’t care whether FMCON.0’s value is “0” or “1”.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
182
Start
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
183
Start
YES
; User Program Mode Disable
Write again?
NO
NO Same Sector? FMUSR #00H ; User Program Mode Disable
;; Check Sector
YES
Finish Writing
NO
Continuous address? ;; Check Address
YES
INC R(n+1) ;; Increse Address
YES
Different Data?
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
LD R0,#40H
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Case3. Programming to the flash memory space located in other sectors 185
x
x
WR_INSECTOR2:
LD R0,#40H
LD R1,#40H
LD R0,#40H
WR_INSECTOR5:
LD FMSECH,#02H ; Set the base address of sector located in target address to write data
LD FMSECL,#80H ; The sector 5’s base address is 0280H
LD R9,# 55H ; Load data “55H” to write
LD R10,#02H ; Load flash memory upper address into upper register of pair working
; register
LD R11,#90H ; Load flash memory lower address into lower register of pair working
; register
CALL WR_BYTE
WR_INSECTOR12:
LD FMSECH,#06H ; Set the base address of sector located in target address to write data
LD FMSECL,#00H ; The sector 12’s base address is 0600H
LD R9,#0A3H ; Load data “A3H” to write
LD R10,#06H ; Load flash memory upper address into upper register of pair working
; register
LD R11,#40H ; Load flash memory lower address into lower register of pair working
; register
WR_BYTE1:
LDC @RR10,R9 ; Write data 'A3H' at flash memory location
INC R11
DEC R1
JP NZ, WR_BYTE1
LD FMUSR,#00H ; User Program mode disable
x
x
WR_BYTE:
LDC @RR10,R9 ; Write data written by R9 at flash memory location
INC R11
DEC R0
JP NZ, WR_BYTE
RET
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
READING 186
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
User can set Hard Lock Protection by writing ‘0110B’ in FMCON7-4. This function prevents the changes of data in
a flash memory area. If this function is enabled, the user cannot write or erase the data in a flash memory area.
This protection can be released by the chip erase execution in the tool program mode. In terms of user program
mode, the procedure of setting Hard Lock Protection is following that. In tool mode, the manufacturer of serial tool
writer could support Hardware Protection. Please refer to the manual of serial program writer tool provided by the
manufacturer.
x
x
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
NOTES 188
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
189
14 ELECTRICAL DATA
OVERVIEW
In this section, the following S3F94C8/F94C4 electrical characteristics are presented in tables and graphs:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
(TA = 25 qC)
Parameter Symbol Conditions Rating Unit
Supply voltage VDD – – 0.3 to + 6.5 V
Input voltage VI All ports – 0.3 to VDD + 0.3 V
Output voltage VO All output ports – 0.3 to VDD + 0.3 V
Output current high IOH One I/O pin active – 25 mA
All I/O pins active – 80
Output current low IOL One I/O pin active + 30 mA
All I/O pins active + 100
Operating temperature TA – – 40 to + 85 qC
Storage temperature TSTG – – 65 to + 150 qC
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Output high VOH IOH = – 10 mA VDD = 4.5 to 5.5 V VDD -1.5 VDD - 0.4 – V
voltage Ports 0,2,P1.0-P1.1
Output low VOL IOL = 25 mA VDD = 4.5 to 5.5 V – 0.4 2.0 V
voltage Ports 0,2,P1.0-P1.1
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
1 192
Supply current IDD1 Run mode VDD = 4.5 to 5.5 V – 2 5 mA
10 MHz CPU clock
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
tINTL tINTH
0.2 VDD
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
C2 XOUT 1
VDD = 1.8 to 2.7 V 0.4 – 4 MHz
NOTES:
1. fOSC is the oscillator frequency.
2. The duration of the oscillator stabilization wait time, tWAIT, when it is released by an interrupt is determined by the
settings in the basic timer control register, BTCON.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
196
CPU Clock
10 MHz
8 MHz
4 MHz
3 MHz
..
2 MHz
1 MHz
0.4 MHz
1 1.8 2.7 4 4.5 5 5.5 6 7
VOUT
VDD
A = 0.2 V DD
B = 0.4 VDD
C = 0.6 VDD
D = 0.8 VDD
VSS
A B C D VIN
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
NOTE: Supply current does not include current drawn through internal pull-up resistors or external output current loads.
RESET Oscillator
Stop Occurs Stabilization
~
~
Mode Time
Data Retention
VDD Mode
~
~
Normal
VDDDR Operating
Execution Of
Mode
Stop Instrction
RESET
t WAIT
NOTE: t WAIT is the same as 4096 x 128 x 1/fOSC
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
VDD
VLVR,MAX
VLVR
VLVR,MIN
Notes:
1. The programming time is the time during which one byte (8-bit) is programmed.
2. The Chip erasing time is the time during which entire program memory is erased.
3. The Sector erasing time is the time during which all 128byte block is erased.
4. The chip erasing is available in Tool Program Mode only.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
200
104
VSS VDD
S3F94C8/F94C4
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
201
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
202
15 MECHANICAL DATA
OVERVIEW
The S3F94C8/F94C4 is available in a 20-pin DIP package (Samsung: 20-DIP-300A), a 20-pin SOP package
(Samsung: 20-SOP-375), a 20-pin SSOP package (Samsung: 20-SSOP-225), a 16-pin SOP package (Samsung:
16-SOP-225) and a 16-pin TSSOP package(Samsung:16-TSSOP-0044). Package dimensions are shown in
Figure 15-1, 15-2, 15-3, 15-4, 15-5 and 15-6.
20-DIP-300A 7.62
- 0 .10
.05
+0
5
0.2
#1 #10
5.08 MAX
3.25r0.20
26.80 MAX
26.40r 0.20
0.51 MIN
0.46r0.10
3.30r0.30
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
203
0-8
#20 #11
10.30r0.30
7.50r0.20
9.53
20-SOP-375
+ 0.10
0.85r0.20
#1 #10
0.203 - 0.05
2.50 MAX
2.30r0.10
13.14 MAX
12.74r0.20
0.10 MAX
0.05 MIN
(0.66) 1.27
+ 0.10
0.40 - 0.05
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
204
0-8
6.40 r0.20 #20 #11
4.40 r0.10
5.72
20-SSOP-225
+ 0.10
#1 #10
0.50 r0.20
0.15 - 0.05
1.85 MAX
1.50 r0.10
6.90 MAX
6.50 r0.20
0.10 MAX
0.05 MIN
(0.30) 0.65
+0.10
0.22 -0.05
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
205
10.10
9.70
0-8
#16 #9
0.10
0.05
6.30
5.70
16-SOP-225
0.30
#1 #8
0.15 0.9
0.5
0.70
x80
0.65
1.65
1.45
1.27BSC
0.50
0.35
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
206
#16 #9
0.95
0.85
6.50
6.30
16-TSSOP-0044
4.50
4.30
#1 #8
0.25
0.75
0.45
5.10
4.90
1.10 MAX
0.10 MAX
0.65BSC
0.30
0.19
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
207
OVERVIEW
The S3F94C8/F94C4 single-chip CMOS microcontroller is the Flash MCU. It has an on-chip Flash MCU ROM of
8K/4K bytes. The Flash ROM is accessed by serial data format.
The serial data is transformed by two pins of the chip: SCLK and SDAT, SCLK is the synchronize signal, and the
Flash Programmer Tool send data from the SDAT pin. The corresponding ports of SCLK and SDAT in
S3F94C8/F94C4 are P0.0 and P1.1. And there also need power supply for chip to work and higher power for
entering flash tool mode. So the VDD, VSS of chip must be connected to power and ground. The higher power
supply for the Flash operation is named as VPP port, the corresponding pin in S3F94C8/F94C4 is nRESET (P1.2)
pin. The detail description of the pin functions are listed in the table 16-1.The pin assignments of the
S3F94C8/F94C4 package types are shown in below figures.
NOTE
1. This chapter is about the Tool Program Mode of Flash MCU. If you want to know the User
Program Mode, refer to the chapter 13. Embedded Flash Memory Interface.
2. In S3F94C8/F94C4, there only 5 pins are used as flash operation pins, the nRESET pin is
used as VPP input and without TEST pin that different with other Samsung MCU products.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
208
VSS 1 20 VDD
XIN/P1.0 2 19 P0.0/ADC0/INT0/S
SCLK
XOUT/P1.1 3 18 P0.1/ADC1/INT1/S
SDAT
VPP/nRESET/P1.2 4 17 P0.2/ADC2
P2.1 6 15 P0.4/ADC4
(20-DIP-300A/
P2.2 7 20-SOP-375) 14 P0.5/ADC5
P2.3 8 13 P0.6/ADC6/PWM
P2.4 9 12 P0.7/ADC7
P2.5 10 11 P2.6/ADC8/CLO
VSS 1 16 VDD
XIN/P1.0 2 15 P0.0/ADC0/INT0/S
SCLK
XOUT/P1.1 3 14 P0.1/ADC1/INT1/S
SDAT
S3F94C8/F94C4
VPP/nRESET/P1.2 4 13 P0.2/ADC2
T0/P2.0 5 12 P0.3/ADC3
(16-SOP-225)
P2.1 6 11 P0.4/ADC4
P2.2 7 10 P0.5/ADC5
P2.3 8 9 P0.6/ADC6/PWM
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
210
ON BOARD WRITING
The S3F94C8/F94C4 needs only 5 signal lines including VDD and GND pins for writing internal flash memory with
serial protocol. Therefore the on-board writing is possible if the writing signal lines are considered when the PCB of
application board is designed.
In case of VPP (nRESET) pin, for the purpose of increase the noise effect, a capacitor should be inserted between
the VPP pin and GND.
Please be careful to design the related circuit of these signal pins because rising/falling timing of VPP, SCLK and
SDAT is very important for proper programming.
R SCL Applicatio
SCLK (I/O) To
circuit n
R SDA Applicatio
SDAT (I/O) To
circuit n
Vpp Applicatio
(nRESET) To
CVpp C RESET circuit n
VDD
Vpp SDA
VSS C Vpp are used to improve
Vdd SCL
the noise effect
GND
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
NOTE2: The value of R, C in this table is recommended value. It varies with circuit of system.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
212
INFORMATION BLOCK
The S3F94C8/94C4 provides a special flash area for storing chip ID or customer’s information into it, called
information block. This block is separated from the main flash ROM, the flash ROM memory erase/write/read/read
protection operation take none affect to this block. It can be erase/write/read by Flash Programmer Tools
individually and is not available in user mode.
The size of information block is 256Bytes. Since it is separated from flash ROM, the programming operation (chip
erase/write) will not erase/change the data in information block. User can write Chip ID into it, that different for
each chip, to distinguish every chip. This is very useful for anti-imitation by storing production related information in
this area.
Tool :
-Erase/write/read
-Hard lock
4.095 -Read protection
(S3F94C4)
User :
-Erase/write/read Information Block
-Hard lock 255
(S3F94C8/C4)
Tool :
-Erase/write/read
0 0
Table 16-4. Operation Results Comparison of Main ROM and Information Block
Mode Operation Main Flash ROM Information Block
Tool Mode Erase MTP Yes No
Program ROM / Read ROM Yes No
Hard Lock / Read Protection Yes No
Information Block Erase No Yes
Information Block Write/Read No Yes
User Mode Sector erase Yes No
Write Byte /Read Byte Yes No
Hard Lock Yes No
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
213
NOTES
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
214
17 DEVELOPMENT TOOLS
OVERVIEW
Samsung provide a powerful and ease-to-use development support system on a turnkey basis. The development
support system is composed of a host system, debugging tools, and supporting software. For a host system, any
standard computer that employs Win95/98/2000/XP as its operating system can be used. A sophisticated
debugging tool is provided both in hardware and software: the powerful in-circuit emulator, OPENice-i500/i2000
and SK-1200, for the S3F7-, S3F9-and S3F8- microcontroller families. Samsung also offers supporting software
that includes, debugger, an assembler, and a program for setting options.
TARGET BOARDS
Target boards are available for all the S3C9/S3F9-series microcontrollers. All the required target system cables
and adapters are included on the device-specific target board. TB94C8/94C4 is a specific target board for the
development of application systems using S3F94C8/F94C4.
When you program S3F94C8/F94C4’s flash memory by using an emulator or OTP/MTP writer, you need a specific
programming socket adapter for S3F94C8/F94C4.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
IBM-PC AT or Compatible
Target
OTP/MTP Writer Block Application
System
Probe
Adapter
Bus
Trace/Timer Block
POD TB94C8/94C4
SAM8 Base Block Target
Board
EVA
Power Supply Block Chip
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
The TB94C8/94C4 target board is used for the S3F94C8/F94C4 microcontrollers. The TB94C8/94C4 target board
is operated as target CPU with Emulator (OPENIce I-500/2000, SK-1200).
TB94C8/94C4
To User_VCC
VCC
Off On Idle Stop
JP5 + +
U2
RESET
GND
SW1
J5
1 20
25
20-Pin Connector
100-Pin Connector
128 QFP
S3E94C0
EVA Chip
38
1
U1 10 11
Target System
1 Interface
S1
Emulator
Interfalce
PWM
Main Mode
ON 0 Board Clock Enable
SW2
JP3
JP2
JP1 Y1
3E.7
3E.6
3E.5
3E.4
3E.3
3F.0
3E.2
3F.1
Internal Clock
EVA Mode PWM
Disable
SMDS2 SMDS2+
JP4
NOTE: TB94C8/94C4 should be supplied 5V normally. So the power supply from Emulator should be set 5V for the target
board operation.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
SMDS2/SMDS2+
SMDS2/SMDS2+
NOTE: The following symbol in the "To User_Vcc" Setting column indicates the electrical short (off) configuration:
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
In order to write data into program memory that is available in SMDS2+, the target board should be selected to be
for SMDS2+ through a switch as follows. Otherwise, the program memory writing function is not available.
SMDS2 SMDS2+
R/W* R/W*
Target
System
SMDS2+
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Table 17-4. Using Single Header Pins to Select Clock Source / PWM / Operation Mode 219
Board CLK
Inner CLK
Board CLK
Inner CLK
PWM Enable
JP3
PWM function is DISABLED.
PWM Disable
PWM Enable
PWM Disable
Main Mode
EVA Mode
Main Mode
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
Table 17-5. Using Single Header Pins as the Input Path for External Trigger Sources 220
Connector from
External External Trigger
Triggers Sources of the
Application System
Ch1(TP3)
Ch2(TP4)
0
ON
SW2
OFF
3E.7
3E.6
3E.5
3E.4
3E.3
3E.2
3F.1
3F.0
ON Low
OFF High (Default)
NOTE:
1. For EVA chip, smart option is determined by DIP switch not software.
2. Please keep the reserved bits as default value (high).
x IDLE LED
This is LED is ON when the evaluation chip (S3E94C0) is in idle mode.
x STOP LED
This LED is ON when the evaluation chip (S3E94C0) is in stop mode.
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
221
J5
VSS 1 20 VDD
P1.0 2 19 P0.0/ADC0/INT0
RESET/P1.2 4 17 P0.2/ADC2
T0/P2.0 5 16 P0.3/ADC3
P2.1 6 15 P0.4/ADC4
P2.2 7 14 P0.5/ADC5
P2.3 8 13 P0.6/ADC6/PWM
P2.4 9 12 P0.7/ADC7
P2.5 10 11 P2.6/ADC8/CLO
J101
1 20 1 20
20-Pin Connector
20-Pin Connector
10 11 10 11
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
SAMSUNG provides a complete line of development tools for SAMSUNG's microcontroller. With long experience
in developing MCU systems, our third parties are leading companies in the tool's technology. SAMSUNG In-circuit
emulator solution covers a wide range of capabilities and prices, from a low cost ICE to a complete system with an
OTP/MTP programmer.
x OPENice-i500/2000
x SmartKit SK-1200
OTP/MTP Programmer
x SPW-uni
x GW-uni (8 - gang programmer)
x AS-pro
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
SK-1200 Seminix
x TEL: 82-2-539-7891
x FAX: 82-2-539-7819
x E-mail: sales@seminix.com
x URL: http://www.seminix.com
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
SPW-uni SEMINIX
Single OTP/ MTP/FLASH Programmer x TEL: 82-2-539-7891
x FAX: 82-2-539-7819.
x Download/Upload and data edit function
x E-mail:
x PC-based operation with USB port
sales@seminix.com
x Full function regarding OTP/MTP/FLASH MCU
x URL:
programmer
http://www.seminix.com
(Read, Program, Verify, Blank, Protection..)
x Fast programming speed (4Kbyte/sec)
x Support all of SAMSUNG OTP/MTP/FLASH MCU
devices
x Low-cost
x NOR Flash memory (SST,Samsung…)
x NAND Flash memory (SLC)
x New devices will be supported just by adding
device files or upgrading the software.
GW-uni SEMINIX
Gang Programmer for OTP/MTP/FLASH MCU x TEL: 82-2-539-7891
x 8 devices programming at one time x FAX: 82-2-539-7819.
x Fast programming speed :OTP(2Kbps) / x E-mail:
MTP (10Kbps) sales@seminix.com
x Maximum buffer memory:100Mbyte x URL:
x Operation mode: PC base / Stand-alone(no PC) http://www.seminix.com
x Support full functions of OTP/MTP
(Read, Program, Checksum, Verify, Erase, Read
protection, Smart option)
x Simple GUI(Graphical User Interface)
x Device information setting by a device part no.
x LCD display and touch key (Stand-alone mode
operation)
x System upgradable (Simple firmware upgrade by
user)
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
AS-pro SEMINIX
On-board programmer for Samsung Flash MCU x TEL: 82-2-539-7891
x FAX: 82-2-539-7819.
x Portable & Stand alone Samsung
x E-mail:
OTP/MTP/FLASH Programmer for After Service
sales@seminix.com
x Small size and Light for the portable use
x URL:
x Support all of SAMSUNG OTP/MTP/FLASH
http://www.seminix.com
devices
x HEX file download via USB port from PC
x Very fast program and verify time
( OTP:2Kbytes per second, MTP:10Kbytes per
second)
x Internal large buffer memory (118M Bytes)
x Driver software run under various O/S
(Windows 95/98/2000/XP)
x Full function regarding OTP/MTP programmer
(Read, Program, Verify, Blank, Protection..)
x Two kind of Power Supplies
(User system power or USB power adapter)
x Support Firmware upgrade
Flash writing adapter board C&A technology
x Special flash writing socket for S3F94C8/F94C4 x TEL: 82-2-2612-9027
- 20DIP,20SOP,20SSOP,16DIP,16SOP,16TSSOP x FAX: 82-2-2612-9044
x E-mail:
wisdom@cnatech.com
x URL:
http://www.cnatech.com
PS031501-0813 PRELIMINARY
S3F94C8/S3F94C4
Product Specification
226
NOTES
PS031501-0813 PRELIMINARY