TMP47C243N TOSHIBA

Document overview

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

Technical content

TOSHIBA TMP47C€243/443 CMOS 4-Bit Microcontroller TMP47C243N, TMP47C443N TMP47€243M, TMP47C443M TMP47C243DM, TMP47C443DM The TMP47C243/443 are the high speed and high performance 4-bit single chip microcomputers, with 8-bit AD converter, 8-bit serial interface, pulse output and zero-cross detector based on the TLCS-470 series. [Penne] now [aw | _fachoge [0 TMPA7C243N __ P:SDIP28-400-1.78 _ | TMP47P443VN___ TMP47C243M__ | 2048x8-bit 128x4-bit | _P-SOP28-450-1.27_ _ | TMP47P443VM. __ TMP47C243DM P-SSOP30-56-0.65 _| TMP47P443VDM TMPA7CAN __ P-SDIP28-400-1.78 | TMP47P443VN___ TMP47C443M___| 4096 x8-bit 256x4-bit | P-SOP28-450-1.27__ | TMPA7P443VM ___| TMP47C4430M P-5S0P30-56-0.65 | TMP47P443VDM Features P-SDIP28-400-1.78 4-bit single chip microcomputer Instruction execution time: 1.0 us (at 8 MHz) Low voltage operation:2.2 V (at 4.2 MHz) “a _ " Guceittl 92 basic instructions ; fi ‘TMP47C243N @ Table look-up instructions TMP47C443N ¢ 5-bit to 8-bit data conversion instruction TMP47P443VN @Subroutine nesting: 15 levels max P-S0P28-450-1.27 6 interrupt sources (External: 2, Internal: 4) All sources have independent latches each, and multiple L interrupt control is available. & < 1/0 port (23 pins) "rpa7c2aam - TMP47¢443M sinters! jimer TMP47P443VM a wo -bit Timer/Counters : P-SSOP30-56-0.65 Timer, event counter,and pulse width measurement mode Serial Interface with 8-bit buffer . @ Simultaneous transmission and reception capability —_ > © 8/4-bit transfer, external/internal clock, and “ << TMP47C243DM leading/trailing edge shift mode TMP47C443DM TMP47P443VDM 000707E8A1 @ For a discussion of how the reliability of microcontrollers can be predicted, please refer to Section 1.3 of the chapter entitled Quality and Reliability Assurance / Handling Precautions. @ TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA. products, to comply with the standards of safety. in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA products specifications. Also, please keep in mind the precautions and conditions set forth in the “Handling Guide for Semiconductor Devices,” or “TOSHIBA Semiconductor Reliability Handbook” etc.. @The TOSHIBA products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc). These TOSHIBA products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or 2 malfunction or failure of which may cause loss of human life or. bodily’ injury ("Unintended Usage”). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc.. Unintended Usage of TOSHIBA products listed in this document shall be made at the customer's ‘own risk. gm products described in this document are subject to the foreign exchange and foreign trade laws. The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA CORPORATION for any infringements of intellectual property or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any intellectual Property or other rights of TOSHIBA CORPORATION or others. @ The information contained herein is subject to change without notice. 6-43-1 2000-10-19

TOSHIBA TMP47C€243/443 #8-bit successive approximate type AD converter e With sample and hold ¢ 8analog inputs e Conversion time: 24 ys (at 8 MHz) @Pulse output Buzzer drive/Remocon carrier Zero-cross detector @High current outputs LED direct drive capability (typ. 20 mA x 8 bits) @RESET function @ Watchdog Timer @Hold function Battery/Capacitor back-up Emulation pod: BM47C443 6-43-2 2000-10-19

Pin Assignments (Top View) P-SDIP28-400-1.78/ P-SOP28-450-1.27, P-SSOP30-56-0.65, xin 2 27 1) <— HOLD (KEO) xin > G2 29 H <—HOLD (KEO) Reset —~ U3 26 F <> R92 (SCK) Reset —>~ O13 28 F <> R92 (SCK) R71 (PULSE) <> 5 24 <> R90 (s1) R71 (puLsE) <> 45 26 F1 => R90 (SI) R72/vaREF <> C6 23 F <> Rg3 (11) R72/varer <> 6 25 F) <> p93 (T1) R40 (AINo) <> 7 22 F~<> Re2(INTI/ZIN) rao(aino) <> 47 24 1) <> Rg2 (INTT/ZIN) Rat (aint) ~~ 8 21 => R91 (72) nc. G8 23H Nc. R42 (AIN2) <> O19 20 <> reo (iNT2) Rat (aint) <* 9 22D <> pai (12) R43 (Ain3) <> [10 19 <> R63 Raz (AIN2) <™ Yj 10 21H) <> pgo (INT2) Rso(Ainay <>] 11 181 < per R43 (AIN3) <> 11 20 <> p63 R51 (AINS) <>{] 12 170 pei R50 (AINa) <>] 12 191 <> R62 R52 (Aine) <>C413 16 <> p60 R51 (AINS) <>] 13 18 <> p64 vss 14 15 FI <> 53 (AIN7) R52 (Aine) <> 14 17) => R60 vss 15 16 FH <> R53 (AiN7) Block Diagram vp | r 0 Hold input HOLD (Gense input) (KEO) i [om =| «i Memory om ae] [om] [ee ose XIN Timer! Serial ‘AD pins (ch) outpu R70 R63 ez AT Zin) R92 (SCK) R43(AIN3) —_R53(AIN7) R71 (PULSE) to R91(SO) to to R72/VAREF R60 bap R90(SI) R4O(AINO) R50 (AINa) VO port High current “e ar vopor YOR... Higheurent ( Puce? ) WO por TiCoutput (serial port) (Analog input) zero-cross detector 6-43-3 2000-10-19

R43 to RAO DIEU port with atch (R7 porthas VO (input) AD converter analog input R53 to R50 Grpud) | Every bit datas possible to be set, cleared i. eginpy and tested by the bit manipulation R63 to REO | __vo__| instruction ofthe L-register indirect addressing. R72 /VAREF vo In the RS and Ré6 port, 8-bit data are AD converter reference voltage presentment cunieanenneee gytput by the S-bit to 8-bit data . ana fesveneennninteeeeseeeste R71 (PULSE) W/O (Output) conversion instruction [OUTB @HL] Pulse output R70 vo R83 (T1) 4-bit /O port with latch Timer/Counter 1 external input R82 (INTI/ZIN) When used as input port, external | external interrupt 1 and zero-cross input Jossssessneseennsnneeeeee VO (Input) interrupt input pin, or timer/counter [v---reer err ecreereneeenneeenteennneeeetnesnes R81 (T2) external input pin, the latch must be set | Timer/Counter 2 external input R80 (INT2) ton". External interrupt 1 input R92 (SCK) VO (V0) 3-bit /O port with latch. Serial clock /O. R91 (SO) VO (Output) When used as input port or serial port, the | Serial data output latch must be set to "1" - R90 (SI) VO (Input) Serial data input XIN Input Resonator connecting pins. XOUT Output For inputting external clock, XIN is used and XOUT is opened. vop +5V 7 Power Supply ste . - . vss OV (GND) 6-43-4 2000-10-19

TOSHIBA TMP47C€243/443 Operational Description Concerning the TMP47C243/443 the configuration and functions of hardwares are described. The basic instruction of configuration in the TMP47C243/443 is the same as those of TLCS-470 serise. 1. System Configuration @ Internal CPU Function 2.1. Program Counter (PC)

2.2 Program Memory (ROM)

2.3. H Register, L Register

2.4 Data Memory (RAM)

a. Stack, b. Stack Pointer Word (SPW), c. Data Counter (DC)

2.5 ALU, Accumulator

2.6 Flags

2.7. Clock Generator and Timing Generator 2.8 — Interrupt Function

2.9 Reset Function

+ Watchdog Timer Reset Peripheral Hardware Function Watchdog Timer Reset 3.1 1/0 Ports

3.2 Interval Timer

3.3. Timer/Counters (TC1, TC2)

3.4 AD Converter

3.5 Pulse output

3.6 Zero-cross detector

3.7 Serial Interface

  1. Internal CPU Function

2.1 Program Counter (PC)

The program counter is a 12-bit binary counter which indicates the address of the program memory storing the next instruction to be executed. Normally, the PC is incremented by the number of bytes of the instruction every time it is fetched. When a branch instruction or a subroutine instruction has been executed or an interrupt has been accepted, the specified values listed in Table 2-1 are set to the PC. The PC is initialized to “0” during reset. MsB LSB PCy ' PCM H PC a Se a PC}; | PCig | PCy | PCg ! PCy | PCs } PCs ! PCy ! PC; } PCr ! PC | PCo oor Page assignment ‘Address assignment in page Figure 2-1. Configuration of Program Counter The PC can directly address a 4096-byte address space. However, with the short branch and subroutine call instructions, the following points must be considered. In the TMP47C243/443, the long branch instruction [BSL a] is invalid. (1) Short branch instruction [BSS a] In [BSS a] instruction execution, when the branch condition is satisfied, the value specified in the instruction is set to the lower 6 bits of the PC. That is, [BSS a] becomes the in-page branch instruction. When [BSS a] is stored at the last address of the page, the upper 6 bits of the PC point the next page, so that branch is made to the next page. 6-43-5 2000-10-19

TOSHIBA TMP47C€243/443 (2) Subroutine call instruction [CALL a] In [CALL a] instruction execution, the contents of the PC are saved to the stack then the value specified in the instruction is set to the PC. The address which can be specified by the instruction consists of 11 bits and the most significant bit of the PC is always “0”. Therefore, the entry address of the subroutine should be within an addrress range of 000, through 7FFy. Table 2-1. Status Change of Program Counter Instruct Operation PCi1 1 PCig | PCy 1 PCa | PCy 1 PCE 1 PCS 1 PCy 1 PC3 1 PC? 1 PCy 1 PCy oles a Gdranch condition is satisfied) Immediate data specified by the instruction im SF=0 (Branch condition is S Not satisfied) +2 > Lower bit address Hold | Immediate data specified by the instruction . F=1 wo [BSS a 5 Lower 6-bit address ' 2 =11tit1 +1 | Immediate data specified by the instruction £ (last address in page) ! © 7 H ea a [ree [Oo oe oo Programs and fixed data are stored in the program memory. Address Address . inpage in page The instruction to be executed next is read from the address Page 00n 0001, indicated by the contents of the PC. 01 001 The fixed data can be read by using the table look-up On) ' instructions or 5-bit to 8-bit data conversion instruction. 3E OBE 3F O3F (1) Table look-up instructions ee eae [LDL A, @Dc], [LDH A, @Dc +] ow] ' The table look-up instructions read the lower and upper Hi i 4 bits of the fixed data stored at the address specified in 3f oe the data counter (DC) to place them into the ( 99 vsenenneen 080 accumulator. [LDL A, @DC] instruction reads the lower : ' srorererrnneernnnnrnnnnrnnn ' 4 bits of fixed data, and [LDH A, @DC +] instruction pot ' reads the upper 4 bits. \\ ¥ sesosauennuseeseceseeeeeeee roe The DC is a 12-bit register, allowing it to address the 00 FCO entire program memory space. 3F a el i H 3E FE 3F FFF Figure 2-2. Configuration of Program Memory 6-43-6 2000-10-19

TOSHIBA TMP47C€243/443 (2) 5-bit to 8-bit data conversion instruction [OUTB @HL] The 5-bit to 8-bit data conversion instruction reads the fixed data (8 bits) from the data conversion table in the program memory to output the upper 4 bits to port R6 and the lower 4 bits to port R5. The table is located in the last 32-byte space (addresses,7EO} through 7FFy for the TMP47C243, FEOY through FFFy for the TMP47C443) in the program memory with the lower address consisting of the 5 bits obtained by concatenating the contents of the data memory specified by the HL register pair and the content of the carry flag. This instruction is usable for such applications as converting BCD data into an output code to the 7-segment display elements. Example: The following shows that the BCD data at address 2F}y in the data memory is converted into the 7-segment code (e.g., anode common LED) to be output to ports R6 and R5. LD HL, #2FH ; HL¢2Fy (Data memory address is set) TEST CF ; CF<0 (The table is specified at addresses FEO to FEF}) oy OUTB @HL ; Ports R6, R5<fixed data se ( ORG OFEOH ; Data conversion table lp DATA OCOH, OFQH, OA4H, OBOH, 99H, 92H, 82H, OD8H, 80H, 98H 3 7

2.2.1 Program Memory Map

Figure 2-3 shows the program memory map. Address 000} to 086} and FEO, to FFF} (0004 to 086} and 7EO} to 7FFy for the TMP47C243) of the program memory are also used for special purposes.

2.2.2 Program Memory Capacity

The TMP47C243 has 2048 x 8 bits (addresses 0004 through 7FF}) of program memory (mask ROM), the TMP47C443 has 4096 x 8 bits (addresses 000} through FFFy). Address 2048 x 8-bit Address 4096 x 8-bit 000,, 000,, 006 |1OVF1 routine 006 |IOVFI routine 008 |'IOVE2”” entry address 008 | ove?” a 00a | iTMR nv 00a |iTmR entryaddress ooc [int fi coc [iNT2 ~ 09F | subroutine call entry address aaron °F | subroutine call entry address L designated by [CALLS a] designated by = designated by [CALLS a] instruction [CALL a] i instruction 086 instruction 086 7E0 Data conversion table for i 7FF [OUTB @HL] instruction 7FF 800 (= 000) : 890 FEO(=7E0) Not ; FEO | Data conversion table for FREE TFA ccs ‘ . o seceteed FFF [0UTB @HL] instruction Note: When the TMP47P443V (OTP) is used, the address from FEO, to FFF are used as the data conversion table area. (a) TMP47C243 (b) TMP47C443 Figure 2-3. Program Memory Map On the TMP47C243, no physical program memory exists in the address range 800 through FFFy. However, if this space is accessed by program, the most significant bit of each address is always regarded as “0” and the contents of the program memory corresponding to the address 000 through 7FFy are read. 6-43-7 2000-10-19

TOSHIBA TMP47C€243/443

2.3 H Register and L Register

The H register and the L register are 4-bit general registers. They are also used as a register pair (HL) for the data memory (RAM) addressing pointer. The RAM consists of pages, each page being 16 words long (1 word = 4 bits). The H register specifies a page and the L register specifies an address in the page. The L register has the auto-post-increment/decrement capability, implementing the execution of composite instructions. For example, [ST A, @HL +] instruction automatically increments the contents of the L register after data transfer. During the execution of [SET @L], [CLR @LJ], or [TEST @L] instructions, the L register is also used to specify the bits corresponding to I/O port pins R72 through R40 (the indirect addressing of port bits by the L register). Note that the TMP47C243/443 has not Data Memory Bank (DMB), so that it can not use the data memory bank control instruction Example 1: To write immediate values “5” and “F” to data memory addresses 10} and 11. LD HL, #10H ; HLe-104 ST #5 ,@HL+ ; RAM [104] <—5y, LRe-LR +1 ST #0FH, @HL+ ; RAM[114] FH, LRLR +1 Example 2: The output latch of R71 pin set “1” by the L register indirest addressing bit manipulation instruction. LD L,#1101B ; Sets R71 pin address to L register. SET @L i R711 ee Page specification Address specification in page Figure 2-4. Configuration of H and L Registers The data memory stores user-processed data. One page of this memory is 16 words long (1 word = 4 bits). It has 8 pages. The data memory is addressed in one of three ways (addressing modes): The RAM is addressed in one of the three ways (addressing modes): (1) Register-indirect addressing mode Hregister___Lregister In this mode, a page is specified by the H register and an address in the page by the L register. Example: LD A, @HL ; Acce-RAM [HL] RAM address (a) Lregister-indirect (2) Direct addressing mode Instruction field In this mode, an address is directly specified bythe 8bits [_ Ss xxxx | xxxx | of the second byte (operand) in the instruction field. TF LD Example: LD A, 2CH 3 Acce-RAM [2CH] RAMaddress [_xxxx {| xxxx | . (b) Direct addressing (3) Zero-page addressing mode Instruction field In this mode, an address in zero-page (addresses 00H [—_—SsSs—S| StS | through OFy) is specified by the lower 4 bits of the we second byte (operand) in the instruction field. Example: ST #3, 05H + RAM [05] <3 () Zero-page addressing Figure 2-5. Addressing mode

2.4.1 Data Memory Map

Figure 2-6 shows the data memory map. The data memory is also used for the following special purpose. @® Stack & Stack Pointer Word (SPW) @ Data Counter (DC) @ Count registers of the timer/counters (TC1, TC2) ® Zero-page 6-43-8 2000-10-19

TOSHIBA TMP47C€243/443 Address in page F — D Cc B A 9 8 7 6 5 4 3 2 1 0 e [sw] oc re Ll 8 : H H of address Hi Hy i H Page posetedeteiednsneesaenenfeeieeansninfenneesitiprnnenpsnenadenaiafnssenfvnnnnfeaninguennngunni

5 Po: Ff EE Decrementdirection =f FE

sessueseeebeennesberrunefeonentunnn’ oF address sven pcessedeseenfcsoundanesnegensnefusese

4 H i : H i oo i H : : i H

Note 1: denotes the stack area. Note 2: The TC1 and TC2 areas are shared by the locations 13 and 14. Figure 2-6. Data Memory Map (1) Stack The stack provides the area in which the return address is saved before a jump is performed to the processing routine at the execution of a subroutine call instruction or the acceptance of an interrupt. When a subroutine call instruction is executed, the contents (the return address) of the program counter are saved; when an interrupt is accepted, the contents of the program counter and flags are saved. When returning from the processing routine, executing the subroutine return instruction [RET] restores the contents of the program counter from the stack; executing the interrupt return instruction [RETI] restores the contents of the program counter and flags. The stack consists of up to 15 levels (locations 0 through 14) which are provided in the data memory (addresses COy through FBy). Each location consists of 4-word data memory. Locations 13 and 14 are shared with the count registers of the timer/counters (TC1, TC2) to be described later. The save/restore locations in the stack are determined by the stack pointer word (SPW). The SPW is automatically decremented after save, and incremented before restore. That is, the value of the SPW indicates the stack location number for the next save. (2) Stack Pointer Word (SPW) Address FFy in the data memory is called the stack pointer word, which identifies the location in the stack to be accessed (save or restore). Generally, location number 0 to 12 can be set to the SPW, providing up to 13 levels of stack nesting. Locations 13 and 14 are shared with the timer/counters to be described later; therefore, when the timer/counters are not used, the stack area of up to 15 levels is available. Address FFy is assigned to the SPW, so that the contents of the SPW cannot be set “15” in any case. 6-43-9 2000-10-19

TOSHIBA TMP47C€243/443 The SPW is automatically updated when a subroutine call is executed or an interrupt is accepted. However, if it is used in excess of the stack area permitted by the data memory allocating configuration, the user-processed data may be lost. (For example, when the user-processed data area is in an address range 00} through CFy, up to location 4 of the stacks are usable. If an interrupt is accepted with location 4 already used, the user-processed data stored in addresses CCy through CFy corresponding to the location 3 area is lost.) The SPW is not initialized by hardware, requiring to write the initial value (the location with which the use of the stack starts) by using the initialization routine. Normally, the initial value of “12” is used. Example: To initialize the SPW (when the stack is used from location 12) LD A, #12 7 SPWe-12 ST A,OFFH (3) Data Counter (DC) The data counter is a 12-bit register to specify the address of the data table to be referenced in the use LsB program memory (ROM). Data table reference is [__Datacounter(0o__| Data Counter (DC) performed by the table look-up instructions [LDL A, a “ at ) @DC] and [LDH A, @DC+]. The data table may be located anywhere within the program memory address RAMaddress (FE) (FD) (FCy) space. . The DC is assigned with a RAM address in unit of 4 bits. Figure 2-7. Data Counter Therefore, the RAM manipulation instruction is used to set the initial value or read the contents of the DC. Example: Toset the DC to 780. LD HL,#0FCH ; Sets RAM address of DC, to HL register pair. ST #0H,@HL+ ; DC<—7804 ST #8H,@HL+ ST #7H,@HL+ (4) Count registers of the timer/counters (TC1, TC2) The TMP47C243/443 has two channels of 12-bit timer/counters. The count register of the timer/counter is assigned with a RAM addresses in unit of 4 bits, so that the initial value is set and the contents are read by using the RAM manipulation instruction. The count registers are shared with the stack area (locations 13 and 14) described earlier, so that the stack is usable from location 13 when the timer/counter 1 is not used. When none of timer/counter 1 and timer/counter 2 are used, the stack is usable from location 14. When both timer/counter 1 and timer/counter 2 are used, the data memory locations at addresses F7, and FBy can be used to store the user-processed data. MsB LSB MsB LSB RAMaddress _ (F6,) (F5u) (Fay) RAMaddress (FAy) (FO) (F8u) Figure 2-8. Count Registers of the Timer/Counters (TC1, TC2) 6-43-10 2000-10-19

TOSHIBA TMP47C€243/443 (5) Zero-page The 16 words (at addresses 00} through OF) of the zero page of the data memory can be used as the user flags or pointers by using zero-page addressing mode instructions (comparison, addition, transfer, and bit manipulation), providing enhanced efficiency in programming. Example: To write immediate data “8” to address 09} if bit 2 at address 04) in the RAM is “1”. TEST 04H,2 ; Skips if bit 2 at address 04y in the RAM is “0”. B SKIP ST #8,09H ; Writes “8” to address 09, in the RAM SKIP: PC FLAG PC STACK ig SAVE a STACK igi J SAVE RAMaddress (EBy) (EAy) (E9y) (E84) (E7H) RAMaddress (EB) (EAy) (E9q) (E84) (E7H) Before execution After execution Before acceptance After acceptance wo ]+E2 | ote l~[o] RAMaddress (Fy) (FF) RAMaddress (Fy) (FH) (a) At execution of the subroutine call instruction (b) At acceptance of an interrupt PC FLAG PC Tf RESTORE TT TT RESTORE STACK _ STACK _ RaMaddress (EBy) (EAy) (E94) (E84) (E7H) RaMaddress (EBy) (EAy) (E9y) (E84) (E74) a} Lecationto © > Locations > texcation19 © fe Locations Before execution After execution Beforeexecution After execution sow [Ls ]~[2 | sow Ls ]+Lo | RAM address (Fy) (FF) RAMaddress (FF) (FFy) (c) At execution of the subroutine return instruction (d) At execution of the interrupt return instruction Figure 2-9. Accessing Stack (Save/Restore) 6-43-11 2000-10-19

TOSHIBA TMP47C€243/443

2.4.2 Data Memory Capacity

The TMP47C243 has 128 x 4 bits (addresses 00} to 7Fy) of the data memory (RAM), and the TMP47C443 has 256 x 4 bits (addresses 00} to FF). When power-on performed, the contents of the RAM become unpredicable, so that they must be initialized by the initialization routine. Example: To clear RAM (use common to the TMP47C243 and TMP47C443) LD HL, #00H + HL<e00yq SCLRRAM: ST #0, @HL+ ; RAM [HL] <0, LRCLR +1 B SCLRRAM ADD H, #1 ; HREHR+1 B SCLRRAM Address Address 00, 004 or | 4 OF 10: i 10 Poi Image of address Po 2 00y to OFy i DG H i Data area 7F : 80 : a Epona i Data area i Image of address BF BF PRI pURIEEEeEeEDE 90} to FF co | PSeeeseieeeenneneseny co} . _ SS / i | sharedarea P| sharedarea (a) TMP47C243 rr (b) TMP47C443 Note: With the TMP47C243, the most significant bit of the RAM address is always regarded as “0”, so that addresses 90 to FF} may be accessed as addrresses 10y to 7Fy. However, programming should be performed assuming that the RAM is assigned to addresses 004 to OF and 904 to FFy as shown in Figure 2-10 (a) by considering the application software evaluation with a TMP47P443V (OTP) or development tools. Address 10 to 8Fy should not be accessed. Figure 2-10. Data Memory Capacity and Address Assignment 6-43-12 2000-10-19

TOSHIBA TMP47C€243/443

2.5 ALU and Accumulator

2.5.1 Arithmetic / Logic Unit (ALU)

The ALU performs the arithmetic and logic operations specified by 2 = Databuy instructions on 4-bit binary data and outputs the result of the ee i i Cin operation, the carry information (C), and the zero detect | | LL information (Z). | \\ a / (1) Carry information (C) i = The carry information indicates a carry-out from the most : Le significant bit in an addition. A subtraction is performed as L 2 addition of two’s complement, so that, with a subtraction, the c carry information indicates that there is no borrow to the result most significant bit. With a rotate instruction, the | . information indicates the data to be shifted out from the Mole! Gin indicates the carry input specified by instruction accumulator. (2) Zero detect information (Z) Figure 2-11. ALU This information is “1” when the operation result or the data to be transferred to the accumulator/data memory is “00008”. Example: The carry information (C) and zero detect information (Z) for 4-bit additions and subtractions. Operation Result Cc Zz 4+25 6 0 0 7+9= 0 1 1 8-15 7 1 0 2-25 0 1 1

2.5.2 Accumulator (Acc)

The accumulator is a 4-bit register used to hold source data 3 2 u 0 or results of the operations and data manipulations. Figure 2-12. Accumulator There are a carry flag (CF), a zero flag (ZF) and a status flag (SF), each consisting of 1 bit. These flags are set or cleared 3 2 1 0 according to the condition specified by an instruction. i When an interrupt is accepted, the flags are saved on the — Se stack along with the program counter. When the [RETI] Figure 2-13. Flags instruction is executed, the flags are restored from the stack to the states set before interrupt acceptance. (1) Carry flag (CF) The carry flag holds the carry information received from the ALU at the execution of an addition/subtraction with carry instruction, a compare instruction, or a rotate instruction. With a carry flag test instruction, the CF holds the value specified by it. @® Addition/subtraction with carry instructions [ADDC A, @HL], [SUBRC A, @HL] The CF becomes the input (Cin) to the ALU to hold the carry information. @ Compare instructions [CMPR A, @HL], [CMPR A, #k] The CF holds the carry information (non-borrow). 6-43-13 2000-10-19

TOSHIBA TMP47C€243/443 ® Rotate instructions [ROLC A], [RORC A] The CF is shifted into the accumulator to hold the carry information (the data shifted out from the accumulator). @ Carry flag test instructions [TESTP CF], [TEST CF] With [TESTP CF] instruction, the content of the CF is transferred to the SF then the CF is set to "1". With [TEST CF] instruction, the value obtained by inverting the content of the CF is transferred to the SF then the CF is cleared to “0”. (2) Zero flag (ZF) The zero flag holds the zero detect information (Z) received from the ALU at the execution of an operational instruction, a rotate instruction, an input instrcution, or a transfer-to-accumulator instruction. (3) Status flag (SF) The status flag provides the branch condition for a branch instruction. Branch is performed when this flag is set to “1”. Normally the SF is set to “1”, so that any branch instruction can be regarded as an unconditional branch instruction. When a branch instruction is executed upon set or clear of the SF according to the condition specified by an instruction, this instruction becomes a conditional branch instruction. During reset, the SF is initialized to “1”, other flags are not affected. Example: When the following instructions are executed with the accumulator, H register, L register, data memory (address 07}), and carry flag being set to “Cy”, “0”, "7", “5”, and “1” respectively, the contents of the accumulator and flags become as follows: Instruction | execution Instruction | execution Cor | | sr] ADDC Ay QHL | 2H ee na Le SUBRC A, @HL | 94 0 0 ADD A, #4 04 1 1 0 CPR A, @HL Cy ) 1 DEC A By 1 ) 1 AND A, @HL 4y 0 1 ROLC A 94 1 0 0 LDA, @HL 5a 0 1 RORC A Ey 0 0 1

2.7 Clock Generator and Timing Generator

1 Generator Generator

xout [_] ' HOLD Control —_,— ' System Clocks Figure 2-14. Clock Generator and Timing Generator 6-43-14 2000-10-19

TOSHIBA TMP47C€243/443

2.7.1 Clock Generator

The clock generator provides the basic clock pulse (CP) by which the system clock to be supplied to the CPU and the peripheral hardware is produced. The CP can be easily obtained by connecting the resonator to the XIN and XOUT pins (RC oscillation is also possible, depending on the mask option). The clock from the external oscillator is also available. In the hold operating mode, the clock generator stops oscillating. XIN XQUT XIN a XIN XQUT (Open) Rx Gan Cour (a) Crystal or ceramic resonator (b) External oscillator (c) RC oscillation (mask option) Figure 2-15. Examples of Oscillator Connection Note: Accurate adjustment of the oscillation frequency Although the hardware to externally and directly monitor the CP is not provided, the oscillation frequency can be adjusted by making the program to output the pulse with a fixed frequency to the port with the all interrupts disabled and timer/counters stopped and monitoring this pulse. With a system requiring the oscillation frequency adjustment, the adjusting program must be created beforehand. Example: To output the oscillation frequency adjusting monitor pulse to port R70. SFCCHK: SET %OP07 ,0 Output waveform CLR ‘%0P07,0 BSS SFCCHK —_— fc/40 —

2.7.2 Timing Generator

The timing generator produces the system clocks from basic clock pulse which are supplied to the CPU and the peripheral hardware. The timing generater consists of a 19-stage binary counter with a divide-by-3 prescaler. The basic clock (frequency: fc) provides the prescaler. Therefor, the output frequency at the last stage is fc/2?? [Hz]. During reset, the binary counter is cleared to "0", however, the prescaler is not cleared. The timing generater provides the following functions: ® Internal pulse for interval timer @ Internal serial clock for a serial interface @ Internal pulse for timer/counters © © Warm-up time at release of the hold operation @® Source clock for a pulse output © Source clock for a watchdog timer Prescaler Binary counter So 00 EXE ee XM Ed de do ed 0 de —| 7 11/12 16] 17 19 21 Figure 2-16. Configuration of Timing Generater 6-43-15 2000-10-19

TOSHIBA TMP47C€243/443

2.7.3 Instruction Cycle

The instruction execution and the on-chip peripheral hardware operations are performed in synchronization with the basic clock pulse (CP: fc [Hz]). The smallest unit of instruction execution is called an instruction cycle. The instruction set of the TLCS-47 series consists of 1-cycle instructions and 2-cycle instructions. The former requires 1 cycle for their execution; the latter, 2 cycles. Each instruction cycle consists of 4 states ($1 through $4). Each state consists of 2 basic clock pulses. In the TMP47C243/443, [BSL a] instruction can not be used. 1/fc ls] ee JUUUUUUUUUUUUL State Poss sess Tse st Figure 2-17. Instruction Cycle

2.7.4 Hold Operating Mode

The hold feature stops the system and holds the the system’s internal states active before stop with a low power. The hold operation is controlled by the command register (OP 10) and the HOLD pin input. The HOLD pin input state can be known by the status register (IPOE). The HOLD pin is shared with the KEO pin. (1) Starts HOLD Operating Mode The HOLD operating mode consister of the level-sensitive release mode and the edge-sensitive release mode. The HOLD operation is started when the command is set to the command register and holds the following states during the hold operation: ® The oscillator stops and the system’s internal operations are all held up. @® The interval timer is cleared to “0”. @ The states of the data memory, registers, and latches valid immediately before the system is put in the hold state are all held. @ The program counter holds the address of the instruction to be executed after the instruction which starts the hold operating mode. 6-43-16 2000-10-19

TOSHIBA TMP47C€243/443 (2) Edge-sensitive release mode In this mode, the hold operation is released at the rising edge of the HOLD pin input. This mode is used for applications in which a relatively short-time program processing is repeated at a certain cycle. This cyclic signal (for example, the clock supplied from the low power dissipation oscillator). In the edge-sensitive mode, even if the HOLD pin input is high, the hold operation is performed. Example: To start the hold operation in the edge-sensitive release mode (the warm-up time = 214/fc). LD A, #0101B ; OP10<-0101g OUT A, %OP10 HOLD pin \\ / TT N\\ ; i ‘en! 1 Normal | Normal operation —>9<—HOLD operation Warm-up > operation =P HOLD operation Enter the HOLD Le ee ‘operating mode The HOLD operating mode is released by hardware by program with the rising edge of the HOLD pin input. Figure 2-20. Edge-sensitive release mode Note: In the hold operation, the dissipation of the power associated with the oscillator and the internal hardware is lowered; however, the power dissipation associated with the pin interface (depending on the external circuitry and program) is not directly determined by the hardware operation of the hold feature. This point should be considered in the system design and the interface circuit design. In the CMOS circuitry, a current does not flow when the input level is stable at the power voltage level (Vpp/Vss); however, when the input level gets higher than the power voltage level (by approximately 0.3 to 0.5 V), a current begins to flow. Therefore, if cutting off the output transistor at an I/O port (the open drain output pin with an input transistor connected) puts the pin signal into the high-impedance state, a current flows across the ports input transistor, requiring to fix the level by pull-up or other means. (3) Releases Hold Operating Mode The hold operating mode is released in the following sequence: © The oscillator starts @ Warm-up is performed to acquire the time for stabilizing oscillation. During the warm-up , the internal operations are all stopped. One of three warm-up times can be selected by program depending on the characteristics of the oscillator used. @ When the warm-up time has passed, an ordinary operation restarts from the instruction next to the instruction which starts the hold operation. At this time, the interval timer starts from the reset state “0”. * The warm-up time is obtained by dividing the basic clock by the interval timer, so that, if the frequency at releasing the hold operation is unstable, the warm-up time shown in Figure 5-1 includes an error. Therefore, the warm-up time must be handled as an approximate value. The hold operation is also released by setting the RESET pin to the low level. In this case, the normal reset operation follows immediately. 6-43-18 2000-10-19

TOSHIBA TMP47C€243/443

2.8 Interrupt Function

(1) Interrupt Controller There are 6 interrupt sources (2 external and 4 internal). The prioritized multiple interrupt capability is supported. The interrupt latches (IL5 through ILo) to hold interrupt requests are provided for the interrupt sources. Each interrupt latch is set to “1” when an interrupt request is made, asking the CPU to accept the interrupt. The acceptance of interrupt can be permitted or prohibited by program through the interrupt enable master flip-flop (EIF) and interrupt enable register (EIR). When two or more interrupts occur simultaneously, the one with the highest priority determined by hardware is serviced first. Table 2-2. Interrupt Sources TC2 overowinterrupt wove) | aa EIF=1, EIR}=1 [niet Tieritront wm) | s | a | exert [eneatinerpe? ow [towed 6 | us | efeemer | es | Interrupt latches NTT ¢> fe? oF = IsiO pS Q a Encoder lOvF1 ps o+}+—_,_, Des TRO. / eH nares love2 rs Q ret. TT PON a ares Interrupt ddress ITMR ——- bs Q — ce ‘ acceptance [Te = qi aE jenerator __ | Pe pe SH Interrupt INT2 d> pS Q request > _| > FOF D ICL Ik, r [etm | e1R2 J e1R: | E1Ro | DICLR IL, r IXCH A, EIR] Interrupt CLR ir enable register s.Q Ly a Interrupt enable [EICLR IL, 1] master F/F [DICLR IL, r) System reset Figure 2-21. Interrupt Controller Block Diagram 6-43-19 2000-10-19

TOSHIBA TMP47C€243/443 a. Interrupt enable master flip-flop (EIF) The EIF controls the enable/disable of all interrupts. When this flip-flop is cleared to “0”, all interrupts are disabled; when it is set to “1”, the interrupts are enabled. When an interrupt is accepted, the EIF is cleared to “0”, temporarily disabling the acceptance of subsequent interrupts. When the interrupt service program has been executed, the EIF is set to “1” by the execution of the interrupt return instruction [RETI], being put in the enabled state again. Set or clear of the EIF in program is performed by instructions [EICLR IL, r] and [DICLR IL, r], respectively. The EIF is initialized to “0” during reset. b.Interrupt enable register (EIR) The EIR is a 4-bit register specifies the enable or disable of each interrupt except INT1. An interrupt is enabled when the corresponding bit of the EIR is “1”, and an interrupt is disabled when the corresponding bit of the EIR is “0”. Bit 1 of the EIR (EIR}) is shared by both IOVF2 and ITMR interrupts. Read/write on the EIR is performed by executing [XCH A, EIR] instruction. The EIR is initialized to “0” during reset. c. Interrupt latch (ILs5 through ILo) An interrupt latch is provided for each interrupt source. The IL is set to “1” when an interrupt request is made to ask the CPU for accepting the interrupt. Each IL is cleared to “0” upon acceptance of the interrupt. It is initialized to “0” during reset. The ILs can be cleared independently by interrupt latch operation instructions ([EICLR IL, r], [DICLR IL, r], and [CLR IL, r]) to make them cancel interrupt requests or initialize by program. When the value of instruction field (r) is “0”, the interrupt latch is cleared; when the value is “1”, the ILis held. Note that the ILs cannot be set by instruction. Example 1: To enable |OVF1, INT1, and INT2 interrupts. LD A,#0101B ; ~EIR<-0101g XCH A,EIR EICLR IL,111111B; EIFe-1 Example 2: To set the EIF to “1”, and to clear the interrupt latches except ISIO to “0”. EICLR IL,010000B; EIFe—1, ILs<0, IL3-ILo<-O (2) Interrupt Processing An interrupt request is held until the interrupt is accepted or the IL is cleared by the reset or the interrupt latch operation instruction. The interrupt acknowledge processing is performed in 2 instruction cycles after the end of the current instruction execution (or after the timer/counter processing if any). The interrupt service program terminates upon execution of the interrupt return instruction [RETI]. The interrupt acknowledge processing consists of the following sequence: @® The contents of the program counter and the flags are saved on the stack. @ The interrupt entry address corresponding to the interrupt source is set to the program counter. @ The status flag is set to “1”. @ The EIF is cleared to “0”, temporarily disabling the acceptance of subsequent interrupts. © The interrupt latch for the accepted interrupt source is cleared to “0”. © The instruction stored at the interrupt entry address is executed. (Generally, in the program memory space at the interrupt entry address, the branch instruction to each interrupt processing program is stored.) 6-43-20 2000-10-19

TOSHIBA TMP47C€243/443 To perform the multi-interrupt, the EIF is set to “1” in the interrupt service program, and the acceptable interrupt source is selected by the EIR. However, for the INT1 interrupt, the interrupt service is disabled under software control because it is not disabled by the EIR. Example: The INT1 interrupt service is disabled under software control (Bit 0 of RAM [05y] are assigned to the disabling switch of interrupt service). PINT1: TEST 05H,0 ; Skips if RAM [05y] 0 is “1” B SINT1 RETI SINT1: i One-instruction cycle INT2 NN ITMR 1Ly ILo EIF & ZI x le “""Vinterrupt ] execution | =} execution | interrupt | execution | Cycle acceptance | instr.(00A,) | ! HLEICLR IL, 1] | acceptance | instr.(00C,) | Note 1: It is assumed that there is no other interrupt request and EIR = 00118. Note 2: The value rin the [EICLR IL, r] instruction is assumed as 111111. Note 3: {____}denotes the execution of an instruction. Figure 2-22. Interrupt Timing chart (Example) The interrupt return instruction [RETI] performs the following operations: @® Restores the contents of the program counter and the flags from the stack. @ Sets the EIF to “1” to provide the interrupt enable state again. Note: When the time required for the interrupt service is longer than that foe the interrupt request, only the interrupt service program is executed without executing the main program. In the interrupt processing, the program counter and flags are automatically saved or restored but the accumulator and other registers are not. If it is necessary to save or restore them, it must be performed by program as shown in the following example. To perform the multi-interrupt, the saving RAM area never be overlapped. Example: To save and restore the accumulator and HL register pair. XCH HL, GSAV1 ; RAM[GSAV1] + HL XCH A, GSAV1+2 ; RAM[GSAV1 +2] @ Acc Note: The lower 2 bits of GSAV1 should be “0's”. 6-43-21 2000-10-19

TOSHIBA TMP47C€243/443 (3) External Interrupt When an external interrupt (INT1 or INT2) occurs, the interrupt latch is set at the falling edge of the corresponding pin input (INT1 or INT2). The INT1 interrupt cannot be disabled by the EIR, so that it is always accepted in the interrupt enable state (EIF="1"). Therefore, INT1 is used for an interrupt with high priority such as an emergency interrupt. When R82 (INT) pin is used for the I/O port, the INT1 interrupt occurs at the falling edge of the pin input, so that the interrupt return [RETI] instruction must be stored at the interrupt entry address to perform dummy interrupt processing. The INT2 interrupt can be enable/disable by the EIR. When R80 (INT2) pin is used as the I/O port, the INT2 interrupt ouurs at the falling edge of the pin input. However the interrupt request is not accepted by clearing bit 0 of the EIR to “0”. Because the external interrupt input is the hysteresis type, each of high and low level time requires 2 or more instruction cycles for a correct interrupt operation. When the RESET pin is held to the low level for three or more instruction cycles when the power voltage is within vbD the operating voltage range and the oscillation is stable, reset is performed to initialize the internal states. RESET When the RESET pin input goes high, the reset is cleared and program execution starts from address 0004. The RESET pin is a hysteresis input with a pull-up resistor (220 J kQ typ.). Externally attaching a capacitor and a diode implementa simplified power-on-reset operation. Figure 2-23. Simplified Power-On-Reset Circuit Table 2-3. Initialization of Internal States by Reset Operation Program counter (PC) 000 soeetsnseenseesveeenenensroseeensetnssnseenseessesenne sseetenetnnesetoneesss Referto Status flag (SF) 1 Output latch (VO ports or Output ports) | "inpUT/OUTPUT Interrupt enable master flip-flop (EIF) 0 Circuitry”. Interrupt enable register (EIR) On Refer to the inert bansemsssanar ror mrnnneniteessnstesssessane useesnsessntbaeseeess description of Interrupt latch (IL) “o" Command register each relative Interval timer “or command register. 6-43-22 2000-10-19

TOSHIBA TMP47C€243/443

2.9.1 Watchdog Timer (WDT)

The watchdog timer capability is provided to quickly detect the CPU malfunction such as endless looping caused by noises or the like, and restore the CPU to the normal state. The WDT is disabled during reset. The WDT consists of 10 binary counters, a flip-flop, and a controller. Source input clock of binary counters is fc/2'[Hz]. The flip-flop is set to “1” during reset, and cleared to “0” on the rising edge of the binary counter output. The WDT is controlled by the command register (OP15). The command register is initialized to "10003" during reset. Binary counter CPU reset . LL] =Te]s|s]> T=] > fo] He | Ka me VDD, ' Clear i request t ct o( [_] RESET opis H c/28 [Hz] 3 2 1 0 ' Figure 2-24. Configuration of Watchdog Timer To detect the CPU malfunction by the WDT: @® Set the WDT detection time, and clear the binary counters. @ Enable the WDT. @ Clear the binary counters within WDT detection time that was set in @. If a CPU malfunction occurs, preventing the binary counters from being cleared, the flip-flop is clearred to "0" on the rising edge of the binary counter output, making the malfunction detection signal active. Example: To enable the with detection time of 63 x 215/fc [s] LD A, #0010B ; OP15<-0010g (Set WDT detection time, OUT A, %OP15 clear binary counters) Lo A, #01108 ; OP15<01103 (Enable WOT) ‘ouT A, %OP15 Within WDT detection timer i LD A, #01108 ; OP15<-01103 (Clear binary counters) UT A, %OP15 Note: It is necessary to clear the binary counter prior to enabling watchdog timer. 6-43-23 2000-10-19

Watchdog timer control command register (Port address: OP15) 3 2 1 tO) 0: Binary counter cleared {after clear, it is automatically set to “1") Watchdog timer enable/disable 0: Disable 1: Enable ‘Set Watchdog timer detection time Example: At fe=4.19 MHz 01: 15x 215/fe 17 10: 63x 2'5/fc 493 11: 511 x215/fo 2.2... 3996 Figure 2-25. Watchdog Timer Control Command Register 6-43-24 2000-10-19

TOSHIBA TMP47C€243/443 3. Peripheral Hardware Function

3.1 Ports

The data transfer with the external circuit and the command/status/data transfer with the internal circuit are performed by using the I/O instructions (13 kinds). There are 4 types of ports: @® VO port ; Data transfer with external circuit @ Command register ; Control of internal circuit @ Status register ; Reading the status signal from internal circuit @ Data register ; Data transfer with internal circuit These ports are assigned with port addresses (004 through 1Fy). Each port is selected by specifying its port address in an I/O instruction. Table 3-2 lists the port address assignments and the |/O instructions that can access the ports. 3.1.1 /0 Timing (1) Input timing External data is read from an input port or an I/O port in the $3 state of the second instruction cycle during the input instruction (2-cycle instruction) execution. This timing cannot be recognized from the outside, so that the transient input such as chattering must be processed by program. I Ast instruction cycle | 2nd instruction cycle | execution cycle --- el Input strobe a 0 Figure 3-1. Input Timing (2) Output timing Data is output to an output port or an I/O port in the $4 state of the second instruction cycle during the output instruction (2-cycle instruction) execution. I 1st instruction cycle 2nd instruction cycle | ; | a Si__s2__ 53 S41 S253 SA a Output latch pulse 1 Port autput TTT NEE Figure 3-2. Output Timing 6-43-25 2000-10-19

TOSHIBA TMP47C€243/443 3.1.2 1/0 Ports The TMP47C243/443 have 7 I/O ports (23 pins) each as follows: @ R4,R5 ; 4-bit input/output (shared with AD converter analog inputs) @ R6 ; 4bit input/output @ R7 ; 3-bit input/output (shared with pulse output) @ R8 ; 4-bit input/output (shared with zero-cross input, external interrupt input and timer/counter input) © ro ; 3-bit input/output (shared with serial port) © KE ; 1-bit sense input (shared with hold request/release signal input) Each output port contains a latch, which holds the output data. The input ports have no latch; therefore, it is desired to hold data externally until it is read or read twice or more before processing it. (1) Ports R4, R5, R6, R7 These ports are 4-bit I/O ports with a latch (Port R7 is 3-bit). When used as an input port, the latch must be set to “1”. The latch is initialized to “1” during reset. These 4 ports (15 pins) can be set, cleared, and tested for each bit as specified by L register indirect addressing bit manipulation instructions ([SET @L], [CLR @L], and [TEST @L]). Table 3-1 lists the pins (I/O ports) that correspond to the contents of L register. Example: To clear R43 output as specified by the L register indirect addrressing bit manipulation instruction. LD L, #0011B ; Sets R43 pin address to L register CLR @u i R430 Table 3-1. Relationship between L register contents and I/O port bits

0000 R40 0100 R50 1000 R60 1100 R70

0001 R41 0101 R51 1001 R61 1104 R71

0010 R42 o110 R52 1010 R62 1110 R72

oo11 R43 o141 R53 1011 R63 6-43-26 2000-10-19

TOSHIBA TMP47C€243/443 (a) Ports R4 (R43 to R40) and R5 (R53 to R50) Ports R4 and R5 are 4-bit I/O ports with latch shared by the analog inputs for AD converter. When used as an analog inputs, the latch should be set to “1”. If other port is used as an output, be careful not to execute the output instruction for any port during AD conversion in order to keep accuracy of conversion. The latch is initialized to “1" and analog input is selected R40 (AINO) pin during reset. (b) Ports R5 (R53 to R50) and R6 (R63 to R60) Ports R5 and R6 are 4-bit high current output ports with a latch, which can directly drive LEDs. When an input instruction is executed, the latch data is read in these ports. They can be accessed separately at port addresses OPO5/IPO5 and OPO6/IPO6. Additionally, 8-bit data can be set to these ports (the upper 4 bits to port R6, the lower 4 bits to port R5) by using the 5-bit to 8-bit data conversion instruction [OUTB @HL]. The latch is initialized to “1” during reset. Example 1: To output immediate value “5” to port R5 OUT #5 ,%2OP05 ; Port R5<5 Example 2: To read the latch data from port R6 and store it in the accumulator IN %IP06,A + AccePort R6 Example 3: To read from ROM, the 8-bit data corresponding to the 5 bits obtained by linking the content (1 bit) of the carry flag with the contents (4 bits) of at address 904 in RAM to output the 8-bit data to ports R6 and R5. LD HL, #90H ; HLe€90y (Sets the data memory address) OUTB @HL ; Ports R6, R5<-ROM data PortR4 (Port address: OP04/1P04) AIN selector 3 2 1 0 . Analog input «—{]) R43 R42 Rat R40 IN/TEST/TESTP (AIN3) (AIN2) (AIN1) (AINO) Input data <I PortR5 (Portaddress: OP05/1P05) 3 2 1 0 <I (AIN7) (AIN6) (AINS) (AINA) (@) Port Ra and RS PortR6 (Port address: OP06/1P06) IN/TEST/TESTP 3 2 1 0 Input data <I Output data > [_] Pin (b) Port R6 Figure 3-3. Ports R4,R5 and R6 6-43-27 2000-10-19

TOSHIBA TMP47C€243/443 (©) Port R7 (R72 to R70) Port R7 is a 3-bit I/O port with a latch. R71 is shared by the pulse output and pulse is output when R71 output latch is “0”. To use it for an ordinary I/O port, the pulse output must be disabled. R72/VAREF pin can be selected the I/O port or analog reference voltage supply for AD conversion by the mask option. Note that R73 pin dose not exist actually but “1” is read when an input instruction is executed. IN/ TEST /TESTP PortR7 (Port address: OPO7/1P07) Input data 2 H (vaRrer) | (PULSE) Output data mptorn Control output (b) R71 (PULSE) IN/TEST/ TESTP Input data <J IN/TEST/TESTP

2 Mask Input data <J

option | <] Output data [>—+0--o-[] Pin rates i Deo reference Control output Voltage (a) R72/ VAREF (Q R70 Figure 3-4. PortR7 (2) Port R8 (R83 to R80) Port R8 is a 4-bit /O port with a latch. When used as an input port, the latch must be set to “1”. The latch is initialized to “1” during reset. Port R8 is shared with the external interrupt input pin and the timer/counter input pin. To use this port for one of these functional pins, the latch should be set to “1”. To use it for an ordinary I/O port, the acceptance of external interrupt should be disabled or the event counter/pulse width measurement modes of the timer/counter should be disabled. Note: When R82 (INT1) pin is used for an I/O port, external interrupt 1 occurs upon detection of the falling edge of pin input, and if the interrupt enable master flip-flop is enabled, the interrupt request is always accepted. So that a dummy interrupt processing must be performed (only the interrupt return instruction [RETI] is executed). With R80 (INT2) pin, external interrupt 2 occurs like R82 in but bit 0 of the interrupt enable register (EIRo) is only kept at “0”, not accepting the interrupt request. 6-43-28 2000-10-19

</ 5% §) ko 2| 3 3 z 5 ols| « — s e1]3] & JO & o}|é 3 > 28 2 Blot. o 21s! = Py gia] & 2 £1*) € J) 11 1 c0c000 fe) 2g g 5 a 2 © 2 2 a 8 2 ak s gs] | =z 5 , . g Z <6 fotelererele) oo1oo01c0i10 Oo oococ 8 2] [55 gs c iy 5 oe} Ee Fa £ ig cococeo o°}l 100 t S E ee oFe oxo Te Ss” 5 22 > Fy zz sz < a® B s ta iy 5 2 fe £ 2 2 52> 3 2 = g3 z 6 5 s g aoe v= z js 8 & & BEty BS g A gs 2 = 5 2 zee S8 3 eee a5 35 5 § E rag ae Oy & SERSER qe 22 &€ $ 5 ss$Y £8 Bs 5 2228282 fe £3 2,353,282 geeq S8 o Ol | lessees l/ 11/88/32 1812/21 13322 ~ a e3eee5n Selorlplals goes 2g 2 383333 ss &2 £ 3 & $335 28 Seenee 23 so § 2 2 eft Be e Eeeeee ar << 5 2 F FREAA Fe 2 ~ ~ >s é 28 Se gs ss oe a3 ¢ ee ge

7 Bs £5

a e¢é 3] ga & ge = ss 33 2 ae 2 g2] 83 es

2 Serer Bs) 52 “3

£ soo000 ed Be 9 282882 aa) 25 4 S35538 ae 2 2 228222 =a] 8s 2 snenes ss} a0 a8 ELeeee S$] 22 ze % $5 ras lc x 22 Sok loramenwenweadmuOwulSe-nmenvonandcmvawysl fei fsssssssossseyssserorsverersevaws 6-43-30 2000-10-19

TOSHIBA TMP47C€243/443

3.2 Interval Timer Interrupt (ITMR)

The interval timer can be used to generate an interrupt with a fixed frequency. Interval timer interrupt is control by the command register (OP19). An interval timer interrupt is generated at the first rising edge of the binary counters output after the command has been set. The interval timer is not cleared by command, so that the first interrupt may occur earlier than the preset interrupt period. Example: To set the interval timer interrupt frequency to fc/2'> [Hz]. LD A, #0110B ; OP19<-0110g OUT A, %OP19 Interval Timer interrupt command register (Port address: OP19) 3 2 1 0 00: Stop 01: Enable 1*: (Disable) Example: At f= 4. 194304 MHz 01: fe2"3 512 Jote 1: *; Don't care 10: f/2"5 128 Note 2: fc; Basic clock frequency [Hz] 14: f2'7 vo 32 Figure 3-8. Interval Timer Interrupt Command Register

3.3 Timer/Counters (TC1, TC2)

The TMP47C243/443 contain two 12-bit timer/counters (TC1, TC2). RAM addresses are assigned to the count register in unit of 4 bits, permitting the initial value setting and counter reading through the RAM manipulation instruction. When the timer/counter is not used, the mode selection may be set to “stopped” to use the RAM at the address corresponding to the timer/counter for storing the ordinary user-processed data. MsB LSB MsB LsB TMP47C443—(F6,;) (F5y) (Fay) TMP47C443_— (FAy)) (F9u) (F8y) Figure 3-9. The Count registers of the Timer/Counters (TC1, TC2)

3.3.1 Functions of Timer/Counters

The timer/counters provide the following functions: @® Event counter @® Programmable timer @ Pulse width measurement 6-43-31 2000-10-19

TOSHIBA TMP47C€243/443 Timer/Counter 1 control command register Timer/Counter 2 control command register (Port address: OP1C) (Initial value: 0000) (Port address: OP1D) (Initial value: 0000) 3 2 1 0 3 2 1 0 00: Stop 00: Stop 01: Event counter mode 01: Event counter mode 10: Timer mode 10: Timer mode 11: Pulse width measurement mode 11: Pulse width measurement mode Internal pulse rate (interval timer output) selection [ 1r2 | Internal pulse rate (interval timer output) selection Example: At f¢= 4.194304 MHz Example: At f¢=4.194304 MHz 01: f/28 16384 01: fe/214 256 10: fo/210 4096 10: fo/218 16 11: f214 256 11: £222 1 Note: fc; Basic clock frequency [Hz] Figure 3-10. Timer/Counter Control Command Registers

3.3.2 Control of Timer/Counters

The timer/counters are controlled by the command registers. The command register is accessed as port address OP1C for TC1 and port address OP1D for TC2. These registers are initialized to “0” during reset. The timer/counter increments at the rising edge of each count pulse. Counting starts with the first rising edge of the count pulse generated after the command has been set. Count operation is performed in one instruction cycle after the current instruction execution, during which the execution of a next instruction and the acceptance of an interrupt are delayed. If counting is requested by both TC1 and TC2 simultaneously, the request by TC1 is preferred. The request by TC2 is accepted in the next instruction cycle. Therefore, during count operation, the apparent instruction execution speed drops as counting occurs more frequently. The timer/counter causes an interrupt upon occurrence of an overflow (a transition of the count value from FFFy to 000y). If the timer/counter is in the interrupt enabled state and the overflow interrupt is accepted immediately after its occurrence, the interrupt is processed in the sequence shown in Figure 3- 12. Note that counting continues if there is a count request after overflow occurrence. Instruction cycle ee Count pulse Count request Detection of overflow Occurence of IOVF Execution of Count Executionof Interruptacceptance Execution of instruction cycle instruction processing instruction Figure 3-11. Timer/Counter Overflow Interrupt Timing 6-43-32 2000-10-19

TOSHIBA TMP47C€243/443 * Calculating the preset value of the counter register The preset value of the count register is obtained from the following relation: 2!2 - (interrupt setting time) x (internal pulse rate) For example, to generate an overflow interrupt after 100 ms at fc = 4 MHz with the internal pulse rate of fc/210, set the following value to the count register as the preset value: 212— (100 x 103) x (4x 108/2'°) = 3705 = E794 * The drop of the apparent instruction execution speed can be calculated by the following way. __, (basical clock freq.) /8 tf (Internal pulse rate) ~ 12 * 100 [%] Table 3-3. Internal Pulse Rate Selection Internal pulse rate Max. setting time fc26 [Hz] 218 /fe [3] 65536 [Hz] 0.0625 [3] f/28 220 / fc 16384 0.25 fc/210 222 / fc 4096 1 fo214 226 / fc 256 16 fc/218 230 / fc 16 256 fe/222 234 /fe 1 4096 (3) Pulse width measurement mode In the pulse width measurement mode, the timer/counter increments with the pulse obtained by sampling the external pins (T1, T2) by the internal pulse. As shown in Figure 3-14, the timer/counter increments only while the external pin input is high. The maximum applied frequency to the external pin input must be one that is enough for analyzing the count value. Normally, a frequency sufficient slower than the internal pulse rate setting is applied to the external pin. External input a (11, 72 pin) i t I i 1 hot Count register Figure 3-14. Pulse Width Measurement Mode Timing chart 6-43-34 2000-10-19

TOSHIBA TMP47C€243/443 TMP47C243/443 have a 8-bit successive approximate type AD converter and is capable of processing 8 analog inputs. Analog reference voltage can select VDD or R72 pin by mask option. In the hold mode, analog reference voltage is cut off automatically.

3.4.1 Circuit Configuration

poten o<| Hold

1 Oot request

(R72) L220 Ladder Resistor vass CI] Mask option Tap Decoder Reference voltage aino [ | H Comparator ' Analog Sample palin ses i ain7 [_] oP12 if oP13 P13 P12 3 2 1 ~«0 3 2 1 «0 3 2 1 ~=0 7 6 5 4 3 2 1 ~«0 Figure 3-15. Block Diagram of AD Converter

3.4.2 Control of AD converter

The operation of AD converter is controlled by a command. The command register is accessed as port addresses OP12 and OP13. AD converted value and end of conversion flag (EOCF) can be known by accessing port addresses IP12 and IP13. (1) Analog input selector (OP 12) Analog inputs (AINO through AIN7) are selected by this register. Analog input select command register (Port address: OP12) 3 2 1 0 0000: R40 (AINO) 0001: R41 (AIN1) 0010: R42 (AIN2) 0011: R43 (AIN3) 0100: R50 (AINA) 0101: R51 (AINS) 0110: R52 (AIN6) 0111: R53 (AIN7) 1***: Analog input is not selected Note: *; Don’tcare Figure 3-16. Analog input selector 6-43-35 2000-10-19

TOSHIBA TMP47C€243/443

3.4.3 How to use AD converter

Apply positive of analog reference voltage to the VDD pin and negative to the VSS pin. The AD conversion is carried out by splitting reference voltage between VAREF and VASS to bit corresponding voltage by a ladder resistor and making a judgement by comparing it with analog input voltage. R72 pin can use as the analog reference voltage with the mask option. (1) Start of AD conversion Prior to conversion, select one of the analog input AINO througn AIN7 by the analog input selector. Place output of the analog input, which is to be AD converted, in the high impedance state by setting "1". If other port is used as an output port, be careful not to execute the output instruction for any port during conversion in order to keep accuracy of conversion. AD conversion is started by setting ADS (bit1 of the AD conversion start register). When conversion ends after 24 instruction cycles, EOCF showing the end of conversion is set to “1”. Analog input voltage is sampled during the following 2 instruction cycles after setting ADS. Note: The sample and hold circuit has capacitor (Ca = 12 pF typ.) with resistor (Ra =5 kQ typ.). See I/O circuitry table. This capacitor should be charged or discharged within 2 instruction cycles. (2) Reading of an AD converted value After the end of conversion, read an AD converted value is read by splitting into lower 4 bits and upper 4 bits by the AD converted value register (IP12). Lower 4 bits of the AD converted value can be read when LRo = 0 and upper 4 bits when LRo = 1. Usually an AD converted value is stored in RAM by an instruction [IN %p, @HL]. Further, if an AD converted value is read during conversion, it becomes an indefinite value. (3) AD conversion with HOLD operation When the HOLD operation is started during the conversion, the conversion is terminated and an AD converted value becomes indefinite. Therefore, EOCF is kept clear to “0” after release from the HOLD operation. However, if the HOLD operation is started after the end of conversion (after EOCF has been set), AD converted value and status of EOCF are held. Example: Selecting analog input (AIN4), starting AD conversion, monitoring EOCF, and storing lower 4 bits and upper 4 bits of a converted value to RAM [10q] and RAM [114] respectively. LD A, #4H ; Selecting analog input (AIN4) OUT A, %0P12 LD A, #1H ; Start of AD conversion OUT A, %0P13 SLOOP : IN “%IP13, A ; To wait until EOCF goes to “1” TEST A, 3 B SLOOP LD HL, #10H ; HL 104 IN %IP12, @HL ; RAM [10y] < Lower 4 bits INC L ; Increment of L registers IN %IP12, @HL ; RAM [11H] < Upper 4 bits 6-43-37 2000-10-19

TOSHIBA TMP47C€243/443 Pulse output is used for buzzer drive and remote control carrier. Pulse output is shared with the R71 pin. Pulse output is asynchronous.

3.5.1 Circuit Configuration

Timing wan merpulse | Pulse ouput R71 (PULSE) generator | > = Carrier pulse 3 (2 1 0 ar) 1 0 Figure 3-20. Pulse Generator

3.5.2 Control of pulse

The pulse output is controlled by the command register (OP17) and R71 output latch data (bit 1 of . 0P07). At reset, the OP17 is initialized to “0000” —_—(Port address: OP17) (Initial value: 0000) and pulse output is disabled. To use the pulse 3 2 1 0 output, instruct start/stop of pulse after pulse output is enabled by the OP17. Also, pulse output is "L" level (the OP17 is cleared to “0000g”) during the HOLD operating mode. 0: Disable External LED and so foth may be destroyed if 1: Enable HOLD operation is executed during output of pulse. Therefore, HOLD operating mode should [_srem [selectsoutputmode _| be execute after pulse is stopped (after R71 0: Buzzer pulse (1/2 duty) output latch set to “1"). 1: Remo-com carrier (1/3 duty) Example: Buzzer pulse of 2 kHz is output (fc = 4 MHz) 00: fe/2", fe(2?x3) [Hz] LD A, #1001B O1: fd2", — fel(2*x3) OUT A, %OP17 ; OP17<-1001g 10: fd", — fel(2°x 3) : 11: fo, (Unused) CLR %OPO7,1 ; Pulse start i Buzzer Carrier SET %OPO7,1 ; Pulsestop . Figure 3-21. Pulse Output Control Table 3-4. Pulse Output Frequency 00 fo2" [Hz] 1.024 [kHz] fol (2?x3) [Hz] 37.9 [kHz] (fe=455 kHz) ep Ld ME 8 B75 tes 1.8 MH) 10 fo2” 4.096 fel (2x3) 375 (fe = 3.6 MHz) it fol2? 8.192 Don’t use = 6-43-38 2000-10-19

TOSHIBA TMP47C€243/443 (1) Buzzer pulse The buzzer pulse can be selected one of the four pulse rates by the program. The buzzer pulse is output only when the R71 output latch is “0”. “H” level is output when the output latch is “1”. Note: When a piezoelectric buzzer is connected to the pin, voltage may be generated by the buzzer due to thermal or mechanical shock. In such cases, there is danger of the pin being destroyed so a zener diode should always be connected for protection. voD R71 output data l i \\ i Piezo buzzer PULSE pin H J l : : R71 (PULSE) pin Figure 3-22. Circuit Example of Buzzer Pulse and Timing (2) Carrier pulse for remote control signal transmitter The remote control transmitting carrier has a frequency in Table 3-4, which is the basic clock (fc) divided by 12, 48 or 96. Also, the remote control transmitting carrier is output only when the R71 output latch is “0”. “H” level is output when the output latch is “1”. VDD R71 output data i H i i PULSE pin J i H | ee H i R71 (PULSE) pin A Figure 3-23. Circuit Example of Carrier Pulse and Timing R82 pin is used for zero-cross detection input (ZIN) and zero-cross detection can be performed by connecting and external capacitor. To use the zero-cross detector, the R82 output latch must be set to “1" (itisset to “1” during reset). This function can be used for commercial power supply frequency input, and time base or triac control. ZIN pin is shared by the external interrupt 1. The INT1 interrupt occurs at the falling edge of the pin input by setting interrupt enable master flip-flop (EIF) to “1”. The zero-cross detector is disable and R82 pin is set to “H” level during the hold operating mode. When driving R82 pin directly without using an external capacitor, R82 is used for normal digital input or interrupt input. INTT “4 interrupt 1 IN/TEST/TESTP i . p02 | Capacitor. ACinput H Detection Hold i signal request --4 Interrupt request Figure 3-24. Zero-cross Detector Figure 3-25. Detection Signal 6-43-39 2000-10-19

TOSHIBA TMP47C€243/443 3.7. Serial Interface (SIO) The TMP47C243/443 have a serial interface with an 8-bit buffer. 4-bit/8-bit tramsfer mode can be selected. In the 8-bit transfer mode, data may be transmitted and received simultaneously. The serial interface is connected to the exterenal device via 3 pins (the serial port): R92 (SCR), R91 (SO), and R90 (SI). The serial port is shared by port R9. For the serial port, the output latch of port R9 must be set to "1". In the transmit mode, R90 pin provides the I/O port; in the receive mode, R91 pin provides the I/O port.

3.7.1 Configuration of Serial Interface

Figure 3-26 shows configuration of serial interface. 2nd access Ist access Eg= act Transmit mode: OPOF 3.92 1 0 3 21 0 Receive mode: POF 7,6 5 4 3 2 1 0 32 19. oPte oPtF rl i r] iPoe tt i 3.2 ~1 ~0 3.02 1 ~0 i []so Serstaata Controller (Shift counter) in 8-bit mode in 4-bit mode H

51 Serial data

Serial clock 1 ag Serial data Interrupt request. oO SCK to (Buffer full or Buffer empty) H Figure 3-26. Configuration of Serial Interface

3.7.2 Control of Serial Interface

The serial interface is controlled by command registers (OP1E, OP1F). The operating states of the serial interface can be monitored by the status register (IPOE). 6-43-40 2000-10-19

TOSHIBA TMP47C€243/443

3.7.3 Serial clock

For the serial clock, one of the following can be selected according to the contents of the command registers: (1) Clock source selection a. Internal clock The serial clock frequency is selected by command register 1. The serial clock is output on the SCK pin. Note that the start of transfer, the SCK pin output goes high. When writing (transmitting) or reading (receiving) data in a program does not catch up the serial clock rate, this device stops the serial clock autmatically. Additionally it provides the wait function in which the shift is not occurred until this processing is completed. The highest transfer rate based on the internal clock is 93750 bits/second (at fc = 6 MHz). b. External clock The signal obtained by the clock supplied to the SCK pin from the outside is used for the serial clock. In this case, the output latch of R92 (SCK) must be set to "1" beforehand. For the shift operation to be performed correctly, each of the serial clock high and low levels needs 2 instruction cycles or more to be completed. (2) Shift edge selection a. Leading edge Date is shifted at the leading edge (the falling edge of SCK pin input) of the serial clock. b.Trailing edge Data is shifted at the trailing edge (the rising edge of SCK pin input) of the serial clock. However, in the transmit mode, the trailing-edge shift is not supported.

3.7.4 Transfer bit number

SBIT (bit 2 of the command register 2) can select 4-bit/8-bit serial transfer. (1) 4-bit serial transfer In this mode, transmission/reception is performed on 4-bit basis. ISIO interrupt is generated every 4- bit transfer. Transmit/receive data is written/read by accessing the buffer register (OPOF/IPOF) respectively. (2) 8-bit serial transfer In this mode, transmission/reception is performed on 8-bit basis. ISIO interrupt is generated every 8- bit transfer. Transmit /receive data is written / read by accessing the buffer register (OPOF / IPOF) twice. At the first access after setting transfer mode or generating the interrupt request, the write/read operation of lower 4-bit is performed to from the buffer register. At the second access, that of upper 4-bit is performed. 6-43-42 2000-10-19

TOSHIBA TMP47C€243/443

3.7.5 Transfer modes

Selection between the transmit mode, the receive mode (at transferring 4 bit) and the transmit and receive mode (at transferring 8 bit) is performed by RM (bit 2 of the command register 2). Switching the transfer modes should be implemented after specifying the end of transferring (clears ESIO to “0") and conferring the end of transferring (SIOF). (1) Transmit mode The transmit mode is set to the command register than writes the first transmit data (4 bits or 8 bits) is written to the buffer register (OPOF). (If the transmit mode is not set, the data is not written to the buffer register). In the 8-bit transfer mode, the 8-bit data is wirtten by accessing the buffer register (OPOF) twice. The transmit data is written after the 8-bit transfer mode is set or an interrupt request occurs: the lower 4 bits are written by the first access and the upper 4 bits by the next access. Then, setting ESIO to "1” starts transmission. The transmit data is output to the SO pin in synchronization with the serial clock from the LSB side sequentially. When the LSB is output, the transmit data is moved from the buffer register to the shift register. When the buffer register becomes empty, the buffer empty interrupt (ISIO) to request for the next transmit data is generated. In the interrupt service program, when the nexttransmit data tis written o the buffer register, the interrupt request is reset. In the operation based on the internal clock, if no more data is set after the transmission of the 4-bit or 8-bit data, the serial clock is stopped and the wait state sets in. In the operation based on the external clock, the data must be set in the buffer register by the time the next data shift operation starts. Therefore, the transfer rate is determined by the maximum delay time between the occurrence of the interrupt request and the writing of data to the buffer register by the interrupt serviced program. To end transmission, ESIO is cleared to "0" instead of writing the next transmit data by the buffer empty interrupt service program. When ESIO is cleared,transmission stops upon termination of the currently shifted-out data. The transmission end can be known by the SIOF state (SIOF goes “0” upon transmission end). In the operation based on the external clock, ESIO must be cleared to “0” before the next data is shifted out. If ESIO is not cleared before, the transmission stops upon sending the next 4-bit or 8-bit data (dummy). Example: Transfers the data stored in the data memory (specified by DMB, HL register pair) in the internal clock operation (fc/2’). (8 bit serial transferring). LD A, #0101B OUT A, %OP1E LD A, #0010B OUT A, %OP1F OUT @HL, ZOPOF INC L OUT @HL, ZOPOF LD A, #1010B OUT A, %OP1F 6-43-43 2000-10-19

TOSHIBA TMP47C€243/443 i ESIO KR i SIOF SEF | LT

50 VexXmren Xo = 11

—_._ $a SB D D (a) Internal-clock-based operation with wait clear SIO ESIO Lo. ~~~ fh SIOF L SEF TJ ff so X05 X os X07 KX o0'X 01X04, Cox Kos Xo*/ IsIo a {$$$ $B D Do (b) External-clock-based operation Figure 3-29. Transmit Mode (2) 4-bit receive mode Data can be received when ESIO is set to "1” after setting the receive mode to the command register. The data is put from the SI pin to the shift register in synchronization with the serial clock. Then the 4/8-bit data is transferred from the shift register to the buffer register (IPOF),upon which the (buffer full)interrupt (ISIO) to reguest for readingreceived data is generated. The receive data is read from the buffer register by the interrupt service program. When the data has been read, the interrupt request is reset and the next data is put in the shift register to be transferred to the buffer register. In the operation based on the internal clock, if the previous receive data has not been read from the buffer register at the end of capturing the next data, the serial clock is stopped and the wait operation is performed until the data has been read. In the operation based on the external clock, the shift operation is performed in synchronization with the externally-suppliedclock, so that the data must be read from the buffer register before the next receive data is transferred to it. The maximum transfer rate in the external-clock-based operation is determined by the maximum delay time between the generation of interrupt request and the reading of receive data. In the receive mode, the shift operation may be performed at either the leading edge or the trasiling edge. In the leadingedge shift operation,data is captured at the leading edge of the serial clock, so that the first shift data must be put in the SI pin before the first serial clock is applied at the start of transfer. 6-43-44 2000-10-19

TOSHIBA TMP47C€243/443 To end the receive operation, ESIO must be cleared to "0". When ESIO is cleared, the completion of the transfer of the current 4-bit data to the buffer register terminates the receive operation. To confirm the end of the receive operation by program, SIOF (bit 3 of the status register) must be sensed. SIOF goes “0” upon the end of receive operation. Note: If the transfer modes are changed, the contents of the buffer register are lost. Therefore, the modes should not be changed until the last received data is read even after the end of reception is instructed (by clearing ESIO to “0”). The receive operation can be terminated in one of the following approaches determined by the transfer rate: a.When the transfer rate is sufficiently low (the external-clock-based operation): If ESIO can be cleared to “0” before the next serial clock is applied upon occurrence of buffer full interrupt in the external-clock-based operation, ESIO is cleared to "0" by the interrupt service program, then the last received data is read. Example: To instruct receive end with sufficien flow transfer rate (the leading edge shift). LD A, #0111B ; ESIO <0 (Instruct reception end) OUT A, %OP1E IN %IPOF A ; Acc <IPOE (Reads received data) b.When the transfer rate is high (the internal/external clock-based operation): If the transfer rate is high and,therefore, it is possible that the capture of the next data starts before ESIO is cleared to “0” upon acceptance of any interrupt, ESIO must be cleared to "0" by confirming that SEF (bit 2 of the status register) is set at reading the data proceeding the last data. Then, the data is read. In the interrupt serevicing following the reception of the last data, no operation is needed for termination; only the reading of the received data is performed. This method is generally employed for the internal-clock-based operations. For an external-clock- based operation, ESIO must be cleared and the received data must be read before the last data is transferred to the buffer register. Example: To instruct reception end when transfer rate is high (the internal clock, leading- edge shift). SSEFO : TEST “IPOE, 2 ; Waits until SEF = "1" B SSEFO LD A, #0110B 7 ESIO<—O OUT A, %OP1F IN %IPOF, A ; Acc <—IPOF (Reads received data) 6-43-45 2000-10-19

TOSHIBA TMP47C€243/443 c. One-word reception When receiving only 1 word, ESIO is set to ”1” then it is cleared to “0” after confirming that SEF has gone "1". In this case, buffer full interrupt is caused only once, so that the received data is read by the interrupt service program. Example: To instruct the start/end of 1-word reception (the internal clock, the trailing edge shift). LD A, #0100B ; OP1F <-0100s (Sets in the receive mode) OUT A, %OP1F EI ; EIF —1 (Enables interrupt) LD A, #1110B ; ESIO <1 (Instructs reception start) OUT A, %OP1F SSEFO : TEST ZIPOE, 2 ; Confirms that SEF ="1" B SSEFO LD A, #0100B ; ESIO —0 (Instructs reception end) OUT A, %OP1F 6-43-46 2000-10-19

TOSHIBA TMP47C€243/443 SEF V L_ si ZZZKEX EX EK EKKO oe eX orKorKerX] om Isio = FAY READ (IPOF) So Xf LS (a) Internal-clock-based operation, trailing-edge-shift (with wait) Clear ESIO ESIO ee ‘SIOF hy SEF () sek a st ED, ED 9, C9 C9 ED CD CD CF) Ci9 C79 Ci $8 VM CA READ (IPOF) 4 o 6 (b) External-clock-based operation, leading-edge shift (when transfer rate is low) | Clear ESIO | ESIO ee a SIOF K SEF 7 if si VM XX KK KOK KOKO KOKOKOY ss MLL | READ (IPOF) } 6 } (©) Internal-clock-based operation, leading-edge-shift (when transfer rate is high) Figure3-30. 4-bit Receive Mode 6-43-47 2000-10-19

TOSHIBA TMP47C€243/443 (3) 8-bit Transmit/Receive Mode After setting the transmition/reception mode to the command register, write first transmit data into the buffer register. Then, when “1” is set to ESIO, data transmition/reception becomes possible. The transmit data is output to the SO pin at the leading edge of serial clock and the receive data is input from the SI pin at the trailing edge. If the shift register is filled with the receive data, the data is transferred to the buffer register and ISIO (buffer full) interrupt is generated to request data read. The received data is read from the buffer register by the interrupt service program, and then write the transmit data to the buffer register. Lower order 4 bits of both transmit and receive data are read/written from/into the buffer register by first access after setting of transmition/reception mode or generation of ISIO and higher 4 bits by next access. In the operation based on the internal clock, SIO becomes the wait state until the received data are read out and the next data to be transmitted are written. In the operation based on the external clock, the shift operation is synchronized with the external clock ; therefore, it is necessary to read the data received and to write data to be sent next before starting the next shift operation. The maximum transfer rate using an external clock is determined by the maximum delay time between the generation of the interrupt request and the writing of the data to be transmitted after the reading of the received data. Also, the buffer register is used for both transmission and reception, therefore, the data must be written after reading 8 bits of receive data. This operation is ended by clearing ESIO to “0”. When ESIO is cleared, this operation is ended after transfer of the current 8 bits od data to the buffer register is completed. Programs can confirm that the operation has been completed by sensing SIOF (bit 3 of the status register) because SIOF is cleared to “0” when the operation is completed. Example 1: To write data to be transmitted and to instruct the transmit/receive start. LD A, #0110B ; Sets the 8-bit transfer and serial clock frequency. OUT A, “%OP1E LD A, #0110B ; Sets the transmit/receive mode of internal clock operation OUT A, %OP1F LD HL, #20H ; OPOFeRAM[204] (Writes lower 4-bit data to be transmitted) OUT @GHL, %OPOF INC L ; OPOFRAM[214] (Writes upper 4-bit data to be transmitted) OUT GHL, “OPOF LD A, #1110B ; ESIO <1 (Instructs serial transfer start) OUT A, %OP1F 3 ; Data transfer Example 2: To read data received and to write next data to be transmitted. LD HL, #30H ; Stores lower 4-bit data received in RAM[30y]. IN %IPOF, @HL INC L ; Stores upper 4-bit received in RAM[314]. IN %IPOF, @HL LD HL, #22H ; Writes next lower 4-bit data to be transmitted. OUT GHL, “OPOF INC L ; Writes next upper 4-bit data to be transmitted. OUT @GHL, %OPOF 6-43-48 2000-10-19

TOSHIBA TMP47C€243/443 a ESIO a co SIOF I SEF ee Ly 1 see LL ik so ee @me) DeEhece T7 si XowXonXoa) YoaXoeXor }]XonXonr') XomXoeXor] | sO —__y wi H > CD Ch WD, Cam Xor (a) Internal clock based operation with wait. | Clear SIO - OH ESIO - O05 SIOF SA ‘SEF ee LJ \\ ] \\ see LLL aaa so oaXon1) Gail 008 KooeX 01) Gooy(oaiy Goa") YoosyGo8yoor7. SI SD CD CD CH CD). C9 ED) C9, Clp crc) Ca, io —__ Ml

2 Yeo Fe Fe

(b) External clock based operation Figure 3-31. 8-bit Transmit/Receive Mode

3.7.6 Stopping serial transfer

Aserial transfer operation can be stopped forcibly. It is stopped by setting INH (bit 3 of command register 1) to “1”, clearing the shift counter. When the serial transfer is over, INH is automatically cleared to “0” with no other bits of command register affected. In the transmit mode of this case, SCK and SO output are initialized to “H” level whereas the shift register is not cleared. Therefore, after the resumption of transmit, SO holds the data just before forcible stop via the shift register until the 1st shift data comes to SO. 6-43-49 2000-10-19

TOSHIBA TMP47C€243/443 Port Condition by RESET Operation The transition of Port condition by RESET operation is shown as below. Supply voltage t (RESET) : — VIH2 VIH2 RESET (input) : VIL2 A Internal Kare - > Operation of : : : Sete oore Determines di i the \\ Determines depend th and/O port Initialization result or program gxecution initialization) resuit of program execution —> 4 Fe] Condition of port by Power on reset ———>|~<— Condition of port at resetting during. ———> power supply is stable Figure 3-32. Port condition by Reset operation Note 1: t (RESET) > 24/fc Note 2: VIL2: Stands for low level input voltage of RESET pin. VIH2: Stands for high level input voltage of RESET pin. Note 3: The term from power on reset to the time program is executed (above ) and also the term starting from reset operation during power supply is stable to the program is executed (above @®), the port is on the initial condition. The initial condition of Port differs from I/O circuit by each port, refer to the section of “INPUT/OUTPUT CIRCUITRY”. Thus, when using Port as an output pin, in the term of the above © and @, the voltage level on the signal that connects with the output pin of Port to the input pin of external application circuit should be determined by the external circuitry such as pull-up resistor and / or pull-down resistor. 6-43-50 2000-10-19

TOSHIBA TMP47C€243/443 Input / Output Circuitry The input/output circuitries of the TMP47C243/443 are shown as below, any one of the circuitries can be chosen by a code (SA, SD or SG) as a mask option. (1) Control pins [ewe [we] awww | [ass sd fenabl lenable . ae Resonator connecting pins XIN Input R =1kQ(typ.) XOUT Output R Ry Ro R Re Ro} Rr =1-5MQ(typ.) Ceramic or Ro =2k2 (typ) Crystal LJ RC LJ XIN XOUT XIN XOUT VDD Hysteresis input — Rin Pull-up resistor RESET Input R Riy = 220 kO ( typ.) R=1k2(typ.) HOLD Input R Hysteresis input. (KEO) (Input) SY Ww O R= 1k0Q (typ.) 6-43-51 2000-10-19

(2) W/O ports Taput/ Output Grclry and Code Sink open drain Initial “Hi-2" veo cutpet 5 R=1k2 (typ.) Ra vO AINselector R High current (R5) RS lo. = 20 mA (typ.) Comp. Ra Analog input Ca as Ra =5k0 (typ.) Ca= 12 pF (typ.) vop i Initial “Hiez” Sink open drain RG output R70 | vo —toH R=1k2 (typ) R71 R High current (R6) lol = 20 mA (typ.) A Pe Initial "Hi-2” output VDD Rrer R=1kQ (typ.) R72 | vo aS Ww p O Analog reference p | enable voltage suply R Rrer = 10 KA(typ.) vop j i Initial "Hi-2” Sink open drain output E R R=1k2 (typ.) vo enable Zero-cross input Rzc Rzc = 1 MO (typ.) aie vod Sink open drain R80 Initial “Hi-Z output R81 vo —Po— R83 R Hysteresis input RO R=1k2 (typ.) 6-43-52 2000-10-19

TOSHIBA TMP47C€243/443

Electrical Characteristics

Absolute Maximum Ratings (Vsg = 0 V) symbol [Ping | atings | uit] Supply Voltage [vo [oo = 03 106.5 Input Voltage Povw [oT 03 1000+ 0.3 Output Voltage | Vor [oo 03 t0V09 + 0.3 Port RS, R6 | 30 Output Current (Per 1 pin) UT mA Ports R4, R7, RB, RO Output Current (Total) Port RS, R6 [20 ma Power Dissipation {Topr=70°C] | sop | 180 | mw | ssop [a5 | Soldering Temperature (time) | tid | 2860(109) Storage Temperature Pomtg [= 8510 125 Operating Temperature [topo P= 304070 Note: The absolute maximum ratings are rated values which must not be exceeded during operation, even for an instant. Any one of the ratings must not be exceeded. If any absolute maximum rating is exceeded, a device may break down or its performance may be degraded, causing it to catch fire or explode resulting in injury to the user. Thus, when designing products which include this device, ensure that no absolute maximum rating value will ever be exceeded. Recommended Operating Conditions| (Vss=0V, Topr= - 30 to 70°C) symbol | Pins | conalions win max | unit | fc= 8.0 MHz Supply Voltage Voo fc= 4.2 MHz 55 v IntheHOLDmode | 20 ‘| Except Hysteresis Input In the normal Input High Voltage operating area Voox0.75 | Yoo v | vws | inthe HOLD mode Except Hysteresis Input In the normal Input Low Voltage operating area Vox0.25 | Vv [vis [inthe HOLD mode Vop=2.7t05.5V [a0 | Clock Frequency fe | XIN, XOUT Vop=2.2to 5.5V In the RC oscillation Note: The recommended operating conditions for a device are operating conditions under which it can be guaranteed that the device will operate as specified. If the device is used under operating conditions other than the recommended operating conditions (supply voltage, operating temperature range, specified AC/DC values etc.), malfunction may occur. Thus, when designing products which include this device, ensure that the recommended operating conditions for the device are always adhered to. 6-43-53 2000-10-19

TOSHIBA TMP47C€243/443 DC Characteristics (Vsg =0 V, Topr = - 30 to 70°C) symboi] rns contin | in | tym | a | un RESET, HOLD Input Current Vpp =5.5V, Vin=5.5V/0V #2 | pA ‘Output Leakage Current lo | Open drain output ports Vp =5.5V, Vour=5.5V uh Output Low Voo=45V,lost6ma | - | - | oa | Voltage Vor | Port R4, R7, R8, R9 v Supply Current (in the Normal Vop =3.0V, fe=4MHz |- [1 [2] mA operating mode) Supply Current {in the HOLD Vpp = 5.5V 10 | pA operating mode) Note 1: Typ. values show those at Topr = 25°C, Vpp =5 V. Note 2: Input Current Iy;: The current through resistor is not included. AD Conversion Characteristics (Topr = - 30 to 70°C) a od Vpp=2.7 to 5.5V factonrn | ET Varer = Vpp + 0.001 V LSB Vss = £0.001 V foster ++ ees 6-43-54 2000-10-19

AC Characteristics (Vs5 =0 V, Topr = - 30 to 70°C) symbol | conattons | win | tye [x | unt | a High level clock pulse width twen ; (XIN input) Low level clock pulse width t ow level clock pulse wi wel Voo<2.7V Jao comeniontine we | | te | = we shit ata Hol Tine pow | aston | = T= os | Note 1: AD conversion timing: Internal circuit for pins AINO to 7 AD conversion timing AIN selector ADS l Comp. + (Hi-Z) 12 pF SkA(t tos TM) cor Ye * Electrical change inust be loaded into the buit-in condensen during tain for normal selector —_—— ' 1 i i‘ AD l conversion re Note 2: Shift data Hold Time: External circuit for pins SCK andso Serial port (completed of transmission) voD ‘SCK 10ka 15V tspH r 50 pF so 1.5V 6-43-55 2000-10-19

TOSHIBA TMP47C€243/443 Zero-Cross Detection Characteristics (Vss =0 V, Topr = - 30 to 70°C) ed [iacceanpavaine | ve acomingte-onm |e | - | a0 | we | Peawcowncay | wae [e=siosvetinecwen | - | =| av | wv | [sxccenimatennny | te | | | | | me | is Note 3: Zero-cross detection input: << —_$§_>| External circuit for pin ZIN \\ i iY |e Vn 170s Detection i i I i signal | | Recommended Oscillating Conditions (Vsg =0 V, Vpp = 2.5 to 5.5 V, Topr = - 30 to 70°C) (1) 8 MHz (Vss = 0 V, Vpp =2.7 to 5.5 V, Topr = - 30 to 70°C) XIN XOUT Ceramic Resonator 8 MHz KBR-800M (KYOCERA) xin = Cxour = 30 pF aMHe Crystal Oscillator ia] 210B-6F 8.0000 (TOYOCOM) Cxin = Cxout = 20 pF Cin, Zz a Cxour (2) 4MHz (Vss = 0 V, Vpp =2.2 to 5.5 V, Topr = - 30 to 70°C) Ceramic Resonator CSA4.00MG (MURATA) Cxin = Cxout = 30 pF XIN XOUT KBR-4.00MS (KYOCERA) Cxin = Cxout = 30 pF EFOEC4004A4 (NATIONAL) Cxin = Cxourt = 30 pF Crystal Oscillator 400 kHz Rxour 204B-6F 4.0000 (TOYOCOM) Cxin = Cxout = 20 pF LU in ae J Cxour (3) 400 kHz (Vss = 0 V, Vpp = 2.2 to 5.5 V, Topr = - 30 to 70°C) Ceramic Resonator CSB400B (MURATA) Cxin = Cxout = 220 pF, RxouT=6.8kQ XIN XOUT KBR-400B (KYOCERA) Cxin = Cxout = 100 pF, Rxqut = 10 ka EFOA400K04B (NATIONAL) Cxin =Cxout =470 pF, RxouT=00 RC (4) RC Oscillation (Vss =0 V, Vpp = 5.0 V, Topr = 25°C) xin, 2 MHz (Typ.) Cxin = 33 pF, Rx = 10 ka > 400 kHz (Typ.) Cxin = 100 pF, Rx = 30 kQ 6-43-56 2000-10-19

TOSHIBA TMP47C€243/443 Typical Characteristics R R-Ta RESET pin ch fone TTT | ELE 300 | | ‘es PEEL 100 LLit | |. -40 0 40 80 (°C) jo, LOL WoL __R4,R7, RB, RI port 1p, toLzVow R5, R6 port lo. lo. LOA} CELT bse ap4Pan AunD24n i0/2ca0 eer > We A 10 y Ko -T | ACL), Wet... \\ Ipp - Vop \\ Ipp - fe ‘ Operating area DD. DD ic imafrosase | [| | ematecave | UTI 2 cteae | ee | ee 15 15 py 6 Y rystal Y 20 ee 2 | ee | | ee | Ll B28

0 Vp 0 UT sp fe 0 — os cor VDD

2 4 6 (Vv) 0.1 04 1 4 10(MHz) 2 4 6 (v) fco-Rx (RC) fc-Vpp (RC) Rx fc ——— (ka) |Yoo=5V (MHz) | Cxin = 33 pF EE Ta=25°C a ———

0 Seacce

“CUUNI TTI =» feces “i oe LT NUK rial «eS ‘Een. ESECC oLeaitIN « oLLtLt tl fy, 01 04 1 4 10(MHz) 2 4 6 wv) 6-43-57 2000-10-19