TMP87CC70 TOSHIBA

Document overview

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

Technical content

TOSHIBA TMP87CC70/H70/K70A/M70A CMOS 8-BIT MICROCONTROLLER TMP87CC70F, TMP87CH70F, TMP87CK70AF, TMP87CM70AF The 87CC70/H70/K70A/M70A are the high speed and high performance 8-bit single chip microcomputers. These MCU contain 6-bit A/D conversion inputs and a VFT (Vacuum Fluorescent Tube) driver on a chip. [__rartNo. [rom __[ ram | packace [orp mcu__| TMP87CC70F 12K x 8-bit —TMPS7CH7OF__| _16KxB-bit | sia ebit | QEPBO-P-1420-0.808 | TMP87PM70F _TMP87CK70AF_ | 24K xB-bit _ TMPS7CM70AF | 32K x8-bit

FEATURES

8-bit single chip microcomputer TLCS-870 Series QFP80-P-1420-0.80B @instruction execution time : 0.5 us (at 8 MHz), 122 us (at 32.768 kHz) 412 basic instructions @ Multiplication and Division (8bits x 8bits , 16bits + Sbits) @ Bit manipulations (Set/Clear/Complement/Move/Test/Exclusive or) @ 16-bit data operations @ 1-byte jump/subroutine-call (Short relative jump/ Vector call) . $14 interrupt sources (External: 5, Internal: 9) _ —_ @ All sources have independent latches each, ‘—< _—<m and nested interrupt control is available. We Py: @ 3 edge-selectable external interruptswith noise reject " Eee @ High-speed task switching by register bank changeover #10 Input/Output ports (73 pins) @ Output: 1 port (8 pins) TMpByCHVOF @ Input/Output: 9 ports (65 pins) TMP87CK70AF @Two 16-bit Timer/Counters TMP87CM70AF @ Timer, Eventcounter modes TMP87PM70F @Two 8-bit Timer/Counters @ Timer, Event counter, Capture (Pulse width/duty measurement), PWM output, Programmable divider output modes @Time Base Timer (Interrupt frequency: —1Hzto 16 kHz) @Divider output function (frequency: 1kHz to 8 kHz) @Watchdog Timer @ Interrupt source/reset output (programmable) 8-bit Serial Interface © With 8 bytes transmit/receive data buffer @ Internal/external serial clock, and 4/8-bit mode @8-bit High Speed Serial Output (rate : max. 1 bit/ys) @6-bit A/D conversion input (6 channels) Vacuum Fluorescent Tube Driver (automatic display) @ High breakdown voltage ports (max. 40 V x 32 bits) @Key scanning function @ Key-matrix constructed by segment outputs (1 to 16) and key inputs (1 to 8) @ Dual clock operation @ Single/Dual-clock mode (option) @Five Power saving operating modes @ STOP mode : Oscillation stops. Battery/Capacitor back-up. Port output hold/High-impedance. @ SLOW mode: Low power consumption operation using low-frequency clock (32.768 kHz). @ IDLE1 mode : CPU stops, and Peripherals operate using high-frequency clock. Release by interrupts. @ IDLE2 mode: CPU stops, and Peripherals operate using high-and low-frequency clock. Release by interrupts. @ SLEEP mode: CPU stops, and Peripherals operate using low-frequency clock. Release by interrupts. @Wide operating voltage : 2.7 to 6 V at 4.19 MHz/ 32.768 kHz, 4.5 to 6 V at 8 MHz / 32.768 kHz (87CK70A/M70A) 4.5 to 6 V at 8 MHz / 32.768 kHz (87CC70/H70, 87PM70) @Emulation Pod : BM87CK70FOB (or BM87CK70FOA) 3-70-1

TOSHIBA TMP87CC70/H70/K70A/M70A PIN ASSIGNMENTS. eaace (TOP VIEW) SeSeoSSSSSsSsoesesssEsss RESRHSRESSSRSHSELRELEHES FP80-P-1420-0.80B Q AAATAPAPAPAAUAUAUOUONONONY OVO apapaVapApApAnANH HAHRRAR RAR ARR RA HAAR Aa See Se RR hh Aon Ee ese esGes (315) ps7odf6s ad P66 (G9) vkKC—O66 391 P65 (G10) (keY0) PaoC—Oo67 391 p64 (G11) (keY1) P41 O68 37-0 P63 (G12) (KEY2) Pa20—169 36-1 P62 (G13) (keY3) Pa3C—0470 3511 p61 (G14) (KEY4) PagC—o71 34(LJ p60 (G15) (KEYS) P4SC—O72 33-00 vob (CINS/KEY6) P460—11473, 3240 p07 (CIN@/KEY7) P4774 31 p06 (CIN3) PSOC—T175 3q4 pos (CIN2) P51C—00)76. 291T pon (CIN1) P520—00)77, 291 p03 __ P5479 O 241 pot AAD A}APALAUAUAPAPAPAQAOAQAOADEDADAHAQA}A}A}AT SESS Seer hs MZ SSS Saaesess FELEECLIQS GRR gSRERIEI ELS ecge s "2s * peggcgs fete & gs Bessy 2 2 _ \\Be BLOCK v0 Ports Output Ports vo ors DIAGRAM +97 87 a P90 P80 P70 P60 O . . e rowersupnyy {YO —P> Le] [es ] [es vs Ya Ya " (Ko [Ko [KI [Raq - “ey a © © ee | Reset /O RESET (rom) Test Pin TEST i, Resonator XIN High Timer Timer/Counters ||| Timer/Counters Interfaces certs Lxcut ry | Clock [si0_[ 150 |] e.riewo Pins tow | Generator Watchdog Converter (7 frequ. Timer i O O O Oy dey] P22 PO7 P17 P37 P55, P47 to to to to to to P20 POO P10 P30 P50 P40 VO Ports 3-70-2

TOSHIBA TMP87CC70/H70/K70A/M70A PIN FUNCTION CS Two 8-bit programmable input/output P17, P16, P14 vo ports (tri-state). Pre MO Mmou Teach bit of these ports can be |Timencounter input P13 (DVO) VO (Output) _| individually configured as an input or an | pivider output - z output under software control ‘ External interrupt input 2 or P12 (INT2/TC1) During reset, all bits are configured as | Timer/Counter 1imPUt oc ccccccccececsee P11 (INT1) VO (Input) | inPUts. External interrupt input 1 P10 (INTO) must be set to “1”. External interrupt input 0 P22 (XTOUT) VO (Output) . . Resonator connecting pins (32.768 kHz). - 3-bit input/output port with latch. For inputting external clock, XTIN is used P20(INTS/STOP) npu must be setto "1". External interrupt input 5 or STOP mode release signal input P37 (HSO) VO (Output) HSO serial data output P36 vo P35 (HSCK) S-bit input/output port with latch. HS0 serial clock output prswsnesinenesesnen] YOCUtpUD | When used as an input port, a HSO [ttre P34 (50) sete] CUtPUt, @ SIO input/output, a S10 serlal data output, tsauosenessosesencesuseatens P33 (Si) VO (Input) | timer/counter input, or an interrupt | sio serial data input ceunmnnimnnnnnnnennennennesed input the latch must be set to “1” resinntnnntnnrnnnissrnntiesinetssetssetnseenseeese P32 (SCK) VO (vo) 510 serial clock input/output P31 (TC4) ( ) Timer/Counter 4 input sss VO (Input 5 P30 (INT3/TC3) External interrupt input 3 or Timer/Counter 3 input P47 (CIN47KEY7), B-bit input/output port with latch. Comparator inputs or ae (Rev) pu When used as an input port, the latch " to P40 (KEYO) must be set to "1". Key scan inputs 8-bit PWM output or P55 (PWM / PDO) VO (Output) | ¢ bit inputoutput port with latch. & bit programmable divider output psa VO When used as an input port, a P58 (CIND 0 (CIN VO (Input) | output, the latch must be set to “1” Comparator inputs P67 (G8) to P60 (G15) a. Three 8-bit high breakdown voltage V/O | yet digit driver outputs P77(G0) to P70(G7) | VO(Output) | ports with the latch. When used as a VFT driver output, the latch must be cleared to"0”. P97 (515) to P90 (S8) VFT segment driver outputs Output Sbit high breakdown voltage output port with | (Key strobe outputs) P87 (S7) to P80 (50) (Outputy _| latch, When used, as VET driver output the latch Resonator connecting pins for high-frequency clock. XIN, XOUT Input, Output _| For inputting external clock, XIN is used and XOUT is opened. — Reset signal input or watchdog timer output/address-trap-reset output/system-clock- RESET vo stoutput. reset output. VDD, VSS +5V, OV(GND) Power Supply VT ariverpower supply 3-70-3

TOSHIBA TMP87CC70/H70/K70A/M70A 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 (ROM), the data memory (RAM), and the reset circuit. 1.1. Memory Address Map The TLCS-870 Series is capable of addressing 64K bytes of memory. Figure 1-1 shows the memory address maps of the 87CC70/H70/K70A/M70A. 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 first 128 bytes of the RAM address space. goat 64 bytes gost 64 bytes cose |_&4 bytes | apap |_S4 bytes : : 0040 0940 Register banks H 128bytes |: 128bytes |: 128bytes |: 128 bytes (8 registers x16 banks) OOBF OOBF OOBE | --seeeseeeeeeeeee] OOBF o0co o0co o0co o0co RAM: i i i Note i 384 bytes i 384 bytes : 364 bytes i 384 bytes | pom; Read Only Memory includes : i i : : Program memory i : : i RAM; — Random Access Memory includes : 023F 023F 023F 023F Data memory Pot mise ais ais = Stack fees ri, rit ~i~T > General-purpose register banks ¢ oF80 oF80 oF80 OF80 SFR; Special Function Register includes i i i VO ports DBR: 128bytes | : 128 bytes H 128 bytes 128 bytes Peripheral control registers [ i i i Peripheral status registers OFFF OFFF OFFF OFFF System control registers Ps His mis mis = Interrupt control registers 8000 : 7 root Tid T Program Status Word } A000 poof] Poi : DBR; — Data Buffer Register includes : : i i ae SIO data buffer | pB2st2bytes | Spasz0bytes: | 716128 bytes 000 HSO data buffer i i H 2032 byte: VFT display data buffer FOO eee] RROD fos] BOO froeeeeee|_ eg foes ROM: i H i : 192 bytes = 192 bytes 3 192 bytes = | > 192 bytes FFBE FFBE F ; FEO foo] Reo Pome EERE roe BEBE Yen ) Yer tra cauyareator FFE FFEO rr r interri rere | 32bytes | grep | 32 bytes re 32bytes | prep | 32 bytes J caee eet P| instructions 87CM70A 87CK70A 87CH70 87CC70 Figure 1-1. Memory Address Maps 3-70-4

TOSHIBA TMP87CC70/H70/K70A/M70A 1.2. Program Memory (ROM) The 87CC70 has a 12K x 8-bit (addresses DOOOW-FFFFH), the 87CH70 has a 16K x8-bit (addresses CO00}- FFFF), the 87CK70A has a 24K x8-bit (addresses AO00}-FFFF}Y), and the 87CM70A has a 32K x8-bit (address 8000}-FFFF}) of program memory (mask programmed ROM). Addresses FFOO4-FFFFY in the program memory can also be used for special purposes. (1) Interrupt /Reset vector table (addresses FFEO}-FFFF}) This table consists of a reset vector and 15 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 FFCO4-FFDF}) This table stores call vectors (subroutine entry address, 2 bytes/vector) for the vector call instructions [CALLV n]. 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}-FFFF}) for page call instructions This is the subroutine entry address area for the page call instructions [CALLP n]. Addresses FFOO- FFBFy are normally used because address FFCO}-FFFF} are used for the vector tables. Programs and fixed data are stored in the program memory. The instruction to be executed next is read from the address indicated by the current contents of the program counter (PC). There are relative jump and absolute jump instructions. The concepts of page or bank boundaries are not used in the program memory concerning any jump instruction. Address ROM Example: The relationship between the | 8000, contents jump instructions and the PC. {e209 000) © 5-bit PC-relative jump [JRS cc, $+2+d] i Example: me relationstip E8C4H: JRS T, $+2+08H -F00 andcallgroup When JF = 1, the jump is made to E8CEy, : instructions/Interrupt/ which is 084 added to the contents of the i Reset PC. (The PC contains the address of the ike aE instruction being executed+2;]} FFB | CALLP 7BH ; PC <—FF7By therefore, in this case, the PC contents | FrBF are E8C4y + 2 = E8C6y.) FFCO 56 CALLV OH ; PC C856y FFC1 | callvector(H) | C8 ® 8&-bit PC-relative jump [JR cc, $+2+d] FFC2 E8C4H: JR Z, $+2+80H When ZF = 1, the jump is made to E8464, i which is FF804 (-128) added to the | FFOF current contents of the PC. FFEO 68 INTS ; PC—D368, FFE1 [interrupt vector (H)| D3 ® 16-bit absolute jump UP al FFE2 E8C4H : JP 0C235H An unconditional jump is made to] FFFD address C235y. The absolute jump | FFFE 3E RESET + PC COBEy instruction can jump anywhere within | FFFF |_resetvector(H) | CO the entire 64K-byte space. " Figure 1-2. Program Memory Map In the TLCS-870 Series, the same instruction used to access the data memory (e. g. [LD A, (HL) ] ) is also used to read out fixed data (ROM 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-direction jump processing can easily be programmed. 3-70-5

TOSHIBA TMP87CC70/H70/K70A/M70A Example 1 : Loads the ROM contents at the address specified by the HL register pair contents into the accumulator (HL2 8000,,): LD A, (HL) ; ACROM (HL) Example 2 : Converts BCD to 7-segment code (common anode LED). When A = 05x, 92u is output to port P3 after executing the following program: ADD A, TABLE-$-4 j P3 ROM (TABLE +A) LD (P3), (PC-+A) ey IRS T, SNEXT TAG TABLE: DB OCOH, OFSH, OAGH, OBOH, 99H, 92H, 82H, OD8H, 80H, 98H eff §: SNEXT : ual oh Notes: °$” isa header address of ADD instruction. d Example 3 : N-way multiple jump in accordance with the contents of accumulator (0S AS 3): SHLC A 7 if A=004 then PC-C234, 78 Jp (PC+A) if A=01, then PC-C378,, if A=02y then PC-DA37y if A= 03, then PCe-E1B0}, BO Dw 0C234H, 0C378H, ODA37H, OE1BOH ———

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 user defined reset vector stored in the vector table (addresses FFFF} and FFFE}) is loaded into the PC ; therefore, program execution is possible from any desired address. For example, when COy and 3Ey are stored at addresses FFFFy and FFFEH, respectively, the execution starts from address CO3Ey 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 C123 is being executed, the PC contains C1254. MSB LSB wunwinwse76saz2ro — Pecontents Ka X att X_a+2 X_at3_ ) (a) Configuration (b)_ Timing chart of PC Contents and Instruction Execution Figure 1-3. Program Counter

1.4 Data Memory (RAM)

The 87CC70/H70/K70A/M70A each have 512 x8-bits (addresses 0040}-023F}) of data memory (static RAM). Figure 1-4 shows the data memory map. Addresses 0000}-O0FFy are used as a direct addressing area to enhance instructions which utilize this addressing mode; therefore, addresses 0040}-O0FFy in the data memory can also be used for user flags or user counters. General-purpose register banks (8 registers x 16 banks) are also assigned to the 128 bytes of addresses 0040},-O0BFyy. Access as data memory is still possible even when being used for registers. For example, when the contents of the data memory at address 0040y 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. The stack depth is limited only by the free data memory size. For more details on the stack, see section “1.7 Stack and Stack Pointer”. The 87CC70/H70/K70A/M70A cannot execute programs placed in the data memory. When the program counter indicates a data memory address, a bus error occurs and an address-trap-reset applies. The RESET. pin goes low during the address-trap-reset. 3-70-6

TOSHIBA TMP87CC70/H70/K70A/M70A Example1 : 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 (00C04) >= 0 then jump IRS T,SZERO cLR (00E3H) j (00E3,) 004 JRS TSNEXT SZERO: LD (00E3H), OFFH 7 (00E3y) — FFy SNEXT: Example 2 : Increments the contents of data memory at address O0F5y, and clears to 004 when 10y is exceeded: INC (OOFSH) i (OOF5}4) — (OOF5}) + 1 AND (OOFSH), OFH 3 (OOFSy) — (00F5y)A0F Hy The data memory contents become unstable when the power supply is turned on; therefore, the data memory should be initialized by an initialization routine. Note that the general-purpuse registers are mapped in the RAM ; therefore, do not clear RAM at the current bank addresses. Example : ClearsRAM to “00,” except the bank 0: lo HL, 0048H ; Sets start address to HL register pair LD AH ; Sets initial data (00,) to A register in) BC, O1F7H ; Sets number of byte to BC register pair SRAMCLR: LD (HL+), A DEC BC JRS F, SRAMCLR Address 0 1 2 3 4 5 6789 ABCODEF 00404 |. RegisterbankO | | Register bank 1 . 0050 | Registerbank2 _ Registerbank3 0060 _ -Registerbank4 | -Registerbank5 0070 _ Registerbank6 _ Registerbank7 | oeo oe “pegnerbenke * . i ‘egmerbank ~ swrduubsnidindunbstininebnbenniunntendwnntnntindind | pirget addressing area 0090 _ Registerbank 10, |. Registerbank 11, sono oo erbonk ‘ . we ‘eguterbonk . 7 . oos0 =| Registerbank14. | Registerbank 15. ooco Pb ob bo dopo? i poi i SR as Ge otto - ; ~ : : - be ~ ~ - techies 7 igure 1-4. Data Memory Map 3-70-7

TOSHIBA TMP87CC70/H70/K70A/M70A

1.5 General-purpose Register Banks

The general-purpose registers are mapped into addresses 0040}-00BFy in the data memory as shown in Figure 1-4. 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. = Il bank 15 (00B8 to 00BFi,) bank 14 (0080 to 00B7y) pamele : Bank 6 = bank 13 (00A8 to OOAFy) i wia bank 12 (00A0 to 0071) (een: (peer jscseneefnenees bank 4 (0060 to 00674) oe Dir bank 3 (0058 to 005F,)) (00451) (0044) sessed bank 2 (0050 to 0057) Hot HoGoL bank 1 (0048 to 004Fy) (0047) : (0046.4) bank 0 (0040 to 0047,,) (a) Configuration (b) Address assignments of registers Figure 1-5. General-purpose Register Banks 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 E contents, and stores the result into E. (2) HL, DE The HL and DE specify a memory address. The HL register pair functions as data pointer (HL) / index register (HL +d) / base register (HL + C), and the DE register pair function as a data pointer (DE). The 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. 2@ LD A, (HL+52H) ; Loads the memory contents at the address specified by the value obtained by adding 52} 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 HLinto A. Then increments HL. () LD A, (-HU) ; Decrements HL. Then loads the memory contents at the address specified by new HL into A. The 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. 3-70-8

TOSHIBA TMP87CC70/H70/K70A/M70A Example 2: Block transfer LD B,n-1 } Sets (number of bytes to transfer) - 1 toB LD HL, DSTA ; Sets destination address to HL LD DE, SRCA ; Sets source address to DE SLOOP: LD — (HL), (DE) 3 (HL) — (DE) INC HL >; HLeHL+1 INC DE ; DEHDE+1 DEC B ; BeB-1 JRS F, SLOOP ; IFB20then loop (3) B,C, BC Registers B and C can be used as 8-bit buffers or counters, 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 as a divisor register for the division instruction [DIV gg, c]. Example 1 : Repeat processing LD Bm ; Sets nas the number of repetitions to B SREPEAT: | processing (n + 1 times processing) DEC B JRS F, SREPEAT Example 2 : Unsigned integer division (16-bit + 8-bit) Div WA, C ; Divides the WA contents by the C contents, places the quotient in A and the remainderinW. The general-purpose register 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] and [POP PSW] to access the PSW. The PSW can be also operated by the memory access instruction. Example1 : Incrementing the RBS INC (003FH) ; RBS<RBS +1 Example2 : Reading the RBS LD A, (003FH) 3 A€PSW (A3.9 € RBS, A7.4¢-Flags) 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 PSW is automatically saved onto the stack. The bank used before the interrupt was accepted is restored automatically 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) .udfterrupt processing... RETI ; Maskable interrupt return (Bank restoring) 3-70-9

TOSHIBA TMP87CC70/H70/K70A/M70A

1.6 Program Status Word (PSW)

The program status word (PSW) consists of a register bank selector (RBS) and four flags, and the PSW is assigned to address 003Fy in the SFR. The RBS can be read and written using the memory access instruction (e. g. [LD A, (003FH)], [LD (003FH), A], 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 is set to “1”, but the other flags are not affected. [PUSH PSW] and [POP PSW] are the PSW access instructions.

1.6.1 Register Bank Selector (RBS)

The register bank selector (RBS) is a 4-bit register used to 76 5 4 3 2 7 1 - o 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

1.6.2 Flags

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 instruction [SET, CLR, and CPL], the ZF is set to “1” if the contents of the specified bit is “0”; otherwise the ZF is cleared to “0”. This flag is set to “1” when the upper 8 bits of the product are 004 during the multiplication instruction [MUL], and when 00} for the remainder during the division instruction [DIV]; otherwise it is cleared to “0”. (2) Carry flag (CF) The CF is set to “1” when a carry out of the MSB (most significant bit) of the result occurred during addition or when a borrow into the MSB of the result occurred during subtraction; otherwise the CF is cleared to “0”. During division, this flag is set to “1” when the divisor is 00} (divided by zero error), or when the quotient is 1004 or higher (quotient error); otherwise it is cleared. The CF is also affected during the shift/rotate instructions [SHLC, SHRC, ROLC, and RORC]. 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/complement are possible with the CF manipulation instructions. Example1 : Bit manipulation XOR CF, (009AH) . 0 LD (0001H) . 2, CF Example2 : Arithmetic right shift LD CF, A.7 RORC A (3) Half carry flag (HF) The HF is set to “1” when a carry occurred between bits 3 and 4 of the operation result during an 8- bit addition, or when a borrow occurred from bit 4 into bit 3 of the result during an 8-bit subtraction; otherwise the HF is cleared to “0”. This flag is useful in the decimal adjustment for BCD operations (adjustments using the [DAA r], or [DAS r] instructions). 3-70-10

TOSHIBA TMP87CC70/H70/K70A/M70A Example: BCD operation (The A becomes 47 after executing the following program when A = 19, B = 28) ADD AB ; ACAly, HFA 1,CF=0 DAA A ; AC@41y + 064 = 47, (decimal-adjust) (4) Jump status flag (JF) Zero or carry information is set to the JF after operation (e.g. INC, ADD, CMP, TEST). The JF provides the jump condition for conditional jump instructions [JRS T/F, $+2+d], [JR T/F, $+2+d] (T or Fis a condition code). Jump is performed if the JF is “1" for a true condition (T), or the JF is “0” for a false condition (F). The JF is set to “1” after executing the load/exchange/swap/nibble rotate/jump instruction, so that [URST, $ +2 +d] and [JRT, $ + 2 +d] can be regarded as an unconditional jump instruction. Example: Jump status flag and conditional jump instruction INC A JRS T, SLABLE1 ; Jump when a carry is caused by the immediately : preceding operation instruction. ra) A, (HL) JRS T, SLABLE2 ; JF is set to "1" by the immediately preceding i instruction, making it an unconditional jump instruction. Example: The accumulator and flags will become 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 “219A”, “00C5y", “D7”, "1" and “0”, respectively. Instruction - Instruction — ADDC A, (HL) 72 tioiaia INC OA 9B oo 1 0 suBB A, (HL) 2 tioitio ROLC A 35 ti 0:1:50 cMP A, (HL) 9A oioi1tio RORC A co oi: 0:00 AND A, (HL) 92 oloitio ADD WA, OFS08H 1602 1: 0:10 LD A, (HL) D7 tio:tio MUL Ww, A 13DA O:0:1:0 ADD A, 66H 00 tiaiaia SET AS BA rina 0

1.7 Stack and 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, the contents of the PC (the return address) is saved; on an interrupt acceptance, the contents of the PC and the PSW are saved (the PSW is pushed first, followed by PCy and PC). Therefore, a subroutine call occupies two bytes on the stack; an interrupt occupies three bytes. 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 PC, is popped first, followed by PC and PSW). The stack can be located anywhere within the data memory space except the register bank area, therefore the stack depth is limited only by the free data memory size. 3-70-11

TOSHIBA TMP87CC70/H70/K70A/M70A

1.7.2 Stack Pointer (SP)

The stack pointer (SP) is a 16-bit register containing the address of the next free locations on the stack. an Bwnw9e7654321 ° The SP is postdecremented when a subroutine call or a push instruction is executed, or when an interrupt is accepted; and ack Pointer (SP) the SP is preincremented when a return or a pop instruction is Figure 1-7. Stack Pointer executed. Figure 1-8 shows the stacking order. 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, 023FH ; SP-023Fy Example 2 : To read the SP LD HL, SP ; HLe-sP At acceptance of interrupt At execution of or At execution of aCALUCALLV/CALLP —_at execution of Atexecution of a RETURETN instruction a SWI instruction a RET instruction instruction wae ose wae nn ona 023D 023D) PC, 023D 023D] = PC, 023E] PCL <toun 0238] PCH PES 023E | PCL fe, 023E| PCy — Pop seescertsnne] Qu session poser] BO ecettrthenen O25) PCH Sp O28F | POW 028F PCH 0237 | PP 0040 stack depth Se before me] oy | t SPafter [0230 _] 023¢ 023F 023F (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, and a stand-by controller. Timing generator control register ii generator P9036, t Ct P| High-frequency |: Timing Oo to i i Stand-by controller a H clock oscillator Hl generator xouT “i: H oi i ae i x. —~ XTIN phy : System clocks fl i] PS O : Low-frequency ifs 0038, 00394 XTOUT : [rttestsresseseesseeseessersees? Clock generator control System control registers Figure 1-9. System Clock Controller 3-70-12

TOSHIBA TMP87CC70/H70/K70A/M70A

1.8.1 Clock Generator

The clock generator generates the basic clock which provides the system clocks supplied to the CPU core and on-chip peripheral hardware. It contains two oscillation circuits: one for the high-frequency clock and one for the low-frequency clock. Power consumption can be reduced by switching of the system clock controller to low-power operation based on the low-frequency clock. The high-frequency (fc) and low-frequency (fs) clocks can be easily obtained by connecting a resonator between the XIN/XOUT and XTIN/XTOUT pins, respectively. Clock input from an external oscillator is also possible. In this case, external clock is applied to the XIN/XTIN pin with the XOUT/XTOUT pin not connected. The 87CC70/H70/K70A/M70A are not provided an RC oscillation. Frmmmeaan===""= High-frequency clock “~~7-—=— TPF =========— Lowefrequency clock “~~7-—- =I XOUT XIN XOUT XTIN XTOUT XTIN XTOUT Oo; Ll; H (open); } (open) } ' hoot ' Ol it Ol ; i hoot i i (a) Crystal/Ceramic (b) External oscillator i : (©) Crystal (d) External oscillator : ' resonator too i tn TESONSO nn t= === === Figure 1-10. Examples of Resonator Connection Note: Accurate Adjustment of the Oscillation Frequency: Although no hardware to externally and directly monitor the basic clock pulse is not provided, the oscillation frequency can be adjusted by providing a 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. Example: To output the high-frequency oscillation frequency adjusting monitor pulse to P13 (DVO) pin. SFCCHK: LD (PICR), 00001000B ; Configures port P13 as an output SET (P1).3 i P13 output latch —1 output waveform LD (TBTCR), 11100000B ; Enables divider output | | | ] IRS T,$ ; Loops endless <— fy1024 ——:

1.8.2 Timing Generator

The timing generator generates from the basic clock 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 TC1 -TC4 © Generation of internal clocks for serial interfaces SIO and HSO @® Generation of source clocks for VFT driver circuit ® Generation of warm-up clocks for releasing STOP mode ® Generation of a clock for releasing reset output 3-70-13

TOSHIBA TMP87CC70/H70/K70A/M70A (2) Machine Cycle Instruction execution and on-chip peripheral hardware operation are synchronized with the main system clock. The minimum instruction execution unit is called an “machine cycle”. There are a total of 10 different types of instructions for the TLCS-870 Series: ranging from 1-cycle instructions which require one machine cycle for execution to 10-cycle instructions which require 10 machine cycles forexecution. A machine cycle consists of 4 states (SO - $3), and each state consists of one main system clock. Mfc or t/fs [s} (fm) f ' h ' i 1 1 state [so Tost sa sa Tso st sess] 0.5.8 atfc=8MHz 122 at fs = 32.768 kHz Figure 1-13. Machine Cycle

1.8.3 Stand-by Controller

The stand-by controller starts and stops the oscillation circuits for the high-frequency and low-frequency clocks, and switches the main system clock. There are two operating modes: single-clock and dual-clock. These modes are controlled by the system control registers (SYSCR1, SYSCR2). Figure 1-14 shows the operating mode transition diagram and Figure 1-15 shows the system control registers. Either the single-clock or the dual-clock mode can be selected by an option during reset. (1) Single-clock mode Only the oscillation circuit for the high-frequency clock is used, and P21 (XTIN) and P22 (XTOUT) pins are used as input/output ports. In the single-clock mode, the machine cycle time is 4/fc [s] (0.5 us at fc=8 MHz). @® NORMAL! mode In this mode, both the CPU core and on-chip peripherals operate using the high-frequency clock. In the case where the single-clock mode has been selected as an option, the 87CC70/H70/K70A/M70A are placed in this mode after reset. ® IDLE1 mode In this mode, the internal oscillation circuit remains active. The CPU and the watchdog timer are halted; however, on-chip peripherals remain active (operate using the high-frequency clock). IDLE1 mode is started by setting IDLE bit in the system control register 2 (SYSCR2), and IDLE1 mode is released to NORMAL1 mode by an interrupt request from the 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. 3-70-15

TOSHIBA TMP87CC70/H70/K70A/M70A @ STOP1 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 all output ports can be set to either output hold or high-impedance under software control. STOP1 mode is started by setting STOP bit in the system control register 1 (SYSCR1), and STOP1 mode is released by an input (either level-sensitive or edge-sensitive can be programmably selected) to the STOP pin. After the warming-up period is completed, the execution resumes with the next instruction which follows the STOP mode start instruction. (2) Dual-clock mode Both the high-frequency and low-frequency oscillation circuits are used in this mode. P21 (XTIN) and P22 (XTOUT) pins cannot be used as input/output ports. The main system clock is obtained from the high-frequency clock in NORMAL2 and IDLE2 modes, and is obtained from the low-frequency clock in SLOW and SLEEP modes. The machine cycle time is 4/fc [s] (0.5 us at fc = 8 MHz) in NORMAL2 and IDLE2 modes, and 4/fs [s] (122 ys at fs = 32.768 kHz) in SLOW and SLEEP modes. Note that the 87PM70 is placed in the single-clock mode during reset. To use the dual-clock mode, the low- frequency oscillator should be turned on by executing [SET (SYSCR2).XTEN] instruction. @® NORMAL2 mode In this mode, the CPU core is operated using the high-frequency clock. The on-chip peripherals are operated on the high-frequency clock and/or low-frequency clock. In case that the dual-clock mode has been selected as an option, the 87CC70/H70/K70A/M70A are placed in this mode after reset. @ SLOW mode This mode can be used to reduce power-consumption by turning off oscillation of the high- frequency clock. The CPU core and on-chip peripherals are operated using the low- frequency clock. Switching back and forth between NORMAL2 and SLOW modées is performed by the system control register 2. @ IDLE2 mode In this mode, the internal oscillation circuits remain active. The CPU and the watchdog timer are halted; however, on-chip peripherals operate using the high-frequency clock and/or the low-frequency clock. Starting and releasing of IDLE2 mode are the same as for IDLE1 mode, except that operation returns to NORMAL2 mode. @ SLEEP mode In this mode, the internal oscillation circuit of the low-frequency clock remains active. The CPU, the watchdog timer, and the internal oscillation circuit of the high- frequency clock are halted; however, on-chip peripherals operate using the low-frequency clock. Starting and releasing of SLEEP mode is the same as for IDLE1 mode, except that operation returns to SLOW mode. © STOP2 mode Asin STOP1 mode, all system operations are halted in this mode. 3-70-16

TOSHIBA TMP87CC70/H70/K70A/M70A reset release software software IDLET Cc NORMAL1 sToPt mode mode mode interrupt STOP pin input (a) Single-clock mode reset release software IDLE2 CF NORMAL2 tw mode mode oftware interrupt of ‘STOP pin - sTOP2 input ee mode SLEEP slow ae mode mode |.-°7” Software interrupt (b) Dual-clock mode Note: | NORMAL1 and NORMAL2 modes are generically called NORMAL; STOP1 and STOP2 are called STOP; and IDLE1, IDLE2 and SLEEP are called IDLE. On-chip | Machinecycle Operating mode CPU core High-frequency | Low-frequency Peripherals time 3 turning on g NORMAL oscillation turning off operate operate 4/fc [s] S |IDLe1 oscillation (Note 1) = halt oscillation ‘turning on s oscillation gnredeney | (High and/or Low) Mfc [s] 2 |iptez turning on (Note 1) . oscillation ‘s |stow Low-frequency | Low-frequenc 2 turning off ‘a y ats [s] SLEEP oscillation (Note 2) = halt turning off Note 1: The High-Speed Serial Output (HSO) and the Comparator inputs are halted in IDLE1/IDLE2 mode because CPU core is halted. Note2: The Vacuum Fluorescent Tube (VFT) driver circuit and the High Speed Serial Output (HSO) are halted. The Compartor inputs cannot be used in SLOWISLEEP mode. Figure 1-14. Operating Mode Transition Diagram 3-70-17

TOSHIBA TMP87CC70/H70/K70A/M70A System Control Register 1 7 6 5 4 3 2 10 0 : CPU core and peripherals remain active STOP | STOP modestart 1: CPU core and peripherals are halted (start STOP mode) retm _ | Release method 0 : Edge-sensitive release for STOP mode 1: Level-sensitive release Operating mode 0: Return to NORMAL mode RETM after STOP mode 1: Return to SLOW mode Rw ouren | Pert output control 0: High-impedance during STOP mode 1: Remain unchanged 00: 3x2"/fe or 3x2"/fs Is] Warming-up time at : 9 3 WUT | releasing STOP mode Or: 2N/ fc or 2 ifs 1*: Reserved Note 1: — Alwaysset RETM to “0” when transiting from NORMAL! mode to STOP1 mode and from NORMAL2 mode to STOP2 mode. Always set RETM to “1” when transiting from SLOW mode to STOP2 mode. Note2: When STOP mode is released with RESET pin input, a return is made to NORMAL mode regardless of the RETM contents. Note3: fc ; high-frequency clock [Hz] fs; low-frequency clock [Hz] * ; don't care Note4: — Bits 1 and 0 in SYSCR1 are read in as undefined data when a read instruction is executed. System Control Register 2 26 5 BO SYSCRZ fs : a sat (o039,) Lxew Loren [svserf ie] initial value: 10/100 #s*») xen [High-frequency oscillator] 0 : Turnoff oscillation control 1: Turn on oscillation xten | Low-frequency oscillator | 0 : Turn off oscillation control 1: Turn on oscillation Main system clock select ww jain system clock selec : : High-fr “lock sysck | (write)/main system clock] © High frequency cloc 1 : Low-frequency clock monitor (read) 0 : CPU and watchdog timer remain active IDLE | IDLE mode start : Note1: — Areset is applied (RESET pin output goes low) if both XEN and XTEN are cleared to “0”. Note2: — Donotclear XEN to “0” when SYSCK =0, and do not clear XTEN to “0” when SYSCK = 1. Note3: — WDT; watchdog timer, * ; don’t care Note4: Bits 3-0 in SYSCR2 are always read in as "1” when a read instruction is executed. Note5: — An optional initial value can be selected for XTEN. Always specify when ordering ES (engineering sample). operating mode after reset Single-clock mode (NORMAL1) Dual-clock mode (NORMAL2) Figure 1-15. System Control Registers 3-70-18

TOSHIBA TMP87CC70/H70/K70A/M70A

1.8.4 Operating Mode Control

(1) STOP mode (STOP1, STOP2) STOP mode is controlled by the system control register 1 (SYSCR1) and the STOP pin input. The STOP pin is also used both as a port P20 and an INT5 (external interrupt input 5) pin. 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 and port output latches are all held in the status in effect before STOP mode was entered. The port output can be 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 following the instruction which started STOP mode. 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 for long term battery back-up. When the STOP pin input is high, executing an instruction which starts the STOP mode will not place in the STOP mode but instead will immediately start the release sequence (warm-up). Thus, to start the STOP mode in the level-sensitive release mode, it is necessary for the program to first 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 (P2).0 ; Toreject noise, STOP mode does not start if JRS F, SINTS port P20is at high LD (SYSCR1), 010000008 ; Sets up the level-sensitive release mode. SET (SYSCR1).7 ; Starts STOP mode Low (IL), 1111011101010111B ;_IL11, 7, 5, 3-0 (clears interrupt latches) SINTS : RETI STOP pin \\ 7 Vin \\ H i i XOuTIn SCAT NORMAL i sToP 1 i NORMAL operation —™ * \\ operation AY Warm-up . operation Son tae STOP mode is released by the hardware. Always released if the STOP start STOP mode. pin inputis high Figure 1-16. Level-sensitive Release 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-70-19

TOSHIBA TMP87CC70/H70/K70A/M70A b. Edge-sensitive release 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 executed repeatedly 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), 000000008 ; OUTEN<-0 (specifies high-impedance) DI ; IMF«-0 (disables interrupt service) ‘SET (SYSCR1). STOP ; STOP (activates stop mode) LOW (IL), 1111011101010111B ;_ 1L11, 7, 5, 3-0 (clears interrupt latches) El ; IMFe-1 (enables interrupt service) + \\ H Vv STOP pin 1 \\ ig yn t ' H NORMAL f stop 1 \\ i TOP operation operation ore Warmup ro aL operation —_ operation STOP mode started Ns by the program. STOP mode is released by the hardware at the rising edge of STOP pin input. Figure 1-17. Edge-sensitive Release Mode STOP mode is released by the following sequence: @® When returning to NORMAL2, both the high-frequency and low-frequency clock oscillators are turned on ; when returning to SLOW mode, only the low-frequency clock oscillator is turned on. When returning to NORMAL 1, only the high-frequency clock oscillator is turned on. @® Awarming-up period is inserted to allow oscillation time to stabilize. During warm-up, all internal operations remain halted. Two different warming-up times can be selected with WUT ( bits 2 and 3 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 (e.g. [SET (SYSCR1). 7]). The start is made after the divider of the timing generator is cleared to “0”. Table 1-1. Warming-up Time example 3x2"/ fe [s] 375 [ms] 196.6 [ms] 3x2/fs [s] 750 [ms] 2" / fc 125 65.5 2 / fs 250 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-70-20

= iw, + , 5 : € oo 2 2 sl & 3 i Fe % -| 5 2] |s a s| 3 z 8g £ 5 ind ny ° g 3 2 z 3 2 3 ” 38 % & . g 5 2s = g z z y é 5 |S § Fi mn |e 5 2 zig | s ato] fp bobo toy a 5 g c = ° & 4 3 ® 3 N 2 2 +

TOSHIBA TMP87CC70/H70/K70A/M70A 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 the 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 (IDLE1, IDLE2, SLEEP) IDLE mode is controlled by the system control register 2 and maskable interrupts. The following status is VW maintained during IDLE mode. Starting IDLE mode @® Operation of the CPU and watchdog timer is halted. The on-chip peripherals continue to operate. @® The data memory, CPU registers and port output latches are all held in the status in Yes, Reset effect before IDLE mode was entered. @ The program counter holds the address of No (high) the instruction following the instruction which started IDLE mode. Example: Starting IDLE mode. (Normal ae) Yes SET (SYSCR2) . 4 ; IDLEC1 No IDLE mode includes a normal release mode and an <r interrupt release mode. Selection is made with the Yes (Interrupt release mode) interrupt master enable flag (IMF). Releasing the IDLE mode returns from IDLE1 to NORMAL1, from IDLE2 to NORMAL2, and from SLEEP to SLOW mode. Execution of the a. Normal release mode (IMF = “0") IDLE mode is released by any interrupt source instruction enabled by the individual interrupt enable flag (EF) or an external interrupt 0 (INTO pin) request. Vv Execution resumes with the instruction following - the IDLE mode start instruction (e.g. [SET Figure 1-19. IDLE Mode (SYSCR2).4]). 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 pin) 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. After reset, the 87CC70/H70/K70A/M70A are placed in NORMAL mode. Note: When a watchdog timer interrupt is generated immediately before IDLE mode is started, the watchdog timer interrupt will be processed but IDLE mode will not be started. 3-70-22

= 3 + 8 j---4--] o}. & z S S Fa ~ i + g “ o x oO 3 a a a s 2 2 o £ 3 g « 3 i E 2 £ = Ss — a Q bi 4 gs © ° a € s g o 5 «| 12 e 4 Fd t1 8 8 8 ” 2 5 & ol 18 g = a £ g w é 8 4 & 2 ; £ s 2 3 a apo a 3| = 3 ° 5 2 Fy 5 a < a 2 a a 3 & = $ 3 5 = 8 =e B4 eg} & = 9 8 iw! [2] [2 3 2 8 s 3 s 2 +! Jel 12 3 4 © ra ° o 4 4g ba 38

0 E § 4

aoe} Pp---p---4 5 ” 22 % a ° e 2g ‘3 3 E=| z f] 2 a} 3 2] 2 ¢ a s a s a : os e os 2 os Be, 25 8 Be, £8 8 ae, 28 $8 e, 28 s8 35 €, eg, 2388 85 2, e, 2$ 88 85 2. esx ES oe 23 Be esx ES oe 23 Bs esx ES ae 23 Bs 638 2593 8 BE Bo8 2393 BY BE eu8 2593 ZY BE Sa0 ef a8 £5 55 Seo ef a8 £5 55 Sas Ef a8 £5 55

TOSHIBA TMP87CC70/H70/K70A/M70A (3) SLOW mode SLOW mode is controlled by the system control register 2 and the timer/counter 2. a. Switching from NORMAL2 mode to SLOW mode First, set SYSCK (bit 5 in SYSCR2) to switch the main system clock to the low-frequency clock. Next, clear XEN (bit 7 in SYSCR2) to turn off high-frequency oscillation. Note : The high frequency clock can be continued oscillation in order to return to NORMAL2 mode from SLOW mode quickly. Always turn off oscillation of high frequency clock when switching from SLOW mode to STOP mode. When the low-frequency clock oscillation is unstable, wait until oscillation stabilizes before performing the above operations. The timer/counter 2 (TC2) can conveniently be used to confirm that low-frequency clock oscillation has stabilized. Example1 : Switching from NORMAL2 mode to SLOW mode. SET (SYSCR2).5 j SYSCK-1 (Switches the main system clock to the low-frequency clock) CLR (SYSCR2) .7 ; XENCO (turns off high-frequency oscillation) Example2: Switching to SLOW mode after low-frequency clock oscillation has stabilized. rh) (TC2CR), 14H ; SetsTC2 mode (timer mode, source clock : fs) Low (TREG2), 8000H ; Sets warming-up time (according to Xtal characteristics) rn) (TC2cR), 34H j Starts TC2 PINTTC2 : LD (TC2CR), 10H j Stops TC2 SET (SYSCR2).5 ; SYSCKA1 CLR (SYSCR2) .7 } XENCO RETI VINTTC2 : Dw PINTTC2 ; INTTC2 vector table 3-70-24

TOSHIBA TMP87CC70/H70/K70A/M70A b. Switching from SLOW mode to NORMAL2 mode First, set XEN (bit 7 in SYSCR2) to turn on the high-frequency oscillation. When time for stabilization (warm-up) has been taken by the timer/counter 2 (TC2), clear SYSCK (bit 5 in SYSCR2) to switch the main system clock to the high-frequency clock. SLOW mode can also be released by setting the RESET pin low, which immediately performs the reset operation. After reset, the 87CC70/H70/K70A/M70A are placed in NORMAL mode. Note1: After the SYSCK is cleared to “0”, the CPU core operate using low frequency clock when the main system clock is switching from low frequency clock to high frequency clock. Note2: SLOW mode can also be released by setting the RESET pin low, which immediately performs the reset operation. After reset, the 87CC70/H70/K70A/M70A are placed in NORMAL2 mode. (The PM70 is placed in NORMAL1 mode) Example: Switching from SLOW mode to NORMAL2 mode (fc = 8 MHz, warming-up time is about 7.9 ms). SET (SYSCR2) .7 ; XEN@1 (turns on high-frequency oscillation) LD (TC2CR), 10H ; Sets TC2 mode (timer mode, source clock: fc) ra) (TREG2 +1), OF8H — ; Sets the warming-up time (according to frequency and resonator characteristics) LD (TC2CR), 30H ; Starts TC2 PINTTC2 : LD (TC2CR), 10H j Stops TC2 CLR (SYSCR2).5 ; SYSCKAO (Switches the main system clock to the high-frequency clcok) RETI VINTTC2 : Dw PINTTC2 ; INTTC2 vector table 3-70-25

g = = p] £ é = = C2 36 2 = = CX) zo € 2 = = oe 3 ie] = =a oe ee eee y a = SJ a i = | i = = i = = = = = = = = ' = = ' = = H = & -j ' FS ;.U = H = 8 = = 2 = ! = S Es H = 3 =| ! = a = ! F4 Bo] = 1 = o i =" = aod E44 Hi = 81 4 = iw = =| 3 = i og = a] z Ee 2 ££ | § = 2 = 2 = £ 3 = 2| 6 = € 3 = S| 2 = 2 a = a = be 2 g = pa 2l ca = e| 2 3% = el $ oe] ¢c =| S| 3 = fs] 2 = Ra £ & = Ral P pal =| 5 2 = = 0 Hi 3 = jo Ss 3 2 = H = a = ' = -| £ = i os = S| = = i o£ = S = ' = Ps = 1 = 5 = ! = a = H = a = ' = e = ' = FI = 1 = 2 = i = ic = i = = ' = = i F4 | ' = = H = = 1 = = i = = Pe = = a) = = al! = = 2} = = S| = = Sy = 5 = oS) Z a = Blt <-4L 1 --}---hey-4 Gf ---T- = =f eee 2) ty = = Ba] 2) 3 = = < ir E an = Ze “ F3 5 68 > > 5 > cs 8 gz 3 $5 2E zg 2 gs a Ss & oe 8 § -£ y 2 geygexesxy 3 2 33 eaysayesy 9 2 82 Oe8 8BR8 a Be O58 8 ans Fe g rEssSEssse BX 25 rESsesses 2X 2s

TOSHIBA TMP87CC70/H70/K70A/M70A

1.9 Interrupt Controller

The 87CC70/H70/K70A/M70A each have a total of 14 interrupt sources: 5 externals and 9 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-22 shows the interrupt controller. Table 1-2. Interrupt Sources . Interrupt Vector Table ; Interrupt Source Enable Condition Latch ‘Address | Priority a a ae Pex [aro Gewrainerpeo) ———[faicwvoei=r [as | ee, | | ial [Tine bwTinwion [owes [us| me Finer [nied reaineron) _|wrersr | ty | ts | | Pineal [wre eoiresinens) [ast | hw | Hem | 10] eC Fiera [ noes oyinerand —owretaet [te | rem [| Pineal [wre cereanerapy ————[tetact [tw | ory | ve] (1) Interrupt Latches (IL 15 to 2) 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 003Cy 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 the 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 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 LOW (IL), 1110100000111111B jILy2, IL4q to ILge-O 3-70-27

@ « 3 a8 3 z 8 g 32 be 3 2 $3 2g Beye 32g 8 FF > g gf 5% Sef FEES § 2 bs sage 5 eg SPRas “=: 2 € > ee a a ee te ee 2 Ch rare £13 £ A o| 0 a SS els a A A ee 2 ee 2 aS z oa A A 8 OD x cere ss eels re A ° Cee eee] Ss nD Core) 212 ra cee S| ov cr] |e = So lo [fo flo [fo Ifo fo flo fo fo [fo Jo [eo [fo = 2222222] 2022 4 2 2] 2 fs] YOU AA Gl] Gl] olla ay] Gl] Gil GU ai al] @ xs {E FUE EE MEME ME Ee ee | I 2 |2 0) CReReRRR Re ele ele 232 : g LI ly ey ey ey ey tee ges * q IR g SS SS A SS A SS SL DL ey Cee © iz SS eS SO SO OS | & a SS SO SO 3 Cn 2 Ss SO Os 5 a SS OS OO % Coy rrr dt 2 a 2 a Oe a 2 ee | = z = Ci Se Se Sy z 28 es Fa g a5 a5 as 2 Oz 35 35 35 gs bt Pett So «lee a ES ES SS RU 9 d 9 gs A\\ A\\ A A A\\ Oo a] Oo oO oO

TOSHIBA TMP87CC70/H70/K70A/M70A Example 2 : Reads interrupt latches LD WA, (IL) ; Welly, ACL Example 3: Tests an interrupt latch TEST (IL).7 ; if lLy=1 then jump JR F, SSET (2) Interrupt Enable Register (EIR) The interrupt enable register (EIR) enables and disables 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. For example, the watchdog timer interrupt is not accepted during the software interrupt service. The EIR consists of an interrupt master enable flag (IMF) and the individual interrupt enable flags (EF). This register is 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, except for pseudo non-maskable 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 been 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 the 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. The IMF is normally set and cleared by the [El] and [D1] instructions, and the IMF is initialized to “0” during reset. Note: Donotset IMF to “1”during non-maskable interrupt service programs. ® 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”. Low (EIR), 1110100010100001B;_— EFys to EF3, EFy1, EFz, EFs, IMFe-1 Example 2 : Sets an individual interrupt enable flag to “1”. SET (EIRH).4 i EFi2e1 15 14 13 12 MW 10 9 8 7 6 5 4 3 2 1 0 jooae!¥oa0,) eo Eee ILy (003D,)) TL, (003Cy) (Initial Value : 00000000 000000) EIRy (003By) EIR, (003Ay) (Initial Value : 00000000 0000+*0) Note1: — Donotuse any read-modify-write instruction such as bit manipulation clearing IL. Note2 : Do not clear IL2 to “0” by an instruction. Note3 : Do not set IMF to “1” during non-maskable interrupt service program. Figure 1-23. Interrupt Latch (IL) and Interrupt Enable Register (EIR) 3-70-29

TOSHIBA TMP87CC70/H70/K70A/M70A

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 (4 us @ fc = 8 MHz in the NORMAL mode) 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] (for pseudo non-maskable interrupts). 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 to “0”. ®@ The contents of the program counter (return address) and the program status word are saved (pushed) on the stack. @® The entry address of the interrupt service program is read from the vector table, 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 etic set Coton =e ames a ee Interrupt} H ! ! signal H i i H om t T T wt i ! H leeecuton, Ca ee YEE X oT Pc e-XeXet Xe XK Ket Xoe Koa HM VMK ce? Xa Kae Xerd Note1: a; return address, b ; entry address, c ; address which the RET! instruction is stored Note2: The maximum response time from when an IL is set until an interrupt acceptance processing starts is 2ifm to 38/fm [s] (fm = fc or fs). Figure 1-24. 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 wr, [OR 20a, [aR FFF3y Day D204, | 064 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. When 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 of the INTO pin must be disabled with the INTOEN in the external interrupt control register (EINTCR) or interrupt processing must be avoided by the program. 3-70-30

TOSHIBA TMP87CC70/H70/K70A/M70A Example 1 : Disables an external interrupt 0 using INTOEN LD (EINTCR), 00000000B ; INTOENe-O Example 2 : Disables the processing of external interrupt 0 under the software control (using bit 0 at address OOFO as the interrupt processing disable switch) PINTO: TEST (00FOH) .0 ; Return without interrupt processing if (00FO}4)o = 1 JRS T, SINTO RETI SINTO : rinterrupt processing, : RETI VINTO : Dw PINTO 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: The 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) j Switches to bank n (1 4s @8 MHz) RETI ; Restores bank and Returns main task main task acceptance of interrupt acceptance of interrupt bankm interrupt service task interrupt service task a Se y ¥ IW WK Switch to bank n by \\K saving [LD RBS, n] or N registers time [INC (GRBS) } P instruction | | + erruptretur Restore bank 4 m interrupt return automatically by \\ \\\\ restoring [RETI] /[RETN] N registers interrupt return (a) Saving/Restoring by register bank changeover (b) Saving/Restoring using push/pop or data transfer instructions Figure 1-25. Saving/Restoring General-purpose Registers ® 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. 3-70-31

TOSHIBA TMP87CC70/H70/K70A/M70A Example: Register save using push and pop instructions PINTxx : PUSH WA ; Save WA register pair POP WA ; Restore WA register pair RETI ; Return ee eesseeeeeeessnee sesseeneeeeee sessssssseesese| Address (example) sp —| 023Ay A 023B sp loon ee sp foe premene e PC, PC, PC, 023D PCy PCy PCy 023E PSW PSW PSW sP 023F At acceptance At execution At execution At execution of an of an interrupt > of apush > of apop => interrupt return instruction instruction instruction ® General-purpose registers save/restore using data transfer instructions: Data transfer instructions can be used to save only a specific general-purpose register during processing of a single interrupt. Example: Saving/restoring a register using data transfer instructions PINTxx : LD (GSAVA), A ; Save A register LD A, (GSAVA) ; Restore A register RETI ; Return from interrupt service The interrupt return instructions [RETI] / [RETN] perform the following operations. [RETI] Maskable interrupt return [RETN] Non-maskable interrupt return ® The contents of the program counter and the |@ The contents of the program counter and program status word are restored from the program status word are restored from the stack. stack. @ The stack pointer is incremented 3 times. @ The stack pointer is incremented 3 times. @ The interrupt master enable flag is set to "1". @ The interrupt master enable flag is set to “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 task is performed but not the main task. 3-70-32

TOSHIBA TMP87CC70/H70/K70A/M70A

1.9.2 External Interrupts

The 87CC70/H70/K70A/M70A each have five external interrupt inputs (INTO, INT1, INT2, INT3, and INT5). Three 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 and INT3. 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 (EINTCR). When INTOEN =0, the IL3 will not be set even if the falling edge of INTO pin input is detected. Table 1-3. External Interrupts | wro [into | p10 | sm=1, InToEN=1 | fallingedge — (hysteresis input) Pulses of less than 15/fc or 63/fc [s] ; are eliminated as noise. Pulse equal INTt INTT pil IMF EFs=1 fallingedge | to or more than 48/fc [s] or 192/f¢ [s] or are regarded as signals. rising edge INT2 INT2 Pa2Tci IMF*EF7=1 eliminated as noise Pulse equal to psorres | IMF-EF y= Steregarded oasignaly. YA INTS INTS P20/STOP IMF EFis=1 falling edge — (hysteresis input) Note 1: The noise rejection function is turned off in SLOW and SLEEP modes. Also, the noise reject times are not constant for pulses input while transiting between operating modes (NORMAL2SLOW) Note 2: The noise rejection function is also affected for timer/counter input (TC1 and TC3 pins). Note 3: The pulse width (both “H” and “L” level) for input to the INTO and INT5 pins must be over 1 machine cycle. INTO/INTS input | ‘inti, tintH > teye |(Note : tcyc= 4/fm|[s]) : tint ‘tinTH Note 4: If a noiseless signal is input to the external interrupt pin in the NORMAL 1/2 or IDLE 1/2 mode, the maximum time from the edge of input signal until the IL is set is as follows : ® INT1 pin 49/fc [s] (INTINC=1), 193/fc [s] (INTINC=0) @ INT2,INT3 pins 25/fc [s] Note 5: When INTOEN =0, interrupt latch IL3 is not set even if a falling edge is detected for INTO pin input. Note 6: When high-impedance is specified for port output in stop mode, port input is forcibly to low level internally. Thus, interrupt latches of external interrupt inputs except INT5 (P20/STOP) which are also used as ports may be set to "1". To specify high-impedance for port output in stop mode, first disable interrupt service (IMF =0) , activate stop mode. After releasing stop mode, clear interrupt latches using load instruction, then, enable interrupt service. Example : Activating stop mode. in) (SYSCR1) ,01000000B ; OUTEN+O (specifies high-impedance) DL ; IMF«0 (disables interrupt service) set (SYSCR1) .STOP 3 STOPe1 (activates stop mode) Low (IL),11110111010101118 ;_ IL11,7,5,3+0 (clears interrupt latches) EI ; IMFe1 (enables interrupt service) 3-70-33

TOSHIBA TMP87CC70/H70/K70A/M70A 7 6 5 4 3 2 1 0 (o0s7,) 1 (Initial value: 00*0 000+) . . 0 : Pulses of less than 63/fc [s] are eliminated as noise ANTO vi on nati 0 : P10 input/output port INT3 ES. - uy INT2ES | INT3 to INT1 edge select 0 : Rising edge INT1 ES 1: Falling edge Note1: fe ; High-frequency clock[Hz] * ; don’t care Note2: — Edge detection during switching edge selection is invalid. Note3: Do not change EINTCR when IMF =1. After changing EINTCR, interrupt latches of external interrupt inputs must be cleared to “0” using load instruction. Note4: — Inorder to change of external interrupt input by rewriting the contents of INT2ES, INT3ES and INT4ES during NORMAL1/2 mode, clear interrupt latches of external interrupt inputs (INT2, INT3 and INTA) after 8 machine cycles from the time of rewriting. During SLOW mode, 3 machine cycles are required. Note5: — Inorder to change an edge of timer counter input by rewriting the contents of INT2ES, INT3ES and INT4ES during NORMAL1/2 mode, rewrite the contents after timer counter is stopped (TC*s = 0), that is, interrupt disable state. Then, clear interrupt laches of external interrupt inputs (INT2, INT3 and INTA) after 8 machine cycles from the time of rewriting to change to interrupt enable state. Finally, start timer counter. During SLOW mode, 3 machine cycles are required. Example: When changing TC1 pin inputs edge in external trigger timer mode from rising edge to falling edge. (example: TMP87CHOON) LD (TC1CR),01001000B =; TC1S <-00 (stop TC1) DI i; IMF <0 (disable interrupt service) LD (EINTCR),00000100B ; INT2ES <1 (change edge selection) —F__ nor 8 machine to cycles. = NOP Lp (ILL) ,01111111B ; IL7 <0 (clear interrupt latch) EI } IMF © 1 (enable interrupt service) LD (TCICR),01111000B =; TC1S<11(start TC1) Note6: — If changing the contents of INT1ES during NORMAL1/2 mode, interrupt latch of external interrupt input INT1 must be cleared after 14 machine cycles (when INT1NC = 1) or 50 machine cycles (when INT1NC =0) from the time of changing. During SLOW mode, 3 machine cycles are required. Figure 1-26. External Interrupt Control Register

1.9.3 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. Thus, the [SWI] instruction behaves like the [NOP] instruction. 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. the address trap reset is generated in case that an instruction is fetched from RAM or SFR areas. Note: The fetch data from addresses 7F80} to 7FFFy (test ROM area) for 87CK70A/M70A, BF80}, to BFFF} for 87CC70/H70 is not “FFy”. 3-70-34

TOSHIBA TMP87CC70/H70/K70A/M70A ® Debugging Debugging efficiency can be increased by placing the SWI instruction at the software break point setting address.

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 as a reset output or a non- maskable interrupt request. However, selection is possible only once after reset. At first, the reset output is selected. 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. 1.10.1__Watchdog Timer Configuration MPX reset release signal from T.G. fc/2? or fs/2'° ——>|A Binary Counters fc/ 2" or fs/2 ——>|B clock overflow reset fc/2or f5/2" ——>|C._ Y [> WOT output output fe/ 2" or f5/29 ——| °. clear [| ) >) reset

5 A pos interrupt request, iywp7

Q S_R f writing writing clear WDTOUT WoTT r | disable code_ |code oma was] | Watchdog Timer Control Registers Figure 1-27. Watchdog Timer Configuration

1.10.2 Watchdog Timer Control

Figure 1-28 shows the watchdog timer control registers (WDTCR1, WDTCR2). 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 a CPU malfunction occurs for any cause, the watchdog timer output will become active on the rise 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 low to reset the internal hardware and the external circuits. When WDTOUT =0, a watchdog timer interrupt (INTWDT) is generated. The watchdog timer temporarily stops counting in STOP mode (including warm-up) or IDLE mode, and automatically restarts (continues counting) when STOP/IDLE mode is released. 3-70-35

TOSHIBA TMP87CC70/H70/K70A/M70A Example: Sets the watchdog timer detection time to 221/fc [s] and resets the CPU malfunction. LD (WDTCR2), 4EH j Clears the binary counters LD (WDTCRI1), 000011018; WDTT<-10, WDTOUTe1 LD (WDTCR2), 4EH ; Clears the binary counters Within WOT : (always clear immediately after changing WDTT) detection time : LD (WDTCR2), 4EH ; Clears the binary counters Within WOT : detection time i ra) (WDTCR2), 4EH ; Clears the binary counters Watchdog Timer Control Register 1 7 6 5 4 3 2 1 0 woten | Watchdog timer 0 : Disable (itis necessary to write the disable code to WOTCR2) enable/disable 1: Enable 00:2%/fe or 2'/fs Is] . Watchdog timer 01:27 /fe or 2'°/fs write WDTT | detection time 1O:2/fe or 27 ts only 11:2%/fc or 2"/fs worour | Watchdog timer 0: Interrupt request output select 1: Reset output Note 1 : WDTOUT cannot be set to “1” by program after clearing WOTOUT to "0". Note2: fc ; High-frequency clock [Hz] fs ; Low-frequency clock [Hz] * ; don’t care Note3 : WDTCR1 isa write-only register and must not be used with any of the read-modify-write instructions. Note4 : 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 t) . 4E, : Watchdog timer binary counter clear (clear code) | write Watchdog timer control : 4 WDTECR2 | code write register B1y : Watchdog timer disable (disable code) only others : Invalid Note! : The disable code is invalid unless written when WDTEN =0. Note2 : *;don’tcare Figure 1-28. Watchdog Timer Control Registers Table 1-4. Watchdog Timer Detection Time 2 1fe [s]_ | 2 / fe, 2" / fs 21s, 4.194 s 4s 23 /fc 23 / fe, 2°/ 5 28/45 1.048 s 1s 2" /fc 2/ fe, 2°/ fs — 262.1 ms 250 ms 2° /fc 2°/ fc, 2"/ fs — 65.5 ms 62.5 ms 3-70-36

TOSHIBA TMP87CC70/H70/K70A/M70A (2) Watchdog Timer Enable The watchdog timer is enabled by setting WDTEN (bit 3 in WDTCR1) to “1”. WDTEN is initialized to “1" during reset, so the watchdog timer operates immediately after reset is released. Example : Enables watchdog timer LD (WDTCR1), 000010008 ; WDTEN@1 (3) Watchdog Timer Disable The watchdog timer is disabled by writing the disable code (B1})) 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". The watchdog timer is halted temporarily in STOP mode (including warm-up) and IDLE mode, and restarts automaticallyafter STOP or IDLE mode is released. During disabling the watchdog timer, the binary counters are cleared. Example : Disables watchdog timer LOW (WDTCR1), 0B101H ; WDTEN€0, WDTCR2€disable code

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, 023FH ; Sets the stack pointer LD (WDTCR1) , 000010008 ; WDTOUT@O

1.10.4 Watchdog Timer Reset

If the watchdog timer output becomes active, a reset is generated, which drives the RESET pin (sink open drain output) low to reset the internal hardware and the external circuits. The reset output time is 220/fc [s] (131 ms at fc = 8 MHz). The high-frequency clock oscillator also turns on when a watchdog timer reset is generated in SLOW mode. : 2c [s] oo Bc i ——— Clock 7 Td TT l J l | l (wort = 115) Binary counter 1 Xo Xt X 2 X38 Xo Overflow i INTWOT interrupt : writes 4E,, to WDTCR2 Figure 1-29. Watchdog Timer Interrupt / Reset 3-70-37

TOSHIBA TMP87CC70/H70/K70A/M70A

1.11 Reset Circuit

The 87CC70/H70/K70A/M70A 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-5 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 (220/fc [s] (131 ms at 8 MHz) when power is turned on. Table 1-5. Initializing Internal Status by Reset Action Register bank selector (RBS) 0 a circuitry Interrupt individual enable flags (EF) t) Refertocachof Interrupt latches a) 0 Control registers control register

1.11.1 External Reset Input

When the RESET pin is held at low for at least 3 machine cycles (12/fc [s]) with the power supply voltage a within the operating voltage range and oscillation vod 1 gveD stable, a reset is applied and the internal state is ' typ. 220 ka initialized. RESET When the RESET pin input goes high, the reset * H operation is released and the program execution starts - tot at the vector address stored at addresses FFFE} - FFFFy. The RESET pin contains a Schmitt trigger (hysteresis) Figure 1-30. Simple Power-on- with an internal pull-up resistor. A simple power-on- Reset Circuitry reset can be applied by connecting an external capacitor and a diode.

1.11.2 Address Trap Reset

If a CPU malfunction occurs and an attempt is made to fetch an instruction from the RAM or the SFR area (addresses 0000}, - 023F})), an address-trap-reset will be generated. Then, the RESET pin output will go low. The reset time is 220/fc [s] (131 ms @ 8 MHz). Instruction {reset release Xinstructionatadsress | execution 1 H _— oe _) Address-trap is occurred ne ee RESET output ("L" output) (Hie)! H a | i t rl t Pfc [s] {2c | 2c Hi to Note1: 05a5023Fy Note2: During reset release, reset vector “r” is read out, and an instruction at address r is fetched and decoded. Figure 1-31. Address-Trap-Reset 3-70-38

TOSHIBA TMP87CC70/H70/K70A/M70A

1.11.3 Watchdog Timer Reset

Refer to Section “1.10 Watchdog Timer”.

1.11.4 System-Clock-Reset

Clearing both XEN and XTEN (bits 7 and 6 in SYSCR2) to “0” stops both high-frequency and low- frequency oscillation, and causes the MCU to deadlock. This can be prevented by automatically generating a reset signal whenever XEN = XTEN =0 is detected to continue the oscillation. Then, the RESET pin output goes low from high-impedance. The reset time is 220/fc [s] (131 ms at 8 MHz). 3-70-39

TOSHIBA TMP87CC70/H70/K70A/M70A 2. ON-CHIP PERIPHERALS FUNCTIONS

2.1 Special Function Registers (SFR) and Data Buffer Registers (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} - 003Fy, and the DBR to addresses OF80} — OFFFH. Figure 2-1 shows the 87CC70/H70/K70A/M70A SFRs and DBRs. Address Read Write Address Read Write OT Yo eeessssesseeeeeeee PE PORE en , 2D Yee Teccccessesseneneene tt SIOGR? oo ccceeeeceecseeeessneeeee 2 anne secon , 22 Poon cccccenceseeeeeseennnseenes sf @SOUEG oe ccccsnessnnesnsnnnnnnney OB Yee esesessenesseeeesee PS POM csssssnnssnneeseeeeeeeesnseeessen DBL ccssocsseeecceeeeeersereeeeese A @SOVEG. oo cccsceeessensssnessnnnnnnneey

04 Peer ee OE EY OR cc ceeaeesey 24 |HSOSR(HSOstatus) JHSOCR USO control)

5 face ececcsseeccene eee OME cc eeeeennnensesenteeennienseenne| D5 Dc ceccesssneeccnsneeseesens ef OSOMED. ccc eeeeceneneecannnenecess

06 P6 Port 26 ‘reserved

07 : P7 Port 27 : ‘reserved . | 08 - Peron... 28 7 = assed METCRY (VFT control) 09 Yoereeeeccttesssssssseneneeeeeseen PO POM cscsusoosnneseetteensensseeessns 29 /VETSR (VET status) os cssseeseee| MTOR csecsseseeseccsnnsnsssseeee OA Panne cceseeeee ToneeeessaneneersesfPOCR (PO MO Cont!) 2A |KEYSR (Key scam status) dsc ccsceeesnsTeeeemennnneeeeeses OB fan cescceeee Tonceeeeennneseeenee PIER (PTUO Conttol) 2B Yc ccccecceeeeccetennneeeee A @SOIOG cscaseeemnnenteeeennns OC Poon cceessseeeeseeen Tierra rensesen CR a COE sss ZO Pon ccccssssseseeceeseenneseesnss f@SOMOccsnsssnnnsnsnnnnnnnea OD Yannceeeccccceesessssssseeeeseee GSMO ccocceeseeseeeettteneee 2D Yc cccccssssstesesseceeesensesessst@SCIVEG os cccsseemreneeseecsensnssnneeee CE eeeeeeeeeeccrel MPCR Comparator neat cone CS AL roe OF ‘CMPDR (Comparator input data register). 2F reserved 10 = TREGI, 30 . reserved 1 [agen imerreaseer) gy [rere ened TB Jaaccssssosseseeeeesenessnnsssnsn ns eSEMES cccseeteeen seceee , BB Parcssssssesceseeceesesensmsssssns TOSSED, scssecssseeimnnsnnnsansanesseeees Vcc cccccsese Teceeeeteeenesnnnnssef ESTER (TCA contro) BO Yo cccceeccsee Tosnssneeeseesseesenef WOTERY, in| 16 | EET 36 fo = oo |TBTER(TBT/TS /DVO control) | 18 : TREG3A (Timer register 3A) 38 “SYSCRI 19 | TREG3B (Timer register 38) : = 39 : syscra,,..,Sustem contro 1A = |TC3CR (TC3 control) 3A : EIR, . 1c aS ITC4CR (TCA control). 3c 1 1E reserved 3E : ‘reserved. 1F reserved 3F [PsW/(Program status word RBS (Register bank selector) (a) Special Function Registers Address Read Write OFBOW J coseeeconesenee Note? : Do not access reserved areas by the program. ver Note2: - : Cannot be accessed. Display data buffer Note3 : When defining address 003Fy with assembler symbols, use GPSW and GRBS. . Note4 : Write-only registers and interrupt OFOF latches cannot use the read-modify- reserved write instructions (bit manipulation i ne sevseeeenneteee instructions such as SET, CLR, etc. and FL cee sevsseennneeeee logical operation instructions such as F2 pee gig eesnenencensenses AND, OR, etc.) I. soos Trangmitand receive sesesneeeeees Note5 : KEYDRisa read-only register. FA nnn gata utter so F6 . orrg[ = dS transmitdatabutfer | reserved OFFF H (b) Data Buffer Registers Figure 2-1. SFR & DBR 3-70-40

TOSHIBA TMP87CC70/H70/K70A/M70A

2.2 W/O Ports

The 87CC70/H70/K70A/M70A each have 10 parallel input/output ports (73pins) each as follows: J] reenainaon [Senne [porto | sbitvoport | Port P2 3-bit I/O port Low-frequency resonator connections, external interrupt input, and STOP mode release signal input Ports P1, P2, P3, P4, P5, P6, P7, P8 and P9 can also use secondary function. Each output port contains a latch, which holds the output data. Input ports excluding P4 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 changes in the S2 state of the write cycle during execution of the instruction which writes to an I/O port. fetchcycle fetchcycle read cycle fetchcycle fetchcycle write cycle Instruction ___S0 0 0 — Instruction--S0 0 0 --- cycle-~ ao cycle-~ --- 7 pulse (a) Input Timing (b) Output Timing Note: The positions of the read and 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 PO and P1, 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 r, (sre) ® LD (pp) . b, CF @ CLRISET/CPL (src).b © ADD/ADDC/SUB/SUBB/AND/OR/XOR (src), n @ CLRI/SET/CPL (pp).g @ (src) side of ADD/ADDC/SUB/SUBB/AND/OR/XOR (src), (HL) @ iw (src).b, CF (2) Instructions that read the pin input data ® Instructions other than the above (1) @ (HL) side of ADD/ADDC/SUB/SUBB/AND/OR/XOR (src), (HL) 3-70-41

TOSHIBA TMP87CC70/H70/K70A/M70A

2.2.1 Port PO (P07 - POO)

Port PO is an 8-bit general-purpose input/output port which can be configured as either an input or an output in one-bit unit under software control. Input/output mode is specified by the corresponding bit in the port PO input/output control register (POCR). Port PO is configured as an input if its corresponding POCR bit is cleared to “0”, and as an output if its corresponding POCR bit is set to “1”. During reset, POCR is initialized to “0”, which configures port PO as input. The PO output latches are also initialized to “0”. Data is written into the output latch regardless of POCR contents. Therefore initial output data should be written into the output latch before setting POCR. 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. STOP o our =D POCRI sand data output B <] <4 output latch Note : i=7t00 7 6 5 4 3 2 1 0 {0000.9 (initia value = 0000 0000) 7 6 5 4 3 2 1 0 0: input mode write Figure 2-3. Port PO and POCR Example: Setting the upper 4 bits of port PO as an input port and the lower 4 bits as an output port (Initial output data are 10103). LD (PO), 00001010B } Sets initial data to PO output latches LD (POCR),00001111B —; Sets the port PO input/output mode

2.2.2 Port P1 (P17 - P10)

Port P1 is an 8-bit input/output port which can be configured as an input or an output in one-bit unit under software control. Input/output mode is specified by the corresponding bit in the port P1 input/output control register (P1CR). Port P1 is configured as an input if its corresponding P1CR bit is cleared to “0”, and as an output if its corresponding P1CR bit is set to “1”. During reset, P1CR is initialized to “0”, which configures port P1 as an input . The P1 output latches are also initialized to “0”. Data is written into the output latch regardless of P1CR contents. Therfore initial output data should be written into the output latch before setting P1CR. Port P1 is also used as an external interrupt input, a timer/counter input, and a divider output. When used as a secondary function pin, the input pins should be set to the input mode, and the output pins should be set to the output mode and beforehand the output latch should be set to “1”. It is recommended that pins P11 and P12 should be used as external interrupt inputs, timer/counter input, or input ports. The interrupt latch is set on the rising or falling edge of the output when used as output ports. Pin P10 (INTO) can be configured as either an I/O port or an external interrupt input with INTOEN (bit 6 in EINTCR). During reset, the pin P10 (INTO) is configured as an input port P10. 3-70-42

TOSHIBA TMP87CC70/H70/K70A/M70A STOP OUTEN {_» data input Pe < data output fd Cy ii output latch control output control input Note : i=7to0 6 4 0 P1 P17 : P16: PI5 | P14: P13: P12: P11: PIO (0001,4) i To: pvo | (Ni? | intt : INTO | (Initial value: 0000 0000) 6 4 0 0: Input mode write Figure 2-4. Port P1 and 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), 010000008 —; INTOEN«~1 ih) (P1), 101111118 jPI7A1, P141, P16O iu) (P1CR), 110100008 Note1: After the SYSCK is cleared to “0”, the CPU core operate using low frequency clock when the main system clock is switching from low frequency clock to high frequency clock. Note2: SLOW mode can also be released by setting the RESET pin low, which immediately performs the reset operation. After reset, the 87CC70/H70/K70A/M70A are placed in NORMAL2 mode. (The PM70 is placed in NORMAL1 mode) 3-70-43

TOSHIBA TMP87CC70/H70/K70A/M70A

2.2.3 Port P2 (P22 - P20)

Port P2 is a 3-bit input/output port. It is also used as an external interrupt| SET/CLR/CPL/others CMP/ MCMP/TEST/ others input, and low-frequency crystal |Data input Co <|~] connection pins When used as an oma)! || input port, or the secondary function |, 24 out 1 (NTS / STOP) put P20 (INTS / STOP) pin, the output latch should be set to |control input P| re U “1". During reset , the output latches |pata input TH are initialized to “1". LS Osc. enable A low-frequency crystal (32.768 kHz) is iy connected to pins P21 (XTIN) and P22 |Pete output [>| > i LJ P21 ocriny (XTOUT) in the dual-clock mode. In Data input the single-clock mode, pins P21 and i LU <I a U) 4 P22 can be used as normal T input/output ports. Data output fo a} > [] P22 «xtouT) It is recommended that the P20 pin {> should be used as an external stop Ir interrupt input, a STOP mode release| OuTEN dt Note: *;don’tare signal input, or an input port. If used} yTen as an output port, the interrupt latch is set on the falling edge of the output 2.6.5 4 3 2 1 0 pulse. . . . i : i i i P22 : P21 :_P20 When a read instruction for port P2 is {a002 : i i i i rout: xn EE executed, bits 7 to 3 in P2 read in as HO bascccssebaseeteabeessnsertasseesafeenseeee i | STOP undefined data. (Initial value: **#* #111) 2.2.4 Port P3 (P37 - P30) . Port P3 is an 8-bit input/output port, Figure 2-5. Port P2 and is also used as serial interface input/output, an external interrupt Control in « put X input, and a timer/counter input. > CMP /MCMP TEST When used as an input port or a Data input << . . ‘SET/CLR/CPL/others secondary function pin, the output latch should be set to “1”. The output < latches are initialized to “1" during Data output [> ol [> SS C] 3i reset. Output latch Example 1: Output the immediate data f 5Ay to the P3 port. Control output LD (P3), SAH } P3CSA, STOP 6 Note :i=7 " OUTEN d_) ote s1=7100 Example 2: Inverts the output of the upper 4bits (P37 - P34) of the P3 port. XOR (3), 111100008 76 $5 4 3 2 #1 0 + P37 to P34€-P37 to P34 P3 P37 | P36 | P35 : P34 : P33 | P32 | P31 | P30 (0003,,) | Hs THSCK! so: si i scK i tea :'NI3 (initial value: 11111111) Figure 2-6. Port P3 3-70-44

TOSHIBA TMP87CC70/H70/K70A/M70A

2.2.5 Port P4 (P47 - P40)

Port P4 is an 8-bit input/output port, and EKEY is also used as a key scan input and a tS Key scan input latch (KEYDR) comparator input. When used as an input <q lo >| port or a secondary function pin, the CMP /IMCMP /TEST latch should be set to "1". The 9 comers output pe set t » ime Data input <1 <}+~<q output latches are initialized to “1 SET/CLR/CPL/ others during reset. <} When used key scan function, all of the Data output {oo} i> ] pai port P4 bits must be used as key scan Ouputlatch EPDI inputs or comparator inputs. When used STOP in PACR as both comparator inputs and key scan OUTEN >. inputs, the P47 and P46 pins are used as CIN} only comparator inputs. Bits 7 and 6 are read in as “0” when a read instruction is Note: i=7to0, j=5to4 executed for the key scan input latches (KEYDR). Built-in pull-down resistors can also be connected for each bit using the 7 6 5 4 3 2 1 0 port P4 control register (refer to section Pa at, i ene Pas ; Paa : P43 : PAZ ; Pal : PaO "2.12.6 (2) Key scan input pins”) (0004) | KEY7 | KEY6 : KEYS ! KEY4 ! KEY3 KEY2/ KEY1 | KEYO (Initial value: 1111 1111) Figure 2-7. Port P4

2.2.6 Port P5 (P55 - P50)

Port P5 is a 6-bit input/output port, and is also used as a comparator input, an 8-bit PWM (Pulse Width Modulation) output and an 8-bit programmable divider output. When used as an input port or a secondary function pin, the output latch should be set to “1”. The output latches are initialized to “1” during reset. Bits 6 and 7 are read in as “1” when a read instruction is executed for the port P5. CMP /MCMP/TEST/others: CMP /MCMP/TEST/others J CPL/others J Data output —>[o a} P >] Pin Data output —>[o a] f H>— Din Output latch Output latch STOP Control output OUTEN a » stop CIN} OUTEN dt» (a) P50 to P53 (b) P54 to P55 7 6 5 4 3 2 1 0 Note: j=3to0, peredaceeeeee ane - * ; don’t care P5 i H PSS _: P54 : P53: P52 : P51 : P50 i PwM i Hl oa (0005y) : i PDO : FINO: CIN1 | CIN2:CIN3| (Initial value: **11 1111) Figure 2-8. P5 Port 3-70-45

TOSHIBA TMP87CC70/H70/K70A/M70A

2.2.7 Ports P6 (P67 - P60) and P7 (P77 - P70)

Ports P6 and P7 are 8-bit high-breakdown voltage input/output ports, and are also used as digit outputs, which can directly drive vacuum fluorescent tube (VFT). When used as an input port or a digit output, the output latch should be cleared to “0”. Pins which are not set for digit output can be used as normal I/O port (refer to section “2.12.6 Port Function”). The output latches are initialized to “0” during reset. CMP/MCMP/TEST/ others OUTEN —q——,, stor —L_) 76 5 4 3 2 1 0 PG P67 i P66 : P65 : P64 H P63 : P62 i P61 i P60 Data input q (0006,) | G8 : G9 : G10: G11 : G12: G13 : G14: G15 SET/CLR/CPL /others = = = = = = J (Initial value : 0000 0000) Data output fo a} T> Pi - - - - - — ° : ( Digit output J (00074) | GO : G1: G2: G3: G4: GS ; G6: G7 VKK (Initial value: 0000 0000) Figure 2-9. Ports P6 and P7

2.2.8 Port P8 (P87 - P80)

Port P8 is an 8-bit high-breakdown voltage output port, and also used as a segment output (or a key strobe output), which can directly drive vacuum fluorescent tube (VFT). When used as an input port or a segment (key strobe) output, the output latch should be cleared to “0”. The output latches are initialized to “0” during reset. OUTEN —d sTOP [_» Data input pawourpt fp ety Ny, 2 se 5 2 Output latch PB P87 | P86 | PBS | P84 | P83 | PBZ | PBI | P8O ‘Segment output (0008,) | S7 | S6 ; S5 | S4 | $3: S2 : St: SO (key strobe output) 4 - - - VKK (Initial value: 0000 0000) Figure 2-10. Port P8

2.2.9 Port P9 (P97 - P90)

Port P9 is an 8-bit high-breakdown voltage input/output port, and also used as a segment output (or a key strobe output), which can directly drive vacuum fluorescent tube (VFT). When used as an input port or a segment (key strobe) output, the output latch should be cleared to “0”. Pins which are not set for segment output can be used as normal I/O port (refer to section “2.12.6 Port Function”). The output latches are initialized to “0” during reset. CMP 7MCMP/TEST others OUTEN —d—), Data input <| SET/CLR/CPL/ others Output latch Po P97 | P96 : P95 | P94 : P93 | P92 : POI : PID Segment output b i : (key strobe output) VKK (Initial value: 0000 0000) Figure 2-11. Port P9 3-70-46

TOSHIBA TMP87CC70/H70/K70A/M70A

2.3 Time Base Timer (TBT)

The time base timer generates time base for key scanning, dynamic displaying, etc. It also provides a time base timer interrupt (INTTBT). The time base timer is controlled by the control register (TBTCR) shown in Figure 2-13. An INTTBT is generated on the first rising edge of source clock (the divider output of the timing generator) after the time base timer has been enabled. The divider is not cleared by the program; therefore, only the first interrupt may be generated ahead of the set interrupt period. The interrupt frequency (TBTCK) must be selected with the time base timer disabled (both frequency selection and enabling can be performed simultaneously). H H t120 TBTEN : E t2 = 1 machine cycle tt ; 2 ; Example : Sets the time base timer frequency to fc/216 [Hz] and enables an INTTBT interrupt. LD (TBTCR) , 000010108 SET (EIRL). 6 Mex INTTBT fc/2?3 or f5/2'5 A interrupt fc/2?! or f5/2'3 B request fe/2'S or 6/28 C_ source clock c/2"4 or 5/28 Dy Rising fc/2'3 or 5/25 E | >} edge Source clock] l fc/2'2 or 3/24 F detector z fc/2" or f5/23 G TBTEN E ? fc/29 or 5/2? Hi i A: : ‘ ee | | | TETCR Enable TBT period Time Base Timer Control Register (a) Configuration (b) Time Base Timer Interrupt Figure 2-12. Time Base Timer 7 6 5 4 3 2 1 0 arce, (rita value: 0%+0 0=+4) Time base timer 0: Disable enable/disable 000 : fc/2?8 or f5/2'5 [Hz] 001 : fc/2?" or fs/2'3 write 010 : fe/2'or 5/28 onl tatcK | Time base timer interrupt 011 : fe/2"4or f5/ 2 y frequency select 100 : fc/2"3 or 5/25 101 : fc/ 2" or f5/24 110 : fe/ 2" or fs/23 111 : £c/29 or f5/2 Note: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz], * ; don’t care Note2: TBTCRisa write-only register and must not be used with any of the read-modify- write instructions. Figure 2-13. Time Base Timer and Divider Output Control Register 3-70-47

TOSHIBA TMP87CC70/H70/K70A/M70A Table 2-1. Time Base Timer Interrupt Frequency TBTCK SLOW, SLEEP mode DV7CK=0 DV7CK = 1 Atfc=8MHz | At fs=32.768kHz 000 c/ 223 5/218 5/218 0.95 Hz 1 Hz 010 fc/ 216 5/28 - 122.07 128 o11 fc/2"4 5/26 - 488.28 512 100 fc/2"3 5/25 - 976.56 1024 101 f/2"2 5/24 - 1953.12 2048 110 fe/2"! 5/23 - 3906.25 4096 111 fc/29 fs/2 - 15625, 16384

2.4 Divider Output (DVO)

A50% 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. Divider output circuit is controlled by the control register (TBTCR) shown in Figure 2-14. Note that TBTCR is a write-only register, and must not be used with any of the read-modify-write instructions. ee a ee: ee 0 (00364) (initial value: #0 Ox#+) - . 0: Disable Divider output enable/aisable 00 : fc/2"3 or f/25 [Hz] write Divider output (DVO) 01: fc/2"2 or fs/24 only PVOCK | Frequency selection 10 : fc/2"" or 5/23 11: fe/2"° or fs/2? Note: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz], *; don’t care Figure 2-14. Divider Output Control Register Example: 1kHz pulse output (at fc = 8 MHz) SET (P1).3 ; P13 output latch —1 LD (P1CR), 000010008 ; Configures P13 as an output mode LD (TBTCR), 100000008 ; DVOEN€1, DVOCKe-00 Table 2-2. Frequency of Divider Output DVvock Frequency of Atfc=8 MHz | At fs=32kHz Divider Output 00 fe/2" or 8/2 0.97. [kHz] 1 [kHz] 01 fe/2” ——fs/ 24 1.95 2 10 fcs2" 3/2? 3.90 4 1 fc/2" fs/2? 7.81 8 3-70-48

TOSHIBA TMP87CC70/H70/K70A/M70A output latch output enable dataoutput—[>_ | | 4-3 ovo MPX A fe/ 2'3 or fs/25 A () fc/212 or fs/24 B fc/ 211 or fs/23 Cc P13 output latch J fe/ 210 or f5/22 D J 2 H Dvock DVOEN DVOEN | | L BvS mn Morr . DVO Divider output control register (a) Configuration (b)_ Timing Chart Figure 2-15. Divider Output 2.5 16-bit Timer/Counter 1 (TC1)

2.5.1 Configuration

; 3 > Tet pin O ry Det TT VU fl2" or fs/2? >>| 4 clear fu? Source clock Ly Match S detect INTTC1

3 Comparator interrupt

TCICK Tc1s | Timer/counter 1 control register 16-bit timer register 1 Figure 2-16. Timer/Couter 1 3-70-49

TOSHIBA TMP87CC70/H70/K70A/M70A

2.5.2 Control

The timer/counter 1 is controlled by a timer/counter 1 control register (TC1CR) and a 16-bit timer register (TREG1). Reset does not affect TREG1. i 4 #13 #12 #1 i 9 8 7 6 5S 4 3 2 1 0 wee RECT 001 (0010, 0011}) H Hy Li H 7 6 5 4 3 2 1 ° Write only TCIcR osedoceegeet Deanapenstee (00144) Ecrcnnherennteeene LECIS | TGIK TM (initial value: *#*0 0000) 00 : Timer/event counter mode teim | Timer/counter 1 01: Reserved operating mode select 1* : Reserved 00 : Internal clock fc/2" or fs/2? [Hz] write : 7 teick | Timer/counter 1 01 : Internal clock fel?” only source clock select 10 : Internal clock fe/ 2 11: External clock (TC1 pin input) Timer/counter 1 0 : Stop and counter clear TCIS | start control 1: Command start Note 1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz], *; don’t care Note2: Always write “0” to bits 0, 1, 5, 6 and 7 in TCICR. Note3: Writing to the low-byte of timer register (TREG1,), the comparison is inhibited until the high-byte (TREG1,,) is written. Note4: Set the mode, the source clock and the edge (INT2ES) when the TCI stops (TC1S = 0). Note5: Values to be loaded to the timer register must satisfy the following condition. TREG1>0 Note6: TCICR and TREG1 are write-only registers, which cannot be accessed by any read-modify-write instructions such as bit operate, etc. Figure 2-17. Timer Register 1 and TC1 Control Register

2.5.3 Function

Timer/counter 1 has two operating modes: timer mode and event counter mode. (1) Timer Mode In this mode, counting up is performed using the internal clock. The contents of TREG1 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. Table 2-3. Timer/Counter 1 Source Clock (Internal Clock) NORMAL1/2, IDLE1/2 modes SLOW, SLEEP modes - = = = pv7ekz0 | pv7Ke=1 At fc=8MHz | At fs= 32.768 kHz | At fc=8MHz | At fs= 32.768 kHz fc/2? [Hz] fc/2? [Hz] - 1 ys 65.5 ms fc/2” fc/2? - 16 us 1.0 s fos 2" 5/2? fs/2? [Hz] 256 us 244.14 ys 16.7 s 3-70-50

TOSHIBA TMP87CC70/H70/K70A/M70A 2.6 16-bit Timer/Counter 2 (TC2)

2.6.1 Configuration

MPX [>o Tezpin O H ¥ fcl223 or f9/215 A ear 0/28 c Source clock 23 D fe E fF detect C2 letec INTTC Ss Comparator interrupt

3 Tc2s

Timer/counter 2 control register 16-bit timer register 2 Figure 2-20. Timer/Counter 2

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). Reset does not affect TREG2. 15 14 #13 #12 #«11 «+10 9 8 7 6 S 4 3 2 1 0 (0016, 0017,) rH H L, H] write only reacr 7.6 5 4 3 2 1 0 (00154) ernie dt] ack, [ream] dnitiat value: #00000) team _ | Timer/counter 2 operating 0 : Timer/event counter mode mode select 1: Reserved 000 : Internal clock fc/2% or fs/2"° [Hz] 001 : Internal clock fc/2" or fs/2° 010 : Internal clock fc/2° TC2ck | Timer/counter 2 011 : Internal clock fc/23 write source clock select 100 : Internal clock fe (Note 5) only 101 : Internal clock fs 110 : Reserved 111: External clock (TC2 pin input) te25_| Timer/counter 2 0 : Stop and counter clear start control 1: Start Note 1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz], *; don't care Note2: 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 stop (TC2S = 0). Note 4: Values to be loaded to the timer register must satisfy the following condition. TREG2 > 0 (TREG215~11>0 when warm-up). Note5: “fc” canbe selected as the source clock only in the timer mode during SLOW mode. Note 6: Always write “0” to bit 0 in TC2CR. Note 7: TC2CR and TREG2 are write-only registers and must not be used with any of read-modify- write instructions. Figure 2-21. Timer Register 2 and TC2 Control Register 3-70-52

TOSHIBA TMP87CC70/H70/K70A/M70A

2.6.3 Function

The timer/counter 2 has two operating modes: timer and event counter mode. Also timer/counter 2 is used for warm-up when switching from SLOW mode to NORMAL2 mode. (1) Timer Mode In this mode, the internal clock is used for counting up. The contents of timer register 2 (TREG2) are compared with the contents of the up-counter. If a match is found, a timer/ counter 2 interrupt (INTTC2) is generated, and the counter is cleared. Counting up is resumed after the up-counter is cleared. Also, when fc is selected as the source clock during SLOW mode, the lower 11 bits of TREG2 are ignored and an INTTC2 interrupt is generated by matching the upper 5 bits. Thus, in this case, only the TREG2q setting is necessary. Table 2-4. Source Clock (Internal Clock) for Timer/Counter 2 Resolution Maximum time setting SLOW mode | SLEEP mode fe/2[Hz] | fs/2"[Hz] | fs/2"°[Hz]| 5/2" [Hz] 1.05 s tos 19.1 h 18.2 h fc/2" f5/2° fs/2° 5/2 1.02 ms 1 ms 1.1 min 1 min fcs2® fc/2° - - 32s - 21s - - - fc (Note) - 125 ns - 7.9 ms - fs fs - - - 30.5 4s - 26s Note: “fc” can be used only in the timer mode when switching from the SLOW mode to the NORMAL2 mode. Example: Sets the timer mode with source clock fc/23 [Hz] and generates an interrupt every 25 ms (at fc = 8 MHz). LD (TC2CR), 000011008 i Sets the TC2 mode and source clock LOW (TREG2), 61A8H ; Sets TREG2 (25 ms + 23/fc = 61A8}) LD (TC2CR), 001011008 ; 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 NORMAL1/2 or IDLE1/2 mode, and fs/24 [Hz] in SLOW or SLEEP mode. Example: Sets the event counter mode and generates an INTT2 interrupt 640 counts later. LD (TC2CR), 00011100B ; Sets the TC2 mode Low (TREG2), 0280H j Sets TREG2 LD (TC2CR), 001111008 j Starts TC2 3-70-53

TOSHIBA TMP87CC70/H70/K70A/M70A 2.7 8-Bit Timer/Counter 3 (TC3)

2.7.1 Configuration

Edge Capture |) — detector control are) 13s >] > ¥ INT3ES clear tc3pin OF A any D fe2"2 or fs28 —————>|a source clock overflow fel2%® or £522 fe fo? —— Es [ match Teack capture capture TC3s ScaP 8-bit Timer Register 3A, 3B Timer/Counter 3 Control Register Figure 2-22. Timer/Counter 3

2.7.2 Control

(0019,,) Read only 7 6 5 4 3 2 #1 0 TGR oe Ges tack] [ream (Initial value: *0*0 00*0) (001A) essen sessed oceseseesl initial value : Timer/counter 3 0: Timer/event counter Tc3M operation mode set 1: Capture 00 : Internal clock fc/2” or fs/2* [Hz] tesck | Timer/counter 3 01 : Internal clock fe/2" or f5/22 source clock select 10 : Internal clock fc/2? write 11: External clock (TC3 pin input) only Timer/counter 3 0: Stop & clear Note 1: fc; High-frequency clock [Hz] fs ; Low-frequency clock [Hz] * ; don’t care Note 2: Set the mode, the source clock and the edge when the TC3 stops (TC3S = 0). Note 3: Values to be loaded into timer register 3A must satisfy the following condition. TREG3A > 0(in the timerlevent counter mode) Note 4: TC3CRisa write-only register and must not be used with any of read-modify-write instructions. Figure 2-23. Timer Register 3 and TC3 Control Register 3-70-54

TOSHIBA TMP87CC70/H70/K70A/M70A The timer/counter 3 is controlled by a timer/counter 3 control register (TC3CR) and two 8-bit timer registers (TREG3A and TREG3B). Reset does not affect these timer registers.

2.7.3 Function

The timer/counter 3 has three operating modes : timer, event counter, and capture mode. (1) Timer Mode In this mode, the internal clock is used for counting up. The contents of timer register 3A (TREG3A) are compared with the contents of the up-counter. If a match is found, a timer/counter 3 interrupt (INTTC3) is generated, and the counter is cleared. Counting up resumes after the up-counter is cleared. The current contents of the up-counter are loaded to the TREG3B by setting SCAP (bit 6 in TC3CR) to “1”. SCAP is automatically cleared after capturing. Table 2-5. Source Clock (Internal Clock) for Timer Counter 3 fc/2" or fs/2* [Hz] fs/2* [Hz] 512 us 488.28 ys 131.1. ms 125° ms fe/2" or fs/2 - 128 ys 122.07 ys 32.8 ms 31.25 ms fc/2? - 16 us - 4.1 ms - (2) Event Counter Mode In this mode, the TC3 pin input pulses are used for counting up. Either the rising or falling edge can be selected with INT3ES (bit 3 in EINTCR). The contents of TREG3A are compared with the contents of the up-counter. If a match is found, an INTTC3 interrupt is generated and the counter is cleared. The maximum applied frequency is fc/2* [Hz] in NORMAL1/2 or IDLE1/2 mode, and fs/24 [Hz] in SLOW or SLEEP mode. Two or more machine cycles are required for both the high and low levels of the pulse width. The current contents of the up-counter are loaded to TREG3B by setting SCAP (bit 6 in TC3CR) to “1”. SCAP is automatically cleared after capturing. Example: Generates an interrupt every 0.5 s, inputing 50 Hz pulses to the TC3 pin. LD (TC3CR) , 000011008 Sets TC3 mode and source clock LD (TREG3A), 19H j 0.58+1/50=25= 194 LD (TC3CR) , 000111008 j Start TC3 (3) Capture Mode The pulse width, period and duty of the TC3 pin input are measured in this mode, which can be used in decoding the remote control signals, etc. The counter is free running by the internal clock. On the rising (falling) edge of the TC3 pin input, the current contents of the counter is loaded into TREG3A, then the counter is cleared and an INTTC3 interrupt is generated. On the falling (rising) edge of the TC3 pin input, the current contents of the counter is loaded into TREG3B. In this case, counting continues. On the next rising (falling) edge of the TC3 pin input, the current contents of the counter is loaded in to TREG3A, then the counter is cleared again and an interrupt is generated. If the counter overflows before the edge is detected, FFy is set into TREG3A and an overflow interrupt (INTTC3) is generated. During interrupt processing, it can be determined whether or not there is an overflow by checking whether or not the TREG3A value is FFy. Also, after an interrupt (capture to TREG3A, or overflow detection) is generated, capture and overflow detection are halted until TREG3A has been read out; however, the counter continues. 3-70-55

TOSHIBA TMP87CC70/H70/K70A/M70A Internal clock J J l | J J | l | J J Up-counter 2K KKK KKM Xe KX MOK 2X KX ENE X 2X3) TC3 pin input | r | 1 i TREG3A > >A i i a i TREG3B at capture feqcapture [overflow INTTC3 interrupt I l Reading TREG3A | Figure 2-24. Timing Chart for Capture Mode (INT3ES = 0) 2.8 8-bit Timer/Counter (TC4)

2.8.1 Configuration

s TC4s [> Te4ping IN p | source clear lock fl fd23 Ic

2 Timer F/F 4

TFF4 Tcas | TC4am > {> ] >> toggle pin 2p 2} bset at f>—o > clear ys Timer/Counter 4 Control Register 8-bit Timer Register 4 PWM output cf Td mode 2h Note: MPX; Multiplexer MP; Comparator INTTC4 TC4aM, TFA interrupt Figure 2-25. Timer/Counter 4 3-70-56

TOSHIBA TMP87CC70/H70/K70A/M70A

2.8.2 Control

The timer/counter 4 is controlled by a timer/counter 4 control register (TC4CR) and an 8-bit timer register 4(TREG4). Reset does not affect TREG4. 76 5 4 #3 2 1 0 (oot i (0018,) Write only 7 6 5 4 3 2 1 0 00 : Timer/event counter mode . 01 : Reserved TCAM /TC4 operating modeselect_ | 19 : programmable divider output (PDO) mode 11 : Pulse width modulation (Pwm) output mode 00 : Internal clock fc/2"' or fs/2°[Hz] . 01 : Internal clock f¢/2” write TC4CK | TC4 source clock select 10: Internal clock fe/ 22 only 11 : External clock (TC4 pin input) 0 : Stop & clear Teas | Tc4 I 00 : Clear , 01 : Toggle TFF4 | Timer F/F 4 control 101 Set 11: - (Note 3) 7. 6 5 4 #3 2 1 t) EINTCR ~ y eae oa (0037) CXCEO] DS TC CRY]: Unitial value: 000 000) 0 : Rising edge write TC4ES | TC4 input edge select 1 : Falling edge only Note1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz], *; don’t care Note2: Set the operating mode, the source clock selection and, the timer F/F 4 control and the edge (TC4ES) when the TC4 stops (TC4S =0). Note3: TFF4 must be set to “11” in the timer and event counter modes. Note4: Values to be loaded to the timer register must satisfy the following condition. TREG4>0 Note5: TC4CR and TREG4 are write-only registers and must not be used with any of read-modify- write instructions. Figure 2-26. Timer Register 4 and TC4 Control Register

2.8.3 Function

The timer/counter 4 has four operating modes : timer, event counter, programmable divider output, and PWM output mode. (1) Timer Mode In this mode, the internal clock is used for counting up. The contents of timer register 4 (TREG4) are compared with the contents of the up-counter. If a match is found, a timer/counter 4 interrupt (INTTC4) is generated and the counter is cleared. Counting up resumes after the up-counter is cleared. 3-70-57

TOSHIBA TMP87CC70/H70/K70A/M70A Table 2-6. Source Clock (Internal Clock) for Timer/Counter 4 fc/2" or fs/2? [Hz] fs/2° [Hz] 256 us 244.14 ys 65.536 = ms 62.5 ms fe/2? - 16 ps 4.096 ms fe/23 - 1 ous 256 ys (2) Event Counter Mode In this mode, the TC4 pin input (external clock) pulse is used for counting up. Either the rising or falling edge can be selected with TC4ES (bit 4in EINTCR). The contents of TREG4 are compared with the contents of the up-counter. If a match is found, an INTTC4 interrupt is generated and the counter is cleared. The maximum applied frequency is fc/24 [Hz] in NORMAL1/2 or IDLE1/2 mode, and fs/2* [Hz] in SLOW or SLEEP mode. Two or more machine cycles are required for both the high and low levels of the pulse width. (3) Programmable Divider Output (PDO) Mode The internal clock is used for counting up. The contents of TREG4 are compared with the contents of the up-counter. Timer F/F 4 output is toggled and the counter is cleared each time a match is found. Timer F/F 4 output is inverted and output to the PDO (P55) pin. This mode can be used for 50% duty pulse output. Timer F/F 4 can be initialized by program, and it is initialized to “0” during reset. An INTTC4 interrupt is generated each time the PDO output is toggled. Example: Output a 1024 Hz pulse (At fc = 4.194304 MHz) LD (TC4CcR), 000000108 ; Initializes the TC4 mode, source clock and timer F/F 4. LD (TREG4), 20H } 11024 + 27/fc= 204, LD (TC4CR), 000100108 } Starts TC4 Internal clock J | | | | J J l J | | J | J J l Up-counter oXiKX2X oh PR IERGIK ERIN GN 0 TREGA eS math NG \\ ON Timer F/F 4 ! i i t PDO pin output 1 INTTC4 interrupt l J Figure 2-27. Timing Chart for PDO Mode 3-70-58

TOSHIBA TMP87CC70/H70/K70A/M70A (4) Pulse Width Modulation (PWM) Output Mode PWM output with a resolution of 8 bits is possible. The internal clock is used for counting up. The contents of the TREG4 are compared with the contents of the up-counter. If a match is found, the timer F/F 4 output is toggled. The counter continues counting. And, when an overflow occurs, the timer is again toggled and the counter is cleared. Timer F/F 4 output is inverted and output to the PWM (P55) pin. An INTTC4 interrupt is generated when an overflow occurs. TREG4 is configured a 2-stage shift register and, during output, will not switch until one output cycle is completed even if TREG4 is overwritten; therefore, output can be altered continuously. Also, the first time, TREG4 is shifted by setting TC4S (bit 4 in TC4CR) to “1” after data is loaded to TREG4. Internal clock l | | J l | J J Up-counter DXIKEKOK MK KER OX EK AMER REX OK KK) iii ae miami Cie TREG4 Kom Xf Xm Timer F/F 4 i t i t t PWM pin output 1 1 INTTC4 interrupt | Figure 2-28. Timing Chart for PWM Mode Table 2-7._ PWM Output Mode Resolution Repeat cycle SLOW, SLEEP mode fc/2" [Hz] fs/2? [Hz] fs/2? [Hz] 256 ps 244.14 ps 65.536 ms 62.5 ms fc/2? fc/2? - 16 ys 4.096 ms fc/2? fc/2? - 1 os 256 Ss 3-70-59

TOSHIBA TMP87CC70/H70/K70A/M70A

2.9 Serial Interface (SIO)

The 87CC70/H70/K70A/M70A each have a clocked-synchronous 8-bit serial interface (SIO). The SIO has an 8-byte transmit and receive data buffer that can automatically and continuously transfer up to 64 bits of data. The SIO is connected to external devices via pins P32 (SCR), P33 (SI) and P34 (SO). The serial interface pins are also used as port P3. When used as serial interface pins, the P34-P32 output latches should be set to “1". In the transmit mode, pin P33 is used as a normal I/O port, and in the receive mode, pin P34 is used as anormal I/O port.

2.9.1 Configuration

$10 control register 1/ S10 control Status register register 2 Transmit and receive data buffer (8 bytes in DBR) . Buffer control Shift register 76 5 4 3.2 1 0 SO pin Serial date output 8-bit transfer A-bit transfer SI pin Serial data input INTSIO interrupt request Serial clock SCK pin Serial clock VO Figure 2-29. Serial Interface

2.9.2 Control

The SIO is controlled by two SIO control registers (SIOCR1 and SIOCR2). The serial interface status can be determined by reading a SIO status register (SIOSR). The transmit and receive data buffer is controlled by the SIOCR2. The data buffer is assigned to addresses OFFOy - OFF7} in the DBR (data buffer registers) area, and can continuously transfer up to 8 words (bytes or nibbles) 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. When the internal clock is used as the serial clock in the 8-bit receive mode and the 8-bit transmit/receive mode, a fixed interval wait can be applied to the serial clock for each word transferred. Four different wait times can be selected with SIOCR2. 3-70-60

TOSHIBA TMP87CC70/H70/K70A/M70A SIO Control Register 1 7 6 5 4 3 2 1 0 socm [sos] gg [ stow, [SK] _itialvalue: 00 0000) Indicate transfer startstop 0: Stop 1: Start 0 : Continue transfer SIOINH | Continue/abort transfe ‘ 000 : 8-bit transmit mode 010 : 4-bit transmit mode write SIOM | Transfer mode select 100 : 8-bit transmit/receive or receive mode (Note 1) only 110 : 4-bit receive mode **1: reserved 000 : Internal clock fe/ 2% or fs/2° (Hz) 001 : Internal clock fc/ 2° Output on SCK | Serial clock select 010 : Internal clock fc/2° SCK pin 011 : Internal clock fc/2° _ 111 : External clock (input from SCK pin) Note 1: Transmit/receive or receive mode are selected with ERM in SIOCR2. Note 2: Set SIOS to “0” and SIOINH to “1” when setting the transfer mode or serial clock. Note3: fc; High-frequency clock [Hz], fs ; Low-frequency clock [Hz] Note4: SIOCR1 is write-only registers, which cannot access any of in read-modify-write instruction such as bit operate, etc. SIO Status Register SIOSR a ee sior _ | Serial transfer operating 0 : Transfer terminated status monitor 1: Transfer in process read Shift operating status 0 : Shift operation terminated only monitor 1: Shift operation in process SIO Control Register 2 slocr2 7.6. 5 4 3 2 1 0 (oo2t) i} erm] wart (Initial value: *#00 0000) 8-bit transmit/receive mode 0 : Transmit/receive mode ( Always set to “0” except in ) control 1: Receive mode the 8-bit receive mode. 00:T} = To (no waits) O1:T, = 2% WAIT | Wait control 10:T, = 4Tp | (waits) 14:7 = 8T write Buffer addresses used only 000 : 1-word transfer OFFOy 001 : 2-wordtransfer OFFO - OFF1y Number of transfer words | 010: 3-word transfer OFFO - OFF2y BUF 011: 4-word transfer OFFO - OFF3y 100 : 5-word transfer OFFO - OFF4, 101: 6-word transfer OFFO - OFF5y, 110: 7-word transfer OFFO - OFF6y 111: &-word transfer OFFO - OFF74 3-70-61

TOSHIBA TMP87CC70/H70/K70A/M70A ® External Clock An external clock connected to the SCK pin is used as the serial clock. In this case, the P32 (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 244K-bit/s. (at fc = 8 MHz). SCK pin input l l | tscxL tsckH 4/fs (In the SLOW, SLEEP modes) 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). SCK pin 1 1 1 1 (a) Leading Edge (b) Trailing Edge Figure 2-32. Shift Edge (2) Number of Bits to 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) or 8 bits (8-bit serial transfer) of data can be transferred continuously. The number of words to be transferred is loaded to BUF in SIOCR2. 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. 3-70-63

TOSHIBA TMP87CC70/H70/K70A/M70A SCK pin J J l 50 pin 2X2 X= Xs (a) 1 Word Transmit seein LE LILI LILI LU LU UU UU SO pin \\ 2X2 X22 X23 X bo XP X be XK KO KXAKAKS InsiOinterrupt, CM (b) 3 Words Transmit seen ~~ SO LE LPL LUI LIU LU LU uu Spin (20 X21 X 22 X 23 X bo X bi X be X bs Xo Ka KA Xe / () 3 Words Receive Figure 2-33. Number of Bits to Transfer (Example : 4-bit serial transfer)

2.9.3 Transfer Mode

SIOM (bits 5 - 3 in SIOCR1) and ERM (bit 5 in SIOCR2) are used to select the transmit, receive, or transmit/receive mode. (1) 4-bit and 8-bit Transmit Modes In these modes, SIOCR1 and SIOCR2 are set to the transmit mode and then the data to be transmitted first are written to the data buffer registers (DBR). After the data are 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. 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 an automatic-wait will be initiated if the next transmitted data are not loaded to the data buffer register by the time the number of data words specified with 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 : The wait is 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. 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 “1” 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” at the time that the final bit of the data being shifted out has been transferred. That the transmission has ended can be determined from the status of SIOF (bit 7 in SIOSR) because SIOF is cleared to “0” when a transfer is completed. 3-70-64

TOSHIBA TMP87CC70/H70/K70A/M70A When an external clock is used, it is also necessary to clear SIOS to “0” before shifting the next data; otherwise, dummy data will be transmitted and the operation will end. Clear SIOS ‘sIOs SIOF H SEF __ J J i SCK pin output | l J l J J l J l l J l J J SO pin WX 20K 2X 2X 23K 24X 25K 2X 27K boX biX boX bX baX bs X be X bi/ INTSIO interrupt | > DBR X a X b ie tarsi data (@)_ Internal Clock : Clear $108 i ios Al i ‘SIOF : SEF i SCK pin input SO pin VX 2oX arX a2X aX 2X 25K a5X a7X boX biX boX baX ba b5)K bs Kor/ INTSIO interrupt hl > l DBR X a Xe _ write ansmited data (b) External Clock SCK pin l ‘SIOF tsopH = min. 3.5/fc [s] (NORMAL1/2, IDLE1/2 mode) =min. 3.5/fs [s] (SLOW, SLEEP mode) (c)_ Transmitted Data Hold Time at end of transmit/receive Figure 2-34. Transmit Mode (Example : 8 bit 1 Word Transmit) Example: The way of the transfer stopped (8-bit Transmit mode, External clock). STEST1: TEST (SIOSR).SEF ; IFSEF = 1 then loop IRS F,STEST1 STEST2: TEST (P3).2 ; If5CK =0 then loop IRS T,STEST2 LD (SIOCR1),00000111B 7 S10SH-O Note : When to clear SIOS to “0”, that it is also necessary to check SEF = 1 and SCK =0. 3-70-65

TOSHIBA TMP87CC70/H70/K70A/M70A (2) 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 is then transferred to the shift register via the SI pin synchronous with the serial clock. 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 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: The wait is also canceled by reading a DBR not being used as a received data buffer register is read; therefore, during SIO do not use such DBR for other applications. 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. Clear SIOS to “0” to end receiving. When SIOS is cleared, the current data are transferred to the buffer in 4-bit or 8-bit blocks. The receiving mode ends when the transfer is completed. SIOF is cleared to “0” when receiving is ended and thus can be sensed by program to confirm that receiving has ended. Note: The buffer contents are lost when the transfer mode is switched. If it should become necessary to switch the transfer mode, end receiving by clearing SIOS to “0”, read the last data and then switch the transfer mode. silos ne SEF ] ( SI pin input LLL 9 2K 22K 3X 2aX a5X a6X ar]X boX 1X b2X b3X aX bsK Kb) | INTSIO interrupt ff per Ce XT Read out Read out Figure 2-35. Receive Mode (Example : 8-bit, 1 word, internal clock) 3-70-66

TOSHIBA TMP87CC70/H70/K70A/M70A (3) 8-bit Transmit/Receive Mode After setting the control registers to the 8-bit transmit/receive mode, write the data to be transmitted first to the data buffer registers (DBR). After that, enable transceiving by setting SIOS to “1”. When transmitting, the data are output from the SO pin at leading edges of the serial clock. When receiving, the data are input to 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 BUF has been transferred. The interrupt service program reads the received data from the data buffer register and then writes the data to be transmitted. The data buffer register is used for both transmitting and receiving; therefore, always write the data to be transmitted after reading the received data. When the internal clock is used, a wait is initiated until the received data is read and the next data is written. Note: The wait is also canceled by writing to a DBR not being used as a transmit data buffer registers; therefore, during SIO 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 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 “1” output from the SO pin holds final bit of the last data until falling edge of the SCK. Clear SIOS to “0” to enable the transmit mode. When SIOS is cleared, the current data are transferred to the data buffer register in 8-bit blocks. The transmit mode ends when the transfer is completed. SIOF is cleared to “0” when receiving is ended and thus can be sensed by program to confirm that receiving has ended. Note: The buffer contents are lost when the transfer mode is switched. If it should become necessary to switch the transfer mode, end receiving by clearing SIOS to “0”, read the last data and then switch the transfer mode. sIos to. SIOF SEF ( SOpin WeoX aX 2X 2X 22X asX a5X a7 __X boX biX ba XX bsX baX bs bX b7/ Stpin WK XX oXaXsX Xo] KaoXsiX eX tXdeX asX de 7 INTSIO interrupt ___ | LoS L_ DBR A CD, t write (a) read out(c) write (b) read out (4) Figure 2-36. Transmit/Receive Mode (Example : 8-bit, 1word, internal clock) 3-70-67

TOSHIBA TMP87CC70/H70/K70A/M70A SCK pin l | SIOF i l etsoou_,! tsooH = Min. 4/fc [s] (In NORMAL1/2, IDLE1/2 modes) =Min. 4/fs [s] (In SLOW, SLEEPmodes) Figure 2-37. Transmitted Data Hold Time at end of transmit/receive 3-70-68

TOSHIBA TMP87CC70/H70/K70A/M70A 2.10 — 8-bit High-speed Serial Output (HSO) The 87CC70/H70/K70A/M70A each have a clock-synchronous 8-bit serial output (HSO). The HSO has a 1- byte transmit data buffer register (HSODR). The HSODR is assigned to address OFF8y in the DBR area. The HSO is connected to the external devices via pins P35 (HSCK) and P37 (HSO). These pins are also used as the port P3. When used as pins HSCK/HSO, the P35/P37 output latches should be set to “1”.

2.10.1 Configuration

fe/26 iB y| Control ia M Serial data output fe25 Ic circuit

23 D O HSCK pin

vhecx he i Serial clock output Figure 2-38. High-speed Serial Output

2.10.2 Control

The HSO is controlled by a HSO control register (HSOCR). The transfer status can be determined by reading a HSO status register (HSOSR). HSO Control Register Hsocre 7 8 8 1 0 (oot) DINK] sqk] initial value: +0%* +#00) 00: Internal clock fc/2° [Hz] ve z 01: Internal clock f¢/2° only SCK Serial clock select, 10: Internal clock f¢/2° 11: Internal clock fc/2° Note: fc; High-frequency clock [Hz], * ; don’t care HSO Status Register a ec Se ce SEF Shift operating status 0: Shift operation terminated (enable write to buffer) read monitor 1: Shift operation in process (disable write to buffer) only Figure 2-39. HSO Control Register and Status Register

2.10.3 Transmit Operations

SCK (bits 1 and 0 in HSOCR) is used to select the transfer rate. Transmission is started by writing one byte of data to the HSODR. The transmit data are output sequentially to the HSO pin in synchronized with the falling edges of the serial clock, starting with the least significant bit (LSB). Writing to the buffer is disabled by the hardware during data transfers. The shift register is empty after one byte of data has been transferred, so writing to the buffer is again enabled at that point. SEF (bit 6 in HSOSR) is set to “1” during transfers (write to buffer disabled) and is cleared to “0” when a transfer is completed (write to buffer enabled); therefore, whether or not a transfer has been completed can be confirmed with a program that reads SEF. The HSCK pin is raised to “high” at the start and end of transfers. 3-70-69

TOSHIBA TMP87CC70/H70/K70A/M70A Note: To continue a transfer without sensing SEF, write the next data to be transferred after 9 cycles (11 cycles when fc/23 [Hz] is selected only) at the transfer rate selected with SCK after writing to the buffer. write write HSODR Oo o HSO pin output ) PTET Tue S KPI ty Cy SEF Figure 2-40. High-speed Serial Output Timing Chart 2.11 6-bit A/D Conversion (Comparator) Inputs The comparator input is an analog input to discriminate key input or AFC (Auto Frequency Control) signal input, etc. The analog input voltage level (pins CINS - CINO) can be detected as 64-stage by setting reference voltage. The comparator input pins CIN5-CINO can also be used as ports P46, P47 and P53 - P50. When used as a comparator input, the output latch should be set to “1”. Note that the built-in pull- down resistances of the pins P47 and P46 must be cut off by clearing EPD (bits 7 and 6 in P4CR) to “0” when used as pins CIN4 and CINS.

2.11.1 Configuration

Comparator input control register SCIN 3 ECMP. ., A Comparison result register P47 (CIN4) oo esocens) El 3 Ltt ttf P51 (CIN2) ce v ‘COUTS~COUTO ¥ Comparator P53(CINO) ai SVREF Comparator input refrence voltage setting register Figure 2-41. 6-bit A/D Conversion (Comparator) Input

2.11.2 Control

A/D conversion (comparator) inputs are controlled by a comparator input control register (CMPCR) and a comparator input data register (CMPDR). The CMPDR contains a reference voltage setting register (write-only) and a comparison result register (read-only). 3-70-70

TOSHIBA TMP87CC70/H70/K70A/M70A Comparator Input Control Register CMPCR 7 Bucs Bacergnenet senegeeecd 2 1 9 (0006) LECMP ceeded SCIN (initial value: O*+* +000) . 0 : Disable Comparator input ECMP | Comparator input control 1: Enable Comparator input 000 : 1 channel (CINO) 001 : 2 channels (CINO to 1) write Number of Comparator 010 : 3 channels (CINO to 2) only SCIN FF 011 : 4 channels (CINO to 3) input channels select 100 : 5 channels (CINOto 4) 101 : 6 channels (CINO to 5) 11* : Reserved Note! : The CMPCRisa write-only register and must not be used with any of the read-modify-write instructions. Note2 : Donotset the ECMP to “1” in the SLOW mode. Comparator Input Data Register 7 6 5 4 3 2 1 0 CMPDR i SVREF (Initial value: **00 0000) (000FH) {ics Reference voltage (Vrer) _ _ write SVREF | otting Vper = Vp x (SVREF + 1)/64[V] (SVREF = 0 to 63) only cous ; : ;

8 Comparison result Result of comparing the CINS - CINO pin analog input voltage | read

COUTO with the reference voltage. only Note: *;don’tcare Figure 2-42. Comparator Input Control Register and Data Register

2.11.3 Function

Reference voltage (Vref) is set with SVREF (bits 5 - 0 in CMPDR). The number of comparator input channels is selected with SCIN (bits 2 - 0 in CMPCR). Sequential comparison of the selected number of channels is started by setting ECMP (bit 7 in CMPCR) to "1". The comparison of one channel requires two machine cycles; therefore, the comparison result register (COUTS - COUTO) should be read out at an interval equal to [number of channels x 2 machine cycles] after setting the reference voltage (Vref). COUT5 - COUTO are set to “1” if the input voltage (pins CINS - CINO) is higher than the reference voltage (Vrer) ; otherwise those are cleared to “0”. Note 1: When entering STOP and SLOW modes, ECMP is automatically cleared and SCIN/SVREF are held. And, COUTS - COUTO are always set to “1”. If a comparator is operated at a STOP or SLOW mode, Typ. 1.2 MA (Vpp =5.0 V) of the supply current is used. Note2: Any pins specified for comparator input with SCIN can no longer be used for normal digital input or key scan input, and are read out as”0”. Note 3: COUTS5 - COUTO are read out as “1” when not used as a comparator input. For example, bits 7 to 3 in CMPDR are always read out as “1” when SCIN =010g. 3-70-71

TOSHIBA TMP87CC70/H70/K70A/M70A Example : Comparates the CIN3-CINO inputs with Vref = 2.5 V (At Vpp =5 V). LD (P5), 111111118 ; Sets port P5 output latches to “1” LD (CMPDR), 00011111B ; Sets Vpep=2.5V LD (CMPCR), 10000011B ; Sets SCIN to 4 channels and Enables comparator input : } 4chx2 machine cycles-2 i =6 machine cycles wait. LD A, (CMPDR) ; Reads CMPDR (COUTO~COUT3) Table 2-9. Reference Voltage (at Vpp =5 V) 0.0 0 0 0 0 0.078 0. OOP 0.284 aren eee FT SOD 2 ee ee ee 5.000

2.12 Vacuum Fluorescent Tube Driver Circuit

The 87CC70/H70/K70A/M70A each have 32 high-breakdown voltage output buffers that directly drive the Vacuum Fluorescent Tube (VFT) and its control circuit.

2.12.1 Configuration

Figure 2-43 shows the VFT driver circuitry configuration. Key scan status register DIG ig Jt eer p STCK BK igi ‘ireui INTKEY (32 bytes in DBR) register it Key scan data latch O O O O O 4 G15 GO S15 ~ $0 KEY7 ~ KEYO Figure 2-43. VFT Driver Circuitry 3-70-72

TOSHIBA TMP87CC70/H70/K70A/M70A 2.12.2. Function ® 32 high-breakdown voltage output buffers. © 16 digit output buffers (GO to G15) @ 16segment output buffers (SO to $15) The VKK pin is provided for the VFT drive power supply. ® 8-16segments x 1 - 16 digits can be selected by program using the dynamic display. ® Pins not used for the VFT driver can be used as general-purpose ports. ® The display data is automatically transferred to the high-breakdown voltage output buffers from the display data buffer memory (32 bytes in the DBR). © Brightness level adjustment (8 levels) is available with a dimmer function. © An automatic key scan function is available. It is possible to use the segment outputs for key strobe outputs.

2.12.3 Control

The VFT driver circuit is controlled by two VFT control registers (VFTCR1 and VFTCR2). The VFT operational status can be determined by reading a VFT status register (VFTSR). Switching from NORMAL 1 or NORMAL 2 mode to SLOW or STOP mode, BLK is set to “1” and EKEY is cleared to “0” ; therefore, the VFT driver circuit is placed into the blanking state. The contents of the VFT control registers (except BLK, EKEY) are held. Also segment outputs and digit outputs are cleared to “0"; therefore, the ports P6, P7, P8 and P9 function as normal I/O ports with pull-down. VFT Control Register 1 VeTCRI 7 6 5 4 3 2 1 0 (0028, (initial value: 1000 0111) 7 0: Enable 0: Disable 00: fc/2" or fs/2° [Hz] (once every 4 tsea) Key scan strobe source clock 01: fc/2" or f5/2° (once every 8 tse) STCK | select 10: fc/2"or 15/2” (once every 16 tsec) 11: fc/2" or f5/2° (once every 32 tseg) 0111: 8-segment display mode (outputs $0 to $7) we 1000: 9-segmentdisplaymode (outputs $0 to $8) y 1001: 10-segmentdisplaymode (outputs $0 to $9) 1010: 11-segment display mode (outputs $0 to $10) 1011: 12-segment displaymode (outputs $0 to $11) Number of segmentsselect | 1109: 13 segment display mode (outputs $0 to $12) 1101: 14-segment displaymode (outputs $0 to $13) 1110: 15-segment display mode (outputs SO to $14) 1111: 16-segment display mode (outputs $0 to $15) 0**0 : Reserved O*0* : Reserved 00+ : Reserved Note1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz] tseg; During NORMAL 1 or NORMAL 2(DV7CK =0) 210/ fc [s] During NORMAL 2 mode (DV7CK = 1) 23/fs Note2: VFTCR1 is write-only registers, which cannot access any of in read-modify-write instruction such as bit operate, etc. 3-70-73

TOSHIBA TMP87CC70/H70/K70A/M70A VFT Control Register 2 VETCR2 7. 6 5 4 3 2 1 t) (00294) | (initial value: +000 0000) 000 : (14/16) x tsec Is] 001 : (12/16) x tseg 010 : (10/16) x tseg Dimmer time select 100: (6/16) x tere 101: (4/16) x tseG 110: (2/16) x tseg 111: (1/16) x tseg 0000: 1-digit display mode (outputs GO) 0001: 2-digit display mode (outputs GO to G1) 0010: 3-digit display mode (outputs GO to G2) write 0011: 4-digit display mode (outputs GO to G3) only 0100: 5-digit display mode (outputs G0 to G4) 0101: 6-digit display mode (outputs GO to G5) ‘ei 0110: 7-digit display mode (outputs GO to G6) Number of digits select 0111: 8-digit display mode (outputs G0 to G7) 1000: 9-digit display mode (outputs GO to G8) 1001 : 10-digit display mode (outputs G0 to G9) 1010 : 11-digit display mode (outputs GO to G10) 1011 : 12-digit display mode (outputs GO to G11) 1100 : 13-digit display mode (outputs GO to G12) 1101 : 14-digit display mode (outputs G0 to G13) 1110 : 15-digit display mode (outputs GO to G14) 1111 : 16 -digit display mode(outputs GO to G15) VFT Status Register (0029,;) 7 a wait _ | VFT display operational 0: VET display in operation read status monitor 1: VFT display operation disabled (or key scan operation) | only Key Scan Status Register KEYSR og Oe eet 3 2 10 Figure 2-44. VFT Control Registers/Status Registers (1) Display Mode Setting The number of segments is selected with SEG (bits 3-0 in VFTCR1) and the number of digits is selected with DIG (bits 3-0 in VFTCR2) when BLK (bit 7 in VFTCR1) = 1 and EKEY (bit 6 in VFTCR1)=0. The dimmer time (digit output time) is selected with DIM (bits 6-4 in VFTCR2). Example : Sets display mode (8-seg. x 16-dig., (14/16) x tse) LDW (VETCR1), OF87H =; ~ BLKe~1, EKEY¢-0, STCKe-00, SEG-0111, DIM<-000, DIG-1111 (2) Display Data Setting Normally, the conversion of data to VFT display data is performed by instructions. The converted data which stored to the display data buffer memory (addresses OF80} - OF9Fy in the DBR) is 3-70-74

TOSHIBA TMP87CC70/H70/K70A/M70A automatically transferred to the VFT driver circuit and output to the high-breakdown voltage output buffers. Thus, display patterns can be varied by merely changing the data in the data buffer memory. The VFT segments (dots) and display data area bits have a one-to-one correspondence. A “1” bit lights the corresponding segment and a “0” bit turns off the corresponding segment. Areas of the display data buffer not used for display purposes can be used as normal data memory. The display data buffer is assigned to the DBR area shown in Figure 2-45 (a) but, in the 8-segment display mode only, the assignment is as shown in Figure 2-45 (b) for more effective utilization of data memory. Bit7654321076543210 Digit 76543210 Digit i i i pot i H Poot : pot pot i t Pot [| o> (a) 9 to 16-segment Display Mode (b) 8segment Display Mode Figure 2-45. VFT Display Data Buffer Memory (DBR)

2.12.4 Display Operation

After setting the display mode and storing the display data, VFT display is started by clearing BLK to “0”. Figure 2-46 shows the VFT drive waveform. jy Gi | l GO l | 57-50 (0F92u KX oFatw XK 0F904 X02 X_ OFS) | tse [s] Figure 2-46. VFT Drive Waveform (Example : 8-segment x 3-digit display)

2.12.5 Key Scan Function

The key strobe signal can be output automatically. The output latch should be set to “1” to use the port P4 (KEY) for key scan input. Setting EKEY (bit 6 in VFTCR1) to “1”, the key scan timing is inserted into the display operation synchronizes with the scan rate selected with STCK. A key strobe pulse is output at the key scan timing from the pin Sn (one of the scan segment output pins selected with SEG). The segment pin number “n” is decremented at each key scan timing. For example, in the 8-segment display mode, the output would be from the S7—-S6— «--— S0—S7 pins. 3-70-75

TOSHIBA TMP87CC70/H70/K70A/M70A The KEY7 - KEYO pin input data synchronized with the key strobe output are latched to the key scan input latches (KEYDR) ; therefore, key scan can be performed by configuring a key matrix with the segment output pins and KEY 7 - KEYO pins. The key scan interrupt request (INTKEY) is generated in synchronized with key data latching; therefore, the key strobe bit can be identified by sensing the key scan status register (002A}) with an interrupt service routine and reading the stored key data (return code) from the key scan input latches (KEYDR). The following key scan timing is canceled until KEYDR has been read out. theystr — OFAN >= >= EN (key strobe) output CMAs FX XX fr INTKEY interrupt request ee | | Key data read J Figure 2-47. Key Scan Timing (8-digit Display) 87CC70/H70/K70A/M70A G0toG15 digit outputs key strobe outputs Key returns bbe P40 to Pa7 O—O PP D—D D—P Figure 2-48. Key Matrix Example

2.12.6 Port Function

(1) High-Breakdown Voltage Buffer When a VFT is being driven, the output latch is cleared to “0”. The port output latch is initialized to “0” during reset). When using as a normal input/output pin, caution is required because of being pulled down to the VKK pin voltage internally. 3-70-76

TOSHIBA TMP87CC70/H70/K70A/M70A INPUT/OUTPUT CIRCUITRY (1) Control pins The input/output circuitries of the 87CC70/H70/K70A/M70A control pins are shown below. Please specify either the single-clock mode (oscillation only XIN/XOUT) or the dual-clock mode (oscillation both XIN/XOUT and XTIN/XTOUT) by a code (NM1 or NM2) as an option for an operating mode during reset. CONTROL PIN INPUT/OUTPUT CIRCUITRY and code REMARKS Osc. enable fe Resonator connecting pins (high-frequency) XIN Input VDD Re Ro vod Ry =1.2MQ (typ) XOUT Output Ro =1.5kQ = (typ.) R =1ka (typ.) XIN xOUT a XTEN Resonator connecting pins Osc. enable fs (low-frequency) XTIN (P21) Input | Refer Ry =6MQ (typ.) XTOUT (P22) | Output to p2 Ro =220kQ — (typ.) pol R = f Ro R =1kO (typ.) XTIN xTOUT VDD Sink open drain output Rin Hysteresis input — R RESET vo Address-trap-reset Pull-up resistor wachogtimersese=—] >——] x Ry =220kQ — (typ.) system-clock-reset R =1ka (typ.) R Hysteresis input. STOP /INTS Input ysteresis inpu (P20) P20 R =1kQ (typ.) STOP/INTS VDD R Pull-down resistor Riy =70kQ (typ, TEST Input IN (typ.) Rin R =1kQ (typ.) Note! : The TEST pin of the 87PM70 does not have a pull-down resistor. Note2 : The 87PM70 is placed in the single-clock mode during reset, and the input/output circuitries are the code NM1 type. 3-70-78

TOSHIBA TMP87CC70/H70/K70A/M70A (2) Input/Output Ports The input/output circuitries of the 87CC70/H70/K70A/M70A input / output ports are shown below. A mask option code is only “A”. initial “Hi-2" VDD Tri-state VO vo om disable R R= 1kQ (typ.) initial "Hi-Z" VoD Tri-state /O Hysteresis input vo . disable R R=1k0 (typ.) initial “Hi-2" Sink open drain output vo De 1 R R=1ka Sink open drain output initial “Hi-2" —pDo— Hysteresis input P3 vo R R=1kQ (typ.) Sink open drain output initial “Hi-2" —Po— iN Hysteresis input vo R 4 Rin = 70 ko (typ.) Ri is programable pull-down. y digital input R=1kQ (typ.) initial “Hi-2" Sink open drain output PS vo R R=1k digital input 2 (typ.) To be continued. 3-70-79

TOSHIBA TMP87CC70/H70/K70A/M70A PORT INPUT/ OUTPUT CIRCUITRY (CODE _A) REMARKS initial “Hi-Z” VDD Source open drain output R R High-breakdown voltage P7 vo * Rx = 80 kM (typ.) 'VKK R=1k0 (typ.) Pg Rt vob Source open drain output initial “Hi-2" Output High-breakdown voltage Rk Rx = 80 ka (typ) VKK R=1k0 (typ) 3-70-80

TOSHIBA TMP87CC70/H70/K70A/M70A

ELECTRICAL CHARACTERISTICS

ABSOLUTE MAXIMUM RATINGS (Vss=0V) PARAMETER SYMBOL CONDITIONS RATINGS Sopp Vohage a JinputVoltage Ew P08 t0V00 +03 P2, Pa, P5, XOUT, RESET =0.3 to Vop +0.3 Output Voltage a Output Current (Per 1 pin) P8, P9 (segment outputs) [=12 | sma 76.7 aight outputs) [| Output Current (Total) ouTt mA [Stu [eeier. ere oo | PowerDissipation(Topr=70°c]_ [| po | | 880m RECOMMENDED OPERATING CONDITIONS | (Vss=0V, Topr= - 30 to 70°C) NORMALI, 2 modes fc=8MHz IDLE1, 2 modes Supply Voltage Voo 42MHz v P _frorneie 0 Vpp24.5V Seep rede Von Vpp24.5V ee ee Clock Frequency VDD =2.7to6V Note: The 87CC70/H70 are not guaranteed Vpp =2.7 to 6 Vin NORMALI, 2 and IDLE1, 2 modes. 3-70-81

TOSHIBA TMP87CC70/H70/K70A/M70A D.C. CHARACTERISTICS (Vss=0V, Topr= - 30 to 70°C) PARAMETER PINS CONDITIONS | min. | typ. | max. UNIT [Hysteresis Voltage | Vas [Hysteresisinput | | - og T - TV Input Current Open drain ports, Tri-state ports +2 | pA Input Resistance —— RESET po 800 | 220 | 450 | kn Output Leakage Sink open drain ports Voo=5-5V,Vour=55V | - | - | 2 | iM [vows [Texitepors (vane 45Viin= 07a ar | = | | Output High Voltage v [Vous [P8.P9 [Von =45V lon=-5mA | 24 | - | - | Output Low Voltage Except XOUT Voo=45Vilo=16mA | - | - | o4 | v | Supply Current in Vpp =5.5V 87CC70/H70 | 3 [| 14 | NORMAL 1, 2 modes fe=8 MHz | 10 | 16 | Supply Current in fs =32.768 kHz |87CC70/H70 | 4.0 | IDLE 1, 2 modes Vin=5.3V/0.2V [45 | Supply Current in _ SLOW mode Voo=3.0V fs = 32.768 kHz mn Supply Current in : SLEEP mode Vin=2.8V/0.2V 15 Supply Current in Vpp=5.5V A STOP mode Vin=5.3V/0.2V “ Note 1: Typical values show those at Topr =25 °C, Vpp =5 V. Note2: Input Current lysing; The current through resistor is not included, when the input resistor (pull- up/pull-down) is contained. Note 3: Typical current consumption during A/D conversion is 1.2 mA. A/D CONVERSION CHARACTERISTICS. (Vsg=0V, Vpp=4.5t06.0V, Topr= -30t070°C) 3-70-82

TOSHIBA TMP87CC70/H70/K70A/M70A A.C. CHARACTERISTICS (Vss=0V, Vpp=4.5to 6.0V, Topr= - 30 to 70°C) os Machine Cycle Time ty s 1176 133.3 In SLEEP mode High Level Clock Pulse Width For external clock operation Low Level Clock Pulse Width (XIN input), fc= 8 MHz High Level Clock Pulse Width For external clock operation 147 . . s Low Level Clock Pulse Width (XTIN input), fs = 32.768 kHz RECOMMENDED OSCILLATING CONDITIONS | (Vcs=0V, Vpp=4-5t0 6.0V, Topr= ~ 30 to 70°C) om PARAMETER Oscillator Oscillation Recommended Oscillator KYOCERA —_KBR8.0M Ceramic Resonator 4MHz High-frequency MURATA —_—_CSA 4.00MG Oscillation 8MHz TOYOCOM 2108 8.0000 Crystal Oscillator 4MHz TOYOCOM — 2048 4.0000 Low-frequency . ae Crystal Oscillator 32.768 kHz NDK MX-38T 15 pF 15 pF Oscillation XTIN XTOUT XIN XOUT fr a oe C rom (1) High-frequency Oscillation (2) Low-frequency Oscillation Note: An electrical shield by metal shield plate on the surface of the IC package should be recommendable in order to prevent the device from the high electric fieldstress applied from CRT (Cathode Ray Tube) for continuous reliable operation. 3-70-83

TOSHIBA TMP87CC70/H70/K70A/M70A 3-70-84