Data Sheet

EM78M611E
Universal Serial Bus
Series Microcontroller
Product
Specification
DOC. VERSION 1.3
ELAN MICROELECTRONICS CORP.
December 2011
Trademark Acknowledgments:
IBM is a registered trademark and PS/2 is a trademark of IBM.
Windows is a trademark of Microsoft Corporation.
ELAN and ELAN logo
are trademarks of ELAN Microelectronics Corporation.
Copyright © 2006 ~ 2011 by ELAN Microelectronics Corporation
All Rights Reserved
Printed in Taiwan
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. 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 prohibited.
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.
ELAN MICROELECTRONICS CORPORATION
Headquarters:
Hong Kong:
USA:
No. 12, Innovation Road 1
Hsinchu Science Park
Hsinchu, TAIWAN 308
Tel: +886 3 563-9977
Fax: +886 3 563-9966
http://www.emc.com.tw
Elan (HK) Microelectronics
Corporation, Ltd.
Flat A, 19F., World Tech Centre
95 How Ming Street, Kwun Tong
Kowloon, HONG KONG
Tel: +852 2723-3376
Fax: +852 2723-7780
elanhk@emc.com.hk
Elan Information
Technology Group (U.S.A.)
Korea:
Shenzhen:
Shanghai:
Elan Korea Electronics
Company, Ltd.
Elan Microelectronics
Shenzhen, Ltd.
Elan Microelectronics
Shanghai, Ltd.
301 Dong-A Building
632 Kojan-Dong,
Namdong-ku
Incheon City, KOREA
Tel: +82 32 814-7730
Fax: +82 32 813-7730
3F, SSMEC Bldg., Gaoxin S. Ave. I
Shenzhen Hi-tech Industrial Park
(South Area), Shenzhen
CHINA 518057
Tel: +86 755 2601-0565
Fax: +86 755 2601-0500
elan-sz@elanic.com.cn
3F, Building #13
No. 116, Lane 572, Bibo Road.
Zhangjiang Hi-Tech Park
Shanghai, CHINA 201203
Tel: +86 21 5080-3866
Fax: +86 21 5080-4600
elan-sh@elanic.com.cn
P.O. Box 601
Cupertino, CA 95015
U.S.A.
Tel: +1 408 366-8225
Fax: +1 408 366-8225
EM78M611E
Universal Serial Bus Series Microcontroller
Contents
1
General Description .................................................................................................. 1
2
Features ..................................................................................................................... 1
3
Application................................................................................................................. 3
4
Pin Assignment ......................................................................................................... 4
5
Pin Description.......................................................................................................... 6
6
Block Diagram ........................................................................................................... 7
7
Functional Description ............................................................................................. 8
7.1
Program Memory................................................................................................ 8
7.2
Data Memory ...................................................................................................... 9
7.2.1
7.2.2
7.2.3
7.3
Special Purpose Register....................................................................................9
Operational Registers........................................................................................10
7.2.2.1 R0 (Indirect Addressing Register) ......................................................10
7.2.2.2 R1 (Timer/Clock Counter) ..................................................................10
7.2.2.3 R2 (Program Counter and Stack).......................................................10
7.2.2.4 R3 (Status Register) ...........................................................................11
7.2.2.5 R4 (RAM Select Register)..................................................................13
7.2.2.6 R5 (Port 5 I/O Register)......................................................................13
7.2.2.7 R6 (Port 6 I/O Register)......................................................................13
7.2.2.8 R7 (Port 7 I/O Register)......................................................................13
7.2.2.9 R8 (Port 8 I/O Register)......................................................................13
7.2.2.10 R9 (Port 9 I/O Register)......................................................................13
7.2.2.11 RA (EEPROM Control Register) ........................................................14
7.2.2.12 RB (Pattern Detect Application Control Register) ..............................14
7.2.2.13 RC (USB Application Status Register) ...............................................14
7.2.2.14 RD (USB Application FIFO Address Register) ...................................15
7.2.2.15 RE (USB Application FIFO Data Register).........................................15
7.2.2.16 RF (Interrupt Status Register) ............................................................15
Control Registers...............................................................................................16
7.2.3.1 A (Accumulator)..................................................................................16
7.2.3.2 CONT (Control Register)....................................................................17
7.2.3.3 IOC5 ~IOC9 I/O (Port Direction Control Registers) ...........................18
7.2.3.4 IOCA (Operation Mode Control Register) ..........................................18
7.2.3.5 IOCB (Port 9 Wake-up Pin Select Register) ......................................19
7.2.3.6 IOCC (Port 9 LED Sink Capacity Control Register) ...........................19
7.2.3.7 IOCD (Port 9 Pull-high Control Register) ...........................................20
7.2.3.8 IOCE (Special Function Control Register) .........................................20
7.2.3.9 IOCF (Interrupt Mask Register)..........................................................21
Extra Control Register ...................................................................................... 21
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• iii
EM78M611E
Universal Serial Bus Series Microcontroller
7.4
USB Application FIFOs..................................................................................... 21
7.5
USB Application................................................................................................ 21
7.5.1
7.5.2
7.6
Reset ................................................................................................................ 22
7.6.1
7.6.2
7.6.3
7.7
USB Device Controller ......................................................................................21
Device Address and Endpoints .........................................................................22
Power-on Reset.................................................................................................23
Watchdog Reset................................................................................................23
USB Reset.........................................................................................................23
Power Saving Mode ......................................................................................... 23
7.7.1
7.7.2
Power Down Mode ............................................................................................23
Dual Clock Mode ...............................................................................................23
7.8
Interrupt ............................................................................................................ 23
7.9
Pattern Detect Application (PDA) ..................................................................... 25
7.9.1
7.9.2
7.9.3
Function Description..........................................................................................25
Control Register ................................................................................................25
Sampling Rate and Debounce Length ..............................................................26
7.10 Pulse Width Modulation (PWM) ....................................................................... 27
7.10.1 Function Description..........................................................................................27
7.10.2 Duty Cycle .........................................................................................................28
7.10.3 Control Register ................................................................................................28
7.11 Analog-to-Digital Converter (ADC) ................................................................... 28
7.11.1 Function Description..........................................................................................28
7.11.2 Control Register ................................................................................................29
7.12 EEPROM.......................................................................................................... 30
8
Absolute Maximum Ratings ................................................................................... 31
9
DC Electrical Characteristics ................................................................................. 31
10
Application Circuits ................................................................................................ 33
APPENDIX
A
Special Register Map .............................................................................................. 34
B
Instruction Set ......................................................................................................... 36
C
Code Option Register ............................................................................................. 38
iv •
Product Specification (V1.3) 12.12.2011
EM78M611E
Universal Serial Bus Series Microcontroller
Specification Revision History
Doc. Version
Revision Description
Date
1.0
Preliminary version
2006/04/17
1.1
Released version
2006/11/24
1.2
Modified pull-up function
2008/04/29
1.3
Reduced the number of package types
2011/12/12
Product Specification (V1.3) 12.12.2011
•v
EM78M611E
Universal Serial Bus Series Microcontroller
1
General Description
The EM78M611E is a series of 8-bit Universal Serial Bus (USB) RISC architecture,
Multi-Time Programming (MTP) microcontrollers. It is specifically designed for USB low
speed device application and supports standard devices such as PS/2 keyboard. The
EM78M611E also supports one device address and three endpoints. With no firmware
involved, these series of microcontrollers can automatically identify and decode Standard
USB Command to Endpoint Zero.
The EM78M611E has eight-level stacks and six interrupt sources. It has 144 bytes of
general purpose SRAM, 6K bytes of program ROM, and an embedded 4 bytes of
2
E PROM.
These series of ICs have many powerful features, including:
„
Dual clock mode which allows the device to run on low power saving frequency.
„
Pattern Detect Application function which is used in a serial transmission to count
waveform width.
2
„
Pulse Width Modulation that can generate a duty-cycle-programmable signal.
„
24-channel AD converter with up to 10 bits resolution.
Features
„
Operating voltage: 4.4V ~ 5.5V
„
Low-cost solution for low-speed USB devices, such as keyboard, joystick, and
Gamepad
„
USB Specification Compliance
z
z
z
„
„
Universal Serial Bus Specification Version 1.1
USB Device Class Definition for Human Interface Device (HID), Firmware
Specification Version 1.1
Supports one device address and three endpoints
USB Application
z
P75 (D-) has an internal pull-high resistor (1.5 KΩ)
z
USB protocol handling
z
USB device state handling
z
Identifying and decoding of Standard USB commands to EndPoint Zero
PS/2 Application Support
z
Built-in PS/2 port interface for keyboard and mouse
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
•1
EM78M611E
Universal Serial Bus Series Microcontroller
„
Built-in 8-bit RISC MCU
z
8-level stacks for subroutine nesting and interrupt
z
8-bit real time clock/counter (TCC) with overflow interrupt
z
Six available interrupts
z
Built-in RC oscillator free running for Watchdog Timer and Dual clock mode
z
Two independent programmable prescalers for WDT and TCC
z
Two power saving methods:
1. Power-down mode (Sleep mode)
2. Dual clock mode
„
z
Two clocks per instruction cycle
z
Multi-time programmable
I/O Ports
z
z
z
Up to 11 LED sink pins
Each GPIO pin of Ports 5, 6, 8, P90~P93, P95 and P96 has an internal
programmable pull-high resistor (25KΩ)
Each GPIO pin of Port 6, P74 ~ P77 and Port 9 can wake up the MCU from
sleep mode by input state change
„
„
Internal Memory
z
Built-in 6K×13 bits Program ROM
z
Built-in 144 bytes general purpose registers (SRAM)
z
Built-in USB Application FIFOs
z
Built-in 4 bytes EEPROM with a minimum of 4K write/erase cycles
Operation Frequency
z
z
Normal Mode: MCU runs with an external oscillator frequency of 6 MHz or
12 MHz
Dual Clock Mode: MCU runs at a frequency of 256kHz (or 32kHz, 4kHz,
500Hz), emitted by the internal oscillator with the external ceramic resonator
turned off to conserve power.
2•
„
Built-in Pattern Detect Application for serial signal transmission
„
Built-in Pulse Width Modulation (PWM)
z
2 channels PWM function on P92 (PWM1) and P93 (PWM2)
z
8-bit resolution PWM output
z
8 selections of duty cycles
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
„
„
„
3
Built-in 24-Channel Analog-to-Digital Converter (ADC)
z
24 channels
z
10 bits resolution
z
4 ADC conversion rates: 256K/128K/64K/32K
Built-in 3.3V Voltage Regulator
z
For MCU power supply
z
Pull-up source for the external USB resistor on D-pin
Package Type:
z
44-pin QFP (10×10mm, footprint = 3.2mm)
:
EM78M611EDAQJ
z
20-pin SOP (300mil)
:
EM78M611EDBMJ
z
20-pin SSOP (209mil)
:
EM78M611EDDMJ
z
24-pin SOP (300mil)
:
EM78M611EDCMJ
z
24-pin SSOP (150mil)
:
EM78M611EDEMJ
Application
„
USB Keyboard only
„
USB and PS/2 both compatible with Keyboard
„
USB Keyboard with USB Mouse
„
USB Joystick
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
•3
EM78M611E
Universal Serial Bus Series Microcontroller
P76
P77
P70
OSCI
VDD
VSS
OSCO
V3.3
P90
Pin Assignment
D-/DATA/P75
D+/CLK/P74
4
44 43 42 41 40 39 38 37 36 35 34
P91
1
33
P92/SE1/PWM1
2
32
P93/SE2/PWM2
P94/VPP
3
31
4
30
P95
P96
5
29
6
28
7
27
8
26
P71
P72
P67/AD23
P66/AD22
P65/AD21
P64/AD20
P51/AD1
P52/AD2
9
25
P63/AD19
P62/AD18
P61/AD17
10
24
P60/AD16
P53/AD3
11
23
P87/AD15
VNN
P50/AD0
P86/AD14
P84/AD12
P85/AD13
P82/AD10
P83/AD11
P80/AD8
P81/AD9
P56/AD6
P57/AD7
P54/AD4
P55/AD5
12 13 14 15 16 17 18 19 20 21 22
Figure 4-1 EM78M611EDAQ (44-pin QFP)
1
24
VSS
2
23
VDD
V3.3
3
22
P76
D+/CLK/P74
4
21
P77
D- /DATA/P75
5
20
P66/AD22
P92/SE1/PWM1
6
19
P65/AD21
P93/SE2/PWM2
7
18
P64/AD20
P94/VPP
8
17
P63/AD19
VNN
9
16
P62/AD18
P54/AD4
10
15
P61/AD17
P55/AD5
11
14
P60/AD16
12
13
P57/AD7
P56//AD6
Figure 4-2 EM78M611ED BMJ/DMJ
(20-pin SOP/SSOP)
4•
OSCI
OSCO
Figure 4-3 EM78M611ED CMJ/EMJ
(24-pin SOP/SSOP)
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
5
Pin Description
Symbol
I/O
Function
P50 ~ P57
I/O
General 8-bit bidirectional input/output port. All pins on this port can
be internally pulled-high by software control.
P60 ~ P67
I/O
General 8-bit bidirectional input/output port. All pins on this port can
be internally pulled-high by software control.
P70 ~ P72
P76 ~ P77
P80 ~ P87
P90 ~ P93
P95 ~ P96
P94 / Vpp
PWM1
PWM2
LED sink pins
I/O
P76 ~ P77 will have an internally pulled-high resistor when the
EM78M611E is running in PS/2 mode.
I/O
General 8-bit bidirectional input/output port. All pins on this port can
be internally pulled-high by software control.
I/O
General 6-bit bidirectional input/output port. All pins on this port can
be internally pulled-high by software control or LED sink pins.
I
Input only. MTP program pin.
O
PWM output pins.
USB plus data line interface or CLK for PS/2 keyboard.
D+/CLK/P74
I/O
When the EM78M611E is running in PS/2 mode, this pin will have an
internal pulled-high resistor (2.2KΩ), with VDD=5.0V.
USB minus data line interface or DATA for PS/2 keyboard.
D-/DATA/P75
I/O
When the EM78M611E is running in PS/2 mode, this pin will have an
internal pulled-high resistor (2.2KΩ), with V3.3=3.3V.
When the EM78M611E is running in USB mode, this pin will have an
internal pulled-high resistor (1.5KΩ), with VDD=3.3V.
OSCI
I
6MHz / 12MHz ceramic resonator input.
OSCO
O
Return path for 6MHz / 12MHz ceramic resonator.
VNN
−
MTP program pin. Used in programming the on-chip ROM. During
normal operation, this pin is connected to Ground.
V3.3
PWR
3.3V regulator output
VDD
PWR
Power supply pin
GND
PWR
Ground pin
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
•5
EM78M611E
Universal Serial Bus Series Microcontroller
6
Block Diagram
OSCI
Built-in
RC
OSCO
WDT
Timer
V3.3
3.3V
Regulator
Oscillator
Timing
Control
Prescaler
WDT
Reset,
Sleep &
Wake-up
Control
VDD
Prescaler
TCC
R1
(TCC)
D+
D-
Stack 1
Stack 2
Stack 3
Stack 4
Stack 5
Stack 6
Stack 7
Stack 8
R2
(PC)
Transceiver
ROM
USB
Device
Controller
Instruction
Register
R3
(Status)
RAM
Interrupt
Control
R4
(RSR)
ALU
Instruction
Decoder
ACC
DATA & CONTROL BUS
I/O
Port 7
P74/D+/Clk
P75/D-/Data
P70
P71
P72
P76
P77
I/O
Port 9
P90
P91
P92
P93
P94
P95
P96
P97
I/O
Port 8
P80
P81
P82
P83
P84
P85
P86
P87
I/O
Port 6
P60
P61
P62
P63
P64
P65
P66
P67
I/O
Port 5
P50
P51
P52
P53
P54
P55
P56
P57
Figure 6 EM78M611E Block Diagram
6•
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7
Functional Description
The EM78M611E memory is organized into three spaces, namely; User Program
memory in 6K×13 bits ROM space, Data Memory in 144 bytes SRAM space, EEPROM
space and USB Application FIFOs for EndPoint0, EndPoint1, and EndPoint2.
Furthermore, several registers are used for special purposes.
7.1 Program Memory
The program space of the EM78M611E is 6K words, and is divided into six pages.
Each page is 1K words long. After a reset, the 13-bit Program Counter (PC) points to
location zero of the program space.
The Interrupt Vector is at 0x0001 and accommodates TCC interrupt, RF1 (SE1) timing
counter interrupt, RF2 (SE2) timing counter interrupt, P74~P77 State Changed
interrupt, EndPoint0 interrupt, USB Suspend interrupt, USB Reset interrupt, and USB
Host Resume interrupt.
After an interrupt, the MCU will fetch the next instruction from the corresponding
address as illustrated in the following diagram.
After Reset
0X0000
0X0001
PC
0X03FF
0X0400
Address
Reset Vector
Interrupt Vector
Page 0
Page 1
0X07FF
0X0800
Page 2
0X0BFF
0X0C00
Page 3
0X0FFF
0X1000
Page 4
0X13FF
0X1400
Page 5
0X17FF
Figure 7-1 Instruction Fetching after Reset
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
•7
EM78M611E
Universal Serial Bus Series Microcontroller
7.2 Data Memory
The Data Memory has 144 bytes SRAM space. It has also an on-chip USB Application
FIFO space for USB Application. Figure 7-2 shows the organization of the Data
Memory Space.
7.2.1 Special Purpose Register
When the microcontroller executes instructions, specific registers are implemented to
ensure proper operation of essential functions such as Status Register which records
the calculation status, Port I/O Control Registers which control the I/O pins’ direction,
etc. Lots of other special purpose registers are provided for various functions.
Note that Special Control Registers can only be read or written to by two instructions:
IOR and IOW.
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
:
R0
R1(TCC)
R2(PC)
R3(Status)
R4(RSR)
R5(Port5)
R6(Port6)
P7(Port7)
R8(Port8)
R9(Port9)
RA(EECR)
RB(PDACR)
RC(USBSR)
RD(FIFOA)
RE(FIFODR)
RF(ISR)
Stack
(8 levels)
16x8 C om m on
R e g is te r
00
01
:
0F
Endpoint 0
10
11
:
1F
EP0_status
0
1
2
3
4
5
6
7
IOC5
IOC6
IOC7
IOC8
IOC9
IOCA
IOCB
IOCC
IOCD
IOCE
IOCF
EndPoint
address
ERA(ADCR/AD_Sel)
ERB(AD_LSB)
ERC(AD_MSB)
ERD(AD Rate)
ERE(PW M_CNT)
EP_status
1F
00
20
21
:
32x8 Bank
Register (Bank0)
01
32x8 Bank
Register (Bank1)
10
11
32x8 Bank
Register (Bank2)
32x8 Bank
Register (Bank3)
3F
Figure 7-2 Data RAM Organization of EM78M611E
8•
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.2 Operational Registers
The following subsections describe each of the Operation Registers of the Special
Purpose Registers. The Operation Registers are arranged according to the order of the
registers’ address. Note that some registers are read only, while others are both
readable and writable.
7.2.2.1
R0 (Indirect Addressing Register) Default Value: (0B_0000_0000)
R0 is not a physically implemented register. Its major function is as an indirect
addressing pointer. Any instruction using R0 as a pointer actually accesses data
pointed by the RAM Select Register (R4).
7.2.2.2
R1 (Timer/Clock Counter) Default Value: (0B_0000_0000)
The TCC register is an 8-bit timer or counter. It is readable and writable as any other
register. The Timer module will be incremented after execution of every instruction
cycles. User can work around this by writing an adjusted value. The Timer interrupt is
generated when the R1 register overflows from FFh to 00h. This overflow sets bit TCIF
(RF[0]). The interrupt can be masked by clearing bit TCIE (IOCF[0]). After Power-on
reset and Watchdog reset, the initial value of this register is 0x00.
7.2.2.3
R2 (Program Counter and Stack) Default Value: (0B_0000_0000)
The EM78M611E Program Counter is a 13-bit register that allows accessing of the 6k
words of the Program Memory with 8-level stacks. The eight LSB bits, A0~A7, are
located at R2, while the three MSB bits, A12~A10, are located at R3. The Program
Counter is cleared after Power-on reset or Watchdog reset. The first instruction that is
executed after a reset is located at Address 00h.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
•9
EM78M611E
Universal Serial Bus Series Microcontroller
Call
Interrupt
A12 A11 A10
A9 A8
Stack 1
A7~A0
RET
RETL
RETI
Stack 2
Stack 3
Stack 4
Stack 5
0000
Stack 6
Stack 7
Page 0
Stack 8
03FF
0400
Page 1
07FF
0800
Page 2
0BFF
1000
0000 : Reset Vector
0001 : Interrupt Vector
Page 0
13FF
1400
Page 0
17FF
Figure 7-3 Program Counter and Stack
7.2.2.4
R3 (Status Register) Default Value:(0B_0001_1XXX)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PS2
PS1
PS0
T
P
Z
DC
C
R3 [0] Carry/Borrow Flag
0 = No carry-out from the result’s Most Significant bit
1 = A carry-out from the result’s Most Significant bit occurred
NOTE
For Borrow, the polarity is reversed. For rotate (RRC, RLC) instructions, this bit is
loaded with either high or low-order bit of the source register.
R3 [1] Auxiliary Carry/Borrow Flag. For ADD, SUB Instructions
0 = No carry-out from the 4th low-order bit of the result
1 = A carry-out from the 4th low-order bit of the result occurred
NOTE
For Borrow, the polarity is reversed.
10 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
R3 [2] Zero flag. It will be set to 1 when the result of an arithmetic or logic operation is
zero.
R3 [3] Power down flag. It will be set to 1 during Power-on phase or by “WDTC”
command and cleared when the MCU enters into Power down mode. It remains
in its previous state after a Watchdog Reset.
0: Power down
1: Power-on
R3 [4] Time-out flag. It will be set to 1 during Power-on phase or by “WDTC”
command. It is reset to 0 by WDT time-out.
0: Watchdog timer overflow occurs
1: No Watchdog timer overflow
The various states of Power down flag and Time-out flag at different conditions are
shown below:
T
P
Condition
1
1
Power-on reset
1
1
WDTC instruction
0
*P
WDT time-out
1
0
Power down mode
1
0
Wake up caused by port change during Power down mode
*P: Previous status before WDT reset
R3 [5-7] Page selection bits. These three bits are used to select the program memory
page.
PS2
PS1
PS0
Program Memory Page [Address]
0
0
0
Page 0 [0000-03FF]
0
0
1
Page 1 [0400-07FF]
0
1
0
Page 2 [0800-0BFF]
0
1
1
Page 3 [0C00-0FFF]
1
0
0
Page 4 [1000-13FF]
1
0
1
Page 5 [1400-17FF]
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 11
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.2.5
R4 (RAM Select Register) Default Value: (0B_00XX_XXXX)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
BK1
BK0
Ad5
Ad4
Ad3
Ad2
Ad1
Ad0
R4 (RAM select register) contains the address of the registers.
R4 [0~5] used to select registers in 0x00h~0x3Fh. The address 0x00~0x1F is
common space. After 0x1Fh, SRAM is divided into four banks, using Bank
Select Register.
R4 [6, 7] used to select the registers bank (refer to the table below). The following are
two examples:
(1) R4=00001100 and R4=10001100 point to the same register 0x0Ch.
Since 0x0Ch is in the common space, Bit 6 and Bit 7 are meaningless.
(2) R4=10111100 points to the register 0x3C in Bank 2.
7.2.2.6
R4[7]Bk1
R4[6]Bk0
RAM Bank #
0
0
1
1
0
1
0
1
Bank 0
Bank 1
Bank 2
Bank 3
R5 (Port 5 I/O Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
P57
P56
P55
P54
P53
P52
P51
P50
7.2.2.7
R6 (Port 6 I/O Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
P67
P66
P65
P64
P63
P62
P61
P60
7.2.2.8
R7 (Port 7 I/O Register) Default Value: (0B_0000_X000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
P77
P76
D- / P75 / DATA
D+ / P74 / CLK
−
P72
P71
P70
7.2.2.9
R8 (Port 8 I/O Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
P87
P86
P85
P84
P83
P82
P81
P80
7.2.2.10 R9 (Port 9 I/O Register) Default Value: (0B_X00X_0000)
12 •
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
−
P96
P95
−
P93
P92
P91
P90
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.2.11 RA (EEPROM Control Register) Default Value: (0B_1111_1111)
RA is a command register for EEPROM control. For detailed usage of this register,
refer to Section 8.2.3 which describes the EEPROM embedded in the
EM78M611E.
7.2.2.12 RB (Pattern Detect Application Control Register)
Default Value: (0B_0000_0000)
RB is a control register for controlling the Pattern Detect Application function. For
detailed description of this register, refer to Section 8.7.2 which describes the
PDA function.
7.2.2.13 RC (USB Application Status Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
EP0_W
EP0_R
EP1_R
EP2_R
EP2_W
Host_Suspend
EP0_Busy
Stall
RC [0]
Stall flag. While the MCU receives an unsupported command or invalid
parameters from host, this bit will be set to 1 by the firmware to notify the UDC
to return a STALL handshake. When a successful Setup transaction is
received, this bit is cleared automatically. T his bit is readable and writable.
RC [1]
EP0_Busy flag. When this bit is equal to “1,” it indicates that the UDC is
writing data into the EP0’s FIFO or reading data from it. During this time, the
firmware will avoid accessing the FIFO until UDC finishes writing or reading.
This bit is only readable.
RC [2]
Host Suspend flag. If this bit is equal to 1, it indicates that USB bus has no
traffic for a specified period of 3.0 ms. This bit will also be cleared
automatically when there is bus activity. This bit is only readable.
RC [3]
EP2_W flag. This bit is set when the UDC receives a successful data from
USB Host to EP2. Upon detecting that this bit is equal to one, the firmware will
execute a read sequence to the EP2’s FIFO, after which this bit is cleared.
Otherwise, the subsequent data from USB Host won’t be accepted by the
UDC.
RC [4, 5, 6] EP0_R / EP1_R / EP2_R flag. These three bits inform the UDC to read
the data from the FIFO. Then the UDC will send the data to the Host
automatically. After UDC finishes reading the data from the FIFO, this bit will
be cleared automatically.
Therefore, before writing data into FIFO, the firmware will first check this bit to
avoid overwriting the data. These three bits can only be set by firmware and
cleared by hardware.
RC [7]
EP0_W flag. After the UDC completes writing data to the FIFO, this bit will be
set automatically. The firmware will clear it as soon as it gets the data from
EP0’s FIFO. Only when this bit is cleared that the UDC will be able to write a
new data into the FIFO.
Therefore, before the firmware can write data into the FIFO, this bit must first
be set by the firmware to prevent the UDC from writing data at the same time.
This bit is both readable and writable.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 13
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.2.14 RD (USB Application FIFO Address Register)
Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
UAD4
UAD3
UAD2
UAD1
UAD0
RD [0~4]
USB Application FIFO address registers. These five bits are the address
pointers of USB Application FIFO.
RD [5~7] Undefined registers. The default value is zero.
7.2.2.15 RE (USB Application FIFO Data Register)
Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
UD7
UD6
UD5
UD4
UD3
UD2
UD1
UD0
RE (USB Application FIFO data register) contains the data in the register of which
address is pointed by RD.
NOTE
For example, if user wants to read the fourth byte of EndPoint Zero, user has to use the
address of EP0 (0x00) and Data Byte Pointer of EP0 (0x10) to access it.
// Read the 4th byte of the EP0 FIFO
// First, assign the data byte pointer of EP0 register (0X10) with 0X03.
MOV A, @0X10
MOVRD, a
// Move data in A to RD register
MOV A, @0X03
MOVRE , A
// Move data in A to RE register
// Then read the content from EP0 FIFO (0x00) 4th byte
MOV A, @0X00
MOVRD, A
// Assign address point to EP0 FIFO
MOVA, RE
// Read the fourth byte data (Byte 3) of the EP0 FIFO
MOV A, 0X0E // Read the fifth byte data (Byte 4) of the EP0 FIFO
7.2.2.16 RF (Interrupt Status Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
USB Host
SE2_IF
Resume_IF
14 •
Bit 5
SE1_IF
Bit 4
Bit 3
Bit 2
Bit 1
Port7 state
USB
USB
EP0_IF
change_1F Reset_IF Suspend_IF
Bit 0
TCC_IF
RF [0]
TCC Overflow interrupt flag. It will be set while TCC overflows, and is cleared
by firmware.
RF [1]
EndPoint Zero interrupt flag. It will be set when the EM78M611E receives
Vendor/Customer Command to EndPoint Zero. This bit is cleared by
firmware.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
RF [2]
USB Suspend interrupt flag. It will be set when the EM78M611E finds the
USB Suspend Signal on USB bus. This bit is cleared by the firmware.
RF [3]
USB Reset interrupt flag. It will be set when the host issues the USB Reset
signal.
RF [4]
P74/P75/P76/P77 Port state change interrupt flag.
In PS2 Mode, only pins configured as inputs can cause this interrupt to occur.
These pins (P74, P75, P76 and P77) are compared with the value latched on
the last read of Port 7.
In USB Mode, P76 and P77 have this function.
NOTE
RF [4]: Port State Change Interrupt Flag,
EM78M611
USB Mode –P76 and P77 DO NOT have interrupt function.
PS2 Mode – P74/P75/P76/P77 have interrupt function.
EM78M611E
P74/P75/P76/P77 all have interrupt function (in USB and PS2 mode)
RF [5, 6] SE1 / SE2 Pattern Detect Interrupt flag. These two flags are used for Pattern
detect application.
RF [7]
USB Host Resume interrupt flag. It will be set only in Dual clock mode when
the USB suspend signal becomes low.
NOTE
RF [7]: USB Host Resume_IF
In EM78M611, this bit is always ‘1’. It is not for use.
In EM78M611E, this bit is OK for use.
7.2.3 Control Registers
Some special purpose registers are available for special control purposes. Except for
the Accumulator (ACC), these registers must be read and written with special
instructions. One of these registers, CONT, can only be read by the instruction
"CONTR" and written by "CONTW" instruction. The other special control registers can
be read by the instruction "IOR" and written by the instruction "IOW".
The following paragraphs describe only the general functions of the control registers.
7.2.3.1
A (Accumulator)
The accumulator is an 8-bit register that holds operands and results of arithmetic
calculations. It is not addressable. After an interrupt occurs, the Accumulator is
auto-saved by hardware.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 15
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.3.2
CONT (Control Register) Default Value: (0B_0011_1111)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
LED
INT
TSR2
TSR1
TSR0
PSR2
PSR1
PSR0
Except for Bit 6 (Interrupt enable control bit), the CONT register can be read by the
instruction "CONTR" and written by the instruction “CONTW".
CONT [0~2] Watchdog Timer prescaler bits. These three bits are used as the
Watchdog Timer prescaler.
CONT [3~5] TCC Timer prescaler bits.
The relationship between the prescaler value and these bits are shown below:
PSR2/TSR2
PSR1/TSR1
PSR0/TSR0
TCC Rate
WDT Rate
0
0
0
1: 2
1: 1
0
0
1
1: 4
1: 2
0
1
0
1: 8
1: 4
0
1
1
1: 16
1: 8
1
0
0
1: 32
1: 16
1
0
1
1: 64
1: 32
1
1
0
1: 128
1: 64
1
1
1
1: 256
1: 128
NOTE
WDT Timing base is “Power-on time”. Set by the Code Option [2, 1.]
Ex. Code Option [2, 1] = 01 (2ms), and Prescaler = 1:128.
7
WDT Overflow Time is: 2ms × 2 = 256ms
CONT [6] Interrupt enable control bit. This bit toggles Interrupt function between
enable and disable. It is set to 1 by the interrupt disable instruction "DISI"
and reset by the interrupt enable instructions "ENI" or "RETI."
0 : Disable the Interrupt function
1 : Enable the Interrupt function
CONT [7] LED bit. This bit is used to enable the LED sink capacity of P76 and P77.
0 : Disable the LED sink capacity of P76, P77
1 : Enable the LED sink capacity of P76, P77
16 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.3.3
IOC5 ~IOC9 I/O (Port Direction Control Registers)
Default Value: (0B_1111_1111)
These are I/O port (Port 5 ~ Port 7) direction control registers. Each bit controls the I/O
direction of three I/O ports respectively. When these bits are set to 1, the relative I/O
pins become input pins. Similarly, the I/O pins becomes outputs when the relative
control bits are cleared.
0 : Output direction
1 : Input direction
7.2.3.4
IOCA (Operation Mode Control Register) Default Value: (0B_1110_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Dual_Frq.1
Dual_Frq.0
/P76,/P77
Pull high
Remote_Wa
ke up
ExReg_Sel
PDA
PS/2
USB
IOCA [0, 1]
IOCA[2]
These two bits are used to select the operation mode.
IOCA[1]
IOCA[0]
0
0
Detect Mode
Operation Mode
0
1
USB Mode
1
0
PS/2 Mode
1
1
USB Test Mode
Pattern Detect Application function enable bit. This bit is used to enable the
Pattern Detect Application (PDA) function. For details about this function
refer to Section 8.11.
0 : Disable PDA function
1 : Enable PDA function
IOCA[3]
Extra control register select bit. The five extra control registers (REA, REB,
REC, RED, and REE) are located in 0xA~0xE. To access these five
registers, set the bit as follows:
0 : Select RA~RE
1 : Select Extra Control register ERA~ERE
IOCA[4]
Indicate whether the device is currently requested to support remote wake
up or not. The Remote Wake-up field can be modified by SetFeature () and
ClearFeature () requests.
0 : Do Not support remote wake up
1 : Supports remote wake up
NOTE
IOCA[4]: Remote_Wake up bit
The EM78M611 does NOT support this function. Only EM78M611E does.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 17
EM78M611E
Universal Serial Bus Series Microcontroller
IOCA[5]
Pull-high resistor of P77 and P76. USB mode only.
0 = Pull-high is enabled
1 = Pull-high is disabled
NOTE
IOCA[5]: /P76, /P77 Pull-high bit
The previous version of EM78M611/EM78611 does NOT support this function. Only
the EM78M611E/newEM78611 supports this function in USB mode.
IOCA [6, 7] Select the operation frequency in Dual Clock Mode. Four frequencies are
available and can be chosen as Dual Clock Mode in running the MCU
program.
7.2.3.5
Dual_Frq.1
Dual_Frq.0
Frequency
0
0
500Hz
0
1
4kHz
1
0
32kHz
1
1
256kHz
IOCB (Port 9 Wake-up Pin Select Register)
Default Value: (0B_X111_1111)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
−
/P96
/P95
/P94
/P93
/P92
/P91
/P90
IOCB [0~6] These bits are used to select which of the Port 9 pins is to be assigned to
wake up the MCU while in Power down mode.
0 : Enable the function
1 : Disable the function
IOCB[7]
7.2.3.6
Reserved bit
IOCC (Port 9 LED Sink Capacity Control Register)
Default Value: (0B_X00X_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
−
P96
P95
−
P93
P92
P91
P90
IOCC [0~3, 5, 6] LED sink control bit. These bits are used to enable the LED sink
capacity of P90 ~ P97
0 : Disable the LED sink capacity of respective pins
1 : Enable the LED sink capacity of respective pins
IOCC [4, 7] Reserved bits
18 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.2.3.7
IOCD (Port 9 Pull-high Control Register) Default Value: (0B_X11X_1111)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
−
/PH96
/PH95
−
/PH93
/PH92
/PH91
/PH90
IOCD [0~3, 5, 6] These bits control the 25KΩ pull-high resistor of individual pins in
Port 9.
0 : Enable the pull-high function
1 : Disable the pull-high function
IOCD [4, 7] Reserved bits
7.2.3.8
IOCE (Special Function Control Register) Default Value: (0B_1101_0111)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
/Dual clock
/WUE
WTE
RUN
Device_Resume
/PU8
/PU6
/PU5
IOCE [0, 1, 2] Port 5, Port 6, and Port 8 pull-high control bits.
0 : Enable
1 : Disable
IOCE [3] Setting this bit will allow the UDC to execute resume signaling. This bit is set
by firmware to generate a signal to wake-up the USB host and is cleared as
soon as the USB Suspend signal becomes low. It can only be used in Dual
clock mode when the USB suspend signal becomes low.
NOTE
IOCE[3]: Device_Resume bit
In EM78M611, this bit is always ‘0’. It is not for use.
In EM78M611E, this bit is O.K. for use.
IOCE [4] Run bit. This bit can be cleared by firmware and set during power-on, or by
the hardware at a falling edge of the wake-up signal. When this bit is cleared,
the clock system is disabled and the MCU enters into Power down mode. At
the transition of wake-up signal from high to low, this bit is set to enable the
clock system.
0 : Sleep mode. The EM78M611E is in power down mode.
1 : Run mode. The EM78M611E is working normally.
IOCE [5] Watchdog Timer enable bit. The bit disables/enables the Watchdog Timer.
0 : Disable WDT
1 : Enable WDT
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 19
EM78M611E
Universal Serial Bus Series Microcontroller
IOCE [6] Enable the wake-up function as triggered by port-changed. This bit is set by
UDC.
0 : Enable the wake-up function
1 : Disable the wake-up function
IOCE [7] Dual clock Control bit. This bit is used to select the frequency of the system
clock. When this bit is cleared, the MCU will run on very low frequency for
power saving and the UDC will stop working.
0 : Selects to run on slow frequency
1 : Selects EM78M611E to run on normal frequency
7.2.3.9
IOCF (Interrupt Mask Register) Default Value:(0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
USB Host
Resume_IE
SE2_IE
SE1_IE
Port 7 state
change_1E
USB
Reset_IE
Bit 2
Bit 1
Bit 0
USB
EP0_IE TCC_IE
Suspend_IE
IOCF [0~7] TCC / EP0 / USB Suspend / USB Reset / Port 7 State Change / SE1_IE /
SE2_IE / USB Host Resume interrupt enable bits. These eight bits control
the TCC interrupt function, EP0 interrupt, USB Suspend interrupt, USB
Reset interrupt, Port 7 State Change interrupt and USB Host Resume
interrupt respectively. Individual interrupt is enabled by setting its
associated control bit in the IOCF to "1".
0 : Disable Interrupt
1 : Enable Interrupt
Only when the global interrupt is enabled by the ENI instruction will the individual
interrupt work. After DISI instruction, any interrupt will not work even if the respective
control bits of IOCF are set to 1.
The USB Host Resume Interrupt works only in Dual clock mode. This is because when
the MCU is in sleep mode, it will be automatically woken up by the UDC Resume signal.
7.3 Extra Control Register
Five extra control registers are available to control some special functions. The five
registers are ERA (AD Control register), ERB (AD_LSB), ERC (AD_MSB), ERD
(AD_Rate), and ERE (PWM Control register)
Remember to set IOCA[3] before accessing these five registers. The operating method
is the same as with other control registers.
20 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.4 USB Application FIFOs
For USB Application, EM78M611E provides an 8-byte First-In-First-Out (FIFO) buffer for
each endpoint. The buffer cannot be accessed directly. However, a corresponding Data
Byte Pointer register for each endpoint is made available to address the individual byte of
the FIFO buffer. The contents of the individual byte will map to a special register.
Address
(RD)
0X10
Data Byte Pointer of EP0
0X11
Data Byte Pointer of EP1
0X12
Data Byte Pointer of EP2
Counter
0X00
EP0's FIFO
0X01
EP1's FIFO
0X02
EP1's FIFO
Pointer
Counter
Pointer
Counter
Pointer
0
0
0
1
1
1
2
2
2
3
3
3
4
4
4
5
5
5
6
6
6
7
7
7
Bi-directional
Uni-directional
Bi-directional
7.5 USB Application
EM78M611E is designed specially for USB device application and has many powerful
functions that support the firmware to free itself from complex situation in various
aspects of USB application.
7.5.1 USB Device Controller
The EM78M611E built-in USB Device Controller (UDC) can interpret the USB Standard
Command and respond automatically without involving firmware. The embedded
Series Interface Engine (SIE) handles the serialization and de-serialization of actual
USB transmission. Thus, a developer can concentrate his efforts more in perfecting
the device actual functions and spend less energy in dealing with USB transaction.
The UDC handles and decodes most Standard USB commands defined in the USB
Specification Rev1.1. If the UDC receives an unsupported command, it will set a flag to
notify the MCU of the receipt of such command. The Standard Commands that the
EM78M611E supports includes; Clear Feature, Get Configuration, Get Interface,
Get Status, Set Address, Set Configuration, Set Feature, and Set Interface.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 21
EM78M611E
Universal Serial Bus Series Microcontroller
Each time the UDC receives a USB command, it writes the command into the EP0’s
FIFO. Only when it receives unsupported command will the UDC notify the MCU
through interrupt.
Hence, the EM78M611E is very flexible under USB application since the developer can
freely choose the method of decoding the USB command as dictated by different situation.
7.5.2 Device Address and Endpoints
The EM78M611E supports one device address and three endpoints, namely, EP0 for
control endpoint, EP1 and EP2 for interrupt endpoint. Sending data to USB host in the
EM78M611E is very easy. Just write data into the EP’s FIFO, then set the flag, and the
UDC will handle the rest. It will then confirm that the USB host has received the correct
data from the EM78M611E.
7.6 Reset
The EM78M611E provides three types of reset:
1. Power-on Reset
2. Watchdog Reset
3. USB Reset
7.6.1 Power-on Reset
Power-on Reset occurs when the device is attached to power and a reset signal is
initiated. The signal will last until the MCU becomes stable. After a Power-on Reset,
the MCU enters into the following predetermined states (see below), and then, it is
ready to execute the program.
a. The program counter is cleared.
b. The TCC timer and Watchdog timer are cleared.
c. Special registers and Special Control registers are all set to their initial values.
7.6.2 Watchdog Reset
When the Watchdog timer overflows, it causes the Watchdog to reset. After it resets,
the program is executed from the beginning and some registers will be reset. The UDC
however, remains unaffected.
7.6.3 USB Reset
When the UDC detects a USB Reset signal on the USB Bus, an MCU interrupt occurs,
after which it proceeds to perform the specified process that follows. After a USB
device is attached to the USB port, it cannot respond to any bus transactions until it
receives a USB Reset signal from the bus.
22 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.7 Power Saving Mode
The EM78M611E provides two options of power-saving modes for energy conservation,
i.e., Power Down mode and Dual clock mode.
7.7.1 Power Down Mode
The EM78M611E enters into Power Down mode by clearing the RUN register
(IOCE[4]). During this mode, the oscillator is turned off and the MCU goes to sleep. It
will wake up when signal from USB host is resumed, or when a Watchdog reset occurs
or when an input port state changes.
If the MCU wakes up when the I/O port status changes, the direction of the I/O port
should be set at input direction, and then read the port state. For example:
:
// Set the Port 6 to input port
MOV
A, @0xFF
IOW
PORT6
// Read the Port 6 state
MOV
PORT6, PORT6
// Clear the RUN bit
IOR
0xE
AND
A, 0B11101111
IOW
:
:
0xE
7.7.2 Dual Clock Mode
The EM78M611E has one internal oscillator for power saving application. Clearing the
Bit IOCE [7] will enable the low frequency oscillator. At the same time, the external
oscillator will be turned off. Then the MCU will run under very low frequency to
conserve power. Four types of frequency are available for selection in setting bits
IOCA [6, 7].
The USB Host Resume Interrupt can only be used in this mode. If this interrupt is
enabled, the MCU will be interrupted when the USB Host Resume signal is detected on
the USB Bus.
7.8 Interrupt
The EM78M611E has one interrupt vector in 0x0001. When an interrupt occurs during
an MCU program run, it will jump to the interrupt vector (0x0001) and execute the
instructions sequentially from the interrupt vector. RF is the interrupt status register,
which records the interrupt status in the relative flags/bits.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 23
EM78M611E
Universal Serial Bus Series Microcontroller
The interrupt condition could be one of the following:
TCC Overflow: When the Timer Clock / Counter Register (R1) overflows, the status flag
RF[0] will be set to 1. Its Interrupt Vector is 0X0001.
Port 7 State Change: When the input signals in Port 7 changes, the status flag RF[4]
will be set to 1. Its Interrupt Vector is 0X0001.
SE1 Pattern Detection Interrupt Conditions: If the Pattern Detection Application
function is enabled, there will be four conditions with which interrupt is generated,
and the status flag RF[5] is set to 1 (Interrupt Vector is 0X0001).
a) Signal from P.92 changes to low and the Pattern Counter value is bigger than
R11 register value.
b) Signal from P.92 changes to high, and Pattern Counter value bigger than R10
register value.
c) P.92 remains high, and the Pattern Counter value is equal to 0XFF.
d) P.92 remains low, and the Pattern Counter value is equal to 0XFF.
SE2 Pattern Counter Interrupt Conditions: If the Pattern Detection Application function
is enabled, there will be three conditions with which interrupt is generated and the
status flag RF[6] is set to 1(interrupt vector is 0X0001).
a) Signal from P.93 changes to low and the Pattern Counter value is bigger than
R13 register value.
b) Signal from P.93 changes to high and the Pattern Counter value is bigger than
R12 register value.
c) P.93 remains high, and the Pattern Counter value is equal to 0XFF.
d) P.93 remains low, and the Pattern Counter value is equal to 0XFF.
EP0 interrupt: When the UDC successfully accepts a setup transaction from host to
EndPoint0, the status flag RF[1] is set to 1. Its Interrupt Vector is 0X0001.
USB suspend: When UDC detects a USB Suspend signal on the USB bus, the status
flag RF[2] is set to 1. Its Interrupt Vector is 0X0001.
USB Reset: When the UDC detects a USB Reset signal on the USB bus, the status flag
R[3] is set to 1. Its Interrupt Vector is 0X0001.
USB Host Resume: When the UDC detects that the USB bus is no longer in Suspend
condition and without Device Resume signal, the status flag R[7] is set to 1. Its
Interrupt Vector is 0X0001.
The IOCF is an interrupt mask register which can be set bit by bit. While their
respective bit is written to 0, the hardware interrupt will inhibit, that is, the EM78M611E
will not jump to the interrupt vector to execute instructions. But the interrupt status flags
still records the conditions no matter whether the interrupt is masked or not. The
interrupt status flags must be cleared by firmware before leaving the interrupt service
routine and enabling other interrupt.
The global interrupt is enabled by the ENI (RETI) instruction and is disabled by the DISI
instruction.
24 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.9 Pattern Detect Application (PDA)
7.9.1 Function Description
This function is designed for the serial signal transmission, e.g., the transmission
between a wireless device and its receiver box. The EM78M611 has two sets of built-in
Pattern Detect Application block that ensures the EM78M611 is equipped with a
compound device, such as the receiver box controller for a wireless keyboard paired
with a wireless mouse.
Pattern Detect Application (PDA) can calculate the length of one pattern and interrupt
the MCU while the serial signal is transiting from high to low (or vise-versa). Then the
MCU reads the length value from a specified register.
7.9.2 Control Register
The PDA includes an enable control bit, one control register and 4-length counter
registers in 0x10 ~0x13.
IOCA [2] PDA Enable Control Bit
When this bit is set, the PDA function starts and the P92 and P93 automatically become
input pin to sample the serial signal.
0 : disable PDA function
1 : enable PDA function
RB (PDA Control Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
SE2.F
SE1.F
SR.2
SR.1
SR.0
DB2
DB1
DB0
This register is used to define two parameters of PDA function; signal sampling rate
and debounce length. When a pattern ends, the value in the counter is loaded into its
respective register and the RB[6] or RB[7] is set to indicate which type of pattern (high
or low) is at its end or which type of pattern counter is on overflow.
0: low pattern
1: high pattern
R10 (P.92 Low Pattern Counter)
This register records the length of P.92 in low status.
R11 (P.92 High Pattern Counter)
This register records the length of P.92 in high status.
R12 (P.93 Low Pattern Counter)
This register records the length of P.93 in low status.
R13 (P.93 High Pattern Counter)
This register records the length of P.93 in high status.
R10~R13 function as general registers if this function is not enabled. Once the enabled
bit is set, these four registers will be loaded with the value of the pattern counter.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 25
EM78M611E
Universal Serial Bus Series Microcontroller
7.9.3 Sampling Rate and Debounce Length
Although the two-pattern detect pins are separate, and each pin has its own pattern
counter, both pins use the same Sampling Rate and Debounce Length parameters.
The PDA samples the serial signal for every fixed interval. The pattern counter will be
incremented by one at sampling time if the signal remains unchanged. If the signal is at
high state, then the “high pattern counter“ increases, otherwise the “low pattern
counter” increases. As long as the signal state changes, the PDA will debounce signal
and load the value of pattern counter into the respectively register for the firmware to
read. For example, if the signal in P.92 is in “low” state, the low counter of P.92 will
count continuously until the state of the input signal in P.92 changes. When a state
change occurs (in this case, the signal changes from “low” to “high” state), the PDA will
take a time break (which is equal to the result of sampling interval multiplied by the
debounce length), to avoid possible noise. After the debounce length time, if the signal
remains in high state, the high pattern counter will start to count and load the low
pattern counter’s value into R10. At the same time, RB[6] is cleared to indicate that low
pattern is over.
The correlation between the control register value and the debounce time are as
follows:
DB.2
DB.1
DB.0
Debounce Time
0
0
0
0
0
0
1
Sampling clock
0
1
0
Sampling clock × 2
0
1
1
Sampling clock × 3
1
0
0
Sampling clock × 4
1
0
1
Sampling clock × 5
1
1
0
Sampling clock × 6
1
1
1
Sampling clock × 7
On the other hand, when the signal of P92 always remains “low”, the low pattern
counter of P92 will eventually overflow. Once the counter overflows, the contents of the
counter will also be loaded into R10, that is, the register is written to 0xFF, and the
counter is reset to count from zero again.
If the hardware interrupt of PDA function is enabled, (IOCF[5] is equal to “1”), then the
program will go to 0x0001 to execute interrupt routine while the contents of a pattern
counter is loaded into the register.
26 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
The correlation between the value of control register and the actual sampling rate are
as shown below:
SR.2 SR.1 SR.0
Sampling Rate
Sampling Rate
(External oscillator frequency=6MHz) (External oscillator frequency=12MHz)
0
0
0
N.A.
N.A.
0
0
1
N.A.
N.A.
0
1
0
1500 (Count/ms)
N.A.
0
1
1
750 (Count/ms)
1500 (Count/ms)
1
0
0
375 (Count/ms)
750 (Count/ms)
1
0
1
188 (Count/ms)
375 (Count/ms)
1
1
0
94 (Count/ms)
188 (Count/ms)
1
1
1
47 (Count/ms)
94 (Count /ms)
After the PDA function is enabled (by setting IOCA[2] to 1), user can write a default
value to the High Pattern counter register and Low Pattern counter register. Then set
the corresponding interrupt enable bit (IOCF[5]). When the counting value of one “H”
pattern is bigger than the default value of R11, the Pattern Detecting interrupt will be
generated. Similarly, if the counting value of one “L” pattern is bigger than the default
value of R10, Low Pattern Detecting interrupt will occur. Thus, the EM78M611 is
notified and made aware that one effective pattern is received from P.92.
If user does not need these two interrupts, they can be masked. The new value of
counting a pattern will still be loaded to the R10 and R11. The firmware must poll and
determine whether the value of these two registers has changed or not.
7.10 Pulse Width Modulation (PWM)
7.10.1 Function Description
In PWM mode, both PWM1 (P.92) and PWM2 (P.93) produce plus programmable
signal of up to 8 bits resolution.
The PWM Period is defined as 0xFF × Timer Counter Clock. The Timer Counter clock
source is controlled by an extra control register, ERE. For example; if the Clock source
is 1MHz, then the Period will be 255 µseconds.
⎛
⎞
1
⎟
Period = 255 × ⎜
⎜ Timer Counter Clock ⎟
⎝
⎠
Period (0xFF * Clock)
Duty Cycle
Fig. 8-3 PWM Output Timing
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 27
EM78M611E
Universal Serial Bus Series Microcontroller
7.10.2 Duty Cycle
The PWM duty cycle is defined by writing to the R10/R11 Register for PWM1/PWM2.
Duty Cycle = ( R10 / 255 ) × 100% for PWM1
( R11 / 255 ) × 100% for PWM2
7.10.3 Control Register
R10 (PWM1 Duty Cycle Register)
A specified value keeps the output of PWM1 to remain at high for a Period.
R11 (PWM2 Duty Cycle Register)
A specified value keeps the output of PWM2 to remain at high for a Period.
ERE (PWM Control Register) Default Value: (0B_0000_0001)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PEN2
PEN1
-
-
-
PS2
PS1
PS0
ERE [0~2] PWM Clock Prescaler
PS2
0
0
0
0
1
1
1
1
PS1
0
0
1
1
0
0
1
1
PS0
0
1
0
1
0
1
0
1
Clock (Hz)
Fosc/3
Fosc/6
Fosc/12
Fosc/24
Fosc/48
Fosc/96
Fosc/192
Fosc/384
Period/255 (s)
0.5µ
1µ
2µ
4µ
8µ
16µ
32µ
64µ
ERE [6, 7] PWM1/PWM2 Enable Bit
0 : Disable
1 : Enable
7.11 Analog-to-Digital Converter (ADC)
7.11.1 Function Description
The Analog to Digital converter consists of a 5-bit analog multiplexer, one Control
Register (ERA), and two data registers (RBS & RCS) for 10-bit resolution.
The ADC module utilizes successive approximation to convert the unknown analog
signal to a digital value. The result is fed to the ADDATA. Input channels are selected
by the analog input multiplexer via the ADCS/RAS bits AD0~AD4.
10-bit resolution: 0x00-00~0xC0-FF (0b11000000-11111111)
Start (0x00-00): 0 Vref~(1/1024) × Vref
Full (0xC0-FF): (1023/1024) × Vref~Vref
Conversion Time: 12 clock time of internal clock source
28 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
7.11.2 Control Register
ERA (AD Channel Select Register) Default Value: (0B_0001_1111)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
ADC
0
0
AD4
AD3
AD2
AD1
AD0
ERA [0~4]: AD Channel Selector
AD4
AD3
AD2
AD1
AD0
Channel
I/O Port
0
0
0
0
0
0
P50
0
0
0
0
1
1
P51
0
0
0
1
0
2
P52
0
0
0
1
1
3
P53
0
0
1
0
0
4
P54
0
0
1
0
1
5
P55
0
0
1
1
0
6
P56
0
0
1
1
1
7
P57
0
1
0
0
0
8
P80
0
1
0
0
1
9
P81
0
1
0
1
0
10
P82
0
1
0
1
1
11
P83
0
1
1
0
0
12
P84
0
1
1
0
1
13
P85
0
1
1
1
0
14
P86
0
1
1
1
1
15
P87
1
0
0
0
0
16
P60
1
0
0
0
1
17
P61
1
0
0
1
0
18
P62
1
0
0
1
1
19
P63
1
0
1
0
0
20
P64
1
0
1
0
1
21
P65
1
0
1
1
0
22
P66
1
0
1
1
1
23
P67
ERA [7] AD Converter ready flag
0 → 1: Start AD Conversion (set by firmware).
1 → 0: When AD conversion is finished and has moved digital data into the AD
Data Register, this bit will be set by hardware.
NOTE
Hardware can enable this function only at AD Channel Select of the functional I/O port.
After a power-on reset, the initial value of this register is 0b0001_1111.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 29
EM78M611E
Universal Serial Bus Series Microcontroller
ERB (AD LSB Data Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Bit 1
Bit 0
0
0
0
0
0
0
8 bits AD LSB Digital Data
ERC (AD MSB Data Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
2 bits AD MSB Digital Data.
ERD (AD Control Register) Default Value: (0B_0000_0000)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
0
0
0
0
-
ADPS1
ADPS0
ERD [0 1]: The clock source of AD conversion time.
00: 256kHz
01: 128kHz
10: 64kHz
11: 32kHz
7.12
EEPROM
Four bytes of EEPROM are located in the R2C~R2F of Bank 3. The stored data of
EEPROM are not erased when the power is off and can be read and re-written by
firmware. In some special case of application, for example, cordless keyboard
controller, it can store important data, such as the cordless keyboard’s device identical
number.
A control register, RA controls the EEPROM, that is, to read, write, or to erase the data
from EEPROM. Writing a command into this register will execute an action to the
EEPROM. The command value is defined in the following tale. Note that there is an
execution time laps for each command. Before writing the next command into the
control register, allow enough time for the EEPROM to finish the previous command.
30 •
Command Value
Action
Execution Time
0B_0000_0000
Read
1 ms
0B_0000_0001
Write
9 ms
0B_0000_0010
Erase
128 ms
0B_0000_0011
Disable
N.A.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
8
Absolute Maximum Ratings
Symbol
Min
Max
Unit
0
70
ºC
Storage temperature
-65
150
ºC
Input voltage
-0.5
6.0
V
Output voltage
-0.5
6.0
V
Temperature under bias
9
DC Electrical Characteristics
T = 25ºC, VDD=5V, VSS=0V
Symbol
Parameter
Condition
Min
Type
Max
Unit
3.0
3.3
3.6
V
3.3V Regulator
VRag
Output voltage of 3.3V Regulator
VDD = 5V
VResetL
Low Power Reset detecting low
Voltage
−
−
−
2.2
V
VResetH
Low Power Reset detecting high
Voltage
−
3.0
−
−
V
Ireg
3.3V Regulator driving capacity
−
−
100
mA
−
−
±1
µA
V3.3 = 3.3V
MCU Operation
IIL
Input Leakage Current for input pins VIN=VDD, VSS
VIHX
Clock Input High Voltage
OSCI
2.5
−
−
V
VILX
Clock Input Low Voltage
OSCI
−
−
1.0
V
ICC1
VDD operating supply current –
Normal frequency operation mode
Freq. = 6MHz
−
−
10
mA
ICC2
VDD operating supply current –
Normal frequency operation mode
Freq. = 12MHz
−
−
20
mA
Freq. = 256kHz
−
−
250
µA
WDT disabled
−
−
100
µA
ICC3
ISB1
VDD operating supply current –
Dual clock mode
Operating supply current 1 –
Power down mode
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 31
EM78M611E
Universal Serial Bus Series Microcontroller
Symbol
Parameter
Condition
Min
Type
Max
Unit
GPIO Pins
VIH
Input High Voltage
Port 5 ~ Port 9
2.0
−
−
V
VIL
Input Low Voltage
Port 5 ~ Port 9
−
−
0.8
V
IOH1
Output High Voltage
(P70~P73, P76 and P77)
ISink = 10.0mA
VDD = 5V
−
10
−
mA
IOH2
Output High Voltage
(P74, P75)
ISink = 5.0mA
VDD = 5V
−
5
−
mA
IOH3
Output High Voltage
ISink = 10.0mA
(Port 5, Port 6, Port 8 and P90~P93,
VREG = 3.3V
P95, P96)
−
10
−
mA
IOL1
Output Low Voltage
(P76 and P77 normal mode)
ISink = 10.0mA
VDD = 5V
−
10
−
mA
IOL2
Output Low Voltage
(P74, P75)
ISink = 10.0mA
VDD = 5V
−
5
−
mA
IOL3
Output Low Voltage
ISink = 10.0mA
(P70~P73, P76 and P77 sink LED) VDD = 5V
−
10
−
mA
IOL4
Output Low Voltage
(P90 ~ P93, P95, P96 normal
mode)
ISink = 10.0mA
VREG = 3.3V
−
10
−
mA
IOL5
Output Low Voltage
(P90 ~ P93, P95, P96 sink LED)
ISink = 10.0mA
VREG = 3.3V
−
10
−
mA
Input pin with
pull-high
resistor ,
VREG = 3.3V
−
25
−
KΩ
Input pin with
pull-high
resistor ,
VDD = 5V
−
2.2
−
KΩ
RPH1
RPH2
Pull-high resistor
(Port 5, 6, 8, 9)
Pull-high resistor(P.74 ~ P.77)
(P74/P75) PS2 mode
USB Interface
32 •
VOH
Static Output High
2.8
−
3.6
V
VOL
Static Output Low
−
−
0.3
V
0.2
−
−
V
0.8
−
2.5
V
0.8
−
2.0
V
VDI
Differential Input Sensitivity
VCM
Differential Input Command Mode
Range
VSE
Single Ended Receiver Threshold
CIN
Transceiver Capacitance
−
−
20
pF
VRG
Output Voltage of Internal
Regulator
3.0
−
3.6
V
RPH3
Pull-high resistor (P.75 / D-)
−
1.5
−
KΩ
USB operation
Mode
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
10 Application Circuits
NOTE
A. BC1 , BC2 : load Capacitor
B. C1 (bypass capacitor) : that is placed adjacent to VDD pin , to minimize noise.
C. C2 , C3 (power capacitor) : that placed adjacent to the Power source , will improve
the transient response and ripple rejection.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 33
EM78M611E
Universal Serial Bus Series Microcontroller
APPENDIX
A Special Register Map
Operation Registers
Addr.
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit1
Bit 0
Default Value
Indirect Addressing Register
0B_0000_0000
Timer/Clock Counter
0B_0000_0000
Program Counter
0B_0000_0000
0x00
R0
0x01
R1 (TCC)
0x02
R2 (PC)
0x03
R3 (Status)
PS2
PS1
PS0
0x04
R4 (RSR)
BK1
BK0
Select the register (Address: 00~3F) in indirect addressing mode
0x05
R5 (Port 5)
P57
P56
P55
P54
P53
P52
P51
P50
0B_0000_0000
0x06
R 6 (Port 6)
P67
P66
P65
P64
P63
P62
P61
P60
0B_0000_0000
0x07
R 7 (Port 7)
P77
P76
P75/D-
P74/D+
/DATA
/CLK
P72
P71
P70
0B_0000_u000
0x08
R8 (Port 8)
P87
P86
P85
P84
P83
P82
P81
P80
0B_0000_0000
0x09
R9 (Port 9)
-
P96
P95
-
P93
P92
P91
P90
0B_u00u_0000
0x0A
RA
-
-
-
-
EE_OK
EE_C1
EE_C0
0B_1111_1111
0x0B
RB
SE2.F
SE1.F
SR.2
SR.1
SR.0
DB2
DB1
DB0
0B_1111_1111
0x0C
RC
EP0_W
EP0_R
EP1_R
EP2_R
EP2_W
UDC
UDC
_SUSPEND
_Writing
STALL
0B_0000_0000
0x0D
RD
USB Application FIFO Address Register
0B_0000_0000
0x0E
RE
USB Application FIFO Data Register
0B_0000_0000
0x0F
RF
T
USB Host
Resume_
IF
34 •
SE1_IF
SE1_IF
P
Z
-
-
Port 7 state
USB
USB
change_1F
Reset_IF
Suspend_IF
DC
EP0_IF
C
TCC_IF
0B_0001_1xxx
0B_0000_0000
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
Control Registers
Addr
Name
CONT
Bit 7
S7
Bit 6
Bit 5
INT
TSR2
Bit 4
SR1
Bit 3
TSR0
Bit 2
PSR2
Bit 1
Bit 0
Default Value
PSR1
PSR0
0B_0011_1111
0x05
IOC5
Port 5 Direction Control Register
0B_1111_1111
0x06
IOC6
Port 6 Direction Control Register
0B_1111_1111
0x07
IOC7
Port 7 Direction Control Register
0B_1111_1111
0x08
IOC8
Port 8 Direction Control Register
0B_1111_1111
0x09
IOC9
Port 9 Direction Control Register
0B_1111_1111
0x0A
IOCA
0x0B
IOCB
-
/P96
/P95
0x0C
IOCC
-
P96
P95
0x0D
IOCD
-
/P96
/P95
0x0E
IOCE
/Dual clock
/WUE
WTE
0x0F
IOCF
SE2_IE
SE1_IE
Dual_
Dual_
Frq.1
Frq.0
USB Host
Resume_IE
-
Remote_
ExReg_
Wake Up
Sel
/P94
PDA
PS/2
USB
0B_11x0_0000
/P93
/P92
/P91
/P90
0B_x111_1111
-
P93
P92
P91
P90
0B_x00x_0000
-
/P93
/P92
/P91
/P90
0B_x00x_0000
/PU8
/PU6
/PU5
0B_1101_0111
EP0_IE
TCC_IE
0B_0000_0000
Bit 1
Bit 0
Default Value
Device_
RUN
Resume
Port 7 state
USB
USB
change_1F
Reset_IE
Suspend_IE
Bit 4
Bit 3
Bit 2
Extra Register (IOCA[3] = 1)
Addr
Name
Bit 7
0x0A
ERA
0x0B
ERB
Digital Data (Bit 1~Bit 0)
0B_0000_0000
0x0C
ERC
Digital Data (Bit 10~Bit 2)
0B_0000_0000
0x0D
ERD
-
0x0E
ERE
PEN2
ADC
Bit 6
Bit 5
-
-
PEN1
AD4
AD3
-
-
-
-
-
-
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
AD2
AD1
PS2
AD0
0B_0001_1111
ADSP1
ADSP0
0B_0000_0000
PS1
PS0
0B_0000_0001
• 35
EM78M611E
Universal Serial Bus Series Microcontroller
B Instruction Set
Each instruction in the instruction set is a 13-bit word divided into an OP code and one
or more operands. All instructions are executed within one single instruction cycle
(consisting of two oscillator periods), unless the program counter is changed by(a) Executing the instruction "MOV R2, A", "ADD R2,A", "TBL", or any other instructions
that write to R2 (e.g. "SUB R2,A", "BS R2,6", "CLR R2", ⋅⋅⋅⋅).
(b) Execute CALL, RET, RETI, RETL, JMP, Conditional skip (JBS, JBC, JZ, JZA, DJZ,
DJZA) which were tested to be true.
Under these cases, the execution takes two instruction cycles.
In addition, the instruction set has the following features:
(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.
Legend:
R = Register designator that specifies which one of the 64 registers (including operation and general
purpose registers) is to be utilized by the instruction.
Bits 6 and 7 in R4 determine the selected register bank.
b = Bit field designator that selects the value for the bit located in the register R and which affects the
operation.
k = 8 or 10-bit constant or literal value
36 •
Binary Instruction
Hex
Mnemonic
0 0000 0000 0000
0000
NOP
Operation
No Operation
Decimal Adjust A
Status Affected
None
0 0000 0000 0001
0001
DAA
0 0000 0000 0010
0002
CONTW
C
0 0000 0000 0011
0003
SLEP
0 0000 0000 0100
0004
WDTC
0 → WDT
T, P
0 0000 0000 rrrr
000r
IOW R
A → IOCR
None1
A → CONT
None
0 → WDT, Stop oscillator
T, P
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
0 0000 0001 0011
0013
RETI
[Top of Stack] → PC,
Enable Interrupt
None
0 0000 0001 0100
0014
CONTR
CONT → A
None
0 0000 0001 rrrr
001r
IOR R
IOCR → A
None1
0 0000 0010 0000
0020
TBL
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
R2+A → R2,
Bits 8~9 of R2 unchanged
Z, C, DC
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
Binary Instruction
Hex
Mnemonic
Operation
Status Affected
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
01rr
01rr
02rr
02rr
02rr
02rr
03rr
03rr
03rr
03rr
04rr
04rr
04rr
04rr
05rr
05rr
05rr
05rr
DECA R
DEC R
OR A,R
OR R,A
AND A,R
AND R,A
XOR A,R
XOR R,A
ADD A,R
ADD R,A
MOV A,R
MOV R,R
COMA R
COM R
INCA R
INC R
DJZA R
DJZ R
Z
Z
Z
Z
Z
Z
Z
Z
Z, C, DC
Z, C, DC
Z
Z
Z
Z
Z
Z
None
None
0 0110 00rr rrrr
06rr
RRCA R
0 0110 01rr rrrr
06rr
RRC R
0 0110 10rr rrrr
06rr
RLCA R
0 0110 11rr rrrr
06rr
RLC R
0 0111 00rr rrrr
07rr
SWAPA R
0
0
0
0
0
0
0
07rr
07rr
07rr
0xxx
0xxx
0xxx
0xxx
SWAP R
JZA R
JZ R
BC R,b
BS R,b
JBC R,b
JBS R,b
1 00kk kkkk kkkk
1kkk
CALL k
1
1
1
1
1
kkkk
kkkk
kkkk
kkkk
kkkk
1kkk
18kk
19kk
1Akk
1Bkk
JMP k
MOV A,k
OR A,k
AND A,k
XOR A,k
1 1100 kkkk kkkk
1Ckk
RETL k
1 1101 kkkk kkkk
1 1111 kkkk kkkk
1Dkk
1Fkk
SUB A,k
ADD A,k
R-1 → A
R-1 → R
A ∨ VR → A
A ∨ VR → R
A&R→A
A&R→R
A⊕R→A
A⊕R→R
A+R→A
A+R→R
R→A
R→R
/R → A
/R → R
R+1 → A
R+1 → R
R-1 → A, skip if zero
R-1 → R, skip if zero
R(n) → A(n-1),
R(0) → C, C → A(7)
R(n) → R(n-1),
R(0) → C, C → R(7)
R(n) → A(n+1),
R(7) → C, C → A(0)
R(n) → R(n+1),
R(7) → C, C → R(0)
R(0-3) → A(4-7),
R(4-7) → A(0-3)
R(0-3) ↔ R(4-7)
R+1 → A, skip if zero
R+1 → R, skip if zero
0 → R(b)
1 → R(b)
if R(b)=0, skip
if R(b)=1, skip
PC+1 → [SP],
(Page, k) → PC
(Page, k) → PC
k→A
A∨k→A
A&k→A
A⊕k→A
k → A, [Top of Stack] →
PC
k-A → A
k+A → A
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0001
0001
0010
0010
0010
0010
0011
0011
0011
0011
0100
0100
0100
0100
0101
0101
0101
0101
0111
0111
0111
100b
101b
110b
111b
01kk
1000
1001
1010
1011
10rr
11rr
00rr
01rr
10rr
11rr
00rr
01rr
10rr
11rr
00rr
01rr
10rr
11rr
00rr
01rr
10rr
11rr
01rr
10rr
11rr
bbrr
bbrr
bbrr
bbrr
kkkk
kkkk
kkkk
kkkk
kkkk
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
rrrr
C
C
C
C
None
None
None
None
None2
None
None
None
None
None
None
Z
Z
Z
None
Z, C, DC
Z, C, DC
1
Note: This instruction is applicable to IOCx only.
2
This instruction is not recommended for RE, RF operation.
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 37
EM78M611E
Universal Serial Bus Series Microcontroller
C Code Option Register
EM78M611E has two Code option registers, which are not part of the normal program
memory. The option bits cannot be accessed during normal program execution.
Address 000:
Bit
12
11
10
9
8
7
6
5
4
3
2
1
0
Mnemonic ID_8 ID_7 ID_6 ID_5 ID_4 ID_3 ID_2 ID_1 ID_0 OST_1 OST_0 Frequency /Protect
Address 001:
Bit
5
4
3
2
1
0
Mnemonic
/AD_Hold
/R.S.
−
−
Package_1
Package_0
Bit
12
11
Mnemonic QTP_Code1 QTP_Code0
10
9
8
7
6
EP2_
EP2_
EP2_
EP2_
EP2_
Maxsize_2
Maxsize_1
Maxsize_0
DIR
Enable
Address 000:
Bit 1 (Frequency) : Frequency Selection
0 : MCU run on 12 MHz
1 : MCU run on 6 MHz
Bits 3~2 (OST_1 ~ OST_0) : Oscillator start-up time.
00 : 500µs
01 : 2ms
10 : 8ms
11 : 16ms
Bits 4~12: User ID
Address 001:
Bits 1~0 (Package_1 ~ Package_0) : Package type selection
00 : Not defined
01 : 40 pins
10 : Not defined
11 : 44 pins
Bits 3~2: Reserved bits
38 •
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
EM78M611E
Universal Serial Bus Series Microcontroller
Bit 4 (/R.S.) : D- Pull-up Resistance
0 : Connect Resistor Switch
1 : Disconnect Resistor Switch
Bit 5 (/AD_Hold) : Halts the MCU during AD conversion
0 : Halts the MCU during AD conversion
1 : MCU keeps running during AD conversion
Bit 6 (EP2_Enable) : Endpoint 2 Enable
0 : Disable
1 : Enable
Bit 7 (EP2_Dir) : Endpoint 2 Direction
0 : OUT
1 : IN
Bits 10~8 (EP2_Maxsize_2~0) : Endpoint 2 maximum size
000 : 1 Byte
001 : 2 Bytes
010 : 3 Bytes
011 : 4 Bytes
100 : 5 Byte
101 : 6 Bytes
110 : 7 Bytes
111 : 8 Bytes
Bits 12~11: Values are fixed
Product Specification (V1.3) 12.12.2011
(This specification is subject to change without further notice)
• 39