Contents General Description...1 Features ...1 Pin Assignment ...1 Pin Description...2 Function Description...3 Functional Block Diagram ... 3 Operating Registers ... 4 Special Purpose Registers ... 19 CPU Operation Mode ... 23 AD Converter... 24 Time Base Timer and Keytone Generator ... 26 UART (Universal Asynchronous Receiver/Transmitter)...
Page 4
Contents 5.14 Reset and Wake-up... 42 5.14.1 Reset ... 42 5.14.2 Wake-up from Sleep Mode ... 43 5.14.3 Wake-up from Idle Mode ... 43 5.14.4 The Status of RST, T, and P of the Status Register ... 48 5.15 Interrupt ... 49 5.16 Oscillator...
General Description The EM78P312N is an 8-bit microprocessor with low-power, high-speed CMOS technology and high noise immunity. It has an on-chip 4K×13-bits Electrical One Time Programmable Read Only Memory (OTP-ROM). multi-protection bits to prevent intrusion of user’s OTP memory codes. Seven Option bits are also available to meet user’s requirements.
EM78P312N 8-Bit Microcontroller 5.2 Operating Registers Register Bank 0 Address R0/ IAR R1/ TCC R2/ PC R3/ SR R4/ RSR Port 6 Port 7 Port 8 TC2CR/ ADDL Port 9 Reserved TC4CR TC4D ISFR0 ISFR1 ISFR2 16 Byte Common Register...
Page 9
For an interrupt trigger, the program ROM will jump to individual interrupt vector at Page 0. The CPU will store ACC, R3 status and R5 PAGE automatically, it will restore after instruction RETI. Product Specification (V1.0) 10.03.2006 (This specification is subject to change without further notice) EM78P312N 8-Bit Microcontroller • 5...
Page 11
General Purpose Register Bank (Address 20H ~ 3FH) Bit 5 Bit 4 Bit 3 Program Memory Page [Address] Page 0 [0000~03FF] Page 1 [0400~07FF] Page 2 [0800~0BFF] Page 3 [0C00~0FFF] EM78P312N 8-Bit Microcontroller Bit 2 Bit 1 Bit 0 RSR2 RSR1 RSR0 Bank 0...
Page 12
EM78P312N 8-Bit Microcontroller R6 (Port 6 I/O Data Register) Bit 7 Bit 6 Bit 7 ~ Bit 0 ( P67 ~ P60 ) : 8-bit Port 6 I/O data register User can use IOC6 register to define each bit whether input or output.
Page 13
Pulse Width Modulation output Bit 5 Bit 4 Bit 3 TC4D5 TC4D4 TC4D3 TC4D2 Bit 5 Bit 4 Bit 3 INT3F INT3R EM78P312N 8-Bit Microcontroller Resolution Max. Time ( Fosc=8M ) ( Fosc=8M ) 256μS 65mS 16μS 4μS 1μS 255μS 500nS 127.5μS...
Page 14
EM78P312N 8-Bit Microcontroller RE (Interrupt Status Flag Register 1) Bit 7 Bit 6 EXIF5 TCIF2 Bit 7 ( EXIF5 ) : External Interrupt Flag (/INT5), flag cleared by software. Bit 6 ( TCIF2 ) : 16-bit Timer/Counter 2 Interrupt Flag, flag cleared by software.
Page 15
Bit 5 Bit 4 Bit 3 TC3DA5 TC3DA4 TC3DA3 Bit 5 Bit 4 Bit 3 TC3DB5 TC3DB4 TC3DB3 EM78P312N 8-Bit Microcontroller Bit 2 Bit 1 Bit 0 Resolution Max. time ( Fc=8M ) ( Fc=8M ) 512μS 131.1mS 128μS 32.6mS 16μS...
Page 16
EM78P312N 8-Bit Microcontroller Bank 1 R8 TC2CR/ ADDL (Timer/Counter 2 Control Register, AD Low 2 bits Data Buffer) Bit 7 Bit 6 ADD1 ADD0 Bit 7 ~ Bit 6 ( ADD1 ~ ADD0 ) : AD low 2-bit data buffer Bit 4 ( TC2M ) : Timer/Counter 2 mode select TC2M = “0”...
Page 17
ADIS0 Bit 5 Bit 4 Bit 3 ADE5 ADE4 ADE3 Bit 5 Bit 4 Bit 3 ADD7 ADD6 ADD5 EM78P312N 8-Bit Microcontroller Max. Operating Frequency (Fc) 1MHz 4MHz 8MHz Analog Input Pin Bit 2 Bit 1 Bit 0 ADE2 ADE1...
Page 18
EM78P312N 8-Bit Microcontroller Bank 1 RE TBKTC (TBT/Keytone Control) Bit 7 Bit 6 TCK1 Bit 7 ( TEN ) : Keytone enable control TEN = “0” : Disable TEN = “1” : Enable Bit 6 ~ Bit 5 ( TCK1 ~ TCK0 ) : Keytone Output Clock Source Select...
Page 19
(This specification is subject to change without further notice) BRATE1 BRATE0 Bit 5 Bit 4 Bit 3 SBIM1 SBIM0 UINVEN TC2CK0 Bit 5 Bit 4 Bit 3 PRERR OVERR EM78P312N 8-Bit Microcontroller Baud Rate e.g. Fc=8MHz Fc/13 38400 Fc/26 19200 Fc/52 9600 Fc/104 4800 Fc/208 2400 Fc/416...
Page 20
EM78P312N 8-Bit Microcontroller Bit 6 ( EVEN ) : Select parity check EVEN = “0” : Odd parity EVEN = “1” : Even parity Bit 5 ( PRE ) : Enable parity addition PRE = “0” : Disable PRE = “1” : Enable Bit 4 ( PRERR ) : Parity error flag.
Page 21
(This specification is subject to change without further notice) Clock Source BRS0 ( Normal, Idle ) External clock (/SCK pin) External clock (/SCK pin) buffer. Bit 5 Bit 4 Bit 3 EM78P312N 8-Bit Microcontroller Max. Transfer Rate ( Fc = 8MHz ) 0.95Kbit/s 3.8Kbit/s 7.6Kbit/s 30.5Kbit/s 122Kbit/s 244Kbit/s...
Page 22
EM78P312N 8-Bit Microcontroller Bit 2 ~ Bit 1 ( SPIM1 ~ SPIM0) : SPI Transfer Mode Select TC2CK1 Bit 0 ( RBF ) : Set to 1 by Buffer Full Detector, and cleared to 0 automatically when reading data from the SPID register. RBF bit will be cleared by hardware when enabling SPI.
/PHE72 Bit 5 Bit 4 Bit 3 /PLE73 /PLE72 Bit 5 Bit 4 Bit 3 WDTP1 WDTP0 WDTE WDTP0 EM78P312N 8-Bit Microcontroller Bit 2 Bit 1 Bit 0 /PHE71 /PHE70 Bit 2 Bit 1 Bit 0 /PLE71 /PLE70 Bit 2...
Page 24
EM78P312N 8-Bit Microcontroller Bit 2 ( PSR2 ) ~ Bit 0 ( PSR0 ) : TCC prescaler bits PSR2 IOC6 ~ IOC9 − I/O Port Control Register "1" puts the relative I/O pin into high impedance, while "0" defines the relative I/O pin as output.
Page 25
ENI + EXIE5 (IMR2) Bit 5 Bit 4 Bit 3 VOF[2] VOF[1] VOF[0] Bit 5 Bit 4 Bit 3 ADIE EXIE3 EM78P312N 8-Bit Microcontroller Digital Noise Edge Reject Falling Rising or Falling 15/Fc, 63/Fc Rising or Falling or 7/Fc Rising/Falling Bit 2...
/SLEEP pin wake up Idle Set SIS = 0, execute SLEP instruction Interrupt Frequency Turn on Idle Turn off EM78P312N 8-Bit Microcontroller Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 − − SIS=1 + SLEP Sleep Mode CPU : Halts...
EM78P312N 8-Bit Microcontroller In Sleep mode, the internal oscillator is turned off and all system operation is halted. Sleep mode is released by /SLEEP pin (level sensitive or edge sensitive can be set by System Control Register (SCR) Bit 0 (REM)). After a warm-up period, the next instruction will be executed which is after the Sleep mode start instruction.
Page 29
ADCK0 and ADCK1 select the conversion time (Tct), in terms of instruction cycles. This allows the MCU to run at maximum frequency without sacrificing accuracy of A/D conversion. For the EM78P312N, the conversion time per bit is about 4μs. Table 5 shows the relationship between Tct and the maximum operating frequencies.
EM78P312N 8-Bit Microcontroller 5.6 Time Base Timer and Keytone Generator Registers for AD Converter Circuit R_BANK Address Name Bit 7 Bank 1 0X0E Bank 0 0x0F 0x0F Data Output Fosc/2 Fosc/2 Fosc/2 Fosc/2 TCK1:0 The Keytone output can generate 50% duty pulse for driving a piezo-electric buzzer.
Page 31
Source Clock TBTEN TBT Interrupt Product Specification (V1.0) 10.03.2006 (This specification is subject to change without further notice) TBTEN TBKTC Fig. 5-8 TBT Configuration Fig. 5-9 Time Base Timer Timing Chart EM78P312N 8-Bit Microcontroller Falling Edge Detector Interrupt • 27...
EM78P312N 8-Bit Microcontroller 5.7 UART (Universal Asynchronous Receiver/Transmitter) Registers for UART Circuit R_BANK Address Name Bit 7 Bank 2 0X05 Bank 2 0X06 Bank 2 0X07 Bank 2 0X08 Bank 2 0X09 Bank 0 0x0F 0x0F UINVEN In Universal Asynchronous Receiver Transmitter (UART), each transmitted or received character is individually synchronized by framing it with a start bit and stop bit.
EM78P312N 8-Bit Microcontroller 3. Start transmitting. 4. Serially transmitted data are transmitted in the following order from the TX pin. 5. Start bit: one “0” bit is output. 6. Transmit data: 7, 8 or 9 bits data are output from the LSB to the MSB.
EM78P312N 8-Bit Microcontroller 5.8.1 Serial Clock Six internal clocks can be selected by setting BRS0 ~ BRS2 and the clock output to the outside from /SCK (P70) pin. The External clock can also be used and connected to /SCK (P70) pin.
Page 37
(This specification is subject to change without further notice) shift start shift start shift finish a0 a1 a2 a3 a4 a5 a6 a7 b0 b1 b2 b3 b4 b5 b6 b7 read data Fig. 5-15 Receive Mode (8-bit, 1 word) EM78P312N 8-Bit Microcontroller read data • 33...
Page 38
EM78P312N 8-Bit Microcontroller SPIS /SCK pin SO pin SI pin SPIF SPID write data (d) Multiple Device Connect (/SS) When selecting external clock for transfer clock source, the /SS function can be used. This pin (/SS) will be active when the /SS function is enabled, else the /SS pin is a general purpose I/O.
EM78P312N 8-Bit Microcontroller 5.9.1 Timer Mode In Timer mode, counting up is performed using the internal clock. When the contents of the up-counter matched with the TCR2 (TCR2H+TCR2L), then interrupt is generated and the counter is cleared. Counting up resumes after the counter is cleared.
EM78P312N 8-Bit Microcontroller Rising Edge Falling Detector INT3ES TC3M TC3 pin fc/2 fs/2 fc/2 fs/2 fc/2 TC3S TC2CK TC3CR Fig. 5-22 Configuration of Timer/Counter3 5.10.1 Timer Mode In Timer mode, counting up is performed using the internal clock. When the contents of the up-counter matched with the TCR3DA, then interrupt is generated and the counter is cleared.
EM78P312N 8-Bit Microcontroller fc/2 fc/2 8-bit Up-counter fc/2 TC4 pin TC4CK TC4S TC4CR 5.11.1 Timer Mode In Timer mode, counting up is performed using the internal clock. When the contents of the up-counter matched with the TCR4, then interrupt is generated and the counter is cleared.
18 ms (default). The WDT can also be used as a timer to generate an interrupt at fixed interval. Product Specification (V1.0) 10.03.2006 (This specification is subject to change without further notice) Overflow Match Overwrite Fig. 5-26 Timing Chart for PWM Mode EM78P312N 8-Bit Microcontroller Overflow Match Shift 1 Period • 41...
EM78P312N 8-Bit Microcontroller 5.13 I/O Ports The I/O registers, Port 6, Port 7, Port 8, and Port 9 are bi-directional tri-state I/O ports. Each I/O pin can be defined as “input” or “output” pin by the I/O control register (IOC6 ~ IOC9).
This will reset the controller and run the program at address zero. (3) WDT time out This will reset the controller and run the program at address zero. Product Specification (V1.0) 10.03.2006 (This specification is subject to change without further notice) EM78P312N 8-Bit Microcontroller • 43...
Page 48
EM78P312N 8-Bit Microcontroller Table 6. Summary of the Initialized Values for Registers Address Name Reset Type Bit Name Power-on 0x06 IOC6 /RESET and WDT time out Wake-up from Sleep, Idle mode Bit Name Power-on 0x07 IOC7 /RESET and WDT time out...
Page 50
EM78P312N 8-Bit Microcontroller Register Bank 1 Addres Name Reset Type Bit Name Power-on 0x05 TC3CR /RESET and WDT time out Wake-up from Sleep, Idle mode Bit Name Power-on 0x06 TC3DA /RESET and WDT time out Wake-up from Sleep, Idle mode...
EM78P312N 8-Bit Microcontroller General Purpose Registers Address Name Reset Type Bit Name 0x10 Power-on /RESET and WDT time out 0x3F Wake-up from Sleep, Idle mode Legend: “×” = not used “u” = unknown or don’t care 5.14.4 The Status of RST, T, and P of the Status Register The values of T and P are used to verify the event that triggered the processor to wake up.
High frequency oscillator 5.16.2 Crystal Oscillator/Ceramic Resonators (Crystal) EM78P312N has a clock generator. i.e. fc (high frequency) which can be driven by an external clock signal through the OSCI pin. In most applications, Pin OSCI and Pin OSCO can be connected with a crystal or ceramic resonator to generate oscillation.
Page 55
Table12. Capacitor Selection Guide for Crystal Oscillator or Ceramic Resonator Oscillator Type Ceramic Resonator Crystal Oscillator OSCI EM78P312N EM78P809N Product Specification (V1.0) 10.03.2006 (This specification is subject to change without further notice) OSCI OSCO EM78P312N EM78P809N Fig. 5-29 Crystal/Resonator Circuit...
EM78P312N 8-Bit Microcontroller OSCI EM78P809N EM78P312N Fig. 5-32 Crystal/Resonator-Parallel Mode Circuit 5.16.3 External RC Oscillator Mode For applications that do not need very precise timing calculation, the RC oscillator 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.
The values are for design reference only. 5.17 Code Option Register The EM78P312N has one CODE option word that is not part of the normal program memory. The option bits cannot be accessed during normal program execution. Code Option Register and Customer ID Register arrangement distribution:...
Any microcontroller is not guaranteed to start and operate properly before the power supply maintains at its steady state. The EM78P312N has a built-in Power On Voltage Detector (POVD) with a detecting level of 2.1V. It will work well if V (10 ms or less).
/RESET EM78P312N EM78P809N Fig. 5-34 External Power-Up Reset Circuit 5.18.2 Residue-Voltage Protection When battery is replaced, device power (V The residue-voltage may trip below V cause a poor power-on reset. Fig.35 and Fig. 36 show how to build the residue-voltage protection circuit.
EM78P312N 8-Bit Microcontroller 5.19 Instruction Set Each instruction in the instruction set is a 13-bit word divided into an OP code and one or more operands. Normally, all instructions are executed within one single instruction cycle (one instruction consists of 2 oscillator periods), unless the program counter is changed by instruction "MOV R2,A", "ADD R2,A", or by instructions of arithmetic or...
Page 61
A, k 1Bkk A, k 1Ckk RETL 1Dkk A, k 1Fkk A, k 1E8k PAGE 1E9k BANK EM78P312N 8-Bit Microcontroller Status Operation Affected A → R None 0 → A 0 → R R-A → A Z,C,DC R-A → R Z,C,DC R-1 →...
EM78P312N 8-Bit Microcontroller Absolute Maximum Ratings 6.1 Absolute Maximum Ratings Items Temperature under bias Storage temperature Input voltage Output voltage Operating Frequency (2clk) 6.2 Recommended Operating Conditions Vss = 0V Symbol Parameter Supply Voltage Crystal: VDD 4.5 to 5.5V Crystal: VDD 2.5 to 5.5V 58 •...
2.0V for logic "1",and 0.8V for logic "0". RESET Tim ing (CLK="0") /RESET TCC Input Tim ing (CLKS="0") Tins Product Specification (V1.0) 10.03.2006 (This specification is subject to change without further notice) TEST POINTS Instruction 1 Tdrh Ttcc EM78P312N 8-Bit Microcontroller Executed • 63...
EM78P312N 8-Bit Microcontroller A Package Types: OTP MCU EM78P312NP EM78P312NK EM78P312NAK EM78P312NM EM78P312NS Y/S/J : Green product does not contain hazardous substances. The third edition of Sony SS-00259 standard. Pb content should be less than 100ppm. Pb content to fit in with Sony spec.