TMP87C408M TOSHIBA

Document overview

  • Manufacturer or author: Provided By digicamel.com
  • PDF pages: 84

Technical content

Features

8-bit single chip microcomputer TLCS-870 series P-SOP2B-450-1.27 @ Minimum instruction execution time: 0.5 us (at 8 MHz) a > (TMP87C408/C808/P808) = ei tpe7caosm 0.95 ys (at 4.2 MHz) & Ai TMP87C408LM (TMP87C408L/C808L/P808L) PENA . TMP87C808M @ 129 types & 412 basic instructions TpeypeoeM arene ‘ a , . 87P808M. @ Multiplication (8 bits x 8 bits, 16 bits = 8 bits) TMP87P808LM :Execution time 3.5 vs (at 8 MHz) P-SDIP28-400-1.78 (TMP87C408/C808/P808) —— 7.0 us (at 4 MHz) wa 4a) TwP87C408N (TMP87C408L/C808L/P808L) oa Aegiyil! TMP87c408LN © Bit manipulations Guat yt" Tmpe7ceosn (Set / Clear / Complement / Load / Store / Test / Exclusive or) Sagi iS ote © 16-bit data operations a . TMP87P808LN @ 1-byte jump /call (Short relative jump / Vector call) P-SSQP30-56-0.65 NES ss TMP87C408DM 100070768°1 @ For a discussion of how the reliability of microcontrollers can be predicted, please refer to Section 1.3 of the chapter entitled Quality and Reliability Assurance / Handling Precautions. @ TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA. products, to comply with the standards of safety. in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA. products specifications, Also, please keep in mind the precautions and conditions set forth in the “Handling Guide for Semiconductor Devices,” or “TOSHIBA Semiconductor Reliability Handbook” etc.. @The TOSHIBA products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc). These TOSHIBA products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a, malfunction or failure of which may cause loss of human life or. bodily injury (“Unintended Usage”). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety, devices, etc.. Unintended Usage of TOSHIBA products listed in this document shall be made at the customer's ‘own risk. gm products described in this document are subject to the foreign exchange and foreign trade laws. The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA CORPORATION for any infringements of intellectual property or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any intellectual property or other rights of TOSHIBA CORPORATION or others. @ The information contained herein is subject to change without notice. 3-08-1 2001-01-22

TOSHIBA TMP87C408/808/408L/808L @ 10 interrupt sources (External: 4, Internal: 6) @ All sources have independent latches each, and nested interrupt control is available. @ Edge-selectable external interrupts with noise reject @ High-speed task switching by register bank changeover @ Input / Output ports (22 pins) @ Middle current output: 6 pins = (Typ.7 mA) (TMP87C408/C808/P808) (Typ. 6 mA) (TMP87C408L/C808L/P808L) @ Two 16-bit Timer/Counters @ Timer, Eventcounter, Programmable pulse generator output, Pulse width measurement, External trigger timer, Window modes @ Time Base Timer @ Interrupt frequency types: 8 types (1 to 16384 Hz) @ Divider output function (frequency: 4 types) @ Watchdog Timer @ One 8-bit Serial Interface @ With 8 bytes transmit/receive data buffer @ Internal / external serial clock, and 4/8-bit mode @ 8-bit Successive approximate type A/D converter with sample and hold ®@ 6 analog inputs ®@ Conversion time: 23 us /92 us at 8 MHz programmable selectable (TMP87C408/C808/P808) 46 us / 184 us at 4 MHz programmable selectable (TMP87C408L/C808L/P808L) @ Two Power saving operating modes @ STOP mode: Oscillation stops. Battery/Capacitor back-up Port output hold/high-impedance @ IDLE mode : CPU stops, and Peripherals operate using high-frequency clock. Release by interrupts. 1.8 to 4.0 V at 4.2 MHz (TMP87C408L/C808L/P808L) @ Emulation pod : ~BM87C408M0A 3-08-2 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Pin Assignments (Top View) P-SOP28-450-1.27/ P-SDIP28-400-1.78 P-SOP30-56-0.65 xout <—(]1 28 F<—voo xour <1 30 \\<—voo xin —> (2 27 [<> RESET xin —>(]2 29 PD <>aesT rest O13 26 [<> Pro (nr) rest > 43 28 1 <> pro GT) ro? <> 4 25 <> ers ant) vor <> 4 27 F< ersanty vs <> O15 24 DP <> przuntarrery ros <> 15 26 FD <> rr2anrarcry (ainsstors) pos <> C1 6 23D <>13 Ov) (ainsstops)p6s <>] 6 25D <>P130v0) (ainastora) pea <>] 7 22 1 <> P14 Pre) ainastora)p6a <>} 7 24D <> p14 Pre) (ainaistors) P63 <> C] 8 21 P< eis.rcay Nc Os 230 nc (ainarsTor2) P62 <> C] 9 20 <>Pis (aina/stor3) P63 <> C} 9 22D <>ersirce) (aint) p61 <>] 10 19 <>p17 (ainzvsto2) p62 ~<>C] 10 21 <6 caino) p60 <>C] 11 18 <>72 caintyp6t <> O11 20 P<>Pi7 (warer)p77 <> C12 17 <> era eee (aino) p60 <> C12 19 D <r (STORINTS) P76. <>] 13 16 <> raisin (varer) p77 <>C] 13 18 P<>736eR) (vass) vss —»(] 14 15 [] «> P75 (so) (STOPIINTS) P76 <>] 14 17 DF <> P74 (5!) (vassyvss —> C15 16 [<> P75 (s0) Block Diagram Bowes { voo Supply vss V al ata Memory Register Banks verte st =o TestPin TEST Program Memory i = Time Base Te-bit B-bit Serial Resonator (yin Timer Timer/Counters Interface conmecinn{ out HT wih | clock Pin ister Timer Decoder pra et—

0 O O 0

abit [>] [>| a ; P67 VAREF P17 P77 P66 (P77) to to P65 (AINS /STOPS) Analog P10 P72 tot P62 (AIND /STOP2) orege P61 {AINT PEO LAINGS (Analog inputs/ stop mode release) 3-08-3 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Pin Function P17, P16 v0 8-bit programmable input/output seutinutnenenenenenefucnencnuenenecenee] poets (tri-states) sotenetseessttnntnetsnnisotseenantsetnesetnets P15 (TC2) VO (Input) Each bit of these ports can be individually _| Timer/Counter 2 input P14 (PPG) configured as an input or an output under Programmable pulse generator output soeenene| YQ (Qutput) | S0ftware control. When used as an vssesetveesstrsneentennsvtssennreneteeisennete P13 (DVO) external interrupt input or a timer Divider output pioanyartet counter input, the input mode is c ) configured. When used as a divider Extemalinteruptinput20rTimer/Counter input P11 (INT1) W/O (Input) output or a PPG output, the latch must be _| external interrupt input 1 set to "1" and the output mode is : P10 (INTO) configured. External interrupt input 0 P67, P66 8-bit programmable input/output port feveslieeneetnneseeeetsn (tri-states). Each bit of the port can be snnnnnnnennnrgnnninnnnnnntn P65 (AINS/STOPS) individually configured as an input or an AlDconverter | — Stopmode P64 (AIN4/STOPA) output under software control. When analoginputs release inputs used as an analog input or stop mode i P63 (AIN3 / STOP3) VO(Input) _| release input , the input mode is : P62 (AIN2/STOP2) configured i PEr(AINt) AUD converter analog inputs P60 (AINO) P77 (VAREF) 6-bit programmable input/output port | analog reference power supply soscsenteeneeen] YQ (Qutput) _ | (tri-states). vssenenteesnsetnnenenvstiseeneennenvereeeseenetc P76 (STOP/INTS) Each bit of these ports can be individually | stoP mode release input/External interrupt S input configured as an input or an output under . P74 (SI) vO(inputy _ | When used as an external interrupt input | sig serial data input | oF a serial interface input pin, the input . P73 (SCK) VO (VO) mode is configured. When used as a serial | SIO serial clock input/output footnuaisnntintiufaninnmnnns| interface output pin, the latch must be set | nwstssneteneensennsennsens P72 vo to “1” and the output mode is configured. Resonator connecting pins for clock. XIN, XOUT Input, Output an ; For inputting external clock, XIN is used and XOUT is opened 2.7 to 5.5 V (TMP87C408/C808/P808), 1.8 to 4.0 V (TMP87C408L/CBOBL/PBOBL) Power Supply VSS (VASS) OV (GND) Analog reference GND 3-08-4 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Operational Description 1. CPU Core Functions The CPU core consists of a CPU, a system clock controller, an interrupt controller, and a watchdog timer. This section provides a description of the CPU core, the program memory, the data memory, and the reset circuit. 1.1. Memory Address Map The TLCS-870 Series is capable of addressing 64 Kbytes of memory. Figure 1-1 shows the memory address. maps of the 87C408/808/408L/808L. In the TLCS-870 Series, the memory is organized 4 address spaces (ROM, RAM, SFR, and DBR). It uses a memory mapped I/O system, and all I/O registers are mapped in the SFR/DBR address spaces. There are 16 banks of general-purpose registers. The register banks are also assigned to the RAM address space. 0000,, 0000,, SFR ( 003F 003

9040 S040 J Register banks

i | 128 bytes : | 128 bytes | | (8 registers x 16 banks) QOBE foe OBE Jose ooco 00¢0 RAM | | | 128 bytes | | 128 bytes Note: ROM; Read Only Memory includes: i : Program memory 013F 013F RAM ; Random Access Memory includes: pi PoE : Data memory iP po i Stack Hed => it = General- purpose register banks OFFO OFFO SFR; Special Function Register includes: DBR | | Bbytes : | Bbytes "NO ports : : Peripheral hardware control registers OFF7 OFF7 Peripheral hardware status registers i= =z it = System control registers pi i i Interrupt control registers Pd 1 £000 T7936 Program Status Word F000 [3gqp lS: bytes DBR; Data buffer registers includes: i bytes il i ] suse | SIO transmit/receive data buffer FFOO FFOO Rom] 192 : 192 ._ | bytes 1 | bytes Entry area for page Free J oossseseeeeee FEB coset Yer ‘allinstruction 32 bytes 32 bytes | } vector call instruction FFDF FEDF (revecton) reer [32bytes | Frey | 32bytes jterupt vector le 87€408/408L 87€808/808L Figure 1-1. Memory Address Map 3-08-5 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 1.2. Program Memory (ROM) The 87C408/408L each have a 4 Kbytes (addresses F000 to FFFF}), the 87C808/808L each have an 8 Kbytes (addresses E000 to FFFF}) of program memory (mask programmed ROM). Addresses FF0O to FFFFH of program memory is also used for a special purpose. (1) Interrupt vector table (addresses FFEO to FFFF}) This table consists of a reset vector and 16 interrupt vectors (2 bytes/vector). These vectors store a reset start address and interrupt service routine entry addresses. (2) Vector table for vector call instructions (addresses FFCO to FFDFy) This table stores call vectors (subroutine entry address, 2 bytes/vector) for the vector call instructions [CALLV a]. There are 16 vectors. The CALLV instruction increases memory efficiency when utilized for frequently used subroutine calls (called from 3 or more locations). (3) Entry area(addresses FFOO to FFFF}) for page call instructions This is the subroutine entry address area for the page call instructions [CALLP a]. Addresses FF00 to FFBFy are normally used because addresses FFCO to FFFF} are used for the vector tables. Programs and fixed data are stored in the Address ROM program memory. The instruction to be F000n contents executed next is read from the address 4 indicated by the current contents of the Example: The relationship a between ROM program counter (PC). There are relative jump Contents and Call and absolute jump instructions. The concepts | FFOO group of page or bank boundaries are not used in the instructions/Interrupt/ program memory concerning any jump Reset instruction. CALLP 7BH ; PC FF7By Example: The relationship between the | reer jump instructions and the PC. FFCO 56 CALLV OH ; PCe-F8S6, @® 5-bit PC-relative jump [JRS cc, $+2+d] FFC1 | Callvector(H) _| F8 F8C4H: JRS T, $+2+08H FFC2 When JF = 1, the jump is made to F8CEy, which is 08} added to the contents of the PC. (The PC contains the address of the | FFOF r . ° FFEO |Interrupt vector (L)| 68 INTS i PC—F368q instruction being executed +2; ae FFE1 _|interrupt vector (H)| F3 therefore, in this case, the PC contents | grep are F8C4y, + 2 = F8C6y,.) Hl | | -bit PC- ive j FFFD @8 a elatve ume UR $+2+d] re 3 RESET ; PCHFO3E, When ZF = 1, the jump is made to F846, which is FF80q (-128) added to the Figure 1-2. Program Memory Map current contents of the PC. @ 16-bit absolute jump UP a] F8C4H: JP 0F235H An unconditional jump is made to address F235y. The absolute jump instruction can jump anywhere within the entire 64K-bytes space. 3-08-6 2001-01-22

TOSHIBA TMP87C408/808/408L/808L In the TLCS-870 Series, the same instruction used to access the data memory is also used to read out fixed data stored in the program memory. The register offset PC-relative addressing (PC + A) instructions can also be used, and the code conversion, table look-up and n-way multiple jump processing can easily be programmed. Example 1: Loads the ROM contents at the address specified by the HL register pair contents into the accumulator (87C408: HL 2 F000y) i) A, (HL) ; AE-ROM (HL) Example 2: Converts BCD to 7-segment code (common anode LED). When A = 05, 92 is output to port P1 after executing the following program. ou, ADD A, TABLE-$-4 7P1<-ROM (TABLE + A) I (5 LD (Pt), (PC+A) a, JRS T, SNEXT ;Jump to SNEXT Ls, TABLE: DB OCOH, OF9H, OA4H, OBOH, 99H, 92H, 82H, OD8H, 80H, 98H d SNEXT: definition instruction. Example 3: N-way multiple jump in accordance with the contents of accumulator (0 = A $3). ies SHLC A ; if A=00y then PCHF234y JP (PC +A) if A=01y then PC<F378q if A=02q then PC—FA37q a if A=03y then PCF1BOq DW _0F234H, 0F378H, OFA37H, OF1BOH od

1.3 Program Counter (PC)

The program counter (PC) is a 16-bit register which indicates the program memory address where the instruction to be executed next is stored. After reset, the reset vector stored in the vector table (addresses FFFFy and FFFE}) is loaded into the PC; therefore, program execution is possible from any desired address. For example, when FOq and 3Ey are stored at addresses FFFF} and FFFEH, respectively, the execution starts from address FO3E, after reset. The TLCS-870 Series utilizes pipelined processing (instruction pre-fetch); therefore, the PC always indicates 2 addresses in advance. For example, while a 1-byte instruction stored at address F123} is being executed, the PC contains F125y. se .sB sunniwse7esezaye — Prosramcouner Xa art X ar? Xess) Execution (a) Configuration (b) Timing chart of PC counters and Instruction Execution Figure 1-3. Program Counter 3-08-7 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.4 Data Memory (RAM)

The 87C408/808/408L/808L each have a 256 bytes (addresses 0040 to 013F}) of data memory (static RAM). Figure 1.4 shows the data memory map. Addresses 0000 to OOFFy are used as a direct addressing area to enhance instructions which utilize this addressing mode; therefore, addresses 0040 to OOFFy in the data memory can also be used for user flags or user counters. Example 1: If bit 2 at data memory address 00COy is “1”, 00} is written to data memory at address 00E3}; otherwise, FFy is written to the data memory at address 00E3y. TEST (00COH).2 ; if (00CO}y)2 =0 then jump JRS T,SZERO CLR (00E3H) + (00E3)<00y JRS T,SNEXT SZERO: LD (O0E3H), OFFH } (OOE3H)<CFFH SNEXT: Example 2: Increments the contents of data memory at address 0OF5y, and clears to 004 when 10q is exceeded. INC (00F5H) AND (O0F5H), OFH General-purpose register banks (8 registers x 16 banks) are also assigned to the 128 bytes of addresses 0040 to OOBFy. Access as data memory is still possible even when being used for registers. For example, when the contents of the data memory at address 0040} is read out, the contents of the accumulator in the bank 0 are also read out. The stack can be located anywhere within the data memory except the register bank area. For more details on the stack, see section “1.7 Stack and Stack Pointer”. With the TLCS-870 Series, programs in data memory cannot be executed. If the program counter indicates a specific data memory address (addresses 0040 to 013F}), an address-trap-reset is generated due to bus error. (Output from the RESET pin goes low.) The data memory contents become unstable when the power supply is turned on; therefore, the data memory should be initialized by an initialization routine. Example 1: Clears RAM to 0 except the bank 0 LD HL, 0048H ; Sets start address to HL register pair LD A,H ; Sets initial data (A) LD BC, OOF7H ; Sets number of byte to BC register pair SRAMCLR: LD (HL+), A DEC BC JRS F, SRAMCLR Note: “$” is a header address of ADD instruction. The general-purpose registers are mapped in the RAM, therefore, do not clear RAM at the current bank addresses. Clears RAM to 0 except the bank 0. 3-08-8 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Address 0 1 2 3 4 5 6789 ABCODEF 00404 RegisterbankO . Registerbank1 . sont aeaigcs bank po gcgtierbanitg On eee ec Me cor Pn Registerbanige Register Seamer eet email MRO ee oe eee ee eae ec decdenfudunte eect rbewduucduea| | Directaddressing area 0090 Registerbank 10. | Registerbank 11 soa Pe aesisice bang fo pager ies cosa Resta bani Telstra's

000 Ya donmebonsfimdenudeeubeeudinebeeebeenfimedantebaneehandeneden

Figure 1-4. Data Memory Map

1.5 General-purpose Register Banks

General-purpose registers are mapped into addresses 0040 to OOBFy in the data memory. There are 16 register banks, and each bank contains eight 8-bit registers W, A, B, C, D, E, H, and L. Figure 1-5 shows the general-purpose register bank configuration. The unused register banks can be used as a data memory. i Bank 15 (00B8 to 00BFy) . Bank 14 (0080 to 00B7,;) Pompe: seni ° Bank 13 (00A8 to OOAF}) H wia Bank 12 (00A0 to 00A7},) {Oemie) O0de Be 2 (0043) : (0042) iL Bank 4 (0060 to 00671) D008 Di: Bank 3 (0058 to 005F,,) (00451) : (00444)

5 Bank 2 (0050 to 0057}) He

Hook Bank 1 (0048 to 004F}) (00471) | (00461) Bank 0 (0040 to 00474) (a) Configuration (b) Address assignments of registers Figure 1-5. General-purpose Register Banks 3-08-9 2001-01-22

TOSHIBA TMP87C408/808/408L/808L In addition to access in 8-bit units, the registers can also be accessed in 16-bit units as the register pairs WA, BC, DE, and HL. Besides its function as a general-purpose register, the register also has the following functions. (1) A, WA The A register functions as an 8-bit accumulator and WA the register pair functions as a 16-bit accumulator (W is high byte and A is low byte). Registers other than A can also be used as accumulators for 8-bit operations. Examples: ® ADD A, B ; Adds B contents to A contents and stores the result into A. @ SUB WA, 1234H _ ; Subtracts 1234, from WA contents and stores the result into WA. @ SUB E,A ; Subtracts A contents from B contents, and stores the result into E. (2) HL, DE The HL register functions as a data pointer/index register/base register, and the DE register pair function as a data pointer to specify the memory address. HL also has an auto-post-increment and auto-pre-decrement functions. This function simplifies multiple digit data processing, software LIFO (last-in first-out) processing, etc. Example 1:@ LD A, (HL) ; Loads the memory contents at the address specified by HL into A. @ LD A, (HL+52H) ; Loads the memory contents at the address specified by the value obtained by adding 524 to HL contents into A. @ LD A, (HL+C) — ; Loads the memory contents at the address specified by the value obtained by adding the register C contents to HL contents into A. @ LD A, (HL+) ; Loads the memory contents at the address specified by HL into A. Then increments HL. © LD A, (-HL) ; Decrement HL. Then loads the memory contents at the address specified by new HL into A. TLCS-870 Series can transfer data directly memory to memory, and operate directly between memory data and memory data. This facilitates the programming of block processing. Example 2: Block transfer LD B,n ; Sets number of bytes to transfer - 1 LD HL, DSTA ; Sets destination address LD DE, SRCA ; Sets source address SLOOP: LD (HL), (DE) (HL) <— (DE) INC HL i; HL<HL+1 INC DE ; DE<DE+1 DEC B ; BeB-1 JRS F, SLOOP. ; if B20 then loop (3) B, C, BC Registers B and C can be used as 8-bit buffers or counter, and the BC register pair can be used as a 16- bit buffer or counter. The C register functions as an offset register for register offset index addressing (refer to example 1 @ above) and asa divisor register for the division instruction. Example 1: Repeat processing LD B.n. ; Setsn asthe number of repetitions SREPEAT: ; Processing. DEC B JRS F, SREPEAT Example 2: Division (16-bit + 8-bit) DIV WA, C ; Divides the WA contents by the C contents, places the quotient in A and the remainder in W. 3-08-10 2001-01-22

TOSHIBA TMP87C408/808/408L/808L The general-purpose banks are selected by the 4-bit register bank selector (RBS). During reset, the RBS is initialized to “0”. The bank selected by the RBS is called the current bank. Together with the flag, the RBS is assigned to address 003Fy in the SFR as the program status word (PSW). There are 3 instructions [LD RBS, n], [PUSH PSW], [POP PSW] to access the PSW. The PSW can be also operated by the memory access instruction. Example 1: Incrementing the RBS INC (003FH) ;RBS<RBS + 1 Example 2: Reading the RBS LD A, (003FH) + ;A<-RBS(The flags are simultaneously read in this instruction.) Highly efficient programming and high speed task switching are possible by using bank changeover to save registers during interrupt and to transfer parameters during subroutine processing. During interrupt, the RBS is automatically saved onto the stack. The bank used before the interrupt is automatically restored by executing an interrupt return instruction [RETI]/[RETN] ; therefore, there is no need for the RBS save/restore software processing. The TLCS-870 Series supports a maximum of 15 interrupt sources. One bank is assigned to the main program, and one bank can be assigned to each source. Also, to increase the efficiency of data memory usage, assign the same bank to interrupt sources which are not nested. Example: Saving/restoring registers during interrupt task using bank changeover. PINT1:; LD RBS, n ; RBS —n (Bank changeover) RETI ; Maskable interrupt return (Bank automatic restoring)

1.6 Program Status Word (PSW)

The program status word (PSW) consists of a register bank selector (RBS) and flags, and the PSW is assigned to address 003Fy in the SFR. The RBS can be read and written using the memory access instruction, however the flags can only be read. When writing to the PSW, the change specified by the instruction is made without writing data to the flags. For example, when the instruction [LD (003FH), 05H] is executed, “5” is written to the RBS and the JF isset to “1”, but the other flags are not affected. During interrupt, PSW is saved to the stack with the program counter. The PSW is restored from the stack by executing return instructions [RETIJ/[RETN]. [PUSH PSW] and [POP PSW] are the PSW access instructions.

1.6.1 Register Bank Selector (RBS) 765 4 3 2 10

The register bank selector (RBS) is a 4-bit register used to select general-purpose register banks. For example, when RBS =2, bank 2 is currently selected. During reset, the RBS is initialized to "0". Figure 1-6. PSW (Flags, RBS) Configuration 3-08-11 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.6.2 Flags (FLAG)

The flags are configured with the upper 4 bits: a zero flag, a carry flag, a half carry flag and a jump status flag. The flags are set or cleared under conditions specified by the instruction. These flags except the half carry flag are used as jump condition “cc” for conditional jump instructions [JR cc, $ + 2 +d], [JRS cc, $+2+d]. After reset, the jump status flag is initialized to “1”, other flags are not affected. (1) Zero flag (ZF) The ZF is set to “1” if the operation result or the transfer data is 00} (for 8-bit operations and data transfers)/0000} (for 16-bit operations); otherwise the ZF is cleared to “0”. During the bit manipulation instructions, the ZF is cleared to “0” if the contents of the specified bit is "1". This flag is set to “1” when the upper 8 bits of the product are 004 during the multiplication instruction, and when 00y for the remainder during the division instruction; otherwise it is cleared to "0". (2) Carry flag (CF) The CF is set to “1” when a carry occurred during addition or a borrow occurred during subtraction; otherwise the CF is cleared to “0”. During division, this flag is set to “1” when the divisor is 004 (divided by zero error), or when the quotient is 1004 or higher (quotiont-overflow error). The CF is also affected during the shift/rotate instructions. The data shifted out from a register is set to the CF. This flag is also a 1-bit register (a boolean accumulator) for the bit manipulation instructions. Set/clear/invert are possible with the CF manipulation instructions. Example: Bit manipulation (The result of exclusive-OR between bit 5 content of address 074 and bit 0 content of address 9Ay is written to bit 2 of address 014.) XOR = CF, (009AH) .0 LD (0001H) . 2, CF (3) Half carry flag (HF) The HF is set to “1” when a carry occurred to bit 4 of the operation result during an 8-bit addition, or when a borrow occurred from bit 4 of the result during an 8-bit subtraction. This flag is useful in the decimal adjustment for BCD operations (adjustments using the [DAA r],or [DAS 1] instructions). Example: BCD operation (The A becomes 47} after executing the following program when A = 194, B = 28.) ADD A,B jA€41y, HF <—1,CF=0 DAA A jA&41y + 06}q = 47} (decimal-adjust) (4) Jump status flag (JF) The JF is usually set to “1”. Zero or carry information is set to the JF after operation. The JF provides the jump condition for conditional jump instructions [JR T/F, $ +2 =d], RS T/F, $+2+d] (T orFisa condition code). Example: Jump status flag and conditional jump instruction INC A JRS —T, SLABLE1 ; Jump when a carry is caused by the immediately i preceding operation instruction. LD A, (HL) JRS —-T, SLABLE2 ; JFissetto “1” by the immediately preceding 5 instruction, making it an unconditional jump instruction. 3-08-12 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Example: The accumulator and flags becomes as shown below after executing the following instructions when the WA register pair, the HL register pair, the data memory at address 00C5y, the carry flag and the half carry flag contents being “219Ay", “00C5y", “D7”, “1”, and “0”, respectively. Instruction ccoter ‘or Flag after execution Instruction cc oter 'or| Flag after execution ADDC A, (HL) 2 tioitia INC OA 98 ofof1io suBB_ A, (HL) 2 tioitio ROLC A 35 1:0:1:0 cMP A, (HL) 9A oi oitio RORC A cD oi oioio AND A, (HL) 92 oof tio ADD WA, OF508H 16A2 er ee) in) A, (HL) D7 1ioitio MUL W, A 13pA | 0: 0:1: 0 ADD A, 66H 00 riaiada SET AS. BA 1ititio

1.7 Stack, Stack Pointer

1.7.1 Stack

The stack provides the area in which the return address or status, etc. are saved before a jump is performed to the processing routine during the execution of a subroutine call instruction or the acceptance of an interrupt. On a subroutine call instruction [CALL a] / [CALLP a] / [CALLVn], the return address is saved (the upper byte is pushed first, followed by the lower byte). During software interrupt instruction [SWI] execution or interrupt, the program status word is saved, then the return address is saved. When returning from the processing routine, executing a subroutine return instruction [RET] restores the contents to the PC from the stack; executing an interrupt return instruction [RETI] / [RETN] restores the contents to the PC and the PSW. The stack can be located anywhere within the data memory.

1.7.2 Stack Pointer (SP)

The stack pointer (SP) is a 16-bit register to point out the first start address on the stack. The SP is post-decrement when a “ss \\s8 ao 1514131211109 876543210 subroutine call or a push instruction is executed, or when an interrupt is accepted; and the SPC is pre-incremented when a Stack Pointer (SP) return ora pop instruction is executed. The stack deepens to Figure 1-7. Stack Pointer the direction of the lower address. Figure 1-8 shows the change of the stack access and the SP. The SP is not initialized hardware-wise but requires initialization by an initialize routine (sets the highest stack address). [LD SP, mn], [LD SP, gg] and [LD gg, SP] are the SP access instructions (mn; 16-bit immediate data, gg; register pair). Example 1: To initialize the SP LD SP, 013FH > SP—013FH Example 2: TO read the SP LD HL, SP 7 HL<-SP 3-08-13 2001-01-22

TOSHIBA TMP87C408/808/408L/808L At acceptance of interrupt At execution of or At execution of a CALLCALLV/CALLP at execution of At execution of a RETURETN instruction a $Wlinstruction a RET instruction instruction 013Cy 013Cy 013Cy 013Cy 013D 03D | PG 013D 0130 | PG, O13E | PCL Posh O13E | PCH =Peown O13E | PCL Pao OTSE |. PCH Pup down up o13F | PCy o13F | Psw 013F | PCy or3F | Psw— 0040, Stack depth SP before [013Fx 013F 4 013Dy 013Cy } Y 1 Y Y 013F SPafter | [_0130u 013Cy 013%, | O13F 4 (a) Stacking order (b) Stack depth Figure 1-8. Stack

1.8 System Clock Controller

The system clock controller consists of a clock generator, a timing generator, a clock gear, and a stand-by controller. Clock gear control register___Timing generator control register ee Clock CGCR TBTCR ti generator 00304 VF. ab 0036, XIN H ik fea OZ : Clock gear Timing Qa Vi clock oscillator | : Stand-by controller r+ i generator xOUT i: i System clocks (| (| 0038 0039, SYSCR1 SYSCR2 Clock generator control System control registers Figure 1-9. System Clock Controller 3-08-14 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.8.1 Clock Generator

The clock generator generates the basic clock which provides the system clocks supplied to the CPU core and peripheral hardware. The clocks (fc) can be easily obtained by connecting a resonator between the XIN/XOUT pins. Clock input from an external oscillator is also possible. XIN XOUT XIN XOUT O (open) O a Va (a) Crystal/Ceramic (b) External oscillator resonator Figure 1-10. Example of Resonator Connection Note: Accurate Adjustment of the Oscillation Frequency: Although no hardware to externally and directly monitor the basic clock pulse is provided, the oscillation frequency can be adjusted by making the program to output fixed frequency pulses to the port while disabling all interrupts and monitoring this pulse. With a system requiring adjustment of the oscillation frequency, the adjusting program must be created beforehand.

1.8.2 Clock Gear

The clock gear selects the gear clock (fcgck) which provides the main system clocks supplied to the timing generator from fc, fe/2, fe/4 and fc/8. Power consumption can be reduced by switching of the gear-clock from fc to fc/2, fc/4 and fc/8. The clock gear consists of a divided-by-8 prescaler with a multiplexer. Prescaler dock rp] | fo8 fda fcack, timing generator fi 00030, Clock gear control register Note: MPX; Multiplexer Figure 1-11. Configuration of Clock Gear 3-08-15 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 7 6 5 4 3 2 1 0 FCGCK Gear clock selection (write) ono. feeved sfc / gear clock monitor (read) loon, fu2 1010: fora 1011:fo8 Rw 1100: reserved 1101: reserved 111#:reserved Note!: fc ; High-frequency clock * ; Don’t care Note2: Bit 4 in CGCR is always read in as “1” when a read instruction is executed. Note3: Always set bit 7 to 5 to “0” Figure 1-12. Clock gear control register fe SUNFLTUVSLULPLUPLALULLLeL Le ereLerLesLeL fs l l l fegek l l | l J l l | l | l FCGCK 1000 X 4011 H executior’ fegck = fe Gear clock changing fegek = f/8 Figure 1-13. Example of clock exchangeable timing by clock gear

1.8.3 Timing Generator

The timing generator generates from the basic clock (fc) or the gear clock (fcgck) the various system clocks supplied to the CPU core and peripheral hardware. The timing generator provides the following functions: @® Generation of main system clock @ Generation of divider output (DVO) pulses @ Generation of source clocks for time base timer ® Generation of source clocks for watchdog timer © Generation of internal source clocks for timer/counters © Generation of internal serial clock of serial interface @ Generation of warm-up clocks for releasing STOP mode (1) Configuration of Timing Generator The timing generator consists of a 21-stage divider with a divided-by-2 prescaler. During reset and at releasing STOP mode, the divider is cleared to “0”, however; the prescaler is not cleared. Note: Even if the main system clock is changed by the clock gear, the output from the divider is not changed. The peripheral circuit using high-speed divider output (1st output) can not be used when the main system clock slows down. 3-08-16 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.8.4 Stand-by Controller

The stand-by controller starts and stops the oscillation circuits. These modes are controlled by the system control registers (SYSCR1, SYSCR2). Figure 1.16 shows the operating mode transition diagram and Figure 1.17 shows the system control registers. (1) Operation mode The machine cycle time is 4/fegck [s] @® NORMAL mode In this mode, both the CPU core and on-chip peripherals operate. The TMP87C408/808/408L/808L is placed in this mode after reset. ® IDLE mode In this mode, the CPU and the watchdog timer are halted; however, on-chip peripherals remain active. IDLE mode is started by the system control register 2, and IDLE mode is released to NORMAL mode by an interrupt request from on-chip peripherals or external interrupt inputs. When IMF (interrupt master enable flag) is “1” (interrupt enable), the execution will resume upon acceptance of the interrupt, and the operation will return to normal after the interrupt service is completed. When IMF is “0” (interrupt disable), the execution will resume with the instruction which follows IDLE mode start instruction. @ STOP mode In this mode, the internal oscillation circuit is turned off, causing all system operations to be halted. The internal status immediately prior to the halt is held with the lowest power consumption during this mode. The output status of input output ports can be set to either output hold or high-impedance under software control. STOP mode is started by the system control register 1, and STOP mode is released by STOP input pin (either level-sensitive or edge-sensitive can be selected). After the warming-up period is completed, the execution resumes with the next instruction which follows the STOP mode start instruction. reset release instruction instruction Co mode ___) interrupt release input Mode Transition Diagram omer | caters [ever | tet [ene | a CPU core mode circuit circuit time turning on operate halt | oe Figure 1-16. Operating Mode Transition Diagram 3-08-18 2001-01-22

TOSHIBA TMP87C408/808/408L/808L System Control Register 1 76 5 A (oose,) [stor [eeu [0 Jourenf wyr "initial value: 0000 00+») 0: CPU core and peripherals remain active STOP | STOP mode start 1: CPU core and peripherals are halted rem |Release method for STOP | 0: STOP pin input rising edge release mode 1: STOP pin input "H” level release outen | Pert output control during | 0: High-impedance RW STOP mode 1: Remain unchanged 00: 3x2" / fe Warming-up time at 1 3N6 wut " O12 He releasing STOP mode 10: 3x2"/fe 11: 2" / fe Note 1: Always set bit 5 to “0”. Note 2: Bits 1, 0 in SYSCR1 is read in as undefined value when a read instruction is executed. Note3:fc ; Clock [Hz] * ; don’t care Note 4: When the STOP mode is started by specifying OUTEN = “0”, the internal input of port is fixed to “0” and the interrupt of the falling edge may be set. System Control Register 2 76 5 4B xen _ | High-frequency oscillator 0: Turn off oscillation control 1: Turn on oscillation 0: CPU, WOT operate IDLE | IDLE mode start 1:_ CPU, WOT halt (IDLE mode start) Note 1: A reset is applied if XEN is cleared to “0”. Note 2: Always set bit 6, 5 to “0”. Note 3: WDT ; Watchdog timer, * ; Don’t care Note 4: Bits 3 to 0 in SYSCR2 are read in as ”1” when read instruction is executed. Figure 1-17. System Control Registers 1,2 3-08-19 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.8.5 Operating Mode Control

(1) STOP mode (STOP) STOP mode is controlled by the system control register 1 and the STOP pin input. The STOP pin is also used both as a port P76 and an INT5 (external interrupt input 5) pin. The STOP mode is started by setting STOP (bit 7 in SYSCR1) to “1”. During STOP mode, the following status is maintained. @® Oscillations are turned off, and all internal operations are halted. @ The data memory, registers (except for DBR), PSW, and port output latches are all held in the status in effect before STOP mode was entered. The port output can select either output hold or high-impedance by setting OUTEN (bit 4 in SYSCR1). @ The divider of the timing generator is cleared to “0”. @ The program counter holds the address of the instruction after the following instruction which started the STOP mode. [for example, SET (SYSCR1).7] STOP mode includes a level sensitive release mode and an edge-sensitive release mode, either of which can be selected with RELM (bit 6 in SYSCR1). a. Level-sensitive release mode (RELM = 1) In this mode, STOP mode is released by setting the STOP pin high. This mode is used for capacitor back-up when the main power supply is cut off and long term battery back-up. When the STOP pin input is high, executing an instruction which starts the STOP mode will not place in STOP mode but instead will immediately start the release sequence (Warm-up). Thus, to confirm that the STOP pin input is low. The following method can be used for confirmation: Using an external interrupt input INTS (INTS is a falling edge-sensitive input). Example: Starting STOP mode with an INT5 interrupt. PINTS: TEST (P7).6 ;To reject noise, the STOP mode does not start if JRS F, SINTS port P76 is at high. LD (SYSCR1),01000000B ; Sets up the level-sensitive release mode. SET (SYSCR1) .7 ; Starts STOP mode LDW (IL), 1110011101010111B ;1L12, 11, 7, 5, 3 <0 (clears interrupt latches) SINTS: RETI — 7/1 A STOP pin 1 Vin i ' H oe + CL NORMAL 4 STOP mode ——»M- Warm-up > NORMAL operation operation X a aie cA eal STOP mode is release by the hardware. in input is low “e he SOB and start STOP mode. (Auwavsreleased if the STOP ) pin input is high. Figure 1-18. Level Mode Note 1: After warm-up start, even if STOP pin input is low again, STOP mode does not restart. Note2: When changing to the level-sensitive release mode from the edge-sensitive release mode, the release mode is not switched until a rising edge of the STOP pin input is detected. 3-08-20 2001-01-22

TOSHIBA TMP87C408/808/408L/808L b. Edge mode (RELM = “0") In this mode, STOP mode is released by a rising edge of the STOP pin input. This is used in applications where a relatively short program is repeatedly executed at periodic intervals. This periodic signal (for example, a clock from a low-power consumption oscillator) is input to the STOP pin. In the edge-sensitive release mode, STOP mode is started even when the STOP pin input is high. Example : Starting STOP mode operation in the edge-sensitive release mode LD (SYSCR1), 00000000B ; OUTEN <0 (specifies high-impedance) DI iIMF <0 SET (SYSCR1). STOP ; STOP <1 (activates STOP mode) LDW (IL), 1110011101010111B ;1L7, 5, 3 <0 (clears interrupt latches) EI sIMF <1 t Vin 1 ' H i NORMAL —>}<— stopmode —>k« Warm-up >ke Soreton =P<— STOPmode — STOP mode started eee by the program. STOP mode is released by the hardware at the rising edge of STOP pin input. Figure 1-19. Edge-sensitive Mode STOP mode is released by the following sequence: ® The oscillator is turned on. ® Awarming-up period is inserted to allow oscillation time to stabilize. During warm-up, all internal operations remain halted. Four different warming-up times can be selected with WUT (bits 3 and 2 in SYSCR1) as determined by the resonator characteristics. @ When the warming-up time has elapsed, normal operation resumes with the instruction following the STOP mode start instruction. The start is made after the divider of the timing generator is cleared to “0”. Table 1-2. Warming-up Time example 00 46.87 24.57 1 15.62 8.19 10 11.73 6.15 1" 3.91 2.05 Note: The warming-up time is obtained by dividing the basic clock by the divider: therefore, the warming-up time may include a certain amount of error if there is any fluctuation of the oscillation frequency when STOP mode is released. Thus, the warming-up time must be considered an approximate value. STOP mode can also be released by setting the RESET pin low, which immediately performs the normal reset operation. 3-08-21 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Q c Hz a{ {3 3 ? 5 < 3 g 13 a! |S g 5 3 g 2 2 3 8 = bo oe a § y 5 s € N 3] 5 N 2] 3 N 3-08-22 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Note: When STOP mode is released with a low hold voltage, the following cautions must be observed. The power supply voltage must be at the operating voltage level before releasing STOP mode. The RESET pin input must also be high, rising together with the power supply voltage. In this case, if an external time constant circuit has been connected, the RESET pin input voltage will increase at a slower rate than the power supply voltage. At this time, there is a danger that a reset may occur if input voltage level of the RESET pin drops below the non-inverting high-level input voltage (hysteresis input). (2) IDLE mode (IDLE) IDLE mode is controlled by the system control Y register 2 (SYSCR2) and maskable interrupts. The following status is maintained during IDLE mode. Be Aseactinn @® Operation of the CPU and watchdog timer is halted. On-chip peripherals continue to operate. <> Yes ® The data memory, CPU registers, PSW, and Reset input Reset port output latches are all held in the status in effect before IDLE mode was entered. No @ The program counter holds the address of No Kenn . " Interrupt request the instruction after the following instruction which started IDLE mode. (Normal ae) Yes Example: Starting IDLE mode. No. SET (SYSCR2). 4 IDLE mode includes a normal release mode and an Yes (Interrupt release mode) interrupt release mode. Selection is made with the interrupt master enable flag (IMF). Releasing the IDLE mode returns to NORMAL. instruction which follows a. Normal release mode (IMF = “0”) the IDLE mode start IDLE mode is released by any interrupt source instruction enabled by the individual interrupt enable flag VW (EF) or an external interrupt 0 (INTO) request. Execution resumes with the instruction Figure 1-21. IDLE Mode following the IDLE mode start instruction. The interrupt latch (IL) of the interrupt source for a releasing the IDLE mode cleared to “0” by load instruction. b. Interrupt release mode (IMF = "1") IDLE mode is released and interrupt processing is started by any interrupt source enabled with the individual interrupt enable flag (EF) or an external interrupt 0 (INTO) request. After the interrupt is processed, the execution resumes from the instruction following the instruction which started IDLE mode. IDLE mode can also be released by setting the RESET pin low, which immediately performs the reset operation. Note: When a watchdog timer interrupt is generated immediately before the IDLE mode is started, the watchdog timer interrupt will be processed by IDLE mode will not be started. 3-08-23 2001-01-22

TOSHIBA TMP87C408/808/408L/808L - 3 : ri g a g £ t 2 a = 2 s « £ x 5 FS E 2 g a x pe. _ a os --f----] f-- yg g g 2] 88 5 3 2} 88 = - o yi s a 9 34 ¥1 |, 3 3 aes wt 12] 18 g H +] |e] | al & 2 o a 6] o = = a fs ze Ss, 35 8 «ec. 88 2 se. 85 8 3-08-24 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.9 Interrupt Controller

The 87C408/808/408L/808L each have a total of 10 interrupt sources: 4 externals and 6 internals. Nested interrupt control with priorities is also possible. Two of the internal sources are pseudo non-maskable interrupts; the remainder are all maskable interrupts. Interrupt latches (IL) that hold the interrupt requests are provided for interrupt sources. Each interrupt vector is independent. The interrupt latch is set to “1” when an interrupt request is generated and requests the CPU to accept the interrupt. The acceptance of maskable interrupts can be selectively enabled and disabled by the program using the interrupt master enable flag (IMF) and the individual interrupt enable flags (EF). When two or more interrupts are generated simultaneously, the interrupt is accepted in the highest priority order as determined by the hardware. Figure 1-23 shows the interrupt controller. Table 1-3. Interrupt Sources Interrupt |Vector Table| . Interrupt Source Enable Condition Latch ‘Address | Priority a : maskable Internal | INTWOT (Watchdog timer interrupt) Ik, FFFAW 2 Feces [art wraineraney ower [ks re || [era [is tenements [rerses [iw | 80, | tow 0 | 3-08-25 2001-01-22

TOSHIBA TMP87C408/808/408L/808L (1) Interrupt Latches (IL15 to IL2) Interrupt latches are provided for each source, except for a software interrupt. The latch is set to “1” when an interrupt request is generated, and requests the CPU to accept the interrupt. The latch is cleared to “0” just after the interrupt is accepted. All interrupt latches are initialized to “0” during reset. The interrupt latches are assigned to addresses 003C and 003Dy in the SFR. Each latch can be cleared to “0” individually by an instruction; however, the read-modify-write instruction such as bit manipulation or operation instructions cannot be used (Do not clear IL2 for a watchdog timer interrupt to “0"). Thus, interrupt requests can be canceled and initialized by the program. Note that interrupt latches cannot be directly set to “1” by any instruction. The contents of interrupt latches can be read out by an instruction. Therefore, testing interrupt requests by software is possible. Example 1: Clears interrupt latches LDW (IL), 1111110100111111B ; ILg to ILge—O Example 2: Reads interrupt latches LD WA, (IL) ;WelLy, ACILL Example 3: Tests an interrupt latch TEST (IL).7 jIL7=1 then jump JR F, SSET SSET: 3-08-26 2001-01-22

TOSHIBA TMP87C408/808/408L/808L i ; 7 si > Hi 58 si I; 2S Z)|s&e SASH EH EHR EAESEHEH ae 2 SSEH HEHE EAAEa a 8 Scie Le fi eee Ele =liLe =I[Le =I Lx geile lle =IILe «Ile & Z Fe £ s a re eee Ter ees ee eee | ETE Thigh! : a | fs SS to al 3-08-27 2001-01-22

TOSHIBA TMP87C408/808/408L/808L (2) Interrupt Enable Register (EIR) The interrupt registers (EIR) enable and disable the acceptance of interrupts except for the pseudo non-maskable interrupts (software and watchdog timer interrupts). Pseudo non-maskable interrupts are accepted regardless of the contents of the EIR; however, the pseudo non-maskable interrupts cannot be nested more than once at the same time. The EIR consists of an interrupt master enable flag (IMF) and individual interrupt enable flags (EF). These registers are assigned to addresses 003Ay and 003By in the SFR, and can be read and written by an instruction (including read-modify-write instructions such as bit manipulation instructions). @® Interrupt Master Enable Flag (IMF) The interrupt master enable flag (IMF) enables and disables the acceptance of all interrupts. Clearing this flag to “0” disables the acceptance of all maskable interrupts. Setting to “1” enables the acceptance of interrupts. When an interrupt is accepted, this flag is cleared to “0” to temporarily disable the acceptance of maskable interrupts. After execution of the interrupt service program, this flag is set to “1” by the maskable interrupt return instruction [RETI] to again enable the acceptance of interrupts. If an interrupt request has already occurred, interrupt service starts immediately after execution of the [RETI] instruction. Pseudo non-maskable interrupts are returned by the [RETN] instruction. In this case, the IMF is set to “1” only when pseudo non-maskable interrupt service is started with interrupt acceptance enabled (IMF =1). Note that IMF remains “0” when cleared by the interrupt service program. The IMF is assigned to bit 0 at address 003Ay in the SFR, and can be read and written by an instruction. IMF is normally set and cleared by the [El] and [DI] instructions, and the IMF is initialized to “0” during reset. @ Individual Interrupt Enable Flags (EF15 to EF4) These flags enable and disable the acceptance of individual maskable interrupts, except for an external interrupt 0. Setting the corresponding bit of an individual interrupt enable flag to “1” enables acceptance of an interrupt, setting the bit to “0” disables acceptance. Example 1: Sets EF for individual interrupt enable, and sets IMF to “1” LDW (EIR), 1100000010100001B ; EFy5, EFy4, EF7, EFs, IMFe-1 Example 2: Sets an individual interrupt enable flag to “1” SET (EIRH).1 ; EFge1 Interrupt latch 15 1413 121 109 BO US UK BO (003¢.,, 00304) ILy (003D}) tt, (003CH) Interrupt enable register (Initial value: 00000000 000000+«) (o03a,,0038,) LEFis Fa © | 0 | 0 7 0 i efy! 0 [ety | ete | ers eFay Time] EIR, (003A) IR (00381) (Initial value: 00000000 0000++*0) Note 1: Do not use any read-modify-write instruction such as bit manipulation for clearing IL. Note 2: Do not clear the IL2 by an instruction. Note 3: Do not set IMF to ”1” during non-maskable interrupt service programs. Figure 1-24. Interrupt Latch (IL) and Interrupt Enable Register (EIR) 3-08-28 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.9.1 Interrupt Sequence

An interrupt request is held until the interrupt is accepted or the interrupt latch is cleared to “0” by a reset or an instruction. Interrupt acceptance sequence requires 8 machine cycles after the completion of the current instruction execution. The interrupt service task terminates upon execution of an interrupt return instruction [RETI] (for maskable interrupts) or [RETN](pseudo non-maskable interrupts). Figure 1- 25 shows the timing chart of interrupt acceptance and interrupt return instruction. (1) Interrupt acceptance Interrupt acceptance processing is as follows: @® The interrupt master enable flag (IMF) is cleared to “0” to temporarily disable the acceptance of any following maskable interrupts. When a non-maskable interrupt is accepted, the acceptance of any following interrupts is temporarily disabled. @ The interrupt latch (IL) for the interrupt source accepted is cleared 0 “0”. @ The contents of the program counter and the program status word are saved (pushed) onto the stack. (pushed down in order of PSW, PCy, PC,). The stack pointer (SP) is three decrements. @ The entry address of the interrupt service program is read from the vector table address corresponding to the interrupt source, and the entry address is loaded to the program counter. © The instruction stored at the entry address of the interrupt service program is executed. Interrupt service task 1 machine cycle cH _— —rvne— | pee signal H 7 H 7 ' ? ' Hi Interrupt__t H i t latch t H . +t t i ' H Me ; hy H ' ' \\ H i sacs _\\ BEX rerapracceptone ___ YEP ec eoXeXeet Xe Xe Xe Kore \\ Ke cee Xe Kor Kod se " > ED Cir ED) n Note 1:a; return address _b; entryaddress_c; address when the RET! instruction is stored Note 2: The maximum response time from when an IL is set until an interrupt acceptance processing starts is 38/fegck[s]. It equals to setting the IL on the first machine cycle in 10 cycles instruction execution. Figure 1-25. Timing chart of Interrupt acceptance and Interrupt return Instruction Example: Correspondence between vector table address for INTTBT and the entry address of the interrupt service program. Vector table address Entry address FFF2y —_) F203, | OF FFF3y, F204y 064 3-08-29 2001-01-22

TOSHIBA TMP87C408/808/408L/808L A maskable interrupt is not accepted until the IMF is set to “1” even if a maskable interrupt of higher priority than that of the current interrupt being serviced. In case of nested interrupt service is necessary, the IMF is set to “1” in the interrupt service program. In this case, acceptable interrupt sources are selectively enabled by the individual interrupt enable flags. However, an acceptance of external interrupt 0 cannot be disabled by the EF, therefore, if disablement is necessary, either the external interrupt function must be disabled with the external interrupt control register (INTOEN) or interrupt processing must be avoided by the program. (When INTOEN =0, the interrupt latch IL3 is not set, therefore, the falling edge of the INTO pin input cannot be detected.) Example 1: Disables an external interrupt 0 using INTOEN: CLR (EINTCR). INTOEN =; INTOEN-O Example 2: Disables the processing of external interrupt 0 under the software control (using bit 0 at address OOFOy as the interrupt processing disable switch): PINTO: TEST (O0FO4).0 ; Returns without interrupt processing if (OOFO})o = 1. JRS_— T, SINTO RETI RETI VINTO: DW PINTO (2) General-purpose register save / restore During interrupt acceptance processing, the program counter and the program status word are automatically saved on the stack, but not the accumulator and other registers. These registers are saved by the program if necessary. Also, when nesting multiple interrupt services, it is necessary to avoid using the same data memory area for saving registers. The following method is used to save / restore the general-purpose registers: @® General-purpose register save / restore by register bank changeover: General-purpose registers can be saved at high-speed by switching to a register bank that is not in use. Normally, bank 0 is used for the main task and banks 1 to 15 are assigned to interrupt service tasks. To increase the efficiency of data memory utilization, the same bank is assigned for interrupt sources which are not nested. The switched bank is automatically restored by executing an interrupt return instruction [RETI] or [RETN]. Therefore, it is not necessary for a program to save the RBS. Example: Register Bank Changeover PINTxx : LD RBS, nz, Switches to bank n (1s at 8 MHz) _, interrupt processing, RETI ; Restores bank and Returns 3-08-30 2001-01-22

TOSHIBA TMP87C408/808/408L/808L @® General-purpose register save / restore using push and pop instructions: To save only a specific register, and when the same interrupt source occurs more than once, the general-purpose registers can be saved/restored using push/pop instructions. Example: Register save using push and pop instructions PINTxx : PUSH WA ; Save WA register pair PUSH. HL, 7 ot Save HL register pair L_interrupt processing _: POP HL ; Restore HL register pair POP WA ; Restore WA register pair RETI ; Return i Address (Example) L 0139 ne essen a eee | aeeeeeeseenee feveceeeeeecne] OTA Jeeceeee es) secenenenen eee 0138 ied essen ie scusentnesse] OBE PCL PG, PC -_ , 13D ena ee oa PH. oe Ho ccesssstseese) OTSE Psw _PSW Psw sp] o13F At acceptance of At execution of a push At execution of a pop At execution of an interrupt aninterrupt instruction of WA instruction of WA. return instruction register register @ General-purpose registers save/restore using data transfer instruction: Data transfer instructions can be used to save only a specific general-purpose register during processing of a single interrupt. Example: Saving / Restoring registers by data memory transfer instructions PINTxx : LD (GSAVA), A; Save A register __ Interrupt processing iup) A, (GSAVA) ; Restore A register RETI ; Return Main task Main task Acceptance Interrupt Acceptance Interrupt Bank m |Ofinterrupt service task ofinterrupt service task I. Ce switch to bank n by \\K' saving | [LD RBS, n] instruction N registers eeerupt reta Restore bank | | m Interruptreturn automatically by KK Restoring interrupt return WW registers instruction See S Interrupt return (a) Saving / Restoring by register bank changeover (b) Saving / Restoring using push/pop transfer instructions Figure 1-26. Saving / Restoring General-purpose Registers 3-08-31 2001-01-22

TOSHIBA TMP87C408/808/408L/808L (3) Interrupt return The interrupt return instructions perform the following operations. @® The contents of the program counter and | © The contents of the program counter and the program status word are restored program status word are restored from from the stack. the stack. @ The stack pointer is incremented 3 times. @ The stack pointer is incremented 3 times. @ The interrupt master enable flag is set to | @ The interrupt master enable flag is set to “tn "1" only when a non-maskable interrupt is accepted in interrupt enable status. However, the interrupt master enable flag remains at “0” when so clear by an interrupt service program. Interrupt requests are sampled during the final cycle of the instruction being executed. Thus, the next interrupt can be accepted immediately after the interrupt return instruction is executed. Note: When the interrupt processing time is longer than the interrupt request generation time, the interrupt service is performed but not the main task.

1.9.2 Software Interrupt (INTSW)

Executing the [SWI] instruction generates a software interrupt and immediately starts interrupt processing (INTSW is highest prioritized interrupt). However, if processing of a non-maskable interrupt is already underway, executing the SWI instruction will not generate a software interrupt but will result in the same operation as the [NOP] instruction. Note: Software interrupt generates during non-maskable interrupt processing to use SWI instruction for software break in a development tool. Use the [SWI] instruction only for detection of the address error or for debugging. @® Address Error Detection FFy is read if for some cause such as noise the CPU attempts to fetch an instruction from a non-existent memory address. Code FF is the SWI instruction, so a software interrupt is generated and an address error is detected. The address error detection range can be further expanded by writing FFy to unused areas of the program memory. Address-trap- reset is generated for instruction fetch from a part of RAM area (addresses 0040 to 013F}) or ‘SFR area (0000 to 003Fy). Note: The fetch data from addresses, BF80 to BFFFy for 87C408/808/408L/808L and 87P808/808L is not “FF”, because the outgoing test ROM is contained. @® Debugging Debugging efficiency can be increased by placing the SWI instruction at the software break point setting address. 3-08-32 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.9.3 External Interrupts

The 87C408/808/408L/808L each have four external interrupt inputs. Two of these are equipped with digital noise rejection circuits(pulse inputs of less than a certain time are eliminated as noise). Edge selection is also possible with INT1, INT2 pin. The INTO / P10 pin can be configured as either an external interrupt input pin or an input/output port, and is configured as an input port during reset. Edge selection, noise rejection control and INTO / P10 pin function selection are performed by the external interrupt control register. Table 1-4. External Interrupts [source [vin | sseevsh | tnabieconditions [eds | dictalneiserciecioncruit_| Pulses of less than 15/fc or 63/fcls) are eliminated as noise. Pulses INT1 INT1 Fallingedge | equal to or more than 48/fc [s] or or 192/fc [s] are regarded as signals. Rising edge | TTminated as nis. Pulses equal INT2 INT2 PI2/TCL IMF EF7=1 or more than 24/fe [s] are regarded as signals. Lints Pints eveistop_[ir-eris=1 | Fallingedge J ~ (Hysteresis input) Note 1: The noise rejection function is also affected to detect the edge of Timer/ Counter input (TC1 pin). Note 2: The pulse width (both “H” and “L” level) for input to the INTO and INTS pins must be over 1 machine cycle. INTO/INTS input UNTL. i ‘tinTH * tite. tintH > teyc Note: tcyc = 4/fcgck [s] at NORMAL, IDLE mode Note 3: If a noiseless signal is input to the external interrupt pin in the NORMAL or IDLE mode, the maximum time from the edge of input signal until the IL is set is as follows: ® INT pin 49/fc [s] (at INTINC = 1), 193/fc [s] (at INTINC =0) @ INT2 pin 25/fc [s] Note 4: When INTOEN =0, the interrupt latch IL is not set even if the falling edge of INTO pin input is detected. Note 5: When high-impedance is specified for port output in STOP mode, port input is forcibly fixed to low level internally. Thus, interrupt latches of external interrupt inputs except P76 (STOP / INT5) which are also used as ports may be set to “1”. To specify high-impedance for port output in STOP mode, first disable inteerupt service(IMF =0), activate stop mode. After releasing stop mode, clear interrupt latches using load instruction, then, enable interrupt service. Example: Activating stop mode LD (SYSCR1) , 01000000B ; OUTEN<0 (Specifies High-impedance) DI ; IMFO SET (SYSCR1), STOP ; STOP<-1 (Activates STOP mode) LDW (IL), 1111111101010111B ; IL7, 5, 30 (Clears interrupt latches) EI jp IMFe1 3-08-33 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

76 SAB eo

INTINC | INT1 noise reject time select | 9: Pulses of less than 63/fc [s] are eliminated as noise 1: Pulses of less than 15/f¢ [s] are eliminated as noise a 7 . 0: P10 input / output port PIO/INTOpin configuration | 1: INTO pin (Port P10 should be set to an input mode.) aw INT2 ES 0: Rising edge INT2, INT1 edge select . INT1 ES 1: Falling edge Note: fc; clock [Hz] * ; Don’t care Figure 1-27. External Interrupt Control Register

1.10 Watchdog Timer (WDT)

The Watchdog Timer rapidly detects the CPU malfunction such as endless looping caused by noise or the like, and resumes the CPU to the normal state. The Watchdog Timer signal for detecting malfunction can be selected either a reset output or a non- maskable interrupt request. However, selection is possible only once after reset. After reset, the signal is initialised to the reset output. When the Watchdog Timer is not being used for malfunction detection, it can be used as a timer to generate an interrupt at fixed intervals. 3-08-34 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.10.1 Watchdog Timer Configuration

i & | Clock ba x me x) Clod Overflow D WOT output IReset output Internal reset pL ____, fs Writing Writing wort r | disable code | clear code werour woe] T won] T Watchdog Timer Control Registers Figure 1-28. Watchdog Timer Configuration

1.10.2 Watchdog Timer Control

Figure 1-29 shows the Watchdog Timer control registers. The Watchdog Timer is automatically enabled after reset. (1) Malfunction detection methods using the Watchdog Timer The CPU malfunction is detected as follows. ® Setting the detection time, selecting output, and clearing the binary counter. @® Repeatedly clearing the binary counter within the setting detection time. If the CPU malfunction occurs for any cause, the Watchdog Timer output will become active at the rising of an overflow from the binary counters unless the binary counters are cleared. At this time, when WDTOUT = 1 a reset is generated, which drives the RESET pin to reset the internal hardware. When WDTOUT = 0, a Watchdog Timer interrupt (INTWDT) is generated. The Watchdog Timer temporarily stops counting in the STOP mode including warm-up or IDLE mode, and automatically restarts (continues counting) when the STOP / IDLE mode is released. Example: Sets the Watchdog Timer detection time to 221/fc[s] and resets the CPU malfunction. LD (WDTCR2), 4EH ; Clears the binary counters LD (WDTCR1), 00001101B ; WDTT<—10, WDTOUT<-1 oe LD (WDTCR2), 4EH ; Clears the binary counters within WOT | i (Always clear immediately after changing WDTT) time : LD (WDTCR2), 4EH ; Clears the binary counters Within WOT i detection i time H LD (WDTCR2), 4EH ; Clears the binary counters 3-08-35 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Watchdog Timer Control Register 1 7 6 5 4 3 2 1 0 woten |Watchdog timer enable /| 0: Disable (tismecessary to write the disable code to WDTCR2.) disable 1: Enable 00: 2*/fe — [s] . Watchdog timer detection | 01: 2/fc write WOTT | time 10: 2°/fe only 11: 27 fc Watchdog timer output] 0: Interrupt request woTouT select 1: Reset output Note 1: WDTOUT cannot be set to ”1” by program after clearing WDTOUT to “0”. Note 2: fc; clock[Hz] *; Don’t care Note 3: WDTCR1 is a write-only register and must not be used with any of read-modify-write instructions. Note 4: Disable the Watchdog Timer or clear the counter just before switching to STOP mode. When the counter is cleared just before switching to STOP mode, clear the counter again subsequently to releasing STOP mode. Watchdog Timer Control Register 2 7 6 5 4 3 2 1 0 4Ey: Watchdog Timer binary counter clear (clear code) 5 worcrz |Watchdog Timer control lay Watchdog Timer disable write code write register (disable code) only Others: Invalid Note 1: The disable code is invalid unless written when WDTEN =0. Note 2:* ; Don’t care Note 3: Since WDTCR2 is a write-only register, read-modify-write instructions (e.g., bit manipulating instructions such as SET of CLR and arithmetic instructions such as AND or OR) cannot be used for read/write to this register. Note 4: To clear the binary counter doesn’t initialize the source clock, therefore, it is recommended to clear the binary counter within 3/4 of the detection period. Figure 1-29. Watchdog Timer Control Registers (2) Watchdog Timer Enable The Watchdog Timer is enabled by setting WDTEN (bit 3 in WDTCR1). WDTEN is initialized to “1” during reset, so the Watchdog Timer operates immediately after reset is released. (3) Watchdog Timer Disable The Watchdog Timer is disabled by writing the disable code (B14) to WDTCR2 after clearing WDTEN (bit 3 in WDTCR1) to “0”. The Watchdog Timer is not disabled if this procedure is reversed and the disable code is written to WDTCR2 before WDTEN is cleared to “0”. During disabling the Watchdog Timer , the binary counters are cleared to “0”. Example: Disables Watchdog Timer LDW (WDTCR1), 0B101H ; WDTEN€0, WDTCR2<disable code Table 1-5. Watchdog Timer Detection Time 00 4.1945 01 1.048 s 10 262.1 ms "1 65.5 ms 3-08-36 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.10.3 Watchdog Timer Interrupt (INTWDT)

This is a pseudo non-maskable interrupt which can be accepted regardless of the contents of the EIR. Ifa Watchdog Timer interrupt or a software interrupt is already accepted, however, the new Watchdog Timer interrupt waits until the previous interrupt processing is completed (the end of the [RETN] instruction execution). The stack pointer (SP) should be initialized before using the Watchdog Timer output as an interrupt source with WDTOUT. Example: Watchdog Timer interrupt setting up. LD SP, 013FH ; Sets the stack pointer LD (WDTCR1), 00001000B +; WDTOUT<0

1.10.4 Watchdog Timer Reset

If the Watchdog Timer output becomes active, a reset is generated, which drives the RESET pin low to reset the internal hardware. The reset output time is 12/fcgck to 16/fegck [s] (1.5 to 2.0 us at 8 MHz, 3.0 to 4.0 us at 4 MHz). The RESET pin is sink open drain input / output with pull-up resistor. 2"/fc [s] 2ife_ i <2 Ke : Clock l l (wort = 118) Binary counter 1X2 X3X 9 X 1X 2 X38 XO Overflow H INTWOT interrupt i WOT reset output rn a 2) Tet output) Writes 4£,, to WDTCR2 Figure 1-30. Watchdog Timer Interrupt / Reset

1.11 Reset Circuit

TMP87C408/808/408L/808L each have four types of reset generation procedures: an External reset input, an Address trap reset, a Watchdog Timer reset and a System clock reset. Table 1.8 shows on-chip hardware initialization by reset action. The internal source reset circuit (Watchdog Timer reset, Address trap reset, and System clock reset) is not initialized when power is turned on. Thus, output from the RESET pin may go low (maximum 16/fc[s] (2 pS at 8 MHz, 4 vs at 4 MHz)). Table 1-8. On-chip Hardware Initialization by Reset Action iia Program counter (PC) (FFF) - (FFFEH) generator Register bank selector (RBS) 0 Watchdog Timer Jump status flag (uF) 1 atendog Interrupt master enable flag (IMF) 0 Refer to /O port oa cl Interrupt latches (iy) 0 Control register registers 3-08-37 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

1.11.1 External Reset Input

The RESET pin contains a hysteresis input with an internal pull-up resistor. When the RESET pin is held at low for at least 3 machine cycles (12/fegck [s]) with the power supply voltage within the operating voltage range and oscillation stable, a reset is applied and the internal state is initialized. When the RESET pin input goes high, the reset operation is released and the program execution starts at the vector address stored at addresses FFFE to FFFFy. vop Reser O Ss Reset input Internal source Figure 1-31. Reset Circuit

1.11.2 Address Trap Reset

An Address trap reset is one of fail-safe function that detects CPU malfunction caused by noise or the like. If the CPU attempts to fetch an instruction from a part of RAM or SFR, an internal reset will be generated. Then, the RESET pin output will go low. The reset time is 12/fcgck to 16/fcgck [s] (1.5 to 2.0 us at 8MHz, 3.0 to 4.0 us at 4 MHz). execution h 4 ~ eee.) Addresstrapisoccurred 9 RESET output ("L" output) (Hi-z)! Hl Sa 1 12/fegek to 16/fegck [s]_ | A/fegck to 16/fegck [s] | 16/fegek [s] + Note 1: a is an address in on-chip RAM or SFR. Note 2: During reset release, reset vector “r” is read out, and an instruction at address r is fetched and decoded. Figure 1-32. Address Trap Reset

1.11.3 Watchdog Timer Reset

Refer to Section “1.10 Watchdog Timer”.

1.11.4 System Clock Reset

Clearing XEN to “0” stops a system clock, and causes CPU to deadlock. This can be prevented by automatically generating a reset signal whenever XEN =0 is detected to continue the oscillation. Then sat 4 MHz). 3-08-38 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 2. | On-Chip Peripherals Functions

2.1 Special function register (SFR) and Data Buffer Register (DBR)

The TLCS-870 Series uses the memory mapped I/O system, and all peripheral control and data transfers are performed through the special function registers (SFR) and data buffer registers (DBR). The SFR are mapped to addresses 0000 to 003Fy, and the DBR to addresses OFFO to OFF7}y. Figure 2-1 shows the 87C408/808/408L/808L SFR, DBR. Address Read Write ‘Address Read Write 000 Ye csssseeeseneeeeeennne ef OSOOG oo ccceseettnssesestneseeee] — OOZOH|SIOSR (SIO StAtUs) cscs SIOCRT...nscee (S101 control) «= a 52 ee 04 Preece cocsnasesenessnnnenssesee eevee cossnnnee 24 Yn cosocananennnsnsnsnsnsnsesee sovsnanesanussnanensnsnsee

06 Pé port 26 :

OT eee eee pot eee cnn] 27 PL PICR2(P7 port vO control 2) 08 reserved 28 reserved OA oc cccssestsnedineesseneerssesiefueseeneensee am A Yaa cccssssetsserseenstssesstsniinfrenetstnnesasineneeesseete OB Yann ccecccsssssnnecTeeceeeeenenssssseneefe LER (PT port lO control), , BB fc ccscsccesnsnnssssnssunnnnmsseseseefeonsnsnnsssnunsnmnnaeeeenceanananansnss OD Yann ceccesssssse Teeceeecenses essnvsnlPZERI PZ port UO control 1) 2D Jon. coconananennnsnsnsnsnsnsesee sossnanesansnsnanennees OE Ya secsesnsennnnee ADCCRIAD converter OMe) seen DE Yoo ccccessseessseneeseeesesescnnnsnntstnsfiesenseneeeecesensannnsnennasnnnenseeesee OF [ADCOR (A/D conv. result) = 2F STOPCR (Key Wake-up control 10 fac cceeccccesseeedTesssteesessnsvesesee] REGTAL. | Grimer register . BO Poo cccceeeesccceneeseee SOR (Clock Gear control) oo ccceseeeeseeeeeee W = lrtecia,, Timer reatster 14) 31 reserved

12 TREsia, 32 :

V4 Yc cccccsseeesenen Tesssssssssnssnenesee] GIER (TCT Come scoa BE Poo cccccsssceeeeeeesTesnsnsnsenseeeceeeeed WBTERI . (Watchdog Timer) 16 - [TREG2, mer register 36 fe ssenen TRUER TBTATG/DNO.COMOD oa. ssssessescce 17 fence annnnnnnnl REGR Merger Vg [ITER Externe interruptecontal 18 reserved 38 SYSCRT (5, ) 19 39) [TE oysera.__ Sustem conte 1A ‘ 3A EIR, Intern ni register) TE |. ccccsessssssusesesssssnsessssssnsesssossseccsssnnsseccassusesssssssneseansssssed BE Ya aescesccccessonenssssssenensesersseA@SRIVEG, seccseseseeeeeececsnenenenenss 1F z 3F [Psw RBS (Register bank selector) (a) Special Function Register Address Read Write a Note 1: Do not access reserved areas by the program. oreernemnnecennernese ns eeenerenerenen ee Note 2: - ; cannot be accessed. OFEF ‘ Note 3: When defining address 003F with assembler OFFO vunnnuvvnnn symbols, use GPSW and GRBS. FT dc cecessnneee cosseeccasneseeeee Note 4: Write-only registers and interrupt latches Fd esses HO - ceseseeeesstseneeee cannot use the read-modify-write instructions FB de transmit and receive wees ee (bit manipulation instructions such as SET, F4 see data buffer . . CLR, etc. and logical operation instructions as nn (8 byte) sessuseseeeenneee such as AND, OR, etc.) fe Note 5: PSW ; Program Status Word OFF to % - x OFFF (b) Data Buffer Registers Figure 2-1. SFR & DBR 3-08-39 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 2.2. V/O Ports The 87C408/808/408L/808L each have 3 ports, 22 pin input / output ports. @® Ptport ;8-bit/Oport (External interrupt input, Timer/Counter input/output, and Divider output) @ P6port ;8-bitl/Oport (Analog input, STOP mode release input) @ P7port ;6-bit/Oport (Serial interface, External interrupt, Timer/Counter input / output, and Analog reference power supply) Each output port contains a latch, which holds the output data. All input ports do not have latches, so the external input data should either be held externally until read or reading should be performed several times before processing. Figure 2-2 shows input / output timing examples. External data is read from an I/O port in the $1 state of the read cycle during execution of the read instruction. This timing can not be recognized from outside, so that transient input such as chattering must be processed by the program. Output data output changes in the S2 state of the write cycle during execution of the instruction which writes to an I/O port. fetch cycle fetch cycle read cycle —— oh SO $1 $2 $3 SO $1 S2 S3 SO S1 S2 $3 execution cycle wee, a Input strobe eee i wee patainput LL KU... (a) Input Timing jx fetchoycle fetch cycle, __writecycle a ee eee SO $1 $2 $3 SO $1 S2 S3 SO S1 S2 $3 Instruction os — Outputlatch pulse... ee sees (b) Output timing Note: The positions of the read an write cycles may vary, depending on the instruction. Figure 2-2. Input/Output Timing (Example) When reading an I/O port except programmable I/O ports, whether the pin input data or the output latch contents are read depends on the instructions, as shown below: (1) Instructions that read the output latch contents @ XCH rf, (sre) ® LD (pp).b,cF @ SET/CLR/CPL (src).b © ADD/ADDC/SUB/SUBB/AND/OR/XOR (src), n @ SET/CLR/CPL (pp).g @ (src) side of ADD/ADDC/SUB/SUBB/AND/OR/XOR (src), (HL) ® LD (src).b, CF (2) Instructions that read the pin input data Instructions other than the above (1) and (HL) side of ADD/ADDC/SUB/SUBB/AND/OR/XOR (scr), (HL) 3-08-40 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.2.1 Port P1(P17 to P10)

Port P1 is an 8-bit input / output port which can be configured as an input or an output for each bit individually. Input / output mode is specified by the port P1 input/output control register (P1CR). During reset, the P1CR is initialized to “0”, which configures port P1 as an input. The P1 output latches are also initialized to “0”. Port P1 is also used as an External interrupt input, a Timer / Counter input, and a Divider output. When used as secondary function pin, the input pins should be set to the STOP [ input mode, and the output pins should be set to the | OUTEN ~* [) output mode and beforehand the output latch should be PICRI i ie L set to "1". It is recommended that pins P11 and P12 should | Datainput <I QY be used as External interrupt inputs, Timer / Counter input, or input ports. The interrupt latch is set at the rising or <] falling edge of the output when used as output ports. Pin P10 can be configured as either an input / output ports Data output >> | [_) > LJ with INTOEN or an External interrupt input. During reset, output latch Pti pin P10 is configured as an input port. Sentra! Control i+ a 2—1__+ input Note: i=7to0 Pt P17 : P16: P15 : P14 : P13 tc’ P11 : P10 (0001,,) TC2 : PPG : DVO: Tcj ; INT1 INTO (Initial value: 0000 0000) (0008,) picr | VOcontrol for port P1 0: Input mode Write (set for each bit individually) | _1: Output mode only Note: P1CR is a write-only register and must not be used with any of the read-modify-write instructions. Figure 2-3. Port 1and P1CR Example: Sets P17, P16 and P14 as output ports, P13 and P11 as input ports, and the others as function pins. Internal output data is “1” for the P17 and P14 pins, and “0” for the P16 pin. LD —_(EINTCR), 01000000B 7 INTOEN1 LD = (P1CR), 11010000B Note: The port set to an input mode reads pin input state. When used with input/output modes, output latch contents of the port set to an input mode may be placed by execution of bit operate instruction. 3-08-41 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.2.2 Port P6 (P67 to P60)

Port P6 is an 8-bit general-purpose input/output port which can be configured as an input or an output for each bit individually. P60 to P65 are also used as Analog inputs and P62 to P65 are also used as key wake-up inputs. Input / output mode is specified by port P6 input/output control register (P6CR) and AINDS (bit 4 in ADCCR). During reset, P6CR is set to “0”, AINDS is set to “1”, and port P6 is in input mode. During reset, the output latches of port P6 is initialized to “0”. P6CR is write-only register. When port P6 is not used as analog input, it can be used input / output port. However output instructions must not be performed to maintain the precision at using A/D converter. When the input instruction is executed to port P6 during using A/D converter, “0” is read into the pin that selects Analog input, and “1” or “0” is read into the pin that does not select Analog input, depending on the input level of pins. In the case of using port P6 as key wake-up inputs, please refer to Section “2.9 Key wake up”. Analog input o sToP ° AINDS —4 of saw —L_) [> { ) P6CRI of Data input i <] s Data output fool [> [] Psi (i= oto 5) Key wake-up input oo] PGi (i=2to 5) sToP jo OUTEN 1) [ Data input | <J <I Data output —]o a] [> L_] Psiti=6.7) Output latch ro06 ) 7 6 5 4 3 2 1 0 4) [P67 : P66: POS : P64 : P63 ; P62 : P61 ; PEO ei : AINS | AINA : AIN3 : AIN2 : AIN1 : AINO | (Initial value: 0000 0000) i ESTOPS !STOP4 ! STOP3 !STOP2 i P6CR 7 6 5 4 3 2 1 0 com) | ttt ot on VO control for port P6 0: Input mode Write P6CR | (set for each bit individually) | 1: Output mode only Note 1: Used analog input pins or key wake-up input must be configured as input mode. Note 2: P6CR is a write-only register and must not be used with any of the read-modify-write instructions. Figure 2-4. Port P6 and P6CR Note: The port set to an input mode reads pin input state. When used with input/output modes, output latch contents of the port set to an input mode may be placed by execution of bit operate instruction. 3-08-42 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.2.3 Port P7 (P77 to P72)

Port P7 is a 6-bit general-purpose input / output port which can be configured as either input or output for each bit individually. Input / output mode is specified by port 7 input / output control register 1 (P7CR1). Input/output circuit is specified by port 7 input / output control register 2 (P7CR2). During reset, P7CR1 is cleared to “0”, and port P7 is configured as an input mode. The output latches are initialized to "0". P7CR1 is write-only register. It is recommended that pin P76 should be used as an external interrupt input, a STOP mode release signal input, or an input port. If used as an output port, the interrupt latch is set on the falling edge of the output pulse. P77 is used as an analog reference power suppy pin (VAREF) if an analog input is enabled (AINDS = 0). sToP 0 re = DS) | P7CRIi Data input = <] orc <>, | ite Data output fo | > L_] p7i(i=2tos) Control input << P76 (INTS / STOP) sToP _WAREF re = [3 ae P7CR17 Data input a q q P7CR27 Te" oO Data output [> al {> ik [_] P77 (varer) A AINDS [>< P7 7 6 5 4 3 2 1 O (00074) | P77 : P76 : P75 : P74 | P73 : P72 Hl Varer STOP/) SO SI: SCK : -i- a INTS i (initial value: 0000 00*«) P7CRI 7 6 5 4 3 2 1 Oo prcr1 | YOcontrol for P7 0: Input mode Write (set for each bit individually) | _1: Output mode only P7CR2 7 6 5 4 3 2 1 OO VO control for P7 0: Open drain input / output Note: P7CR1 is a write-only register and must not be used with any of the read-modify-write instructions. Figure 2-5. Port P7 and P7CR 3-08-43 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Note 1: The port set to an input mode reads pin input state. When used with input/output modes, output latch contents of the port set to an input mode may be placed by execution of bit operate instruction. Note 2: In case of using port P65 to P62 as key wake-up input, P76 pin must be used as input only (in cluding INT5/STOP), must not be used as output port. Note 3: * ; Don’t Care Example: The lower 2-bit of Port P7 is set to an output port and the others are set to an input port. LD = (P7CR1), OFH ; P7CR1<-00001111 3-08-44 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.3 Time Base Timer (TBT)

The time-base timer is used to generate the 1223 base time for key scan and dynamic display fc/2?! ° rocessing. For this purpose, it generates a fer z oure p g. For this purpose, it g) fe/2"4 © [clock Rising INTTBT time-base timer interrupt (INTTBT) at f¢/2"3 2 > edge interrupt predetermined intervals. f12"? o detector] request This interrupt is generated beginning with fel the first rising edge of the source clock (the 3 timing generator’s divider output selected qTeTeK TBTEN by TBTCK) after the time-base timer is enabled. Note that since the divider cannot Time Base Timer Control Register be cleared by a program, the first interrupt (2) Configuration only may occur earlier than the set s, lock - ource clocl interrupt period. (See Figure 2-6, (b).) When selecting the interrupt frequency, = - "i . 7 TBTEN : : make sure the time-base timer is disabled. _ i i (Do not change the selected interrupt irtet tog i frequency when disabling the active timer | en | | either.) However, you can select the Enable T8T Interrupt period interrupt frequency simultaneously when . enabling the timer. (b) Time Base Timer Interrupt Figure 2-6. Time Base Timer 7 6 5S 4 #3 2 1 0 Time Base Timer 0: Disable T 000:fc/ 223 [Hz] 001:f¢/ 221 010:fc/2'6 RW retcx | Timebasetimerinterrupt | 011:f¢/2'* frequency select 100:fc/2" 101:f¢/2'? 110:f¢/2"" 111:f¢/ 29 Note 1: fc; clock [Hz], * ; Don’t care Note 2: The fourth bit in TBTCR must be to "0". Figure 2-7. Time Base Timer Control Register Table 2-1. Time Base Timer Interrupt Frequency [Hz] NORMAL, IDLE mode (at fc = 8 MHz) 000 0.95 001 3.81 010 122.07 o11 488.28 100 976.56 101 1953.12 110 3906.25 11 15625 3-08-45 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.4 Divider Output (DVO)

A 50% duty pulse can be output using the Divider output circuit, which is useful for piezo-electric buzzer drive. Divider output is from pin P13 (DVO). The P13 output latch should be set to “1” and then the P13 should be configured as an output mode. 7 6 5 4 3 2 1 O (oose) evoen] ovgcx To Jowwm[ cerca, J Unitial value: 0%#0 On+a) ‘i 0: Disable 00: fe/2 [Hz] Divider output (DVO pin) 01: fe/2" bvock frequency selection 10: fe/2"! 11: fe/2"0 Note: fc; High-frequency clock [Hz], * ; Don’t care Figure 2-8. Divider Output Control Register Example: 1 kHz pulse output (at fc = 8 MHz) SET (P1).3 ; P13 output latch —1 LD (P1CR), 00001000B ; Configures P13 as an output mode LD (TBTCR), 10000000B ; DVOEN<-1, DVOCK<-00 Table 2-2. Frequency of Divider Output [kHz] 00 0.512 0.976 01 1.024 1.953 10 2.048 3.906 1" 4.096 7.812 Output latch Output mode (P1CR3) Output data [>_<] [> >—CP3:0v0) Selector 4 fc/213 ease | O) fe/211 >—c_¥ {7310 >, P13 output latch l 2 — Dvock DVOEN DVOEN | pod L Divider output control register DVO pin (a) Configuration (b) Timing Chart Figure 2-9. Divider Output 3-08-46 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 2.5 16-bit Timer/Counter 1 (TC1)

2.5.1 Configuration

: A ab | | ge ef F | U0] + a = $3) FRE BP. . 8 K4 g} 5 (\\ 0 <= +t aoe az $ ee. é 3°? 3-08-47 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.5.2 Control

The Timer/Counter 1 is controlled by a Timer/Counter 1 control register (TC1CR) and two 16-bit timer registers (TREG1A and TREG1B). Timer register 15 1413, 12,1109 BO USL UB oor. Write only TREG1B (0012, 00134) TREG 1B, (00131) TREG1B, (0012,) Timer/Counter Read / Write (Write available in only PPG output mode) 7 6 5 4 #3 2 1 ~ 0 SCAPT TCICR TRF1 |MCAPT Tc1 TC1CcK TCIM iti (0014) Mert! cis fale Cc (Initial value: 0000 0000) 00: Timer / External trigger timer / Event counter mode tem {TC 01: Window mode mode select 10: Pulse width measurement mode 11: PPG (Programmable pulse generate) output mode 00: Internal clock fc/2"' [Hz] Tc1 01: Internal clock fe/2” TCICK | source clock select 10: Internal clock fc?) 11: External clock (TC1 pin input) Write 00: Stop & counter clear only ters. {TC 01: Command start start control 10: reserved 11: External trigger start Pulse width measurement MCAP1 0: Double edge capture 1: Single edge capture control . External trigger timer 0: Trigger start 1: Trigger start & stoy MPPG1_| PPG output control 0: Continuous pulse __1: Single pulse TFF1 | Timer F/F1 control 0: Clear 4: Set Note 1: fc; clock [Hz] Note 2: Writing to the low-byte of the timer registers (TREG1A,, TREG1B,), the comparison is inhibited until the high-byte (TREG1Ay, TREG1B}) is written. (Only the low-byte of the timer registers cannot be changed.) After writing to the high-byte, the comparison within 1 machine cycle(during instruction execution) is ignored. Note 3: Set the mode, source clock, edge (INT2ES), PPG output control and timer F/F1 control when TC1 stops (TC15 =00). Note 4: Software capture can be used in only timer and event counter modes. SCAP1 is automatically cleared to "0" after software capture. Note 5: Values to be loaded to timer registers must satisfy the following condition. TREG1A>TREG1B>0 (PPG output mode) ; TREG1A>0 (except for PPG output mode) Note 6: Always write “0” to TFF1 except the PPG output mode. Note 7: TCICR is a write-only register, which cannot be accessed by any read-modify-write instructions such as bit operate, etc. Note 8: TREG1B cannot be written after setting to PPG output mode. Figure 2-11. Timer Registers and Control Register TC1 3-08-48 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.5.3 Function

Timer/Counter 1 has six operating modes: Timer, External trigger timer, Event counter, Window, Pulse width measurement, and Programmable pulse generator output mode. (1) Timer Mode In this mode, counting up is performed using the internal clock. The contents of the Timer register 1A (TREG1A) are compared with the contents of up-counter. If a match is found, an INTTC1 interrupt is generated, and the counter is cleared to “0”. Counting up resumes after the counter is cleared. The current contents of up-counter can be transferred to the Timer register 1B (TREG1B) by setting SCAP1(bit 6 in TC1CR) to “1"(software capture function). SCAP1 is automatically cleared to "0" after capturing. Table 2-3. Timer/Counter 1 Source Clock (Internal Clock) (at fc = 8 MHz) 00 256 16.8 01 16 1.0 10 1 65.5 m Example 1: Sets the Timer mode with source clock fc/211[Hz] and generates an interrupt 1s. later (at fc = 8 MHz). LDW (TREG1A), 1000H ; Sets the timer register (1s + 211/fc = 10004) SET (EIRL). EF4 ; Enables INTTC1 interrupt El LD (TC1CR), 000100008 ; StartsTC1 Note: TCICR is a write-only register, which cannot start by [SET(TC1CR).4] instruction. Example 2: Software capture LD (TC1CR) , 010100008 7 SCAP1<-1 LD WA, (TREG1B) ; Reads captured value Command start Source clock l ' | | | J | J | Counter o C: X2X2X 4) KKK XX 2 KX 5 XX)

1 Match Counter

INTTC1 interrupt t detect clear (a) Timer mode Source clock l l J l Counter Kom=2 Xom=t Xm Koma Ximez KX et Xn XK et) SCAP1 | (b) Software Capture Figure 2-12. Timer Mode Timing Chart 3-08-49 2001-01-22

TOSHIBA TMP87C408/808/408L/808L (2) External Trigger Timer mode In this mode, counting up is started by an external trigger. This trigger is the edge of the TC1 pin input. Either the riging or the falling edge can be selected. Edge selection is the same as for INT2 pin. Source clock is used an internal clock selected. The contents of TREG1A is compared with the contents of up-counter. If a match is found, an INTTC1 interrupt is generated, and the counter is cleared to “0” and halted. The counter is restarted by the selected edge of the TC1 pin input. When the edge input is opposite to the edge input way of the count start trigger at METTI (bit 6 in TC1CR) = 1, the counter is cleared, and count stops. In this mode, pulse input with a constant pulse width generates interrupt. When METT1 is “0”, the opposite edge input is ignored. The edge of TC1 pin input before match detection is also ignored. The TC1 pin input has the same noise rejection as the INT2 pin, therefore, pulses of 7/fc [s] or less are rejected as noise in NORMAL or IDLE mode. A pulse width of 24/fc [s] or more is required for edge detection. Example 1:Generates interrupt after 100 s from TC1 pin input rising edge (at fc = 8 MHz). LD (EINTCR), 00000000B ; INT2ES<0 (rising edge) LDW (TREG1A), 0064H } 100 ws +23/fc=64y SET (EIRL).EF4 ; Enables INTTC1 interrupt El LD (TC1CR), 00111000B ; Starts TC1 external trigger, METT =0 Example 2: When “L” level pulses of 4ms or more is input to TC1 pin, generates interrupt. (at fc = 8 MHz) LD (EINTCR), 00000100B ; INT2ES<1 (“L” level) LDW (TREG1A), OOFAH ; 4ms+27/fc=FAq SET (EIRL).EF4 ; Enables INTTC1 interrupt El LD (TC1CR), 011101008 ; Starts TC1 external trigger , METT =1 Count start Count start Rising edge TC1 pin input f Trigger K Trigger fintaes <0) Internal clock | i | l | Counter 0 X7X2XK=X KX 2X 3) Kn-1) eX —2 Ki X 2X3 Timerregisterta 2 Xa Match | p4) Clear INTTC1 interrupt (a) Trigger Start (METT1 = 0) Count Count Count start clear start Rising edge select TC1 pin input h Trigger Y Trigger I Trigger Y (Ntaes = . Internal clock | Hi J l J Counter F OOOQGOE—TOAGEONE Note: m<n Timerregister 1A Xn match /ciear INTTC1 interrupt (b) Trigger Start & Stop (METT1 = 1) Figure 2-13. External Trigger Timer Mode Timing Chart 3-08-50 2001-01-22

TOSHIBA TMP87C408/808/408L/808L (5) Pulse width measurement mode Counting is started by a trigger of the rising (falling) edge of the TC1 pin input (set to external trigger start by TC1CR). The source clock is used an internal clock. On the next falling (rising) edge, the counter contents are transferred to TREG1B and an interrupt is generated. The counter is cleared when the single edge capture mode is set. When double edge capture is set, the counter continues and, at the next rising (falling) edge, the counter contents are again transferred to TREG1B. If a falling (rising) edge capture value is required, it is necessary to read out TREG1B contents until a rising (falling) edge is detected. Falling or rising edge is selected with INT2ES, and single edge or double edge is selected with MCAP1 (bit 6 in TC1CR). Example: Duty measurement (Resolution fc/27[Hz]) CLR (INTTC1SW). 0 ;INTTC1 service switch initial setting LD —_ (EINTCR), 000000008 ; Sets the rising edge at the INT2ES edge LD — (TC1CR), 000001108 ; Sets the TC1 mode and source clock SET (EIRL). EF4 ; Enables INTTC1 El LD = (TC1CR),00110110B ; Starts TC1 with an external trigger in MCAP1 =0 PINTTC1: CPL (INTTC1SW).0 ; Complements INTTC1 service switch JRS_— F,SINTTC1 LD — (HPULSE), (TREG1BL) ; Reads TREG1B (“H" level pulse width) LD — (HPULSE + 1), (TREG1BH) RETI SINTTC1: LD (WIDTH), (TREG1BL) ; Reads TREG1B (Period) LD (WIDTH + 1), (TREG1BH) : ; Duty calculation RETI VINTTC1: DW_ PINTTC1 WIDTH :

1 HPULSE :

INTTC1SW —__ JT &Le 3-08-52 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Count start Count start TC1 pin input a re es A Oo) Internal clock l H J | J i l Counter = XOXOXO >*X OG Capture TREG1B 7 INTTC1 interrupt _ [Application] High or low pulse width measurement (a) Single edge capture (MCAP = 1) Count start Count start TC! pininput es es =0) Internal clock | E J 1 J E | Counter CD ED ED ED Cd G4 (Cd Ed iP ed Ge) ReGt8 (XT INTTC1 interrupt I I [Application] @ Period/Frequency measurement @ Duty measurement (b) Double edge capture (MCAP1 = 0) Figure 2-16. Pulse Width Measurement Mode (6) Programmable Pulse Generate (PPG) output mode Counting is started by an edge of the TC1 pin input (either the rising or falling edge can be selected) or by acommand. Either the rising or falling edge can be selected by INT2ES of EINTCR. The source clock is used an internal clock. First, the contents of TREG1B are compared with the contents of the up-counter. If a match is found, Timer F/F1 output is toggled. INTTC1 interrupt is generated at continuous output (MPPG1=0) Next, Timer F/F1 is again toggled and the counter is cleared by matching with TREG1A. An INTTC1 interrupt is generated at this time. Timer F/F1 output is inverted and connected to the P14 (PPG) pin. In the case of PPG output, set the P14 output latch to “1” and configure as an output mode. Timer F/F1 is cleared to “0” during reset. The Timer F/F1 value can also be set by TFF1 (bit 7 in TC1CR) and either a positive or negative logic pulse output is available. Also, writing to the TREG1B is not possible unless the Timer/Counter 1 is set to the PPG output mode. Example: “H” level 800 ys, “L"” level 200 ws pulse output at fc = 8 MHz SET (P1).4 ;P14 output latche-1 LD (P1CR), 00010000B ;Sets P14 to an output mode LD (TC1CR), 10001011B =; Sets PPG output mode LDW (TREG1A), 03E8H Sets a period (1 ms = 1 ~s = 03E8y) LDW = (TREG1B), 00C8H ;Sets “L” level pulse width (200 ys + 1 ws = 00C8H) LD (TC1CR),10010011B =; Start 3-08-53 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 2.6 16-bit Timer/Counter 2 (TC2)

2.6.1 Configuration

Tc2s > >o Tc2pin DH4>[H e223 la D le Clear fu28; Ic Event counter Source TC2M detcet Icomparator INTTC2 3 [ > interrupt TC2CK TCs [ Enable Match detect control TC2CR TREG2 Timer/Counter 2 control register 16-bit timer register 2 TREG2H — TREG2L write strobe Figure 2-19. Timer/Counter 2 (TC2)

2.6.2 Control

The Timer/Counter 2 is controlled by a Timer/Counter 2 control register (TC2CR) and a 16-bit timer register 2 (TREG2). 11413 121 1099 BOT LULU UU TREG2 TREG2,, (0017, TREG2, (0016, (ootey, 0017 Ls. TREGZafo0I7Y treason) Write only 7.6 5S 4 3 2 1 0 TO2CR : “as (0015). [reas TC2cK Tc2M] (initial value: *#00 000) team _ | Timer/Counter 2 operating 0: Timer/Event counter mode mode select 1: Window mode 000: Internal clock f¢/ 2” [Hz] 001 : Internal clock fe/ 2”? 010: Internal clock fe/ 2° | Teac _| Timer/Counter 2 011: Internal clock fe/ 2? Write source clock select 100: reserved only 101: reserved 110: reserved 111: External clock (TC2 pin input) Timer/Counter 2 0: Stop and counter clear Te2s : start control 1: Start Note 1: fc; clock [Hz], *; Don't care Note 2: When writing to the low byte of timer register 2 (TREG2,), the comparison is inhibited until the high- byte (TREG2,) is written. After writing to the high-byte, any match during 1 machine cycle (instruction execution cycle) is ignored. Note 3: Set the mode and source clock when Timer/Counter stops (TC2S = 0). Note 4: Values to be loaded to the timer register must satisfy the following condition. TREG2 > 0 Note 5: TC2CR and TREG2 is a write-only register and cannot be used with any of the read-modify-write Tastractions. Figure 2-20. Timer Register 2 and TC2 Control Register 3-08-55 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.6.3 Function

The Timer/Counter 2 has three operating modes: Timer, Event counter and Window modes. (1) Timer Mode In this mode, the internal clock is used for counting up. The contents of TREG2 are compared with the contents of up-counter. If a match is found, an INTTC2 interrupt is generated, and the counter is cleared. Counting up is resumed after the counter is cleared. Table 2-4. Source Clock (Internal Clock) for Timer/Counter 2 (at fc = 8 MHz) 000 1.05 s 19.1h 001 1.02 ms 1.1 min 010 320s 241s 011 1 6 65.5 ms Example: Sets the Timer mode with source clock fc/23 [Hz] and generates an interrupt every 25 ms (at fc = 8 MHz). LDW (TREG2), 61A8H ; Sets the TREG2 (25 ms + 23/fc=61A8}) SET (EIRH).EF14 ; Enables INTTC2 interrupt El LD (TC2CR), 00101100B ; Starts TC2 (2) Event Counter Mode In this mode, events are counted on the rising edge of the TC2 pin input. The contents of TREG2 are compared with the contents of the up-counter. If a match is found, an INTTC2 interrupt is generated, and the counter is cleared. The maximum frequency applied to the TC2 pin is fc/24 [Hz] in NORMAL or IDLE mode. But, a pulse width of 2 machine cycles or more is required for both “H” and “L" level. Example: Sets the Event counter mode and generates an INTTC2 interrupt 640 counts later LDW (TREG2), 640 ; Sets the TREG2 SET (EIRH).EF14 ; Enables INTTC2 interrupt El LD (TC2CR), 00111100B ; Starts TC2 (3) Window Mode In this mode, counting up is performed by an internal clock during “H” level of TC2 external pin input (Window pulse). The contents of TREG2 are compared with the contents of up-counter. If a match is found, an INTTC2 interrupt is generated, and the up-counter is cleared to “0”. It is necessary that the maximum applied frequency must be considerably slower than the selected internal clock. Example: Inputs “H” level pulse of 120 ms or more and generates interrupt. (at fc = 8 MHz). LDW (TREG2), 0078H ; Sets TREG2 (120 ms + 213/fc = 00784) SET (EIRH).EF14 ; Enables INTTC2 interrupt El LD (TC2CR), 00100101B ; Starts TC2 3-08-56 2001-01-22

TOSHIBA TMP87C408/808/408L/808L TC2 pin input Internal clock ' t H H ' 7 t ' Counter 9 CE X2X XoXo? KX 1X2 XS) rRes2 a Match | -4j Counter clear INTTC2 interrupt Figure 2-21. Window Mode Timing Chart 3-08-57 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.7 Serial Interface (SIO)

The 87C408/808/408L/808L each have one clocked-synchronous 8-bit Serial interfaces (SIO). The Serial interface has an 8-byte transmit and receive data buffer that can automatically and continuously transfer up to 64 bits of data. The Serial interface is connected to external devices via pins P75 (SO), P74 (SI), and P73 (SCK). The Serial interface pins are also used as port P7. When used as Serial interface pins, the output latches of these pins should be set to “1”. In the Transmit mode, pins P74 can be used as normal I/O ports, and in the Receive mode, the pins P75 can be used as normal I/O ports.

2.7.1 Configuration

SIO control register/status register cpu SIOCR1/SIOSR SIOCR2 [| j Transmit and receive H data buffer ' ; Buffer control (8-byte in DBR) ' Control circuit circuit ' Shift register igi i shift ! $0 pi Sk | tan B-bit transfer 4-bit transfer sipin 7~ Serial data input Serial clock 4 INTSIO interrupt t SCK interrupt reduces UJ Serial clock /O Figure 2-22. Serial Interface

2.7.2 Control

The Serial interface is controlled by SIO control registers (SIOCR1/SIOCR2). The Serial interface status can be determined by reading SIO status registers (SIOSR). The transmit and receive data buffer is controlled by the BUF (bits 2 to 0 in SIOCR2). The data buffer is assigned to addresses OFFO to OFF7} for SIO in the DBR area, and can continuously transfer up to 8 words at one time. When the specified number of words has been transferred, a buffer empty (in the Transmit mode) or a buffer full (in the Receive mode or Transmit/Receive mode) interrupt (INTSIO) is generated. 3-08-58 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Serial interface control register 1 siocri 7 6 5 4 3 2 1 OO (00204) [sios sioM (initial value: 0000 0000) ; 0: Stop S108 Indleate transfer sterUstop 0: Continue transfer SIOINH | Continue/abort transfer 1: Abort transfer (automatically cleared after abort) 000: 8-bit Transmit mode 010: 4-bit Transmit mode . Transfer mode select 100: 8-bit Transmit/Receive mode Write 101: 8-bit Receive mode only 110: 4-bit Receive mode 000: internal clock fe/ 2"? [Hz] 001: Internal clock fe/ 2° (output on 5CK pin) SCK | Serial clock select 010: Internal clock f¢/2° joutputon SCK pt Ot11zInternal clock fe/2> J 111: External clock (input form SCK pin) Note 1: Set SIOS to "0" and SIOINH to "1" when setting the Transmit mode or serial clock. Note 2: SIOCR1 is a write-only register and must not be used with any of read-modify-write instructions such as. bit manipulation. Serial interface control register 2 slocr2 7.6 5. 4 3 2 1 0 0021) tL WAIT [BUF] initial value: +**0 0000) Always sets “00” except 8-bit Transmit/Receive mode. 00: Ty = Tp (non-wait) WAIT | wait control 01: T= 27 10: Ty = 4Tp | (wait) 1: Ty = 8Tp Buffer address used Write 000: 1 word transfer OF FO only 001:2word transfer OFFO to OFF1y 010:3word transfer OFFO to OFF2y BUF | Number of transfer words 011:4wordtransfer OFFO to OFF3y 100:Sword transfer OFFO to OFFA, 101:6word transfer OFFO to OFFSy 110:7word transfer OFFO to OFF6y 111:8wordtransfer__OFFO to OFF74 Note 1: Tr; frame time (1 word data transfer time), Tp ; data transfer time —— Tb — ' Note 2: The lower 4 bits of each buffer are used during 4-bit transfers. Zeros (0) are stored to the upper 4 bits when receiving. Note 3: Transmitting starts at the lowest address. Received data are also stored starting from the lowest address to the highest address. First, address OFFOy is transferred. Note 4: The value to be loaded to BUF is held after transfer is completed. Note 5: SIOCR2 must be set when the serial interface is stopped (SIOF = 0). Note 6: SIOCR2 is a write-only register and must not be used with any of read-modify-write instructions such as bit manipulation. Note7: * ; Don'tcare Figure 2-23. Serial Interface Control Register 3-08-59 2001-01-22

TOSHIBA TMP87C408/808/408L/808L @® External Clock An external clock connected to the SCK pin is used as the serial clock. In this case, the P73 ‘SCK)) output latch must be set to “1”. To ensure shifting, a pulse width of at least 4 machine cycles is required. Thus, the maximum transfer speed is 244 Kbit/s (at fc = 8 MHz). tsckL tsckH Sexe tsa > Atoye b. Shift edge The leading edge is used to transmit, and the trailing edge is used to receive. ® Leading Edge Transmitted data are shifted on the leading edge of the serial clock (falling edge of the SCK pin input/output). ® Trailing Edge Received data are shifted on the trailing edge of the serial clock (rising edge of the SCK pin input/output). Sckpin TYLILIL LU (a) Leading Edge ScKppn LALA LA A Sipin Note: * ; Don’tcare (b) Trailing Edge Figure 2-26. Shift Edge (2) Number of Bits of Transfer Either 4-bit or 8-bit serial transfer can be selected. When 4-bit serial transfer is selected, only the lower 4-bits of the transmit/receive data buffer register are used. The upper 4-bits are cleared to “0” when receiving. The data is transferred in sequence starting at the least significant bit (LSB). (3) Number of Words to Transfer Up to 8 words consisting of 4 bits of data (4-bit serial transfer) to 8 bits (8-bit serial transfer) of data can be transferred continuously. The number of words to be transferred is loaded to BUF. An INTSIO interrupt is generated when the specified number of words has been transferred. If the number of words is to be changed during transfer, the serial interface must be stopped before making the change. The number of words can be changed during automatic-wait operation of an internal clock. In this case, the serial interface is not required to be stopped. 3-08-61 2001-01-22

TOSHIBA TMP87C408/808/408L/808L SCK pin J SO pin INTSIO interrupt (a) 1 Word Transmit SCK pin J l J SO pin \\2oXarX 22X aaX boX iX bX bX KAXLKS INTSIO interrupt l (b)_ 3 Words Transmit Sipin KaoXarX 22K aaX roXiK 2X bsKcoKAKAK/ INTSIO interrupt (<)_ 3 Words Receive Figure 2-27. Number of Bits to Transfer (Example: 1 word = 4 bits) (4) Transfer Mode SIOM (bits 3 to 5 in SIOCR1) is used to select the Transmit, Receive, or Transmit/Receive mode. a. 4-bit and 8-bit Transmit Modes In these modes, the Transmit mode is set to the control register and then the data to be transmitted first are written to the data buffer registers (DBR). After the data area written, the transmission is started by setting SIOS to “1”. The data are then output sequentially to the SO pin in synchronous with the serial clock, starting with the least significant bit (LSB). As soon as the LSB has been output, the data are transferred from the data buffer register to the shift register per 1 word. When the final data bit has been transferred and the data buffer register is empty, an INTSIO (buffer empty) interrupt is generated to request the next transmitted data. When the internal clock is used, the serial clock will stop and perform an automatic wait if the next transmitted data are not loaded to the data buffer register by the time the number of data words specified with the BUF has been transmitted. Writing even one word of data cancels the automatic-wait; therefore, when transmitting two or more words, always write the next word before transmission of the previous word is completed. Note: Automatic-waits are also canceled by writing to a DBR not being used as a transmit data buffer register; therefore, during SIO do not use such DBR for other applications. For example, when 3 words are transmitted, do not use the DBR of the remained 5 words. When an external clock is used, the data must be written to the data buffer register before shifting next data. Thus, the transfer speed is determined by the maximum delay time from the generation of the interrupt request to writing of the data to the data buffer register by the interrupt service program. When the transmit is started, after the SIOF goes “high” output from the SO pin holds final bit of the last data until falling edge of the SCK. The transmission is ended by clearing SIOS to “0” or set SIOINH to “1” in the buffer empty interrupt service program to end transmitting. After SIOS is cleared, the transmission is ended at the time that the final bit of the data being shifted has been output. That the transmission has ended can be determined from the status of SIOF (bit 7 in SIOSR). SIOF is cleared to “0” when the transmission is completed. When SIOINH is set, the transmission is immediately ended and SIOF is cleared to “0”. 3-08-62 2001-01-22

TOSHIBA TMP87C408/808/408L/808L b.4-bit and 8-bit Receive Modes After setting the control registers to the Receive mode, set SIOS to “1” to enable receiving. The data are then transferred to the shift register via the SI pin in synchronous with the serial clock, starting with the least significant bit (LSB). When one word of data has been received, it is transferred from the shift register to the data buffer register (DBR). When the number of words specified with the BUF has been received, an INTSIO (buffer full) interrupt is generated to request that these data be read out. The data are then read from the data buffer registers by the interrupt service program. When the internal clock is used, and the previous data are not read from the data buffer register before the next data are received, the serial clock will stop and an automatic-wait will be initiated until the data are read. A wait will not be initiated if even one data word has been read. Note: Automatic-waits are also canceled by reading a DBR not being used as a received data When an external clock is used, the shift operation is synchronized with the external clock; therefore, the previous data are read before the next data are transferred to the data buffer register. If the previous data have not been read, the next data will not be transferred to the data buffer register and the receiving of any more data will be canceled. When an external clock is used, the maximum transfer speed is determined by the delay between the time when the interrupt request is generated and when the data received have been read. The receiving is ended by clearing SIOS to “0” or setting SIOINH to “1” in buffer full interrupt service program. When SIOS is cleared, the current data are transferred to the buffer. After SIOS cleaned, the transmissions is ended at the time that the final bit of the data being shifted has been output. That the transmission has ended can be determined from the status of SIOF (bit 7 in SIOSR). SIOF is cleared to “0” when the transmission is ended. After confirmed the receiving termination, the final receiving data is read. When SIOINH is set, the receiving is immediately ended and SIOF is cleared to “0”. (The received data is ignored, and it is not required to be read out.) If it is necessary to change the number of words in external clock operation, SIOS should be cleared to “0” then BUF must be rewritten after confirming that SIOF has been cleared to “0”. If it is necessary to change the number of words in internal clock operation, during automatic- wait which occurs after completion of data receiving. (BUF must be rewritten before the received data is read out.) Note: The buffer contents are lost when the transfer mode is switched. If it should become data and then switch the Transfer mode. 3-08-64 2001-01-22

TOSHIBA TMP87C408/808/408L/808L slos | nn SIOF SCK pin (output) SIpin VM 20 2X 22K 23X 20K asX asX a7) PoX bX b2X baX baX bsX bs X br] INTSIO interrupt DBR a a oa Read receive data Read receive data Figure 2-30. Receive Mode (Example: 8-bit, 1 word, internal clock) c. 8-bit Transmit/Receive Mode After setting the control registers to the Transmit/Receive mode, write the data to be transmitted first to the data buffer registers (DBR). After that, enable transmitting and receiving by setting SIOS to “1”. When transmitting, the data are output from the SO pin at leading edges of the serial cock, starting with the least significant bit (LSB). When receiving, the data are input through the SI pin at the trailing edges of the serial clock. 8-bit data are transferred from the shift register to the data buffer register. An INTSIO interrupt is generated when the number of data words specified with the BUF has been transferred. The interrupt service program reads the received data from the data buffer register, the transmitted data is written. The data buffer register is used for both transmitting and receiving; therefore, always write the data to the transmitted after reading all the received data. When the internal clock is used, a wait is initiated until the received data are read and the next data are written. A wait will not be initiated if even one data word has been written. Note: Waits are also canceled by writing to a DBR not being used as the transmit/received data buffer register; therefore, do not use such DBR for other applications. When an external clock is used, the shift operation is synchronized with the external clock; therefore, it is necessary to read the received data and write the data to be transmitted next before starting the next shift operation. When an external clock is used, the maximum transfer speed is determined by the maximum delay between generation of an interrupt request and the received data are read and the data to be transmitted next are written. When the transmit is started, after the SIOF goes “high” output from the SO pin holds final bit of the last data until falling edge of the SCK. The transmit/receive operation is ended by clearing SIOS to “0” or set SIOINH to “1” in INTSIO interrupt service program. When SIOS is cleared, the current data are transferred to the data buffer register. The transmit/receive is ended at the time that the final bit of the data being shifted has been output. The end of transmit/receive can be determined from the status of SIOF (bit 7 in SIOSR). SIOF is cleared to “0” when the transmit/receive is ended. When SIOINH is set, the transmission is immediately ended and SIOF is cleared to “0”. If the number of words is to be changed during transfer, SIOS must be cleared to “0” and BUF is rewritten after SIOF is determined to be cleared to “0” during automatic-wait operation of an external clock operation. The number of words can be changed in an internal clock. In this case BUF must be rewritten before the received data is read out. 3-08-65 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.7.3 NOTES FOR USAGE OF SIO

If same ringing noise occurs at rising or falling of SCK pin, note that the SCK pin does not function as Schmitt circuit. VoD - —_ voD typ0.9V . sck 2 FV ~ [28s sx O > internal oy ee . GND i “TT internal Figure 2-33. Example of ringing noise The SCK pin is used as a count clock for detecting the ending point of the serial data. If some rising noise occurs on the SCK input line, as Figure 1, some miscounting will be performed, thus the function for shifting the receive data will finish earlier than anticipated, it shown as Figure 2-34. Correct count 1 2 3 4 5 6 7 8 4 4 4 4 miss count 1,2 3,4 5,6 7,8 Figure 2-34. Example of miss count (at 8-bit receive mode) Note 1: In case of SCK pin is used as input, it is recommended that Schmitt circuit is inserted externally. Note 2: Additionally, SI pin does not function as Schmitt circuit, so we suggest that Schmitt circuit is inserted externally. 3-08-67 2001-01-22

TOSHIBA TMP87C408/808/408L/808L 2.8 8-bit A/D Converter (ADC) The 87C408/808/408L/808L each have an 8-bit successive approximate type A/D converter with sample and hold. Analog reference power supply (VAREF) is automatically cut off in STOP mode or analog input disable.

2.8.1 Configuration

i i Ri2 R R a2 | VAREF i; wane none nnn nnenn nnn nn-=- i O vass sToP owl Analog input Sample & Hold Reference Multiplexer pomereiereceereerern voltage AINO Ay i 5 i aint O B i H 8 ain2 O c i aa i Ain3 O D i i ‘Analog i i comparator aina O E Leer teete eerste ains O F EN Shift clock ENS 6. ‘ADS || EOCF P6 input/output control register. A/D Converter control register A/D Conversion result register Figure 2-35. A/D Converter (ADC)

2.8.2 Control

The A/D converter is controlled by an A/D converter control register (ADCCR). Reading EOCF of ADCCR recognizes A/D converter operation state, and reading A/D conversion result register (ADCDR) recognizes A/D conversion result. AND Conversion Result Register ADCOR 7 6 5 4 3 2 1 Oo (oor) CE] Ready Figure 2-36. A/D Conversion Result Register 3-08-68 2001-01-22

TOSHIBA TMP87C408/808/408L/808L ‘AID Converter Control Register 7 6 5 4 3 2 #1 0 ADCCR (eeae) [EOF ADS TACK anos], SAN] _iitialvatue: 00010000 0000: AINO 0001: AIN1 0010: AIN2 Analog input selection O800. ANS 0101: AINS 0110: reserved 0111: reserved ies: reserved ; 0: Enable aoa: 0: Conversion time = 184/fegck ae Note 1: * ; Don'tcare Note 2: Select analog input when A/D converter stops. Note 3: The ADS is automatically cleared to “0” after starting conversion. Note 4: The EOCF is cleared to “0” when reading the ADCDR. Note5: The EOCF is read-only. The written data is ignored. Figure 2-37. A/D Converter Control Register

2.8.3 Operation

The high side of an analog reference voltage is applied to VAREF pin, and the low side is applied to VASS pin. The reference voltage between VAREF and VASS is divided into the voltage corresponding with bits by radar resistance. The reference voltage is compared with an analog input voltage and A/D conversion is performed. Note: VASS is the same as VSS. (1) Start of A/D conversion First, selects one of analog input channels (AIN5S to AINO) by SAIN(bit 3 to 0 in ADCCR). Clear the AINDS (bit 4 in ADCCR) to “0”. The channel used as an analog input is cleared to “0” by P6 input control (P6CR). Note: The pin that is not used as an analog input can be used as regular input/output pins. During conversion, do not perform output instruction to maintain a precision for all of the pins. A/D conversion time is set with the ACK (bit 5 in ADCCR). A/D conversion is started by setting the ADS (bit 6 in ADCCR) to “1”. A/D conversion time is from A/D conversion until setting the conversion result to ADCDR. When ACK =0, conversion is accomplished in 184/fcgck [s] (46 machine cycles). For example, 23 ys in fegck =8 MHz. The EOCF (bit 7 in ADCCR) is set to “1” at end of conversion.When ADS is set to “1” during A/D conversion, conversion is initialized and restarted.Sampling of an analog input voltage is performed in 4 machine cycles after A/D conversion start is indicated. Note 1: To keep the same level of an analog input during 4 Machine Cycle Time is necessary for charging the electron to the sample hold circuit of the 87C408/808/P808 which has a resistor (typ. 5 kQ) and a capacitor (typ. 12pF). Note 2: To keep the same level of an analog input during 4 Machine Cycle Time is necessary for charging the electron to the sample hold circuit of the 87C408L/808L/P808L which has a resistor (typ. 7 kQ) and a capacitor (typ. 11pF). 3-08-69 2001-01-22

TOSHIBA TMP87C408/808/408L/808L

2.9 Key Wake Up

The87C408/808/408L/808L can control STOP mode with four pins such as P62, P63, P64 and P65 other than P76 (INT5/STOP). When the STOP mode is controlled in port inputs of P62, P63, P64 and P65, system register 1 (SYSCR1) must start the STOP mode (Level release mode). Edge mode cannot use at key wake-up. STOP mode control register stopr _2 6 5 4 3 2 1 0 1: Enable 1: Enable Read / Write 1: Enable 1: Enable Figure 2-40. Stop Mode Control Register STOP mode control circuit STOP mode CI o [_] P76 «INTs / STOP) control signal Ct Cl oc} [| P62 (ainz/stor2) cE—H o<{|-_(] 64 (ainasstopay Lo o<]—[] Pes ains stops) capabaha STOPCR (002FH) SIs isle 5|4|3|2 Figure 2-41. Stop Mode Control Circuit Each bit of P62 to P65 can be individually connected with internal pull-up resistor under the STOP mode control register (STOPCR). AINi 4. Data input ‘en | Data output as on PGi (i=2to 5) Control input STOPi Figure 2-42. Port P6i(i=2to 5) Note: In case of using port P65 to P62 as key wake-up input, P76 pin must be used as input only (in cluding INT5/STOP), must not be used as output port. 3-08-71 2001-01-22

TOSHIBA TMP87C408/808/408L/808L Input / Output Circuit (1) Control pins The input/output circuits of the 87C408/808/408L/808L control pins are shown below. Osc. enable fe van ; vo vob High-frequency resonator input Rr Ri connecting pin XOUT Output ° ng Pr Rp =1.2MQ_ (typ.) Ro =1.5k2 — (typ. XIN XxOUT ° (yp) VDD Sink open drain output Ri R " Hysteresis input RESET vo | Address-trap-reset Pull-up resistor Watchdog-timer-rese cK Riy=220k0 (typ.) System-clock-reset R=1k2 (typ) Initial “Hi-Z” VOD STOP/INTS Input Disable mine Hysteresis input (P76) R R=1kQ (typ.) P76 STOP/INTS Initial "Hi-2” Rin VDD Hysteresis input i=2to5 sTOPi Input (P6i) Disable R Pull-up resistor PGi Riy=70kQ = (typ.) (87¢408/808) Riv=130kQ (typ. sToPi (87¢408L/808L) R=1kQ (typ.) VDD R Pull-down resister TEST Input Riy=70kQ (typ.) Rin R=1kQ (typ.) Note: The 87P808/808L does not have a pull-down resistor for TEST pin. Be sure to fix the TEST Pin to low. 3-08-72 2001-01-22

TOSHIBA TMP87C408/808/408L/808L (2) Input / Output Ports The input / output circuits of the 87C408/808/408L/808L input / output ports are shown below. Initial “Hi-Z” VDD Tri-state VO mine Hysteresis input =1k . vo Disable 8 R=1k0 (typ.) Initial "Hi-2" VDD Tri-state VO R=1k0 (typ.) vo Disable be R Initial “Hi-2" yo Tri-state /O P-ch Control R=1k0 (typ.) "7 i Disable R 3-08-73 2001-01-22

Electrical Characteristics

(1) 87€408/808 Absolute Maximum Ratings (Vss =0V) symbot | conatons ratings unt | Supply Voltage | Mo [oY = 0 t0 5 Input Voltage Pov [oT 03 t0 Von +08 Output Voltage | vor [oT = 03 t0 V0 +08 P16 [| a2 ma 1OL Output Current (Per 1 pin) P7 (Middle current port) 1,6, 7 1,6 [soma 1OL Output Current (Total) P7 (Middle current port) [60 S| | [ion [3 tous [rnpeer Tam Power isipation Tropes 70° pe OU SE [in | Input Current P1, P6, P7 A ° [tne | . Soldering Temperature(time) | tsid_ | | z0ct0) |e _ [Storage Temperature | tg [= 5510125 Operating Temperature Peto PO = 30070 Note: The absolute maximum ratings are rated values which must not be exceeded during operation, even for an instant. Any one of the ratings must not be exceeded. If any absolute maximum rating is exceeded, a device may break down or its performance may be degraded, causing it to catch fire or explode resulting in injury to the user. Thus, when designing products which include this device, ensure that no absolute maximum rating value will ever be exceeded. Recommended Operating Conditions (Vss = 0V, Topr = - 30 to 70°C) symbot | pins] cottons tin |x| unt fe=8MHz IDLE mode fe= |.NORMAL mode Supply Voltage Voo 4.2MHz [IDLEmode 27 v . Vppx0.70 Voo=4.5V Vp x0.75 Input High Voltage Voo v . Vop x 0.30 Voo=4.5V Voox 0.25 Input Low Voltage v ee ee Vpp=4.5t05.5V C80] Clock Frequency fe XIN, XOUT Vpp=2.7t05.5V Note 1: The recommended operating conditions for a device are operating conditions under which it can be guaranteed that the device will operate as specified. If the device is used under operating conditions other than the recommended operating conditions (supply voltage, operating temperature range, specified AC/DC values etc.), malfunction may occur. Thus, when designing products which include this device, ensure that the recommended operating conditions for the device are always adhered to. Note 2: Clock frequency fc: Supply voltage range is specified in NORMAL mode and IDLE mode. Note 3: Minimum of clock frequency: 1 MHz S fegck 3-08-74 2001-01-22

D.C. Characteristics (Vss=0V, Topr= - 30 to 70°C) symbot | ins | conctions | in | tye. | oe | uni | [riseressvorage | vis _[awierssinats + ———SCS~CS = ‘Po | - | VY put Curré iv2__| Tristate ports Vie S:SV/0¥ w [twa [ RESET, STOPI TEST po 30 70 | 50 InputResistance | Rina RESET Po 800 Tf 220 | 450 | ko Output Leak! Current Vop=55ViVour=ssviov | -2 | - | 2 | oa | Output High Voltage Vop=45V, ton=-0.7ma | 41 | - | - | v | Output Low Voltage Except XOUT and P7 Voo = 4.5V, lov=1.6mA [ - | - [oa] v | Output Low Current Vop=4sviou=ov | = [| 7 | - | ma | [« [ - [ss | 0 | supply Current in fege 2 | - | 40 | 64 | Vp =5.5V m upply Current in [rer | NORMAL mode fegck [402 | - | 00s | 1.6 | ic = 4.19 MHz [oa | - [os | 09 | Supply Current in Vpp=5.5V A STOP mode Vin=5.3V/0.2V # Note 1: Typical values show those at Topr = 25°C, VDD =5 V. Note 2: Input Current lyy1, liv: The current through resistor is not included, when the input resistor (pull-up or pull-down) is contained. Note 3: Ipp ; Except for Irer 3-08-75 2001-01-22

A/D Conversion Characteristics (Vss = 0 V, Vpp = 2.7 to 5.5 V, Topr= - 30 to 70°C) | Vanes [oe Analog Reference Voltage AREF [ = [ Voo v a a AnaloginputVoltageRange [| Vaw [Tass T= | Vane |v Analog Reference Current Vaner=55V.Vass(Vs)=0.0v [ = | o8 | 10 | ma | Varer = 5.000 V or LsB Varer = 2.700 V Mass) 0.000 Po | Note: Quantizing error is not contained in those errors. TMP87C408DM Nonlinearity Error J - [| - | + | Aner = 2. P= | - fs | Note: For the TMP87C408, the guaranteed value for A/D conversion accuracy is different when Vpp = 2.7V. 3-08-76 2001-01-22

A.C. Characteristics (I ) (Vss=0V, Vpp =4.5 to 5.5 V, Topr= - 30 to 70°C) symbol | condone [min] tym | ax | rit | In NORMAL mode Machine Cycle Time ty 1s In IDLE mode High Level Clock Pulse Width For external clock operation Low Level Clock Pulse Width fe=8 MHz (XIN input) A/D Conversion Time taoc A.C. Characteristics (II) (Vss=0V, Vpp =2.7 to 5.5V, Topr= - 30 to 70°C) symboi | condones [min tym | ax | unit | In NORMAL mode Machine Cycle Time ty 0.95 ws In IDLE mode High Level Clock Pulse Width For external clock operation Low Level Clock Pulse Width fe=4.2 MHz A/D Conversion Time taoc Note: A/D conversion timing: Internal circuit for AINO to 5 A/D conversion timing AIN selector comp —>-O os — JL (Hi-2) 12pF coc YY) typ. an 5k (typ.) To keep the same level of an selector — analog input during taiy is H i necessary for charging the nD TTT | circuit. i ' 3-08-77 2001-01-22

Recommended Oscillating Conditions (I ) (Vss = 0V, Vpp =4.5 to 5.5 V, Topr= - 30 to 70°C) Oscillation ; Recommended Conditions Parameter Oscillator Frequency Recommended Oscillator KYOCERA KBR8.0M | 30 pF 30 pF 8MHz MURATA CSAC8.00MT 30 pF (VOD =4.5%05.5V) HaGRATA CSAB.OOMTZ cST8.00MTW Ceramic Resonator SST58.00MT High-frequency 4.19MHz MURATA csA4.19MG | 30 pF 30 pF sett (VDD = 2.7 to 5.5 V) aMHz (vpD =2.7to 5.5) | KYOCERA KBR4.0MS 30 pF 8MHz (vob =4.5to5.5v) | TOYOCom 210B 8.0000 Crystal Oscillator MHz 20 pF 20 pF Recommended Oscillating Conditions (II) (Vss=0V, Vpp =2.7 to 5.5 V, Topr= - 30 to 70°C) ; ‘Oscillation ; Recommended Conditions Parameter Oscillator Frequency Recommended Oscillator 4.19MHz MURATA CSA4.19MG| 30 pF 30 pF (VDD = 2.7 to 5.5 V) MURATA cST4.19MGW High-frequency MURATA CsA4.00MG | __30pF__ {| 30pF__ | Ceramic Resonator csa4.oomec [TT Oscillation 4MHz MURATA CST4.00MGW (VDD =2.7to5.5V) CSTC4.00MG XIN 1 G T 7 (1) High-frequency Oscillation Note: When used in high electric field such as a picture tube, the package is recommended to be electrically shielded to maintain a regular operation. 3-08-78 2001-01-22

(1) 87C408L/808L Absolute Maximum Ratings (Vss = 0V) symbel Supply Voltage P vo fo = t0 55 Input Voltage Pov [oT 03 t0 Von +08 Output Voltage | vor [oT 03 t0 Vn +08 | tours fenee ama 1OL Output Current (Per 1 pin) P7 (Middle current port) [10h [tours [1.6.7 |= toon fpnes sm 10L Output Current (Total) P7 (Middle current por [60 | ma] [rok [3 tour [enreer Tama sop | 300 | Power Dissipation [Topr=70°C] [sop | 120 +4 ™ [| 0 Input Current P1, P6, P7 mA SolderingTemperature(timey [| tid [| act) e_ Storage Temperature Pog [oT 8520 125 Operating Temperature top f= 301070 Note: The absolute maximum ratings are rated values which must not be exceeded during operation, even for an instant. Any one of the ratings must not be exceeded. If any absolute maximum rating is exceeded, a device may break down or its performance may be degraded, causing it to catch fire or explode resulting in injury to the user. Thus, when designing products which include this device, ensure that no absolute maximum rating value will ever be exceeded. Recommended Operating Conditions (Vsg = OV, Topr = - 30 to 70°C) symbol | vias | contitions in| ox | unit | fe= 4.2 MHz Supply Voltage Voo IDLE mode v STOP mode InputHigh voltage | vw | | M00 0.90] Yoo |v Clock Frequency XIN, XOUT Vop= 1.8t04.0V [10 | 42 [nz] Note 1: The recommended operating conditions for a device are operating conditions under which it can be guaranteed that the device will operate as specified. If the device is used under operating conditions other than the recommended operating conditions (supply voltage, operating temperature range, specified AC/DC values etc.), malfunction may occur. Thus, when designing products which include this device, ensure that the recommended operating conditions for the device are always adhered to. Note 2: Clock frequency fc: Supply voltage range is specified in NORMAL mode and IDLE mode. Note 3: Minimum of clock frequency: 1 MHz = fegck 3-08-79 2001-01-22

D.C. Characteristics (Vss=0V, Topr= - 30 to 70°C) symbol | ris | conctions [min |e. | ax | unit | Fameressvotoge | vas _[Woneeiinpas po td input Current in2__| Tri-state ports Vine40V/0V a | tina _[ RESET, STOP | Rin _[resr Po 30 | 70 50 | | fins [stori fizztos 30 | 130 | 50 | Output Leakl Current Tri-state ports Voo=4.0V,Vour=4.0v/ov | -2 | - | 2 | pA | Output Low Voltage Except XOUT and P7 Vop=4.0V, lop=1.3mA [ - | - [oa] v | Output Low Current Voo=40Vvoxtov | = | 6 | - | ma | Tees [se] Supply Current in [ier | NORMAL mode fegck [402 | - | 1.35 | 25 | le [pa [a | Supply Current in [er | +7 | IDLE mode fegck [402 | - | 09 | 17 lee [= Por [as | Supply Current in [rer | NORMAL mode fegek [402 | - | 05 | 1.6 | ma lee [oe [| Supply Current in [i {= | os fv | DLEmode [fe2 | - | 05s | IDLE mode fegck [402 | - | 055 | 1.1 | Supply Current in [rer | NORMAL mode fegck [102 | - | 05 | 08 | | | - [035 | os | Supply Current in [ier | IDLE mode fegek [402 | - | 0.23 | 0.35 | fice | — [or [oz Supply Current in Vpp =5.5V A STOP mode Vin=5.3V/0.2V # Note 1: Typical values show those at Topr =25°C, VDD =4 V. Note 2: Input Current liv, mz: The current through resistor is not included, when the input resistor (pull-up or pull-down) is contained. Note3: Ipp ; Except for Irer 3-08-80 2001-01-22

A/D Conversion Characteristics (I ) (Vss = OV, Vpp = 1.8to 4.0 V, Topr= - 30 to 70°C) [ Vane [tT Analog Reference Voltage str [ = T voo v [ vass [oss AnaloginputVoltageRange | Vaw [| ass T= [Vane |v Varer S Vop = 4.0 ise Full Scale Error ACK= 1 tNote2) #2 ee ees Note1: Quantizing error is not contained in those errors. Note2: ACK ; bit5 of ADCCR (#000). conversion time = 184 tcy (175.6 us/ at fegck = 4.19 MHz) A/D Conversion Characteristics (II) (Vss = OV, Vpp = 2.7 to 4.0 V, Topr = - 30 to 70°C) | Voner | Analog Reference Voltage aarF | _- | Voo v [Vass [oss AnaloginputVoltageRange | Vaw [Tass T= [Vane | Analog Reference Current | tner [Vancr=4.0V,Vass(Vssy=oov [| - | a5 | 1.0 | ma | Varer = 4.000 V Mass) = 0.000 a eee or LsB Varer = 2.700 V Vass (ss)=0 000 a ee Note: Quantizing error is not contained in those errors. 3-08-81 2001-01-22

A.C. Characteristics (Vss=0V, Vpp = 1.8to 4.0 V, Topr= - 30 to 70°C) symooi | conavione [in| tym. | tox | uni | In NORMAL mode Machine Cycle Time ty 0.95 Ss In IDLE mode High Level Clock Pulse Width For external clock operation Low Level Clock Pulse Width fe=4.2 MHz A/D Conversion Time tape Note: A/D conversion timing: Internal circuit for AINO to 5 A/D conversion timing AIN selector comp. d—oO a | wiz) ocr wey 7ko (typ)

3 To keep the same level of an selector nel

analog input during tay is H i necessary for charging the AD a | electron to the sample hold conversion $$$ $e =e circuit. H H 3-08-82 2001-01-22

Recommended Oscillating Conditions (Vss=0V, Topr= —30 to 70°C) Oscillation Recommended Conditions Parameter Oscillator Frequency Recommended Oscillator 4.19 MHz MURATA CSA4.19MG 30 pF 30 pF (VDD =2.7 to5.5V) MURATA CST4.19MGW High-frequency MURATA CSA4.00MG Ceramic Resonator csaa.oomec [= Oscillation 4MHz MURATA ¢ST4.00MGW (VDD =2.7 to5.5V) cSTC4.00MG murara esressoome] [| XIN xouT (1) High-frequency Oscillation Note: Whenused in high electric field such as a picture tube, the package is recommended to be electrically shielded to maintain a regular operation. 3-08-83 2001-01-22