EM78P156EL
EM78P156EL
EM78P156EL
OTP ROM
1. GENERAL DESCRIPTION
EM78P156EL is an 8-bit microprocessor designed and developed with low-power and high-speed CMOS
technology. It is equipped with 1K*13-bits Electrical One Time Programmable Read Only Memory
(OTP-ROM). It provides a PROTECTION bit to prevent user’s code in the OTP memory from being
intruded. 6 OPTION bits are also available to meet user’s requirements.
With its OTP-ROM feature, the EM78P156EL is able to offer a convenient way of developing and verifying
user’s programs. Moreover, user can take advantage of EMC Writer to easily program his development
code.
2. FEATURES
3. PIN ASSIGNMENTS
4. FUNCTION DESCRIPTION
Instruction
Sleep RAM Decoder
& Wake R3
AC
Control
R4
IOC5 IOC6
R5 R6
P P P P PPPPPPPP
5 5 5 5 66 66 66 66
0 1 2 3 01 23 45 67
CALL Stack 1
PC A 9 A8 A7 ~ A0
Stack 2
RET
Stack 3
RETL
000 Stack 4
RETL K
Stack 5
PA G E 0
3FF
00 R0
01 R1(TCC)
02 R2(PC)
Stack
03 R3(Status) (5 level)
04 R4(RSR)
05 R5(Port5) IOC5
06 R6(Port6) IOC6
07
08
09
0A IOCA
0B IOCB
0C IOCC
0D IOCD
0E IOCE
0F RF IOCF
10 R10
:
:
: 48x8
: Common
Register
3F R3F
4. R3 (Status Register)
7 6 5 4 3 2 1 0
GP2 GP1 GP0 T P Z DC C
• Bit 0 (C) Carry flag
• Bit 1 (DC) Auxiliary carry flag
• Bit 2 (Z) Zero flag.
This specification is subject to change without prior notice. 8 2002/04/19
EM78P156EL
OTP ROM
6. R5 ~ R6 (Port 5 ~ Port 6)
• R5 and R6 are I/O registers.
• Only the lower 4 bits of R5 are available.
• Bit 0 (TCIF) TCC overflow interrupt flag. Set when TCC overflows, reset by software.
• Bit 1 (ICIF) Port 6 input status change interrupt flag. Set when Port 6 input changes, reset by
software.
• Bit 2 (EXIF) External interrupt flag. Set by falling edge on /INT pin, reset by software.
• Bits 3 ~ 7 Not used.
• RF can be cleared by instruction but cannot be set.
• IOCF is the interrupt mask register.
• Note that the result of reading RF is the "logic AND" of RF and IOCF.
8. R10 ~ R3F
• All of these are 8-bit general-purpose registers.
• R1 (TCC) is an 8-bit timer/counter. The clock source of TCC can be internal or external clock input
(edge selectable from TCC pin). If TCC signal source is from internal clock, TCC will increase by 1 at
every instruction cycle (without prescaler). Referring to Fig. 5, CLK=Fosc/2 or CLK=Fosc/4 application
is determined by the CODE Option bit CLK status. CLK=Fosc/2 is used if CLK bit is "0", and
CLK=Fosc/4 is used if CLK bit is "1". If TCC signal source comes from external clock input, TCC is
increased by 1 at every falling edge or rising edge of TCC pin.
• 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 any
time during normal mode by software programming. Refer to WDTE bit of IOCE register. Without
prescaler, the WDT time-out period is approximately 18 ms 1 (default).
MUX PAB
WDT time-out
1
<Note>: Vdd = 5V, set up time period = 16.5ms ± 5%
Vdd = 3V, set up time period = 18ms ± 5%
This specification is subject to change without prior notice. 14 2002/04/19
EM78P156EL
OTP ROM
The I/O registers and I/O control registers are both readable and writable. The I/O interface circuits for
Port 5 and Port 6 are shown in the following Figures 6, 7(a), 7(b), and Figure 8.
PCRD
Q P D
R
_ CLK PCWR
C
Q L
PORT Q P D IOD
R
_ CLK PDWR
C
Q L
PDRD
0 M
U
1 X
PCRD
P
Q R D
_ CLK PCWR
Q C
L
0
D P
R Q M
1 U
CLK _
C Q X
L
T10
PDRD
P
D R Q
CLK _
C Q
L
INT
NOTE: Pull-high (down) and Open-drain are not shown in the figure.
Fig. 7(a) The Circuit of I/O Port and I/O Control Register for P60 (/INT)
PCRD
P D
Q R
_ CLK PCWR
Q C
L
P61~P67
P D IOD
PORT Q R
_ CLK PDWR
Q C
L
0 M
1 U
X
TIN
PDRD
D P Q
R
CLK _
C
L Q
NOTE: Pull-high (down) and Open-drain are not shown in the figure.
Fig. 7(b) The Circuit of I/O Port and I/O Control Register for P61~P67
IOCE.1
P Q
D R
CLK Interrupt
_
C Q
L
RE.1
ENI Instruction
P
T10 D R Q
T11
P
CLK Q R D
_
C Q CLK
L
_
Q C
L
T17
DISI Instruction
Interrupt
(Wake-up from SLEEP)
/SLEP
Next Instruction
(Wake-up from SLEEP)
Fig. 7(c) Block Diagram of I/O Port 6 with Input Change Interrupt/Wake-up
1
NOTE: Software disables WDT (watchdog timer) but hardware must be enabled before applying
Port 6 Change Wake-Up function. (CODE Option Register and Bit 11 (ENWDTB-) set to
“1”).
This specification is subject to change without prior notice. 17 2002/04/19
EM78P156EL
OTP ROM
PCRD
ROC
VCC
P
Q D
R
Weakly
Pull-up CLK PCWR
Q C
L
P
PORT Q D IOD
R
PDWR
Q C
L
PDRD
0 M
1
U
Rex* X
The device is kept in a RESET condition for a period of approx. 18ms 1 (one oscillator start-up timer
period) after the reset is detected. Once the RESET occurs, the following functions are performed.
Refer to Fig.9.
The sleep (power down) mode is asserted by executing the “SLEP” instruction. While entering sleep
mode, WDT (if enabled) is cleared but keeps on running. The controller can be awakened by-
The first two cases will cause the EM78P156EL to reset. The T and P flags of R3 can be used to
determine the source of the reset (wake-up). The last case is considered the continuation of program
execution and the global interrupt ("ENI" or "DISI" being executed) decides whether or not the
1
NOTE: Vdd = 5V, set up time period = 16.8ms ± 5%
Vdd = 3V, set up time period = 19ms ± 5%
This specification is subject to change without prior notice. 19 2002/04/19
EM78P156EL
OTP ROM
controller branches to the interrupt vector following wake-up. If ENI is executed before SLEP, the
instruction will begin to execute from the address 008H after wake-up. If DISI is executed before
SLEP, the operation will restart from the succeeding instruction right next to SLEP after wake-up.
Only one of Cases 2 and 3 can be enabled before entering the sleep mode. That is,
[a] if Port 6 Input Status Change Interrupt is enabled before SLEP , WDT must be disabled. by
software. However, the WDT bit in the option register remains enabled. Hence, the
EM78P156EL can be awakened only by Case 1 or 3.
[b] if WDT is enabled before SLEP, Port 6 Input Status Change Interrupt must be disabled. Hence,
the EM78P156EL can be awakened only by Case 1 or 2. Refer to the section on Interrupt.
If Port 6 Input Status Change Interrupt is used to wake-up the EM78P156EL (Case [a] above), the
following instructions must be executed before SLEP:
CONTW
CONTW
IOW RE
IOW RF
SLEP ; Sleep
NOP
One problem user should be aware of, is that after waking up from the sleep mode, WDT would
enable automatically. The WDT operation (being enabled or disabled) should be handled
appropriately by software after waking up from the sleep mode.
Address Name Reset Type Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Wake-Up from Pin Change P P P P P P P P
Bit Name X X X X X EXIF ICIF TCIF
Power-On U U U U U 0 0 0
0x0F RF(ISR)
/RESET and WDT U U U U U 0 0 0
Wake-Up from Pin Change U U U U U P P P
Bit Name - - - - - - - -
Power-On 1 1 1 1 1 1 1 1
0x0A IOCA
/RESET and WDT 1 1 1 1 1 1 1 1
Wake-Up from Pin Change P P P P P P P P
Bit Name /PD7 /PD6 /PD5 /PD4 X /PD2 /PD1 /PD0
Power-On 1 1 1 1 U 1 1 1
0x0B IOCB
/RESET and WDT 1 1 1 1 U 1 1 1
Wake-Up from Pin Change P P P P U P P P
Bit Name OD7 OD6 OD5 OD4 OD3 OD2 OD1 OD0
Power-On 0 0 0 0 0 0 0 0
0x0C IOCC
/RESET and WDT 0 0 0 0 0 0 0 0
Wake-Up from Pin Change P P P P P P P P
Bit Name /PH7 /PH6 /PH5 /PH4 /PH3 /PH2 /PH1 /PH0
Power-On 1 1 1 1 1 1 1 1
0x0D IOCD
/RESET and WDT 1 1 1 1 1 1 1 1
Wake-Up from Pin Change P P P P P P P P
Bit Name WDTE EIS X ROC X X X X
Power-On 1 0 U 0 U U U U
0x0E IOCE
/RESET and WDT 1 0 U 0 U U U U
Wake-Up from Pin Change 1 P U P U U U U
Bit Name X X X X X EXIE ICIE TCIE
Power-On U U U U U 0 0 0
0x0F IOCF
/RESET and WDT U U U U U 0 0 0
Wake-Up from Pin Change U U U U U P P P
Bit Name - - - - - - - -
Power-On U U U U U U U U
0x10~0x2F R10~R2F
/RESET and WDT P P P P P P P P
Wake-Up from Pin Change P P P P P P P P
** To jump address 0x08, or to execute the instruction which is next to the “SLEP” instruction.
X: Not used. U: Unknown or don’t care. P: Previous value before reset. t: Check Table 6
1. A power-on condition,
2. A high-low-high pulse on /RESET pin, and
This specification is subject to change without prior notice. 22 2002/04/19
EM78P156EL
OTP ROM
The values of T and P, listed in Table 6 are used to check how the processor wakes up. Table 7
shows the events that may affect the status of T and P.
VDD
D Q
CLK
Oscillator CLK
CLR
Power-on
Reset
Voltage
Detector
WDTE
/RESET
4.6 Interrupt
The EM78P156EL has three falling-edge interrupts listed below:
Before the Port 6 Input Status Change Interrupt is enabled, reading Port 6 (e.g. "MOV R6,R6") is
necessary. Each pin of Port 6 will have this feature if its status changed. Any pin configured as output or
P60 pin configured as /INT is excluded from this function. The Port 6 Input Status Changed Interrupt can
wake up the EM78P156EL from the sleep mode if Port 6 is enabled prior to going into the sleep mode by
executing SLEP. When the chip wakes-up, the controller will continue to execute the succeeding
address if the global interrupt is disabled or branch to the interrupt vector 008H if the global interrupt is
enabled.
RF is the interrupt status register that records the interrupt requests in the relative flags/bits. IOCF is an
interrupt mask register. The global interrupt is enabled by the ENI instruction and is disabled by the DISI
instruction. When one of the interrupts (enabled) occurs, the next instruction will be fetched from
address 008H. Once in the interrupt service routine, the source of an interrupt can be determined by
polling the flag bits in RF. The interrupt flag bit must be cleared by instructions before leaving the
interrupt service routine and before interrupts are enabled to avoid recursive interrupts.
The flag (except ICIF bit) in the Interrupt Status Register (RF) is set regardless of the status of its mask
bit or the execution of ENI. Note that the outcome of RF will be the logic AND of RF and IOCF (refer to
Fig. 10). The RETI instruction ends the interrupt routine and enables the global interrupt (the execution
of ENI).
When an interrupt is generated by the INT instruction (enabled), the next instruction will be fetched from
address 001H.
VCC
P
D R Q IRQn
/IRQn CLK _ INT
C Q RFRD IRQm
L
RF
ENI/DISI
P
Q R D IOD
_ CLK
C IOCFWR
IOCF Q L
/RESET
IOCFRD
RFWR
4.7 Oscillator
1. Oscillator Modes
The EM78P156EL can be operated in three different oscillator modes, such as External RC oscillator
mode (ERC), High XTAL oscillator mode (HXT), and Low XTAL oscillator mode (LXT). User can
select one of them by programming MS and HLF in the CODE option register. Table 8 depicts how
these three modes are defined.
The up-most limited operation frequency of crystal/resonator on the different VDDs is listed in Table
9.
EM78P156EL can be driven by an external clock signal through the OSCI pin as shown in Fig. 11
below.
OSCO
EM78P156EL
In the most applications, pin OSCI and pin OSCO can connected with a crystal or ceramic resonator
to generate oscillation. Fig. 12 depicts such circuit. The same thing applies whether it is in the HXT
mode or in the LXT mode. Table 10 provides the recommended values of C1 and C2. Since each
resonator has its own attribute, user should refer to its specification for appropriate values of C1 and
C2. RS, a serial resistor, may be necessary for AT strip cut crystal or low frequency mode.
C1
OSCI
EM78P156EL
XTAL
OSCO
RS C2
330 330
C
OSCI
7404 7404 7404
EM78P156EL
XTAL
4.7K 10K
Vdd
OSCI
7404 7404
EM78P156EL
10K
XTAL
C1 C2
For some applications that do not need a very precise timing calculation, the RC oscillator (Fig. 15)
offers a lot of cost savings. Nevertheless, it should be noted that the frequency of the RC oscillator is
influenced by the supply voltage, the values of the resistor (Rext), the capacitor (Cext), and even by
the operation temperature. Moreover, the frequency also changes slightly from one chip to another
due to the manufacturing process variation.
In order to maintain a stable system frequency, the values of the Cext should not be less than 20pF,
and that the value of Rext should not be greater than 1 M ohm. If they cannot be kept in this range, the
frequency is easily affected by noise, humidity, and leakage.
The smaller the Rext in the RC oscillator, the faster its frequency will be. On the contrary, for very low
Rext values, for instance, 1 KΩ, the oscillator becomes unstable because the NMOS cannot
discharge the current of the capacitance correctly.
Based on the above reasons, it must be kept in mind that all of the supply voltage, the operation
temperature, the components of the RC oscillator, the package types, the way the PCB is layout, will
affect the system frequency.
Vcc
Rext
OSCI
EM78P156EL Cext
Word 0 Word 1
Bit12~Bit0 Bit12~Bit0
1. Code Option Register (Word 0)
WORD 0
Bit12 Bit11 Bit10 Bit9 Bit8 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
MS /ENWDT CLK CS HLF - HLP - - - - - -
• Bit 12 (MS):Oscillator type selection.
0: RC type
1: XTAL type (XTAL1 and XTAL2)
• Bit 11 (/ENWDT): Watchdog timer enable bit.
0: Enable
1: Disable
• Bit 10 (CLK): Instruction period option bit.
0: two oscillator periods.
1: four oscillator periods.
Refer to the section on Instruction Set.
• Bit 9 (CS): Code Security Bit
0: Security On
1: Security Off
• Bit 8 (HLF): XTAL frequency selection
0: XTAL2 type (low frequency, 32.768KHz)
Vdd
R
/RESET
D
EM78P156EL
Rin
C
Vdd Vdd
EM78P156EL 33K
Q1 10K
/RESET
40K
1N4684
Vdd Vdd
EM78P156EL R1
Q1
/RESET
40K R2
If for some reasons, the specification of the instruction cycle is not suitable for certain applications, try
modifying the instruction as follows:
Case (A) is selected by the CODE Option bit, called CLK. One instruction cycle consists of two
oscillator clocks if CLK is low, and four oscillator clocks if CLK is high.
Note that once the 4 oscillator periods within one instruction cycle is selected as in Case (A), the
internal clock source to TCC should be CLK=Fosc/4, instead of Fosc/ 2 as indicated in Fig. 5.
(1) Every bit of any register can be set, cleared, or tested directly.
(2) The I/O register can be regarded as general register. That is, the same instruction can operate
on I/O register.
The symbol "R" represents a register designator that specifies which one of the registers (including
operational registers and general purpose registers) is to be utilized by the instruction. "b" represents
a bit field designator that selects the value for the bit which is located in the register "R", and affects
operation. "k" represents an 8 or 10-bit constant or literal value.
INSTRUCTION BINARY HEX MNEMONIC OPERATION STATUS AFFECTED
0 0000 0000 0000 0000 NOP No Operation None
0 0000 0000 0001 0001 DAA Decimal Adjust A C
0 0000 0000 0010 0002 CONTW A → CONT None
0 0000 0000 0011 0003 SLEP 0 → WDT, Stop oscillator T,P
0 0000 0000 0100 0004 WDTC 0 → WDT T,P
0 0000 0000 rrrr 000r IOW R A → IOCR None <Note1>
0 0000 0001 0000 0010 ENI Enable Interrupt None
0 0000 0001 0001 0011 DISI Disable Interrupt None
0 0000 0001 0010 0012 RET [Top of Stack] → PC None
[Top of Stack] → PC, Enable
0 0000 0001 0011 0013 RETI None
Interrupt
0 0000 0001 0100 0014 CONTR CONT → A None
0 0000 0001 rrrr 001r IOR R IOCR → A None <Note1>
0 0000 01rr rrrr 00rr MOV R,A A→ R None
0 0000 1000 0000 0080 CLRA 0→A Z
0 0000 11rr rrrr 00rr CLR R 0→R Z
0 0001 00rr rrrr 01rr SUB A,R R-A → A Z,C,DC
0 0001 01rr rrrr 01rr SUB R,A R-A → R Z,C,DC
0 0001 10rr rrrr 01rr DECA R R-1 → A Z
0 0001 11rr rrrr 01rr DEC R R-1 → R Z
0 0010 00rr rrrr 02rr OR A,R A∨ R → A Z
0 0010 01rr rrrr 02rr OR R,A A∨ R → R Z
0 0010 10rr rrrr 02rr AND A,R A&R→A Z
0 0010 11rr rrrr 02rr AND R,A A&R→R Z
0 0011 00rr rrrr 03rr XOR A,R A⊕ R → A Z
0 0011 01rr rrrr 03rr XOR R,A A⊕ R → R Z
0 0011 10rr rrrr 03rr ADD A,R A+R→A Z,C,DC
0 0011 11rr rrrr 03rr ADD R,A A+R→R Z,C,DC
0 0100 00rr rrrr 04rr MOV A,R R→A Z
0 0100 01rr rrrr 04rr MOV R,R R→R Z
0 0100 10rr rrrr 04rr COMA R /R → A Z
0 0100 11rr rrrr 04rr COM R /R → R Z
0 0101 00rr rrrr 05rr INCA R R+1 → A Z
0 0101 01rr rrrr 05rr INC R R+1 → R Z
0 0101 10rr rrrr 05rr DJZA R R-1 → A, skip if zero None
0 0101 11rr rrrr 05rr DJZ R R-1 → R, skip if zero None
R(n) → A(n-1),
0 0110 00rr rrrr 06rr RRCA R C
R(0) → C, C → A(7)
R(n) → R(n-1),
0 0110 01rr rrrr 06rr RRC R C
R(0) → C, C → R(7)
R(n) → A(n+1),
0 0110 10rr rrrr 06rr RLCA R C
R(7) → C, C → A(0)
0 0110 11rr rrrr 06rr RLC R R(n) → R(n+1), C
This specification is subject to change without prior notice. 33 2002/04/19
EM78P156EL
OTP ROM
R(7) → C, C → R(0)
R(0-3) → A(4-7),
0 0111 00rr rrrr 07rr SWAPA R None
R(4-7) → A(0-3)
0 0111 01rr rrrr 07rr SWAP R R(0-3) ↔ R(4-7) None
0 0111 10rr rrrr 07rr JZA R R+1 → A, skip if zero None
0 0111 11rr rrrr 07rr JZ R R+1 → R, skip if zero None
0 100b bbrr rrrr 0xxx BC R,b 0 → R(b) None <Note2>
0 101b bbrr rrrr 0xxx BS R,b 1 → R(b) None <Note3>
0 110b bbrr rrrr 0xxx JBC R,b if R(b)=0, skip None
0 111b bbrr rrrr 0xxx JBS R,b if R(b)=1, skip None
PC+1 → [SP],
1 00kk kkkk kkkk 1kkk CALL k None
(Page, k) → PC
1 01kk kkkk kkkk 1kkk JMP k (Page, k) → PC None
1 1000 kkkk kkkk 18kk MOV A,k k→A None
1 1001 kkkk kkkk 19kk OR A,k A∨ k→ A Z
1 1010 kkkk kkkk 1Akk AND A,k A&k→A Z
1 1011 kkkk kkkk 1Bkk XOR A,k A⊕ k→ A Z
k → A,
1 1100 kkkk kkkk 1Ckk RETL k None
[Top of Stack] → PC
1 1101 kkkk kkkk 1Dkk SUB A,k k-A → A Z,C,DC
PC+1 → [SP],
1 1110 0000 0001 1E01 INT None
001H → PC
1 1111 kkkk kkkk 1Fkk ADD A,k k+A → A Z,C,DC
<Note 1> This instruction is applicable to IOC5~IOC6, IOCB~IOCF only.
<Note 2> This instruction is not recommended for RF operation.
<Note 3> This instruction cannot operate under RF.
2.4
2.0 2.0
TEST POINTS
0.8 0.8
0.4
AC Testing : Input is driven at 2.4V for logic "1",and 0.4V for logic "0".Timing measurements are
made at 2.0V for logic "1",and 0.8V for logic "0".
CLK
/RESET
Tdrh
CLK
TCC
Ttcc
Items Rating
Temperature under bias 0°C to 70°C
Storage temperature -65°C to 150°C
Input voltage -0.3V to +6.0V
Output voltage -0.3V to +6.0V
6. ELECTRICAL CHARACTERISTICS
APPENDIX
Package Types:
OTP MCU Package Type Pin Count Package Size
EM78P156ELP DIP 18 300 mil
EM78P156ELM SOP 18 300 mil
EM78P156ELAS SSOP 20 209 mil
EM78P156ELKM SSOP 20 209 mil