The contents of this specification are subject to change without further 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. ELA N Microelectronics shall not
be liable for direct, indirect, special inciden tal, or co nsequential damages arising from th e use of su ch inform ation
or materia l .
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 Microelectro nics product in such applications is not supported and is prohibited.
NO PART OF THIS SPECIFICATION MA Y BE REPRODUCED OR TRANSMITTED IN ANY FORM OR BY
ANY MEANS WITHOUT THE E XPRESSED WRITTEN PERMISSION OF ELAN MICROELECTRONICS.
A Package Type: ............................................................................................................64
Specification Revision History
Doc. Version Revision Description Date
1.0 Initial Version 2006/10/03
iv •Product Specification (V1.0) 10.03.2006
EM78P312N
8-Bit Microcontroller
1 General Description
The EM78P312N is an 8-bit microprocessor with low-power, high-speed CMOS technology and high noise immunity. It
has an on-chip 4K×13-bits Electrical One Time Programmable Read Only Memory (OTP-ROM). It provides
multi-protecti on bits to prevent intrusion of user’s OTP memory codes. Seven Option bits are also available to meet
user’s requirements. With its OTP-ROM feature, the EM78P312N provides a convenient way of developing and verifying
user’s programs. Moreover, this OTP device offers the advantages of easy and effective program updates, using
development and programming tools. User can avail of the ELAN Writer to easily program his development code.
2 Features
CPU configuration
z 4K×13 bits on-chip ROM
z 144×8 bits on-chip registers (SRAM)
z 8-level stacks for subroutine nesting
z Less than 3.5mA at 5V/8MHz
z Typically 0.8 μA, during sleep mode
z Typically 1.1 μA, during idle mode
I/O port configuration
z 4 bidirectional I/O ports : P6, P7, P8, P9
z 22 I/O pins
z 10 Programmable pull-down I/O pins
z 10 programmable pull-high I/O pins
z External interrupt : P60, P61, P73, P80
Operating voltage range:
z OTP version
Operating voltage range:2.5v~5.5v
Operating temperature range:
z -40~85°C
Operating frequency range:
Main clock
• Crystal mode:
DC ~ 20MHz/2clks @ 5V; DC ~100ns inst. cycle @ 5V
DC ~ 8MHz/2clks @ 3V;DC ~ 250ns inst. cycle @ 3V
z 8-bit channels Analog-to-Digital Converter with 10-bit
resolution
z Time Base Timer:(1Hz~16kHz at 8MHz)
z Key tone output:(1kHz~8kHz at 8MHz)
z 8-bit channels Analog-to-Digital Converter with 10-bit
resolution
Fifteen available interrupts:
z WDT time-out interrupt
z TCC overflow interrupt
z Time base timer interrupt (the first falling edge of the
source clock)
z Serial UART transmit interrupt
z Serial UART receive interrupt
z Serial UART receive error interrupt
z Four External interrupt
z ADC completion interrupt
z TC2 overflow interrupt
z TC3 overflow interrupt
z TC4 overflow interrupt
z Serial SPI interrupt
Special features
z Programmable free running watchdog timer
z Two clocks per instruction cycle
z Power-on Reset
z High noise immunity
z Power saving Sleep mode
z Selectable Oscillation mode
Package type:
z 28-pin DIP 600 mil: EM78P312NP
z 28-pin Skinny DIP 300 mil: EM78P312NAK
z 28-pin Skinny DIP 400 mil: EM78P312N
z 28-pin SOP 300 mil: EM78P312NM
z 28-pin SSOP 209 mil: EM78P312NS
Crystal type: Output terminal for crystal oscillator
RC type: Instruction clock output
External clock signal input
Input pin with Schmitt Trigger. If this pin remains at logic low, the
controller will also remain in reset condition.
8-bit bidiectional input/output pins.
P60 can be used as external Interrupt 0 (/INT0).
P61 can be used as external Interrupt 1 (INT1).
P62 can be used as 16-bit Timer/Counter 2 (TC2).
P63 can be used as divider output (/TONE).
P64 slave mode enable (/SS).
P60 ~ P63 can be used as pull-high or pull-low pins.
8-bit bidiectional input/output pins.
P70 can be used as SPI serial clock input/output (/SCK)
P71 can be used as SPI serial data input (SI) or UART data receive
input (RX)
P72 can be used as SPI serial data output (SO) or UART data
transmit output (TX)
P73 can be used as Sleep mode release input (/SLEEP) or external
interrupt Input 5 (/INT5)
P70 ~ P73 can be used as pull-high or pull-low pins
2-bit bidiectional input/output pins.
P80 can be used as 8-bit Timer/Counter 3 (TC3) or external
Interrupt Input 3 (INT3).
P81 can be used as 8-bit Timer/Counter 4 (TC4) or programmable
divider output (PDO).
P80 ~ P81 can be used as pull-high or pull-low pins.
8-bit bidiectional input/output pins.
P90~P97 can be used as 8 channel 10-bit resolution A/D converter.
P97 can be used as AD reference power supply input (VREF).
2 •
Product Specification (V1.0) 10.03.2006
(This specification is subject to change without further notice)
5 Function Description
5.1 Functional Block Diagram
EM78P312N
8-Bit Microcontroller
P9
P90
P91
P92
P93
P94
P95
P96
P97
P8
P80
P81
P7
P70
P71
P72
P73
P74
P75
P76
P77
P6
P60
P61
P62
P63
P64
P65
P66
P67
ACC
ROM
Instruction
Register
Instruction
Decoder
ALU
R3
Status Reg.
PC
8-level stack
(13 bit)
Interrupt
Control
Register
Interrupt
Circuit
R4
Ext.
OSC.
Oscillation
Generation
Reset
Mux
.
RAM
Ext.
RC
Start-up
Timer
WDT
TC2
TC3
TC4
UART
SPI
TCC
TBKTC
ADC
TC2
TC3
TC4
TX RX
Sin Sout
SCK
TCC
Keytone
Ext INT0
Ext INT3Ext INT1Ext INT5
Fig. 5-1 Functional Block Diagram
Product Specification ( V 1 . 0) 10 . 0 3 . 2 006
(This specification is subject to change without further notice)
• 3
Ain 0~7
EM78P312N
8-Bit Microcontroller
5.2 Operating Registers
Address
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
:
1F
Register
Bank 0
R0/ IAR
R1/ TCC
R2/ PC
R3/ SR
R4/ RSR
SCR
Port 6
Port 7
Port 8
Port 9
Reserved
TC4CR
TC4D
ISFR0
ISFR1
ISFR2
16 Byte
Common Register
Register
Bank 1
R3 (7, 6) = (0, 1)
TC3CR
TC3DA
TC3DB
TC2CR/ ADDL
TC2DH
TC2DL
ADCR
ADIC
ADDH
TBKTC
Reserved
Register
Bank 2
R3 (7, 6) = (1, 0)R3 (7, ) = (1, 1)
URC1
URC2
URS
URRD
URTD
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Register
Bank 3
SPIC1
SPIC2
SPID
Reserved
Reserved
PHC1
PLC1
PHC2
PLC2
Reserved
Reserved
Control
Register
Reserved
IOC6
IOC7
IOC8
IOC9
Reserved
INTCR
ADOSCR
Reserved
IMR1
IMR2
20
:
3F
Bank 0
R4 (7, 6) = (0, 0)
32 Byte
Common Register
Bank 1
R4 (7, 6) = (0, 1)
32 Byte
Common Register
Fig. 5-2 Operating Registers
4 •
Product Specification (V1.0) 10.03.2006
(This specification is subject to change without further notice)
EM78P312N
8-Bit Microcontroller
R0 (Indirect Addressing Register)
R0 is not a physically implemented register. Its major function is to act as an indirect
addressing pointer. Any instruction using R0 as a pointer actually accesses data
pointed by the RAM Select Register (R4).
R1 (Time Clock /Counter)
This register is writable and readable just like the other registers. The contents of the
prescaler counter are cleared only when a value is written into the TCC register.
R2 (Program Counter) & Stack
z Depending on the device type, R2 and hardware stack are 10-bit wide. The
structure is depicted in Fig.5-3.
z Generates 8192 ×13 bits on-chip OTP ROM addresses to the relative
programming instruction codes. One program page is 1024 words long.
z R2 is set as all "0"s when under RESET condition
z "JMP" instruction allows direct loading of the lower 10 program counter bits.
Thus, "JMP" allows the PC to go to any location within a page.
z "CALL" instruction loads the lower 10 bits of the PC, and then PC+1 is pushed
onto the stack. Thus, the subroutine entry address can be located
anywhere within a page.
z "RET" ("RETL k", "RETI") instruction loads the program counter with the
contents of the top-level stack.
z All instructions are single instruction cycle (fclk/2 or fclk/4) except for the
instruction that would change the contents of R2. Such instruction will need
one more instruction cycle.
z For an interrupt trigger, the program ROM will jump to individual interrupt
vector at Page 0. The CPU will store ACC, R3 status and R5 PAGE
automatically, it will restore after instruction RETI.
Product Specification( V 1 . 0) 10 . 0 3 . 2 006
(This specification is subject to change without further notice)
• 5
EM78P312N
8-Bit Microcontroller
R5
PC
A12
000 : PAGE0 0000~03F F
001 : PAGE1 0400~07F F
010 : PAGE2 0800~0BFF
011 : PAGE3 0C00~0FFF
100 : PAGE4 1000~13F F
101 : PAGE5 1400~17F F
110 : PAGE6 1800~1BFF
111 : PAGE7 1C00~1FFF
INT3R = “1” : Rising edge is detected
Bit 1 ( WDTIF ) : WDT time-out flag, flag cleared by software.
Bit 0 ( EXIF0 ) : External interrupt flag (INT0). Flag cleared by software. If the INT0EN
is reset to “0”, the flag is cleared.
Product Specification( V 1 . 0) 10 . 0 3 . 2 006
(This specification is subject to change without further notice)
• 9
EM78P312N
8-Bit Microcontroller
RE (Interrupt Status Flag Register 1)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
EXIF5 TCIF2 ADIF 0 EXIF3 TCIF4 SPIF TCIF3
Bit 7 ( EXIF5 ) : External Interrupt Flag (/INT5), flag cleared by software.
Bit 6 ( TCIF2 ) : 16-bit Timer/Counter 2 Interrupt Flag, flag cleared by software.
Bit 5 ( ADIF ) : AD conversion complete flag, flag cleared by software.
Bit 3 ( EXIF3 ) : External Interrupt Flag (/INT3), flag cleared by software.
Bit 2 ( TCIF4 ) : 8-bit Timer/Counter 4 Interrupt Flag, flag cleared by software.
Bit 1 ( SPIF ) : SPI Mode Interrupt Flag, flag cleared by software.
Bit 0 ( TCIF3 ) : 8-bit Timer/Counter 3 interrupt flag, flag cleared by software.
0 : means no interrupt request
1 : means with interrupt request
z ISFR1 can be cleared by instruction, but cannot be set by instruction
z IMR1 is the interrupt mask register
z Note that reading ISFR1 will obtain the result of the ISFR1 "logic AND" and
IMR1.
RF(Interrupt Status Flag Register 2)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 UERRIF RBFF TBEF TBIF EXIF1 0 TCIF0
Bit 6 (U ERRI F ) : UART Receiving Error Interrupt, cleared by software or UART
disabled.
Bit 5 (RBFF) : UART Receive Mode Data Buffer Full Interrupt Flag. Flag cleared by
software.
Bit 4 (TB E F ) : UART Transmit Mode Data Buffer Empty Interrupt Flag. Flag cleared by
software.
Bit 3 (TBIF) : Time Base Timer Interrupt Flag. Flag cleared by software.
Bit 2 (EXIF1) : External Interrupt Flag (INT1). Flag cleared by software.
Bit 0 (TCIF0) : TCC Overflow Interrupt Flag. Set as TCC overflows; flag cleared by
software.
0 : means no interrupt request
1 : means with interrupt request
10 •
Product Specification (V1.0) 10.03.2006
(This specification is subject to change without further notice)
EM78P312N
8-Bit Microcontroller
z ISFR2 can be cleared by instruction, but cannot be set by instruction
z IMR2 is the interrupt mask register
z Note that reading ISFR2 will obtain the result of the ISFR2 "logic AND" and
IMR2
Bank 1 R5 TC3CR (Timer/Counter 3 Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
TC3CAP TC3S TC3CK1 TC3CK0 TC3M 0 0 0
Bit 7 ( TC3CAP ) : Software capture control
TC3CAP = “0” : -
TC3CAP = “1” : Software capture
Bit 6 ( TC3S ) : Timer/Counter 3 start control
TC3S = “0” : Stop and counter clear
TC3S = “1” : Start
Bit 5 ~ Bit 4 ( TC3CK1 ~ TC3CK0 ) : Timer/Counter 3 Clock Source Select