MC96F8208S 8-Bit Microcontroller
MC96F8208S 8-Bit Microcontroller
Peripheral Features
Operating Conditions
1.8V to 5.5V Wide Voltage Range
-40°C to 85°C Temperature Range
Application
Revision history
Version 1.0
Published by FAE team
2013 ABOV Semiconductor Co. Ltd. all rights reserved.
Additional information of this manual may be served by ABOV Semiconductor offices in Korea or distributors.
ABOV Semiconductor reserves the right to make changes to any information here in at any time without notice.
The information, diagrams and other data in this manual are correct and reliable;
however, ABOV Semiconductor is in no way responsible for any violations of patents or other rights of the third
party generated by the use of this manual.
2
MC96F8208S ABOV Semiconductor Co., Ltd.
1 Overview
1.1. Description
The MC96F8208S is advanced CMOS 8-bit microcontroller with 16 Kbytes of FLASH. This is powerful microcontroller
which provides a highly flexible and cost effective solution to many embedded control applications. This provides the
following features : 8k bytes of FLASH, 256 bytes of IRAM, 256 bytes of XRAM , general purpose I/O, basic interval
timer, watchdog timer, 8/16-bit timer/counter, 16-bit PPG output, 8-bit PWM output, watch timer, buzzer driving port,
SPI, UART, I2C, 12-bit A/D converter, on-chip POR, LVR, LVI, on-chip oscillator and clock circuitry. The MC96F8208S
also supports power saving modes to reduce power consumption.
3
ABOV Semiconductor Co., Ltd. MC96F8208S
1.2 Features
4
MC96F8208S ABOV Semiconductor Co., Ltd.
1.3.1 Compiler
The OCD (On Chip Debug) emulator supports ABOV Semiconductor’s 8051 series MCU emulation.
The OCD interface uses two-wire interfacing between PC and MCU which is attached to user’s system. The OCD can
read or change the value of MCU internal memory and I/O peripherals. And the OCD also controls MCU internal
debugging logic, it means OCD controls emulation, step run, monitoring, etc.
The OCD Debugger program works on Microsoft-Windows NT, 2000, XP, Vista (32bit) operating system.
If you want to see more details, please refer to OCD debugger manual. You can download debugger S/W and manual
from our web-site.
Connection:
− DSCL (MC96F8316 P01 port)
− DSDA (MC96F8316 P00 port)
NOTE)
1. MC96F8208S does not support the OCD function. MC96F8316 should be used for debugging.
1 2 User VCC
3 4 User GND
5 6 DSCL
7 8 DSDA
9 10
5
ABOV Semiconductor Co., Ltd. MC96F8208S
6
MC96F8208S ABOV Semiconductor Co., Ltd.
7
ABOV Semiconductor Co., Ltd. MC96F8208S
1.3.3 Programmer
Single programmer:
PGMplus USB: It programs MCU device directly.
DSDA
VDD VSS
DSCL
Standalone PGMplus:
It programs MCU device directly.
DSDA
VDD VSS
DSCL
8
MC96F8208S ABOV Semiconductor Co., Ltd.
OCD emulator:
It can write code toMCU device too, because OCD debugger supports ISP (In System Programming). It does not
require additional H/W, except developer’s target system.
Gang programmer:
It programs 8 MCU devices at once.So, it is mainly used in mass production factory.
Gang programmer is standalone type, it means it does not require host PC, after a program is downloaded from host
PC to Gang programmer.
9
ABOV Semiconductor Co., Ltd. MC96F8208S
1.4.1 Overview
The program memory of MC96F8208S is MTP Type. This flash is accessed by serial data format. There are four
pins(DSCL, DSDA, VDD, VSS) for programming/reading the flash.
Table 1.3 Descriptions of pins which are used to programming/reading the Flash
The MC96F8208S needs only four signal lines including VDD and VSS pins for programming FLASH with serial
protocol. Therefore the on-board programming is possible if the programming signal lines are considered when the
PCB of application board is designed.
10
MC96F8208S ABOV Semiconductor Co., Ltd.
At the FLASH programming, the programming tool needs 4 signal lines that are DSCL, DSDA, VDD, and VSS. When
you design the PCB circuits, you should consider the usage of these signal lines for the on-board programming.
Please be careful to design the related circuit of these signal pins because rising/falling timing of DSCL and DSDA is
very important for proper programming.
R1 (2kΩ ~ 5kΩ)
DSCL(I) To application circuit
R2 (2kΩ ~ 5kΩ)
DSDA(I/O) To application circuit
VDD
VSS
NOTE)
1. In on-board programming mode, very high-speed signal will be provided to pin DSCL and DSDA.
And it will cause some damages to the application circuits connected to DSCL or DSDA port if the
application circuit is designed as high speed response such as relay control circuit. If possible, the
I/O configuration of DSDA, DSCL pins had better be set to input mode.
2. The value of R1 and R2 is recommended value. It varies with circuit of system.
11
ABOV Semiconductor Co., Ltd. MC96F8208S
2 Block diagram
Flash
8KB
CORE XRAM
M8051 256B
IRAM
256B
ISP
General purpose I/O In-system programming
18 ports normal I/O
Power control
Power on reset
Watchdog timer Low voltage reset
1 channel, 8-bit Low voltage indicator
5kHz, internal RC OSC Power down mode
Clock generator
Basic interval timer 16MHz, Internal RC OSC
1 channel, 8-bit 12MHz, Crystal OSC
Buzzer
1 channel, 8-bit
Timer / Counter
1 channel, 8-bit
UART
2 channels, 16-bit
1 channel, 8-bit
SPI
1 channel, 8-bit
ADC I2C
10 Input channels, 12-bit 1 channel, 8-bit
NOTE)
1. The P03, P11, P24 and P25 are not in the 16-Pin package.
12
MC96F8208S ABOV Semiconductor Co., Ltd.
3 Pin assignment
VSS 1 20 VDD
MC96F8208SD/B
P37/XOUT 2 19 P00/AN0/DSDA
(20- SOP/ P DI P)
P36/XIN 3 18 P01/AN1/DSCL
P35/EINT10/T0O/PWM0O 4 17 P02/AN2/AVREF/EINT0
P32/RESETB 5 16 P03/AN3/EINT1
P31/RXD/(SCL) 6 15 P11/AN8/EINT6/EC1/BUZO
P30/TXD/(SDA) 7 14 P12/AN9/EINT11/T1O/PWM1O
P25/SCL 8 13 P13/AN10/EINT12/T2O/PWM2O
P24/SDA 9 12 P14/AN11/MISO
P16/AN13/SCK 10 11 P15/AN12/MOSI
NOTE)
1. The programmer (PGMplus, Gang8) uses P0[1:0] pin as DSCL, DSDA.
2. The SDA/SCL lines for I2C can be configured on the P30/P31 pins by software control.
VDD
VSS
20
19
18
17
16
P35/EINT10/T0O/PWM0O 1 15 P01/AN1/DSCL
P32/RESETB 2 14 P02/AN2/AVREF/EINT0
MC96F8208SU
P31/RXD/(SCL) 3 13 P03/AN3/EINT1
(20-QFN)
P30/TXD/(SDA) 4 12 P11/AN8/EINT6/EC1/BUZO
P25/SCL 5 11 P12/AN9/EINT11/T1O/PWM1O
10
6
7
8
9
P15/AN12/MOSI
P24/SDA
P16/AN13/SCK
P14/AN11/MISO
P13/AN10/EINT12/T2O/PWM2O
NOTE)
1. The programmer (PGMplus, Gang) uses P0[1:0] pin as DSCL, DSDA.
2. The SDA/SCL lines for I2C can be configured on the P30/P31 pins by software control.
13
ABOV Semiconductor Co., Ltd. MC96F8208S
MC96F8208SM
P32/ RESETB 1 16 P35/ EINT10/T0O/ PWM0O
P31/ RXD/(SCL) 2 15 P36/ XIN
(16-SOP)
P30/ TXD/( SDA) 3 14 P37/ XOUT
P16/AN13/ SCK 4 13 VSS
P15/AN12/ MOSI 5 12 VDD
P14/AN11/ MISO 6 11 P00/AN0/ DSDA
P13/AN10/ EINT12/T2O/ PWM2O 7 10 P01/AN1/ DSCL
P12/AN9/ EINT11/T1O/ PWM1O 8 9 P02/AN2/ AVREF/ EINT0
NOTE)
1. The programmer(PGMplus, Gang) uses P0[1:0] pin as DSCL, DSDA.
2. The P03,P11 and P24-P25 pins should be selected as a push-pull output or an input with pull-up
resistor by software control when the 16-pin package is used.
3. The SDA/SCL lines for I2C can be configured on the P30/P31 pins by software control.
14
MC96F8208S ABOV Semiconductor Co., Ltd.
4 Package Diagram
15
ABOV Semiconductor Co., Ltd. MC96F8208S
16
MC96F8208S ABOV Semiconductor Co., Ltd.
17
ABOV Semiconductor Co., Ltd. MC96F8208S
18
MC96F8208S ABOV Semiconductor Co., Ltd.
5 Pin Description
PIN
I/O Function @RESET Shared with
Name
P00 Port 0 is a bit-programmable I/O port which can be AN0/DSDA
configured as a schmitt-trigger input, a push-pull
P01 output, or an open-drain output. AN1/DSCL
I/O Input
P02 A pull-up resistor can be specified in 1-bit unit. AN2/AVREF/EINT0
The P03 is only in the 20-Pin package.
P03 AN3/EINT1
P11 Port 1 is a bit-programmable I/O port which can be AN8/EINT6/EC1/BUZO
configured as a schmitt-trigger input, a push-pull
P12 output, or an open-drain output. AN9/EINT11/T1O/PWM1O
P13 A pull-up resistor can be specified in 1-bit unit. AN10/EINT12/T2O/PWM2O
I/O The P11 is only in the 20-Pin package. Input
P14 AN11/MISO
P15 AN12/MOSI
P16 AN13/SCK
Port 2 is a bit-programmable I/O port which can be
P24 configured as a schmitt-trigger input, a push-pull SDA
I/O output, or an open-drain output. Input
P25 A pull-up resistor can be specified in 1-bit unit. SCL
The P24 - P25 are only in the 20-Pin package.
P30 Port 3 is a bit-programmable I/O port which can be TXD
configured as a schmitt-trigger input, a push-pull
P31 output, or an open-drain output. RXD
P32 A pull-up resistor can be specified in 1-bit unit. RESETB
I/O Input
P35 EINT10/T0O/PWM0O
P36 XIN
P37 XOUT
EINT0 P02/AN2/AVREF
EINT1 I/O External interrupt inputs Input P03/AN3
EINT6 P11/AN8/EC1/BUZO
EINT10 I/O External interrupt input and Timer 0 capture input Input P35/T0O/PWM0O
EINT11 I/O External interrupt input and Timer 1 capture input Input P12/AN9/T1O/PWM1O
EINT12 I/O External interrupt input and Timer 2 capture input Input P13/AN10/T2O/PWM2O
T0O I/O Timer 0 interval output Input P35/EINT10/PWM0O
T1O I/O Timer 1 interval output Input P12/AN9/EINT11/PWM1O
T2O I/O Timer 2 interval output Input P13/AN10/EINT12/PWM2O
PWM0O I/O Timer 0 PWM output Input P35/EINT10/T0O
PWM1O I/O Timer 1 PWM output Input P12/AN9/EINT11/T1O
PWM2O I/O Timer 2 PWM output Input P13/AN10/EINT12/T2O
EC1 I/O Timer 1 event count input Input P11/AN8/EINT6/BUZO
BUZO I/O Buzzer signal output Input P11/AN8/EINT6/EC1
SCK I/O Serial clock input/output Input P16/AN13
MISO I/O Serial data input/output Input P14/AN11
MOSI I/O Serial data input/output Input P15/AN12
TXD I/O UART data output Input P30
RXD I/O UART data input Input P31
SCL I/O I2C clock input/output Input P25
SDA I/O I2C data input/output Input P24
19
ABOV Semiconductor Co., Ltd. MC96F8208S
PIN
I/O Function @RESET Shared with
Name
AVREF I/O A/D converter reference voltage Input P02/AN2/EINT0
AN0 P00/DSDA
AN1 P01/DSCL
AN2 P02/AVREF/EINT0
AN3 P03/EINT1
AN8 P11/EINT6/EC1/BUZO
AN9 I/O A/D converter analog input channels Input P12/EINT11/T1O/PWM1O
AN10 P13/EINT12/T2O/PWM2O
AN11 P14/MISO
AN12 P15/MOSI
AN13 P16/SCK
System reset pin with a pull-up resistor when it is
RESETB I/O selected as the RESETB by CONFIGURE Input P32
OPTION
(NOTE4,5)
DSDA I/O Programmer data input/output Input P00
(NOTE4,5)
DSCL I/O Programmer clock input Input P01
XIN P36
I/O Main oscillator pins Input
XOUT P37
VDD,
– Power input pins – –
VSS
Table 5.1 Normal Pin Description (Concluded)
NOTE)
1. The P03, P11, P24 and P25 are not in the 16-Pin package.
2. The P32/RESETB pin is configured as one of the P32 and the RESETB pin by the “CONFIGURE
OPTION”.
3. The P37/XOUT and P36/XIN pins are configured as a function pin by software control.
4. If the P00 and P01 pins are connected to the programmer during power-on reset, the pins are
automatically configured as In-System programming pins.
5. The P00 and P01 pins are configured as inputs with internal pull-up resistor only during the reset or
power-on reset.
20
MC96F8208S ABOV Semiconductor Co., Ltd.
6 Port Structures
VDD
PULL-UP
REGISTER
VDD VDD
OPEN DRAIN
REGISTER
DATA
0
REGISTER MUX
PAD
SUB-FUNC DATA OUTPUT 1
SUB-FUNC ENABLE
SUB-FUNC DIRECTION 1
MUX
DIRECTION
0
REGISTER
CMOS or
Schmitt Level
Input
PORTx INPUT or
SUB-FUNC DATA INPUT
ANALOG CHANNEL
ENABLE
ANALOG INPUT
21
ABOV Semiconductor Co., Ltd. MC96F8208S
VDD
PULL-UP
REGISTER
VDD VDD
OPEN DRAIN
REGISTER
DATA
0
REGISTER MUX
PAD
SUB-FUNC DATA OUTPUT 1
SUB-FUNC ENABLE
SUB-FUNC DIRECTION 1
MUX
DIRECTION
0
REGISTER
VDD
EXTERNAL Q D
INTERRUPT
CP POLARITY
r REG.
INTERRUPT
ENABLE
FLAG
CLEAR CMOS or
Schmitt Level
Input
0
PORTx INPUT or
MUX
SUB-FUNC DATA INPUT
1 Q D
CP
r DEBOUNCE
CLK
DEBOUNCE
ENABLE
ANALOG CHANNEL
ENABLE
ANALOG INPUT
22
MC96F8208S ABOV Semiconductor Co., Ltd.
7 Electrical Characteristics
NOTE)
1. Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at any other conditions beyond
those indicated in the operational sections of this specification is not implied. Exposure to absolute
maximum rating conditions for extended periods may affect device reliability.
23
ABOV Semiconductor Co., Ltd. MC96F8208S
NOTE)
1. Zero offset error is the difference between 000000000000 and the converted output for zero input voltage
(VSS).
2. Full scale error is the difference between 111111111111 and the converted output for full-scale input
voltage (AVREF).
24
MC96F8208S ABOV Semiconductor Co., Ltd.
25
ABOV Semiconductor Co., Ltd. MC96F8208S
NOTE)
1. A 0.1uF bypass capacitor should be connected to VDD and VSS.
26
MC96F8208S ABOV Semiconductor Co., Ltd.
7.8 DC Characteristics
(TA= -40°C ~ +85°C, VDD= 1.8V ~ 5.5V, VSS= 0V, fXIN= 12MHz)
Parameter Symbol Conditions MIN TYP MAX Unit
Input High Voltage VIH All input pins, RESETB 0.8VDD – VDD V
Input Low Voltage VIL All input pins, RESETB – – 0.2VDD V
VDD= 4.5V, IOH= -2mA,
Output High Voltage VOH1 VDD-1.0 – – V
All output ports
VDD=4.5V, IOL= 15mA;
Output Low Voltage VOL1 – – 1.0 V
All output ports
Input High Leakage
IIH All input ports – – 1 μA
Current
Input Low Leakage
IIL All input ports -1 – – μA
Current
VI=0V, TA= 25°C VDD=5.0V 25 50 100
RPU1 kΩ
All Input ports VDD=3.0V 50 100 200
Pull-Up Resistor
VI=0V, TA= 25°C VDD=5.0V 150 250 400
RPU2 kΩ
RESETB VDD=3.0V 300 500 700
ADC wake-up RAWPU1 100 150 200
TA= 25°C kΩ
pull-up resistor RAWPU2 200 300 400
OSC feedback XIN= VDD, XOUT= VSS
RX1 600 1200 2000 kΩ
resistor TA= 25°C, VDD= 5V
fXIN= 12MHz, VDD= 5V±10% – 3.0 6.0
IDD1
fXIN= 10MHz, VDD= 3V±10% – 2.2 4.4
(RUN)
fIRC= 16MHz, VDD= 5V±10% – 3.0 6.0
Supply Current fXIN= 12MHz, VDD= 5V±10% – 1.3 2.6
IDD2
fXIN= 10MHz, VDD= 3V±10% – 0.7 1.4
(IDLE)
fIRC= 16MHz, VDD= 5V±10% – 0.8 1.6
IDD5 STOP, VDD= 5V±10%, TA= 25°C – 0.5 3.0
Table 7.8 DC Characteristics
NOTE)
1. Where the fXIN is an external main oscillator, the fIRC is an internal RC oscillator, and the fx is the selected
system clock.
2. All supply current items don’t include the current of an internal Watch-dog timer RC (WDTRC) oscillator
and a peripheral block.
3. All supply current items include the current of the power-on reset (POR) block.
27
ABOV Semiconductor Co., Ltd. MC96F8208S
7.9 AC Characteristics
(TA= -40°C ~ +85°C, VDD= 1.8V ~ 5.5V)
Parameter Symbol Conditions MIN TYP MAX Unit
RESETB input low width tRSL Input, VDD= 5V 10 – – us
tINTH,
Interrupt input high, low width All interrupt, VDD= 5V 200 – –
tINTL
External Counter Input High, tECWH, ns
EC1, VDD = 5V 200 – –
Low Pulse Width tECWL
External Counter Transition Time tREC, tFEC EC1, VDD = 5V 20 – –
t RST
RESETB
0.2 VDD
t IWL t IWH
External
Interrupt 0.8 VDD
0.2 VDD
t ECWL t ECWH
t FEC tREC
EC1
28
MC96F8208S ABOV Semiconductor Co., Ltd.
tSCK
tFOD
SCK
(CPOL=0)
(Output/Input)
tSCKL tSCKH
SCK
(CPOL=1)
(Output/Input)
tDIS tDIH
tDS
29
ABOV Semiconductor Co., Ltd. MC96F8208S
t SCK
t HIGH t LOW
tSCK
Shift Clock
tS1
tH1
Data Out D0 D1 D2 D3 D4 D5 D6 D7
tS2
tH2
Data In Valid Valid Valid Valid Valid Valid Valid Valid
30
MC96F8208S ABOV Semiconductor Co., Ltd.
tSCL
tSCLH tSCLL
tSTSU tDIH tSPSU
SCL tSPHD
SDA
tBF
tSTHD tDIS
tVD
SDA
Out
tVD
31
ABOV Semiconductor Co., Ltd. MC96F8208S
Idle Mode
(Watchdog Timer Active)
Stop Mode
~
~
Normal
Operating Mode
Data Retention
V DD
~
~
V DDDR
Execution of
STOP Instruction
0.8VDD
INT Request
t WAIT
NOTE: tWAIT is the same as (the selected bit overflow of BIT) X 1/(BIT Clock)
RESET
Occurs
Oscillation
Stop Mode
~
~
Stabillization Time
Normal
Data Retention Operating Mode
VDD
~
~
V DDDR
Execution of
STOP Instruction
RESETB
0.8 VDD
0.2 VDD
TWAIT
32
MC96F8208S ABOV Semiconductor Co., Ltd.
NOTE)
1. During a flash operation, SCLK[1:0] of SCCR must be set to “00” or “01” (INT-RC OSC or Main X-TAL for
system clock).
33
ABOV Semiconductor Co., Ltd. MC96F8208S
XIN XOUT
C1 C2
XIN XOUT
External Open
Clock
Source
34
MC96F8208S ABOV Semiconductor Co., Ltd.
1/fXIN
tXL tXH
XIN 0.8VDD
0.2VDD
35
ABOV Semiconductor Co., Ltd. MC96F8208S
(f XIN=0. 4 to 12MHz)
12.0 MHz
10.0 MHz
4.2 MHz
0.4 MHz
Supply voltage(V)
36
MC96F8208S ABOV Semiconductor Co., Ltd.
VDD +
0.1uF
0.1uF DC Power
VSS
VCC
The MCU power line (VDD and VSS)
{ FND(7-Segment),
,,,,,
etc
}
I/O
0.01uF
XOUT
37
ABOV Semiconductor Co., Ltd. MC96F8208S
mA
3.00
2.50
12MHz -40℃
2.00 12MHz +25℃
12MHz +85℃
1.50
HF-IRC 16MHz -40℃
HF-IRC 16MHz +25℃
1.00
HF-IRC 16MHz +85℃
0.50
0.00
2.5V 3.0V 3.5V 4.0V 4.5V 5.0V 5.5V
mA
1.60
1.40
0.20
0.00
2.5V 3.0V 3.5V 4.0V 4.5V 5.0V 5.5V
38
MC96F8208S ABOV Semiconductor Co., Ltd.
uA
2.50
2.00
1.50 -40℃
+25℃
1.00
+85℃
0.50
0.00
2.5V 3.0V 3.5V 4.0V 4.5V 5.0V 5.5V
39
ABOV Semiconductor Co., Ltd. MC96F8208S
8 Memory
The MC96F8208S addresses two separate address memory stores: Program memory and Data memory. The logical
separation of Program and Data memory allows Data memory to be accessed by 8-bit addresses, which makes the 8-
bit CPU access the data memory more rapidly. Nevertheless, 16-bit Data memory addresses can also be generated
through the DPTR register.
MC96F8208S provides on-chip 8k bytes of the ISP type flash program memory, which can be read and written to.
Internal data memory (IRAM) is 256 bytes and it includes the stack area. External data memory (XRAM) is 256 bytes.
40
MC96F8208S ABOV Semiconductor Co., Ltd.
FFFFH
1FFFH
8K Bytes
0000H
NOTE)
1. 8 Kbytes Including Interrupt Vector Region
41
ABOV Semiconductor Co., Ltd. MC96F8208S
FFH FFH
80H 80H
7FH
Lower 128bytes
Internal RAM
(Direct or Indirect
Addressing)
00H
The internal data memory space is divided into three blocks, which are generally referred to as the lower 128 bytes,
upper 128 bytes, and SFR space.
Internal data memory addresses are always one byte wide, which implies an address space of only 256 bytes.
However, in fact the addressing modes for internal RAM can accommodate up to 384 bytes by using a simple trick.
Direct addresses higher than 7FH access one memory space and indirect addresses higher than 7FH access a
different memory space. Thus Figure 8-2 shows the upper 128 bytes and SFR space occupying the same block of
addresses, 80H through FFH, although they are physically separate entities.
The lower 128 bytes of RAM are present in all 8051 devices as mapped in Figure 8-3. The lowest 32 bytes are
grouped into 4 banks of 8 registers. Program instructions call out these registers as R0 through R7. Two bits in the
Program Status Word select which register bank is in use. This allows more efficient use of code space, since register
instructions are shorter than instructions that use direct addressing.
The next 16 bytes above the register banks form a block of bit-addressable memory space. The 8051 instruction set
includes a wide selection of single-bit instructions, and the 128 bits in this area can be directly addressed by these
instructions. The bit addresses in this area are 00H through 7FH.
All of the bytes in the lower 128 bytes can be accessed by either direct or indirect addressing. The upper 128 bytes
RAM can only be accessed by indirect addressing. These spaces are used for data RAM and stack.
42
MC96F8208S ABOV Semiconductor Co., Ltd.
7FH 7F 7E 7D 7C 7B 7A 79 78
77 76 75 74 73 72 71 70
6F 6E 6D 6C 6B 6A 69 68
67 66 65 64 63 62 61 60
General Purpose 5F 5E 5D 5C 5B 5A 59 58
80 Bytes
Register 57 56 55 54 53 52 51 50
4F 4E 4D 4C 4B 4A 49 48
47 46 45 44 43 42 41 40
3F 3E 3D 3C 3B 3A 39 38
30H 37 36 35 34 33 32 31 30
2FH 2F 2E 2D 2C 2B 2A 29 28
27 26 25 24 23 22 21 20
16 Bytes
Bit Addressable 1F 1E 1D 1C 1B 1A 19 18
(128bits)
17 16 15 14 13 12 11 10
20H 0F 0E 0D 0C 0B 0A 09 08
1FH 07 06 05 04 03 02 01 00
Register Bank 3
8 Bytes
(8 Bytes)
18H
17H
Register Bank 2
8 Bytes
(8 Bytes)
10H
0FH
Register Bank 1 R7
8 Bytes
(8 Bytes) R6
08H
R5
07H
Register Bank 0 R4
8 Bytes
(8 Bytes) R3
00H
R2
R1
R0
43
ABOV Semiconductor Co., Ltd. MC96F8208S
00FFH
External RAM
256 Bytes
(Indirect Addressing)
0000H
44
MC96F8208S ABOV Semiconductor Co., Ltd.
- Reserved
M8051 compatible
(1)
00H/8H 01H/9H 02H/0AH 03H/0BH 04H/0CH 05H/0DH 06H/0EH 07H/0FH
0C8H OSCCR – – – – – – –
WTDR/ WDTDR/
88H P1 SCCR BITCR BITCNT WDTCR BUZDR
WTCNT WDTCNT
NOTE)
1. 00H/8H(1), These registers are bit-addressable.
45
ABOV Semiconductor Co., Ltd. MC96F8208S
@Reset
Address Function Symbol R/W
7 6 5 4 3 2 1 0
80H P0 Data Register P0 R/W – – – – 0 0 0 0
81H Stack Pointer SP R/W 0 0 0 0 0 1 1 1
82H Data Pointer Register Low DPL R/W 0 0 0 0 0 0 0 0
83H Data Pointer Register High DPH R/W 0 0 0 0 0 0 0 0
84H Data Pointer Register Low 1 DPL1 R/W 0 0 0 0 0 0 0 0
85H Data Pointer Register High 1 DPH1 R/W 0 0 0 0 0 0 0 0
86H Low Voltage Indicator Control Register LVICR R/W – – 0 0 0 0 0 0
87H Power Control Register PCON R/W 0 – – – 0 0 0 0
88H P1 Data Register P1 R/W – 0 0 0 0 0 0 –
Watch Timer Data Register WTDR W 0 1 1 1 1 1 1 1
89H
Watch Timer Counter Register WTCNT R – 0 0 0 0 0 0 0
8AH System and Clock Control Register SCCR R/W – – – – – – 0 0
8BH Basic Interval Timer Control Register BITCR R/W 0 0 0 – 0 0 0 1
8CH Basic Interval Timer Counter Register BITCNT R 0 0 0 0 0 0 0 0
8DH Watch Dog Timer Control Register WDTCR R/W 0 0 0 – – – 0 0
Watch Dog Timer Data Register WDTDR W 1 1 1 1 1 1 1 1
8EH
Watch Dog Timer Counter Register WDTCNT R 0 0 0 0 0 0 0 0
8FH BUZZER Data Register BUZDR R/W 1 1 1 1 1 1 1 1
90H P2 Data Register P2 R/W – – 0 0 – – – –
91H P0 Open-drain Selection Register P0OD R/W – – – – 0 0 0 0
92H P1 Open-drain Selection Register P1OD R/W – 0 0 0 0 0 0 –
93H P2 Open-drain Selection Register P2OD R/W – – 0 0 – – – –
94H P3 Open-drain Selection Register P3OD R/W 0 0 0 – – 0 0 0
95H Reserved – – –
96H Watch Timer Control Register WTCR R/W 0 – – 0 0 0 0 0
97H BUZZER Control Register BUZCR R/W – – – – 0 0 0 0
98H P3 Data Register P3 R/W 0 0 0 – – 0 0 0
99H Reserved – – –
9AH Reserved – – –
9BH Reserved – – –
9CH A/D Converter Control Low Register ADCCRL R/W 0 0 0 0 0 0 0 0
9DH A/D Converter Control High Register ADCCRH R/W 0 – – 0 0 0 0 0
9EH A/D Converter Data Low Register ADCDRL R x x x x x x x x
9FH A/D Converter Data High Register ADCDRH R x x x x x x x x
46
MC96F8208S ABOV Semiconductor Co., Ltd.
@Reset
Address Function Symbol R/W
7 6 5 4 3 2 1 0
A0H Internal Interrupt Flag Register IIFLAG R/W – – – – – 0 0 0
A1H P0 Direction Register P0IO R/W – – – – 0 0 0 0
A2H Extended Operation Register EO R/W – – – 0 – 0 0 0
A3H Reserved – – –
A4H External Interrupt Polarity 0 Low Register EIPOL0L R/W – – – – 0 0 0 0
A5H External Interrupt Polarity 0 High Register EIPOL0H R/W – – 0 0 – – – –
A6H External Interrupt Polarity 1 Register EIPOL1 R/W – – 0 0 0 0 0 0
A7H Reserved – – –
A8H Interrupt Enable Register IE R/W 0 – 0 – – 0 0 0
A9H Interrupt Enable Register 1 IE1 R/W – – 0 0 0 0 0 –
AAH Interrupt Enable Register 2 IE2 R/W – – – – 0 0 0 0
ABH Interrupt Enable Register 3 IE3 R/W – – – 0 0 0 0 0
ACH P0 Pull-up Resistor Selection Register P0PU R/W – – – – 0 0 0 0
ADH P1 Pull-up Resistor Selection Register P1PU R/W – 0 0 0 0 0 0 –
AEH P2 Pull-up Resistor Selection Register P2PU R/W – – 0 0 – – – –
AFH P3 Pull-up Resistor Selection Register P3PU R/W 0 0 0 – – 0 0 0
B0H External Interrupt Flag 1 Register EIFLAG1 R/W – 0 0 0 – – – –
B1H P1 Direction Register P1IO R/W – 0 0 0 0 0 0 –
B2H Timer 0 Control Register T0CR R/W 0 – 0 0 0 0 0 0
B3H Timer 0 Counter Register T0CNT R 0 0 0 0 0 0 0 0
Timer 0 Data Register T0DR R/W 1 1 1 1 1 1 1 1
B4H
Timer 0 Capture Data Register T0CDR R 0 0 0 0 0 0 0 0
B5H SPI Control Register SPICR R/W 0 0 0 0 0 0 0 0
B6H SPI Data Register SPIDR R/W 0 0 0 0 0 0 0 0
B7H SPI Status Register SPISR R/W 0 0 – – 0 – – –
B8H Interrupt Priority Register IP R/W – – 0 0 0 0 0 0
B9H P2 Direction Register P2IO R/W – – 0 0 – – – –
BAH Timer 1 Control Low Register T1CRL R/W 0 0 0 0 – 0 0 0
BBH Timer 1 Control High Register T1CRH R/W 0 – 0 0 – – – 0
BCH Timer 1 A Data Low Register T1ADRL R/W 1 1 1 1 1 1 1 1
BDH Timer 1 A Data High Register T1ADRH R/W 1 1 1 1 1 1 1 1
BEH Timer 1 B Data Low Register T1BDRL R/W 1 1 1 1 1 1 1 1
BFH Timer 1 B Data High Register T1BDRH R/W 1 1 1 1 1 1 1 1
47
ABOV Semiconductor Co., Ltd. MC96F8208S
@Reset
Address Function Symbol R/W
7 6 5 4 3 2 1 0
C0H External Interrupt Flag 0 Register EIFLAG0 R/W – 0 – – – – 0 0
C1H P3 Direction Register P3IO R/W 0 0 0 – – 0 0 0
C2H Timer 2 Control Low Register T2CRL R/W 0 0 0 0 0 0 – 0
C3H Timer 2 Control High Register T2CRH R/W 0 – 0 0 – – – 0
C4H Timer 2 A Data Low Register T2ADRL R/W 1 1 1 1 1 1 1 1
C5H Timer 2 A Data High Register T2ADRH R/W 1 1 1 1 1 1 1 1
C6H Timer 2 B Data Low Register T2BDRL R/W 1 1 1 1 1 1 1 1
C7H Timer 2 B Data High Register T2BDRH R/W 1 1 1 1 1 1 1 1
C8H Oscillator Control Register OSCCR R/W – – 0 0 1 0 0 0
C9H Reserved – – –
CAH Reserved – – –
CBH Reserved – – –
CCH Reserved – – –
CDH Reserved – – –
CEH Reserved – – –
CFH Reserved – – –
D0H Program Status Word Register PSW R/W 0 0 0 0 0 0 0 0
D1H Reserved – – –
D2H Reserved – – –
D3H P0 Function Selection Register P0FSR R/W – – – 0 0 0 0 0
D4H P1 Function Selection Low Register P1FSRL R/W – 0 0 0 0 0 0 –
D5H P1 Function Selection High Register P1FSRH R/W – – 0 0 0 0 0 0
D6H P2 Function Selection Register P2FSR R/W – – – – – – 0 0
D7H P3 Function Selection Register P3FSR R/W 0 0 0 – – 0 0 0
D8H Low Voltage Reset Control Register LVRCR R/W 0 – – 0 0 0 0 0
D9H Reserved – – –
DAH Reserved – – –
DBH Reserved – – –
DCH ADC Wake-up Interrupt Flag Low Register ADWIFRL R/W 0 0 0 0 0 0 0 0
DDH ADC Wake-up Interrupt Flag High Register ADWIFRH R/W – 0 0 0 0 0 0 0
DEH P03 Debounce Enable Register P03DB R/W 0 0 0 – – – 0 0
DFH P12 Debounce Enable Register P12DB R/W – – – – 0 0 0 –
48
MC96F8208S ABOV Semiconductor Co., Ltd.
@Reset
Address Function Symbol R/W
7 6 5 4 3 2 1 0
E0H Accumulator A Register ACC R/W 0 0 0 0 0 0 0 0
E1H Reserved – – –
E2H UART Control Register 1 UARTCR1 R/W – – 0 0 0 0 0 –
E3H UART Control Register 2 UARTCR2 R/W 0 0 0 0 0 0 0 0
E4H UART Control Register 3 UARTCR3 R/W – 0 – – – 0 0 0
E5H UART Status Register UARTST R/W 1 0 0 0 0 0 0 0
E6H UART Baud Rate Generation Register UARTBD R/W 1 1 1 1 1 1 1 1
E7H UART Data Register UARTDR R/W 0 0 0 0 0 0 0 0
E8H Reset Flag Register RSTFR R/W 1 x 0 – x – – –
E9H I2C Control Register I2CCR R/W 0 0 0 0 0 0 0 0
EAH I2C Status Register I2CSR R/W 0 0 0 0 0 0 0 0
EBH I2C Slave Address 0 Register I2CSAR0 R/W 0 0 0 0 0 0 0 0
ECH I2C Data Register I2CDR R/W 0 0 0 0 0 0 0 0
EDH I2C SDA Hold Time Register I2CSDHR R/W 0 0 0 0 0 0 0 1
EEH I2C SCL Low Period Register I2CSCLR R/W 0 0 1 1 1 1 1 1
EFH I2C SCL High Period Register I2CSCHR R/W 0 0 1 1 1 1 1 1
F0H B Register B R/W 0 0 0 0 0 0 0 0
F1H I2C Slave Address 1 Register I2CSAR1 R/W 0 0 0 0 0 0 0 0
F2H ADC Wake-up Resistor Control Register0 ADWRCR0 R/W 0 0 0 0 0 0 0 0
F3H Reserved – – –
F4H ADC Wake-up Resistor Control Register2 ADWRCR2 R/W 0 0 0 0 0 0 0 0
F5H ADC Wake-up Resistor Control Register3 ADWRCR3 R/W – – – – 0 0 0 0
F6H ADC Wake-up Control Low Register ADWCRL R/W – – – – 0 0 0 0
F7H ADC Wake-up Control High Register ADWCRH R/W – – 0 0 0 0 0 0
F8H Interrupt Priority Register 1 IP1 R/W – – 0 0 0 0 0 0
F9H Reserved – – –
FAH Flash Sector Address High Register FSADRH R/W – – – – 0 0 0 0
FBH Flash Sector Address Middle Register FSADRM R/W 0 0 0 0 0 0 0 0
FCH Flash Sector Address Low Register FSADRL R/W 0 0 0 0 0 0 0 0
FDH Flash Identification Register FIDR R/W 0 0 0 0 0 0 0 0
FEH Flash Mode Control Register FMCR R/W 0 – – – – 0 0 0
FFH Reserved – – –
49
ABOV Semiconductor Co., Ltd. MC96F8208S
B (B Register) : F0H
7 6 5 4 3 2 1 0
B
R/W R/W R/W R/W R/W R/W R/W R/W
Initial value : 00H
B B Register
50
MC96F8208S ABOV Semiconductor Co., Ltd.
51
ABOV Semiconductor Co., Ltd. MC96F8208S
9 I/O Ports
Data Register is a bidirectional I/O port. If ports are configured as output ports, data can be written to the
corresponding bit of the Px. If ports are configured as input ports, the data can be read from the corresponding bit of
the Px.
Each I/O pin can be independently used as an input or an output through the PxIO register. Bits cleared in this register
will make the corresponding pin of Px to input mode. Set bits of this register will make the pin to output mode. Almost
bits are cleared by a system reset, but some bits are set by a system reset.
The on-chip pull-up resistor can be connected to I/O ports individually with a pull-up resistor selection register (PxPU).
The pull-up register selection controls the pull-up resister enable/disable of each port. When the corresponding bit is 1,
the pull-up resister of the pin is enabled. When 0, the pull-up resister is disabled. All bits are cleared by a system reset.
There are internally open-drain selection registers (PxOD) for P0 ~ P3. The open-drain selection register controls the
open-drain enable/disable of each port. Almost ports become push-pull by a system reset, but some ports become
open-drain by a system reset.
P0[6:2], P1[3:0], P2[3:0] and P35 support debounce function. Debounce clocks of each ports are fx/1, fx/4, and
fx/4096.
These registers define alternative functions of ports. Please remember that these registers should be set properly for
alternative port function. A reset clears the PxFSR register to ‘00H’, which makes all pins to normal I/O ports.
52
MC96F8208S ABOV Semiconductor Co., Ltd.
53
ABOV Semiconductor Co., Ltd. MC96F8208S
9.3 P0 Port
P0 is 4-bit I/O port. P0 control registers consist of P0 data register (P0), P0 direction register (P0IO), debounce enable
register (P03DB), P0 pull-up resistor selection register (P0PU), and P0 open-drain selection register (P0OD). Refer to
the port function selection registers for the P0 function selection.
54
MC96F8208S ABOV Semiconductor Co., Ltd.
55
ABOV Semiconductor Co., Ltd. MC96F8208S
56
MC96F8208S ABOV Semiconductor Co., Ltd.
9.4 P1 Port
P1 is 6-bit I/O port. P1 control registers consist of P1 data register (P1), P1 direction register (P1IO), debounce enable
register (P12DB), P1 pull-up resistor selection register (P1PU), and P1 open-drain selection register (P1OD) . Refer to
the port function selection registers for the P1 function selection.
57
ABOV Semiconductor Co., Ltd. MC96F8208S
58
MC96F8208S ABOV Semiconductor Co., Ltd.
59
ABOV Semiconductor Co., Ltd. MC96F8208S
60
MC96F8208S ABOV Semiconductor Co., Ltd.
9.5 P2 Port
P2 is 2-bit I/O port. P2 control registers consist of P2 data register (P2), P2 direction register (P2IO), P2 pull-up resistor
selection register (P2PU) and P2 open-drain selection register (P2OD). Refer to the port function selection registers for
the P2 function selection.
61
ABOV Semiconductor Co., Ltd. MC96F8208S
62
MC96F8208S ABOV Semiconductor Co., Ltd.
9.6 P3 Port
P3 is 6-bit I/O port. P3 control registers consist of P3 data register (P3), P3 direction register (P3IO), P3 pull-up resistor
selection register (P3PU) and P3 open-drain selection register (P3OD). Refer to the port function selection registers for
the P3 function selection.
63
ABOV Semiconductor Co., Ltd. MC96F8208S
NOTE)
1. Refer to the configure option for the P32/RESETB
2. If P31 and P30 are used as SCL/SDA for I2C, P3OD[1:0] should be set “1”.
64
MC96F8208S ABOV Semiconductor Co., Ltd.
10 Interrupt Controller
10.1 Overview
The MC96F8208S supports up to 20 interrupt sources. The interrupts have separate enable register bits associated
with them, allowing software control. They can also have four levels of priority assigned to them. The non-maskable
interrupt source is always enabled with a higher priority than any other interrupt source, and is not controllable by
software. The interrupt controller has following features:
− Receive the request from 20 interrupt source
− 6 group priority
− 4 priority levels
− Multi Interrupt possibility
− If the requests of different priority levels are received simultaneously, the request of higher priority level is
served first.
− Each interrupt source can be controlled by EA bit and each IEx bit
− Interrupt latency: 3~9 machine cycles in single interrupt system
The non-maskable interrupt is always enabled. The maskable interrupts are enabled through four pair of interrupt
enable registers (IE, IE1, IE2, IE3). Each bit of IE, IE1, IE2, IE3 register individually enables/disables the
corresponding interrupt source. Overall control is provided by bit 7 of IE (EA). When EA is set to ‘0’, all interrupts are
disabled: when EA is set to ‘1’, interrupts are individually enabled or disabled through the other bits of the interrupt
enable registers. The EA bit is always cleared to ‘0’ jumping to an interrupt service vector and set to ‘1’ executing the
[RETI] instruction. The MC96F8208S supports a four-level priority scheme. Each maskable interrupt is individually
assigned to one of four priority levels according to IP and IP1.
Table 10-1 shows the Interrupt Group Priority Level that is available for sharing interrupt priority. Priority of a group is
set by two bits of interrupt priority registers (one bit from IP, another one from IP1). Interrupt service routine serves
higher priority interrupt first. If two requests of different priority levels are received simultaneously, the request of higher
priority level is served prior to the lower one.
65
ABOV Semiconductor Co., Ltd. MC96F8208S
66
MC96F8208S ABOV Semiconductor Co., Ltd.
EIPOL1
2
EINT10 Pin
FLAG10 INT0 Interrupt
2
EINT11 Pin
FLAG11 INT1 Interrupt
2
EINT12 Pin
FLAG12 INT2 Interrupt
EINT6 Pin
FLAG6 INT7 Interrupt
2
EIPOL0H
EIPOL0H,EIPOL0L
67
ABOV Semiconductor Co., Ltd. MC96F8208S
EIPOL0H IE1
6
6
EIFLAG0.6 6
6
EINT6 FLAG6 7
7
7
I2C I2CIFR 7
8
8
Uart Rx 8
8
9
Uart Tx 9
9
9
10
10
AN0 AN0WIFR 10
10 Level 0
AN3 AN3WIFR 11 Level 1
11
11 Level 2
AN8 AN8WIFR 11 Level 3 Release
Stop/Sleep
AN13 AN13WIFR 12
12
12
12
IE2 13
13
13
Timer 0 overflow T0OVIFR 13
14 EA
14
Timer 0 T0IFR 14
14
15
Timer 1 T1IFR 15
15
15
16
Timer 2 T2IFR 16
16
16
17
17
17
17
18
18
IE3 18
18
19
ADC ADCIFR
19
19
19
20
SPI SPIIFR 20
20
20
WT WTIFR 21
21
21
21
WDT WDTIFR 22
22
22
BIT BITIFR 22
23
23
23
23 Priority Low
NOTE)
1. The release signal for stop/idle mode may be generated by all interrupt sources which are enabled
without reference to the priority level.
2. An interrupt request is delayed while data are written to IE, IE1, IE2, IE3, IP, IP1, and PCON register.
68
MC96F8208S ABOV Semiconductor Co., Ltd.
Interrupt
Interrupt Source Symbol Polarity Mask Vector Address
Enable Bit
Hardware Reset RESETB - 0 Non-Maskable 0000H
External Interrupt 10 INT0 IE.0 1 Maskable 0003H
External Interrupt 11 INT1 IE.1 2 Maskable 000BH
External Interrupt 12 INT2 IE.2 3 Maskable 0013H
- INT3 IE.3 4 Maskable 001BH
- INT4 IE.4 5 Maskable 0023H
External Interrupt 0/1 INT5 IE.5 6 Maskable 002BH
- INT6 IE1.0 7 Maskable 0033H
External Interrupt 6 INT7 IE1.1 8 Maskable 003BH
I2C Interrupt INT8 IE1.2 9 Maskable 0043H
UART Rx Interrupt INT9 IE1.3 10 Maskable 004BH
UART Tx Interrupt INT10 IE1.4 11 Maskable 0053H
ADC Wake-up Interrupt INT11 IE1.5 12 Maskable 005BH
T0 Overflow Interrupt INT12 IE2.0 13 Maskable 0063H
T0 Match Interrupt INT13 IE2.1 14 Maskable 006BH
T1 Match Interrupt INT14 IE2.2 15 Maskable 0073H
T2 Match Interrupt INT15 IE2.3 16 Maskable 007BH
- INT16 IE2.4 17 Maskable 0083H
- INT17 IE2.5 18 Maskable 008BH
ADC Interrupt INT18 IE3.0 19 Maskable 0093H
SPI Interrupt INT19 IE3.1 20 Maskable 009BH
WT Interrupt INT20 IE3.2 21 Maskable 00A3H
WDT Interrupt INT21 IE3.3 22 Maskable 00ABH
BIT Interrupt INT22 IE3.4 23 Maskable 00B3H
- INT23 IE3.5 24 Maskable 00BBH
For maskable interrupt execution, EA bit must set ‘1’ and specific interrupt must be enabled by writing ‘1’ to associated
bit in the IEx. If an interrupt request is received, the specific interrupt request flag is set to ‘1’. And it remains ‘1’ until
CPU accepts interrupt. If the interrupt is served, the interrupt request flag will be cleared automatically.
69
ABOV Semiconductor Co., Ltd. MC96F8208S
1 IE.EA Flag 0
9 IE.EA Flag 1
70
MC96F8208S ABOV Semiconductor Co., Ltd.
Next Instruction
Next Instruction
Next Instruction
After executing next instruction,
interrupt flag result is effective.
Next Instruction
71
ABOV Semiconductor Co., Ltd. MC96F8208S
Main Program
Service
INT1 ISR
Set EA
INT0 ISR
Occur
INT1 Interrupt
Occur
INT0 Interrupt
RETI
RETI
Figure 10.6 shows an example of multi-interrupt processing. While INT1 is served, INT0 which has higher priority than
INT1 is occurred. Then INT0 is served immediately and then the remain part of INT1 service routine is executed. If the
priority level of INT0 is same or lower than INT1, INT0 will be served after the INT1 service has completed.
An interrupt service routine may be only interrupted by an interrupt of higher priority and, if two interrupts of different
priority occur at the same time, the higher level interrupt will be served first. An interrupt cannot be interrupted by
another interrupt of the same or a lower priority level. If two interrupts of the same priority level occur simultaneously,
the service order for those interrupts is determined by the scan order.
72
MC96F8208S ABOV Semiconductor Co., Ltd.
Interrupt
goes
Active
Interrupt
Latched Interrupt Processing Interrupt Routine
: LCALL & LJMP
Figure 10.8 Correspondence between Vector Table Address and the Entry Address of ISP
73
ABOV Semiconductor Co., Ltd. MC96F8208S
SCLK
INT_SRC
INTR_ACK
LAST_CYC
INTR_LCALL
Figure 10.10 Timing Chart of Interrupt Acceptance and Interrupt Return Instruction
Interrupt sources are sampled at the last cycle of a command. If an interrupt source is detected the lower 8-bit of
interrupt vector (INT_VEC) is decided. M8051W core makes interrupt acknowledge at the first cycle of a command,
and executes long call to jump to interrupt service routine.
NOTE)
st st nd nd
1. command cycle CLPx: L=Last cycle, 1=1 cycle or 1 phase, 2=2 cycle or 2 phase
74
MC96F8208S ABOV Semiconductor Co., Ltd.
Interrupt enable register consists of global interrupt control bit (EA) and peripheral interrupt control bits. Total 24
peripherals are able to control interrupt.
The 24 interrupts are divided into 6 groups which have each 4 interrupt sources. A group can be assigned 4 levels
interrupt priority using interrupt priority register. Level 3 is the highest priority, while level 0 is the lowest priority. After a
reset IP and IP1 are cleared to ‘00H’. If interrupts have the same priority level, lower number interrupt is served first.
The external interrupt flag 0 register (EIFLAG0) and external interrupt flag 1 register (EIFLAG1) are set to ‘1’ when the
external interrupt generating condition is satisfied. The flag is cleared when the interrupt service routine is executed.
Alternatively, the flag can be cleared by writing ‘0’ to it.
The external interrupt polarity 0 high/low register (EIPOL0H/L), external interrupt polarity 1 register (EIPOL1) and
external interrupt polarity 2 register (EIPOL2) determines which type of rising/falling/both edge interrupt. Initially, default
value is no interrupt at any edge.
75
ABOV Semiconductor Co., Ltd. MC96F8208S
The interrupt register is used for controlling interrupt functions. Also it has external interrupt control registers. The
interrupt register consists of interrupt enable register (IE), interrupt enable register 1 (IE1), interrupt enable register 2
(IE2) and interrupt enable register 3 (IE3). For external interrupt, it consists of external interrupt flag 0 register
(EIFLAG0), external interrupt polarity 0 high/low register (EIPOL0H/L), external interrupt flag 1 register (EIFLAG1) and
external interrupt polarity 1 register (EIPOL1) .
76
MC96F8208S ABOV Semiconductor Co., Ltd.
77
ABOV Semiconductor Co., Ltd. MC96F8208S
78
MC96F8208S ABOV Semiconductor Co., Ltd.
79
ABOV Semiconductor Co., Ltd. MC96F8208S
80
MC96F8208S ABOV Semiconductor Co., Ltd.
81
ABOV Semiconductor Co., Ltd. MC96F8208S
11 Peripheral Hardware
11.1.1 Overview
As shown in Figure 11.1, the clock generator produces the basic clock pulses which provide the system clock to be
supplied to the CPU and the peripheral hardware. It contains main-frequency clock oscillator. The main clock operation
can be easily obtained by attaching a crystal between the XIN and XOUT pin, respectively.
The main clock can be also obtained from the external oscillator. In this case, it is necessary to put the external clock
signal into the XIN pin and open the XOUT pin. The default system clock is 1MHz INT-RC Oscillator and the default
division rate is sixteen. In order to stabilize system internally, it is used 1MHz INT-RC oscillator on POR.
2
WDTCK
SCLK[1:0]
82
MC96F8208S ABOV Semiconductor Co., Ltd.
The clock generator register uses clock control for system operation. The clock generation consists of System and
clock control register and oscillator control register.
83
ABOV Semiconductor Co., Ltd. MC96F8208S
84
MC96F8208S ABOV Semiconductor Co., Ltd.
11.2.1 Overview
The MC96F8208S has one 8-bit basic interval timer that is free-run and can’t stop. Block diagram is shown in Figure
11.2. In addition, the basic interval timer generates the time base for watchdog timer counting. It also provides a basic
interval timer interrupt (BITIFR).
BCK[2:0]
Start CPU
selected bit
8-Bit Up Counter overflow To interrupt
BIT Clock BITIFR
BITCNT block
clear
clear
RESET INT_ACK
BCLR WDT
STOP
85
ABOV Semiconductor Co., Ltd. MC96F8208S
The basic interval timer register consists of basic interval timer counter register (BITCNT) and basic interval timer
control register (BITCR). If BCLR bit is set to ‘1’, BITCNT becomes ‘0’ and then counts up. After 1 machine cycle,
BCLR bit is cleared to ‘0’ automatically.
86
MC96F8208S ABOV Semiconductor Co., Ltd.
11.3.1 Overview
The watchdog timer rapidly detects the CPU malfunction such as endless looping caused by noise or something like
that, and resumes the CPU to the normal state. The watchdog timer signal for malfunction detection can be used as
either a CPU reset or an interrupt request. When the watchdog timer is not being used for malfunction detection, it can
be used as a timer to generate an interrupt at fixed intervals. It is possible to use free running 8-bit timer mode
(WDTRSON=’0’) or watch dog timer mode (WDTRSON=’1’) as setting WDTCR[6] bit. If WDTCR[5] is written to ‘1’,
WDT counter value is cleared and counts up. After 1 machine cycle, this bit is cleared to ‘0’ automatically. The
watchdog timer consists of 8-bit binary counter and the watchdog timer data register. When the value of 8-bit binary
counter is equal to the 8 bits of WDTCNT, the interrupt request flag is generated. This can be used as Watchdog timer
interrupt or reset of CPU in accordance with the bit WDTRSON.
The input clock source of watch dog timer is the BIT overflow. The interval of watchdog timer interrupt is decided by
BIT overflow period and WDTDR set value. The equation can be described as
Source Clock
BIT Overflow
WDTCNT[7:0] 0 1 2 3 0 1 2 3 0 1 2
Counter Clear
WDTDR[7:0] n 3
WDTCL
Occur
WDTIFR Match
WDTDR 0000_0011b
Detect
Interrupt
WDTRESETB RESET
87
ABOV Semiconductor Co., Ltd. MC96F8208S
To interrupt
WDTIFR
block
WDTDR clear
INT_ACK
WDTCL WDTRSON
WDTCR
The watch dog timer register consists of watch dog timer counter register (WDTCNT), watch dog timer data register
(WDTDR) and watch dog timer control register (WDTCR).
88
MC96F8208S ABOV Semiconductor Co., Ltd.
89
ABOV Semiconductor Co., Ltd. MC96F8208S
11.4.1 Overview
The watch timer has the function for RTC (Real Time Clock) operation. It is generally used for RTC design. The
internal structure of the watch timer consists of the clock source select circuit, timer counter circuit, output select circuit,
and watch timer control register. To operate the watch timer, determine the input clock source, output interval, and set
WTEN to ‘1’ in watch timer control register (WTCR). It is able to execute simultaneously or individually. To stop or reset
WT, clear the WTEN bit in WTCR register. The watch timer counter circuits may be composed of 21-bit counter which
contains low 14-bit with binary counter and high 7-bit counter in order to raise resolution. In WTDR, it can control WT
clear and set interval value at write time, and it can read 7-bit WT counter value at read time.
P
r
fx/64
e 14
Match
M f WCK 14Bit fWCK /2 Clear
s Timer counter
fx/128 U Binary Counter WTCL
fx c
a X
fx/256
l
match
e 14
f WCK /(2 X(7 bit WTDR Value +1))
r
Comparator
fWCK /214
WTIFR To interrupt
fWCK /213 MUX
block
fWCK /2 7
Clear
2
Reload Match
WTCL
WTDR
Write case WTCL WTDR6 WTDR5 WTDR4 WTDR3 WTDR2 WTDR1 WTDR0
WTCNT
- WTCNT6 WTCNT5 WTCNT4 WTCNT3 WTCNT2 WTCNT1 WTCNT0
Read case
90
MC96F8208S ABOV Semiconductor Co., Ltd.
The watch timer register consists of watch timer counter register (WTCNT), watch timer data register (WTDR), and
watch timer control register (WTCR). As WTCR is 6-bit writable/readable register, WTCR can control the clock source
(WTCK[1:0]), interrupt interval (WTIN[1:0]), and function enable/disable (WTEN). Also there is WT interrupt flag bit
(WTIFR).
91
ABOV Semiconductor Co., Ltd. MC96F8208S
92
MC96F8208S ABOV Semiconductor Co., Ltd.
11.5 Timer 0
11.5.1 Overview
The 8-bit timer 0 consists of multiplexer, timer 0 counter register, timer 0 data register, timer 0 capture data register and
timer 0 control register (T0CNT, T0DR, T0CDR, T0CR).
The timer/counter 0 can be clocked by an internal. The clock source is selected by clock selection logic which is
controlled by the clock selection bits (T0CK[2:0]).
− TIMER 0 clock source: fX/2, 4, 8, 32, 128, 512, 2048
In the capture mode, by EINT10, the data is captured into input capture data register (T0CDR). In timer/counter mode,
whenever counter value is equal to T0DR, T0O port toggles. Also the timer 0 outputs PWM waveform through
PWM0O port in the PWM mode.
93
ABOV Semiconductor Co., Ltd. MC96F8208S
The 8-bit timer/counter mode is selected by control register as shown in Figure 11.6.
The 8-bit timer have counter and data register. The counter register is increased by internal. Timer 0 can use the input
clock with one of 2, 4, 8, 32, 128, 512 and 2048 prescaler division rates (T0CK[2:0]). When the value of T0CNT and
T0DR is identical in timer 0, a match signal is generated and the interrupt of Timer 0 occurs. T0CNT value is
automatically cleared by match signal. It can be also cleared by software (T0CC).
T0CR T0EN - T0MS1 T0MS0 T0CK2 T0CK1 T0CK0 T0CC ADDRESS : B2H
INITIAL VALUE: 0000_0000B
1 - 0 0 x x x x
T0O/PWM0O
T0CNT n
Value n-
1
n-
2 Count Pulse
Period
Up-count 6 PCP
5
4
3
2
1
0
Timer 0
(T0IFR)
Interrupt Occur Occur Occur
Interrupt Interrupt Interrupt
94
MC96F8208S ABOV Semiconductor Co., Ltd.
The timer 0 has a high speed PWM (Pulse Width Modulation) function. In PWM mode, T0O/PWM0O pin outputs up to
8-bit resolution PWM output. This pin should be configured as a PWM output by setting the T0O/PWM0O function by
P3FSR[5] bit. In the 8-bit timer/counter mode, a match signal is generated when the counter value is identical to the
value of T0DR. When the value of T0CNT and T0DR is identical in timer 0, a match signal is generated and the
interrupt of timer 0 occurs. In PWM mode, the match signal does not clear the counter. Instead, it runs continuously,
overflowing at “FFH”, and then continues incrementing from “00H”. The timer 0 overflow interrupt is generated
whenever a counter overflow occurs. T0CNT value is cleared by software (T0CC) bit.
T0CR T0EN - T0MS1 T0MS0 T0CK2 T0CK1 T0CK0 T0CC ADDRESS : B2H
INITIAL VALUE: 0000_0000B
1 - 0 1 x x x x
INT_ACK
Clear
To interrupt
T0OVIFR block
T0O/PWM0O
95
ABOV Semiconductor Co., Ltd. MC96F8208S
Set T0EN
Timer 0
clock
T0DR
T0 Overflow
Interrupt
1. T0DR = 4AH
T0PWM
T0 Match
Interrupt
2. T0DR = 00H
T0PWM
T0 Match
Interrupt
3. T0DR = FFH
T0PWM
T0 Match
Interrupt
96
MC96F8208S ABOV Semiconductor Co., Ltd.
The timer 0 capture mode is set by T0MS[1:0] as ‘1x’. The clock source can use the internal/external clock. Basically,
it has the same function as the 8-bit timer/counter mode and the interrupt occurs when T0CNT is equal to T0DR.
T0CNT value is automatically cleared by match signal and it can be also cleared by software (T0CC).
This timer interrupt in capture mode is very useful when the pulse width of captured signal is wider than the maximum
period of timer.
The capture result is loaded into T0CDR. In the timer 0 capture mode, timer 0 output (T0O) waveform is not available.
According to EIPOL1 registers setting, the external interrupt EINT10 function is chosen. Of course, the EINT10 pin
must be set to an input port.
T0CDR and T0DR are in the same address. In the capture mode, reading operation reads T0CDR, not T0DR and
writing operation will update T0DR.
T0CR T0EN - T0MS1 T0MS0 T0CK2 T0CK1 T0CK0 T0CC ADDRESS : B2H
INITIAL VALUE: 0000_0000B
1 - 1 x x x x x
T0CDR(8Bit)
EINT10
INT_ACK
2 Clear
T0MS[1:0]
FLAG10 To interrupt
(EIFLAG1.4) block
97
ABOV Semiconductor Co., Ltd. MC96F8208S
T0CDR Load
n
T0CNT Value n-1
n-2
Count Pulse Period
PCP
Up-count 6
5
4
3
2
1
0
TIME
Interrupt
Request
(FLAG10)
Interrupt Interval Period
FFH FFH
XXH
T0CNT
YYH
Interrupt
Request
(T0IFR)
Interrupt
Request
(FLAG10)
Interrupt Interval Period = FFH+01H+FFH +01H+YYH+01H
98
MC96F8208S ABOV Semiconductor Co., Ltd.
INT_ACK
Clear
To interrupt
fx/2 T0OVIFR
P block
r fx/4
e 8-bit Timer 0 Counter
fx/8
s M Clear T0CC
fx fx/32 U T0CNT (8Bit) INT_ACK
c
X Match signal
a fx/128 Clear
l fx/512 Clear
e Match To interrupt
fx/2048 T0EN MUX T0IFR
r block
Comparator
To other 2
3
T0DR (8Bit) block
T0CK[2:0] T0MS[1:0]
8-bit Timer 0 Data Register
EIPOL1[1:0]
T0O/PWM0O
2
T0CDR (8Bit)
EINT10
INT_ACK
Clear
2
T0MS[1:0]
FLAG10 To interrupt
(EIFLAG1.4) block
The timer/counter 0 register consists of timer 0 counter register (T0CNT), timer 0 data register (T0DR), timer 0 capture
data register (T0CDR), and timer 0 control register (T0CR). T0IFR and T0OVIFR bits are in the internal interrupt flag
register (IIFLAG).
99
ABOV Semiconductor Co., Ltd. MC96F8208S
T0CDR (Timer 0 Capture Data Register: Read Case, Capture mode only) : B4H
7 6 5 4 3 2 1 0
T0CDR7 T0CDR6 T0CDR5 T0CDR4 T0CDR3 T0CDR2 T0CDR1 T0CDR0
R R R R R R R R
Initial value : 00H
T0CDR[7:0] T0 Capture Data
100
MC96F8208S ABOV Semiconductor Co., Ltd.
101
ABOV Semiconductor Co., Ltd. MC96F8208S
11.6 Timer 1
11.6.1 Overview
The 16-bit timer 1 consists of multiplexer, timer 1 A data register high/low, timer 1 B data register high/low and timer 1
control register high/low (T1ADRH, T1ADRL, T1BDRH, T1BDRL, T1CRH, T1CRL).
The timer/counter 1 can be clocked by an internal or an external clock source (EC1). The clock source is selected by
clock selection logic which is controlled by the clock selection bits (T1CK[2:0]).
− TIMER 1 clock source: fX/1, 2, 4, 8, 64, 512, 2048 and EC1
In the capture mode, by EINT11, the data is captured into input capture data register (T1BDRH/T1BDRL). Timer 1
outputs the comparison result between counter and data register through T1O port in timer/counter mode. Also Timer
1 outputs PWM wave form through PWM1O port in the PPG mode.
The 16-bit timer/counter mode is selected by control register as shown in Figure 11.14.
The 16-bit timer have counter and data register. The counter register is increased by internal or external clock input.
Timer 1 can use the input clock with one of 1, 2, 4, 8, 64, 512 and 2048 prescaler division rates (T1CK[2:0]). When
the value of T1CNTH, T1CNTL and the value of T1ADRH, T1ADRL are identical in Timer 1 respectively, a match
signal is generated and the interrupt of Timer 1 occurs. The T1CNTH, T1CNTL value is automatically cleared by
match signal. It can be also cleared by software (T1CC).
The external clock (EC1) counts up the timer at the rising edge. If the EC1 is selected as a clock source by T1CK[2:0],
EC1 port should be set to the input port by P11IO bit.
102
MC96F8208S ABOV Semiconductor Co., Ltd.
Reload A Match
T1CC
T1EN
T1CK[2:0]
T1ECE INT_ACK
3 Buffer Register A
Clear
Edge
EC1 A Match To interrupt
Detector T1IFR
fx/1 T1EN block
P
r fx/2 Comparator
e Clear A Match
fx/4 M 16-bit Counter
s R T1CC
U T1CNTH/T1CNTL
fx c fx/8 T1EN
X
a fx/64
l Pulse
fx/512 T1O
e Generator
r fx/2048
2
T1MS[1:0] T1POL
n
T1CNTH/L
Value n-1
n-2
Count Pulse Period
PCP
Up-count 6
5
4
3
2
1
0
Timer 1
(T1IFR)
Interrupt Occur Occur Occur
Interrupt Interrupt Interrupt
103
ABOV Semiconductor Co., Ltd. MC96F8208S
The 16-bit timer 1 capture mode is set by T1MS[1:0] as ‘01’. The clock source can use the internal/external clock.
Basically, it has the same function as the 16-bit timer/counter mode and the interrupt occurs when T1CNTH/T1CNTL is
equal to T1ADRH/T1ADRL. The T1CNTH, T1CNTL values are automatically cleared by match signal. It can be also
cleared by software (T1CC).
This timer interrupt in capture mode is very useful when the pulse width of captured signal is wider than the maximum
period of timer.
The capture result is loaded into T1BDRH/T1BDRL.
According to EIPOL1 registers setting, the external interrupt EINT11 function is chosen. Of course, the EINT11 pin
must be set as an input port.
Reload A Match
T1CC
T1EN
T1CK[2:0]
T1ECE INT_ACK
3 Buffer Register A
Clear
Edge
EC1 A Match To interrupt
Detector T1IFR
fx/1 T1EN block
P
r fx/2 Comparator
e Clear A Match
fx/4 M 16-bit Counter
s R T1CC
U T1CNTH/T1CNTL
fx c fx/8 T1EN
X
a fx/64
Clear
l fx/512
e
r fx/2048
EIPOLB[1:0]
2
T1CNTR
16-bit B Data Register
EINT11 T1BDRH/T1BDRL
INT_ACK
Clear
2
T1MS[1:0]
FLAG11 To interrupt
(EIFLAG1.5) block
104
MC96F8208S ABOV Semiconductor Co., Ltd.
T1BDRH/L Load
n
T1CNTH/L
Value n-1
n-2
Count Pulse Period
PCP
Up-count 6
5
4
3
2
1
0
TIME
Interrupt
Request
(FLAG11)
Interrupt Interval Period
FFFFH FFFFH
XXH
T1CNTH/L
YYH
Interrupt
Request
(T1IFR)
Interrupt
Request
(FLAG11)
Interrupt Interval Period = FFFFH+01H+FFFFH +01H+YYH+01H
105
ABOV Semiconductor Co., Ltd. MC96F8208S
The timer 1 has a PPG (Programmable Pulse Generation) function. In PPG mode, T1O/PWM1O pin outputs up to
16-bit resolution PWM output. This pin should be configured as a PWM output by setting P1FSRL[4:3] to ‘01’. The
period of the PWM output is determined by the T1ADRH/T1ADRL. And the duty of the PWM output is determined by
the T1BDRH/T1BDRL.
Reload A Match
T1CC
T1EN
T1CK[2:0]
T1ECE INT_ACK
3 Buffer Register A
Clear
Edge
EC1 A Match To interrupt
Detector T1IFR
fx/1 T1EN block
P
r fx/2 Comparator
e Clear A Match
fx/4 M 16-bit Counter
s R T1CC
U T1CNTH/T1CNTL
fx c fx/8 T1EN
X
a fx/64
l Pulse T1O/
fx/512 B Match
e Generator PWM1O
r fx/2048
Comparator
2
Buffer Register B T1MS[1:0] T1POL
Reload A Match
T1CC
T1EN
NOTE)
1. The T1EN is automatically cleared to logic “0” after one pulse is generated at a PPG one-shot mode.
106
MC96F8208S ABOV Semiconductor Co., Ltd.
Timer 1 clock
Counter X 0 1 2 3 4 5 6 7 8 M-1 0 1 2 3 4
T1ADRH/L M
T1 Interrupt
PWM1O A Match
3. T1BDRH/L = "0000H"
Timer 1 clock
Counter X 0 1 2 3 4 5 6 7 8 M-1 0
T1ADRH/L M
T1 Interrupt
PWM1O A Match
3. T1BDRH/L = "0000H"
107
ABOV Semiconductor Co., Ltd. MC96F8208S
Reload A Match
T1CC
T1EN
To other
T1ECE T1CK[2:0] block
INT_ACK
3 Buffer Register A
Clear
Edge
EC1 A Match
Detector To interrupt
T1IFR
fx/1 T1EN block
P
r fx/2 Comparator
e M Clear A Match
fx/4 16-bit Counter R T1CC
s U
fx/8 T1CNTH/T1CNTL T1EN
fx c X
a fx/64
Clear Pulse T1O/
l fx/512 B Match
e Generator PWM1O
r fx/2048
Comparator
2
Buffer Register B T1MS[1:0] T1POL
EIPOL1[3:2]
2 Reload A Match
T1CNTR T1CC
T1EN
EINT11 INT_ACK
16-bit B Data Register
T1BDRH/T1BDRL Clear
2
T1MS[1:0]
FLAG11 To interrupt
(EIFLAG1.5) block
108
MC96F8208S ABOV Semiconductor Co., Ltd.
The timer/counter 1 register consists of timer 1 A data high register (T1ADRH), timer 1 A data low register (T1ADRL),
timer 1 B data high register (T1BDRH), timer 1 B data low register (T1BDRL), timer 1 control high register (T1CRH)
and timer 1 control low register (T1CRL).
109
ABOV Semiconductor Co., Ltd. MC96F8208S
110
MC96F8208S ABOV Semiconductor Co., Ltd.
111
ABOV Semiconductor Co., Ltd. MC96F8208S
11.7 Timer 2
11.7.1 Overview
The 16-bit timer 2 consists of multiplexer, timer 2 A data high/low register, timer 2 B data high/low register and timer 2
control high/low register (T2ADRH, T2ADRL, T2BDRH, T2BDRL, T2CRH, T2CRL).
The timer/counter 2 can be clocked by an internal or T1 A Match (timer 1 A match signal). The clock source is selected
by clock selection logic which is controlled by the clock selection bits (T2CK[2:0]).
− TIMER 2 clock source: fX/1, 2, 4, 8, 64, 512, 2048 and T1 A Match
In the capture mode, by EINT12, the data is captured into input capture data register (T2BDRH/T2BDRL). In
timer/counter mode, whenever counter value is equal to T2ADRH/L, T2O port toggles. Also the timer 2 outputs PWM
wave form to PWM2O port in the PPG mode.
112
MC96F8208S ABOV Semiconductor Co., Ltd.
The 16-bit timer/counter mode is selected by control register as shown in Figure 11.22.
The 16-bit timer have counter and data register. The counter register is increased by internal or timer 1 A match clock
input. Timer 2 can use the input clock with one of 1, 2, 4, 8, 64, 512 and 2048 prescaler division rates and T1 A Match
(T2CK[2:0]). When the values of T2CNTH/T2CNTL and T2ADRH/T2ADRL are identical in timer 2, a match signal is
generated and the interrupt of Timer 2 occurs. The T2CNTH/T2CNTL values are automatically cleared by match
signal. It can be also cleared by software (T2CC).
Reload A Match
T2CC
T2CK[2:0] T2EN
T2ECS INT_ACK
3 Buffer Register A
Clear
Reserved M
U A Match To interrupt
T1 A Match X T2IFR
fx/1 T2EN block
P
r fx/2 Comparator
e Clear A Match
fx/4 M 16-bit Counter
s R T2CC
U T2CNTH/T2CNTL
fx c fx/8 T2EN
X
a fx/64
l Pulse
fx/512 T2O
e Generator
r fx/2048
2
T2MS[1:0] T2POL
NOTE)
1. T1 A Match is a pulse for the timer 2 clock source if it is selected.
113
ABOV Semiconductor Co., Ltd. MC96F8208S
n
T2CNTH/L
Value n-1
n-2
Count Pulse Period
PCP
Up-count 6
5
4
3
2
1
0
Timer 2
(T2IFR)
Interrupt Occur Occur Occur
Interrupt Interrupt Interrupt
114
MC96F8208S ABOV Semiconductor Co., Ltd.
The timer 2 capture mode is set by T2MS[1:0] as ‘01’. The clock source can use the internal clock. Basically, it has
the same function as the 16-bit timer/counter mode and the interrupt occurs when T2CNTH/T2CNTL is equal to
T2ADRH/T2ADRL. T2CNTH/T2CNTL values are automatically cleared by match signal and it can be also cleared by
software (T2CC).
This timer interrupt in capture mode is very useful when the pulse width of captured signal is wider than the maximum
period of timer.
The capture result is loaded into T2BDRH/T2BDRL. In the timer 2 capture mode, timer 2 output(T2O) waveform is not
available.
According to EIPOL1 registers setting, the external interrupt EINT12 function is chosen. Of course, the EINT12 pin
must be set to an input port.
Reload A Match
T2CC
T2CK[2:0] T2EN
T2ECS
INT_ACK
3 Buffer Register A
Clear
Reserved M
U A Match To interrupt
T1 A Match X T2IFR
fx/1 T2EN block
P
r fx/2 Comparator
e Clear A Match
fx/4 M 16-bit Counter
s R T2CC
U T2CNTH/T2CNTL
fx c fx/8 T2EN
X
a fx/64
Clear
l fx/512
e
r fx/2048
EIPOL1[5:4]
2
T2CNTR
16-bit B Data Register
EINT12 T2BDRH/T2BDRL
INT_ACK
Clear
2
T2MS[1:0]
FLAG12 To interrupt
(EIFLAG1.6) block
NOTE)
1. T1 A Match is a pulse for the timer 2 clock source if it is selected.
115
ABOV Semiconductor Co., Ltd. MC96F8208S
T2BDRH/L Load
n
T2CNTH/L
Value n-1
n-2
Count Pulse Period
PCP
Up-count 6
5
4
3
2
1
0
TIME
Interrupt
Request
(FLAG12)
Interrupt Interval Period
FFFFH FFFFH
XXH
T2CNTH/L
YYH
Interrupt
Request
(T2IFR)
Interrupt
Request
(FLAG12)
Interrupt Interval Period = FFFFH+01H+FFFFH +01H+YYH+01H
116
MC96F8208S ABOV Semiconductor Co., Ltd.
The timer 2 has a PPG (Programmable Pulse Generation) function. In PPG mode, the T2O/PWM2O pin outputs up
to 16-bit resolution PWM output. This pin should be configured as a PWM output by set P1FSRL[6:5] to ‘01’. The
period of the PWM output is determined by the T2ADRH/T2ADRL. And the duty of the PWM output is determined by
the T2BDRH/T2BDRL.
Reload A Match
T2CC
T2CK[2:0] T2EN
T2ECS
INT_ACK
3 Buffer Register A
Clear
Reserved M
U A Match To interrupt
T1 A Match X T2IFR
fx/1 T2EN block
P
r fx/2 Comparator
e Clear A Match
fx/4 M 16-bit Counter
s R T2CC
U T2CNTH/T2CNTL
fx c fx/8 T2EN
X
a fx/64
l Pulse T2O/
fx/512 B Match
e Generator PWM2O
r fx/2048
Comparator
2
Buffer Register B T2MS[1:0] T2POL
Reload A Match
T2CC
T2EN
NOTE)
1. The T2EN is automatically cleared to logic “0” after one pulse is generated at a PPG one-shot mode.
2. T1 A Match is a pulse for the timer 2 clock source if it is selected.
117
ABOV Semiconductor Co., Ltd. MC96F8208S
Timer 2 clock
Counter X 0 1 2 3 4 5 6 7 8 M-1 0 1 2 3 4
T2ADRH/L M
T2 Interrupt
PWM2O A Match
3. T2BDRH/L = "0000H"
Timer 2 clock
Counter X 0 1 2 3 4 5 6 7 8 M-1 0
T2ADRH/L M
T2 Interrupt
PWM2O A Match
3. T2BDRH/L = "0000H"
118
MC96F8208S ABOV Semiconductor Co., Ltd.
Reload A Match
T2CC
T2EN
To other
T2ECS T2CK[2:0] block
INT_ACK
3 Buffer Register A
Reserved M Clear
U
A Match To interrupt
T1 A Match X T2IFR
fx/1 T2EN block
P
r fx/2 Comparator
e M Clear A Match
fx/4 16-bit Counter
s U R T2CC
fx c fx/8 X T2CNTH/T2CNTL T2EN
a fx/64
l Clear Pulse T2O/
fx/512 B Match
e Generator PWM2O
r fx/2048
Comparator
2
Buffer Register B T2MS[1:0] T2POL
EIPOL1[5:4]
2 Reload A Match
T2CNTR T2CC
T2EN
EINT12 INT_ACK
16-bit B Data Register
T2BDRH/T2BDRL Clear
2
T2MS[1:0]
FLAG12 To interrupt
(EIFLAG1.6) block
NOTE)
1. T1 A Match is a pulse for the timer 2 clock source if it is selected.
119
ABOV Semiconductor Co., Ltd. MC96F8208S
The timer/counter 2 register consists of timer 2 A data high register (T2ADRH), timer 2 A data low register (T2ADRL),
timer 2 B data high register (T2BDRH), timer 2 B data low register (T2BDRL), timer 2 control high register (T2CRH)
and timer 2 control low register (T2CRL).
120
MC96F8208S ABOV Semiconductor Co., Ltd.
121
ABOV Semiconductor Co., Ltd. MC96F8208S
122
MC96F8208S ABOV Semiconductor Co., Ltd.
11.8.1 Overview
The Buzzer consists of 8 bit counter, buzzer data register (BUZDR), and buzzer control register (BUZCR). The Square
Wave (61.035Hz~125.0 kHz @8MHz) is outputted through P11/BUZO pin. The buzzer data register (BUZDR) controls
the buzzer frequency (look at the following expression). In buzzer control register (BUZCR), BUCK[2:0] selects source
clock divided by prescaler.
Oscillator Frequency
f BUZ(Hz)
2 PrescalerRatio (BUZDR 1)
BUZEN
fx/32 8-bit Up-Counter
fx/64 M Clear
Pre
fx fx/128 U Counter
scaler
X
fx/256
Match
F/F BUZO
3
Comparator
BUCK[2:0]
BUZDR
123
ABOV Semiconductor Co., Ltd. MC96F8208S
Buzzer driver consists of buzzer data register (BUZDR) and buzzer control register (BUZCR).
124
MC96F8208S ABOV Semiconductor Co., Ltd.
11.9.1 Overview
The analog-to-digital converter (A/D) allows conversion of an analog input signal to corresponding 12-bit digital value.
The A/D module has fifteen analog inputs. The output of the multiplexer is the input into the converter which generates
the result through successive approximation. The A/D module has four registers which are the A/D converter control
high register (ADCCRH), A/D converter control low register (ADCCRL), A/D converter data high register (ADCDRH),
and A/D converter data low register (ADCDRL). The channels to be converted are selected by setting ADSEL[3:0]. To
execute A/D conversion, TRIG[1:0] bits should be set to ‘xx’. The register ADCDRH and ADCDRL contains the results
of the A/D conversion. When the conversion is completed, the result is loaded into the ADCDRH and ADCDRL, the
A/D conversion status bit AFLAG is set to ‘1’, and the A/D interrupt is set. During A/D conversion, AFLAG bit is read as
‘0’.
The A/D conversion process requires 4 steps (4 clock edges) to convert each bit and 10 clocks to set up A/D
conversion. Therefore, total of 58 clocks are required to complete a 12-bit conversion: When fxx/8 is selected for
conversion clock with a 12MHz fxx clock frequency, one clock cycle is 0.66 μs. Each bit conversion requires 4 clocks,
the conversion rate is calculated as follows:
4 clocks/bit × 12 bits + set-up time = 58 clocks,
58 clock × 0.66 μs = 38.28 μs at 1.5 MHz (12 MHz/8)
NOTE)
1. The A/D converter needs at least 20 μs for conversion time. So you must set the conversion time more
than 20 μs.
125
ABOV Semiconductor Co., Ltd. MC96F8208S
TRIG[1:0]
2
ADST
ADSEL[3:0] M
Start T0 match signal
(Select one input pin U
T1 A match signal
of the assigned pins) X
T2 A match signal
Clock
ADCLK
Selector
Clear
AN0
AFLAG
AN3 M
Input Pins AN8 U + Comparator
X Control To interrupt
ADCIFR
Logic block
AN13 -
VDD18
Clear
INT_ACK
Reference
Voltage
ADCDRH (R), ADCDRL (R)
VDD AVREF
Analog AN0~AN3/
Input AN8~AN13
0~1000pF
Analog
Power AVREF
Input
22uF
126
MC96F8208S ABOV Semiconductor Co., Ltd.
ADCO11 ADCO10 ADCO9 ADCO8 ADCO7 ADCO6 ADCO5 ADCO4 ADCO3 ADCO2 ADCO1 ADCO0
ADCDRH7 ADCDRH6 ADCDRH5 ADCDRH4 ADCDRH3 ADCDRH2 ADCDRH1 ADCDRH0 ADCDRL7 ADCDRL6 ADCDRL5 ADCDRL4
ADCDRH[7:0] ADCDRL[7:4]
ADCDRL[3:0] bits are “0”
ADCO11 ADCO10 ADCO9 ADCO8 ADCO7 ADCO6 ADCO5 ADCO4 ADCO3 ADCO2 ADCO1 ADCO0
ADCDRH3 ADCDRH2 ADCDRH1 ADCDRH0 ADCDRL7 ADCDRL6 ADCDRL5 ADCDRL4 ADCDRL3 ADCDRL2 ADCDRL1 ADCDRL0
ADCDRL[3:0] ADCDRL[7:0]
ADCDRL[7:4] bits are “0”
127
ABOV Semiconductor Co., Ltd. MC96F8208S
ADC END
The A/D converter has ADC power-down wake-up function. The function includes two pull-up resistors for wake-up
from power-down mode. The corresponding pull-up resistor which is selected as an ADC input function by
P0FSR/P1FSRL/P1FSRH register is enabled during power-down mode(IDLE, STOP) if ANnRS[1:0] is not “00b”. An
ADC wake-up interrupt can occur by a falling edge(VIL) of key inputs during power-down mode(IDLE, STOP) if
ANnWEN bit is ‘1’. Where n = 0, 1, 2, 3, 8, 9, 10, 11, 12 and 13.
128
MC96F8208S ABOV Semiconductor Co., Ltd.
VDD VDD
ANnRS0
IDLE or STOP
ANn Function
ANnRS1
IDLE or STOP
RAWPU1 RAWPU2
ANn Function
ANn
S/W
Clear
ANnWEN
ADnWIFR To interrupt
IDLE or STOP block
ANn Function
NOTE)
1. AN0-AN3, AN8-AN13 Function can be controlled by P0FSR, P1FSRL, and P1FSRH.
2. The pull-up resistor of P0/P1 can be enabled by P0PU/P1PU register. So, Be careful of each P0/P1 pull-
up resistor. If a pull-up resistor of P0/P1 is enabled, the corresponding pin will be changed the equivalent
resistor value by it.
3. ADC wake-up interrupt can occur by a falling edge(VIL) of selected ANn pins.
4. ADC path is off when it is power-down mode and ADC wake-up interrupt path is on during power-down
mode when ANnWEN bit is ‘1’.
5. Where n = 0, 1, 2, 3, 8, 9, 10, 11, 12, and 13.
To use ADC power-down wake-up function in case of AN0 and a wake-up pull-up resistor 150kΩ, follow the
recommended steps below.
1. Select AN0 function by P0FSR0 bit set to ‘1’ in P0FSR register. Disable P00’s pull-up resistor (P00PU).
2. Enable pull-up resistor 150kΩ by AN0RS[1:0] bits of ADWRCR0 register set to ‘01b’ for AN0.
3. Enable ADC wake-up interrupt by AN0WEN bit of ADWCRL register set to ‘1’ for AN0.
4. Enter the power-down(idle or stop) mode.
5. If it occurs the falling edge(VIL) of key input through AN0, an ADC wake-up interrupt will be requested and
released from power-down mode.
6. At this time, ADC wake-up interrupt flag for AN0, AN0WIFR bit of ADWIFRL register becomes ‘1’. The flag is
cleared only by writing a ‘0’ to the bit. So, the flag should be cleared by software.
129
ABOV Semiconductor Co., Ltd. MC96F8208S
The resistor Rs needs to use the “ADC power-down wake-up function". The resistor prevents the ADC input pi
n from floating when the CPU goes into power-down mode. If Rs >> R1, the equivalent resistor of Rs//R1 dep
ends on the resistor R1. So, the resistor Rs had better use highly greater value than the R1 resistor.
VDD
Pxx
Rs
R1
ANn
R2
R3
Rm
Figure 11.37 Application circuit for ADC Key Input by resistor string
NOTE)
1. The Rs about 1MΩ recommended.
2. Pxx is normal I/O pin.
3. Where n = 0, 1, 2, 3, 8, 9, 10, 11, 12, and 13.
130
MC96F8208S ABOV Semiconductor Co., Ltd.
The ADC register consists of A/D converter data high register (ADCDRH), A/D converter data low register (ADCDRL),
A/D converter control high register (ADCCRH), A/D converter control low register (ADCCRL), ADC wake-up resistor
control register 0 (ADWRCR0), ADC wake-up resistor control register 1 (ADWRCR1), ADC wake-up resistor control
register 2 (ADWRCR2), ADC wake-up resistor control register 3 (ADWRCR3), ADC wake-up control high register
(ADWCRH), ADC wake-up control low register (ADWCRL), ADC wake-up interrupt flag high register (ADWIFRH), and
ADC wake-up interrupt flag low register (ADWIFRL).
131
ABOV Semiconductor Co., Ltd. MC96F8208S
132
MC96F8208S ABOV Semiconductor Co., Ltd.
133
ABOV Semiconductor Co., Ltd. MC96F8208S
134
MC96F8208S ABOV Semiconductor Co., Ltd.
135
ABOV Semiconductor Co., Ltd. MC96F8208S
136
MC96F8208S ABOV Semiconductor Co., Ltd.
137
ABOV Semiconductor Co., Ltd. MC96F8208S
11.10 SPI
11.10.1 Overview
There is serial peripheral interface (SPI) one channel in MC96F8208S. The SPI allows synchronous serial data
transfer between the external serial devices. It can do Full-duplex communication by 4-wire (MOSI, MISO, SCK),
support master/slave mode, can select serial clock (SCK) polarity, phase and whether LSB first data transfer or MSB
first data transfer.
SPIEN
P fx/2
r fx/4
e fx/8 M
s M Edge SPI WCOL
fx/16 U
fx c U Detector Control Circuit
X
a fx/32 X
l fx/64 To interrupt
e SPIIFR
fx/128 CPOL CPHA block
r
MS
Clear
3 INT_ACK
SPICR[2:0]
MS
SCK
SCK
Control
MISO M
8-bit Shift
U
Register
X
FXCH
8
MS FLSB
MOSI
D
SPIDR
E
(8-bit)
P
138
MC96F8208S ABOV Semiconductor Co., Ltd.
User can use SPI for serial data communication by following step
1. Select SPI operation mode(master/slave, polarity, phase) by control register SPICR.
2. When the user writes a byte to the data register SPIDR, SPI will start an operation.
3. In this time, if the SPI is configured as a Master, serial clock will come out of SCK pin. And Master shifts the
eight bits into the Slave (transmit), Slave shifts the eight bits into the Master at the same time (receive). If the
SPI is configured as a Slave, serial clock will come into SCK pin. And Slave shifts the eight bits into the Master
(transmit), Master shifts the eight bits into the Slave at the same time (receive).
4. When transmit/receive is done, SPIIFR bit will be set. If the SPI interrupt is enabled, an interrupt is requested.
And SPIIFR bit is cleared by hardware when executing the corresponding interrupt. If SPI interrupt is disable,
SPIIFR bit is cleared when user read the status register SPISR, and then access (read/write) the data register
SPIDR.
139
ABOV Semiconductor Co., Ltd. MC96F8208S
SCK
(CPOL = 0)
SCK
(CPOL = 1)
MISO/MOSI
D0 D1 D2 D3 D4 D5 D6 D7
(Output)
MOSI/MISO
D0 D1 D2 D3 D4 D5 D6 D7
(Input)
SPIIFR
SCK
(CPOL = 0)
SCK
(CPOL = 1)
MISO/MOSI
D0 D1 D2 D3 D4 D5 D6 D7
(Output)
MOSI/MISO
D0 D1 D2 D3 D4 D5 D6 D7
(Input)
SPIIFR
140
MC96F8208S ABOV Semiconductor Co., Ltd.
The SPI register consists of SPI control register (SPICR), SPI status register (SPISR) and SPI data register (SPIDR)
141
ABOV Semiconductor Co., Ltd. MC96F8208S
142
MC96F8208S ABOV Semiconductor Co., Ltd.
11.11 UART
11.11.1 Overview
The universal asynchronous serial receiver and transmitter (UART) is a highly flexible serial communication device.
The main features are listed below.
UART has baud rate generator, transmitter and receiver. The baud rate generator for asynchronous operation. The
Transmitter consists of a single write buffer, a serial shift register, parity generator and control logic for handling
different serial frame formats. The write buffer allows continuous transfer of data without any delay between frames.
The receiver is the most complex part of the UART module due to its clock and data recovery units. The recovery unit
is used for asynchronous data reception. In addition to the recovery unit, the receiver includes a parity checker, a shift
register, a two-level receive FIFO (UARTDR) and control logic. The receiver supports the same frame formats as the
transmitter and can detect frame error, data overrun and parity errors.
143
ABOV Semiconductor Co., Ltd. MC96F8208S
To interrupt
block
UARTBD
WAKEIE RXCIE
B
DOR/PE/FE UARTDR[0] U
Checker (Rx) S
UARTDR[1] L
Stop bit (Rx) I
Generator UPM0 N
E
M Parity
Tx Generator
TXD U
Control Transmit Shift Register
X
(TXSR)
TXCIE UDRIE
To interrupt
block
144
MC96F8208S ABOV Semiconductor Co., Ltd.
UARTBD
U2X
fSCLK
Baud Rate (UARTBD+1)
SCLK /8 /2 M
Generator
U txclk
X
rxclk
The clock generation logic generates the base clock for the transmitter and receiver.
Following table shows equations for calculating the baud rate (in bps).
Normal Mode(U2X=0)
145
ABOV Semiconductor Co., Ltd. MC96F8208S
A serial frame is defined to be one character of data bits with synchronization bits (start and stop bits), and optionally a
parity bit for error detection.
The UART supports all 30 combinations of the following as valid frame formats.
− 1 start bit
− 5, 6, 7, 8 or 9 data bits
− no, even or odd parity bit
− 1 or 2 stop bits
A frame starts with the start bit followed by the least significant data bit (LSB). Then the next data bits, up to nine, are
succeeding, ending with the most significant bit (MSB). If parity function is enabled, the parity bit is inserted between
the last data bit and the stop bit. A high-to-low transition on data pin is considered as start bit. When a complete frame
is transmitted, it can be directly followed by a new frame, or the communication line can be set to an idle state. The idle
means high state of data pin. The following figure shows the possible combinations of the frame formats. Bits inside
brackets are optional.
1 data frame
Character
bits
The frame format used by the UART is set by the USIZE[2:0], UPM[1:0] and USBS bits in UARTCR1 and UARTCR3
register. The Transmitter and Receiver use the same setting.
The parity bit is calculated by doing an exclusive-OR of all the data bits. If odd parity is used, the result of the
exclusive-or is inverted. The parity bit is located between the MSB and first stop bit of a serial frame.
Peven = Dn-1 ^ … ^ D3 ^ D2 ^ D1 ^ D0 ^ 0
Podd = Dn-1 ^ … ^ D3 ^ D2 ^ D1 ^ D0 ^ 1
Peven : Parity bit using even parity
Podd : Parity bit using odd parity
Dn : Data bit n of the character
146
MC96F8208S ABOV Semiconductor Co., Ltd.
The UART transmitter is enabled by setting the TXE bit in UARTCR2 register. When the Transmitter is enabled, the
TXD pin should be set to TXD function for the serial output pin of UART by the P3FSR[1:0]. The baud-rate, operation
mode and frame format must be setup once before doing any transmission.
A data transmission is initiated by loading the transmit buffer (UARTDR register I/O location) with the data to be
transmitted. The data written in transmit buffer is moved to the shift register when the shift register is ready to send a
new frame. The shift register is loaded with the new data if it is in idle state or immediately after the last stop bit of the
previous frame is transmitted. When the shift register is loaded with new data, it will transfer one complete frame
according to the settings of control registers. If the 9-bit characters are used, the ninth bit must be written to the TX8 bit
in UARTCR3 register before it is loaded to the transmit buffer (UARTDR register).
The UART transmitter has 2 flags which indicate its state. One is UART data register empty flag (UDRE) and the other
is transmit complete flag (TXC). Both flags can be interrupt sources.
UDRE flag indicates whether the transmit buffer is ready to receive new data. This bit is set when the transmit buffer is
empty and cleared when the transmit buffer contains data to be transmitted but has not yet been moved into the shift
register. And also this flag can be cleared by writing ‘0’ to this bit position. Writing ‘1’ to this bit position is prevented.
When the data register empty interrupt enable (UDRIE) bit in UARTCR2 register is set and the global interrupt is
enabled, UART data register empty interrupt is generated while UDRE flag is set.
The transmit complete (TXC) flag bit is set when the entire frame in the transmit shift register has been shifted out and
there is no more data in the transmit buffer. The TXC flag is automatically cleared when the transmit complete interrupt
service routine is executed, or it can be cleared by writing ‘0’ to TXC bit in UARTST register.
When the transmit complete interrupt enable (TXCIE) bit in UARTCR2 register is set and the global interrupt is
enabled, UART transmit complete interrupt is generated while TXC flag is set.
The parity generator calculates the parity bit for the serial frame data to be sent. When parity bit is enabled (UPM[1]=1),
the transmitter control logic inserts the parity bit between the MSB and the first stop bit of the frame to be sent.
Disabling the transmitter by clearing the TXE bit will not become effective until ongoing transmission is completed.
When the Transmitter is disabled, the TXD pin can be used as a normal general purpose I/O (GPIO).
147
ABOV Semiconductor Co., Ltd. MC96F8208S
The UART receiver is enabled by setting the RXE bit in the UARTCR2 register. When the receiver is enabled, the
RXD pin should be set to the input port for the serial input pin of UART by P31IO bit. The baud-rate, mode of operation
and frame format must be set before serial reception.
The receiver starts data reception when it detects a valid start bit (LOW) on RXD pin. Each bit after start bit is sampled
at pre-defined baud-rate (asynchronous) and shifted into the receive shift register until the first stop bit of a frame is
nd nd
received. Even if there’s 2 stop bit in the frame, the 2 stop bit is ignored by the receiver. That is, receiving the first
stop bit means that a complete serial frame is present in the receiver shift register and contents of the shift register are
to be moved into the receive buffer. The receive buffer is read by reading the UARTDR register.
If 9-bit characters are used (USIZE[2:0] = “111”), the ninth bit is stored in the RX8 bit position in the UARTCR3 register.
th
The 9 bit must be read from the RX8 bit before reading the low 8 bits from the UARTDR register. Likewise, the error
flags FE, DOR, PE must be read before reading the data from UARTDR register. It’s because the error flags are
stored in the same FIFO position of the receive buffer.
The UART receiver has one flag that indicates the receiver state.
The receive complete (RXC) flag indicates whether there are unread data in the receive buffer. This flag is set when
there are unread data in the receive buffer and cleared when the receive buffer is empty. If the receiver is disabled
(RXE=0), the receiver buffer is flushed and the RXC flag is cleared.
When the receive complete interrupt enable (RXCIE) bit in the UARTCR2 register is set and global interrupt is enabled,
the UART receiver complete interrupt is generated while RXC flag is set.
The UART receiver has three error flags which are frame error (FE), data overrun (DOR) and parity error (PE). These
error flags can be read from the UARTST register. As received data are stored in the 2-level receive buffer, these error
flags are also stored in the same position of receive buffer. So, before reading received data from UARTDR register,
read the UARTST register first which contains error flags.
The frame error (FE) flag indicates the state of the first stop bit. The FE flag is ‘0’ when the stop bit was correctly
detected as ‘1’, and the FE flag is ‘1’ when the stop bit was incorrect, i.e. detected as ‘0’. This flag can be used for
detecting out-of-sync conditions between data frames.
The data overrun (DOR) flag indicates data loss due to a receive buffer full condition. DOR occurs when the receive
buffer is full, and another new data is present in the receive shift register which are to be stored into the receive buffer.
After the DOR flag is set, all the incoming data are lost. To prevent data loss or clear this flag, read the receive buffer.
The parity error (PE) flag indicates that the frame in the receive buffer had a parity error when received. If parity check
function is not enabled (UPM[1]=0), the PE bit is always read ‘0’.
148
MC96F8208S ABOV Semiconductor Co., Ltd.
If parity bit is enabled (UPM[1]=1), the Parity Checker calculates the parity of the data bits in incoming frame and
compares the result with the parity bit from the received serial frame.
In contrast to transmitter, disabling the Receiver by clearing RXE bit makes the Receiver inactive immediately. When
the receiver is disabled, the receiver flushes the receive buffer, the remaining data in the buffer is all reset, and the
RXD pin can be used as a normal general purpose I/O (GPIO).
To receive asynchronous data frame, the UART includes a clock and data recovery unit. The clock recovery logic is
used for synchronizing the internally generated baud-rate clock to the incoming asynchronous serial frame on the RXD
pin.
The data recovery logic samples and low pass filters the incoming bits, and this removes the noise of RXD pin.
The next figure illustrates the sampling process of the start bit of an incoming frame. The sampling rate is 16 times the
baud-rate for normal mode(U2X=0) and 8 times the baud-rate for double speed mode (U2X=1). The horizontal arrows
show the synchronization variation due to the asynchronous sampling process. Note that larger time variation is
shown when using the double speed mode.
RXD START
IDLE BIT0
Sample
(U2X = 0)
0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3
Sample
(U2X = 1)
0 1 2 3 4 5 6 7 8 1 2
149
ABOV Semiconductor Co., Ltd. MC96F8208S
When the receiver is enabled (RXE=1), the clock recovery logic tries to find a high-to-low transition on the RXD line,
the start bit condition. After detecting high to low transition on RXD line, the clock recovery logic uses samples 8, 9,
and 10 for normal mode, and samples 4, 5, and 6 for double speed mode to decide if a valid start bit is received. If
more than 2 samples have logical low level, it is considered that a valid start bit is detected and the internally
generated clock is synchronized to the incoming data frame. And the data recovery can begin. The synchronization
process is repeated for each start bit.
As described above, when the receiver clock is synchronized to the start bit, the data recovery can begin. Data
recovery process is almost similar to the clock recovery process. The data recovery logic samples 16 times for each
incoming bits for normal mode and 8 times for double speed mode. And uses sample 8, 9, and 10 to decide data value
for normal mode, and samples 4, 5, and 6 for double speed mode. If more than 2 samples have low levels, the
received bit is considered to a logic ‘0’ and if more than 2 samples have high levels, the received bit is considered to a
logic ‘1’. The data recovery process is then repeated until a complete frame is received including the first stop bit. The
decided bit value is stored in the receive shift register in order. Note that the Receiver only uses the first stop bit of a
frame. Internally, after receiving the first stop bit, the Receiver is in idle state and waiting to find start bit.
RXD BIT n
Sample
(U2X = 0)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1
Sample
(U2X = 1)
1 2 3 4 5 6 7 8 1
The process for detecting stop bit is like clock and data recovery process. That is, if 2 or more samples of 3 center
values have high level, correct stop bit is detected, else a frame error (FE) flag is set. After deciding whether the first
stop bit is valid or not, the Receiver goes to idle state and monitors the RXD line to check a valid high to low transition
is detected (start bit detection).
Sample
(U2X = 0)
1 2 3 4 5 6 7 8 9 10 11 12 13
Sample
(U2X = 1)
1 2 3 4 5 6 7
Figure 11.46 Stop Bit Sampling and Next Start Bit Sampling
150
MC96F8208S ABOV Semiconductor Co., Ltd.
UART module consists of UART baud rate generation register (UARTBD), UART data register (UARTDR), UART
control register 1 (UARTCR1), UART control register 2 (UARTCR2) ,UART control register 3 (UARTCR3), and
UART status register (UARTST).
151
ABOV Semiconductor Co., Ltd. MC96F8208S
152
MC96F8208S ABOV Semiconductor Co., Ltd.
153
ABOV Semiconductor Co., Ltd. MC96F8208S
154
MC96F8208S ABOV Semiconductor Co., Ltd.
155
ABOV Semiconductor Co., Ltd. MC96F8208S
Table 11.17 Examples of USI0BD and USI1BDSettings for Commonly Used Oscillator Frequencies
11.12 I2C
11.12.1 Overview
The I2C is one of industrial standard serial communication protocols, and which uses 2 bus lines Serial Data Line
(SDA) and Serial Clock Line (SCL) to exchange data. Because both SDA and SCL lines are open-drain output, each
line needs pull-up resistor. The features are as shown below.
157
ABOV Semiconductor Co., Ltd. MC96F8208S
Clear
INT_ACK IICIFR To interrupt
block Slave Address Register
I2CSAR
RXACK, GCALL, Interrupt
IICIE
TEND, STOPD, Generator
SSEL, MLOST, General Call And
BUSY, TMODE IICGCE
Address Detector
I
N
Receive Shift Register T
SDA I2CDR, (Rx) E
(RXSR)
R
N
SDA In/Out ACK Signal
N-ch A
Controller Generator ACKEN L
VSS STOP/START STOPC
B
Condition Generator STARTC U
S
Transmit Shift Register
I2CDR, (Tx) L
(TXSR)
I
SDA Hold Time Register N
I2CSDHR E
Time Generator
SCL Out SCL High Period Register
SCL And
Controller I2CSCHR
Time Controller
SCL Low Period Register
N-ch I2CSCLR
SCLK
VSS (fx: System clock)
NOTE)
1. When the corresponding port is an sub-function for SCL/SDA pin, the SCL/SDA pins are not
automatically set to the N-channel open-drain outputs and the input latch is read in the case of
reading the pins. The corresponding pull-up resistor is determined by the control register.
2. For SCL/SDA function of I2C, corresponding ports should be set to N-channel open-drain outputs.
3. If P31, P30, P25 and P24 are used as SCL/SDA for I2C, P3OD[1:0] and P2OD[5:4] should be set “1”
The data on the SDA line must be stable during HIGH period of the clock, SCL. The HIGH or LOW state of the data
line can only change when the clock signal on the SCL line is LOW. The exceptions are START(S), repeated
START(Sr) and STOP(P) condition where data line changes when clock line is high.
SDA
SCL
158
MC96F8208S ABOV Semiconductor Co., Ltd.
One master can issue a START (S) condition to notice other devices connected to the SCL, SDA lines that it will use
the bus. A STOP (P) condition is generated by the master to release the bus lines so that other devices can use it.
A high to low transition on the SDA line while SCL is high defines a START (S) condition.
A low to high transition on the SDA line while SCL is high defines a STOP (P) condition.
START and STOP conditions are always generated by the master. The bus is considered to be busy after START
condition. The bus is considered to be free again after STOP condition, ie, the bus is busy between START and STOP
condition. If a repeated START condition (Sr) is generated instead of STOP condition, the bus stays busy. So, the
START and repeated START conditions are functionally identical.
SDA
SCL
S P
Every byte put on the SDA line must be 8-bits long. The number of bytes that can be transmitted per transfer is
unlimited. Each byte has to be followed by an acknowledge bit. Data is transferred with the most significant bit (MSB)
first. If a slave can’t receive or transmit another complete byte of data until it has performed some other function, it can
hold the clock line SCL LOW to force the master into a wait state. Data transfer then continues when the slave is ready
for another byte of data and releases clock line SCL.
P
SDA
MSB Acknowledgement Acknowledgement Sr
Signal form Slave Signal form Slave
Byte Complete, Clock line held low while
Interrupt within Device interrupts are served.
SCL 1 9 1 9
S Sr
or ACK ACK or
Sr P
START or Repeated STOP or Repeated
START Condition START Condition
159
ABOV Semiconductor Co., Ltd. MC96F8208S
The acknowledge related clock pulse is generated by the master. The transmitter releases the SDA line (HIGH) during
the acknowledge clock pulse. The receiver must pull down the SDA line during the acknowledge clock pulse so that it
remains stable LOW during the HIGH period of this clock pulse. When a slave is addressed by a master (Address
Packet), and if it is unable to receive or transmit because it’s performing some real time function, the data line must be
left HIGH by the slave. And also, when a slave addressed by a master is unable to receive more data bits, the slave
receiver must release the SDA line (Data Packet). The master can then generate either a STOP condition to abort the
transfer, or a repeated START condition to start a new transfer.
If a master receiver is involved in a transfer, it must signal the end of data to the slave transmitter by not generating an
acknowledge on the last byte that was clocked out of the slave. The slave transmitter must release the data line to
allow the master to generate a STOP or repeated START condition.
Data Output
By Transmitter
NACK
Data Output
By Receiver
ACK
160
MC96F8208S ABOV Semiconductor Co., Ltd.
Clock synchronization is performed using the wired-AND connection of I2C interfaces to the SCL line. This means that
a HIGH to LOW transition on the SCL line will cause the devices concerned to start counting off their LOW period and
it will hold the SCL line in that state until the clock HIGH state is reached. However the LOW to HIGH transition of this
clock may not change the state of the SCL line if another clock is still within its LOW period. In this way, a
synchronized SCL clock is generated with its LOW period determined by the device with the longest clock LOW period,
and its HIGH period determined by the one with the shortest clock HIGH period.
A master may start a transfer only if the bus is free. Two or more masters may generate a START condition.
Arbitration takes place on the SDA line, while the SCL line is at the HIGH level, in such a way that the master which
transmits a HIGH level, while another master is transmitting a LOW level will switch off its DATA output state because
the level on the bus doesn’t correspond to its own level. Arbitration continues for many bits until a winning master gets
the ownership of I2C bus. Its first stage is comparison of the address bits.
High Counter
Reset
Slow Device
SCLOUT
SCL
Device1
DataOut
Device2
DataOut
SDA on BUS
SCL on BUS
161
ABOV Semiconductor Co., Ltd. MC96F8208S
11.12.8 Operation
The I2C is byte-oriented and interrupt based. Interrupts are issued after all bus events except for a transmission of a
START condition. Because the I2C is interrupt based, the application software is free to carry on other operations
during a I2C byte transfer.
Note that when a I2C interrupt is generated, IICIFR flag in IIFLAG register is set, it is cleared by writing an any value to
I2CSR. When I2C interrupt occurs, the SCL line is hold LOW until writing any value to I2CSR. When the IICIFR flag is
set, the I2CSR contains a value indicating the current state of the I2C bus. According to the value in I2CSR, software
can decide what to do next.
I2C can operate in 4 modes by configuring master/slave, transmitter/receiver. The operating mode is configured by a
winning master. A more detailed explanation follows below.
I2C (Master) can choose one of the following cases regardless of the reception of ACK signal from slave.
1) Master receives ACK signal from slave, so continues data transfer because slave can receive more data
from master. In this case, load data to transmit to I2CDR.
2) Master stops data transfer even if it receives ACK signal from slave. In this case, set the STOPC bit in
I2CCR.
162
MC96F8208S ABOV Semiconductor Co., Ltd.
3) Master transmits repeated START condition with not checking ACK signal. In this case, load SLA+R/W
into the I2CDR and set STARTC bit in I2CCR.
After doing one of the actions above, write any arbitrary to I2CSR to release SCL line. In case of 1), move to
step 7. In case of 2), move to step 9 to handle STOP interrupt. In case of 3), move to step 6 after transmitting
the data in I2CDR and if transfer direction bit is ‘1’ go to master receiver section.
7. 1-Byte of data is being transmitted. During data transfer, bus arbitration continues.
8. This is ACK signal processing stage for data packet transmitted by master. I2C holds the SCL LOW. When
I2C loses bus mastership while transmitting data arbitrating other masters, the MLOST bit in I2CSR is set. If
then, I2C waits in idle state. When the data in I2CDR is transmitted completely, I2C generates TEND
interrupt.
I2C can choose one of the following cases regardless of the reception of ACK signal from slave.
1) Master receives ACK signal from slave, so continues data transfer because slave can receive more data
from master. In this case, load data to transmit to I2CDR.
2) Master stops data transfer even if it receives ACK signal from slave. In this case, set the STOPC bit in
I2CCR.
3) Master transmits repeated START condition with not checking ACK signal. In this case, load SLA+R/W
into the I2CDR and set the STARTC bit in I2CCR.
After doing one of the actions above, write any arbitrary to I2CSR to release SCL line. In case of 1), move to
step 7. In case of 2), move to step 9 to handle STOP interrupt. In case of 3), move to step 6 after transmitting
the data in I2CDR, and if transfer direction bit is ‘1’ go to master receiver section.
9. This is the final step for master transmitter function of I2C, handling STOP interrupt. The STOP bit indicates
that data transfer between master and slave is over. To clear I2CSR, write any value to I2CSR. After this, I2C
enters idle state.
163
ABOV Semiconductor Co., Ltd. MC96F8208S
I2C (Master) can choose one of the following cases according to the reception of ACK signal from slave.
1) Master receives ACK signal from slave, so continues data transfer because slave can prepare and
transmit more data to master. Configure ACKEN bit in I2CCR to decide whether I2C Acknowledges the
next data to be received or not.
2) Master stops data transfer because it receives no ACK signal from slave. In this case, set the STOPC bit
in I2CCR.
3) Master transmits repeated START condition due to no ACK signal from slave. In this case, load SLA+R/W
into the I2CDR and set STARTC bit in I2CCR.
After doing one of the actions above, write arbitrary value to I2CSR to release SCL line. In case of 1), move
to step 7. In case of 2), move to step 9 to handle STOP interrupt. In case of 3), move to step 6 after
transmitting the data in I2CDR and if transfer direction bit is ‘0’ go to master transmitter section.
164
MC96F8208S ABOV Semiconductor Co., Ltd.
I2C0 can choose one of the following cases according to the RXACK flag in I2CSR.
1) Master continues receiving data from slave. To do this, set ACKEN bit in I2CCR to Acknowledge the next
data to be received.
2) Master wants to terminate data transfer when it receives next data by not generating ACK signal. This can
be done by clearing ACKEN bit in I2CCR.
3) Because no ACK signal is detected, master terminates data transfer. In this case, set the STOPC bit in
I2CCR.
4) No ACK signal is detected, and master transmits repeated START condition. In this case, load SLA+R/W
into the I2CDR and set the STARTC bit in I2CCR.
After doing one of the actions above, write arbitrary value to I2CSR to release SCL line. In case of 1) and 2),
move to step 7. In case of 3), move to step 9 to handle STOP interrupt. In case of 4), move to step 6 after
transmitting the data in I2CDR, and if transfer direction bit is ‘0’ go to master transmitter section.
9. This is the final step for master receiver function of I2C, handling STOP interrupt. The STOP bit indicates that
data transfer between master and slave is over. To clear I2CSR, write any value to I2CSR. After this, I2C
enters idle state.
165
ABOV Semiconductor Co., Ltd. MC96F8208S
1) No ACK signal is detected and I2C waits STOP or repeated START condition.
2) ACK signal from master is detected. Load data to transmit into I2CDR.
After doing one of the actions above, write arbitrary value to I2CSR to release SCL line. In case of 1) move to
step 7 to terminate communication. In case of 2) move to step 5. In either case, a repeated START condition
can be detected. For that case, move step 4.
7. This is the final step for slave transmitter function of I2C, handling STOP interrupt. The STOPC bit indicates
that data transfer between master and slave is over. To clear I2CSR, write any value to I2CSR. After this,
I2C enters idle state.
166
MC96F8208S ABOV Semiconductor Co., Ltd.
1) No ACK signal is detected (ACKEN=0) and I2C waits STOP or repeated START condition.
2) ACK signal is detected (ACKEN=1) and I2C can continue to receive data from master.
After doing one of the actions above, write arbitrary value to I2CSR to release SCL line. In case of 1) move to
step 7 to terminate communication. In case of 2) move to step 5. In either case, a repeated START condition
can be detected. For that case, move step 4.
7. This is the final step for slave receiver function of I2C, handling STOP interrupt. The STOPC bit indicates that
data transfer between master and slave is over. To clear I2CSR, write any value to I2CSR. After this, I2C
enters idle state.
167
ABOV Semiconductor Co., Ltd. MC96F8208S
I2C module consists of I2C control register (I2CCR), I2C status register (I2CSR), I2C slave address 0/1 register
(I2CSAR0/I2CSAR1), I2C data register (I2CDR), I2C SDA hold time register (I2CSDHR), I2C SCL low period register
(I2CSCLR), and I2C SCL high period Register (I2CSCHR).
168
MC96F8208S ABOV Semiconductor Co., Ltd.
169
ABOV Semiconductor Co., Ltd. MC96F8208S
170
MC96F8208S ABOV Semiconductor Co., Ltd.
171
ABOV Semiconductor Co., Ltd. MC96F8208S
172
MC96F8208S ABOV Semiconductor Co., Ltd.
12.1 Overview
The MC96F8208S has two power-down modes to minimize the power consumption of the device. In power down
mode, power consumption is reduced considerably. The device provides three kinds of power saving functions, Main-
IDLE and STOP mode. In two modes, program is stopped.
173
ABOV Semiconductor Co., Ltd. MC96F8208S
OSC
CPU Clock
External
Interrupt
Release
174
MC96F8208S ABOV Semiconductor Co., Ltd.
OSC
CPU Clock
Release
External
Interrupt
STOP Instruction
Execute
By Software
setting
Normal Operation STOP Operation Normal Operation
175
ABOV Semiconductor Co., Ltd. MC96F8208S
SET PCON[7:0]
SET IEx.b
STOP Mode
Interrupt Request
Corresponding Interrupt N
Enable Bit(IE, IE1, IE2, IE3) IEx.b==1 ?
STOP Mode
Release
Interrupt Service
Routine
Next Instruction
176
MC96F8208S ABOV Semiconductor Co., Ltd.
NOTE)
1. To enter IDLE mode, PCON must be set to ‘01H’.
2. To enter STOP mode, PCON must be set to ‘03H’.
3. The PCON register is automatically cleared by a release signal in STOP/IDLE mode.
4. Three or more NOP instructions must immediately follow the instruction that make the device enter
STOP/IDLE mode. Refer to the following examples.
Ex1) MOV PCON, #01H ; IDLE mode Ex2) MOV PCON, #03H ; STOP mode
NOP NOP
NOP NOP
NOP NOP
• •
• •
• •
177
ABOV Semiconductor Co., Ltd. MC96F8208S
13 RESET
13.1 Overview
The following is the hardware setting value.
R
WDT RST
WDT RSTEN
IFBIT
(BIT Overflow)
178
MC96F8208S ABOV Semiconductor Co., Ltd.
A
t > TRNC t > TRNC t > TRNC
A’
VDD
nPOR
(Internal Signal) BIT Overflows
BIT Starts
Internal RESETB
Oscillation
nPOR
(Internal Signal) BIT Overflows
BIT Starts
Internal RESETB
Oscillation
179
ABOV Semiconductor Co., Ltd. MC96F8208S
VDD
Internal nPOR
PAD RESETB
“H”
LVR_RESETB
INT-OSC (16MHz)
INT-OSC 16MHz/16
:VDD Input
:Internal OSC
⑥
④
Reset Release
Configure
Read
POR
① ③ ⑤ ⑦
180
MC96F8208S ABOV Semiconductor Co., Ltd.
181
ABOV Semiconductor Co., Ltd. MC96F8208S
1 2 3 4 5
OSC
RESETB
Release
Internal
Release
RESETB
ADDRESS
? ? 00 01 02 ?
BUS
CORE
? ? ? 02 ? ? ?
BUS
NOTE)
1. As shown Figure 13.8, the stable generating time is not included in the start-up time.
2. The RESETB pin has a Pull-up register by hardware
182
MC96F8208S ABOV Semiconductor Co., Ltd.
External VDD
Brown Out
LVRVS[3:0] Detector
RESET_BODB
(BOD)
LVREN
CPU LVRF
D Q
Write (Low Voltage
Reset Flag)
CP
SCLK
r
(System CLK)
nPOR
VDD VBODMAX
VBODMIN
Internal 16ms
RESETB
VDD VBODMAX
VBODMIN
t < 16ms 16ms
Internal
RESETB
183
ABOV Semiconductor Co., Ltd. MC96F8208S
“H”
VDD
“H”
Internal nPOR
“H”
PAD RESETB
LVR_RESETB
INT-OSC 16MHz/16
184
MC96F8208S ABOV Semiconductor Co., Ltd.
2.00V
2.10V
2.20V
2.32V
2.44V
2.59V M
Reference U
2.75V LVI Circuit LVIF
VDD Voltage X
2.93V
Generator
3.14V
3.38V
3.67V
4.00V LVIEN
4.40V
LVILS[3:0]
185
ABOV Semiconductor Co., Ltd. MC96F8208S
186
MC96F8208S ABOV Semiconductor Co., Ltd.
187
ABOV Semiconductor Co., Ltd. MC96F8208S
188
MC96F8208S ABOV Semiconductor Co., Ltd.
14.1 Overview
14.1.1 Description
MC96F8208S can not use On-chip debug(OCD). MC96F8208S isn’t equipped with on-chip debugger. We
recommend to develop and debug program with MC96F8316. On-chip debug system (OCD) of MC96F8316 can be
used for programming the non-volatile memories and on-chip debugging. Detail descriptions for programming via the
OCD interface can be found in the following chapter.
Figure 14.1 shows a block diagram of the OCD interface and the On-chip Debug system.
189
ABOV Semiconductor Co., Ltd. MC96F8208S
14.1.2 Feature
− Two-wire external interface: 1-wire serial clock input, 1-wire bi-directional serial data bus
− Debugger Access to:
• All Internal Peripheral Units
• Internal data RAM
• Program Counter
• Flash and Data EEPROM Memories
− Extensive On-chip Debug Support for Break Conditions, Including
• Break Instruction
• Single Step Break
• Program Memory Break Points on Single Address
• Programming of Flash, EEPROM, Fuses, and Lock Bits through the two-wire Interface
®
• On-chip Debugging Supported by Dr.Choice
− Operating frequency
• Supports the maximum frequency of the target MCU
DBG
DSCL BDC
USB Control
DSDA
CPU DBGRegister
Address bus
190
MC96F8208S ABOV Semiconductor Co., Ltd.
191
ABOV Semiconductor Co., Ltd. MC96F8208S
DSDA
DSCL
St 1 10 1 10 Sp
ACK ACK
START STOP
DSDA
DSCL
data line
stable: change
data valid of data
except Start and Stop allowed
192
MC96F8208S ABOV Semiconductor Co., Ltd.
DSDA
DSDA
DSCL DSCL
St Sp
Dataoutput
Bytransmitter
no acknowledge
Dataoutput
Byreceiver
acknowledge
DSCL from
master 1 2 9 10
Host PC
DSCL OUT
Start wait
Target Device
DSCL OUT
minimum 1 TSCLK
Maximum 5 TSCLK for next byte
transmission
DSCL
Internal Operation
193
ABOV Semiconductor Co., Ltd. MC96F8208S
VDD
pull - up Rp Rp
resistors
DSDA(Debugger Serial Data Line)
VDD VDD
194
MC96F8208S ABOV Semiconductor Co., Ltd.
15 Flash Memory
15.1 Overview
15.1.1 Description
MC96F8208S incorporates flash memory to which a program can be written, erased, and overwritten while mounted
on the board. The flash memory can be read by ‘MOVC’ instruction and it can be programmed in OCD, serial ISP
mode or user program mode.
195
ABOV Semiconductor Co., Ltd. MC96F8208S
01FFFH
Sector 255
01FE0H 01FE0H
01FDFH
Sector 254
01FC0H 01FC0H
01FBFH
Sector 253
01FA0H 01FA0H
01F9FH
Sector 252
Flash
ROM
Sector
Address
Address
Sector 2
00040H 00040H
0003FH
Sector 1
00020H 00020H
0001FH
Sector 0
00000H 00000H
32bytes
Accessed by 801FH Page(Sector)
Flash Page Buffer
MOVX instruction Buffer
(External Data Memory, 32bytes)
only 8000H Address
FSADRH/M/L
Flash Controller FIDR
FMCR
196
MC96F8208S ABOV Semiconductor Co., Ltd.
Flash control register consists of the flash sector address high register (FSADRH), flash sector address middle register
(FSADRM), flash sector address low register (FSADRL), flash identification register (FIDR), and flash mode control
register (FMCR). They are mapped to SFR area and can be accessed only in programming mode.
197
ABOV Semiconductor Co., Ltd. MC96F8208S
198
MC96F8208S ABOV Semiconductor Co., Ltd.
199
ABOV Semiconductor Co., Ltd. MC96F8208S
Serial in-system program uses the interface of debugger which uses two wires. Refer to chapter 14 in details about
debugger
MC96F8208S can program its own flash memory (protection area). The protection area can not be erased or
programmed. The protection areas are available only when the PAEN bit is cleared to ‘0’, that is, enable protection
area at the configure option 2 if it is needed. If the protection area isn’t enabled (PAEN =’1’), this area can be used as a
normal program memory.
The size of protection area can be varied by setting of configure option 2.
NOTE)
1. Refer to chapter 16 in configure option control.
200
MC96F8208S ABOV Semiconductor Co., Ltd.
MOV A,#0
MOV R0,#32 ;Sector size is 32bytes
MOV DPH,#0x80
MOV DPL,#0
MOV FSADRH,#0x00
MOV FSADRM,#0x3F
MOV FSADRL,#0xA0 ;Select sector 509
MOV FIDR,#0xA5 ;Identification value
MOV FMCR,#0x02 ;Start flash erase mode
NOP ;Dummy instruction, This instruction must be needed.
NOP ;Dummy instruction, This instruction must be needed.
NOP ;Dummy instruction, This instruction must be needed.
Erase_verify:
MOVC A,@A+DPTR
SUBB A,R1
JNZ Verify error
INC DPTR
DJNZ R0,Erase_verify
Verify_error:
201
ABOV Semiconductor Co., Ltd. MC96F8208S
MOV A,#0
MOV R0,#32 ;Sector size is 32bytes
MOV DPH,#0x80
MOV DPL,#0
MOV FSADRH,#0x00
MOV FSADRM,#0x3F
MOV FSADRL,#0xA0 ;Select sector 509
MOV FIDR,#0xA5 ;Identification value
MOV FMCR,#0x03 ;Start flash write mode
NOP ;Dummy instruction, This instruction must be needed.
NOP ;Dummy instruction, This instruction must be needed.
NOP ;Dummy instruction, This instruction must be needed.
Write_verify:
MOVC A,@A+DPTR
SUBB A,R1
JNZ Verify_error
INC R1
INC DPTR
DJNZ R0,Write_verify
Verify_error:
202
MC96F8208S ABOV Semiconductor Co., Ltd.
MOV A,#5
MOV DPH,#0x80
MOV DPL,#0
MOVX @DPTR,A ;Write data to page buffer
MOV A,#6
MOV DPH,#0x80
MOV DPL,#0x05
MOVX @DPTR,A ;Write data to page buffer
MOV FSADRH,#0x00
MOV FSADRM,#0x3F
MOV FSADRL,#0xA0 ;Select sector 509
MOV FIDR,#0xA5 ;Identification value
MOV FMCR,#0x03 ;Start flash write mode
NOP ;Dummy instruction, This instruction must be needed.
NOP ;Dummy instruction, This instruction must be needed.
NOP ;Dummy instruction, This instruction must be needed.
MOV A,#0
MOV R1,#6
MOV DPH,#0x3F
MOV DPL,#0xA5
MOVC A,@A+DPTR
SUBB A,R1 ;0x3FA5 = 6 ?
JNZ Verify_error
Verify_error:
203
ABOV Semiconductor Co., Ltd. MC96F8208S
MOV A,#0
MOV DPH,#0x3F
MOV DPL,#0xA0 ;flash memory address
204
MC96F8208S ABOV Semiconductor Co., Ltd.
16 Configure Option
205
ABOV Semiconductor Co., Ltd. MC96F8208S
17 APPENDIX
ARITHMETIC
Mnemonic Description Bytes Cycles Hex code
ADD A,Rn Add register to A 1 1 28-2F
ADD A,dir Add direct byte to A 2 1 25
ADD A,@Ri Add indirect memory to A 1 1 26-27
ADD A,#data Add immediate to A 2 1 24
ADDC A,Rn Add register to A with carry 1 1 38-3F
ADDC A,dir Add direct byte to A with carry 2 1 35
ADDC A,@Ri Add indirect memory to A with carry 1 1 36-37
ADDC A,#data Add immediate to A with carry 2 1 34
SUBB A,Rn Subtract register from A with borrow 1 1 98-9F
SUBB A,dir Subtract direct byte from A with borrow 2 1 95
SUBB A,@Ri Subtract indirect memory from A with borrow 1 1 96-97
SUBB A,#data Subtract immediate from A with borrow 2 1 94
INC A Increment A 1 1 04
INC Rn Increment register 1 1 08-0F
INC dir Increment direct byte 2 1 05
INC @Ri Increment indirect memory 1 1 06-07
DEC A Decrement A 1 1 14
DEC Rn Decrement register 1 1 18-1F
DEC dir Decrement direct byte 2 1 15
DEC @Ri Decrement indirect memory 1 1 16-17
INC DPTR Increment data pointer 1 2 A3
MUL AB Multiply A by B 1 4 A4
DIV AB Divide A by B 1 4 84
DA A Decimal Adjust A 1 1 D4
206
MC96F8208S ABOV Semiconductor Co., Ltd.
LOGICAL
Mnemonic Description Bytes Cycles Hex code
ANL A,Rn AND register to A 1 1 58-5F
ANL A,dir AND direct byte to A 2 1 55
ANL A,@Ri AND indirect memory to A 1 1 56-57
ANL A,#data AND immediate to A 2 1 54
ANL dir,A AND A to direct byte 2 1 52
ANL dir,#data AND immediate to direct byte 3 2 53
ORL A,Rn OR register to A 1 1 48-4F
ORL A,dir OR direct byte to A 2 1 45
ORL A,@Ri OR indirect memory to A 1 1 46-47
ORL A,#data OR immediate to A 2 1 44
ORL dir,A OR A to direct byte 2 1 42
ORL dir,#data OR immediate to direct byte 3 2 43
XRL A,Rn Exclusive-OR register to A 1 1 68-6F
XRL A,dir Exclusive-OR direct byte to A 2 1 65
XRL A, @Ri Exclusive-OR indirect memory to A 1 1 66-67
XRL A,#data Exclusive-OR immediate to A 2 1 64
XRL dir,A Exclusive-OR A to direct byte 2 1 62
XRL dir,#data Exclusive-OR immediate to direct byte 3 2 63
CLR A Clear A 1 1 E4
CPL A Complement A 1 1 F4
SWAP A Swap Nibbles of A 1 1 C4
RL A Rotate A left 1 1 23
RLC A Rotate A left through carry 1 1 33
RR A Rotate A right 1 1 03
RRC A Rotate A right through carry 1 1 13
207
ABOV Semiconductor Co., Ltd. MC96F8208S
DATA TRANSFER
Mnemonic Description Bytes Cycles Hex code
MOV A,Rn Move register to A 1 1 E8-EF
MOV A,dir Move direct byte to A 2 1 E5
MOV A,@Ri Move indirect memory to A 1 1 E6-E7
MOV A,#data Move immediate to A 2 1 74
MOV Rn,A Move A to register 1 1 F8-FF
MOV Rn,dir Move direct byte to register 2 2 A8-AF
MOV Rn,#data Move immediate to register 2 1 78-7F
MOV dir,A Move A to direct byte 2 1 F5
MOV dir,Rn Move register to direct byte 2 2 88-8F
MOV dir,dir Move direct byte to direct byte 3 2 85
MOV dir,@Ri Move indirect memory to direct byte 2 2 86-87
MOV dir,#data Move immediate to direct byte 3 2 75
MOV @Ri,A Move A to indirect memory 1 1 F6-F7
MOV @Ri,dir Move direct byte to indirect memory 2 2 A6-A7
MOV @Ri,#data Move immediate to indirect memory 2 1 76-77
MOV DPTR,#data Move immediate to data pointer 3 2 90
MOVC A,@A+DPTR Move code byte relative DPTR to A 1 2 93
MOVC A,@A+PC Move code byte relative PC to A 1 2 83
MOVX A,@Ri Move external data(A8) to A 1 2 E2-E3
MOVX A,@DPTR Move external data(A16) to A 1 2 E0
MOVX @Ri,A Move A to external data(A8) 1 2 F2-F3
MOVX @DPTR,A Move A to external data(A16) 1 2 F0
PUSH dir Push direct byte onto stack 2 2 C0
POP dir Pop direct byte from stack 2 2 D0
XCH A,Rn Exchange A and register 1 1 C8-CF
XCH A,dir Exchange A and direct byte 2 1 C5
XCH A,@Ri Exchange A and indirect memory 1 1 C6-C7
XCHD A,@Ri Exchange A and indirect memory nibble 1 1 D6-D7
BOOLEAN
Mnemonic Description Bytes Cycles Hex code
CLR C Clear carry 1 1 C3
CLR bit Clear direct bit 2 1 C2
SETB C Set carry 1 1 D3
SETB bit Set direct bit 2 1 D2
CPL C Complement carry 1 1 B3
CPL bit Complement direct bit 2 1 B2
ANL C,bit AND direct bit to carry 2 2 82
ANL C,/bit AND direct bit inverse to carry 2 2 B0
ORL C,bit OR direct bit to carry 2 2 72
ORL C,/bit OR direct bit inverse to carry 2 2 A0
MOV C,bit Move direct bit to carry 2 1 A2
MOV bit,C Move carry to direct bit 2 2 92
208
MC96F8208S ABOV Semiconductor Co., Ltd.
BRANCHING
Mnemonic Description Bytes Cycles Hex code
ACALL addr 11 Absolute jump to subroutine 2 2 11→F1
LCALL addr 16 Long jump to subroutine 3 2 12
RET Return from subroutine 1 2 22
RETI Return from interrupt 1 2 32
AJMP addr 11 Absolute jump unconditional 2 2 01→E1
LJMP addr 16 Long jump unconditional 3 2 02
SJMP rel Short jump (relative address) 2 2 80
JC rel Jump on carry = 1 2 2 40
JNC rel Jump on carry = 0 2 2 50
JB bit,rel Jump on direct bit = 1 3 2 20
JNB bit,rel Jump on direct bit = 0 3 2 30
JBC bit,rel Jump on direct bit = 1 and clear 3 2 10
JMP @A+DPTR Jump indirect relative DPTR 1 2 73
JZ rel Jump on accumulator = 0 2 2 60
JNZ rel Jump on accumulator ≠0 2 2 70
CJNE A,dir,rel Compare A,direct jne relative 3 2 B5
CJNE A,#d,rel Compare A,immediate jne relative 3 2 B4
CJNE Rn,#d,rel Compare register, immediate jne relative 3 2 B8-BF
CJNE @Ri,#d,rel Compare indirect, immediate jne relative 3 2 B6-B7
DJNZ Rn,rel Decrement register, jnz relative 3 2 D8-DF
DJNZ dir,rel Decrement direct byte, jnz relative 3 2 D5
MISCELLANEOUS
Mnemonic Description Bytes Cycles Hex code
NOP No operation 1 1 00
In the above table, an entry such as E8-EF indicates a continuous block of hex opcodes used for 8 different registers,
the register numbers of which are defined by the lowest three bits of the corresponding code. Non-continuous blocks
of codes, shown as 11→F1 (for example), are used for absolute jumps and calls, with the top 3 bits of the code being
used to store the top three bits of the destination address.
The CJNE instructions use the abbreviation #d for immediate data; other instructions use #data.
209
ABOV Semiconductor Co., Ltd. MC96F8208S
Table of contents
Revision history .............................................................................................................................................................. 2
1 Overview ................................................................................................................................................................... 3
1.1. Description .......................................................................................................................................................... 3
1.2 Features .............................................................................................................................................................. 4
1.3 Development tools .............................................................................................................................................. 5
1.3.1 Compiler ...................................................................................................................................................... 5
1.3.2 OCD(On-chip debugger) emulator and debugger ....................................................................................... 5
1.3.3 Programmer................................................................................................................................................. 8
1.4 MTP programming ............................................................................................................................................ 10
1.4.1 Overview .................................................................................................................................................... 10
1.4.2 On-Board programming ............................................................................................................................. 10
1.4.3 Circuit Design Guide.................................................................................................................................. 11
2 Block diagram ........................................................................................................................................................ 12
3 Pin assignment ...................................................................................................................................................... 13
4 Package Diagram ................................................................................................................................................... 15
5 Pin Description ....................................................................................................................................................... 19
6 Port Structures ....................................................................................................................................................... 21
6.1 General Purpose I/O Port ................................................................................................................................. 21
6.2 External Interrupt I/O Port ................................................................................................................................. 22
7 Electrical Characteristics ...................................................................................................................................... 23
7.1 Absolute Maximum Ratings .............................................................................................................................. 23
7.2 Recommended Operating Conditions .............................................................................................................. 23
7.3 A/D Converter Characteristics .......................................................................................................................... 24
7.4 Power-On Reset Characteristics ...................................................................................................................... 24
7.5 Low Voltage Reset and Low Voltage Indicator Characteristics ........................................................................ 25
7.6 High Internal RC Oscillator Characteristics ...................................................................................................... 26
7.7 Internal Watch-Dog Timer RC Oscillator Characteristics.................................................................................. 26
7.8 DC Characteristics ............................................................................................................................................ 27
7.9 AC Characteristics ............................................................................................................................................ 28
7.10 SPI Characteristics ........................................................................................................................................... 29
7.11 UART Characteristics ....................................................................................................................................... 30
7.12 I2C Characteristics ........................................................................................................................................... 31
7.13 Data Retention Voltage in Stop Mode .............................................................................................................. 32
7.14 Internal Flash Rom Characteristics .................................................................................................................. 33
7.15 Input/Output Capacitance ................................................................................................................................. 33
7.16 Main Clock Oscillator Characteristics ............................................................................................................... 34
7.17 Main Oscillation Stabilization Characteristics ................................................................................................... 35
7.18 Operating Voltage Range ................................................................................................................................. 36
7.19 Recommended Circuit and Layout ................................................................................................................... 37
7.20 Typical Characteristics ...................................................................................................................................... 38
8 Memory ................................................................................................................................................................... 40
8.1 Program Memory .............................................................................................................................................. 40
8.2 Data Memory .................................................................................................................................................... 42
8.3 External Data Memory ...................................................................................................................................... 44
8.4 SFR Map ........................................................................................................................................................... 45
8.4.1 SFR Map Summary ................................................................................................................................... 45
8.4.2 SFR Map ................................................................................................................................................... 46
8.4.3 SFR Map ................................................................................................................................................... 50
9 I/O Ports .................................................................................................................................................................. 52
9.1 I/O Ports ............................................................................................................................................................ 52
9.2 Port Register ..................................................................................................................................................... 52
210
MC96F8208S ABOV Semiconductor Co., Ltd.
211
ABOV Semiconductor Co., Ltd. MC96F8208S
212
MC96F8208S ABOV Semiconductor Co., Ltd.
213
ABOV Semiconductor Co., Ltd. MC96F8208S
214