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 conta ined in this specificati on. ELAN Microelectronics sha ll not
be liable for direct, indirect, special incide ntal, or conseque ntial dama ges arising from the use of s uch information
or material.
The software (if any) described in this specification is furnished under a license or nond isclosure agreement, and
may be used or copied only in accordance wi th 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 sup porte d and is prohibite d.
NO P A RT OF THIS SPECIFICATION MAY BE REPRODUCED OR TRANSMI TTED IN ANY FORM OR BY
ANY MEANS WITHOUT THE EXPRESSED WRITTEN PERMISSION OF ELAN MICROELECTRONICS.
Flat A, 19F. , World T ech Centre 95
How Ming Street, Kwun Tong
Kowloon, HONG KONG
Tel: +852 2723-3376
Fax: +852 2723-7780
elanhk@emc.com.hk
Shenzhen:
Elan Microelectronics
Shenzhen, Ltd.
3F , SSME C Bldg., Gaoxin S . A ve. I
Shenzhen Hi-tech Industrial Park
(South Area) Shenzhen
CHINA 518057
Tel: +86 755 2601-0565
Fax: +86 755 2601-0500
USA:
Elan Information Technology
Group (USA)
1821 Saratoga Ave., Suite 250
Saratoga, CA 95070
USA
Tel: +1 408 366-8225
Fax: +1 4 08 366-8220
Shanghai:
Elan Microelectronics
Shanghai, Ltd.
#23, Zone 115, Lane 572, Bibo Rd.
Zhangjiang Hi-Tech Park
Shanghai, CHINA 201203
Tel: +86 21 5080-3866
Fax: +86 21 5080-4600
Contents
Contents
1 General Description.................................................................................................. 1
1.1 Added the IRC drift rate in the feature 2006/05/29
1. Improved the contents and format of the Features
section, Fig.4-1 EM78P259N/260N Functional Block Diagram, Fig.6-2 TCC and WDT Block Diagram and
Fig.6-11 IR/PWM System Block Diagram.
5. Modified Section 8.1 AD Converter Characteristics,
Section 8.2 Comparator (OP) Characteristics and
Appendix A. Package Type.
2007/05/18
vi •Product Specification (V1.2) 05.18.2007
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
1 General Description
The EM78P259N and EM78P260N are 8-bit microprocessors designed and developed with low-power and
high-speed CMOS technology. The series has an on-chip 2K×13-bit Electrical One Time Programmable
Read Only Memory (OTP-ROM). It provides a protection bit to prevent intrusion of user’s code. Three Code
option words are also available to meet user’s requirements.
With its enhanced OTP-ROM feature, the EM78P259N and EM78P260N provide 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.
(This specification is subject to change without further notice)
Drift Rate
Voltage
(2.3V~5.5V)
Process Total
• 1
All these four main frequencies can be trimmed by
programming with four calibrated bits in the
ICE259N Simulator. OTP is auto trimmed by ELAN
Writer.
Peripheral configuration
• 8-bit real time clock/counter (TCC) with
selective signal sources, trigger edges, and
overflow interrupt
• 8-bit real time clock/counter (TCCA, TCCC) and
16-bit real time clock/counter (TCCB) with
selective signal sources, trigger edges, and
overflow interrupt
• 4-bit channel Analog-to-Digital Converter with
12-bit resolution in Vref mode
• Easily implemented IR (Infrared remote control)
application circuit
Crystal type: Crystal input terminal or external clock input pin.
RC type: clock output with a duration of one instruction cycle
External clock signal input
If set as /RESET and remains at logic low, the device will be
reset
Voltage on /RESET/Vpp must not exceed Vdd during normal
mode
External Counter input
TCC is defined by CONT <5>
I
TCCA is defined by IOC80 <1>
TCCB is defined by IOC90 <5>
TCCC is defined by IOC90 <1>
Analog to Digital Converter
I
Defined by ADCON (R9) <1:0>
IR mode output pin, capable of driving and sinking
current=20mA when the output voltage drops to 0.7Vdd and
rise to0.3Vdd at Vdd=5V.
External reference voltage for ADC
Defined by ADCON (R9) <7>
External interrupt pin triggered by a falling or rising edge
Defined by CONT <7>
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 3
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
5.2 EM78P260NP/M/KM
Symbol Pin No. Type Function
P70 16 I/O
P60~P67 7~14 I/O
P50~P57
CIN-, CIN+
CO
OSCI 17 I
OSCO 16 I/O
/RESET 5 I
TCC, TCCA,
TCCB, TCCC
ADC0~ADC3
IR OUT 14 O
VREF 4 I
/INT 7 I
VDD 15 – Power supply
VSS 6 – Ground
1~4
17~20
13, 12
11
4, 8,
9, 10
2, 3,
18, 19
General purpose input/output pin
Default value after a power-on reset
General purpose input/output pin
Open-drain
Default value after a power-on reset
General purpose input/output pin
Pull-high/pull-down
I/O
Default value after a power-on reset
Wake up from sleep mode when the status of the pin changes
“-“ : the input pin of Vin- of the comparator
“+” : the input pin of Vin+ of the comparator
I
O
Pin CO is the comparator output
Defined by IOC80 <4:3>
Crystal type: Crystal input terminal or external clock input pin.
RC type: clock output with a duration of one instruction cycle
External clock signal input
If set as /RESET and remains at logic low, the device will be
reset
Voltage on /RESET/Vpp must not exceed Vdd during normal
mode
External Timer/Counter input
TCC is defined by CONT <5>
I
TCCA is defined by IOC80 <1>
TCCB is defined by IOC90 <5>
TCCC is defined by IOC90 <1>
Analog to Digital Converter
I
Defined by ADCON (R9) <1:0>
IR mode output pin, capable of driving and sinking
current=20mA when the output voltage drops to 0.7Vdd and
rise to0.3Vdd at Vdd=5V.
External reference voltage for ADC
Defined by ADCON (R9) <7>
External interrupt pin triggered by a falling or rising edge
Defined by CONT <7>
4 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
6 Function Description
6.1 Operational Registers
6.1.1 R0 (Indirect Address Register)
R0 is not a physically implemented register. Its major function is to perform as an
indirect address pointer. Any instruction using R0 as a pointer, actually accesses the
data pointed by the RAM Select Register (R4).
6.1.2 R1 (Time Clock /Counter)
Increased by an external signal edge which is defined by the TE bit (CONT-4)
through the TCC pin, or by the instruction cycle clock.
Writable and readable as any other registers
The TCC prescaler counter (IOCC1) is assigned to TCC
The contents of the IOCC1 register is cleared –
• when a value is written to the TCC register.
• when a value is written to the TCC prescaler bits (Bits 3, 2, 1, 0 of the CONT
register)
•during power-on reset, /RESET, or WDT time out reset.
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.1.3 R2 (Program Counter) and Stack
R3
A9 A8 A10
00 PAGE0 0000~03FF
01 PAGE1 0400~07FF
R2 and hardware stacks are 12-bit wide. The structure is depicted in the table
under Section 6.1.3.1, Data Memory Configuration (subsequent page).
Generates 2K×13 bits on-chip ROM addresses to the relative programming
instruction codes. One program page is 1024 words long.
000H
003H
~
01EH
3FEH
7FFH
User Memory Space
The contents of R2 are all set to "0"s when a reset condition occurs.
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 5
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
"JMP" instruction allows direct loading of the lower 10 program counter bits. Thus,
"JMP" allows PC to jump to any location within a page.
"CALL" instruction loads the lower 10 bits of the PC, and then PC+1 is pushed into
the stack. Thus, the subroutine entry address can be located anywhere within a
page.
"RET" ("RETL k", "RETI") instruction loads the program counter with the contents
of the top of stack.
"ADD R2, A" allows a relative address to be added to the current PC, and the ninth
and above bits of the PC will increase progressively.
"MOV R2, A" allows loading of an address from the "A" register to the lower 8 bits of
the PC, and the ninth and tenth bits (A8 ~ A9) of the PC will remain unchanged.
Any instruction (except “ADD R2,A”) that is written to R2 (e.g., "MOV R2, A", "BC
R2, 6", etc.) will cause the ninth bit and the tenth bit (A8 ~ A9) of the PC to remain
unchanged.
In the case of EM78P259N/260N, the most significant bit (A10) will be loaded with
the content of PS0 in the status register (R3) upon execution of a "JMP", "CALL", or
any other instructions set which write to R2.
All instructions are single instruction cycle (fclk/2 or fclk/4) except for the
instructions that are written to R2. Note that these instructions need one or two
instructions cycle as determined by Code Option Register CYES bit.
6 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.1.3.1 Data Memory Configuration
Address R PAGE registersIOCX0 PAGE registers
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
R0
(Indirect Addressing Register)
R1
(Time Clock Counter)
R2
(Program Counter)
R3
(Status Register)
R4
(RAM Select Register)
R5
(Port 5)
R6
(Port 6)
R7
(Port 7)
(ADC Input Select Register
R8
R9
(ADC Control Register)
(ADC Offset Calibration
RA
Register)
(The converted value
RB
AD11~AD4 of ADC)
(The converted value
RC
AD11~AD8 of ADC)
(The converted value
RD
AD7~AD0 of ADC)
(Interrupt Status 2 and
RE
Wake-up Control Register
(Interrupt Status Register 1)
RF
Reserve
CONT
(Control Register)
Reserve
Reserve
Reserve
IOC50
(I/O Port Control Register)
IOC60
(I/O Port Control Register)
IOC70
(I/O Port Control Register)
(Comparator and TCCA
IOC80
Control Register)
(TCCB and TCCC
IOC90
Control Register)
(IR and TCCC Scale
IOCA0
Control Register)
(Pull-down Control
IOCB0
Register)
(Open-drain Control
IOCC0
Register)
IOCD0
(Pull-high Control Register)
(WDT Control Register and
IOCE0
Interrupt Mask Register 2)
IOCF0
(Interrupt Mask Register 1)
IOCX1 PAGE registers
Reserve
Reserve
Reserve
Reserve
Reserve
IOC51
IOC61
IOCA1
IOCB1
IOCC1
(TCCA Counter)
(TCCB LSB Counter)
IOC71
(TCCB HSB Counter)
IOC81
(TCCC Counter)
IOC91
(Low Time Register)
(High Time Register)
(High Time and Low Time
Scale control Register)
(TCC Prescaler Control)
Reserve
Reserve
Reserve
10
︰
1F
20
:
3F
General Registers
Bank 0Bank 1
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 7
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.1.4 R3 (Status Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
RST IOCS PS0 T P Z DC C
Bit 7 (RST): Bit of reset type
Set to “1” if wake-up from sleep on pin change, comparator status
change, or AD conversion completed. Set to “0” if wake-up from other
reset types
Bit 6 (IOCS): Select the Segment of IO control register
0 = Segment 0 (IOC50 ~ IOCF0) selected
1 = Segment 1 (IOC51 ~ IOCC1) selected
Bit 5 (PS0): Page select bits. PS0 is used to select a program memory page. When
executing a "JMP," "CALL," or other instructions which cause the
program counter to change (e.g., MOV R2, A), PS0 is loaded into the
11th bit of the program counter where it selects one of the available
program memory pages. Note that RET (RETL, RETI) instruction does
not change the PS0 bit. That is, the return address will always be back
to the page from where the subroutine was called, regardless of the
current PS0 bit setting.
PS0 Program Memory Page [Address]
0 Page 0 [000-3FF]
1 Page 1 [400-7FF]
Bit 4 (T):Time-out bit. Set to “1” by the "SLEP" and "WDTC" commands or during
power on; and reset to “0” by WDT time-out (see Section 6.5.2, The T
and P Status under STATUS Register for more details).
Bit 3 (P):Power-down bit. Set to “1” during power-on or by a "WDTC" command
and reset to “0” by a "SLEP" command (see Section 6.5.2, The T and P
Status under STATUS Register for more details).
Bit 2 (Z):Zero flag. Set to "1" if the result of an arithmetic or logic operation is
zero.
Bit 1 (DC): Auxiliary carry flag
Bit 0 (C): Carry flag
6.1.5 R4 (RAM Select Register)
Bit 7: Set to “0” all the time
Bit 6: Used to select Bank 0 or Bank 1 of the register
Bits 5~0: Used to select a register (Address: 00~0F, 10~3F) in indirect addressing
mode
See the table under Section 6.1.3.1, Data Memory Configuration for data memory
configuration.
8 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.1.6 R5 ~ R6 (Port 5 ~ Port 6)
R5 & R6 are I/O registers
The upper 2 bits of R5 are fixed to “0” (if EM78P259N is selected).
Only the lower 6 bits of R5 are available (this applies to EM78P259N only as
EM78P260N can use all the bits)
6.1.7 R7 (Port 7)
Bit 7 6 5 4 3 2 1 0
EM78P259N/260N ‘0’ ‘0’ ‘0’ ‘0’ ‘0’ ‘0’ ‘0’ I/O
ICE259N C3 C2 C1 C0 RCM1 RCM0 ‘0’ I/O
Note: R7 is an I/O register
For EM78P259N/260N, only the lower 1 bit of R7 is available.
Bit 7 ~ Bit 2:
[With EM78P259N/260N]: Unimplemented, read as ‘0’.
[With Simulator (C3~C0, RCM1, & RCM0)]: are IRC calibration bits in IRC oscillator
mode. Under IRC oscillator mode of ICE259N simulator,
these are the IRC mode selection bits and IRC calibration bits.
Bit 7 ~ Bit 4 (C3 ~ C0): Calibrator of internal RC mode
C3 C2 C1 C0 Frequency (MHz)
0 0 0 0 (1-36%) x F
0 0 0 1 (1-31.5%) x F
0 0 1 0 (1-27%) x F
0 0 1 1 (1-22.5%) x F
0 1 0 0 (1-18%) x F
0 1 0 1 (1-13.5%) x F
0 1 1 0 (1-9%) x F
0 1 1 1 (1-4.5%) x F
1 1 1 1 F (default)
1 1 1 0 (1+4.5%) x F
1 1 0 1 (1+9%) x F
1 1 0 0 (1+135%) x F
1 0 1 1 (1+18%) x F
1 0 1 0 (1+22.5%) x F
1 0 0 1 (1+27%) x F
1 0 0 0 (1+31.5%) x F
1. Frequency values shown are theoretical and taken at an instance of
a high frequency mode. Hence, frequency values are shown for
reference only. Definite values depend on the actual process.
2. Similar way of calculation is also applicable to low frequency mode.
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 9
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 3 & Bit 2 (RCM1, RCM0): IRC mode selection bits
6.1.8 R8 (AISR: ADC Input Select Register)
The AISR register individually defines the pins of Port 5 as analog input or as digital I/O.
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
– – – – ADE3 ADE2 ADE1 ADE0
Bit 7 ~ Bit 4: Not used
Bit 3 (ADE3): AD converter enable bit of P53 pin
0 = Disable ADC3, P53 functions as I/O pin
1 = Enable ADC3 to function as analog input pin
RCM 1 RCM 0 Frequency (MHz)
1 1 4 (default)
1 0 8
0 1 1
0 0 455kHz
Bit 2 (ADE2): AD converter enable bit of P52 pin
0 = Disable ADC2, P52 functions as I/O pin
1 = Enable ADC2 to function as analog input pin
Bit 1 (ADE1): AD converter enable bit of P51 pin
0 = Disable ADC1, P51 functions as I/O pin
1 = Enable ADC1 to function as analog input pin
Bit 0 (ADE0): AD converter enable bit of P50 pin.
0 = Disable ADC0, P50 functions as I/O pin
1 = Enable ADC0 to function as analog input pin
10 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.1.9 R9 (ADCON: ADC Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
VREFS CKR1 CKR0 ADRUN ADPD – ADIS1 ADIS0
Bit 7 (VREFS): Input source of the Vref of the ADC
0 = The Vref of the ADC is connected to Vdd (default value), and the
P54/VREF pin carries out the function of P54
1 = The Vref of the ADC is connected to P54/VREF
NOTE
The P54/TCC/VREF pin cannot be applied to TCC and VREF at the same time.
If P54/TCC/VREF functions as VREF analog input pin, then CONT Bit 5 “TS”
must be “0.”
The P54/TCC/VREF pin priority is as follows:
P53/TCC/VREF Pin Priority
High Medium Low
VREF TCC P54
Bit 6 & Bit 5 (CKR1 & CKR0): Prescaler of oscillator clock rate of ADC
When Comparator enters sleep mode, this bit must be set to “Enable.“
Bit 1 (ICWE): Port 5 input change to wake-up status enable bit
0 = Disable Port 5 input change to wake-up status
1 = Enable Port 5 input change to wake-up status
When Port 5 change enters sleep mode, this bit must be set to
“Enable“.
Bit 0: Not implemented, read as ‘0’
6.1.15 RF (Interrupt Status 2 Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
LPWTIF HPWTIF TCCCIF TCCBIF TCCAIF EXIF ICIF TCIF
Note: “ 1 ” means with interrupt request “ 0 ” means no interrupt occurs
RF can be cleared by instruction but cannot be set.
IOCF0 is the relative interrupt mask register.
Reading RF will result to "logic AND" of RF and IOCF0.
Bit 7 (LPWTIF): Internal low-pulse width timer underflow interrupt flag for IR/PWM
function. Reset by software.
Bit 6 (HPWTIF): Internal high-pulse width timer underflow interrupt flag for IR/PWM
function. Reset by software.
Bit 5 (TCCCIF): TCCC overflow interrupt flag. Set when TCCC overflows. Reset by
software.
Bit 4 (TCCBIF): TCCB overflow interrupt flag. Set when TCCC overflows. Reset by
software.
Bit 3 (TCCAIF): TCCA overflow interrupt flag. Set when TCCC overflows. Reset by
software.
Bit 2 (EXIF):External interrupt flag. Set by falling edge on /INT pin. Reset by
software.
Bit 1 (ICIF): Port 5 input status change interrupt flag. Set when Port 5 input
changes. Reset by software.
Bit 0 (TCIF):TCC overflow interrupt flag. Set when TCC overflows. Reset by
software.
6.1.16 R10 ~ R3F
All of these are 8-bit general-purpose registers.
14 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
6.2 Special Purpose Registers
6.2.1 A (Accumulator)
Internal data transfer operation, or instruction operand holding usually involves the
temporary storage function of the Accumulator, which is not an addressable register.
6.2.2 CONT (Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
INTE INT TS TE PSTE PST2 PST1 PST0
Note: The CONT register is both readable and writable
Bit 6 is read only.
Bit 7 (INTE): INT signal edge
0 = interrupt occurs at the rising edge on the INT pin
1 = interrupt occurs at the falling edge on the INT pin
Bit 6 (INT): Interrupt enable flag
0 = masked by DISI or hardware interrupt
1 = enabled by the ENI/RETI instructions
This bit is readable only.
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 5 (TS): TCC signal source
0 = internal instruction cycle clock. P54 is bi-directional I/O pin.
1 = transition on the TCC pin
Bit 4 (TE): TCC signal edge
0 = increment if the transition from low to high takes place on the TCC
pin
1 = increment if the transition from high to low takes place on the TCC
pin.
Bit 3 (PSTE): Prescaler enable bit for TCC
0 = prescaler disable bit. TCC rate is 1:1.
1 = prescaler enable bit. TCC rate is set as Bit 2 ~ Bit 0.
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 15
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 2 ~ Bit 0 (PST2 ~ PST0): TCC prescaler bits
PST2 PST1 PST0 TCC Rate
0 0 0 1:2
0 0 1 1:4
0 1 0 1:8
0 1 1 1:16
1 0 0 1:32
1 0 1 1:64
1 1 0 1:128
1 1 1 1:256
Note: Tcc time-out period [1/Fosc x prescaler x 256 (Tcc cnt) x 1 (CLK=2)]
Tcc time-out period [1/Fosc x prescaler x 256 (Tcc cnt) x 2 (CLK=4)]
6.2.3 IOC50 ~ IOC70 (I/O Port Control Register)
"1" puts the relative I/O pin into high impedance, while "0" defines the relative I/O
pin as output.
Only the lower 6 bits of IOC50 can be defined (this applies to EM78P259N only,
since EM78P260N can use all the bits).
Only the lower 1 bit of IOC70 can be defined, the other bits are not available.
IOC50, IOC60, and IOC70 registers are all readable and writable
6.2.4 IOC80 (Comparator and TCCA Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
– – CMPOUTCOS1 COS0 TCCAENTCCATS TCCATE
Note: Bits 4~0 of the IOC80 register are both readable and writable
Bit 5 of the IOC80 register is read only.
Bit 7 & Bit 6: Not used
Bit 5 (CMPOUT): Result of the comparator output
This bit is read only.
Bit 4 & Bit 3 (COS1 & COS0): Comparator/OP Select bits
COS1 COS0 Function Description
0 0
0 1 Acts as Comparator and P64 functions as normal I/O pin
1 0 Acts as Comparator and P64 functions as Comparator output pin (CO)
1 1 Acts as OP and P64 functions as OP output pin (CO)
Bit 2 (TCCAEN): TCCA enable bit
0 = disable TCCA
1 = enable TCCA as a counter
Comparator and OP are not used. P64, P65, and P66 function as
normal I/O pins.
16 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 1 (TCCATS): TCCA signal source
0 =: internal instruction cycle clock. P61 is a bi-directional I/O pin. 1 = transit through the TCCA pin
Bit 0 (TCCATE): TCCA signal edge
0 = increment if transition from low to high takes place on the
TCCA pin
1 = increment if transition from high to low takes place on the
defined as IROUT. If HP=1, the TCCC counter scale uses the
low time segments of the pulse generated by Fcarrier frequency
modulation (see Fig. 6-11 in Section 6.8.2, Function
Description). When HP=0, the TCCC is an Up Counter.
Bit 2 (HF): High Frequency bit
0 = PWM application. IROUT waveform is achieved according to
high-pulse width timer and low-pulse width timer which
determines the high time width and low time width respectively
1 = IR application mode. The low time segments of the pulse
generated by Fcarrier frequency modulation (see Fig. 6-11 in
Section 6.8.2, Function Description)
Bit 1 (LGP): Long Pulse.
0 = high time register and low time register is valid
1 = high time register is ignored. A single pulse is generated.
Bit 0 (IROUTE): Control bit to define the P67 (IROUT) pin function
0 = P67 is defined as bi-directional I/O pin
1 = P67 is defined as IROUT. Under this condition, the I/O control
bit of P67 (Bit 7 of IOC60) must be set to “0”
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 19
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.2.7 IOCB0 (Pull-down Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
/PD57 /PD56 /PD55 /PD54 /PD53 /PD52 /PD51 /PD50
Note: The IOCB0 register is both readable and writable
Bit 7 (/PD57): Control bit used to enable the pull-down function of the P57 pin
(applicable to EM78P260N only)
0 = Enable internal pull-down
1 = Disable internal pull-down
Bit 6 (/PD56): Control bit used to enable the pull-down function of the P56 pin
(applicable to EM78P260N only)
Bit 5 (/PD55): Control bit used to enable the pull-down function of the P55 pin
Bit 4 (/PD54): Control bit used to enable the pull-down function of the P54 pin
Bit 3 (/PD53): Control bit used to enable the pull-down function of the P53 pin
Bit 2 (/PD52): Control bit used to enable the pull-down function of the P52 pin
Bit 1 (/PD51): Control bit used to enable the pull-down function of the P51 pin
Bit 0 (/PD50): Control bit used to enable the pull-down function of the P50 pin.
6.2.8 IOCC0 (Open-Drain Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
/OD67 /OD66 /OD65 /OD64 /OD63 /OD62 /OD61 /OD60
Note: The IOCC0 register is both readable and writable
Bit 7 (/OD67): Control bit used to enable the open-drain output of the P67 pin
Bit 6 (/OD66): Control bit used to enable the open-drain output of the P66 pin
Bit 5 (/OD65): Control bit used to enable the open-drain output of the P65 pin
Bit 4 (/OD64): Control bit used to enable the open-drain output of the P64 pin
Bit 3 (/OD63): Control bit used to enable the open-drain output of the P63 pin
Bit 2 (/OD62): Control bit used to enable the open-drain output of the P62 pin
Bit 1 (/OD61): Control bit used to enable the open-drain output of the P61 pin
Bit 0 (/OD60): Control bit used to enable the open-drain output of the P60 pin
20 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.2.9 IOCD0 (Pull-high Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
/PH57 /PH56 /PH55 /PH54 /PH53 /PH52 /PH51 /PH50
Note: The IOCD0 register is both readable and writable
Bit 7 (/PH57): Control bit is used to enable the pull-high of the P57 pin (applicable to
EM78P260N only).
0 = Enable internal pull-high;
1 = Disable internal pull-high.
Bit 6 (/PH56): Control bit used to enable the pull-high function of the P56 pin
(applicable to EM78P260N only).
Bit 5 (/PH55): Control bit used to enable the pull-high function of the P55 pin.
Bit 4 (/PH54): Control bit used to enable the pull-high function of the P54 pin.
Bit 3 (/PH53): Control bit used to enable the pull-high function of the P53 pin.
Bit 2 (/PH52): Control bit used to enable the pull-high function of the P52 pin.
Bit 1 (/PH51): Control bit used to enable the pull-high function of the P51 pin.
Bit 0 (/PH50): Control bit used to enable the pull-high function of the P50 pin.
6.2.10 IOCE0 (WDT Control & Interrupt Mask Registers 2)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
WDTE EIS ADIE CMPIE PSWE PSW2 PSW1 PSW0
Bit 7 (WDTE): Control bit used to enable Watchdog Timer
0 = Disable WDT
1 = Enable WDT
WDTE is both readable and writable
Bit 6 (EIS): Control bit used to define the function of the P60 (/INT) pin
0 = P60, bi-directional I/O pin
1 = /INT, external interrupt pin. In this case, the I/O control bit of P60
(Bit 0 of IOC60) must be set to "1"
NOTE
■ When EIS is "0," the path of /INT is masked. When EIS is "1," the status of /INT pin
can also be read by way of reading Port 6 (R6). Refer to Fig. 6-4 (I/O Port and I/O
Control Register Circuit for P60 (/INT)) under Section 6.4 (I/O Ports).
■ EIS is both readable and writable.
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
Bit 3 (PSWE): Prescaler enable bit for WDT
0 = prescaler disable bit, WDT rate is 1:1
1 = prescaler enable bit, WDT rate is set as Bit 2 ~ Bit 0
Bit 2 ~ Bit 0 (PSW2 ~ PSW0): WDT prescaler bits
PSW2 PSW1 PSW0 WDT Rate
0 0 0 1:2
0 0 1 1:4
0 1 0 1:8
0 1 1 1:16
1 0 0 1:32
1 0 1 1:64
1 1 0 1:128
1 1 1 1:256
6.2.11 IOCF0 (Interrupt Mask Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
LPWTIE HPWTIE TCCCIE TCCBIE TCCAIE EXIE ICIE TCIE
NOTE
■ The IOCF0 register is both readable and writable
■ Individual interrupt is enabled by setting its associated control bit in the IOCF0 and
in IOCE0 Bit 4 & 5 to "1".
■ Global interrupt is enabled by the ENI instruction and is disabled by the DISI
instruction. Refer to Fig. 6-8 (Interrupt Input Circuit) under Section 6.6 (Interrupt).
Bit 7 (LPWTIE): LPWTIF interrupt enable bit
0 = Disable LPWTIF interrupt
1 = Enable LPWTIF interrupt
Bit 6 (HPWTIE): HPWTIF interrupt enable bit
0 = Disable HPWTIF interrupt
1 = Enable HPWTIF interrupt
22 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
The IOC51 (TCCA) is an 8-bit clock counter. It can be read, written, and cleared on
any reset condition and is an Up Counter.
NOTE
■ TCCA timeout period [1/Fosc x (256-TCCA cnt) x 1(CLK=2)]
■ TCCA timeout period [1/Fosc x (256-TCCA cnt) x 2(CLK=4)]
6.2.13 IOC61 (TCCB Counter)
The IOC61 (TCCB) is an 8-bit clock counter for the least significant byte of TCCBX
(TCCB). It can be read, written, and cleared on any reset condition and is an Up
Counter.
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 23
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.2.14 IOC71 (TCCBH/MSB Counter)
The IOC71 (TCCBH) is an 8-bit clock counter for the most significant byte of TCCBX
(TCCBH). It can be read, written, and cleared on any reset condition.
When TCCBHE (IOC90) is “0,” then TCCBH is disabled. When TCCBHE is”1,” then
TCCB is a 16-bit length counter.
When TCCBH is Disabled:
■ TCCB time-out period [1/Fosc x ( 256 - TCCB cnt ) x 1(CLK=2)]
■ TCCB time-out period [1/Fosc x ( 256 - TCCB cnt ) x 2(CLK=4)]
When TCCBH is Enabled:
■ TCCB time-out period {1/Fosc x [ 65536 - (TCCBH * 256 + TCCB cnt)] x 1(CLK=2)}
■ TCCB time-out period {1/Fosc x [ 65536 - (TCCBH * 256 + TCCB cnt)] x 2(CLK=4)}
6.2.15 IOC81 (TCCC Counter)
NOTE
The IOC81 (TCCC) is an 8-bit clock counter that can be extended to 16-bit counter.
It can be read, written, and cleared on any reset condition.
If HF (Bit 2 of IOCA0) = 1 and IRE (Bit 3 of IOCA0) = 1, TCCC counter scale uses the
low time segments of the pulse generated by Fcarrier frequency modulation (see Fig.
6-12 in Section 6.8.2, Function Description). Then TCCC value will be TCCC predict
value.
When HP = 0 or IRE = 0, the TCCC is an Up Counter.
NOTE
In TCCC Up Counter mode:
■ TCCC time-out period [1/Fosc x scaler (IOCA0) x (256-TCCC cnt) x 1(CLK=2)]
■ TCCC time-out period [1/Fosc x scaler (IOCA0) x (256-TCCC cnt) x 2(CLK=4)]
When HP = 1 and IRE = 1, TCCC counter scale uses the low time segments of the
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.2.16 IOC91 (Low Time Register)
The 8-bit Low time register controls the active or Low segment of the pulse.
The decimal value of its contents determines the number of oscillator cycles and
verifies that the IR OUT pin is active. The active period of IR OUT can be calculated as
follows:
NOTE
■ Low time width = { [1+decimal low time value (IOC91)] * Low time Scale(IOCB1) } /
FT
■ FT is system clock: FT = Fosc/1 (CLK=2)
FT = Fosc/2 (CLK=4)
When an interrupt is generated by the Low time down counter underflow (if enabled),
the next instruction will be fetched from Address 015H (Low time).
6.2.17 IOCA1 (High Time Register)
The 8-bit High time register controls the inactive or High period of the pulse.
The decimal value of its contents determine the number of oscillator cycles and verifies
that the IR OUT pin is inactive. The inactive period of IR OUT can be calculated as
follows:
NOTE
■ High time width = {[1+decimal high time value (IOCA1)] * High time Scale(IOCB1) }
/ FT
■ FT is system clock: FT=Fosc/1(CLK=2)
FT=Fosc/2(CLK=4)
When an interrupt is generated by the High time down counter underflow (if enabled),
the next instruction will be fetched from Address 012H (High time).
6.2.18 IOCB1 High/Low Time Scale Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
HTSE HTS2 HTS1 HTS0 LTSE LTS2 LTS1 LTS0
Bit 7 (HTSE):High time scale enable bit. 0 = scale disable bit, High time rate is 1:1
1 = scale enable bit, High time rate is set as Bit 6~Bit 4.
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 25
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 6 ~ Bit 4 (HTS2 ~ HTS0): High time scale bits:
HTS2 HTS1 HTS0 High time Rate
0 0 0 1:2
0 0 1 1:4
0 1 0 1:8
0 1 1 1:16
1 0 0 1:32
1 0 1 1:64
1 1 0 1:128
1 1 1 1:256
Bit 3 (LTSE): Low time scale enable bit.
0 = scale disable bit, Low time rate is 1:1
1 = scale enable bit, Low time rate is set as Bit 2~Bit 0.
Bit 2 ~ Bit 0 (LTS2 ~ LTS0): Low time scale bits:
LTS2 LTS1 LTS0 Low time Rate
0 0 0 1:2
0 0 1 1:4
0 1 0 1:8
0 1 1 1:16
1 0 0 1:32
1 0 1 1:64
1 1 0 1:128
1 1 1 1:256
6.2.19 IOCC1 (TCC Prescaler Counter)
The TCC prescaler counter can be read and written to.
PST2 PST1 PST0Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 0 0 - - - - - - - V 1:2
0 0 1 - - - - - - V V 1:4
0 1 0 - - - - - V V V 1:8
0 1 1 - - - - V V V V 1:16
1 0 0 - - - V V V V V 1:32
1 0 1 - - V V V V V V 1:64
1 1 0 - V V V V V V V 1:128
1 1 1 V V V V V V V V 1:256
V = valid value
The TCC prescaler counter is assigned to TCC (R1).
The contents of the IOCC1 register are cleared when one of the following occurs:
a value is written to TCC register
a value is written to TCC prescaler bits (Bits 3, 2, 1, 0 of CONT)
power-on reset, /RESET
WDT time-out reset
26 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
TCC
Rate
6.3 TCC/WDT and Prescaler
There are two 8-bit counters available as prescalers that can be extended to 16-bit
counter
register are used to determine the ratio of the TCC prescaler, and the PWR2 ~ PWR0
bits of the IOCE0 register are used to determine the WDT prescaler. The prescaler
counter is cleared by the instructions each time such instructions are written into TCC.
The WDT and prescaler will be cleared by the “WDTC” and “SLEP” instructions. Fig.
6-2 (next page) depicts the block diagram of TCC/WDT.
TCC (R1) is an 8-bit timer/counter. The TCC clock source can be an internal clock or
external signal input (edge selectable from the TCC pin). If TCC signal source is from
the internal clock, TCC will increase by 1 at every instruction cycle (without prescaler).
Referring to Fig. 6-2, CLK=Fosc/2 or CLK=Fosc/4 is dependent to the Code Option bit
<CLKS>. CLK=Fosc/2 if the CLKS bit is "0," and CLK=Fosc/4 if the CLKS bit is "1." If
TCC signal source is from an external clock input, TCC will increase by 1 at every
falling edge or rising edge of the TCC pin. The TCC pin input time length (kept in High
or Low level) must be greater than 1CLK.
for the TCC and WDT respectively. The PST2 ~ PST0 bits of the CONT
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
The internal TCC will stop running when sleep mode occurs. However, during AD
conversion, when TCC is set to “SLEP” instruction, if the ADWE bit of the RE register
is enabled, the TCC will keep on running
The watchdog timer is a free running on-chip RC oscillator. The WDT will keep on
running even when the oscillator driver has been turned off (i.e., in sleep mode).
During normal operation or sleep mode, a WDT time-out (if enabled) will cause the
device to reset. The WDT can be enabled or disabled at any time during normal mode
through software programming. Refer to WDTE bit of IOCE0 register (Section 6.2.10
IOCE0 (WDT Control & Interrupt Mask Registers 2). With no prescaler, the WDT
time-out period is approximately 18ms
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
1
VDD=5V, WDT time-out period = 16.5ms ± 30%
VDD=3V, WDT time-out period = 18ms ± 30%
2
VDD=5V, WDT time-out period = 4.2ms ± 30%
VDD=3V, WDT time-out period = 4.5ms ± 30%
• 27
NOTE
1
or or 4.5ms2.
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
1CLK (Fosc/1)
TCC Pin
TE (CONT)
WDTE
(IOCE0)
2 CLK (Fosc/2)
0
MUX
1
TS (CONT)
8-Bit counterWDT
WDT Time out
Fig. 6-2 TCC and WDT Block Diagram
8-Bit Counter (IOCC1)
8 to 1 MUX
Prescaler
PSR2~0
(CONT)
Prescaler8 to 1 MUX
PSW2~0
(IOCE0)
Data Bus
TCC (R1)
TCC overflow
interrupt
6.4 I/O Ports
The I/O registers (Port 5, Port 6, and Port 7) are bi-directional tri-state I/O ports. Port 5
is pulled-high and pulled-down internally by software. Likewise, P6 has its open-drain
output through software. Port 5 features an input status changed interrupt (or wake-up)
function. Each I/O pin can be defined as "input" or "output" pin by the I/O control
register (IOC5 ~ IOC7). The I/O registers and I/O control registers are both readable
and writable. The I/O interface circuits for Port 5, Port 6, and Port7 are illustrated in
Figures 6-3, 6-4, 6-5, & 6-6 (see next page).
28 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
PCRD
Q
_
Q
P
D
R
PCWR
CLK
C
L
PORT
0
M
U
1
X
Note: Open-drain is not shown in the figure.
Fig. 6-3 I/O Port and I/O Control Register Circuit for Port 6 and Port 7
PORT
Bit 6 of IOCE
P
D
Q
CLK
R
_
C
Q
L
0
1
P
Q
_
Q
D
R
C
L
CLK
PDWR
PDRD
IOD
PCRD
P
Q
D
R
_
Q
Q
_
Q
M
U
X
CLK
C
L
P
R
CLK
C
L
PCWR
IOD
D
PDWR
INT
Note: Open-drain is not shown in the figure.
Fig. 6-4 I/O Port and I/O Control Register Circuit for P60 (/INT)
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 29
PDRD
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
PCRD
_
Q
P
R
DQ
CLK
PCWR
C
L
P50 ~ P57
PORT
M
0
U
X
1
P
R
CLK
_
C
Q
L
P
DQ
R
CLK
_
C
Q
L
DQ
PDWR
PDRD
IOD
TI n
Note: Pull-high (down) is not shown in the figure.
Fig. 6-5 I/O Port and I/O Control Register Circuit for Port 50 ~ P57
TI 0
TI 1
….
IO CF.1
RF.1
TI 8
Fig. 6-6 Port 5 Block Diagram with Input Change Interrupt/Wake-up
30 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.4.1 Usage of Port 5 Input Change Wake-up/Interrupt Function
(1) Wake-up (2) Wake-up and Interrupt
(a) Before Sleep (a) Before Sleep
1. Disable WDT 1. Disable WDT
2. Read I/O Port 5 (MOV R5,R5) 2. Read I/O Port 5 (MOV R5,R5)
3. Execute "ENI" or "DISI" 3. Execute "ENI" or "DISI"
4. Enable wake-up bit (Set RE ICWE =1) 4. Enable wake-up bit (Set RE ICWE =1)
A reset is initiated by one of the following events:
1. Power-on reset
2. /RESET pin input "low"
3. WDT time-out (if enabled).
The device is kept under reset condition for a period of approximately 18ms
LXT mode) after the reset is detected. When in LXT mode, the reset time is 500ms.
Two choices (18ms
occurs, the following functions are performed (the initial Address is 000h):
The oscillator continues running, or will be started (if in sleep mode)
The Program Counter (R2) is set to all "0"
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
3
VDD=5V, WDT Time-out period = 16.5ms ± 30%.
VDD=3V, WDT Time-out period = 18ms ± 30%.
4
VDD=5V, WDT Time-out period = 4.2ms ± 30%.
VDD=3V, WDT Time-out period = 4.5ms ± 30%.
3
or 4.5ms4) are available for WDT-time out period. Once a reset
• 31
3
(except in
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
All I/O port pins are configured as input mode (high-impedance state)
The Watchdog Timer and prescaler are cleared
When power is switched on, the upper 3 bits of R3 is cleared
The IOCB0 register bits are set to all "1"
The IOCC0 register bits are set to all "1"
The IOCD0 register bits are set to all "1"
Bits 7, 5, and 4 of IOCE0 register is cleared
Bit 5 and 4 of RE register is cleared
RF and IOCF0 registers are cleared
Executing the “SLEP” instruction will assert the sleep (power down) mode. While
entering into sleep mode, the Oscillator, TCC, TCCA, TCCB, and TCCC are stopped.
The WDT (if enabled) is cleared but keeps on running.
During AD conversion, when “SLEP” instruction I set; the Oscillator, TCC, TCCA,
TCCB, and TCCC keep on running. The WDT (if enabled) is cleared but keeps on
running.
The controller can be awakened by:
Case 1 External reset input on /RESET pin
Case 2 WDT time-out (if enabled)
Case 3 Port 5 input status changes (if ICWE is enabled)
Case 4 Comparator output status changes (if CMPWE is enabled)
Case 5 AD conversion completed (if ADWE enable)
The first two cases (1 & 2) will cause the EM78P260N to reset. The T and P flags of R3
can be used to determine the source of the reset (wake-up). Cases 3, 4, & 5 are
considered the continuation of program execution and the global interrupt ("ENI" or
"DISI" being executed) decides whether or not the controller branches to the interrupt
vector following wake-up. If ENI is executed before SLEP, the instruction will begin to
execute from address 0x06 (Case 3), 0x0F (Case 4), and 0x0C (Case 5) after wake-up.
If DISI is executed before SLEP, the execution will restart from the instruction next to
SLEP after wake-up.
Only one of Cases 2 to 5 can be enabled before entering into sleep mode. That is:
Case [a] If WDT is enabled before SLEP, all of the RE bit is disabled. Hence, the
EM78P259N/260N can be awakened only with Case 1 or Case 2. Refer to
the section on Interrupt (Section 6.6 below) for further details.
Case [b] If Port 5 Input Status Change is used to wake -up EM78P259N/260N and the
ICWE bit of RE register is enabled before SLEP, WDT must be disabled.
Hence, the EM78P259N/260N can be awakened only with Case 3. Wake-up
time is dependent on oscillator mode. In RC mode, Wake-up time is 32
clocks (for stable oscillators). In High Crystal mode, Wake-up time is 2ms
and 32clocks (for stable oscillators); and in low Crystal mode, Wake-up time
is 500ms.
32 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
S
,
8-Bit Microprocessor with OTP ROM
Case [c] If Comparator output status change is used to wake-up the EM78P259N/
260N and CMPWE bit of the RE register is enabled before SLEP, WDT must
be disabled by software. Hence, the EM78P259N/260N can be awakened
only with Case 4. Wake-up time is dependent on the oscillator mode. In RC
mode the Wake-up time is 32 clocks (for stable oscillators). In High Crystal
mode, Wake-up time is 2ms and 32 clocks (for stable oscillators); and in low
Crystal mode, Wake-up time is 500ms.
Case [d] If AD conversion completed is used to wake-up the EM78P259N/260N and
ADWE bit of RE register is enabled before SLEP, WDT must be disabled by
software. Hence, the EM78P259N/260N can be awakened only with Case 5.
The wake-up time is 15 TAD (ADC clock period).
If Port 5 Input Status Change Interrupt is used to wake up the EM78P259N/260N (as in
Case [b] above), the following instructions must be executed before SLEP:
6.7.1 ADC Control Register (AISR/R8, ADCON/R9, ADOC/RA)
6.7.1.1 R8 (AISR: ADC Input Select Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
– – – – ADE3 ADE2 ADE1 ADE0
The AISR register individually defines the Port 5 pins as analog input or as digital I/O.
Vref
34
Bit 7 ~ 4: Not used
Bit 3 (ADE3): AD converter enable bit of P53 pin
0 = Disable ADC3, P53 acts as I/O pin
1 = Enable ADC3 acts as analog input pin
Bit 2 (ADE2): AD converter enable bit of P52 pin
0 = Disable ADC2, P53 acts as I/O pin
1 = Enable ADC2 acts as analog input pin
44 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 1 (ADE1): AD converter enable bit of P51 pin
0 = Disable ADC1, P51 acts as I/O pin
1 = Enable ADC1 acts as analog input pin
Bit 0 (ADE0): AD converter enable bit of P50 pin
0 = Disable ADC0, P50 acts as I/O pin
1 = Enable ADC0 acts as analog input pin
6.7.1.2 R9 (ADCON: AD Control Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
VREFS CKR1 CKR0 ADRUN ADPD - ADIS1 ADIS0
The ADCON register controls the operation of the AD conversion and determines
which pin should be currently active.
Bit 7(VREFS): Input source of the ADC Vref
0 = The ADC Vref is connected to Vdd (default value), and the
P54/VREF pin carries out the P54 function
1 = The ADC Vref is connected to P54/VREF
NOTE
The P54/TCC/VREF pin cannot be applied to TCC and VREF at the same time. IF
P54/TCC/VREF acts as VREF analog input pin, then CONT Bit 5 (TS) must be “0”.
The P54/TCC/VREF pin priority is as follows:
P54/TCC/VREF Pin Priority
High Medium Low
VREF TCC P54
Bit 6 ~ Bit 5 (CKR1 ~ CKR0): The ADC prescaler oscillator clock rate
00 = 1: 16 (default value)
01 = 1: 4
10 = 1: 64
11 = 1: WDT ring oscillator frequency
CKR1:CKR0 Operat ion Mode Max. Operation Frequency
00 Fosc/16 4 MHz
01 Fosc/4 1 MHz
10 Fosc/64 16 MHz
11 Internal RC –
Product Specification(V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 45
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Bit 4 (ADRUN): ADC starts to RUN.
0 = reset on completion of the conversion. This bit cannot be reset
1 = an AD conversion is started. This bit can be set by software.
Bit 3 (ADPD): ADC Power-down mode.
0 = switch off the resistor reference to save power even
while the CPU is operating.
1 = ADC is operating
Bit 2: Not used
Bit 1 ~ Bit 0 (ADIS1 ~ ADIS0): Analog Input Select
00 = ADIN0/P50
01 = ADIN1/P51
10 = ADIN2/P52
11 = A D I N3/P53
These bits can only be changed when the ADIF bit and the ADRUN bit
are both LOW.
though software.
6.7.1.3 RA (ADOC: AD Offset Calibration Register)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
CALI SIGN VOF[2] VOF[1] VOF[0] – – –
Bit 7 (CALI): Calibration enable bit for ADC offset
0 = Calibration disable
1 = Calibration enable
Bit 6 (SIGN): Polarity bit of offset voltage
0 = Negative voltage
1 = Positive voltage
Bit 5 ~ Bit 3 (VOF[2] ~ VOF[0]): Offset voltage bits.
VOF[2] VOF[1] VOF[0] EM78P259N/260N ICE259N
0 0 0 0LSB 0LSB
0 0 1 2LSB 1LSB
0 1 0 4LSB 2LSB
0 1 1 6LSB 3LSB
1 0 0 8LSB 4LSB
1 0 1 10LSB 5LSB
1 1 0 12LSB 6LSB
1 1 1 14LSB 7LSB
Bit 2 ~ Bit 0: Unimplemented, read as ‘0’.
46 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.7.2 ADC Data Register (ADDATA/RB, ADDATA1H/RC,
ADDATA1L/RD)
When the AD conversion is completed, the result is loaded to the ADDATA, ADDATA1H
and ADDATA1L registers. The ADRUN bit is cleared, and the ADIF is set.
6.7.3 ADC Sampling Time
The accuracy, linearity, and speed of the successive approximation of AD converter are
dependent on the properties of the ADC and the comparator. The source impedance
and the internal sampling impedance directly affect the time required to charge the
sample holding capacitor. The application program controls the length of the sample
time to meet the specified accuracy. Generally speaking, the program should wait for
2μs for each KΩ of the analog source impedance and at least 2μs for the
low-impedance source. The maximum recommended impedance for analog source is
10KΩ at Vdd=5V. After the analog input channel is selected, this acquisition time must
be done before the conversion is started.
6.7.4 AD Conversion Time
CKR1 and CKR0 select the conversion time (Tct), in terms of instruction cycles. This
allows the MCU to run at a maximum frequency without sacrificing the AD conversion
accuracy. For the EM78P259N/260N, the conversion time per bit is about 4μs. The
table below shows the relationship between Tct and the maximum operating
IOC50 == 0X5 ; Control Register of Port 5
IOC60 == 0X6 ; Control Register of Port 6
C_INT== 0XF ; Interrupt Control Register
C. ADC Control Register
ADDATA == 0xB ; The contents are the results of ADC
AISR == 0x08 ; ADC input select register
ADCON == 0x9 ; 7 6 5 4 3 2 1 0
; VREFS CKR1 CKR0 ADRUN ADPD ADIS2 ADIS1 ADIS0
D. Define Bits in ADCON
ADRUN == 0x4 ; ADC is executed as the bit is set
ADPD == 0x3 ; Power Mode of ADC
E. Program Starts
ORG 0 ; Initial address
JMP INITIAL ;
ORG 0x0C ; Interrupt vector
JMP CLRRE
;
;
;(User program section)
;
;
CLRRE:
MOV A,RE
AND A, @0BXX0XXXXX ; To clear the ADIF bit, “X” by application
MOV RE,A
BS ADCON, ADRUN ; To start to execute the next AD conversion
if necessary
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
• 49
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
RETI
INITIAL:
MOV A,@0B00000001 ; To define P50 as an analog input
MOV AISR,A
MOV A,@0B00001000 ; To select P50 as an analog input channel, and
MOV ADCON,A ; To define P50 as an input pin and set clock
En_ADC:
MOV A, @0BXXXXXXX1 ; To define P50 as an input pin, and the others
IOW PORT5 ; are dependent on applications
MOV A, @0BXXXX1XXX ; Enable the ADWE wake-up function of ADC, “X”
MOV RE,A
MOV A, @0BXXXX1XXX ; Enable the ADIE interrupt function of ADC,
IOW C_INT
ENI ; Enable the interrupt function
BS ADCON, ADRUN ; Start to run the ADC
; If the interrupt function is employed, the following three lines
may be ignored
;If Sleep:
SLEP
;
;(User program section)
;
or
;If Polling:
POLLING:
JBC ADCON, ADRUN ; To check the ADRUN bit continuously;
JMP POLLING ; ADRUN bit will be reset as the AD conversion
;
;(User program section)
;
AD power on
rate at fosc/16
by application
“X” by application
is completed
50 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
8-Bit Microprocessor with OTP ROM
6.8 Infrared Remote Control Application/PWM Waveform
Generation
6.8.1 Overview
This LSI can easily output infrared carrier or PWM standard waveform. As illustrated
below, the IR and PWM waveform generation function include an 8-bit down count
timer/counter, high time, low time, and IR control register. The IROUT pin waveform is
determined by IOCA0 (IR and TCCC scale control register), IOCB1 (high time rate, low
time rate control register), IOC81 (TCCC counter), IOCA1 (high time register), and
IOC91 (low time register).
FT:CLK(Fosc)
EM78P259N/260N
Scale
(IOCA0)
8 Bit counter
8-to-1 MUX
(High-time)(IOCA1)
8bit binary
down counter
8
Auto-reload buffer
(TCCC)(IOC81)
Details of the Fcarrier high time width and low time width are explained below:
(This specification is subject to change without further notice)
• 55
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
6.9 Timer/Counter
6.9.1 Overview
Timer A (TCCA) is an 8-bit clock counter. Timer B (TCCB) is a 16-bit clock counter.
Timer C (TCCC) is an 8-bit clock counter that can be extended to 16-bit clock counter
with programmable scalers. TCCA, TCCB, and TCCC can be read and written to, and
are cleared at every reset condition.
6.9.2 Function Description
Set predict value
TCCA
System clock or
External input
Set predict valueSet predict value
TCCAEN
Overflow
Set TCCAIF
TCCB
System clock or
External inp ut
TCCBEN
Overflow
Set TCCBIF
TCCC
8-to-1 MUX
8 Bit
counter
System clock or
External inp ut
TCCCEN
Set TCCCIF
Overflow
TCCCS1 ~ TCCCS0
Fig. 6-13 Timer Block Diagram
Each signal and block of the above TIMER block diagram is described as follows:
TCCX: Timer A~C register. TCCX increases until it matches with zero, and then
reloads the predicted value. When writing a value to TCCX, the predicted
value and TCCX value become the set value. When reading from TCCX, the
value will be the TCCX direct value. When TCCXEN is enabled, the reload of
the predicted value to TCCX, TCCXIE is also enabled. TCCXIF will be set at
the same time. It is an Up Counter.
Under TCCA Counter (IOC51):
IOC51 (TCCA) is an 8-bit clock counter. It can be read, written to, and cleared
on any reset condition and is an Up Counter.
NOTE
■ TCCA time-out period [1/Fosc x (256-TCCA cnt) x 1 (CLK=2)]
■ TCCA time-out period [1/Fosc x (256-TCCA cnt) x 2 (CLK=4)]
Under TCCB Counter (IOC61):
TCCB (IOC61) is an 8-bit clock counter for the least significant byte of TCCBX
(TCCB). It can be read, written to, and cleared on any reset condition and is an
Up Counter.
56 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Under TCCBH / MSB Counter (IOC71):
TCCBH/MSB (IOC71) is an 8-bit clock counter is for the most significant byte of
TCCBX (TCCBH). It can be read, written to, and cleared on any reset
condition.
When TCCBHE (IOC90) is “0,” then TCCBH is disabled. When TCCBHE is”1,”
then TCCB is a 16-bit length counter.
NOTE
When TCCBH is Disabled:
TCCB time-out period [1/Fosc x ( 256 - TCCB cnt ) x 1(CLK=2)]
TCCB time-out period [1/Fosc x ( 256 - TCCB cnt ) x 2(CLK=4)]
When TCCBH is Enabled:
TCCB time-out period {1/Fosc x [ 65536 - (TCCBH * 256 + TCCB cnt)] x 1(CLK=2)}
TCCB time-out period {1/Fosc x [ 65536 - (TCCBH * 256 + TCCB cnt)] x 2(CLK=4)}
Under TCCC Counter (IOC81):
IOC81 (TCCC) is an 8-bit clock counter. It can be read, written, and cleared on
any reset condition.
If HF (Bit 2 of IOCA0) = 1 and IRE (Bit 3 of IOCA0) = 1, TCCC counter scale
uses the low time segments of the pulse generated by Fcarrier frequency
modulation (see Fig. 6-12 in Section 6.8.2, Function Description). Then the
TCCC value will be the TCCC predicted value.
When HF = 0 or IRE = 0, the TCCC is an Up Counter.
In TCCC Up Counter mode:
■ TCCC timeout period [1/Fosc x scaler (IOCA0) x (256-TCCC cnt) x 1(CLK=2)]
■ TCCC timeout period [1/Fosc x scaler (IOCA0) x (256-TCCC cnt) x 2(CLK=4)]
When HF = 1 and IRE = 1, the TCCC counter scale uses the low time
segments of the pulse generated by Fcarrier frequency modulation.
The EM78P259N/260N can be driven by an external clock signal through the OSCI pin
as illustrated below.
In most applications, Pin OSCI and Pin OSCO can be connected with a crystal or
ceramic resonator to generate oscillation. Fig. 6-17 below depicts such a circuit. The
same applies to the HXT mode and the LXT mode.
OSCI
EM78P259N
EM78P260N
OSCO
Fig. 6-16 External Clock Input Circuit
C1
OSCI
EM78P259N
EM78P260N
OSCO
Crystal
RS
C2
Fig. 6-17 Crystal/Resonator Circuit
The following table provides the recommended values for C1 and C2. Since each
resonator has its own attribute, you should refer to the resonator specifications for the
appropriate values of C1 and C2. RS, a serial resistor, may be required for AT strip cut
crystal or low frequency mode.
Capacitor selection guide for crystal oscillator or ceramic resonators:
Oscillator Type Frequency Mode Frequency C1(pF) C2(pF)
455kHz 100~150 100~150
Ceramic Resonators HXT
LXT
Crystal Oscillator
HXT
2.0 MHz 20~40 20~40
4.0 MHz 10~30 10~30
32.768kHz 25 15
100kHz 25 25
200kHz 25 25
455kHz 20~40 20~150
1.0 MHz 15~30 15~30
2.0 MHz 15 15
4.0 MHz 15 15
62 •
Product Specification (V1.2) 05.18.2007
(This specification is subject to change without further notice)
EM78P259N/260N
8-Bit Microprocessor with OTP ROM
Circuit diagrams for serial and parallel modes Crystal/Resonator:
OSCI
EM78P259N
EM78P260N
Fig. 6-18 Serial Mode Crystal/Resonator Circuit Diagram