TOSHIBA TLCS-900 Series TMP95C061 CMOS 16-bit Microcontrollers (4) External memory expansion • Can be expanded up to 16M bytes (for both programs and TMP95C061F data) • AM8/16 pin (select external data bus width) 1. Outline and Device Characteristics • Can mix 8- and 16-bit external data bus width. …Dynamic data bus sizing TMP95C061F is a high-speed advanced 16-bit microcontrol- ler developed for controlling medium to large-scale equipment. (5) DRAM Controller The TMP95C061F is housed in an 100-pin flat package. (6) 8-bit timer: 2 channels Device characteristics are as follows: (7) 16-bit timer: 2 channels (8) Pattern generators: 4 bits, 2 channels (1) Original 16-bit CPU (9) Serial interface: 2 channels • TLCS-90/900 instruction mnemonic upward compatible. (10) 10-bit A/D converter: 4 channels • 16M-byte linear address space (11) Watchdog timer (12) Chip select/wait controller: 4 blocks • General-purpose registers and register bank system (13) Interrupt functions • 16-bit multiplication/division and bit transfer/arithmetic • 2 CPU interrupts… …SWI instruction and Illegal instruction instructions • 18 internal interrupts • High-speed DMA 7-level priority can be set. • 6 external interrupts - 4 channels (640ns/2 bytes at 25MHz) (14) I/O ports: 56 pins (2) Minimum instruction execution time (15) Standby function : 3 HALT modes (RUN, IDLE, STOP) - 160ns at 25MHz (3) Internal RAM: None Internal ROM: None The information contained here is subject to change without notice. The information contained herein is presented only as guide for the applications of our products. No responsibility is assumed by TOSHIBA for any infringements of patents or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of TOSHIBA or others. These TOSHIBA products are intended for usage in general electronic equipments (office equipment, communication equipment, measuring equipment, domestic electrification, etc.) Please make sure that you consult with us before you use these TOSHIBA products in equip- ments which require high quality and/or reliability, and in equipments which could have major impact to the welfare of human life (atomic energy control, spaceship, traffic signal, combustion control, all types of safety devices, etc.). TOSHIBA cannot accept liability to any damage which may occur in case these TOSHIBA products were used in the mentioned equipments without prior consultation with TOSHIBA. TOSHIBA CORPORATION 1 TMP95C061 Figure 1. TMP95C061 Block Diagram 2 TOSHIBA CORPORATION TMP95C061 2. Pin Assignment and Functions 2.1 Pin Assignment The assignment of input/output pins for TMP95C061, their Figure 2.1 shows pin assignment of TMP95C061. name and outline functions are described below. Figure 2.1. Pin Assignment (100-pin QFP) TOSHIBA CORPORATION 3 TMP95C061 2.2 Pin Names and Functions described below. The names of input/output pins and their functions are Table 2.2. Pin Names and Functions 4 TOSHIBA CORPORATION TMP95C061 TOSHIBA CORPORATION 5 TMP95C061 6 TOSHIBA CORPORATION TMP95C061 3. Operation When reset is released, instruction execution starts from This section describes in blocks the functions and basic oper- PC reset vector. CPU internal registers other than the above ations of TMP95C061 device. are not changed. Check the [7. Care Points and Restriction] because of the When reset is accepted, processing for built-in I/Os, Care Points, etc., are described. ports, and other pins is as follows: • Initializes built-in I/O registers as per specifications. 3.1 CPU • Sets port pins (including pins also used as built-in I/Os) to TMP95C061 device has a built-in high-performance 16-bit general-purpose input/output port mode. CPU (900/H CPU). (For CPU operation, see TLCS-900 CPU in • Sets the WDTOUT pin to 0. (Watchdog timer is set to enable the previous section.) after reset.) This section describes CPU functions unique to • Pulls up the CLK pin to 1. TMP95C061 that are not described in the previous section. 3.1.2 External Data Width Selection Pin (AM18/16) 3.1.1 Reset After reset operation, TMP95C061, the operates 8 bits or 16 To reset the TMP95C061, the RESET input must be kept at 0 bits external data width according to input to AM8/16 pin. for at least 10 system clocks (10 states: 800ns with a 25MHz system clock) within an operating voltage range and with a • Fixed 16 bit bus or 16 bit bus interlarded with 8 bit stable oscillation. bus When reset is accepted, the CPU sets as follows: “0” should be input. Port 1 (P10 to P17) operate as • Program Counter (PC) to 8000H. data bus D8 to 15. The data bus width for external PC (7 : 0) ← stored data to 0FFFF00H access is set by Chip Select/Wait Control resistor. PC (15 : 8) ← stored data to 0FFFF01H PC (23 : 16) ← stored data to 0FFFF02H • Fixed 8 bit bus • Stack pointer (XSP) for system mode to 100H. • IFF2 to 0 bits of status register to 111. (Sets mask register to “1” should be input. Port 1 (P10 to P17) operate as 8 interrupt level 7.) bit data I/O ports. The value set in Chip Select/Wait • MAX bit of status register to 1. (Sets to minimum mode.) Control resistor , , , • Bits RFP2 to 0 of status register to 000. (Sets register banks and are neglected. to 0.) TOSHIBA CORPORATION 7 TMP95C061 3.2 Memory Map Figure 3.2 shows a memory map of the TMP95C061. Figure 3.2. Memory Map 8 TOSHIBA CORPORATION TMP95C061 3.3 Interrupts flip-flop (IFF2 to 0) and the built-in interrupt controller. TLCS-900 interrupts are controlled by the CPU interrupt mask TMP95C061F has the following 26 interrupt sources: • Interrupts from the CPU…2 (Software interrupts, privileged violations, and Illegal (undefined) instruction execution) • Interrupts from external pins (NMI, INT0, and INT4 to 7)…6 • Interrupts from built-in I/Os…14 • Interrupts from high-speed DMA (HDMA)…4 A fixed individual interrupt vector number is assigned to with a priority of 3 or greater, and non-maskable interrupts each interrupt source; six levels of priority (variable) can also be which are set in the interrupt controller. The DI instruction assigned to each maskable interrupt. Non-maskable interrupts (IFF<2:0> = 7) operates in the same way as the EI 7 instruc- have a fixed priority of 7. tion. Since the priority values for maskable interrupts are 0 to 6, When an interrupt is generated, the interrupt controller the DI instruction is used to disable maskable interrupts to be sends the value of the priority of the interrupt source to the accepted. The EI instruction becomes effective immediately CPU. When more than one interrupt is generated simulta- after execution. (With the TLCS-90, the EI instruction becomes neously, the interrupt controller sends the value of the highest effective after execution of the subsequent instruction.) priority (7 for non-maskable interrupts is the highest) to the In addition to the general-purpose interrupt processing CPU. mode described above, there is also a high-speed DMA The CPU compares the value of the priority sent with the (HDMA) processing mode. HDMA is a mode used by the CPU value in the CPU interrupt mask register (IFF2 to 0). If the value to automatically transfer byte, word and 4-byte data. It enables is greater than that of the CPU interrupt mask register, the the CPU to process interrupts such as data saves to built-in I/Os interrupt is accepted. The value in the CPU interrupt mask reg- at high speed. ister (IFF2 to 0) can be changed using the EI instruction (con- Figure 3.3 (1) is a flowchart showing overall interrupt tents of the EI num/IFF<2:0> = num). For example, processing. programming EI 3 enables acceptance of maskable interrupts TOSHIBA CORPORATION 9 TMP95C061 Figure 3.3 (1). Interrupt Processing Flowchart 10 TOSHIBA CORPORATION TMP95C061 3.3.1 General-Purpose Interrupt Processing Bus Width Interrupt Processing State Number Bus Width of When accepting an interrupt, the CPU operates as follows: Interrupt Stack Area MAX mode Min mode Vector Area (1) The CPU reads the interrupt vector from the interrupt 8 bit 23 24 controller. When more than one interrupt with the 8 bit same level is generated simultaneously, the interrupt 16 bit 24 20 controller generates interrupt vectors in accordance 8 bit 22 20 16 bit with the default priority (which is fixed as follows: the 16 bit 18 16 smaller the vector value, the higher the priority), then clears the interrupt request. To return to the main routine after completion of the inter- rupt processing, the RETI instruction is usually used. Executing (2) The CPU pushes the program counter and the status this instruction restores the contents of the program counter register to the system stack area (area indicated by the and the status registers and decements the INTNEST (Inter- system mode stack pointer(XSP)). rupt Nesting Counter). Though acceptance of non-maskable interrupts cannot be disabled by program, acceptance of maskable interrupts (3) The CPU sets a value in the CPU interrupt mask regis- can. A priority can be set for each source of maskable inter- ter that is higher by 1 than the value of the rupts. The CPU accepts an interrupt request with a priority accepted interrupt level. However, if the value is 7, 7 is higher than the value in the CPU mask register . set without an increment. The CPU mask register is set to a value higher by 1 than the priority of the accepted interrupt. Thus, if an inter- (4) The CPU increments the INTNEST (Interrupt Nesting rupt with a level higher than the interrupt being processed is Counter). generated, the CPU accepts the interrupt with the higher level, causing interrupt processing to nest. If an interrupt generated while the CPU is performing pro- (5) The CPU jumps to address FFFF00H + interrupt vec- cesses (1) to (5) for an earlier interrupt, the new interrupt is tor, then starts the interrupt processing routine. sampled immediately after the start instruction of the interrupt processing is executed. Setting DI as the start instruction dis- ables maskable interrupt nesting. (Note: With the 900 and 900/L, an interrupt is sampled before the start instruction is executed.) Resetting initializes the CPU mask registers to 7; therefore, maskable interrupts are disabled. The addresses 0FFFF00H to 0FFFFFFH (256 bytes) of the TMP95C061 are assigned for interrupt processing entry area. TOSHIBA CORPORATION 11 TMP95C061 Table 3.3 (1) TMP95C061 Interrupt Table 12 TOSHIBA CORPORATION TMP95C061 Setting to Reset/Interrupt Vector TOSHIBA CORPORATION 13 TMP95C061 3.3.2 High-Speed DMA (HDMA) The priority of the HDMA transfer end interrupt gener- In addition to the conventional interrupt processing, ated at this time is determined by its interrupt level and TMP95C061 also has a high-speed DMA (HDMA) function. default priority, same as with other maskable inter- Each interrupt request starts HDMA operation in level “6” irrele- rupts. vant to the set interrupt level. Level “6” is the interrupt level The priorities of HDMA requests generated simulta- which has the highest priority among maskable interrupts. neously in multiple channels are irrelevant to their input levels. The HDMA request which is generated in the (1) HDMA Operation channel with the small number has a higher priority. (CH0: highest priority; CH3: lowest priority). When the interrupt is generated in the interrupt request The 32-bit control registers are used for setting transfer source set by HDMA start vector resistors, the inter- source/destination addresses. However, the TLCS- rupt controller sends the HDMA request to the CPU in 900 has only 24 address pins for output. A 16M-byte level “6” irrelevant to the set interrupt level. space is available for the high-speed HDMA. There are The HDMA has four channels so that it can be set up two data transfer modes: one-byte mode and one- for up to four types of interrupt source. word mode. Incrementing, decrementing, and fixing the transfer source/destination address after transfer When an HDMA interrupt is accepted, data is auto- can be done in both modes. Therefore data can easily matically transferred from the transfer source address be transferred between I/O and memory and between to the transfer destination address set in the control I/Os. For details of transfer modes, see the description register, and the transfer counter is decremented. If the of transfer mode registers. value in the counter after decrementing is not 0, HDMA processing is completed; if the value in the The transfer counter has 16 bits, so up to 65536 trans- counter after decrementing is 0, the CPU notifies the fers (the maximum when the initial value of the transfer interrupt controller of the HDMA transfer end interrupt counter is 0000H) can be performed for one interrupt (INTTCn), zero-clears the HDMA start vector register, source by high-speed DMA processing. disables re-start of the HDMA, and ends the HDMA Interrupt sources processed by HDMA processing are processing. those with the high-speed HDMA start vectors listed in Table 3.3 (1). 14 TOSHIBA CORPORATION TMP95C061 (2) Register Configuration (CPU Control Register) These Control Registers cannot be set only “LCD cr, r” instruction. TOSHIBA CORPORATION 15 TMP95C061 (3) Transfer Mode Register Details 16 TOSHIBA CORPORATION TMP95C061 3.3.3. Interrupt Controller ables the corresponding interrupt request. The priority of the Figure 3.3.3 (1) is a block diagram of the interrupt circuits. The non-maskable interrupt (NMI pin, watchdog timer, etc.) is fixed left half of the diagram shows the interrupt controller; the right to 7. If interrupt requests with the same interrupt level are gen- half includes the CPU interrupt request signal circuit and the erated simultaneously, interrupts are accepted in accordance HALT release signal circuit. with the default priority (the smaller the vector value, the higher Each interrupt channel (total of 24 channels) in the inter- the priority). rupt controller has an interrupt request flip-flop, interrupt prior- The interrupt controller sends the interrupt request with ity setting register, and a register for storing the high-speed the highest priority among the simultaneous interrupts and its micro DMA start vector. The interrupt request flip-flop is used vector address to the CPU. The CPU compares the priority to latch interrupt requests from peripheral devices. The flip-flop value set in the Status Register by the interrupt is cleared to 0 at reset, when the CPU reads the interrupt request signal with the priority value sent; if the latter is higher, channel vector after the acceptance of interrupt, or when the the interrupt is accepted. Then the CPU sets a value higher CPU executes an instruction that clears the interrupt of that than the priority value by 1 in the CPU SR . Inter- channel (writes 0 in the clear bit of the interrupt priority setting rupt requests where the priority value equals or is higher than register). the set value are accepted simultaneously during the previous For example, to clear the INT0 interrupt request, set the interrupt routine. When interrupt processing is completed (after register after the DI instruction as follows. execution of the RETI instruction), the CPU restores the priority value saved in the stack before the interrupt was generated to the CPU SR . INTE0AD←---- 0 --- Zero-clears the INT0 Flip-Flop. The interrupt controller also has four registers used to store the HDMA start vector. These are I/O registers; unlike The status of the interrupt request flip-flop is detected by other HDMA registers (DMAS, DMAD, DMAM, and DMAC), reading the clear bit. Detects whether there is an interrupt they can be accessed in either normal or system mode. Writing request for an interrupt channel. the start vector of the interrupt source for the HDMA processing The interrupt priority can be set by writing the priority in (see Table 3.3 (1)), enables the corresponding interrupt to be the interrupt priority setting register (e.g., INTE0AD, INTE45, processed by micro HDMA processing. The values must be set etc.) provided for each interrupt source. Interrupt levels to be in the HDMA parameter registers (e.g., DMAS and DMAD) prior set are from 1 to 6. Writing 0 or 7 as the interrupt priority dis- to the micro HDMA processing. TOSHIBA CORPORATION 17 TMP95C061 Figure 3.3.3 (1). Block Diagram of Interrupt Controller 18 TOSHIBA CORPORATION TMP95C061 (1) Interrupt Priority Setting Register TOSHIBA CORPORATION 19 TMP95C061 (2) External Interrupt Control Setting of External Interrupt Pin Functions 20 TOSHIBA CORPORATION TMP95C061 (3) HDMA Start Vector the HDMA transfer end interrupt processing. If the same vector is set in the HDMA start vector regis- Register used to assign HDMA processing to an inter- ters of the multiple channels, the interrupt generated in rupt source. The interrupt source whose HDMA start the channel with the smaller number has a higher prior- vector matches the vector value set in this register is ity. assigned as the HDMA start source. Thus, if the same vector is set in the HDMA start vector When the HMDA transfer counter value reaches 0, the registers of two channels, the interrupt generated in controller is notified of the HDMA transfer end interrupt the channel with the smaller number is processed until corresponding to the channel, the HDMA start vector is the HDMA transfer end. If a HDMA start vector is not cleared, and the HDMA start source of the channel is set, then the HDMA processing is started for the chan- also cleared. To continue the HDMA processing, the nel with the larger number is processed. HDMA start vector register must be set again within TOSHIBA CORPORATION 21 TMP95C061 (4) Notes request flag while reading the interrupt vector after accepting the interrupt. If so, the CPU would read the The instruction execution unit and the bus interface default vector “0028H” and start the interrupt process- unit of this CPU operate independently of each other. ing from the address “FFFF28H”. Therefore, if the instruction used to clear an interrupt To avoid this, make sure that the instruction used to request flag of an interrupt is fetched before the inter- clear the interrupt request flag comes after the DI rupt is generated, it is possible that the CPU might instruction. execute the fetched instruction to clear the interrupt 22 TOSHIBA CORPORATION TMP95C061 3.4 Standby Controller (3) STOP : All internal circuits including the built-in oscilla- When the “HALT” instruction is executed, the operating mode tor stop. This greatly reduces power con- changes RUN, IDLE, or STOP mode depending on the con- sumption. tents of the HALT mode setting register WDMOD . The HALT release depends on these three modes. For details, see “Table 3.4 (2)”. (Note: The HALT state cannot be (1) RUN : Only the CPU halts; power consumption released by HDMA start.) remains unchanged. (Example releasing “RUN” mode) INT0 interrupt releases HALT state when the RUN mode (2) IDLE : Only the built-in oscillator operates, while all is on. other built-in circuits stop. The power con- sumption is reduced to 1/10 or less than that during NORMAL operation. When the halt state is released by a reset, the status in effect before entering the halt status is hold. TOSHIBA CORPORATION 23 TMP95C061 (1) RUN Mode cuted. Only the CPU stops executing the instruction. Until the HALT state is released, the CPU repeats Figure 3.4.1 shows the timing fro releasing the HALT dummy cycles. In the HALT state, an interrupt request state by interrupts in the RUN mode. is sampled with the rising edge of the “CLK” signal. In the RUN mode, the system clock in the MCU contin- The external interrupts (INT4, 5, 6, 7) releases only ues to operate even after a HALT instruction is exe- RUN mode. Figure 3.4.1. Timing Chart for Releasing the HALT State by Interrupt in RUN Modes 24 TOSHIBA CORPORATION TMP95C061 (2) IDLE Mode In the HALT state, an interrupt request is sampled asynchronously with the system clock, however, the Figure 3.4.2 illustrates the timing for releasing the HALT HALT release (restart of operation) is performed syn- state by interrupts in the IDLE mode. chronously with it. In the IDLE mode, only their internal oscillator oper- The interrupts except NMI and INT0 is disable during ates. The system clock in the MCU stops, and the this mode. CLK pin is fixed at the “1” level. Figure 3.4.2. Timing Chart for Releasing the HALT State by Interrupts in RUN Mode TOSHIBA CORPORATION 25 TMP95C061 (3) STOP Mode WDMOD to “1”. The content of this register is initialized to “0” by resetting. Figure 3.4.3 is a timing chart fro releasing the HALT When the CPU accepts an interrupt request, the inter- state by interrupts in the STOP mode. nal oscillator is restarted immediately. However, to get The STOP mode is selected to stop all internal circuits the stabilized oscillation, the system clock starts its including the internal oscillator. In this mode, all pins output after the time set by the warming up counter except special ones are put in the high-impedance WDMOD . A warming up time of either the state, independent of the internal operation of the clock oscillation time x 214 or 216 can be set by setting MCU. Note, however, that the pre-halt state (the status this bit to either “0” or “1”. This bit is initialized to “0” by prior to execution of HALT instruction) of all output pins resetting. can be retained by setting the internal I/O register Figure 3.4.3. Timing Chart for Released by Interrupt in STOP Mode Only either the NMI, INT0, or RESET can release the release to get the stabilized oscillation because the STOP mode. warming up counter is ignored. When the STOP is released by the except RESET, the The warming up counter operates when the STOP system clock is started outputting after warming up mode is released even the system which is used as an time to get the stabilized oscillation. external oscillator. As a result, it takes warming up time When the STOP mode is released by RESET, it is nec- from inputting the releasing request to outputting the essary to keep the RESET signal at “0” long enough to system clock. 26 TOSHIBA CORPORATION TMP95C061 Table 3.4 (1) Pin States in STOP Mode TOSHIBA CORPORATION 27 TMP95C061 Table 3.4 (2) I/O Operation and Cancel During Halt Mode 28 TOSHIBA CORPORATION TMP95C061 3.5 Functions of Ports These ports are also used for internal CPU and I/O. Table The TMP95C061 has a total of 56 bits when the AM8/16 pin is 3.5 lists port pin functions. set to 1; a total of 48 bits when the AM8/16 pin is set to 0. (R: ↑ = With programmable pull-up resistor ↓ = WIth programmable pull-down) Table 3.5 Functions of Ports Number of Port Name Pin Name Direction R Direction Setting Unit Pin Name for Built-in Function Pins Port1 P10 to P17 8 I/O – Bit D8 to D15 Port2 P20 to P27 8 Output – (Fixed) A16 to A23 Port5 P50 1 I/O ↑ Bit HWR P53 1 I/O ↑ Bit BUSRQ P54 1 I/O ↑ Bit BUSAK P55 1 I/O ↑ Bit R/W Port6 P60 1 Output – (Fixed) CS0 P61 1 Output – (Fixed) CS1 P62 1 Output – (Fixed) CS2 P63 1 Output – (Fixed) CS3/CAS P64 1 Output – (Fixed) RAS P65 1 Output – (Fixed) REFOUT Port7 P70 to P77 8 I/O ↑ Bit PG00 to PG03, PG10 to PG13 Port8 P80 1 I/O ↑ Bit TXD0 P81 1 I/O ↑ Bit RXD0 P82 1 I/O ↑ Bit CTS0/SCLK0 P83 1 I/O ↑ Bit TCD1 P84 1 I/O ↑ Bit RXD1 P85 1 I/O ↑ Bit SCLK1 Port9 P90 to P93 4 Input – (Fixed) AN0 to AN3 PortA PA0 1 I/O ↑ Bit WAIT PA1 1 I/O ↑ Bit TI0 PA2 1 I/O ↑ Bit TO1 PA3 1 I/O ↑ Bit TO3 PortB PB0 1 I/O ↑ Bit TI4/INT4 PB1 1 I/O ↑ Bit TI5/INT5 PB2 1 I/O ↑ Bit TO4 PB3 1 I/O ↑ Bit TO5 PB4 1 I/O ↑ Bit TI6/INT6 PB5 1 I/O ↑ Bit TI7/INT7 PB6 1 I/O ↑ Bit TO6 PB7 1 I/O ↑ Bit INT0 TOSHIBA CORPORATION 29 TMP95C061 3.5.1 Port 1 (P10 - P17) In addition to functioning as a general purpose I/O port, Port 1 is an 8-bit general-purpose I/O port. I/O can be set on a Port 1 also functions as an address data bus (D8 to 15). bit basis using control register P1CR. Resetting resets all bits Port 1 always functions as a data bus (D8 to 15) (AM8/16 of output latch P1 and control register P1CR to 0 and sets Port = “0”). 1 to input mode. Figure 3.5 (1). Port 1 30 TOSHIBA CORPORATION TMP95C061 Figure 3.5 (2). Registers for Port 1 TOSHIBA CORPORATION 31 TMP95C061 3.5.2 Port 2 (P20 to P27) With the TMP95C061, which has no internal ROM, all Port 2 is an 8-bit general-purpose I/O port. I/O can be set on bits of P2FC are set to “1” and operate A23 to A16 after reset bit basis using the control register P2FC. Resetting resets all input. bits of output latch P2 and function register P2FC. Resetting also sets P2 to input mode. Figure 3.5 (3). Port 2 32 TOSHIBA CORPORATION TMP95C061 Figure 3.5 (4). Registers for Port 2 TOSHIBA CORPORATION 33 TMP95C061 3.5.3 Port 5 (P52 to P55) Resets all the bits of the output latch, the control register Port 5 is a 4-bit general-purpose I/O port. I/O can be set on bit P5CR and the function register P5FC to “0” and sets each port basis using control register P5CR and the function register input mode with pull-up resistors. P5FC. Resetting does the following: Figure 3.5 (5). Port5 (P50, P51, P52, P54, P55) 34 TOSHIBA CORPORATION TMP95C061 Figure 3.5 (6). Port5 (P53) TOSHIBA CORPORATION 35 TMP95C061 Figure 3.5 (7). Registers for Port5 36 TOSHIBA CORPORATION TMP95C061 3.5.4 Port6 (P60 to P65) Functions can be selected using P6FC and provided chip Port 6 is a 6-bit general-purpose output port. Resetting sets select and DRAM control functions (CS0 to 3, CAS, RAS and each output latch P62 = “0”, P60, P61, P63 to P65 = “1”. REFOUT). After resetting, each port operates as output port. Figure 3.5 (8). Port6 TOSHIBA CORPORATION 37 TMP95C061 Figure 3.5 (9). Register for Port 6 38 TOSHIBA CORPORATION TMP95C061 3.5.5 Port7 (P70 to P77) also functions as a pattern-generator PG0/PG1 output. PG0 is Port 7 is an 8-bit general-purpose I/O port. I/O can be set on a assigned to P70 to P73; PG1, to P74 to P77. Writing in the bit basis. Resetting sets Port 7 as an input port and connects corresponding bit of port 7 control register (P7CR) and func- a pull-up resistor. It also sets all bits of the output latch to 1. In tion register (P7FC) enables PG output. Resetting resets the addition to functioning as a general-purpose I/O port, Port 7 function register P7FC value to 0, and sets all bits to ports. Figure 3.5 (10). Port 7 TOSHIBA CORPORATION 39 TMP95C061 Figure 3.5 (11). Register for Port 7 40 TOSHIBA CORPORATION TMP95C061 3.5.6 Port 8 (P80 - P85) (1) Port 80, 83 (TXD0/TXD1) Port 8 is a 6-bit general-purpose I/O port, also used as an ana- log input pin. I/O can be set on a bit basis. Resetting sets Port P80 and P83 also function as serial channel TXD out- 8 as an input port and connects a pull-up resistor. It also sets put pins in addition to I/O ports. They have program- all bits of the output latch register P8 to 1. In addition to func- mable open drain function. tioning as a general-purpose I/O port, Port 8 also functions as an I/O for serial channel 1, 0. Writing “1” in the corresponding bit of Port 8 function register enables those functions. Reset- ting resets the function register value to “0”, and sets all bits to ports. Figure 3.5 (12). Port 80, 83 TOSHIBA CORPORATION 41 TMP95C061 (2) Port 81, 84 (RXD0, 1) input pins for serial channels. P81 and P84 are I/O ports, and also used as RXD Figure 3.5 (13). Port 81, 84 (3) Port 82 (CTS0/SCLK0) as a SCLK0 I/O pin for serial channels. P92 is an I/O port, and also used as a CTS input pin or Figure 3.5 (14). Port 82 42 TOSHIBA CORPORATION TMP95C061 (4) Port 85 (SCLK1) SCLK1 I/O pin for serial channel 1. P85 is a general-purpose I/O port. It is also used as a Figure 3.5 (15). Port 85 TOSHIBA CORPORATION 43 TMP95C061 Figure 3.5 (16). Register for Port 8 44 TOSHIBA CORPORATION TMP95C061 3.5.7 Port 9 (P90 to P93) for the internal A/D Converter. Port 9 is a 4-bit input I/O port, also used as analog input pins Figure 3.5 (17). Port 9 Figure 3.5 (18). Register for Port 9 3.5.8 Port A (PA0 to PA3) Port A1 as an 8-bit timer input (TI0), Port A2 as a PWM0 out- Port A is a 4-bit general-purpose I/O port. I/O can be set on a put (TO1), and Port A3 as a PWM1 output (TO3) pin. Writing 1 bit basis. Resetting sets Port 7 as an input port and connects in the corresponding bit of the Port A function register (PAFC) a pull-up resistor. In addition to functioning as a general-pur- enables output of the timer. Resetting resets the function regis- pose I/O port, Port A0 also functions as wait input pin WAIT; ter PAFC value to 0, and sets all bits to ports. TOSHIBA CORPORATION 45 TMP95C061 Figure 3.5 (19). Port A 46 TOSHIBA CORPORATION TMP95C061 Figure 3.5 (20). Register for Port A TOSHIBA CORPORATION 47 TMP95C061 3.5.9 Port B (PB0 to PB7) clocks, an output for 16-bit timer F/F 4, 5, and 6 output, and Port B is an 8-bit general-purpose I/O port. I/O can be set on a an input for INT0. Writing “1” in the corresponding bit of the bit basis. Resetting sets Port B as an input port and connects Port B function register (PB FC) enables those functions. a pull-up resistor. It also sets all bits of the output latch register Resetting resets the function register PBFC value to “0”, and PB to 1. In addition to functioning as a general-purpose I/O sets all bits to ports. port, Port B also functions as an input for 16-bit timer 4 and 5 (1) PB0 ~ PB6 Figure 3.5 (21). Port B (PB0 - PB6) 48 TOSHIBA CORPORATION TMP95C061 (2) PB7 (INT0) as an INT0 pin for external interrupt request input. Port B7 is a general-purpose I/O port, and also used Figure 3.5 (22). Port B7 TOSHIBA CORPORATION 49 TMP95C061 Figure 3.5 (23). Register for Port B 50 TOSHIBA CORPORATION TMP95C061 3.6 Chip Select/Wait Control, AM8/16 pin 3.6.1 Control Register TMP96C061 has a built-in chip select/wait controller used to Table 3.6 (1) shows control registers control chip select (CS0 to CS3 pins), wait (WAIT pin), and Each block address area is controlled by 1-byte CS/ data bus size (8 or 16 bits) for any of the three block address WAIT control registers. Start address register (MSAR0 to areas. MSAR3) and address mask register (MAM0 to 3). Additionally, there is an AM8/16 pin which selects exter- nal data bus width for TMP95C061. Table 3.6 (1) Chip Select/Wait Control Register TOSHIBA CORPORATION 51 TMP95C061 (1) Enable (3) Wait control Bit 4 (B0E, B1E, B2E, and B3E) of control register Control register bits 1 and 0 (B0W1, 0; B1W1, 0; B2W1, BXCS is a master bit used to specify enable (1)/disable 0; B3W1, 0; BEXW1, 0) are used to specify the number (0) of the setting. of waits. Setting these bits to 00 inserts a 2-state wait Resetting sets B0E, B1E, and B3E to disable (0) and regardless of the WAIT pin status. Setting them to 01 B2E to enable (1). inserts a 1-state wait regardless of the WAIT status. Setting them to 10 inserts a 1-state wait and samples the WAIT pin status. If the pin is low, inserting the wait (2) Data bus size select maintains the bus cycle until the pin goes high. Setting them to 11 completes the bus cycle without a wait Bit 2 (B0BUS, B1BUS, B2BUS, B3BUS, BEXBUS) of regardless of the WAIT pin status. the control register is used to specify data bus size. Resetting sets these bits to 00 (2-state wait mode). Setting this bit to 0 accesses the memory in 16-bit data bus mode; setting it to 1 accesses the memory in Note: In case of competition of accessing and refreshing to DRAM, 8-bit data bus mode. TMP95C061 automatically inserts refresh cycle in addition to set- This bit is effective only in 16 bit bus mode (AM8/16 = tled wait cycle. 0). In 8-bit bus mode (AM8/16 = 1), this bit is negligible and all external memory areas are accessed in fixed 8 (4) CS/CAS Waveform Select bit bus (See 3.1.2 External Data width selection pin (AM8/16)). Bit 3 of control register B3 is used to specify waveform Changing data bus size depending on the access mode output from the chip select pin (CS3/CAS). Set- address is called dynamic bus sizing. Table 3.6 (2) ting this bit to 0 specifies CS3 waveforms; setting it to shows the details of the bus operation. 1 specifies CAS waveforms. Resetting clears bit 5 to 0. Table 3.6 (2) Dynamic Bus Sizing Operand Operand Memory CPU Data CPU Address Data Size Start Address Data Size D15 to D8 D7 to D0 2n + 0 8 bits 2n + 0 xxxxx b7 to b0 8 bits (even number) 16 bits 2n + 0 xxxxx b7 to b0 2n + 1 8 bits 2n + 1 xxxxx b7 to b0 (odd number) 16 bits 2n + 1 b7 to b0 xxxxx 2n + 0 xxxxx b7 to b0 8 bits 2n + 0 2n + 1 xxxxx b15 to b8 (even number) 16 bits 2n + 0 b15 to b8 b7 to b0 16 bits 2n + 1 xxxxx b7 to b0 8 bits 2n + 1 2n + 2 xxxxx b15 to b8 (odd number) 2n + 1 b7 to b0 xxxxx 16 bits 2n + 2 xxxxx b15 to b8 2n + 0 xxxxx b7 to b0 2n + 1 xxxxx b15 to b8 8 bits 2n + 2 xxxxx b23 to b16 2n + 0 2n + 3 xxxxx b31 to b24 (even number) 2n + 0 b15 to b8 b7 to b0 16 bits 2n + 2 b31 to b24 b23 to b16 32 bits 2n + 1 xxxxx b7 to b0 2n + 2 xxxxx b15 to b8 8 bits 2n + 3 xxxxx b23 to b16 2n + 1 2n + 4 xxxxx b31 to b24 (odd number) 2n + 1 b7 to b0 xxxxx 2n + 2 b23 to b16 b15 to b8 16 bits 2n + 4 xxxxx b31 to b24 xxxxx: During a read, data input to the bus is ignored. At write, the bus is at high impedance and the write strobe signal remains non-active. 52 TOSHIBA CORPORATION TMP95C061 (5) Extra CS Area Bus/Wait Control (6) BEXCS register is used to specify the data bus size and Setting B2CS = 0 selects CS2 in the 16M- the number of wait in case of accessing address area byte area (000080H to FFFFFFHF). Setting B2CS which is not specified using CS0 to 3 register.s This reg- = 1 selects CS2 according to the setting area ister has no master enable bit, so always enable to for start address register MSAR2 and address mark unspecified area. Each bit has same meaning as BxCS. register MAMR2, the same as for CS0 and SC1. A reset zero-clears this bit. TOSHIBA CORPORATION 53 TMP95C061 3.6.2 Address Area Specification is a match, the specified space is assumed to be accessed The address space is specified with the start address register and a low strobe signal is output from the corresponding chip (MSAR0 to 3). For each bus cycle, the chip select controller select pin (CS0 to CS3) if it is enabled (B0E to B3E = “1”). compares the address on the bus and value of this start If the set address areas overlap or CS2 is enable for the address register. The value of the address mask register is 16M-byte area, the one with a smaller CS number is selected. used to ignore result of this address comparison. When there Figure 3.6 (1). Chip Select (CS0 to CS3) Operation Timing 54 TOSHIBA CORPORATION TMP95C061 Figure 3.6 (2). CS0 Address Decode Block Diagram Figure 3.6 (3). CS1 Address Decode Block Diagram TOSHIBA CORPORATION 55 TMP95C061 Figure 3.6 (4). CS1 Address Decode Block Diagram (1) Memory start address register Memory address mask register Table 3.6 (3) Memory Start Address Register 56 TOSHIBA CORPORATION TMP95C061 Table 3.6 (4) Memory Address Mask Register TOSHIBA CORPORATION 57 TMP95C061 MSAR0 3 < S23> to correspond to addresses CS1, CS2, and CS3 can be used in the same manner. A23 to A16 and S15, S14 to 9, and S8 corresponding Resetting sets the registers MSAR0, MSA1, MSAR2, to addresses A15, A14, to 9, and A8 are “0” by MSAR3, MAMR0, MAMR1, MAMR2 and MAMR3 to default. MAMR0 to enable/disable com- “0FFH”, and sets the control register bits B0E, B1E, to parison of value set with MSAR0 and address and “0”. So, chip select CS0, CS1, and CS3 are disable to correspond to to , S15, after resetting, while Bit B2E = 1, B2M = 0 and CS2 is S14 to 9, and S8. In addition, V21, V22, and V23 cor- enable for memory area 000080H to 0FFFFFFH (16M responding to , , and are “0” by byte). default and comparison is always enabled. (2) How to the Start Address Example of enabling/disabling comparison (CS0 registers MSAR0 and MSAMR0) The address decoder is output by specifying the start address for CS output and the space size. When comparison is disabled by setting = 1, The start address is set every 64K-byte because it is the comparison of the value of and address decoded by A16 to A23 as shown in the block dia- A16 is disabled and the value of becomes gram. invalid. In other words, the DRAM start address is set to one When comparison is enabled by setting = 0, of the 64K-byte intervals after “000000H”. the comparison of the value of and address However, note that the start address may be changed A16 is enabled and CS0 is enabled only when they due to the value of the MAMR. match. Figure 3.6 (5). Where to Set Start Address 58 TOSHIBA CORPORATION TMP95C061 (3) How to Set the Address Space ures 3.6 (2) to (4)), CS0, CS1, or CS2/CS3 can specify the address area for which the chip select signal can The address space is specified by setting the memory be output depending on whether to compare the start address mask register (MAMR0 to 3). address A8 to A20, A8 to A21, or A15 to A22, respec- tively. As shown in the address decoder block diagram (Fig- Figure 3.6 (6). Chip Select and Space Size (4) Start Address/Address Space Setting Procedure (Setting Example) ➀ Set memory start address register (MSARx) When the setting the CS0 area to 64Kbyte (010000 (Set address) to 01FFFFH), 16 bit data width and non-wait, ➁ Set memory start address mask register (MAMRx) MSAR0 = 01H start address 010000H (Set area start area) MAMR0 = 07H address area 64Kbyte B0CS = 13H 16 bit data width, 0-wait ➂ Set control register (BxCS) data bus width, number of waits, enable/disable of the area TOSHIBA CORPORATION 59 TMP95C061 3.7 Dynamic RAM (DRAM) Controller 4) address mapping size TMP95C061 consists of a control circuit to refresh DRAM, an CS3 area: 64K-8M byte access circuit to perform read/write. 5) memory access address length 1) refresh mode 8-11 bits CAS before RAS refresh mode 6) wait controller 2) refresh interval depends on the setting CS/WAIT controller 31-195 states (programmable) 7) arbitration between refresh and memory access 3) refresh cycle width refreshing is prior to memory access, automatically 2-9 states (programmable) inserted wait cycle during memory access cycle. 60 TOSHIBA CORPORATION TMP95C061 Control Register Figure 3.7 (1). Refresh Control Register TOSHIBA CORPORATION 61 TMP95C061 Figure 3.7 (2). DRAM Memory Access Control Register 62 TOSHIBA CORPORATION TMP95C061 Operation Description tion and delay RAS precharge time (RAS high width). This is called slow access mode. Set mode to slow (1) Memory Access Control access using DMEMCR . In the access cycle, Address multiplexer outputs row/ Access control is enable when DMEMCR = 1. column address through A0 to A11 pin. The enable/ And then DRAM control signals (RAS, CAS, and disable setting of address multiplexing and multiplexed REFOUT) are output during the time CPU access CS3 address width are controlled by DMEMCR area. The cycle (bus width and number of wait) depend and . The relation between address width on the value of CS/WAIT controller and bus width is below. To facilitate connection with low-speed DRAM, the Figures 3.7 (3), (4) show the access timing. DRAM controller can accelerate RAS rise at wait inser- Table 3.7 Address Multiplex TOSHIBA CORPORATION 63 TMP95C061 Figure 3.7 (3). DRAM Access Timing (Normal Access Mode) 64 TOSHIBA CORPORATION TMP95C061 Figure 3.7 (4). DRAM Access Timing (Slow Access Mode) TOSHIBA CORPORATION 65 TMP95C061 (2) Refresh Controller i) CAS before RAS interval refresh mode The TMP95C061 can output RAS/CAS used to The refresh interval and refresh width for CAS before refresh the DRAM. At the same time the state signal RAS interval refresh mode depends on the DRAM REFOUT which indicates a refresh cycle is output. being used. (Only for interval refresh mode.) Therefore, TMP95C061 enables the refresh interval DRAM can be refreshed easily because RAS/CAS/ and refresh cycle width to be set with the refresh con- REFOUT output frequency and pulse width are pro- troller register value according to the system clock grammable. and DRAM that are being used. The refresh controller has the following features. Figure 3.7 (5) shows a timing example for CAS before RAS refresh cycle. • Refresh mode: CAS before RAS interval refresh mode CAS before RAS self refresh mode • Refresh interval: 31 to 195 states (program- mable) • Refresh cycle width: 2 to 9 states (programma- ble) • Dummy cycle can be generated • Refresh cycle is asynchronous with CPU operation cycle Figure 3.7 (5). Refresh Cycle Timing Example 66 TOSHIBA CORPORATION TMP95C061 How to set the register is described next. The insertion interval is set with the three bits DREFCR according to the system clock being Figure 3.7 (1) shows the bit structure of the refresh used. control register DREFCR. Example: When the system clock is 25MHz and the ➀ Refresh cycle insertion interval DRAM refresh cycle is to be 15.6µs, set these bits to “111”. Table 3.13 (2) Refresh Cycle Insertion Interval ➁ The three bits DREFCR can be used to ii) CAS before RAS self refresh mode change the refresh cycle width (RAS, CAS Low out- put width). (2 to 9 states) This mode is used when DRAM controller or is halted with HALT (IDLE, STOP) instruction while refreshing ➂ Refresh cycle control with CAS before RAS interval refresh mode (hereafter referred to as interval mode). The refresh cycle can be disabled/enabled with the bit However, REFOUT is not output. (“1” is output.) DREFCR . Figure 3.7 (6) shows the self refresh mode timing dia- gram. TOSHIBA CORPORATION 67 TMP95C061 Figure 3.7 (6). Self Refresh Cycle Timing This mode is executed as follows. First, the settings are made fro normal interval mode. Then B3CS is set to “0” before a HALT instruction to perform one normal refresh. Then the CAS pin and RAS pin are kept at low level and the self refresh mode is entered. Can- celling HALT and supplying a clock to the DRAM con- troller automatically sets DMEMCR to 1 and cancels self refresh mode. After cancellation, refresh is performed once normally and processing returns to interval mode. (Note that when HALT is cancelled by a reset, the I/O registers are initialized, therefore, refresh is not normally performed.) After DMEMCR to “0”, make sure that the 68 TOSHIBA CORPORATION TMP95C061 (4) Priority to off, and sets the pin to high impedance. The refresh cycle is asynchronous with the access The DRAM refresh cycle may overlap with the DRAM cycle. When a refresh request is generated and the read/write cycle because it is not synchronized with refresh cycle is at wait because of a conflict with the the CPU operating cycle. In this case, the DRAM con- access cycle until the bus release, the bus release troller gives priority to the cycle that starts operation timing is delayed until the refresh cycle is completed. first. If the priority is given to the refresh cycle, a wait is The refresh counter keeps counting during bus automatically inserted in the memory access cycle. release. The refresh request generated during bus release is held for one cycle. The refresh cycle is (5) Bus Release Mode performed immediately after the TMP95C061 regains bus mastership. The bus release request or refresh counter is asyn- The TMP95C061 has a bus release function. Setting chronous with the bus cycle. To use this mode, the dedicated DRAM control pins (RAS, CAS, REFOUT) external bus master must generate a refresh cycle enables selection of release mode (by setting the pins during bus release. to high impedance like other pins) or non-release (remain driving) mode in which refresh cycle output is supported. For the states of other pins at bus release, (ii) Mode not used by DRAM control dedicated pin to see 3.14 (2), Pin states at bus release. release bus (DMEMCR = 1) (i) Mode used by DRAM control dedicated pin to Valid even if the DRAM is not accessed by the exter- release bus (DMEMCR = 0) nal bus master during bus release. If this mode is set, the DRAM dedicated pin does not release the bus even if a bus release request is generated but When the bus release request (BUSRQ) pin is set to keeps supporting a refresh cycle only. Note that all active (low level), the TMP95C061 acknowledges the other pins release the bus. Unlike (i), bus release the bus release request. After the current bus cycle timing is not influenced by a refresh request. (including DRAM access cycle) ends, the TMP95C061 sets the DRAM control dedicated pin A reset DMECR to 0 and the DRAM control (RAS, CAS, REFOUT) to high, sets the output buffer dedicated pin to bus release mode. TOSHIBA CORPORATION 69 TMP95C061 (6) Connection Example (1) 8 bit bus configuration (2) 16 bit bus configuration 70 TOSHIBA CORPORATION TMP95C061 3.8 8-bit Timers Figure 3.8 (1) shows the block diagram of the 8-bit timer TMP95C061 contains four 8-bit timers (timers 0, 1, 2 and 3), (timer 0 and timer 1). each of which can be operated independently. The cascade Timers 2/3 have the same circuit configuration as timer 0 connection allows these timers to be used as 16-bit timers. and timer 1. The difference between Timer 0 and Timer 2 is The following four operating modes are provided for the 8-bit tim- that Timer 0 has an external clock input pin (TI0), while Timer 2 ers: has none. Each interval timer consists of an 8-bit comparator, and 8- • 8-bit interval timer mode (4 timers) bit timer register. Besides, timer flip-flops (TFF1, TFF3) are pro- vided for each pair of timer 0/1 and timer 2/3. • 16-bit interval timer mode (2 timers) Among the input clock sources for the interval timers, the • 8-bit programmable square wave pulse generation (PPG: internal clocks of øT1, øT4, øT16, and øT256 are obtained variable duty with variable cycle) output mode (2 timers) from the 9-bit prescaler shown in Figure 3.8 (2). • 8-bit pulse width modulation (PWM: variable duty constant The operation modes and timer flip-flops of the 8-bit timer with cycle) output mode (2 timers) are controlled by five control registers T01MOD, T23MOD, TFFCR, TRUN, and TRDC. TOSHIBA CORPORATION 71 TMP95C061 Figure 3.8 (1). Block Diagram of 8-bit Timers (Timers 0 and 1) 72 TOSHIBA CORPORATION TMP95C061 ➀ Prescaler øT16 and øT256 among the prescaler output. This prescaler can be run or stopped by the timer opera- These are 9 bit prescaler and prescaler clock selection tion control register TRUN . Counting starts register to generates input clock for 8-bit Timer 0/1, when is set to “1”, while the prescaler is Timer 4/5 and Serial Interface 0/1. cleared to zero and stops operation when The 8-bit Timer 0, uses 4 types of clock: øT1, øT4, is set to “0”. Figure 3.8 (2). Prescaler TOSHIBA CORPORATION 73 TMP95C061 ➁ Up-counter be controlled for each interval timer by the timer operation control register TRUN. When reset, all up-counters will There is an 8 bit binary counter which counts up by the be cleared to stop the timers. input clock pulse specified by the Timer 0/1 mode reg- ister T01MOD and Timer 2/3 mode register T23MOD. ➂ Timer register The input clocks of timer 0/2 are selected from the three internal clocks øT1, øT4, and øT16 and the This is an 8-bit register for setting an interval time. external clock input (TI0: timer 0 only) using the mode When the set value of timer registers TREG0, TREG1, register T01MOD and T23MOD. TREG2, TREG3, matches the value of up-counter, the The input clocks of timer 1/3 differ depending on the comparator match detect signal becomes active. If the operation mode. When the timers are set to 16 bit set value is 00H, this signal becomes active when the timer mode, the overflows output of timer 1/3 are used up-counter overflows. as the input clock. When the timers are not set to the Timer register TREG0/TREG2 is of double buffer struc- 16 bit mode, the input clock is selected from the inter- ture, each of which makes a pair with register buffer. nal clocks øT1, øT16, and øT256, and the output The timer register double buffer register TRDC comparator (match detection). bit controls whether the double buffer structure in the TREG0/TREG2 should be Example: When T01MOD = 01 enabled or disabled. It is disabled when / the overflow output of timer 0 = 0, and enabled when they are set to 1. becomes the input clock of timer 1 In the condition of double buffer state, the data is (16-bit timer). transformed from the register buffer to the timer regis- When T01MOD7, 6 = 00 and ter when the 2n - 1 overflow occurs in PWM mode, or T01MOD3, 2 = 01, øT1 becomes at the PPG cycle in PPG mode. the input of timer 1 (8 bit timer When reset, it will be initialized to / mode). = 0 to disable the double buffer. To use the double buffer, write data in the timer register, set / Operation mode is also set by T01MOD register and to 1, and write the following data in the reg- T23 MOD register. When reset, it is initialized to ister buffer. T01MOD = 00, T23MOD = 00, whereby the up-counter is placed in the 8-bit timer mode. The counting and stop and clear of up-counter can 74 TOSHIBA CORPORATION TMP95C061 Figure 3.8 (3). Configuration of Timer Register 0/2 Note: Timer register and the register buffer are allocated o the same memory address. When / = 0, the same value is written in the regis- ter buffer as well as the timer register, while when / = 1 only the register buffer is written. The memory address of each timer register is as follows. All the registers are write-only and cannot be read. The initial value is indeterminate; when using the 8-bit TREG0: 000022H timer, always write data to the timer register. TREG1: 000023H TREG2: 000026H TREG3: 000027H TOSHIBA CORPORATION 75 TMP95C061 Figure 3.8 (4). Timer 0/1 Mode Control Register (T01MOD) 76 TOSHIBA CORPORATION TMP95C061 Figure 3.8 (5). Timer 2/3 Mode Register (T23MOD) TOSHIBA CORPORATION 77 TMP95C061 Figure 3.8 (6). 8-Bit Timer Flip-flop Control Register (TFFCR) 78 TOSHIBA CORPORATION TMP95C061 Figure 3.8 (7). Timer Operation Control Register (TRUN) TOSHIBA CORPORATION 79 TMP95C061 Figure 3.8 (8). Timer Register Double Buffer Control Register (TRDC) 80 TOSHIBA CORPORATION TMP95C061 ➃ Comparator The operation of 8-bit timers will be described below: A comparator compares the value in the up-counter (1) 8-bit Timer Mode with the values to which the timer register is set. When they match, the up-counter is cleared to zero and an Four interval timers, 0, 1, 2, and 3, can be used indepen- interrupt signal (INTT0 to 3) is generated. If the timer dently as an 8-bit interval timer. All interval timers oper- flip-flop inversion is enabled, the timer flip-flop is ate in the same manner, and thus, only the operation inverted at the same time. of timer 1 will be explained below. ➄ Timer flip-flop (timer F/F) ➀ Generating interrupts in a fixed cycle The status of the timer flip-flop is inverted by the match To generate timer 1 interrupt at constant intervals detect signal (comparator output) of each interval timer using timer 1 (INTT1), first stop timer 1, then set the and the value can be output to the timer output pins operation mode, input clock, and synchronization to TO1 (also used as PA2) and TO3 (also used as PA3). T01MOD and TREG1, respectively. Then, enable interrupt The timer F/F are provided for a pair of timer 0/1 and INTT1 and start the counting of timer 1. timer 2/3. The outputs of timer F/F are TFF1 and TFF3, and output signals through the TO1 and TO3. Example: To generate timer 1 interrupt every 32µs at fc = 25MHz, set each register in the follow- ing manner. Use Table 3.8 (1) for selecting the input clock. Table 3.8 (1) Setting the Interrupt Period and Input Clock for 8 Bit Timer Input clock Interrupt period (at fc = 25MHz) Resolution øT1 (8/fc) 32µs to 81.92µs 32µs øT4 (32/fc) 12.8µs to 327.7µs 1.28µs øT16 (128/fc) 5.12µs to 1.311ms 5.12µs øT256 (2048/fc) 81.92µs to 20.97ms 81.92µs TOSHIBA CORPORATION 81 TMP95C061 ➁ Generating a 50% duty square wave pulse Example: To output a 1.92µs square wave pulse from TO1 pin at fc = 25MHz, set each register in the The timer flip-flop is inverted at constant intervals, and following procedures. Either timer 0 or timer 1 its status is output to a timer output pin (TO1). may be used, but this example uses timer 1. Figure 3.8 (9). Square Wave (50% Duty) Output Timing Chart 82 TOSHIBA CORPORATION TMP95C061 ➂ Making timer 1 count up by match signal from timer Set the 8-bit timer mode, and set the comparator output 0 comparator of timer 0 as the input clock to timer 1. Figure 3.8 (10). Timer 1 Count Up by Timer 0 ➃ Output inversion with software ➄ Initial setting of timer flip-flop (TFF) The value of timer flip-flop (timer F/F) can be inverted, The value of TFF can be initialized to “0” or “1”, inde- independent of timer operation. pendent of timer operation. Writing 00 into TFFCR inverts the value of For example, write “10” in TFFCR to TFF1. Writing 00 into TFFCR inverts the clear TFF1 to “0”, while write “01” in TFFCR value of TFF3. to set TFF1 to “1”. Note: The value of timer F/F and timer register cannot be read. TOSHIBA CORPORATION 83 TMP95C061 (2) 16-bit timer mode When set in 16-bit timer mode, the overflow output of timer 0 will become the input clock of timer 1, regardless of A 16-bit interval timer is configurated by using the pair the set value of clock control register TCLK. of timer 0/1 and timer 2/3. The lower 8 bits of the timer (interrupt) cycle are set by Timer 2/3 operate as Timer 0/1, so described have the timer register TREG0, and the upper 8 bits are set about Timer 0/1. by TREG1. Note that TREG0 always must be set first (Writing data into TREG0 disables the comparator To make a 16-bit interval timer by cascade connection temporarily, which is restarted by writing data into timer 0 and timer 1, set timer 0/timer 1 mode register TREG1). T01MOD to “0, 1”. Table 3.8 (2) Interrupt Period and Input Clock in 16 Bit Timer Mode Input clock Interrupt period (at fc = 25MHz) Resolution øT1 (8/fc) 32µs to 20.971ms 32µs øT4 (32/fc) 12.8µs to 83.885ms 1.28µs øT16 (128/fc) 5.12µs to 335.539ms 5.12µs Setting example: To generate an interrupt INTT1 every 0.32 The comparator match signal is output from timer 0 seconds at fc = 25MHz, set the following each time the up-counter UC0 matches TREG0, values for timer registers TREG0 and where the up-counter UC0 is not be cleared, and then TREG1. the INTT0 is not decremented. When counting with input clock of øT16 With the timer 1 comparator, the match detect signal is (5.12µs @ 25MHz) output at each comparator timing when up-counter 0.32s ÷5.12µs = 62500 = F424H UC1 and TREG1 values match. When the match Therefore, set TREG1 = F4H and TREG0 = detect signal is output simultaneously from both com- 24H,respectively. parators of timer 0 and timer 1, the up-counters UC0 and UC1 are cleared to “0”, and the interrupt INTT1 is generated. If inversion is enabled, the value of the timer flip-flop TFF1 is inverted. 84 TOSHIBA CORPORATION TMP95C061 Example: When TREG1 = 04H and TREG0 = 80H Figure 3.8 (11). Timer Output by 16-Bit Timer Mode (3) 8-bit PPG (Programmable Pulse Generation) Mode be either low-active or high-active. In this mode, timer 1 and timer 3 cannot be used. Square wave pulse can be generated at any frequency Timer 0 outputs pulse through TO1 pin (also used as and duty by timer 0 and timer 2. The output pulse may PA2). Timer 2 outputs pulse to TO3 pin (also used as PA3). TOSHIBA CORPORATION 85 TMP95C061 As an example, Timer 0 will be explained below. Timer 2 provides the same functions. Figure 3.8 (12). Block Diagram of 8-bit PPG Output Mode 86 TOSHIBA CORPORATION TMP95C061 When the double buffer of TREG0 is enabled in this mode, Use of the double buffer makes easy the handling of low the value of register buffer will be shifted in TREG0 each duty waves (when duty is varied). TREG1 matches UC0. Example: Generating 1/4 duty 78.125kHz pulse (at fc = Given øT1 = 0.32µs (at 25MHz), 25MHz) 12.8µs ÷ 0.32µs = 40 Consequently, to set the timer register 1 (TREG1) to TREG1= 40 = 28H and then duty to 1/4, t x 1/4 = 12.8µs x 1/4 = 3.2µs 3.2µs ÷ 0.32µs = 10 • Calculate the value to be set for timer register Therefore, set timer register 0 (TREG0) to TREG0 = 10 To obtain the frequency 78.125kHz, the pulse = 0AH. cyc;e t should be: t = 1/78.125kHz = 12.8µs TOSHIBA CORPORATION 87 TMP95C061 (4) 8-bit PWM (Pulse Width Modulation) Mode matches the set value of timer register TREG0 or when 2n - 1 (n = 6, 7 or 8; specified by T01MOD ) counter overflow occurs. Up-counter UC1 is cleared bit resolution of PWM pulse can be output. PWM pulse when 2n - 1 counter overflow occurs. is output through TO1 pin) when using timer 0. When To use this PWM mode, the following conditions must using timer 2, the pulse is through TO3 pin. Timer 1 be satisfied. and timer 3 are valid for 8-bit timers. As an example, the PWM mode operation of Ti mer 0 (Set value of timer register) < (set overflow value of 2n - will be explained below. Timer 2 provides the same 1 counter) operation as Timer 0. (Set value of timer register) ≠ 0 Timer output is inverted when up-counter (UC0) Figure 3.8 (13) shows the block diagram of this mode. Figure 3.8 (13). Block Diagram of 8-Bit PWM Mode 88 TOSHIBA CORPORATION TMP95C061 In this mode, the value of register buffer will be shifted in Use the double buffer makes easy the handling of small TREG0 if 2n - 1 overflow is detected when the double buffer of duty waves. TREG0 is enabled. TOSHIBA CORPORATION 89 TMP95C061 Example: To output the following PWM waves to TO1 To realize 40.64µs of PWM cycle by øT1 = 0.32µs pin at fc = 25MHz. (at fc = 25MHz), . 40.64µs ÷ 0.32µs = 127 = 2n - 1 Consequently, n should be set to 7. As the period of low level is 28.8µs, for T1 = 0.32µs, set the following value for TREG0. 28.8µs ÷ 0.32µs = 90 = 5AH Table 3.8 (3) PWM Cycle and Selection of 2n - 1 Counter PWM cycle (@fc = 25MHz) øT1 øT16 øT256 26 - 1 20.2µs 80.6µs (12.4kHz) 322.6µs (3.1kHz) 27 - 1 40.6µs 162.6µs (6.2kHz) 650.2µs (1.5kHz) 28 - 1 81.6µs 326.4µs (3.1kHz) 1.31ms (0.8kHz) 90 TOSHIBA CORPORATION TMP95C061 (5) Table 3.8 (4) shows the list of 8-bit timer modes. Table 3.8 (4) Selection of 8 Bit Timer Mode and Control Register Timer mode Upper input Lower input Invert select TO1M PWM0 (8-bit timer x 2 T1CLK T0CLK FF1IS (T23M) (PWM2) channels) (T3CLK) (T2CLK) (FF31S) 16-bit timer (External clock 01 – – – (16-bit) x 1 ch øT1, 4, 16) 8-bit timer (External clock 0: Lower timer (Input of upper timer is 00 – 00 øT1, 4, 16) 1: Upper timer output of power one) (External clock 0: Lower timer 8-bit timer x 2 ch 00 – (øT1, 16, 256) øT1, 4, 16) 1: Upper time (External clock 8-bit PPG x 1 ch 10 – – – øT1, 4, 16) 8-bit PWM x 1 ch (Lower) (External clock 11 PWM cycle (øT1, 16, 256) – 8-bit timer x 1 ch (Upper) øT1, 4, 16) TOSHIBA CORPORATION 91 TMP95C061 3.9 16-bit Timer Timer/event counter consists of 16-bit up-counter, two The TMP95C061 contains two (timer 4 and timer 5) multifunc- 16-bit timer registers, two 16-bit capture registers (one of them tional 16-bit timer/event counter with the following operating applies double-buffer), two comparators, capture input controller, modes: and timer flip-flop and the control circuit. Timer/event counter is controlled by 4 control registers: • 16-bit interval timer mode T4MOD/T5MOD, T4FFCR/T5FFCR, TRUN, and T45CR. Figure 3.9 (1), (2) shows the block diagram of the 16-bit • 16-bit event counter mode timer/event counter (timer 4 and timer 5). • 16-bit programmable pulse generation (PPG) mode • Frequency measurement mode • Pulse width measurement mode • Time differential measurement mode 92 TOSHIBA CORPORATION TMP95C061 Figure 3.9 (1). Block Diagram of 16-Bit Timer (Timer 4) TOSHIBA CORPORATION 93 TMP95C061 Figure 3.9 (2). Block Diagram of 16-bit Timer (Timer 5) 94 TOSHIBA CORPORATION TMP95C061 Figure 3.9 (3). 16-Bit Timer Mode Controller Register (T4MOD) (1/2) TOSHIBA CORPORATION 95 TMP95C061 Figure 3.9 (4). 16-Bit Timer Mode Controller Register (T4MOD) (2/2) 96 TOSHIBA CORPORATION TMP95C061 Figure 3.9 (5). 16-Bit Timer 4 F/F Control (T4FFCR) TOSHIBA CORPORATION 97 TMP95C061 Figure 3.9 (6). 16-Bit Timer Mode Control Register (T5MOD) (1/2) 98 TOSHIBA CORPORATION TMP95C061 Figure 3.9 (7). 16-Bit Timer Mode Control Register (T5MOD) (2/2) TOSHIBA CORPORATION 99 TMP95C061 Figure 3.9 (8). 16-Bit Timer 5 F/F Control (T5FFCR) 100 TOSHIBA CORPORATION TMP95C061 Figure 3.9 (9). 16-Bit Timer (Timer 4, 5) Control Register (T45CR) Figure 3.9 (10). Timer Operation Control Register (TRUN) TOSHIBA CORPORATION 101 TMP95C061 ➀ Up-counter (UC16) timer register TREG5, TREG7. The “clear enable/dis- able” is set by T4MOD and T5MOD . UC16 is a 16-bit binary counter which counts up If clearing is disabled, the counter operates as a free- according to the input clock specified by T4MOD running counter. register or T5MOD register. As the input clock, one of the internal clocks øT1, øT4, ➁ Timer Registers and øTI6 from 9-bit prescaler (also used for 8-bit timer), and external clock from TI4 pin (also used as These two 16-bit registers are used to set the value of PB0/INT4 pin) and TI67 pin (also used as PB4/INT6 counter. When the value of up-counter UC4/UC5 pin) can be selected. When reset, it will be initialized to matches the set value of this timer register, the com- / = 00 to select TI4, TI6 parator match detect signal will be active. input mode. Counting or stop and clear of the counter Setting data for timer register (TREG4, TREG5/TREG6 is controlled by timer operation control register TRUN and TREG7) is executed using 2 byte data load , . instruction or by using 1 byte data load instruction When clearing is enabled, up-counter UC4/UC5 will be twice for lower 8 bits and upper 1 bits in order. cleared to zero each time it coincides or matches the The timer register TREG4/TREG6 make double buffer TREG4, TREG6 and register buffer are allocated to the structure, which are paired with register buffer. The same memory addresses 000030H/000031H and timer control register T45CR con- 000040H/000041H. When = 0, the trols whether the double buffer structure should be same value will be written in both the timer register and enabled or disabled. : disabled when the register buffer. When = 1, the = 0, while enabled when = 1. value is written into only the register buffer. When the double buffer is enabled, the timing to transfer Since the timer register is indeterminate after a reset, data from the register buffer to the timer register is at always write data to higher and lower bits. the match between the up-counter (UC4 and UC5) ➂ Capture Register (CAP1 and CAP2) and timer register TREG5 and TREG7. When reset, it will be initialized to = These 16-bit registers are used to hold the values of 0, whereby the double buffer is disabled. To use the double the up-counter. buffer, write data in the timer register, set = 1, and then write the following data in the regis- byte load instruction or two 1- byte data load instruction, ter buffer. from the lower 8 bits followed by the upper 8 bits. 102 TOSHIBA CORPORATION TMP95C061 ➃ Capture Input Control Circuit counter UC4/UC5 value with the set value of (TREG4, TREG5, TREG5/TREG6, TREG7) to detect the match. This circuit controls the timing to latch the value of When a match is detected, the comparators generate an interrupt (INTTR4, INTTR5/INTTR6, INTTR7), respec- up-counter UC4/UC5 into (CAP1, CAP2/CAP3, tively. The up-counter UC4/UC5 is cleared only when CAP4). The latch timing of capture register is controlled by UC4/UC5 matches TREG5/TREG7. (The clearing of up- register T4MOD /T5MOD . /T5MOD = 0). • When T4MOD /T5MOD = 00 Capture function is disabled. Disable is the default on reset. This flip-flop is inverted by the match detect signal from the comparators and the latch signals to the cap- ture registers. Disable/enable of the inversion can be • When T4MOD /T5MOD = 01 EQ5T4, EQ4T4> /T5FFCR . TFF5/TFF6 will be inverted when pin (also used as PB0/INT7) input, while data is loaded “00” is written in T4FFCR < TFF4C1, 0>/T5FFCR < to CAP2/CAP4 at the TI5 pin (also used as P81/INT5) TFF6C1, 0>. Also, it is set to “1” when “10” is written, and TI7 pin (also used as PB5/INT7) input. (Time differ- and cleared to “0” when “10” is written. The value of ence measurement) TFF4 can be output to the timer output pin TO4 (commonly used as PB2)/TO6 (also used used as PB6). • When T4MOD /T5MOD = 10 ➆ Timer Flip-flop (TFF5) Data is loaded to CAP1/CAP3 at the rise edge of the TI4 pin/TI6 pin input, while data is loaded to CAP2/CAP4 This flip-flop is inverted by the match detect signal at the fall edge. Only in this setting, interrupt INT4/INT6 from the comparator and the latch signal to the cap- occurs at fall edge. (Pulse width measurement) ture register CAP2. TFF5 will be inverted when “00” is written in T4FFCR < TFF5C1, 0>. Also, it is set to “1” • When T4MOD /T5MOD = 11 written. The value of TFF5 can be output to the timer out- Data is loaded to CAP1/CAP3 at the rise edge of timer flip- put pin TO5 (commonly used as P82). flop TFF1, while to CAP2/CAP4 at the fall edge. Note: This flip-flop (TFF5) is contained only in the 16-bit timer 4. Besides, the value of up-counter can be loaded to capture registers by software. Whenever “0” is written (1) 16-bit Timer Mode in T4MOD , T5MOD , the current value of up-counter will be loaded to capture register Timer 4 and Timer 5 can be operated independently. Both CAP1/CAP3. It is necessary to keep the prescaler in can be operated all the same, so, Timer 4 is shown here RUN mode (TRUN to be “1”). for the purposes of illustration only. Generating interrupts at fixed intervals, the interval time ➄ Comparator is set in the timer register TREG5 to generate the inter- rupt INTTR5. These are 16-bit comparators which compare the up- TOSHIBA CORPORATION 103 TMP95C061 (2) 16-bit Event Counter Mode The counter counts at the rise edge of TI4 pin/TI6 pin input. In timer mode as described in above, the timer can be TI4 pin/TI6 pin can also be used as PB0/INT4 and used as an event counter by selecting the external PB4/INT6. clock (TI4 pin/TI6 pin input) as the input clock. To read Since both timers operate in exactly the same way, the value of the counter, first perform “software cap- timer 4 is used for the purposes of explanation. ture” once and read the captured value. (3) 16-bit Programmable Pulse Generation (PPG) Output flip-flop TFF4 that is to be enabled by match of the up- Mode counter UC4 with the timer register TREG 4 or 5 and to be output to TO4 (also used as P82). In this mode, the Timer 4 and Timer 5 can be operated all the same, following conditions must be satisfied. Timer 4 is used for the purposes of explanation. The PPG mode is obtained by inversion of the timer (Set value of TREG4) < (Set value of TREG5) Figure 3.9 (11). Programmable Pulse Generation (PPG) Output Waveforms 104 TOSHIBA CORPORATION TMP95C061 When the double buffer of TREG4 is enabled in this TREG4 at match with TREG5. This feature makes easy mode, the value of register buffer 4 will be shifted in the handling of low duty waves. Figure 3.9 (12). Operation of Register Buffer Figure 3.9 (13). Block Diagram of 16-Bit PPG Mode TOSHIBA CORPORATION 105 TMP95C061 (4) Application examples of capture function ➀ One-shot pulse output from external trigger pulse Timer 4 and Timer 5 can be operated all the same, Set the up-counter UC4 in free-running mode with the Timer 4 is used for the purposes of explanation internal input clock, input the external trigger pulse The loading of up-counter (UC4) values into the capture reg- from TI4 pin, and load the value of up-counter into the isters CAP1 and CAP2, the timer flip-flop TFF4 inversion capture register CAP1 at the rising edge of TI4 pin. due to the match detection by comparators CP4 and Then set to T4MOD = 01. CP5, and the output of the TFF4 status to TO4 pin can When the interrupt INT4 is generated at the rising edge be enabled or disabled. Combined with interrupt func- of TI4 input, set the CAP1 value (c) plus a delay time (d) tion, they can be applied in many ways, for example: to TREG4 (= c + d), and set the above set value (c + d) pulse a one shot pulse width (p) the TREG5 (= c + d + ➀ One-shot pulse output from external trigger pulse p). When the interrupt INT4 occurs the T4FFCR register should be set that the TFF4 ➁ Frequency measurement inversion is enabled only when the up-counter value ➂ Pulse width measurement matches TREG4 or 5. When interrupt INTTR5 occurs, ➃ Time difference measurement this inversion will be disabled. Figure 3.9 (14). One-Shot Output (with Delay) 106 TOSHIBA CORPORATION TMP95C061 Setting example: To output 2ms one-shot pulse with a 3ms delay to the external trigger pulse to TI4 pin. TOSHIBA CORPORATION 107 TMP95C061 When delay time is unnecessary, invert timer flip-flop INT4 occurs. The TFF4 inversion should be enabled TFF4 when the up-counter value is loaded into capture before the up-counter (UC4) value matches TREG5, register 1 (CAP1), and set the CAP1 value (c) plus the and disabled when generating the interrupt INTTR5. one-shot pulse width (p) to TREG5 when the interrupt Figure 3.9 (15). One-Shot Pulse Output (without Delay) ➁ Frequency measurement of Timer 4. The value of the up-counter is loaded into the capture register CAP1 at the rise edge of the timer The frequency of the external clock can be measured flip-flop TFF1 of 8-bit timers (Timer 0 and Timer 1), and in this mode. The clock is input through the TI4 pin, into CAP2 at its fall edge. and its frequency is measured by using the 8-bit timers The frequency is calculated by the difference between (Timer 0 and Timer 1) and the 16-bit timer/event the loaded values CAP1 and CAP2 when the interrupt counter (Timer 4). (INTT0 or INTT1) is generated by either 8-bit timer. The TI4 pin input should be selected for the input clock Figure 3.9 (16). Frequency Measurement For example, if the value for the level “1” width of TFF1 between CAP1 and CAP2 is 100, the frequency will be of the 8-bit timer is set to 0.5 sec. and the difference 100/0.5 [s] - 200 [Hz]. 108 TOSHIBA CORPORATION TMP95C061 ➂ Pulse width measurement edge of the external trigger pulse respectively. The interrupt INT4 occurs at the falling edge of TI4. This mode allows to measure the “H” level width of an The pulse width is obtained from the difference external pulse. While keeping the 16-bit timer/event between the values of CAP1 and CAP2 and the internal counter counting (free-running) with the internal clock clock cycle. input, the external pulse is input through the TI4 pin. For example, if the internal clock is 8.0 microseconds Then the capture function is used to load the UC4 val- and the difference between CAP1 and CAP2 is 100, ues into CAP1 and CAP2 at the rising edge and falling the pulse width will be 100 x 0.8µs = 80µs. Figure 3.9 (17) Pulse Width Measurement Note: Only in this pulse width measuring mode (T4MOD = 10), external interrupt INT1 occurs at the falling edge of TI4 pin input. In other modes, it occurs at the rising edge. The width of “L” level can be measured from the difference (free-running) with the internal clock, and load the UC4 between the first C2 and the second C1 at the second value into CAP1 at the rising edge of the input pulse to INT1 interrupt. TI4. Then the interrupt INT1 is generated. Similarly, the UC4 value is loaded into CAP2 at the ris- ➃ Time difference measurement ing edge of the input pulse to TI5, generating the inter- rupt INT2. This mode is used to measure the difference in time The time difference between these pulses can be between the rising edges of external pulses input obtained from the difference between the time counts through TI4 and TI5. at which loading the up-counter value into CAP1 and CAP2 has been done. Keep the 16-bit timer/event counter (Timer 4) counting TOSHIBA CORPORATION 109 TMP95C061 Figure 3.9 (18). Time Difference Measurement (5) Different Phased Pulses Output Mode When the value in up-counter UC4 and the value in TREG4 (TREG5) match, the value in TFF4 (TFF5) is In this mode signals with any different phase can be inverted and output to TO4 (TO5). output by free-running up-counter UC4. This mode can be used only in Timer 4. Figure 3.9 (19). Phase Output Cycles (counter overflow time) of the above output waves are listed on Table 3.9 (2). The following table 20MHz 25MHz shows cycles (counter overflow) of the above output øT1 26.214ms 20.97ms wave. øT4 104.856ms 83.88ms øT16 419.424ms 335.54ms 110 TOSHIBA CORPORATION TMP95C061 3.10 Stepping Motor Control/Pattern Generation Port the PG port. TMP95C061 contains two channels (PG0 and PG1) of 4-bit PG0 and PG1 can be used independently. hardware stepping motor control/pattern generation (herein All PG operate in the same manner except the following after called PG) which actuate in synchronization with the (8- points, and thus only the operation of PG0 will be explained bit/16-bit) timers. The PG (PG0 and PG1) are shared in 8-bit I/ below. O ports P7. Different Points between PG0 and PG1 Channel 0 (PG0) is synchronous with 8-bit timer 2 or timer 3, 16-bit timer 5, to update the output. PG0 PG1 The PG ports are controlled by control registers (PG01CR) and can select either stepping motor control mode from 8-bit timer 0, 1 or from 8-bit timer 2, 3 or Trigger Signal 16-bit timer 4 16-bit timer 5 or pattern generation mode. Each bit of the P7 can be used as Figure 3.10 (1). PG Block Diagram TOSHIBA CORPORATION 111 TMP95C061 Figure 3.10 (2a). Pattern Generation Control Register (PG01CR) 112 TOSHIBA CORPORATION TMP95C061 Figure 3.10 (2b). Pattern Generation Control Register (PG01CR) TOSHIBA CORPORATION 113 TMP95C061 Figure 3.10 (3). Pattern Generation 0 Register (PG0REG) Figure 3.10 (4). Pattern Generation 1 Register (PG1REG) 114 TOSHIBA CORPORATION TMP95C061 Figure 3.10 (5). 16-bit Timer Trigger Control Register (T45CR) TOSHIBA CORPORATION 115 TMP95C061 Figure 3.10 (6). Connection of Timer and Pattern Generator (1) Pattern Generation Mode In this mode, set PG01CR and to 1, and PG01CR and to 0. PG functions as a pattern generation according to the The output of this pattern generator is output to port 7; setting of PG01CR . In this mode, writing from since port and functions can be switched on a bit basis CPU is executed only on the shifter alternate register. using port 7 function control register P7FC, any port Writing a new data should be done during the interrupt pin can be assigned to pattern generator output. operation of the timer for shift trigger, and a pattern can Figure 3.10 (7) shows the block diagram of this mode. be output synchronous with the timer. Example of pattern generation mode 116 TOSHIBA CORPORATION TMP95C061 Figure 3.10 (7). Pattern Generation Mode Block Diagram (PG0) In this pattern generation mode, only writing the output mode. Accordingly, the data shifted by trigger signal from a latch is disabled by hardware, but other functions do the same timer must be written before the next trigger signal is output. operation as 1-2 excitation in stepping motor control port TOSHIBA CORPORATION 117 TMP95C061 (2) Stepping Motor Control Mode Figure 3.10 (8) and Figure 3.10 (9) show the output waveforms of 4-phase 1 excitation and 4-phase 2 excitation, respectively, when channel 0 (PG0) is ➀ 4-phase 1-Step/2-Step Excitation selected. Figure 3.10 (8). Output Waveforms of 4-Phase 1-Step Excitation (Normal Rotation and Reverse Rotation) 118 TOSHIBA CORPORATION TMP95C061 Figure 3.10 (9). Output Waveforms of 4-Phase 2-Step Excitation (Normal Rotation) The operation when channel 0 is selected is explained 1-step excitation will be selected when only one bit is below. set to “1” during the initialization of PG, while 4-phase The output latch of PG0 (also used as P6) is shifted at 2-step excitation will be selected when two consecu- the rising edge of the trigger signal from the timer to be tive bits are set to “1”. output to the port. The value in the shift alternate registers are ignored The direction of shift is specified by PG01CR when the 4-phase 1-step/2-step excitation mode is : Normal rotation (PG00 → PG01 → PG02 → selected. PG03) when is set to “0”; reverse rotation Figure 3.10 (10) shows the block diagram. (PG00 ← PG01 ← PG02 ← PG03) when “1”. 4-phase Figure 3.10 (10). Block Diagram of 4-Phase 1-Step Excitation/2-Step Excitation (Normal Rotation) TOSHIBA CORPORATION 119 TMP95C061 ➁ 4-Phase 1-2 Step Excitation Figure 3.10 (11) shows the output waveforms of 4- phase 1 -2 step excitation when channel 0 is selected. Figure 3.10 (11). Output Waveforms of 4-Phase 1-2 Step Excitation (Normal Rotation and Reverse Rotation) 120 TOSHIBA CORPORATION TMP95C061 The initialization for 4-phase 1-2 step excitation is as example, to change the output waveform shown in follows: Figure 3.10 (11) into negative logic, change the initial By rearranging the initial value “b7 b6 b5 b4 b3 b2 b1 value to “00110111”. b0” to “b7 b3 b6 b2 b5 b1 b4 b0”, the consecutive 3 The operation will be explained below for channel 0. bits are set to “1” and other bits are set to “0” (positive The output latch of PG0 (shared by P7) and the shifter logic). alternate register (SA0) for Pattern Generation are For example, if b7, b3, and b6 are set to “1", the initial shifted at the rising edge of trigger signal from the timer value becomes “11001000”, obtaining the output to be output to the port. The direction of shift is set by waveforms as shown in Figure 3.10 (11). PG01CR . To get an output waveform of negative logic, set values Figure 3.10 (12) shows the block diagram. 1’s and 0’s of the initial value should be inverted. For Figure 3.10 (12). Block Diagram of 4-Phase 1-2 Step Excitation (Normal Rotation) TOSHIBA CORPORATION 121 TMP95C061 Setting example: To drive channel 0 (PG0) by 4-phase 1-2 timer 0 is selected, set each register as follows: step excitation (normal rotation) when (3) Trigger Signal From Timer not equal to the trigger signal of timer flip-flop (TFF1, TFF4, TFF5, and TFF6) and differs as shown in Table The trigger signal from the timer which is used by PG is 3.10 (1) depending on the operation mode of the timer. Table 3.10 (1) Select of Trigger Signal TFF1 Inversion PG Shift 8-bit timer mode Selected by TFFCR when the up-counter value matches TREG0 or TREG1 value. 16-bit timer mode When the up-counter value matches with both TREG0 and TREG1 values. (The value of up-counter = TREG1*28 + TREG0) PPG output mode When the up-counter value matches with both TREG0 and TREG1. When the up-counter value matches TREG1 value (PPG cycle). PWM output mode When the up-counter value matches TREG0 value and PWM cycle. Trigger signal for PG is not generated. Note: To shift PG, TFFCR must be set to “1” to enable TFF1 inversion. Channel 1 of PG can be synchronized with the 16-bit trigger is generated when the value in UC4 and the timer Timer 4/Timer 5. In this case, the PG shift trigger value in TREG5 match. When using a trigger signal signal from the 16-bit timer is output only when the up- from Timer 5, set T5FFCR to 1. Generates a counter UC4/UC5 value matches TREG5/TREG7. trigger when the value in UC5 and the value in TREG7 When using a trigger signal from Timer 4, set either match. T4FFCR or T4MOD to “1” and a 122 TOSHIBA CORPORATION TMP95C061 (4) Application of PG and Timer Output To drive a stepping motor, in addition to the value of each phase (PG output), synchronizing signal is often As explained in “Trigger signal from timer”, the timing required at the timing when excitation is changed over. to shift PG and invert TFF differs depending on the In this application, port 7is used as a stepping motor mode of timer. An application to operate PG while control port to output a synchronizing signal to the operating an 8-bit timer in PPG mode will be explained TO1 pin (shared by PA2). below. Figure 3.10 (13). Output Waveforms of 4-Phase 1-Step Excitation Setting example: TOSHIBA CORPORATION 123 TMP95C061 3.11 Serial Channel The serial channel has the following operation modes: TMP96C061 contains two serial Input/Output channels. ● I/O interface mode Mode 0: To transmit and receive I/O data as well as the synchronizing signal SCLK for extending I/O. Mode 1: 7-bit data ● Asynchronous transmission Mode 2: 8-bit data (UART) mode Mode 3: 9-bit data In mode 1 and mode 2, a parity bit can be added. Mode Figure 3.11 (1) shows the data format (for one frame) in 3 has wake-up function for making the master controller start each mode. slave controllers in serial link (multi-controller system). Figure 3.11 (1). Data Formats 124 TOSHIBA CORPORATION TMP95C061 The serial channel has a buffer register for transmitting detected to be normal at least twice in three samplings. and receiving operations, in order to temporarily store trans- When the transmission buffer becomes empty and mitted or received data, so that transmitting and receiving requests the CPU to send the next transmission data, or when operations can be done independently (full duplex). data is stored in the receiving data register and the CPU is However, in I/O interface mode, SCLK (serial clock) pin is requested to read the data, INTTX or INTRX interrupt occurs. used for both transmission and receiving, the channel Besides, if an overrun error, parity error, or framing error occurs becomes half-duplex. during receiving operation, flag SC0CR/SC1CR will be set. to prevent the occurrence of overrun error and provides one The serial channel 0/1 includes a special baud rate gen- frame of margin before CPU reads the received data. The erator, which can set any baud rate by dividing the frequency receiving data register stores the already received data while of four clocks (φT0, φT2, φT8, and φT32) from the internal pres- the buffer register receives the next frame data. caler (shared by 8-bit/16-bit timer) by the value 2 to 16. By using CTS and RTS (there is no RTS pin, so any one In I/O interface mode, it is possible to input synchronous port must be controlled by software), it is possible to halt data signals as well as to transmit or receive data by external clock. send until CPU finishes reading receive data every time a frame is received (Handshake function). 3.11.1 Control Registers In the UART mode, a check function is added not to start The serial channel is controlled by three control registers the receiving operation by error start bits due to noise. The SC0CR, SC0MOD, and BR0CR. Transmitted and received channel starts receiving data only when the start bit is data is stored in register SC0BUF. TOSHIBA CORPORATION 125 TMP95C061 Figure 3.11 (2). Serial Mode Control Register (Channel 0, SC0MOD) 126 TOSHIBA CORPORATION TMP95C061 Figure 3.11 (3). Serial Control Register (Channel, SC0CR) TOSHIBA CORPORATION 127 TMP95C061 Figure 3.11 (4). Serial Channel Control (Channel 0, BR0CR) Figure 3.11 (5). Serial Transmission/Receiving Buffer Registers (Channel 0, SC0BUF) 128 TOSHIBA CORPORATION TMP95C061 Figure 3.11 (6). Serial Mode Control Register (Channel 1, SC1MOD) TOSHIBA CORPORATION 129 TMP95C061 Figure 3.11 (7). Serial Control Register (Channel 1, SC1CR) 130 TOSHIBA CORPORATION TMP95C061 Figure 3.11 (8). Baud Rate Generator Control Register (Channel 0, BR0CR) Figure 3.11 (9). Serial Transmission/Receiving Buffer Registers (Channel 1, SC1BUF) TOSHIBA CORPORATION 131 TMP95C061 Figure 3.11 (10). Port 9 Function Register (P9FC) Port 3.11 (11). Port 9 Open Drain Enable Register (ODE) 132 TOSHIBA CORPORATION TMP95C061 3.11.2 Configuration Figure 3.11 (12) shows the block diagram of the serial channel 0. Figure 3.11 (12). Block Diagram of the Serial Channel 0 TOSHIBA CORPORATION 133 TMP95C061 Figure 3.11 (13) shows the block diagram of the serial channel 1. Figure 3.11 (13). Block Diagram of the Serial Channel 1 134 TOSHIBA CORPORATION TMP95C061 ➀ Baud Rate Generator of these input clocks is selected by the baud rate genera- tor control register bit / of Baud rate generator comprises a circuit that gener- BR0CR/BR1CR. ates transmission and receiving clocks to determine the The baud rate generator includes a 4-bit frequency transfer rate of the serial channel. divider, which divides frequency by 2 to 16 values to The input clock to the baud rate generator, φT0 (fc/ determine the transfer rate. 4), φT2 (fc/16), φT8 (fc/64), or φT32 (fc/256) is generated How to calculate a transfer rate when the baud rate by the 9-bit prescaler which is shared by the timers. One generator is used is explained below. ● UART mode Transfer rate = Input clock of baud rate generator ÷ 16 Frequency divisor of baud rate generator ● I/O interface mode Transfer rate = Input clock of baud rate generator ÷2 Frequency divisor of baud rate generator The relation between the input clock and the source clock (fc) is as follows: φT0 = fc/4 φT2 = fc/16 φT8 = fc/64 φT32 = fc/256 Accordingly, when source clock fc is 12.288 MHz, input clock is φT2 (fc/16), and frequency divisor is 5, the transfer rate in UART mode becomes as follows: Transfer rate = fc/16 ÷ 16 5 = 12.288 x 106/16/5/16 = 9600 (bps) Table 3.11 (1) shows an example of the transfer rate in UART mode. Also with 8-bit timer 2, the serial channel can get a transfer rate. Table 3.11 (2) shows an example of baud rate using timer 2. Table 3.11 (1) Selection of Transfer Rate (1) (When Baud Rate Generator is Used) Unit (kbps) Input Clock φT0 φT2 φT8 φT32 fc [Mhz] Frequency (fc/4) (fc/16) (fc/64) (fc/256) Divisor 9.830400 2 76.800 19.200 4.800 1.200 ↑ 4 38.400 9.600 2.400 0.600 ↑ 8 19.200 4.800 1.200 0.300 ↑ 16 9.600 2.400 0.600 0.150 12.288000 5 38.400 9.600 2.400 0.600 ↑ A 19.200 4.800 1.200 0.300 14.745600 3 76.800 19.200 4.800 1.200 ↑ 6 38.400 9.600 2.400 0.600 ↑ C 19.200 4.800 1.200 0.300 Note: Transfer rate in I/O interface mode is 8 times as fast as the values given in the above table. TOSHIBA CORPORATION 135 TMP95C061 Table 3.11 (2) Selection of Transfer Rate (1) (When Timer 2 (Input Clock φT1) is Used) Unit (Kbps) fc 12.288MHz 12MHz 9.8304MHz 8MHz 6.144MHz TREG0 1H 96 76.8 62.5 48 2H 48 38.4 31.25 24 3H 32 31.25 16 4H 24 19.2 12 5H 19.2 9.6 8H 12 9.6 6 AH 9.6 4.8 10H 6 4.8 3 14H 4.8 2.4 How to calculate the transfer rate (when timer 2 is used): Transfer rate = fc TREG2 x 8 x 16 ↑ (When Timer 2 (input clock φT1) is used) Input clock of Timer 2 φT1 = 8/fc φT4 = 32/fc φT16 = 128/fc Note 1: Timer 2 match detect signal cannot be used as the transfer clock in I/O interface mode. ➁ Serial Clock Generation Circuit ➂ Receiving Counter This circuit generates the basic clock for transmitting The receiving counter is a 4-bit binary counter used in and receiving data. asynchronous communication (UART) mode and counts up by SIOCLK clock. Sixteen pulses of SIOCLK 1) I/O interface mode (channel 1 only) are used for receiving one bit of data, and the data bit is sampled three times at 7th, 8th and 9th clock. With the three samples, the received data is evaluated When in SCLK output mode with the setting of SC1CR by the rule of majority. = “0", the basic clock will be generated by dividing by 2 the output of the baud rate generator as For example, if the sampled data bit is “1", “0” and “1” described before. When in SCLK input mode with the at 7th, 8th and 9th clock respectively, the received data setting of SC0CR = “1", the rising edge or fall- is evaluated as “1”. The sampled data “0", “0” and “1” ing edge will be detected according to the setting of is evaluated that the received data is “0”. SC0CR register to generate the basic clock. ➃ Receiving Control 2) Asynchronous Communication (UART) mode 1) I/O interface mode (channel 1 only) According to the setting of SC0MOD/SC1MOD , the above baud rate generator clock, internal clock When in SCLK1 output mode with the setting of φ1 (max. 500 Kbps @ fc = 16MHz), or the match SC1CR = “0", RxD1 signal will be sampled at detect signal from timer 0 will be selected to generate the rising edge of shift clock which is output to SCLK the basic clock SIOCLK. pin. When in SCLK input mode with the setting SC1CR = “1", RxD1 signal will be sampled at the rising edge or falling edge of SCLK input according to the setting of SC1CR register. 136 TOSHIBA CORPORATION TMP95C061 2) Asynchronous Communication (UART) mode read before all bits of the next data are received by the receiving buffer 1, an overrun error occurs. If an over- The receiving control has a circuit for detecting the run error occurs, the contents of the receiving buffer 1 start bit by the rule of majority. When two or more “0” will be lost, although the contents of the receiving are detected during 3 samples, it is recognized as start buffer 2 and SC0CR SC1CR are still bit and the receiving operation is started. preserved. Reading data from receive data buffer 2 (SC0BUF/SC1BUF) clears interrupt request flags Data being received is also evaluated by the rule of INTR0 and INTRX1 . majority. The parity bit added in 8-bit UART mode and the most significant bit (MSB) in 9-bit UART mode are stored in ➄ Receiving Buffer SC0CR /SC1CR . When in 9-bit UART mode, the wake-up function of To prevent overrun error, the receiving buffer has a the slave controllers is enabled by setting SC0MOD double buffer structure. /SC1MOD to “1", and interrupt INTRX0/ Received data is stored one bit by one bit in the receiv- INTRX1 occurs only when SC0CR /SC1CR ing buffer 1 (shift register type). When 7 bits or 8 bits of is set to “1”. data are stored in the receiving buffer 1, the stored data is transferred to another receiving buffer 2 ➅ Transmission Counter (SC0BUF/SC1BUF), generating an interrupt INTRX0/ INTRX1. The CPU reads only receiving buffer 2 (SC0BUF/SC1BUF). Even before the CPU reads the Transmission counter is a 4-bit binary counter which is receiving buffer 2 (SC0BUF/SC1BUF), the received used in asynchronous communication (UART) mode data can be stored in the receiving buffer 1. However, and, like a receiving counter, counts by SIOCLK clock, unless the receiving buffer 2 (SC0BUF/SC1BUF) is generating TxDCLK every 16 clock pulses. Figure 3.11 (14). Generation of Transmission Clock ➆ Transmission Controller by bit to TxD1 pin at the rising edge or falling edge of SCLK input according to the setting of SC1CR 1) I/O interface mode register. In SCLK0 output mode with the setting of SC1CR 2) Asynchronous Communication (UART) mode = “0", the data in the transmission buffer are output bit by bit to TxD1 pin at the rising edge of shift When transmission data is written in the transmission clock which is output from SCLK1 pin. buffer sent from the CPU, transmission starts at the ris- In SCLK1 input mode with the setting SC1CR = ing edge of the next TxDCLK, generating a transmis- “1", the data in the transmission buffer are output bit sion shift clock TxDSFT. TOSHIBA CORPORATION 137 TMP95C061 Handshake function ated, requests the next send data to the CPU. Though there is no RTS pin, a handshake function can Serial channel 0 has a CTS0 pin. Using this pin, data be easily configured by setting any port assigned to the can be sent in units of one frame; thus, overrun errors RTS function. The RTS should be output “High” to can be avoided. The handshake function is enabled/ request data send halt after data receive is completed disabled by SC0MOD . by a software in the RXD interrupt routine. When the CTS0 pin goes high, after completion of the current data send, data send is halted until the CTS0 pin goes low again. The INTTX0 Interrupts are gener- Figure 3.11 (15). Handshake Function Figure 3.11 (16). Timing of CTS (Clear to Send) 138 TOSHIBA CORPORATION TMP95C061 ➇ Transmission Buffer UART mode and with SC0MOD /SC1MOD when in 8-bit UART mode. If they are not equal, a par- Transmission buffer (SC0BUF/SC1BUF) shifts to and ity error occurs, and SC0CR /SC1CR sends the transmission data written from the CPU from flag is set. the least significant bit (LSB) in order, using transmis- sion shift clock TxDSFT which is generated by the ➉ Error Flag transmission control. When all bits are shifted out, the transmission buffer becomes empty and generates Three error flags are provided to increase the reliability INTTX0/INTTX1 interrupt. of receiving data. ➈ Parity Control Circuit 1. Overrun error When serial channel control register SC0CR / If all bits of the next data are received in receiving buffer SC1CR is set to “1", it is possible to transmit 1 while valid data is stored in receiving buffer 2 and receive data with parity. However, parity can be (SCBUF0/1), an overrun error will occur. added only in 7-bit UART or 8-bit UART mode. With SC0CR /SC1CR register, even (odd) parity can be selected. 2. Parity error For transmission, parity is automatically generated according to the data written in the transmission buffer The parity generated for the data shifted in receiving (SC0BUF/SC2BUF), and data are transmitted after buffer 2 (SCBUF0/1) is compared with the parity bit being stored in SC0BUF /SC1BUF received from RxD pin. If they are not equal, a parity when in 7-bit UART mode while in SC0MOD / error occurs. SC1MOD when in 8-bit UART mode. and must be set before transmission data are 3. Framing error written in the transmission buffer. For receiving, data is shifted in the receiving buffer 1, The stop bit of received data is sampled three times and parity is added after the data is transferred in the around the center. If the majority is “0", a framing error receiving buffer 2 (SC0BUF/SC1BUF), and then com- occurs. pared with SC0BUF /SC1BUF when in 7-bit 11 Generating Timing 1) UART mode Receiving Mode 9 Bit 8 Bit + Parity 8 Bit, 7 Bit + Parity, 7 Bit Interrupt timing Center of last bit (Bit 8) Center of last bit (parity bit) Center of stop bit Framing error timing Center of stop bit Center of stop bit Center of stop bit Parity error timing Center of last bit (Bit 8) Center of last bit (parity bit) Center of stop bit Overrun error timing Center of last bit (Bit 8) Center of last bit (parity bit) Center of stop bit Note: Framing error occurs after an interrupt has occurred. Therefore, to check for framing error during interrupt operation, it is necessary to wait for 1 bit period of transfer rate. Transmitting Mode 9 Bit 8 Bit + Parity 8-Bit, 7 Bit + Parity, 7 Bit Interrupt timing Just before last bit is transmitted. ← ← TOSHIBA CORPORATION 139 TMP95C061 2) I/O Interface mode SCLK output mode Immediately after rise of last SCLK signal. (See Figure 3.11 (19).) Transmission interrupt timing Immediately after rise of last SCLK signal (rising mode), or immediately after fall in falling mode. SCLK input mode (See Figure 3.11 (20).) Timing used to transfer received data to data receive buffer 2 (SC1BUF); that is, immediately after SCLK output mode last SCLK. (See Figure 3.11 (21).) Receiving interrupt timing Timing used to transfer received data to data receive buffer 2 (SC1BUF); that is, immediately after SCLK input mode SCLK. (See Figure 3.11 (22).) 140 TOSHIBA CORPORATION TMP95C061 3.11.3 Operational Description for transmitting or receiving data to or from the external shifter register. (1) Mode 0 (I/O interface mode) This mode includes SCLK output mode to output syn- chronous clock SCLK and SCLK input mode to input This mode is used to increase the number of I/O pins external synchronous clock SCLK. Figure 3.11 (17). Example of SCLK Output Mode Connection FIgure 3.11 (18). Example of SCLK Input Mode Connection TOSHIBA CORPORATION 141 TMP95C061 ➀ Transmission time the CPU writes data in the transmission buffer. When all data is output, INTES0 will be set to generate In SCLK output mode, 8-bit data and synchronous clock INTTX0 interrupt. are output from TxD pin and SCLK0 pin, respectively, each Figure 3.11 (19) Transmitting Operation in I/O Interface Mode (SCLK Output Mode) (Channel 1) In SCLK output mode, 8-bit data are output from TxD0 When all data are output, INTES0 will be set pin when SCLK0 input becomes active while data are to generate INTTX0 interrupt. written in the transmission buffer by CPU. Figure 3.11 (20). Transmitting Operation in I/O Interface Mode (SCLK Input Mode) 142 TOSHIBA CORPORATION TMP95C061 ➁ Receiving is cleared by reading the received data. When 8-bit data are received, the data will be trans- In SCLK output mode, synchronous clock is output ferred in the receiving buffer 2 (SC1BUF) at the timing from SCLK pin and the data is shifted in the receiving shown below, and INTES1 will be set again buffer 1 whenever the receive interrupt flag INTES0 to generate INTRX1 interrupt. Figure 3.11 (21). Receiving Operation in I/O Interface Mode (SCLK Output Mode) In SCLK input mode, the data is shifted in the receiving data will be shifted in the receiving buffer 2 (SC1BUF) at buffer 1 when SCLK input becomes active, while the the timing shown below, and INTES1 will be set receive interrupt flag INTES1 is cleared by read- again to generate INTRX interrupt. ing the received data. When 8-bit data is received, the Figure 3.11 (22). Receiving Operation in I/O Interface Mode (SCLK Input Mode) Note: For data receiving, the system must be placed in the receive enable state (SC1MOD = “1”) TOSHIBA CORPORATION 143 TMP95C061 (2) Mode 1 (7-bit UART Mode) and even parity or odd parity is selected by SC0CR /SC1CR when is set to “1” The 7-bit mode can be set by setting serial channel (enable). mode register SC0MOD /SC1MOD to “01”. Setting example: When transmitting data with the fol- In this mode, a parity bit can be added, and the addi- lowing format, the control registers tion of a parity bit can be enabled or disabled by serial should be set as described below. channel control register SC0CR /SC1CR , Channel 0 is explained here. (3) Mode 2 (8-bit UART Mode) even parity or odd parity is selected by SC0CR /SC1CR when is set to “1” The 8-bit UART mode can be specified by setting (enable). SC0MOD / SC1MOD to “10”. In this mode, parity bit can be added, the addition of a Setting example: When receiving data with the follow- parity bit is enabled or disabled by SC0CR , and ing format, the control register should be set as described below. 144 TOSHIBA CORPORATION TMP95C061 (4) Mode 3 (9-bit UART Mode) Wake-up function The 9-bit UART mode can be specified by setting In 9-bit UART mode, the wake-up function of slave SC0MOD /SC1MOD to “11”. In controllers is enabled by setting SC0MOD / this mode, parity bit cannot be added SC1MOD to “1”. The interrupt INTRX1/INTRX0 occurs only when = 1. For transmission, the MSB (9th bit) is written in SC0M0D , while in receiving it is stored in SCCR . For writing and reading the buffer, the MSB is read or written first, then SC0BUF/SC1BUF. Figure 3.11 (23). Serial Link Using Wake-Up Function TOSHIBA CORPORATION 145 TMP95C061 Protocol ➂ The master controller transmits one-frame data includ- ing the 8-bit select code for the slave controllers. The ➀ Select the 9-bit UART mode for master and slave con- MSB (bit 8) is set to “1”. trollers. ➁ Set SC0MOD /SC1MOD bit of each slave controller to “1” to enable data receiving. ➃ Each slave controller receives the above frame, and ➄ The master controller transmits data to the specified clears WU bit to “0” if the above select code matches slave controller whose SC0MOD /SC1MOD its own select code. bit is cleared to “0.” The MSB (bit 8) is cleared to “0”. ➅ The other slave controllers (with the bit remain- The slave controllers (WU = 0) can transmit data to the ing at “1”) ignore the receiving data because their master controller, and it is possible to indicate the end MSBs (bit 8 or ) are set to “0” to disable the of data receiving to the master controller by this trans- interrupt INTRX0/INTRX1. mission. 146 TOSHIBA CORPORATION TMP95C061 Setting Example: To link two slave controllers serially the internal clock φ1 (fc/2) as the with the master controller, and use transfer clock. Since serial channels 0 and 1 operate in exactly the same way, channel 0 is used for the purposes of expla- nation. TOSHIBA CORPORATION 147 TMP95C061 3.12 Analog/Digital Converter Figure 3.12 (1) shows the block diagram of the A/D con- TMP95C061 contains a high-speed analog/digital converter verter. The 4-channel analog input pins (AN3 to AN0) are (A/D converter) with 4-channel analog input that features 10-bit shared by input-only P9 and so can be used as input port. successive approximation. Figure 3.12 (1). Block Diagram of A/D Converter Note 1: This A/D converter does not have a built-in sample and hold circuit. Therefore, when A/D converting high-frequency signals, connect a sample and hold circuit externally. Note 2: To lower the power supply current in IDLE or STOP mode, depending on the timing, standby mode can be entered with the internal comparator in enable state. Thus, stop A/D conversion before executing the HALT instruction. The ladder resistor between VREF (VREFH) - AGND (VREFL) cannot be disconnected internallly. 148 TOSHIBA CORPORATION TMP95C061 Figure 3.12 (2). A/D Control Register TOSHIBA CORPORATION 149 TMP95C061 Figure 3.12 (3-1). A/D Conversion Result Register (ADREG0, 1) 150 TOSHIBA CORPORATION TMP95C061 Figure 3.12 (3-2). A/D Conversion Result Register (ADREG2, 3) TOSHIBA CORPORATION 151 TMP95C061 3.12.1 Operation (5) A/D Conversion Speed Selection (1) Analog Reference Voltage There are four A/D conversion speed modes. The selection is executed by ADMOD High analog reference voltage is applied to the VREF register. (VREFH) pin, and low analog reference voltage is When reset, ADMOD will be initialized to “0,” applied to AGND (VREFL) pin. so that high speed conversion mode will be selected. The reference voltage between VREG (VREFH) and AGND (VREFL) is divided by 1024 using ladder resis- (6) A/D Conversion End and Interrupt tance, and compared with the analog input voltage for A/D conversion. • A/D conversion single mode (2) Analog Input Channels ADMOD for A/D conversion end will be set to “1,” ADMOD flag will be reset to “0,” and INTAD interrupt will be enabled when A/D conversion Analog input channel is selected by ADMOD . However, which channel to select depends on the mode or when A/D conversion of the last channel ends operation mode of the A/D converter. in channel scan mode. In fixed analog input mode, one channel is selected by • A/D conversion repeat mode ADMOD among four pins: AN0 to AN3. For both fixed conversion channel mode and conver- In analog input channel scan mode, the number of sion channel scan mode, INTAD should be disabled channels to be scanned from AN0 is specified by when in repeat mode. Always set the INTE0AD at ADMOD , such as AN0 → AN1, AN0 → “000,” that disables the interrupt request. AN1 → AN2, and AN0 → AN1 → AN2 → AN3. Write “0” to ADMOD to end the repeat When reset, A/D conversion channel register will be ini- mode. Then, the repeat mode will be exited as soon as tialized to ADMOD = 00, so that AN0 pin the conversion in progress is completed. will be selected. The pins which are not used as analog input channel (7) Storing the A/D Conversion Result can be used as ordinary input port P9. The results of A/D conversion are stored in ADREG0 to (3) Starting A/D Conversion ADREG3 registers for each channel. In repeat mode, the registers are updated whenever conversion ends. A/D conversion starts when A/D conversion register ADREG0 to ADREG3 are read-only registers. ADMOD is written “1". When A/D conversion starts, A/D conversion busy flag ADMOD (8) Reading the A/D Conversion Result which indicates “conversion is in progress” will be set to “1". The results of A/D conversion are stored in ADREG0 to ADREG3 registers. When the contents of one of (4) A/D Conversion Mode ADREG0 to ADREG3 registers are read, ADMOD will be cleared to “0". Both fixed A/D conversion channel mode and A/D con- Reading data from the upper 8 bits of the register version channel scan mode have two conversion (ADREG0H, ADREG1H, ADREG2H, ADREG3H) for modes, i.e., single and repeat conversion modes. one of the channels in use clears interrupt request flag In fixed channel repeat mode, conversion of specified INTE0AD . one channel is executed repeatedly. In scan repeat mode, scanning from AN0, … → AN3 is executed repeatedly. A/D conversion mode is selected by ADMOD . 152 TOSHIBA CORPORATION TMP95C061 TOSHIBA CORPORATION 153 TMP95C061 3.13 Watchdog Timer (Runaway Detecting Timer) watchdog timer detects a malfunction, it generates a non- TMP95C061 is containing watchdog timer of Runaway detect- maskable interrupt to notify the CPU of the malfunction, and ing. outputs 0 externally from watchdog timer out pin WDTOUT to The watchdog timer (WDT) is used to return the CPU to notify the peripheral devices of the malfunction. the normal state when it detects that the CPU has started to Connecting the watchdog timer output to the reset pin malfunction (runaway) due to causes such as noise. When the internally forces a reset. 154 TOSHIBA CORPORATION TMP95C061 3.13.1 Configuration (WDT). Figure 3.13 (1) shows the block diagram of the watchdog timer Figure 3.13 (1). Block Diagram of Watchdog Timer TOSHIBA CORPORATION 155 TMP95C061 The watchdog timer is a 22-stage binary counter which LDW (WDMOD), B100H ; disable uses φ (fc/2) as the input clock. There are four outputs from the LD (WDCR), 4EH ; write clear binary counter: 216/fc, 218/fc, 220/fc, and 222/fc. Selecting one SET 7, (WDMOD) ; enable again of the outputs with the WDMOD register generates a watch- In other words, the WDTOUT continues to output “0” until dog interrupt, and outputs watchdog timer out when an over- the clear code is written. flow occurs. The watchdog timer out pin (WDTOUT) outputs 0 to 8 to Since the watchdog timer out pin (WDTOUT) outputs “0” 20 states (640ns to 1.6µs @ 25MHz) and resets itself. due to a watchdog timer overflow, the peripheral devices can be reset. The watchdog timer out pin is set to “1” after dis- abling WDT and clearing the watchdog timer (by writing a clear code 4EH in the WDCR register). (Example) Figure 3.13 (2). Normal Mode Figure 3.13 (3). Reset Mode 156 TOSHIBA CORPORATION TMP95C061 3.13.2 Control Registers To disable, it is necessary to clear this bit to “0” and Watchdog timer WDT is controlled by two control registers write the disable code (B1H) in the watchdog timer WDMOD and WDCR. control register WDCR. This makes it difficult for the watchdog timer to be disabled by runaway. (1) Watchdog Timer Mode Register (WDMOD) However, it is possible to return from the disable state to enable state by merely setting to “1". ➀ Setting the detecting time of watchdog timer ➂ Watchdog timer out reset connection This 2-bit register is used to set the watchdog timer This register is used to connect the output of the interrupt time for detecting the runaway. This register is watchdog timer with RESET terminal, internally. Since initialized to WDMOD = 00 when reset, WDMOD is initialized to 0 at reset, a reset and therefore 216/fSYS is set. (The number of states is by the watchdog timer will not be performed. approximately 32,768). (2) Watchdog Timer Control Register (WDCR) ➁ Watchdog timer enable/disable control register This register is used to disable and clear the binary counter of the watchdog timer function. When reset, WDMOD is initialized to “1” enable the watchdog timer. • Disable control WDMOD ← 0 – – – – – x x Clear WDMOD to “0". WDCR ← 1 0 1 1 0 0 0 1 Write the disable code (B1H). • Enable control The binary counter can be cleared and resume counting by writing clear code (4EH) into the WDCR reg- Set WDMOD to “1". ister. • Watchdog timer clear control WDCR ← 0 1 0 0 1 1 1 0 Write the clear code (4EH). TOSHIBA CORPORATION 157 TMP95C061 Figure 3.13 (4). Watchdog Timer Mode Register 158 TOSHIBA CORPORATION TMP95C061 Figure 3.13 (5). Watchdog Timer Control Register TOSHIBA CORPORATION 159 TMP95C061 3.13.3 Operation ation by an anti-malfunction program. By connecting the The watchdog timer generates interrupt INTWD after the watchdog timer out pin to peripheral devices’ resets, a CPU detecting time set in the WDMOD register and malfunction can also be acknowledged to other devices. outputs a low level signal. The watchdog timer must be zero- The watchdog timer restarts operation immediately after cleared by software before an INTWD interrupt is generated. If resetting is released. the CPU malfunctions (runaway) due to causes such as noise, The watchdog timer stops its operation in the IDLE and but does not execute the instruction used to clear the binary STOP modes. In the RUN mode, the watchdog timer is counter, the binary counter overflows and an INTWD interrupt enabled. is generated. The CPU detects malfunction (runaway) due to However, the function can be disabled when entering the the INTWD Interrupt and it is possible to return to normal oper- RUN mode. 160 TOSHIBA CORPORATION TMP95C061 3.14 Bus Release Function BUSAK pin to low to indicate the bus is released. For bus The TMP95C061 supports a bus request pin (BUSRQ: also release timing and DRAM dedicated pin state when the DRAM used as P53) and a bus acknowledge pin (BUSAK: also used controller is in use, see 3.7 (5) Bus release mode. as P54). Set these pins using P5CR and P5FC. During bus release, the TMP95C061 cannot access internal I/Os and internal I/Os keep functioning. Therefore, the 3.14 (1) Operation Description watchdog timer continues counting. To use the bus release function, set runaway detect time with bus release time in con- When 0 is input to the BUSRQ pin, the TMP95C061 acknowl- sideration. edges a bus request. When the current bus cycle ends, the TMP95C061 sets the address bus (A23 to A0) and bus control 3.14 (2) Pin States as Bus Release signals (RD, WR, R/W, CS0 to 3) to high, then sets these sig- nals and the data bus (D15 to D0) output buffer to off, sets the Table 3.14 shows pin states at bus release. Table 3.14 Pin States as Bus Release TOSHIBA CORPORATION 161 TMP95C061 4. Electrical Characteristics 4.1 Absolute Maximum Symbol Parameter Rating Unit Vcc Power Supply Voltage -0.5 ~ 6.5 V V IN Input Voltage -0.5 ~ Vcc + 0.5 V Σ IOL Output Current (total) 102 mA Σ IOH Output Current (total) -120 mA PD Power Dissipation (Ta = 70°C) 600 mW T SOLDER Soldering Temperature (10s) 260 °C °C T STG Storage Temperature -65 ~ 150 ° T OPR Operating Temperature -20 ~ 70 C 4.2 DC Characteristics Vcc = 5V ± 10%, Ta = -20 to 70°C (8 to 25MHz) (Typical values are for Ta = 25°C and Vcc = 5V unless otherwise noted) Symbol Parameter Min Max Unit Test Condition V IL Input Low Voltage (AD0-15) -0.3 0.8 V V IL1 P5, P7, P8, P9, PA, PB -0.3 0.3Vcc V V IL2 RESET, NMI, INTO (PB7) -0.3 0.25Vcc V V IL3 EA, AM8/16 -0.3 0.3 V V IL4 X1 -0.3 0.2Vcc V V IH Input High Voltage (D0 to 15) 2.2 Vcc + 0.3 V V IH1 P5, P7, P8, P9, PA, PB 0.7Vcc Vcc + 0.3 V V IH2 RESET, NMI, INTO (PB7) 0.75Vcc Vcc + 0.3 V V IH3 EA, AM8/16 Vcc - 0.3 Vcc + 0.3 V V IH4 X1 0.8Vcc Vcc + 0.3 V V OL Output Low Voltage 0.45 V I OL = 1.6mA V OH Output High Voltage 2.4 V I OH = -400µA V OH1 0.75Vcc V I OH = -100µA V OH2 0.9Vcc V I OH = - 20µA Darlington Drive Current V EXT - 1.5V I DAR -1.0 -3.5 mA (8 Output Pins max.) R EXT = 1.1KΩ I LI Input Leakage Current 0.02 (Typ) ±5 µA 0.0 ≤ Vin ≤ Vcc I LO Output Leakage Current 0.05 (Typ) ±10 µA 0.2 ≤ Vin ≤ Vcc - 0.2 Operating Current (RUN) 50 mA fc = 25MHz 26 (Typ) IDLE 10 mA I cc 1.7 (Typ) STOP (Ta = -20 ~ 70°C) 50 µA 0.2 ≤ Vin ≤ Vcc - 0.2 0.2 (Typ) STOP (Ta = 0 ~ 50°C) 10 µA 0.2 ≤ Vin ≤ Vcc - 0.2 Power Down Voltage V IL2 = 0.2Vcc, V STOP 2.0 6.0 V (@STOP, RAM Back up) V IH2 = 0.8Vcc R RST RESET Pull Up Register 50 150 KΩ C IO Pin Capacitance 10 pF fc = 1MHz Schmitt Width V TH 0.4 1.0 (Typ) V RESET, NMI, INTO (PB7) RK Pull Down/Up Register 50 150 KΩ Note: I-DAR is guaranteed for a total of up to 8 ports. 162 TOSHIBA CORPORATION TMP95C061 4.3 AC Electrical Characteristics Vcc = 5V±10%, Ta = -20 ~ 70°C (8MHz to 25MHz) Variable 20MHz 25MHz No. Symbol Parameter Unit Min Max Min Max Min Max 1 tOSC Osc. Period (= x) 40 125 50 40 ns 2 tCLK CLK width 2x - 40 85 40 ns 3 tAK A0 to 23 Valid→CLK Hold 0.5x - 20 11.0 0 ns 4 tKA CLK Valid→A0 to 23 Hold 1.5x - 60 240 0 ns 5 tAC A0 to 23 Valid→RD/WR fall 0.5x - 20 160 20 ns 6 tCA RD/WR rise→A0 to 23 Hold 0.5x - 20 11.0 0 ns 7 tAD A0 to 23 Valid→D0 - 15 input 3.0x - 35 140 105 ns 8 tRD RD fall →D0 - 15 input 3.5x - 40 85 60 ns 9 tRR RD Low width 2.0x - 40 85 60 ns 10 tHR RD rise→D0 to 15 Hold 0 0.0 0 ns 11 tWW WR Low width 2.5x - 40 85 60 ns 12 tDW D0 to 15 Valid→WR rise 2.0x - 40 60 40 ns 13 tWD WR rise→D0 to 15 Hold 0.5x - 10 15 10 ns 14 tAW A0 to 23 Valid→ WAIT input (1WAIT + n mode) 3.5x - 90 85 50 ns 15 tCW WR Low width 2.5x - 0 125 100 ns 16 tAPH A0 to 23 Valid → PORT input 2.5x - 90 35 10 ns 17 tAPH2 A0 to 23 Valid → PORT Hold 2.5x - 50 175 150 ns 18 tCP WR rise → PORT Valid 200 200 200 ns AC Measuring Conditions • Output Level: High 2.2V /Low 0.8V, CL50pF (However, D0 to D15, A0 to A23, ALE, RD, WR, HWR, R/W, CLK, CS0 to CS3, CL = 100pF) • Input Level: High 2.4V /Low 0.45V (D0 to D15) High 0.8Vcc /Low 0.2Vcc (except for D0 to D15) TOSHIBA CORPORATION 163 TMP95C061 (1) Read Cycle 164 TOSHIBA CORPORATION TMP95C061 (2) Write Cycle TOSHIBA CORPORATION 165 TMP95C061 4.4 DRAM Control AC Characteristics Vcc = 5V±10% TA = -20 ~ 70°C (8MHz to 25MHz) Variable 20MHz 25MHz No. Symbol Parameter Unit Min Max Min Max Min Max 1 tRC RAS cycle time 4x 200 160 ns 2 tRAC RAS access time 3x -40 110 80 ns 3 tCAC CAS access time 1.5x - 25 40 25 ns 4 tAA Column address access time 2.5x - 35 70 45 ns 5 tOFF Input data hold time 0 0 0 ns 6 tRP RAS precharge time 1.5x - 10 65 50 ns 7 tRAS RAS low pulse width 2.5x - 30 65 70 ns 8 tRSH RAS hold time 1x - 15 65 25 ns 9 tCSH CAS hold time 3x - 35 65 85 ns 10 tCAS CAS low pulse width 1.5x - 15 65 45 ns 11 tRCD RAS - CAS delay time 1.5x - 40 1.5x 35 75 20 60 ns 12 tRAD CAS column address delay time 0.5x - 5 0.5x - 20 20 45 15 40 ns 13 tCRP RAS - CAS precharge time 1x - 35 15 5 ns 14 tCP CAS precharge time 2.5x - 35 90 65 ns 15 tASR Low address setup time 0.5x - 15 10 5 ns 16 tRAH Low address hold time 0.5x - 5 20 15 ns 17 tASC Column address setup time 1x - 25 25 15 ns 18 tCAH Column address hold time 2x - 35 65 45 ns 19 tRAL Column address RAS read time 2x - 30 70 50 ns 20 tCWL Write command CAS read time 2.5x - 35 90 65 ns 21 tDS Data output setup time 0.5x - 5 10 5 ns 22 tDH Data output hold time 2x - 35 65 45 ns 23 tWCS Write command setup time 1x - 30 20 10 ns 24 tCHR*1 CAS hold time 2x - 50 50 30 ns 25 tRPC* RAS precharge CAS active time 1.5x - 30 45 30 ns 26 tCSR* CAS setup time 0.5x - 10 15 10 ns 27 tRPS*2 RAS precharge time 6x - 50 250 190 ns 28 tCHS*2 CAS hold time 0 0 0 ns 29 tCFL Refresh setup time 1x - 5 45 35 ns 30 tCFH Refresh hold time 1x - 10 40 30 ns *1 CAS before RAS interval refresh mode *2 CAS before RAS self-refresh mode * Both refresh modes AC Measuring Conditions • Output Level: High 2.2V /Low 0.8V, CL50pF (However CL = 100pF for D0 to D15, A0 to A23, RD, WR, HWR, R/W RAS) • Input Level: High 2.4V /Low 0.45V (AD0 ~ AD15) High 0.8Vcc/Low 0.2Vcc (except for D0 to D15) 166 TOSHIBA CORPORATION TMP95C061 (1) Read/Write Access Cycle TOSHIBA CORPORATION 167 TMP95C061 (2) CAS Before RAS Interval Refresh Cycle (3) CAS Before RAS Self-Refresh Cycle 168 TOSHIBA CORPORATION TMP95C061 4.5 A/D Conversion Characteristics Vcc = 5V±10% TA = -20 ~ 70°C (8 to 25MHz) Symbol Parameter Min Typ Max Unit VREF Analog reference voltage Vcc - 1.5 Vcc Vcc AGND Analog reference voltage Vss Vss Vss V VAIN Analog input voltage range Vss Vcc IREF Analog current for analog reference voltage 0.5 1.5 mA Slow mode ±1.5 ±4.0 Error 4 ≤ fc ≤ 16MHz Fast mode ±3.0 ±6.0 (Quantize error of LSB ±0.5 LSB not included) Slow mode ±1.5 ±4.0 16 ≤ fc ≤ 25MHz Fast mode ±4.0 ±8.0 4.6 Serial Channel Timing - I/O Interface Mode Vcc = 5V±10% TA = -20 to 70°C (8 to 25MHz) (1) SCLK Input Mode Variable 16MHz 20MHz Symbol Parameter Unit Min Max Min Max Min Max tSCY SCLK cycle 16x 0.8 0.64 µs tOSS Output Data→rising edge of SCLK tSCY/2 - 5x - 50 100 70 ns tOHS SCLK rising edge→output data hold 5x - 100 150 100 ns tHSR SCLK rising edge→input data hold 0 0 0 ns tSRD SCLK rising edge→effective data input tSCY - 5x - 100 450 340 ns Vcc = 5V±10% TA = -20 to 70°C (8 to 25MHz) (2) SCLK Output Mode Variable 16MHz 20MHz Symbol Parameter Unit Min Max Min Max Min Max tSCY SCLK cycle (programmable) 16x 8192x 0.8 512 0.64 409.6 µs tOSS Output Data→rising edge of SCLK tSCY - 2x - 150 550 410 ns tOHS SCLK rising edge→output data hold 2x - 80 20 0 ns tHSR SCLK rising edge→input data hold 0 0 0 ns tSRD SCLK rising edge→effective data input tSCY - 2x - 150 550 410 ns 4.7 Timer/Counter Input Clock (TI0, TI4, TI5, TI6, TI7) Vcc = 5V±10% TA = -20 to 70°C (8 to 25MHz) Variable 20MHz 25MHz Symbol Parameter Unit Min Max Min Max Min Max tVCK Clock cycle 8x + 100 500 420 ns tVCKL Low level clock pulse width 4x + 40 240 200 ns tVCKH High level clock pulse width 4x + 40 240 200 ns TOSHIBA CORPORATION 169 TMP95C061 4.8 Interrupt Operation Vcc = 5V±10% Ta = -20 to 70°C (8 to 25MHz) Variable 20MHz 25MHz Symbol Parameter Unit Min Max Min Max Min Max tINTAL NMI, INT0 Low level pulse width 4x 200 160 ns tINTAH NMI, INT0 High level pulse width 4x 200 160 ns tINTBL INT4 ~ INT7 Low level pulse width 8x + 100 500 420 ns tINTBH INT4 ~ INT7 High level pulse width 8x + 100 500 420 ns 170 TOSHIBA CORPORATION TMP95C061 4.9 Timing Chart for I/O Interface Mode TOSHIBA CORPORATION 171 TMP95C061 4.10 Timing Chart for Bus Request (BUSRQ)/BUS Acknowledge (BUSAK) Variable 20MHz 25MHz Symbol Parameter Unit Min Max Min Max Min Max tBRC BUSRQ setup time for CLK 120 120 120 ns tCBAL CLK→BUSAK falling edge 1.5x + 120 220 200 ns tCBAH CLK→BUSAK rising edge 0.5x + 40 65 60 ns tABA Floating time to BUSAK fall 0 80 0 80 0 80 ns tBAA Floating time to BUSAK rise 0 80 0 80 0 80 ns Note: The bus will be released after the WAIT request is inactive, when the BUSRQ is set to “0” during “wait” cycle. 172 TOSHIBA CORPORATION TMP95C061 5. Table of Special Function Registers (3) Timer control (SFRs) (4) Pattern Generator control (SFR; Special Function Register) (5) Watch Dog Timer control The special function registers (SFRs) include the I/O ports (6) Serial Channel control and peripheral control registers allocated to the 128-byte (7) A/D converter control addresses from 000000H to 00007FH. (8) Interrupt control (1) I/O port (9) Chip Select/Wait Control (2) I/O port control (10) DRAM Control Configuration of the table TOSHIBA CORPORATION 173 TMP95C061 Table 5 I/O Register Address Map 174 TOSHIBA CORPORATION TMP95C061 (1) I/O Port TOSHIBA CORPORATION 175 TMP95C061 (2) I/O Port Control (1/2) 176 TOSHIBA CORPORATION TMP95C061 (2) I/O Port Control (2/2) TOSHIBA CORPORATION 177 TMP95C061 (3) Timer Control (1/3) 178 TOSHIBA CORPORATION TMP95C061 (3) Timer Control (2/3) TOSHIBA CORPORATION 179 TMP95C061 (3) Timer Control (3/3) 180 TOSHIBA CORPORATION TMP95C061 (4) Pattern Generator (5) Watch Dog Timer TOSHIBA CORPORATION 181 TMP95C061 (6) Serial Channel 182 TOSHIBA CORPORATION TMP95C061 (7) A/D Converter Control TOSHIBA CORPORATION 183 TMP95C061 (8) Interrupt Control (1/2) 184 TOSHIBA CORPORATION TMP95C061 (8) Interrupt Control (2/2) TOSHIBA CORPORATION 185 TMP95C061 (9) Chip Select/Wait Control (1/2) 186 TOSHIBA CORPORATION TMP95C061 (9) Chip Select/Wait Control (2/2) (10) DRAM Control TOSHIBA CORPORATION 187 TMP95C061 6. Port Section Equivalent Circuit Diagram STOP: This signal becomes active “1” when the hold • Reading The Circuit Diagram mode setting register is set to the STOP mode (WDMOD = 0,1) and the CPU Basically, the gate symbols written are the same as executes the HALT instruction. When the drive those used for the standard CMOS logic IC [74HCXX] enable bit [DRVE] is set to “1”, however, STP series. remains at “0”. The dedicated signal is described below. • The input protection resistor ranges from several tens of ohms to several hundreds of ohms. • D0 to D7, P1 (D8 to 15) • P2 (A16 to A23), A0 to A15, RD, WR, P6 • P52 52, P7, P81, P82. P84, P85, PA, PB6 ~ B0 188 TOSHIBA CORPORATION TMP95C061 • P9 (AN0 to 3) • P87 (INT0) • P80 (TXD0), P83 (TXD1) • NMI • WDTOUT TOSHIBA CORPORATION 189 TMP95C061 • CLK • EA, AM8/16 • RESET • X1, X2 • VREF (VREFH), AGND (VREFL) 190 TOSHIBA CORPORATION TMP95C061 7. Care Points and Restriction (2) Care Points (1) Special Expression ➀ EA, pin, AM/16 pin ➀ Explanation of a built-in I/O register: Register Fix these pins VCC or GND unless changing voltage. Symbol ex) TRUN . . . Bit T0RUN of Register TRUN ➁ Warming-up Counter ➁ Read, Modify and Write Instruction The warming-up counter operates when the STOP mode. is released even the system which is used an An instruction which CPU executes following by one external oscillator. As a result, it takes warming up time instruction. from inputting the releasing request to outputting the system clock. 1. CPU reads data of the memory. ➂ Programmable Pull Up/Down Resistance 2. CPU modifies the data. The programmable pull up/down resistors can be 3. CPU writes the data to the same memory. selected ON/OFF by program when they are used as the input ports. The case of they are used as the out- ex1) SET 3, (TRUN) . . . set bit3 of TRUN put ports, they cannot be selected ON/OFF by pro- ex2) INC1, (100H) . . . increment the data of 100H gram. • The representative Read, Modify and Write Instruction in the TLCS-900 ➃ Bus Releasing Function SET imm, mem, RES imm, mem CHG imm, mem, TSET imm, mem Refer to the “Note about the Bus Release” in 3.5 Func- INC imm, mem, DEC imm, mem tions of Ports because the pin state when the bus is RLD A, mem, ADD imm, reg released is written. ➂ 1 state ➄ Watch Dog Timer One cyclecycle clock divided by 2 oscillation frequency The watch dog timer starts operation immediately after is called 1 state. the reset is released. When the watch dog timer is not used, set watch dog timer to disable. ex) Oscillation frequency is 25MHz. 2/25MHz = 80ns = 1 state ➅ CPU (HDMA) Only the “LDC cr, r”, “LDC r, cr” instruction can be used to access the control register like transfer source address register (DMASn) in the CPU. TOSHIBA CORPORATION 191 TMP95C061 Notes 192 TOSHIBA CORPORATION