The contents of this specification are subject to change wi t h out f urt her notice. ELAN Microelectronics assumes
no responsibility concerning the accuracy, adequacy, or completeness of this specification. ELAN
Microelectronics makes no commitment to update, or to keep current the information and material contained in
this specification. Such information and material may change to conform to each confirmed order.
In no event shall ELAN Microelectronics be made responsible for any claims attributed to errors, omissions, or
other inaccuracies in the information or material contained in this specification. ELAN Microelectronics shall
not be liable for direct, indirect, special incidental, or consequential damages arising from the use of such
information or material.
The software (if any) described in this specification is furnished under a license or nondisclosure agreement, and
may be used or copied only in accordance with the terms of such agreement.
ELAN Microelectronics products are not intended for use in life support appliances, devices, or systems. Use of
ELAN Microelectronics product in such applications is not supported and is prohib ited.
NO PART OF THIS SPECIFICATION MAY BE REPRODUCED OR TRANSMITTED IN ANY FORM OR
BY ANY MEANS WITHOUT THE EXPRESSED WRITTEN PERMISSION OF ELAN MICROELECTRONICS.
12 Pad Diagram ............................................................................................................83
Specification Revision History
Doc. Version Revision Description Date
0.1 Initial Preliminary Version 2007/10/12
Product Specification (V0.1) 10.11.2007 • v
(This specification is subject to change without further notice)
Contents
vi •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
1 General Description
The EPH3600 isan 8-bit RISC MCU embedded with following:
10 bits SAR A/D converter with touch screen controller
One 16-bit general timer with capture and event counter functions,
Two 8-bit timers IR generator
EL timer Watchdog timer
SPI UART
One current D/A.
Moreover, the EPH3600 is equipped with a large size user RAM and program/data
memory. The MCU is most suitable for products involving handwriting recognition
application that requires high performance with low cost solution; such as SMS,
Stylus Remote Controller, mobile phones, handwriting input device, etc.
The MCU’s core is ELAN’s second generation RISC (RISC II) based IC. The core is
specifically designed to provide a low power consumption portable device. It
supports FAST, SLOW, and Idle mode, as well as Sleep mode for low power
consumption application.
EPH3600
RISC II Series Microcontroller
IMPORTANT NOTES
■ Do not use Register BSR (05h) Bit 7 ~ Bit 5
■ Do not use Register BSR1 (07h) Bit 7 ~ Bit 5
■ Do not use Special Register (04h)
■ Do not use Special Register (1Bh)
■ Do not use Special Register (1Ch)
■ Do not use Special Register (1Fh)
■ Do not use Special Register (32h)
■ Do not use Special Register (33h)
■ Do not use Special Register (37h)
■ Do not use Special Register (38h)
■ Do not use Special Register (39h)
■ Do not use Special Register (45h)
■ Do not use Special Register (46h)
■ Do not use Special Register (47h)
■ Do not use Special Register (4Fh)
■ Do not use Special Register (50h)
■ Do not use Special Register (51h)
■ Do not use Special Register (52h)
■ Do not use Special Register (53h)
■ Do not use JDNZ and JINZ at FSR1 (09h) special register
■ Do not use Register TABPTRH (0Dh) Bit 6
Product Specification (V0.1) 10.11.2007 • 1
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
1.1 Applications
Handwriting Recognition
Dictionary, Data Bank
Stylus Remote Controlller
2 Features
2.1 MCU Features
8-bit RISC MCU
8×8 multiplier with controllable signed or unsigned operation
Operating voltage and speed: 16MHz~11MHz @ 2.9V~3.6V, 10MHz @
2.2V~3.6V, 4MHz @ 1.6V~3.6V
One Instruction cycle time = 2 × System clock time
Program ROM addressing: 16K words maximum
Data ROM addressing: 256K words maximum
128 bytes un-banked RAM including special registers and common registers
32×128 bytes banked RAM
RAM stack has a maximum of 128 levels
Table Look Up function is fast and highly efficient when implemented with Repeat
instruction
Register-to-Register move instruction
Compare and Branch in one instruction (2 cycles)
Single Repeat function (256 repeat times maximum)
Decimal Add & Sub instruction
Full range Call and Jump capability (2 cycles)
2.2 Peripheral
One input port (Port A) and 24 gene ral I/O pins (Port B, Port C, Port D)
1-channel Speech Synthesizer
16-bit timer (Timer 0) with capture and ev ent counter functions
8-bit timer (Timer 1) with wake-up function
8-bit timer (Timer 2)
8-bit IR generator
2 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
6-bit EL Timer output
A current D/A for speech application
8-bit Watchdog Timer
10 bits resolution SAR A/D converter with 6 channels general analog input and 2
Watchdog Timer with on-chip RC oscillator
MCU mode: Sleep Mode, Idle Mode, Slow Mode, and Fast Mode
Supports either RC oscillation or crystal oscillation system clock
EPH3600
RISC II Series Microcontroller
PLL can be turned on at Fast Mode, and controlled by PEN bit when MCU is in
Slow Mode or Idle Mode
MCU Wake-up function includes input wake up, Ti mer 1 wake up, touch panel
wake up, SPI wake up, and A/D wake up
MCU interrupt function includes Input Port interrupt, Touch Panel interrupt,
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
5 Pin Description
5.1 MCU System Pins (9 Pins)
Name
AVDD
VSS
VDD
VSS
RSTB I
TEST I Normally connected to VSS. Reserved for testing use.
OSCI/RC
OSCO
PLLC I
VREX I/O
I/O/P
Type
P
P
I
O
Description
Analog positive power supply. The range is 2.2V~3.6V. Connect to VSS
through capacitors (0.1µF).
Digital and Analog positive power supply. Range is 2.2V~3.6V. Connect
to VSS through capacitor (0.1µF).
System reset input with built-in pull-up resistor (100KΩ Typical).
Low: RESET asserted
High: RESET released
RC or Crystal selection by Code Option.
32768 Hz oscillator pins. Connect to VSS through capacitor (20pF)
RC oscillator connector pin. Connect to VDD through a resistor (2MΩ).
PLL capacitor connector pin. Connect to VSS through capacitor
(0.047µF).
External or internal reference voltage for A/D converter. Connect to VSS
through capacitor (0.1µF).
6 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
5.2 I/O Ports (32 Pins)
EPH3600
RISC II Series Microcontroller
Name
Port A I
Port B
Port C
Port D
I/O/P
Type
I/O
I
O
I
O
O
O
O
O
I/O
O
O
I
I
I
I
I
I
I/O
I
O
I/O
I
I/O
Description
General Input port for special functions, i.e., Wake-up and
Interrupt
Bit 7: ON key input
Bits 6~0: Key matrix input pins
General Input/Output port
Bit 7: UART Rx pin
Bit 6: UART Tx pin
Bit 5: Event Counter/Capture input pin
Bit 4: EL CHOP output pin
Bit 3: EL CK output pin
Bit 2: IR output pin
Bit 1: Current D/A output pin
Bit 0: I/O pin
General Input/Output port
Bit 7: Touch screen X direction negative pin
Bit 6: Touch screen Y direction negative pin
Bit 5: Touch screen X direction positive pin & A/D input Channel 3
Bit 4: Touch screen Y direction positive pin & A/D input Channel 4
Bit 3: A/D input Channel 5
Bit 2: A/D input Channel 6
Bit 1: A/D input Channel 7
Bit 0: A/D input Channel 8
General Input/Output port
Bit 7: Serial data input pin
Bit 6: Serial data output pin
Bit 5: Serial clock Input/Output pin
Bit 4: /Slave Select pin
Bit 3~0: I/O pin
Product Specification (V0.1) 10.11.2007 • 7
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
6 Code Options
The Code Options are located at Address 0x000C~0x0013 of the Program ROM:
Port C.7 function selection bit : “XN for touch panel” “General I/O function” (Default)
Port C.6 function selection bit : “YN for touch panel” “General I/O function” (Default)
Port C.5 function selection bit : “XP for touch panel/ADIN3” “General I/O function” (Default)
Port C.4 function selection bit : “YP for touch panel/ADIN4” “General I/O function” (Default)
Port C.3 function selection bit : “ADIN5” “General I/O function” (Default)
Port C.2 function selection bit : “ADIN6” “General I/O function” (Default)
Port C.1 function selection bit : “ADIN7” “General I/O function” (Default)
Port C.0 function selection bit : “ADIN8” “General I/O function” (Default)
DAC function selection bits:
DAC Function Selection Port B.0 and Port B.1 Function
DAC is used Port B.1 is DAO for D/A, Port B.0 is General I/O
DAC usage is prohibited General I/O (Default)
Select UART standard baud rate : “PLL frequency is 9.83MHz” (Default)“PLL frequency is 14.745MHz”
Port A pull-h and DAC control bit: “PAPUR register, DAC bit ineffective” (Default)“PAPUR register, DAC bit effective”
EL Output TIming : “Output is from carrier gating with 128Hz and CKP” (Default) “CHOP output is directly from carrier”
8 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
7 Function Description
7.1 Reset Function
A Reset can be caused by:
Power-on voltage detector reset and power-on reset
WDT timeout
RSTB pin pull low
VDD
EPH3600
RISC II Series Microcontroller
P o w e r-o n R e se t
RSTB
+
0.1uF
WDT Reset
Figure 7-1 On-chip Reset Circuit
7.1.1 Power-up and Reset Timing
VDD
RSTB
Tpwr
OSC
Twup
CPU Work
/Chip R eset
Twup1
Figure 7-2 Power-up and Reset Timing
Symbol Characteristics Min. Typical Max. Unit
Tpwr Oscillator start up time 100 226 300 ms
Twup CPU warm up time 260 340 550 ms
Twup1 CPU reset time 18 22 44 ms
Product Specification (V0.1) 10.11.2007 • 9
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
Status (R0Fh)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
/TO /PD SGE SLE OV Z DC C
Bit 0 (C):Carry flag or inverse of Borrow flag (B) When in SUB operation, borrow flag is indicated by the inverse of carry
bit (B = /C)
Bit 1 (DC): Auxiliary carry flag
Bit 2 (Z): Zero flag
Bit 3 (OV): Overflow flag. Use in signed operation when Bit 6 carry into or borrow
from a signed bit (Bit 7).
Bit 4 (SLE): Computation result is less than or equal to zero (Negative value) after
a signed arithmetic. It is only affected by a HEX arithmetic instruction.
Bit 5 (SGE): Computation result is greater than or equal to zero (Positive value) after
a signed arithmetic. It is only affected by a HEX arithmetic instruction.
NOTE
1. When OV=1 after a signed arithmetic, user can check the SGE and SLE bits to
determine whether an overflow (carry into a signed bit) or underflow (borrow from
a signed bit) occurs.
OV=1 and SGE=1 → overflow occurs
OV=1 and SLE=1 → underflow occurs
2. When overflow occurs, you should clear the MSB of the Accumulator in order to
get the correct value.
When underflow occurs, you should set the MSB of the Accumulator in order to
get the correct value.
Example 1: ADD a positive value to another positive value, and ACC signed bit will
be affected.
MOV ACC, #60h ; Signed number +60h
ADD ACC, #70h ; +60h ADD WITH +70h
After instruction: ACC = 0D0h
SGE=1, means the result is greater than or equal to 0 (positive value)
OV=1, means the result is carry into a signed bit (Bit 7), overflow occurs.
Correct the signed bit: ACC = 50h (Clear the signed bit)
The actual result = +80h (OV=1) + 50h = +0D0h
Example 2: SUB a positive value from a negative value, and ACC signed bit will be
affected.
MOV ACC, #50h ; Signed number +50h
SUB ACC, #90h ; +50h SUB from –70h (Signed
number of 90h)
10 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
After instruction: ACC = 40h
SLE=1, means the result is less than or equal to 0 (negative value)
OV=1, means the result is borrow from a signed bit (Bit 7), underflow
occurs.
Correct the signed bit: ACC = 0C0h (Set the signed bit)
The actual result = –80h (OV=1) + 0C0h (signed number of 0C0h) = 40h
Bit 6 (/PD): Reset to 0 when entering SLEEP mode. Set to 1 by “WDTC” instruction,
power-on reset, or during a Reset pin low condition.
Bit 7 (/TO): Reset to 0 during WDT time out reset. Set to 1 by “WDTC” instruction,
entering SLEEP MODE, power-on reset, or during a Reset pin low
condition.
When a reset occurs, the special function register will be reset to its initial value
except for the /TO and /PD bits of the STATUS register.
Bit 7 (/TO) Bit 6 (/PD) Event
0 0 WDT time out reset from SLEEP mode
0 1 WDT time out reset (not SLEE P mode)
1 0 Reserved
1 1 Power on or RSTB pin low condition
Legend: “×” = unknown “−” = unimplemented, read as “0” “u” = unchanged “c” = value depending on the condition
1
Not a physical register.
2
Bit 0 (MS0) of RE (CPUCON) is reloaded from “INIM” bit of code option when the
MCU is reset.
3
If it is a power-on reset or RSTB pin is at low condition, the /TO bit and /PD bit of RF
(STATUS) are set to “1”. If it is a WDT time out reset, the /TO bit is cleared and /PD
bit is unchanged.
4
R1D, R1E are generated register RAM.
5
PAPUR can be used only by the code option setting.
5
12 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
××=
××=
7.2 Oscillator System
EPH3600
RISC II Series Microcontroller
OSCI
OSCO
32.8kHz
RC/Crystal
Osc.
OSCSEL
of
Code Option
PLL
PEN
Fosc
A/D Clock
Factor
F
PLL
FSS
0
1
MS0
Fsystem
F
A/D
Figure 7-3 Oscillator System Function Block Diagram
7.2.1 32.768kHz Crystal or 32.8kHz RC
For the 32.8kHz RC oscillator, connect a 2MΩ pull-up resistor to OSCI pin and the
OSCO pin should be floating.
For the 32.768kHz Crystal oscillator, connect the crystal between OSCI and OSCO
pins. Then connect the OSCI and OSCO pins to ground through a 20pF capacitor.
VDD
OSCI
2Mohm
OSCO
OSCI
OSCO
32.768kHz Crystal
Oscillator
32.8kHz RC Oscillator
Figure 7-4 Crystal and RC Oscillator Circuit Diagram
7.2.2 Phase Locked Loop (PLL)
PLLF (R3Ch): Store the actual PLL frequency value. It is used to check whether
the PLL frequency is stable or not.
2
PFS (R20h): Target PLL frequency select register. System clock can be fine
tuned from 0.983MHz to 16MHz. The initial value of the PFS
register after a chip reset is set at “20h” (F
2
arg
FPLLFF
OSCactual
=2.097 MHz)
PLL
FPFSF
OSCett
Product Specification (V0.1) 10.11.2007 • 13
(This specification is subject to change without further notice)
Legend: “ √ ” = function is available if enabled “ × ” = function is Not available
1
Interrupt flag will be recorded but not executed until the MCU wakes up.
2
It is recommended to operate the A/D converter in Idle mode to lower the noise couple from
the MCU clock.
SLEEP IDLE SLOW FAST
Product Specification (V0.1) 10.11.2007 • 15
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
CPUCON (R0Eh):
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Sleep Mode: When MS1 bit is set to ‘0’ and “SLEP” instruction is ex ecuted, the
Idle Mode: When MS1 bit is set to ‘1’ and “SLEP” instruction is executed, the
Slow Mode: When MS0 bit is set to ‘0’, the MCU will enter into Slow mode.
Fast Mode: When MS0 bit is set to ‘1’, the MCU will enter into Fast mode.
PLL enable: It is only effective when the MCU is in Idle mode or SLOW mode.
MCU Mode PEN Bit PLL On/Off
SLEEP × Off
IDLE/SLOW
FAST × On
MCU will enter into Sleep mode.
MCU will enter into Idle mode.
0 Off
1 On
F
PLL
Target+5%
Target
T arget-5 %
Ts
FAS T M O D E
Ts
MS0
System
clock
Target
32.768K
0m s
SLOW
MODE
0m s
0.244ms
Figure 7-7 MCU Operation Timing Diagram
NOTE
1. Switch from Slow mode to Fast mode at Time = 0ms
2. The System clock will switch to FPLL after 8 oscillation clocks, and the system
clock will then increase to about hundreds of kHz.
3. The PLL frequency will be stable (±5%) at Time = Ts (2ms ~ 5ms).
Time
Tim e
16 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
7.4 Wake-up Function
EPH3600
RISC II Series Microcontroller
Mode
Device
I/O wake up √ √ × ×
Touch panel wake up √ √ × ×
Timer1 wake up × √ × ×
A/D wake up × √ × ×
SPI wake up √ (Slave) √ (Slave)× ×
Legend: √= Function is available if en abled ×= Function is NOT available
Sleep Idle Slow Fast
Flowchart:
Change PLL F requency
BSCPUCO N, PENTurn on the PLL
BCCPUCON, MS0Change CPU to Slow mode
M O V A ,# 1 2 2
M O V P F S ,A
Chan ge PLL fre quency to
8MHz
SCALL DLY5m s
BSCPUCO N, M S0
BCCPUCON, PEN
G o to M a in R o u tin e
Code Example:
Entry FAST mode
MOV A,#122 ;8MHz MOV PFS,A BS CPUCON,MS0
Entry SLOW mode
BC CPUCON,MS0
D e la y fo r 5 m s to w a it fo r
PLL to be stable
Change CPU to Fast m ode
T u rn o ff th e P L L
Entry IDLE mode BS CPUCON,MS1 SLEP NOP
Entry SLEEP mode BC CPUCON,MS1 SLEP NOP
Product Specification (V0.1) 10.11.2007 • 17
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
7.5 Interrupt
When an interrupt occurs, the GLINT bit of the CPUCON register is reset to 0, which
disables all interrupts, including Level 1 ~ Level 5. Setting this bit to 1 will enable all
un-mask interrupts.
LJMP MSTART ;(0X00) Initialize
LJMP INPTINT ;(0X02) Input Port and Touch Panel INT
LJMP CAPINT ;(0X04) Capture Input INT
LJMP SPHINT ;(0X06) Speech Timer INT
LJMP TIMERINT ;(0X08) Timer-0,1,2 INT
LJMP PERIPH ;(0X0A) Peripheral INT
PgmSEG CSEG 0X20
;--Push interrupt register PUSH: MOVPR StatusBuf,Status MOV AccBuf,A RET
;--POP interrupt register POP: MOV A,AccBuf
MOVRP Status,StatusBuf RETI
7.5.1 Input Port A Interrupt
1. Port A Interrupt (Falling edge trigger): Port A is used as external interrupt/wake-up
input.
2. Touch Panel Interrupt (Level trigger): When Port C.7 ~ Port C.4 (X+, X-, Y+ and Y-)
are connected to touch panel input pins and
touch panel is touched, PIRQB interrupt
occurs.
Code Example:
;===Input Port And Touch Panel Interrupt
INPTINT: S0CALL PUSH JBC ADCON,PIRQB,toTPINT TEST PAINTSTA JBC STATUS,F_Z,toPAINT SJMP POP
18 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
;---Touch panel interrupt toTPINT:
: SJMP POP ;---Port A interrupt toPAINT: CLR PAINTSTA : SJMP POP
EPH3600
RISC II Series Microcontroller
7.5.2 Capture Input Interrupt
The Capture function is used to capture an input event at rising to falling edge, falling
to rising edge, rising to rising edge, or falling to falling edge. When every event input
edge is detected, a Capture interrupt occurs.
Code Example:
; === Capture Input Interrupt
CAPINT: S0CALL PUSH JBS INTSTA,CPIF,toCAPINT SJMP POP
;---Capture input interrupt toCAPINT: BS INTSTA,CPIF : SJMP POP
7.5.3 Speech Timer Interrupt
Speech Timer is an 11-bit timer for time counting. When the counting value of the
Speech Timer underflows, an interrupt occurs and the SPHTRL value will be reloaded
to counting value.
Code Example:
; === Speech Timer Interrupt
SPHINT: S0CALL PUSH JBS PHTCON,SPHTI,toSPHINT SJMP POP
; --- To speech timerinterrupt toSPHINT: BC SPHTCON,SPHTI : SJMP POP
7.5.4 Timer 0, Timer 1, and Timer 2 Interrupts
1. Timer 0 Interrupt: Timer 0 is a 16-bit timer for general time counting. When the
counting value is larger than TRL0H : TRL0L value, a Timer 0
interrupt occurs.
2. Timer 1 Interrupt: Timer 1 is an 8 bit-timer for time counting and wake-up function.
When the counting value of Timer 1 underflows, an interrupt
occurs and the TRL1 value will be reloaded to counting value.
3. Timer 2 Interrupt: Timer 2 is an 8-bit timer for time counting. When the counting
value of Timer 2 underflows, an interrupt occurs and the TRL2
value will be reloaded to counting value.
signal to digital output bits. When the conversion is completed,
an A/D interrupt occurs.
;--A/D interrupt toADINT: BC INTSTA,ADIF : SJMP POP ;--UART Receiving Error Interrupt toUERRINT: BC INTSTA,UERRI : SJMP POP ;--UARTTx Buffer FullInterrupt toUTXINT: BC INTSTA,UTXI : SJMP POP ;--UARTRx Buffer FullInterrupt toURXINT: BC INTSTA,URXI : SJMP POP ;--SPI Interrupt toSPINT: BC SPISTA,SRBFI : SJMP POP
8K Words × 2 Segments = 16K Words
Address Segment
0000h
|
000Bh
000Ch
|
0013h
0014h
|
001Fh
0020h
|
3FFFh
20 •Product Specification (V0.1) 10.11.2007
Interrupt Vector
(12 words)
Code Option
(8 words)
Test Program
(12 words)
Segment 0
|
Segment 1
(This specification is subject to change without further notice)
When the PAPUR register & DAC bit are enabled and effective, the following conditons occur:
a) Code option setting can use PAPUR register, SPHTPSR1~0, and DAC bit.
b) The KE, /R2EN, and Bit7PU bit of PACON can NOT be used.
Note that the code option setting is available only from the real chip but can NOT be simulated
with the PM board.
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
7.8.2 Other Un-banked Register of RAM:
Address Un-banked
56h
|
7Fh
General Purpose RAM
7.8.3 Banked Register of RAM:(selected by BSR)
Address Bank 0 Bank 1 Bank 2 Bank 3 …….. Bank 31
80h
|
FFh
General
Purpose
RAM
General
Purpose
RAM
7.9 Special Register Description
STKPTR (R06h)
The stack level starts from the bottom going up (in a decreasing order), starting from
0FFh of Bank 31.
Stack is located at Bank 30 and 31 from Address FFh~80h. Initial top position of
stack pointer is located at 00h.
Bits 0~6 of STKPTR are used as address pointer from 80h ~ FFh
Bit 7=1 is used to select Bank 31
Bit 7=0 is used to select Bank 30
Each INT/CALL will stack two bytes address, total capacity is 128 levels.
PCL, PCM (R02h, R03h): Program Counter Register
Bit 15 … Bit 8 Bit 7 … Bit 0
PCM PCL
General
Purpose
RAM
General
Purpose
RAM
……..
General
Purpose
RAM
Generates up to 64K×16 on-chip ROM addresses at the relative programming
instruction codes.
“S0CALL” loads the low 12 bits of the PC (4K×16 ROM).
“SCALL” or ”SJUMP” loads the low 13 bits of the PC (8K×16 ROM).
“LCALL” or ”LJUMP” loads the full 16 bits of the PC (64K×16 ROM)
“ADD R2, A” or “ADC R2, A” allows a relative address to be added to the current PC.
The carry bit of R2 will automatically carry into PCM.
Product Specification (V0.1) 10.11.2007 • 25
(This specification is subject to change without further notice)
Bit 23 is used to select the internal/external memory.
Bit 20 ~ Bit 1 are used to point the memory address.
Bit 0 is used to select the low byte or high byte of the pointed word (see
PAWAKE (R2Fh): is Port A wake-up control register
“0” : Disable wake-up function
“1” : Enable wake-up function
Port B (R18h) are general I/O registers
DCRB (R34h): Port B Direction Control
“0” : Output pin setting
“1” : Input pin setting
PBCON (R3Ah): Pull-up Resistor Control of Port B
“0” : Disable pull-up resistor
“1” : Enable pull-up resistor
Port C (R19h): are General I/O Registers
DCRC (R35h): Port C Direction Control
“0” : Output pin setting
“1” : Input pin setting
PCCON (R3Bh): Pull-up Resistor Control of Port C.
“0” : Disable pull-up resistor
“1” : Enable pull-up resistor
30 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
Port D (R1Ah): is a General I/O Register
DCRDE (R36h): Direction Control & Pull-up Resistor Control of Port D
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
- - - - DHNPU DLNPU DHNDC DLNDC
Bit 1 (DHNDC) & Bit 0 (DLNDC): Port D high nibble direction control
“0” : Output pin setting
Bit 3 (DHNPU) & Bit 2 (DLNPU): Enable Port D high nibble pull-up resistor
“0” : Disable pull up resistor
Code Example:
; *** Port A function ; --- Port A interrupt INPTINT: PUSH MOV A,PAINTSTA BC PACON,KE ; --- Port A interrupt JBS STATUS,F_Z,Q_PAINT MOV PORTD,A Q_PAINT: POP RETI ; --- Port A R2 pull-up enable MOV A,#00001010B MOV PACON,A ; --- Port A interrupt MOV A,#11111111B MOV PAINTEN,A CLR PAINTSTA ; --- Port A wakeup MOV PAWAKE,A BS CPUCON,GLINT ; --- Sleep mode BC CPUCON,MS1 KeyLoop: BS PACON,KE SLEP NOP : SJMP KeyLoop
EPH3600
RISC II Series Microcontroller
“1” : Input pin setting
“1” : Enable pull-up resistor
; *** Output function => 0XAAh to all port CLR DCRC CLR DCRB CLR DCRDE MOV A,#0XAA MOV PORTC,A MOV PORTB,A MOV PORTD,A ;
; *** Input function => Input port to RAM 80 ~ 83h
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8 Peripheral
8.1 Timer 0 (16-bit Timer with Capture and Event Counter Functions)
TRL0H:TRL0L
Timer 0
(16-bit Counter)
AGMD2~0
Edge Detector
Comparator
Reset
Counting
Value
Selector
T0FNEN1~0
Timer 0 INT
T0CH:T0CL
CPIF
Fosc
FPLL/2
T0CS
T0PSR1~0
Fcs
Prescaler
EVIN/CPIN
T0FNEN1~0
Function
Enable
Selector
Schmit
Trigger
Figure 8-1 Timer 0 Function Block Diagram
8.1.1 Timer 0 Mode:
Under this mode, Timer 0 is used as a general-purpose 16-bit up counter. An
interrupt is available for user’s application.
A prescaler for the timer is also available. The T0PSR2~T0PSR0 bits of the
TR01CON register determine the prescaler ratio and generate different clock rates for
the timer clock source. Counter value will be incremented by one (counting up)
according to the timer clock source and stored into the T0CH: T0CL register. The
clock source (Fcs) is selected from Fosc or F
T0PSR1~0. When the counting value is larger than TRL0H: TRL0L value, Timer 0
interrupt will occur, and the counter value will be reset to zero automatically.
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8.1.2 Capture Mode: CPIN (Port B.5) Pin
Capture is a function that captures a Timer 0 value when an event occurs on CPIN pin.
The counter value is captured at: 1st rising edge, 2nd falling edge, etc.; 1st falling
edge, 2nd rising edge, etc.; every rising edge or every falling edge selected by
AGMD2~0 bit of the SFCR register. When an event edge is detected from CPIN
input pin, the interrupt flag CPIF is set. If a new event edge is detected before the old
value in T0CH: T0CL register is read, the old captured value will be lost.
The CPIN pin should be configured in capture function input by setting T0FNEN1~0
bits of TR2CON register.
1
T0:00:0Pr
Fcs
()()
[]
−××=
CLTCHTCLTCHTescaler
OLDNEW
Capture Mode Example:
T0FNEN1~0
AGMD2~0
T0CH:T0CL
00
000
CPIN
Timer0
P1 P2 P3 P4 P5P6P7 P8 P9
CPIF
P2P6
001010
P10 P11
P7P9P3
10
011
P12 P13P14
P15
P11 P13 P15
P16 P17
100
P18 P19 P20
P17P21
101
P21
P22 P23 P24 P25 P26 P27 P28 P29 P30
P22
P31 P32
P33
8.1.3 Event Counter Mode: EVIN (Port B.5) Pin
Event counter is a function wherein the 16-bit counter value increments by one when
an event occurs on EVIN pin at: every rising edge or every falling edge selected by
AGMD2~0 bit of the SFCR register. In other words, the Timer 0 clock source is from
an external event (EVIN pin).
The EVIN pin should be configured in event counting function input by setting the
T0FNEN1~0 bits of the TR2CON register. The counting value of Timer 0 will be
stored in T0CH: T0CL registers.
Event Counter Mode Example:
T0FNEN1~0
AGMD2~0
Timer 0
T0CH:T0CL
0011
010011
EVIN
P0P1P2P3P4P5
P0P1P2P3P4P5
Product Specification (V0.1) 10.11.2007 • 33
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
TRL0H, TRL0L (R25h, R24h): is used to store the values that are compared with
T0CH, T0CL (R3Eh, R3Dh): is used to store the Timer 0 counting value in Timer
TR01CON (R27h): Timer 0 and Timer 1 Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
T1WKEN T1EN T1PSR1 T1PSR0 IREN T0CS T0PSR1 T0PSR0
Bit 1 ~ Bit 0 (T0PSR1~T0PSR0): Timer 0 Prescaler select bit
T0PSR1: T0PSR0 Prescaler Value
Bit 2 (T0CS): Timer 0 clock source select bit
Timer 0 register.
0 mode and Event counter mode. But in Capture
mode, it is used to store the captured value.
Bit 5 ~ Bit 4 (T0FNEN1 ~ T0FNEN0): Timer 0 and Capture, event counter mode
selection bits.
SFCR (R44h): Special Function Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
AGMD2 AGMD1 AGMD0 WDTPSR1 WDTPSR0 SPHSB CSB1 CSB0
Bit 7 ~ Bit 5 (AGMD2 ~ AGMD0): Capture and Event Counter function e dg e
detector selection bits.
T0FNEN 1 ~ 0 Mode AGMD 2~0 Edge Mode
00 Disable - 01 Timer 0 - -
000 1st Rising edge, 2nd falling edge, etc.
001 1st Falling edge, 2nd rising edge, etc.
10 Capture
11 Event Counter
010 Every rising edge
011 Every falling edge
100 Every 4th rising edge
101 Every 16th rising edge
010 Every rising edge
011 Every falling edge
Note: 1. When changing from one mode to another, the Timer 0 must be initially disabled.
2. To avoid error, setup T0FNEN1 and T0FNEN0 simultaneously.
34 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
CPUCON (R0Eh): MCU Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Bit 2 (GLINT): Global Interrupt Control Bit
“0” : Disable all interrupts
“1” : Enable all un-masked interrupt
INTCON (R22h): Interrupt Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIE ADIE URXIE UTXIE UERRIE TMR2IE TMR1IE TMR0IE
Bit 0 (TMR0IE): Timer 0 Interrupt Control Bit
“0” : Disable Timer 0 interrupt
“1” : Enable Timer 0 interrupt
Bit 7 (CPIE): Capture Interrupt Control bit
“0” : Disable Capture interrupt
“1” : Enable Capture interrupt
INTSTA (R23h): Interrupt Status Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIF ADIF URXI UTXI UERRI TMR2I TMR1I TMR0I
Bit 0 (TMR0I): Set to 1 when Timer 0 is larger than TRL0H ~ TRL0L value
Clear to 0 by software or Timer 0
Bit 7 (CPIF): Set to 1 when Capture input edge is detected
Clear to 0 by software or disable Capture
Code Example:
;===Timer 0 interrupt TIMERINT: PUSH JBC INTSTA,TMR0I,Q_Time BC INTSTA,TMR0I BTG PORTC,3 Q_Time: POP RETI ;===Timer 0 = (8M/2) / [4 x 3FFF + 1]Timer0SR: : System setting 8MHz PC.2Port C & D setting output port : ; --- Fpll & Prescaler 1:4
;===Capture Input Interrupt CAPINT: PUSH JBS INTSTA,CPIF,Q_ICAP BC INTSTA,CPIF BTG PORTC,3 BS INTFLAG,F_ICAP Q_ICAP: POP RETI ; ;===1st falling edge,2nd rising edge, etc. CAP_SR: System setting 8MHz PC.2Port C & D setting output port User setting F_ICAP flag.
Product Specification (V0.1) 10.11.2007 • 35
(This specification is subject to change without further notice)
; === Every rising edge EVcntSR: : System setting 8MHz Port C & D setting output port : MOV A,#0XFF ; Switch 256 times reload MOV TRL0L,A CLR TRL0H ; Count start 0000H BS TR01CON,T0CS ; PLL/2 MOV A,#01000000B MOV SFCR,A ; Rising edge MOV A,#00110000B MOV TR2CON,A ; 11->Event count Enable EV_LOOP: MOVRP PORTC,T0CH ; Out event count to Port C:D MOVRP PORTD,T0CL SJMP EV_LOOP
36 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
8.2 Timer 1 (8 Bits)
EPH3600
RISC II Series Microcontroller
TRL1
reload
PrescalerFosc
T1PSR1~0
underflow
Timer 1
Figure 8-2 Timer 1 Function Block Diagram
Timer 1 INT or
Timer 1 wake up
TR1C
Timer 1 is a general-purpose 8-bit down counter for applications requiring time
counting. Interrupt and wake up functions are offered for your application. The clock
source is from the oscillator clock.
A prescaler is also available for the timer. The T1PSR1~T1PSR0 bits of the
TR01CON register determine the prescaler ratio and generate different clock rates for
the timer clock source. Setting T1WKEN bit of the TR01CON register to 1 will enable
the Timer 1 underflow wake-up function in IDLE MODE.
Counting value will be decremented by one (count down) according to the real timer
clock source. When the counter underflows, the timer interrupt will be triggered if the
global interrupt and Timer 1 interrupt are both enabled. At the same time, the TRL1
value is automatically reloaded into the 8 bits counter.
1
T
()
11Pr
+××=TRLescaler
Focs
The Timer 1 frequency range is from 0.5Hz (TRL1 = 0FFh, prescaler = 1:256) to
8.192kHz (TRL1 = 0h, prescaler = 1:4). The clock source is from the oscillator clock
(Fosc).
TRL1 (R26h): Use to store the auto-reload value of Timer 1. When enabling
Timer 1 or an underflow occurs, TRL1 register value will
automatically be reloaded into the 8 bits counter.
TR1C (R4Ch): Use to store the Timer 1 Counting Value
Product Specification (V0.1) 10.11.2007 • 37
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
TR01CON (R27h): Timer 0 and Timer 1 Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
T1WKEN T1EN T1PSR1 T1PSR0 IREN T0CS T0PSR1 T0PSR0
Bit 5 ~ Bit 4 (T1PSR1~T1PSR0): Timer 1 Pre-scale Select Bit.
Bit 6 (T1EN): Timer 1 Enable Control Bit “0” : Disable Timer 1 (stop counting)
Bit 7 (T1WKEN): Enable bit of Timer 1 underflow wake-up function in IDLE MODE. “0” : Disable Timer 1 wake-up function
T1PSR1: T1PSR0 Prescaler Value
00 1:4
01 1:16
10 1:64
11 1:256
“1” : Enable Timer 1
“1” : Enable Timer 1 wake-up function
CPUCON (R0Eh): MCU Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Bit 2 (GLINT): Global Interrupt Control Bit
INTCON (R22h): Interrupt Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIE ADIE URXIE UTXIE UERRIE TMR2IE TMR1IE TMR0IE
Bit 1 (TMR1IE): Timer 1 Interrupt Control Bit
“0” : Disable Timer 1 interrupt
“1” : Enable Timer 1 interrupt
INTSTA (R23h): Interrupt Status Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIF ADIF URXI UTXI UERRI TMR2I TMR1I TMR0I
Bit 1 (TMR1I): Set to 1 when Timer 1 interrupt occurs
Clear to 0 by software or disable Timer 1
38 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
POP RETI ; === Timer 1 = 32.768K/[256 x 3F + 1] Timer1SR: : PC.2 setting output port : MOV A,#10110000B MOV TR01CON,A ; Fosc & Prescaler 1:256 & wakeup MOV A,#03FH MOV TRL1,A ; 0.5sec = (256 x 63 + 1)/32.768K BS TR01CON,T1EN ; Timer 1 enable BS INTCON,TMR1IE ; Timer 1 interrupt enable BC INTSTA,TMR1I ; Clear Timer 1 interrupt status BS CPUCON,GLINT ; Enable global interrupt BS CPUCON,MS1 ; Idle mode T1WLoop: SLEP NOP : SJMP T1Wloop
Product Specification (V0.1) 10.11.2007 • 39
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8.3 Timer 2 (8 Bits)
TRL2
reload
Fosc
FPLL/2
Fcs
Prescaler
T2PSR1~0T2CS
Figure 8-3 Timer 2 Function Block Diagram
Timer 2
T2EN
underflow
Timer 2 INT
TR2C
Timer 2 is a general-purpose 8-bit down counter for applications that require time
counting. Interrupt functions are available for your application. The clock source
(Fcs) is from the oscillator clock or F
PLL/2.
There is a prescaler for the timer. The T2PSR1~T2PSR0 bits of the TR2CON
register determine the prescaler ratio and generate different clock rates for the timer
clock source.
Counting value will be decremented by one (counting down) according to the timer
clock source. When the counter value underflows, a timer interrupt will occur (if
Timer 2 interrupt is enabled).
POP RETI ; === Timer 2 = (8M/2)/[4 x 3F + 1] Timer2SR: : System setting 8MHz Port D setting output port : MOV A,#00000110B MOV TR2CON,A ; Fpll & Prescaler 1:4 MOV A,#03FH MOV TRL2,A ; 16us = (4 x 63 + 1)/(8M/2) BS TR2CON,T2EN ; Timer 2 enable BS INTCON,TMR2IE ; Timer 2 interrupt enable BC INTSTA,TMR2I ;Clear Timer 2 interrupt status BS CPUCON,GLINT ; Enable global interrupt TMR2Loop: MOVRP PORTD,TR2C ;Out Timer 2 count to Port D SJMP TMR2Loop
42 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
8.4 IR Generator: IROT (Port B.2) Pin
EPH3600
RISC II Series Microcontroller
TRLIR
reload
PrescalerFPLL
IRP SR 1 ~ 0
8-bit C ounter
IRE N
Figure 8-4 IR Generator Function Block Diagram
underflow
Divide
by 2
IROT
IR function is enabled by IREN bit and output on the IROT (Port B.2) pin by a
general-purpose 8-bit down counter. When IREN is low, the T-flip-flop should be
initialized, as IROT equals zero. The clock source is from the PLL clock. The
IRPSR1 ~ IRPSR0 bits of the TR2CON register determine the prescaler ratio and
generate different clock rates for the timer clock source. The counting value will be
decremented by one (counting down) according to the clock source. When the
counter value underflows, the IR reload register value will be reloaded into the
counter.
T
2
F
PLL
()
1Pr
+××=TRLIRescaler
IR Carrier Signal Frequency:
Clock Source Fper / 2 TRLIR Prescaler IR Freq.
Fpll (8MHz) 4MHz 0Fh 1:1 250kHz
Fpll (16MHz) 8MHz 0Fh 1:1 500kHz
TRLIR (R29h): is used to store the auto-reload value of the IR gene rator. When
enabling the IR generator or when an underflow occurs, the TRLIR
register value is automatically reloaded into the 8 bits counter.
TR01CON (R27h): Timer 0 and Timer 1 Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
T1WKEN T1EN T1PSR1 T1PSR0 IREN T0CS T0PSR1 T0PSR0
Bit 3 (IREN):IR function enable control bit
“0” : Disable IR function and recover IROT pin as a general I/O pin
“1” : Enable IR function and change Port B.2 as IROT output pin.
Product Specification (V0.1) 10.11.2007 • 43
(This specification is subject to change without further notice)
Figure 8-5 EL or IR Generator Timer Function Block Diagram
EL Timer is a 6-bit down counter that is suitable for counting the CHOP signal output.
The clock source is from 1/2 system cl ock (1MHz ~ 16MHz).
Counter value decreases (count down) by one according to the timer clock source.
When under flow occurs, the CHOP output level will be toggled. When EL timer is
enabled or underflow happens, ELTRL will automatically reload into 6-bit counte r.
underflow
÷ 2
256 Hz
Carrier
128 Hz
CKP
CHOP output (Port B.4)
CHOP output(Port B.5)
CK output (Port B.3)
CK output(Port B.4)
44 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
ELTEN bit is used to enable EL timer and change Port B.4 and Port B.3 to CHOP
and CK output pin.
Where: CHOP (Port B.4): Chop output pin of EL driver
CK (Port B.3): CK output pin of EL driver
CKP bit is used to select clock polarity of CHOP output (see timing diagram in
Figure 8-6 for further details).
The frequency range of CHOP carrier signal is from 128Hz (System clock at
32768Hz, ELTRL=3Fh) to 4MHz (System clock at 16MHz, ELTRL=0h).
)(Fsystem/2Fchop×
×=
1
+
EL Code Option: EL Output Timing
Select “CHOP output is from carrier gating with 128Hz and CKP”
or “CHOP output is directly from carrier” (for IR function)
Bit5 ~ Bit0 (ELTRL5~ELTRL0): Store the auto reload value of EL timer. When EL
timer is enabled or underflow occurs, ELTRL5 ~ 0 will automatically
reload into 6-bit counter.
Bit6 (CKP): EL clock polarity select bit
“0” Idle state for CHOP pin is low level
“1” Idle state for CHOP pin is high level
Bit7 (ELTEN): EL/IR Timer enable control bit
“0” Disable EL Timer (stop counting) and recover CK and CHOP pin
to general I/O pin
1
2
1)(ELTRL
“1” Enable EL Timer and change Port B.3 and Port B.4 to CK and
CHOP output pin
Product Specification (V0.1) 10.11.2007 • 45
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8.5.1 EL Generator Timing
256H z
(internal clock)
128Hz
(internal clock)
Tdelay3
3.9ms
3.9ms
CHOP
(CKP = 0 )
3.9ms
3.9ms
Carrier
CHOP
(C K P = 1 )
1.95ms
5.85ms
Carrier
CK
Figure 8-6 EL Generator Timing Diagram
Code Example:
EL code option -- EL Output Timing: Select “CHOP output is from carrier gating with 128Hz and CKP” ; === EL generator 200KHz : System setting 4MHz : MOV A,#00000100B MOV ELCON,A ; (4MHz/2) / [(4+1) x 2] = 200KHz BS ELCON,ELTEN ; Enable EL generator. :
EL code option -- EL Output Timing: Select “CHOP output is directly from carrier”. ; === EL generator 32.25KHz : System setting 8MHz : MOV A,#00111111B MOV ELCON,A ; (8MHz/2) / [(63+1)x2] = 31.25KHz BS ELCON,ELTEN ; Enable IR generator. :
46 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
8.6 Watchdog Timer (WDT)
EPH3600
RISC II Series Microcontroller
Fosc/2 except @
SLEEP mode
Intern a l R C OS C
@ SLEEP mode
(16kHz +/- 20%)
FWDT
MUXPrescaler
Enable
MCU mode
2
WDTPSR1~0WDTEN
Instruction "WDTC"
reset
8-bit Counter
(W D T )
overflow
W DT Time out reset
Figure 8-7 Watchdog Timer Function Block Diagram
The Watchdog Timer (WDT) clock source is from on -chip RC oscillator (16kHz ±
20%, MCU in Sleep mode) or F
will keep on running even when the oscillator has been turned off (i.e., in Sleep
Mode). WDT time-out will cause the MCU to reset (if WDT is enabled). To prevent
reset from occuring, you must clear the WDT value by using the “WDTC” instruction
before WDT time-out. Setting the WDTEN bit will enable the WDT function. The
WDT default condition is disabled A prescaler is also available to generate different
clock rates for the WDT clock source. The prescaler ratio is defined by WDTPSR1 ~
WDTPSR0.
T
/2 (MCU in Fast, Slow, or Idle mode). The WDT
OSC
F
1
WDT
()
1Pr
+××=WDTescaler
The WDT time out range is 64ms (prescaler = 1:4) to 2.048 second (prescaler = 1:128).
RS232C compatible
Mode selectable (7/8/9-bit) with/without parity bit
Baud rate selectable
Error detect function
Interrupt available for Tx buffer empty, Rx buffer full and receiver error
TXD and RXD port inverse output control
Timer0/32
RXD
Selector
Fsystem
RXETXE
UINVEN
RB8
RX ControlTX Control
RX s h ift re g iste r
UAR T R x reg.UARTTx reg.
Baud rate
generator
Parity con tro l
Interrupt
Control
Error flag
TB8
TXD
Data Bus
Figure 8-8 UART Function Block Diagram
UINVEN
48 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
In Universal Asynchronous Receiver Transmitter (UART), each transmitted or
received character is individually synchronized by framing it with a start bit and stop
bit.
Full duplex data transfer is possible because the UART has independent transmit and
receive sections. Double buffering in both sections enables the UART to be
programmed for continuous data transfer.
The figure below shows the general format of one character sent or received. The
communication channel is normally held in the marked state (high). Character
transmission or reception starts with a transition to the space state (low).
The first bit transmitted or received is the start bit (low). It is followed by the data bits,
in which the least significant bit (LSB) comes first. The data bits are followed by the
parity bit. If present, then the stop bit or bits (high) confirm the end of the frame.
In receiving, the UART synchronizes on the falling edge of the start bit. When two or
more “0”s are detected during three sampling, it is recognized as a normal start bit
and receiving operation is started.
8.7.1 Data Format in UART
Idle state
START
bit
1 bit7 or 8 bits
D0D1D2Dn
One character or frame
Figure 8-9 UART Data Format Diagram
Parity
STOP
bit
bit
1 bit1 bits
(mark)
8.7.2 UART Modes
There are three modes in UART. Mode 1 (7 bits data) and Mode 2 (8 bits data) allow
the addition of a parity bit. The parity bit addition is not available in Mode 3. The
Figure below shows the data format in each mode.
Product Specification (V0.1) 10.11.2007 • 49
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
1234511109876
START
START
START
START
START
7 bits DATA
7 bits DATAParity
8 bits DATA
8 bits DATAParity
9 bits DATA
STOP
STOP
STOP
STOP
STOP
Mode 1
Mode 2
Mode 3
UMODE PRE
0 0 0
0 0 1
0 1 0
0 1 1
1 0 X
Figure 8-10 UART Modes Data Format
8.7.3 UART Transmit Data
In transmitting serial data, the UART operates as follows:
1. Set the TXE bit of the UARTCON register to enable UART transmission function.
2. Write data into the UARTTX register, and the TBE bit of the UARTCON register
will be set by hardware. Then start transmitting.
3. Serially transmitted data are transmitted in the following order from the TXD pin:
(a) Start bit: one “0” bit is output
(b) Transmit data: 7, 8, or 9 bits data are output from LSB to MSB
(c) Parity bit: one parity bit (odd or even sele ctable) is output
(d) Stop bit: one “1” bit (stop bit) is outp ut
(e) Mark state: output “1” continues until the start bit of the next transmit data
4. After transmitting the stop bit, the UART generates a UTXI interrupt (if enabled)
8.7.4 UART Receive Data
1. Sets the RXE bit of the UARTCON register to enable the UART receiving
function.
2. The UART monitors the RXD pin and synchronizes internally when it detects a
start bit.
3. Received data is shifted into the UARTRX register in LSB to MSB sequence.
4. The parity bit and the stop bit are received. After one character is received, the
UART generates a URXI interrupt (if enabled). And the URBF bit of the
UARTSTA register is set to 1.
50 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
5. The UART makes the following checks:
a) Parity check: The number of “1” in the receive data must match with the
even or odd parity setting of the EVEN bit in the UARTSTA
register.
b) Frame check: The start bit must be “0” and the stop bit must be “1.”
c) Overrun check: the URBF bit of the UARTCON register must be cleared
(i.e., the UARTRX register should be read out) before the
next received data are loaded into the UARTRX register.
If any of the checks failed, the UERRI interrupt will be generated (if enabled).
And the error flag is indicated in PRERR, OVERR or FMERR bit. The error flag
should be cleared by software, otherwise, a UERRI interrupt will occur when the
next byte is received.
6. Read the received data from the UARTRX register. The URBF bit will be cleared
by hardware.
8.7.5 UART Baud Rate Generator
The baud rate generator comprises of a circuit that generates a clock pulse
which determines the transfer speed of the transmitted/received data in the
UART.
The input clock of the baud rate generator is derived from the syst em clock
divided by 64 or from Timer 0 divided by 32.
The system clock should be at 9.83MHz (PFS = 150) or 14.745MHz
(PFS = 225) when UART is enabled.
The BRATE2 ~ BRATE0 bits of the UARTCON register determines the desired
baud rate.
8.7.6 UART Applicable Registers
UARTCON (R30h): UART Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
TB8 UMODE1 UMODE0BRATE2 BRATE1 BRATE0 UTBE TXE
Bit 0 (TXE): Enables transmit data function
Bit 1 (UTBE): UART transfer buffer empty flag. Set to “1” when the transfer buffer is
empty. Reset to “0” automatically when writing into the UARTTX
register.
NOTE
When transmit data is enabled, the UTBE (read-only) bit will be
cleared by hardware. Hence, writing to the UARTTX register is
required when you want to start transmitting data.
Product Specification (V0.1) 10.11.2007 • 51
(This specification is subject to change without further notice)
00 Mode 1: 7-bit data
01 Mode 2: 8-bit data
10 Mode 3: 9-bit data
11 Reserved
Fpll = 9.83MHz
(PFS = 150)
Fpll = 14.745MHz
(PFS = 225)
Fpll = 14.745MHz
(PFS = 225)
Bit 7 (TB8): Transmission Data Bit 8
UARTSTA (R31h): UART Status Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
RB8 EVEN PRE PRERR OVERR FMERR URBF RXE
Bit 0 (RXE): Enable receive data function
Bit 1 (URBF): UART read buffer full flag. Set to 1 when one character is received.
Reset to 0 automatically when read from the UARTRX register.
NOTE
When receive data is enabled, URBF (read-only) bit will be cleared by
hardware. Hence, reading from the UARTRX register is required to
avoid overrun error.
Bit 2 (FMERR): Framing error flag. Set to 1 when framing error occurs
Clear to 0 by software
Bit 3 (OVERR): Overrun error flag. Set to 1 when overrun error occurs
Clear to 0 by software
Bit 4 (PRERR): Parity error flag. Set to 1 when parity error occurs
Clear to 0 by software
52 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
Bit 5 (PRE): Enable parity addition
“0” : Disable
“1” : Enable
Bit 6 (EVEN): Select parity check
“0” : Odd parity
“1” : Even parity
Bit 7 (RB8): Receiving Data Bit 8
UARTTX (R15h): UART Transfer Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
TB7 TB6 TB5 TB4 TB3 TB2 TB1 TB0
Bit 7 ~ Bit 0 (TB7 ~ TB0): Transmit data register. UARTTX register is write-only.
UARTRX (R16h): UART Receiver Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0
Bit 7 ~ Bit 0 (RB7 ~ RB0): Receive data register. UARTRX regi ster is read-only.
STBCON (R21h): Strobe Output Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
UINVEN /REN BitST ALL STB3 STB2 STB1 STB0
Bit 7 (UINVEN): Enable UART TXD and RXD port inverse output.
“0” : Disable TXD and RXD port inverse output.
“1” : Enable TXD and RXD port inverse output.
CPUCON (R0Eh): MCU Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Bit 2 (GLINT): Global Interrupt Control Bit
“0” : Disable all interrupts
“1” : Enable all un-masked interrupt
Product Specification (V0.1) 10.11.2007 • 53
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
INTCON (R22h): Interrupt Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIE ADIE URXIE UTXIE UERRIE TMR2IE TMR1IE TMR0IE
Bit 3 (UERRIE): Control bit of UART receiving error interrupt
“0” : Disable
Bit 4 (UTXIE): Control bit of UART Transfer buffer empty interrupt
“0” : Disable
Bit 5 (URXIE): Control bit of UART Receiver buffer full interrupt
“0” : Disable
INTSTA (R23h): Interrupt Status Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIF ADIF URXI UTXI UERRI TMR2I TMR1I TMR0I
“1” : Enable
“1” : Enable
“1” : Enable
Bit 3 (UERRI): Set to 1 when UART receiving error occurs
Clear to 0 by software or disable UART
Bit 4 (UTXI): Set to 1 when UART transfer buffer empty occurs
Clear to 0 by software or disable UARTTX (TXE=0)
Bit 5 (URXI): Set to 1 when UART receiver buffer full occurs
(This specification is subject to change without further notice)
Stop bit
Start bit
Figure 8-13 UART Receive Counter Timing
One bit cycle
Bit 0
EPH3600
RISC II Series Microcontroller
8.7.10 UART Receive Operation (8 bits da ta with parity and s top b it)
STAR T
RXD
pin
Sample
Timing
URBF
URXI
PRER R
OVERR
FM ERR
Sy nc h ro n iz atio n
D0D1D2Dn
bit
Figure 8-14 UART Receive Operation
Code Example:
;===UART Receiver buffer full interrupt PERIPH: PUSH JBC INTSTA,URXI,UERRINT BC INTSTA,URXI MOVPR URX_NO,UARTRX SJMP Q_RXINT ; ;===UART error interrupt UERRINT: JBC INTSTA,UERRI,Q_RXINT BC INTSTA,UERRI ;---Framing error flag ;---Over run error flag ;---Parity error flag MOV A,UARTSTA AND A,#00011100B MOV PORTD,A BC UARTSTA,FMERR BC UARTSTA,OVERR BC UARTSTA,PRERR Q_RXINT: POP RETI
Clear b y h ard w a re w h en
read d ata fro m U A R T R x
Clear by
softw are
56 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
8.8 A/D Converter
XP/ADIN3
XN
YP/ADIN4
YN
ADIN5
ADIN6
ADIN7
ADIN8
DET
CHS2~0
S/ D B
ADEN
FOSC
FPL L/2
Where:
RISC II Series Microcontroller
VREX
Ref er en ce V o l t age G ener at or
6-channel
MUX
&
SW, Mode L ogi c
10-bit SAR A/D
Cl ock
Factor
8
ADCF
Figure 8-15 A/D Converter Function Block Diagram
FA/D
FSS
VRS
EPH3600
ADIF or
A D wak e up
ADOTH ~
ADOTL [1:0]
VREX:Reference voltage I/O pin
When VRS=1; it is input pin
When VRS=0, it is output pin
XN (Port C.7): X negative position input
YN (Port C.6): Y negative position input
XP/ADIN3 (Port C.5): X positive position input or A/D input Channel 3
YP/ADIN4 (Port C.4): Y positive position input or A/D input Channel 4
ADIN5 (Port C.3): A/D converter input Channel 5
ADIN6 (Port C.2): A/D converter input Channel 6
ADIN5 (Port C.1): A/D converter input Channel 7
ADIN6 (Port C.0): A/D converter input Channel 8
Product Specification (V0.1) 10.11.2007 • 57
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
This A/D converter has 8 channels and 10-bit resolution. When the MCU is in Slow
mode and ADEN=1, A/D conversion runs immediately. When the MCU is in Fast
mode or Idle mode, ADEN=1, A/D conversion will also run. The A/D resolution is
better in Idle mode than in Fast mode. The two channels; XP and YP have low
resistance switches for driving the touch screens. The other 6 channels are for
general applications.
The A/D converter operation for touch panel application is as follows:
Step 1: Pen down detection
If the panel is not tapped, the PIRQB is high. When the touch panel is
tapped, the PIRQB is low and PIRQB interrupt occurs (if INT is enabled).
Step 2: Measure the X position
If the PIRQB remains low and steady for awhile, the DET bit is cleared, then
the PIRQB returns to high and the X position is measured.
Step 3: Measure the Y position
Y position is measured immediately after Step 2.
Step 4: Back to Step 1
8.8.1 A/D Converter Applicable Registers
ADCON (R2Ch): A/D Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3Bit 2 Bit 1 Bit 0
DET VRS ADEN PIRQB - CHS2 CHS1 CHS0
Bit 2 ~ Bit 0 (CHS2 ~ CHS0): 2-channel touch screen & 6-channel A/D input selection.
Bit 4 (PIQRB): Touch screen status bit. It is a read bit
“0” : Touch screen is tapped
“1” : Touch screen is not tapped
Bit 5 (ADEN): A/D enable control bit. Automatically clears to “0” when ADIF occurs.
“0” : A/D disabled
“1” : A/D enabled
Bit 6 (VRS): A/D input reference voltage selection and enable/disable internal
reference generator bit
“0” : Enable the internal reference generator and the voltage is
referenced from the internal reference voltage generator
“1” : Disable the internal reference generator and the voltage is
referenced from the external VREX pin
58 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
Bit 7 (DET): Touch panel pen down detection mode control bit. Enables/disables
PIRQB interrupt and wake-up functions
“0” : Disable the detection mode. S switches are OFF for interrupts
and wake-up functions
“1” : Enable the detection mode. S switches are ON for interrupts and
Any FA/D value that is greater than 1.4MHz is invalid.
CPUCON (R0Eh): MCU Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Bit 0 (MS0): CPU Fast/Slow mode setting
“0” : Slow mode
“1” : Fast mode
Bit 1 (MS1): CPU Sleep & Idle mode setting
“0” : Sleep mode
“1” : Idle mode
Bit 2 (GLINT): Global interrupt control bit
“0” : Disable all interrupts
“1” : Enable all un-mask interrupts
Bit 7 (PEN): PLL enable (only effective when the MCU is in IDLE or SLOW mode)
“0” : Disable PLL
“1” : Enable PLL
60 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
INTCON (R22h): Interrupt Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIE ADIE URXIE UTXIE UERRIE TMR2IE TMR1IE TMR0IE
Bit 6 (ADIE): A/D interrupt control bit
“0” : Disable
“1” : Enable
INTSTA (R23h): Interrupt Status Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CPIF ADIF URXI UTXI UERRI TMR2I TMR1I TMR0I
Bit 6 (ADIF): Set to 1 when A/D output data is ready to be read
Clear to “0” by software or disable A/D
8.8.2 Timing Diagram of General A/D Converter Application
MCU mode
FA/D
ADEN
CHS [2:0] = 010 ~ 101
CHS[2:0]
ADEN
ADSTART
FA/D
Internal d a ta o u t
ADIF
010
Tset2 Thld
Tcon
Tacq
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0D9
Clear to 0 au to matically
Figure 8-16 A/D Converter General Application Timing Diagram
011
8.8.3 Correlation between A/D Converter and MCU Mode
When MCU is in FAST mode: When MCU is in SLOW mode:
FAST mode
MCU mode
FA/D
ADEN
SLOW mode
ADSTART
(I nter nal ena ble A/ D
ADSTART
(I nter nal en able A/ D signal )
Figure 8-17 A/D Converter vs. MCU Mode
Product Specification (V0.1) 10.11.2007 • 61
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
Code Example:
;===A/D interrupt
PERIPH:
PUSH
JBC INTSTA,ADIF,Q_ADINT
BC INTSTA,ADIF
BS INTFLAG,F_IAD
Q_ADINT:
POP
RETI
; === Fpll=8MHz & ADCF=7 => FA/D=499kHz
AD_SR:
:
System setting 8MHz
Port B & D setting output port
:
;---PLL enable
BS CPUCON,PEN
;---Clock source is PLL
BS ADOTL,FSS
;---FA/D=499kHz
MOV A,#7
MOV ADCF,A
;---VRIN, Differential, ADIN3
MOV A,#00000010B
MOV ADCON,A ;---AD interrupt enable BS INTCON,ADIE BC INTSTA,ADIF BS CPUCON,GLINT
;===Fast mode: MCU in fast mode BS CPUCON,MS1 ;---AD wakeup BS ADOTL,ADWKEN ;--- Repeat detect A/D 3 times MOV A,#3 AD3times: ;---AD enable BS ADCON,ADEN Chk_AD: JBC INTFLAG,F_IAD,Chk_AD BC INTFLAG,F_IAD JDNZ ACC,AD3times ;===Slow mode: MCU in slow mode BC CPUCON,MS0 ;---Repeat detect A/D 3 times MOV A,#3 AD3times: ;---AD enable BS ADCON,ADEN Chk_AD: JBC INTFLAG,F_IAD,Chk_AD BC INTFLAG,F_IAD JDNZ ACC,AD3times ;---Out AD to Port B : D MOVRP PORTB,ADOTH MOV A,ADOTL AND A,#00000011B MOV PORTD,A :
62 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8.8.4 A/D Converter Flowchart
Touch Pad Functi on
MOV A,#122
MOV PFS,A
BS CPUCON,PEN
BS ADOTL ,FSS
BS ADOTL ,ADWKEN
MOV A,#7
MOV ADCF,A
MOV A, #11000000B
MOV ADCON,A
BS INTCON,ADIE
BC INTSTA, ADIF
BS CPUCON,GLI NT
BCCPUCON,MS1
BC ADCON,DET
BS INTFLAG,F1I TP
BS ADCON,DET
= 0
JBC INTFLAG,F_I TP
= 1
BCI NTFLAG,FI TP
MOVA , #3
BCA DCON,CHS0
BSADCON,ADEN
= 1
JBS ADCON,ADEN
> 0
MOVA, #3
= 0
JDNZ ACC
= 0
Syst em cl o ck
Hi gh f requency is 8MHz
Setti ng Touch Pad Contr ol Regi ster
Set PLL turn on
Cl ock sour ce i s PLL
AD wake-up enable
AD clock frequency = 499kHz
Set to VREX & dif ferential
AD i nterr upt enabl e
Al l un- mask ed i nterr upt enabl e
Setti ng CPU to Idl e mode
Touch panel pen down detecti on
mode and enable PIRQB int errupt and
wake-up f uncti on
Check i f T ouch Pad Pen Down occurs
XP detect 3 times for Idle mode
Touch Pad I nterr upt
PUSH STATUS
JBS
ADCON,PIRQB
= 1
JBS
INTFLAG,F1ITP
= 1
BC ADCON,DET
BS INTFLAG,F_ITP
BC INTFALG,F1ITP
POP STATUS
Touch Pad Functi on
AD I nterr upt
PUSH STATUS
JBC
INTSTA,ADI F
= 1
BC INTSTA ,ADIF
POP STATUS
Touch pad f uncti on
= 0
= 0
= 0
Check if Touch Pad Pen
Down occurs
Check T ouch pad bounc e
Touch pad OK
Check if A D Int errupt
occurs
BSA DCON,CHS0
BSA DCON,ADEN
= 1
JBS ADCON,ADEN
> 0
BSADCON,DET
= 0
JDNZ ACC
= 0
Goto Mai n Rout ine
YP detection 3 times for dle mode
Charge pen d own detect
Product Specification (V0.1) 10.11.2007 • 63
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
Code Example
:; *** Touch panel Interrupt INPTINT:
TPINT1:
Q_TPINT:
; === A/D interrupt PERIPH:
Q_ADINT:
; === Touch panel routine TP_SR:
TPILoop:
TPILp1:
; --- Repeat YP detect A/D 3 times
YP3times:
WaitYAD:
; --- Repeat XP detect A/D 3 times
XP3times:
WaitXAD:
SJMP TPILoop
PUSH JBS ADCON,PIRQB,Q_TPINT ; Touch screen status bit JBS INTFLAG,F1ITP,TPINT1 BC ADCON,DET ; Pen down detection disable BS INTFLAG,F_ITP ; Pen down ok flag
BC INTFLAG,F1ITP ; Pen down detect 2 times
POP RETI
PUSH JBC INTSTA,ADIF,Q_ADINT BC INTSTA,ADIF
POP RETI
: System setting 8MHz Port B & D setting output port : BS CPUCON,PEN ; PLL enable BS ADOTL,FSS ; Clock source is PLL BS ADOTL,ADWKEN ; AD wake-up MOV A,#7 MOV ADCF,A ; FA/D=499kHz MOV A,#11000000B MOV ADCON,A ; VREX, Differential BS INTCON,ADIE ; AD interrupt enable BC INTSTA,ADIF BS CPUCON,GLINT
BC ADCON,DET ; Pen down detection disable BS INTFLAG,F1ITP BS ADCON,DET ; Pen down detection enable
JBC INTFLAG,F_ITP,TPILp1 BC INTFLAG,F_ITP ; Clear Pen down flag
MOV A,#3
BS ADCON,CHS0 ; YP detection BS ADCON,ADEN ; AD enable
The buffer will ignore any write until shifting is completed. If you select 24 bits shift
buffer, it will include the SPRH, SPRM, and SPRL. However, if 8 bits shift buffer is
selected, only the SPRL register is included.
When writing data into the SPRL register, the SE bit of the SPICON register will be
set by hardware and shifting starts. When the shift buffer is empty, and the receive
buffer is full at the same time, the received data is shifted into SPRH, SPRM and
SPRL registers. After the SPRL register has been read out, the hardware will
automatically clear the RBF flag.
Product Specification (V0.1) 10.11.2007 • 67
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
SPICON (R3Fh): SPI Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
TLS1 TLS0 BRS2 BRS1 BRS0 EDS DORD SE
Bit 0 (SE): Shift enable. Set to “1” automatically when writing data into the SPRL
Bit 1 (DORD): Data transmission order
“0” : Shift left (MSB first)
“1” : Shift right (LSB first)
Bit 2 (EDS): Select the rising / falling edge latch by programming the EDS bit
“0” : Falling edge
“1” : Rising edge
register and shifting starts. Reset to “0” when a transfer buffer empty is
detected.
NOTE
The SE bit is read-only and is cleared by hardware when SPI is
enabled. Hence, writing to the SPRL register is necessary when user
wants to start shifting the data.
Bit 5 ~ Bit 3 (BRS2 ~ BRS0): Bit rate select. Programming the clock frequency/rates
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
SPISTA (R40h): SPI Status Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
WEN - SRBFIE SRBFI SPWKENSMP DCOL RBF
Bit 0 (RBF):Set to “1” by Buffer Full Detector, and automatically cleared to “0”
when data are read from the SPRL register.
NOTE
The RBF bit is cleared by hardware when SPI is enabled and this
bit becomes read-only. Hence, reading the SPRL register is
necessary to avoid data collision (DCOL) condition.
Bit 1 (DCOL): SPI Data collision
Bit 2 (SMP): SPI data input sample phase
“0” : Input data sampled at the middle of data output time
“1” : Input data sampl ed at the end of data output time
NOTE
In Slave mode, data input sample is fixed at the middle of data
output time.
Bit 3 (SPWKEN): SPI wake up enable control bit
“0” : Disable SPI (Slave mode) read buffer full wakeup
“1” : Enable SPI (Slave mode) read buffer full wakeup
Bit 4 (SRBFI): Set to “1” when an SPI read buffer full occurs. Clear to “0” by
software or disable SPI.
“0” : Data collision does not occur
“1” : Data collision occurs. Should be cleared by software
Bit 5 (SRBFIE): Control bit of SPI read buffer full interrupt
“0” : Disable interrupt function
“1” : Enable interrupt function
CPUCON (R0Eh): MCU Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Bit 2 (GLINT): Global interrupt control bit
“0” : Disable all interrupts
“1” : Enable all un-mask interrupts
Product Specification (V0.1) 10.11.2007 • 69
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8.9.5 SPI Timing Diagrams
Master Mode (Shift Buffer Length = 24Bits)
SCK
(EDS=0)
SCK
(EDS=1)
SDO
(DORD=0)
SDO
(DORD=1)
SDI
(DORD=0
SMP=0)
Data Sample
(SMP=0)
SDI
(DORD=1
SMP=1)
Data Sample
(SMP=1)
RBF
SE
Bit23 Bit22Bit22Bit23Bit0Bit1Bit2Bit3
Bit0Bit0 Bit1Bit1Bit23Bit21Bit20Bit22
Bit23 Bit22Bit22Bit23Bit0Bit1Bit2Bit3
Bit0Bit0 Bit1Bit1Bit23Bit21Bit20Bit22
Clock stops
when SE=0
Cleared when
reading data
from the
SPRL register
Set when
writing data to
SPRL register
Figure 8-19 SPI Master Mode Timing Diagram
Code Example: Master Mode (8bit)
;*** Interrupt SPI PERIPH: PUSH COMA DATACNT ;--- SPI read buffer full JBC SPISTA,SRBFI,Q_SPINT BC SPISTA,SRBFI BS INTFLAG,F_SPI ;--- SPI Data collision JBC SPISTA,DCOL,Q_SPINT MOV A,#0XFF Q_SPINT: MOV DATACNT,A POP RETI ;=== 8MHz/4 = 2000000 bit rate SPIM_SR: : System setting 8MHz Port D setting output port : ;--- 8bit,Fsystem/2, Rising edge& MSB MOV A,#11001100B MOV SPICON,A
;--- SPI full interrupt MOV A,#00100000B MOV SPISTA,A ;--- Global interrupt BS CPUCON,GLINT ;--- SPI data output => 55 MOV A,#0X55 MOV DATACNT,A SPI8LOOP: MOV A,DATACNT MOV SPRL,A ;--- SPI Data collision JBC SPISTA,DCOL,SPI8LP1 BC SPISTA,DCOL ;--- SPI data output resend => 55 MOV A,#0X55 MOV DATACNT,A SPI8LP1: JBC INTFLAG,F_SPI,SPI8LP1 SPI8LP2: BC INTFLAG,F_SPI MOVRP PORTD,SPRL SJMP SPI8LOOP
70 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
000 Melody Channel 1 Not use
001 Melody Channel 2 Not use
010 Melody Channel 3 Not use
011 Melody Channel 4 Not use
1×× Speech Channel -
8.10.1 Speech Function
The 11-bit speech timer is used at Channel 4. The clock source for the speech timer
is from Fper=F
/2. When R44 [2:0] = “1××,” the control register bank will change to
PLL
speech channel. An interrupt function is available for your application. The control
registers are listed as follows:
Code Opiton selected: “PAPUR register, DAC control bit ineffective” .
_
=
rateSampling
Fper
SPHTRL
1]0:10[
+
Code Opiton selected: “PAPUR register, DAC control bit effective” .
rateSampling×
_
Fper
SPHTRL
+=1]0:10[
SPHTPSR
Speech Prescaler = 1/SPHTPSR
72 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
SPHDR (R48h): Speech Data Register
In speech function control, SPHDR acts as an output window to the D/A converter
mixer. The program should write the synthesized data to SPHDR, and the data is fed
into the mixer at the next speech timer underflow. For correct mixing operation, the
value to be written to SPHDR must be an 8-bit signed data. The reset initial value is
“0”.
SPHTRL (R4Ah): Low byte of Speech Timer Auto-reload Register
The Speech timer is an 11-bit down counter for speech applications. The frequency
generated by the speech timer is determined by the value of the 11-bit auto-reload
register, including SPHTRL and SPHTRLH0 ~ SPHTRLH2 of SPHTCON. When the
counter value underflows, the timer interrupt will occur and auto-reload from the 11-bit
auto-reload register.
SPHTCON (R49h): Speech Timer Control Register
SPHTCON is used to determine the three MSB of the 11-bit auto-reload register and
enable/disable the speech timer. The reset initial value of SPHTCON is “0000 0000”.
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
CPUCON (R0Eh): MCU Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PEN - - SMCANDSMIER GLINT MS1 MS0
Bit 2 (GLINT): Global interrupt control bit
“0” : Disable all interrupts
“1” : Enable all un-masked interrupts
NOTE
1. When the PAPUR register & DAC bit are enabled and effective, the
following conditons occur:
a) Code option setting can use PAPUR register, SPHTPSR1~0,
and DAC bit.
b) The KE, /R2EN, and Bit7PU bit of PACON can NOT be used.
2. The code option setting is available only from the real chip but
cannot be simulated with the PM board.
8.11 DAC Function
The EPH3600 is embedded with only one DAC convert choices of speech outputs.
8.11.1 DAC Function Block Diagram
Mixer
If both SPHSB and VOEN bits are set to “1” and SPHTEN bit is cleared to “0”, the
data of the speech data register will be output immediately through the D/A converter
when the register changes.
VOEN
9
Figure 8-21 DAC Function Block Diagram
VOL0~VOL2
DAC
Code Option
DAC
8~32
DAO
680~1K5
Ω
8050
74 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
8.11.2 DAC Function Registers
VOCON (R4Bh): Voice Output Control Register
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
VOEN DAC - - - VOL2 VOL1 VOL0
Bit 0 ~ 2 (VOL0 ~ VOL2): Volume control of DAC
VOL2 ~ VOL0 Volume
000 1 (min.)
001 2
010 3
011 4
100 5
101 6
110 7
111 8 (max.)
Bit 6 (DAC): D/A converter output control bit
“0” : D/A converter output control is by speech timer
“1” : D/A output control is through SPHDR register
NOTE
1. When the PAPUR register & DAC bit are enabled and effective, the
following conditons occur:
a) Code option setting can use PAPUR register, SPHTPSR1~0,
and DAC bit.
b) The KE, /R2EN, and Bit7PU bit of PACON can NOT be used.
2. The code option setting is available only from the real chip but
cannot be simulated with the PM board.
Bit 7 (VOEN): Voice output control bit
“0” : DAC disabled
“1” : DAC enabled
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
9 Electrical Characteristic
9.1 Absolute Maximum Ratings
Items Sym. Condition Limits Unit
Supply voltage VDD -0.3 to +3.6 V
Input voltage (general input port) VIN -0.5 to VDD +0.5 V
Power Dissipation (Topr=70ºC) PD 300 mW
Operating temperature range TOPR -10 to +70 °C
Storage temperature range T STR -55 to +125 °C
9.2 Recommended Operating Conditions
Items Sym. Condition Limits Unit
Supply voltage
Input voltage
A/D full-Scale input span ADRG Positive input-negative input 0 to VREX V
Operating temperature TOPR - -10 to +70 °C
VDD 1.6 to 3.6
AVDD
-
2.4 to 3.6
VIH - VDD × 0.9 to VDDV
VIL - 0 to VDD × 0.1 V
V
9.3 DC Electrical Characteristics
Condition: Ta=-10~+70ºC, VDD= 3.0 ± 0.3V
Parameter Sym. Condition Min. Typical Max. Unit
Fmain
Clock
Supply
Current
Voltage
Input
Threshold
Voltage
(Schmitt)
Main-clock frequency
Fsub Sub-clock frequency
Idd1 Sleep mode
Idd2
Idle mode
Idd3
Idd5 Slow mode
Idd6
Fast mode
Idd7
VIH1 VDD×0.7 - VDD Input
PA[0:7], PB[0:7], PC[0:7], PD[0:7] (as general input port)
Enter IDLE MODE if MS1=1
Enter SLEEP MODE if MS1=0
Single repeat
0010 0111 rrrr rrrr RPT r
*(r) times on next instruction
*(r) is the content of register r
0100 0011 kkkk kkkk BANK #k BSR Å k None 1
0100 0000 kkkk kkkk TBPTL #k TABPTRL Å k None 1
0100 0001 kkkk kkkk TBPTM #k TABPTRM Å k None 1
0100 0010 kkkk kkkk TBPTH #k TABPTRH Å k None 1
0010 11 i i rrrr rrrr TBRD i,r rÅROM[(TABPTR)]
0010 1111 rrrr rrrr TBRD A,r rÅROM[(TABPTR+ACC)]
1, 2
None 2
2
None 2
0010 0100 rrrr rrrr CLR r r Å 0 Z 1
0100 1110 kkkk kkkk MOV A,#k A Å k None 1
0010 0000 rrrr rrrr MOV A,r A Å r Z 1
0010 0001 rrrr rrrr MOV r,A r Å A None 1
100p pppp rrrr rrrr MOVRP p,r Register p Å Register r None 1
101p pppp rrrr rrrr MOVPR r,p Register r Å Register p None 1
0000 1111 rrrr rrrr SWAP r r(0:3)ÅÆr(4:7) None 1
0000 1110 rrrr rrrr SWAPA r r(0:3)ÆA(4:7);r(4:7)ÆA(0:3) None 1
0110 1bbb rrrr rrrr BC r,b r(b) Å 0 None 1
0111 0bbb rrrr rrrr BS r,b r(b) Å 1 None 1
0111 1bbb rrrr rrrr BTG r,b r(b) Å /r(b) None 1
0001 1100 rrrr rrrr INCA r A Å r+1. C,Z 1
0001 1101 rrrr rrrr INC r r Å r+1 C,Z 1
0001 0000 rrrr rrrr ADD A,r A Å A+r C,DC,Z,OV,SGE,SLE 1
0001 0001 rrrr rrrr ADD r,A r Å r+A 3 C,DC,Z,OV,SGE,SLE 1
0100 1010 kkkk kkkk ADD A,#k A Å A+k C,DC,Z,OV,SGE,SLE 1
0001 0010 rrrr rrrr ADC A,r A Å A+r+C C,DC,Z,OV,SGE,SLE 1
0001 0011 rrrr rrrr ADC r,A r Å r+A+C C,DC,Z,OV,SGE,SLE 1
0100 1011 kkkk kkkk ADC A,#k A Å A+k+C C,DC,Z,OV,SGE,SLE 1
0001 1110 rrrr rrrr DECA r A Å r-1 C,Z 1
0001 1111 rrrr rrrr DEC r rÅ r-1 C,Z 1
0001 0110 rrrr rrrr SUB A,r A Å r-A 4 C,DC,Z,OV,SGE,SLE 1
0001 0111 rrrr rrrr SUB r,A r Å r-A 4 C,DC,Z,OV,SGE,SLE 1
0100 1100 kkkk kkkk SUB A,#k A Å k-A 4 C,DC,Z,OV,SGE,SLE 1
0001 1000 rrrr rrrr SUBB A,r A Å r-A-/C 4 C,DC,Z,OV,SGE,SLE 1
0001 1001 rrrr rrrr SUBB r,A r Å r-A-/C 4 C,DC,Z,OV,SGE,SLE 1
0100 1101 kkkk kkkk SUBB A,#k A Å k-A-/C
4
C,DC,Z,OV,SGE,SLE 1
None 1
None 1
80 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
(Continued)
Type Instruction Binary Mnemonic Operation Status Affected Cycles
0010 0110 rrrr rrrr MUL A,r PRODH:PRODL Å A*r None 1
0100 1111 kkkk kkkk MUL A,#k PRODH:PRODL Å A*k None 1
Arithmetic
Operation
Logic
Operation
Rotate
Shift
Bit
Compare &
Jump
Compare 0010 0101 rrrr rrrr TEST r Z Å 0 if r<>0;Z Å 1 if r=0 Z 1
Compare &
Jump
0001 0100 rrrr rrrr ADDDC A,r A Å (Decimal ADD) A+r+C C, DC, Z 1
0001 0101 rrrr rrrr ADDDC r,A r Å (Decimal ADD) r+A+C C, DC, Z 1
0001 1010 rrrr rrrr SUBDB A,r A Å (Decimal SUB) r-A-/C C, DC, Z 1
0001 1011 rrrr rrrr SUBDB r,A r Å (Decimal SUB) r-A-/C C, DC, Z 1
0000 0010 rrrr rrrr OR A,r A Å A .or. r Z 1
0000 0011 rrrr rrrr OR r,A r Å r .or. A Z 1
0100 0100 kkkk kkkk OR A,#k A Å A .or. k Z 1
0000 0100 rrrr rrrr AND A,r A Å A .and. r Z 1
0000 0101 rrrr rrrr AND r,A r Å r .and. A Z 1
0100 0101 kkkk kkkk AND A,#k A Å A .and. k Z 1
0000 0110 rrrr rrrr XOR A,r A Å A .xor. r Z 1
0000 0111 rrrr rrrr XOR r,A r Å r .xor. A Z 1
0100 0110 kkkk kkkk XOR A,#k A Å A .xor. k Z 1
0000 1000 rrrr rrrr COMA r A Å /r. Z 1
0000 1001 rrrr rrrr COM r r Å /r. Z 1
0000 1010 rrrr rrrr RRCA r A(n-1) År(n);C År(0);A(7) ÅC C 1
0000 1011 rrrr rrrr RRC r r(n-1) År(n);C År(0);r(7) ÅC C 1
0000 1100 rrrr rrrr RLCA r A(n+1) År(n);C År(7);A(0) ÅC C 1
0000 1101 rrrr rrrr RLC r r(n+1) År(n);C År(7);r(0) ÅCC 1
0010 0010 rrrr rrrr SHRA r A(n-1)År(n); A(7)ÅC None 1
0010 0011 rrrr rrrr SHLA r A(n+1)År(n); A(0)ÅC None 1
0101 1bbb rrrr rrrr
aaaa aaaa aaaa aaaa
0110 0bbb rrrr rrrr
aaaa aaaa aaaa aaaa
0101 0000 rrrr rrrr
aaaa aaaa aaaa aaaa
0101 0001 rrrr rrrr
aaaa aaaa aaaa aaaa
0101 0010 rrrr rrrr
aaaa aaaa aaaa aaaa
0101 0011 rrrr rrrr
a
aaa aaaa aaaa aaaa
0100 0111 kkkk kkkk
aaaa aaaa aaaa aaaa
0100 1000 kkkk kkkk
aaaa aaaa aaaa aaaa
0100 1001 kkkk kkkk
aaaa aaaa aaaa aaaa
JBC r,b,addr
JBS r,b,addr
JDNZ A,r,addr
JDNZ r,addr
JINZ A,r,addr
JINZ r,addr
JGE A,#k,addr
JLE A,#k,addr
JE A,#k,addr
If r(b)=0,jump to addr;
PC[15:0] Å addr.
If r(b)=1,jump to addr;
PC[15:0] Å addr.
A Å r-1, jump to addr if not zero;
5
5
PC [15:0] Å addr.5
r Å r-1, jump to addr if not zero;
PC [15:0] Å addr.5
A Å r+1,jump to addr if not zero;
PC[15:0] Å addr.5
r Å r+1,jump to addr if not zero;
PC[15:0] Å addr.5
Jump to addr if Ak;
PC [15:0] Å addr.
Jump to addr if Ak;
PC [15:0] Å addr.
Jump to addr if A=k;
PC[15:0] Å addr.
5
5
5
None 2
None 2
None 2
None 2
None 2
None 2
None 2
None 2
None 2
Product Specification (V0.1) 10.11.2007 • 81
(This specification is subject to change without further notice)
EPH3600
RISC II Series Microcontroller
(Continued)
Type Instruction Binary Mnemonic Operation Status Affected Cycles
Jump to addr if Ar;
PC[15:0] Å addr.
Jump to addr if Ar;
PC[15:0] Å addr.
Jump to addr if A=r;
PC[15:0] Å addr.
5
5
5
PC Å addr;
PC [13..16] unchanged
None 2
None 2
None 2
None 1
PC Å addr. None 2
Top of Stack] Å PC+1;
PC [11:0] Å addr;
PC [12:16] Å 00000
6
None 1
[Top of Stack] Å PC+1;
PC [12:0] Å addr;
None 1
PC [13:16] unchanged.
[Top of Stack] Å PC+1;
PC Å addr
0000 0000 0011 aaaa
aaaa aaaa aaaa aaaa
0010 1011 1111 1110 RET PC Å (Top of Stack) None 1
0010 1011 1111 1111 RETI
1
TBRD i, r:
rÅ ROM [(TABPTR)];
i=00: TABPTR no change
i=01: TABPTRÅTABPTR+1
i=10: TABPTRÅTABPTR-1
2
TABPTR=(TABPTRH: TABPTRM: TABPTRL)
Bit 0 = 0: Low byte of the pointed ROM data
Bit 0 = 1: High byte of the pointed ROM data
The maximum table look up space is internal 8 Mbytes.
3
Carry bit of ADD PCL, A or ADD TABPTRL, A will automatically carry into PCM or TABPTRM.
The Instruction cycle for writing to the PC (program counter) takes 2 cycles.
4
When in SUB operation, borrow flag is indicated by the inverse of carry bit, i.e., B = /C.
5
The maximum jump range is 64K absolute address, which means it can only jump within the same 64K
range.
6
S0CALL address ability is from 0x000 to 0xFFF (4K space).
LCALL addr
(2 words)
82 •Product Specification (V0.1) 10.11.2007
(This specification is subject to change without further notice)
12 Pad Diagram
EPH3600
RISC II Series Microcontroller
(0,0)
TEST
PL L C
OSCI
OSCO
RSTB
VREX
VDD
PC. 7
PC. 6
PC. 5
PC. 4
18
19
20
21
22
23
24
25
26
27
28
31 32 33 34 35 36 37 38
PC. 3
PC. 2
PC. 1
PB .0
PC. 0
PB .1
Figure 12-1 EPH3600 Pad Locations
Chip size: 2580 * 3200 µm
Pad size: 90 * 90 µm
EPH3600
PB .2
PB .3
PB .4
2
2
62
PA . 7
61
PA . 6
60
PA . 5
59
PA . 4
58
PA . 3
57
PA . 2
56
PA . 1
55
PA . 0
54
PD .7
53
PD .6
45 46 47 48 49 5039 40 41 42 43 44
PB .5
PB .6
PB .7
VSS
PD . 0
PD . 1
PD . 2
PD . 3
PD . 4
VDD
PD . 5
Minimum pitch: 105 µm
Product Specification (V0.1) 10.11.2007 • 83
(This specification is subject to change without further notice)