![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
toshiba toshiba corporation 1 tlcs-900 series TMP96C141AF 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 (of?e equipment, communication equipment, measuring equipment, domestic electri?ation, 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, traf? 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. cmos 16-bit microcontroller TMP96C141AF 1. outline and device characteristics the TMP96C141AF is high-speed advanced 16-bit microcon- troller developed for controlling medium to large-scale equip- ment. the TMP96C141AF is housed in an 80-pin ?t package. device characteristics are as follows: (1) original 16-bit cpu tlcs-90 instruction mnemonic upward compatible. 16m-byte linear address space general-purpose registers and register bank system 16-bit multiplication/division and bit transfer/arithmetic instructions high-speed micro dma - 4 channels (1.6 m s/2 bytes @ 20mhz) (2) minimum instruction execution time - 200ns @ 20mhz (3) internal ram: 1k byte internal rom: none (4) external memory expansion can be expanded up to 16m bytes (for both programs and data). can mix 8- and 16-bit external data buses. ? dynamic data bus sizing (5) 8-bit timers: 2 channels (6) 8-bit pwm timers: 2 channels (7) 16-bit timers: 2 channels (8) pattern generators: 4 bits, 2 channels (9) serial interface: 2 channels (10) 10-bit a/d converter: 4 channels (11) watchdog timer (12) chip select/wait controller: 3 blocks (13) interrupt functions 3 cpu interrupts ? ? swi instruction, privileged violation, and illegal instruction 14 internal interrupts 6 external interrupts (14) i/o ports (15) standby function : 3 halt modes (run, idle, stop) 7-level priority can be set.
2 toshiba corporation TMP96C141AF figure 1. TMP96C141AF block diagram toshiba corporation 3 TMP96C141AF 2. pin assignment and functions the assignment of input/output pins for TMP96C141AF, their name and outline functions are described below. figure 2.1 pin assignment (80-pin qfp) 2.1 pin assignment figure 2.1 shows pin assignment of TMP96C141AF. 4 toshiba corporation TMP96C141AF 2.2 pin names and functions the names of input/output pins and their functions are described below. note: with the external dma controller, this device s built-in memory or built-in i/o cannot be accessed using the busrq and busak pins. table 2.2. pin names and functions pin name number of pins i/o functions p00 ~ p07 ad0 ~ ad7 8 i/o tri-state port 0: i/o port that allows i/o to be selected on a bit basis address / data (lower): 0 - 7 for address / data bus p10 ~ p17 ad8 ~ ad15 a8 ~ a15 8 i/o tri-state output port 1: i/o port that allows i/o to be selected on a bit basis address data (upper): 8 - 15 for address / data bus address: 8 to 15 for address bus p20 ~ p27 a0 ~ a7 a16 ~ a23 8 i/o output output port 2: i/o port that allows selection of i/o on a bit basis (with pull-down resistor) address: 0 - 7 for address bus address: 16 - 23 for address bus p30 rd 1 output output port 30: output port read: strobe signal for reading external memory p31 wr 1 output output port 31: output port write: strobe signal for writing data on pins ad0 -7 p32 hwr 1 i/o output port 32: i/o port (with pull-up resistor) high write: strobe signal for writing data on pins ad8 - 15 p33 w ait 1 i/o input port 33: i/o port (with pull-up resistor) wait: pin used to request cpu bus wait p34 busrq 1 i/o input port 34: i/o port (with pull-up resistor) bus request: signal used to request high impedance for ad0 - 15, a0 - 23, rd , wr , hwr , r/w , ras , cs0 , cs1 , and cs2 pins. (for external dmac) p35 busak 1 i/o output port 35: i/o (with pull-up resistor) bus acknowledge: signal indicating that ad0 - 15, a0 - 23, rd , wr , hwr , r/w , ras , cs0 , cs1 , and cs2 pins are at high impedance after receiving busrq. (for external dmac) p36 r/w 1 i/o output port 36: i/o port (with pull-up resistor) read/write: 1 represents read or dummy cycle; 0, write cycle. p37 ras 1 i/o output port 37: i/o port (with pull-up resistor) row address strobe: outputs ras strobe for dram. p40 cs0 cas0 1 i/o output output port 40: i/o port (with pull-up resistor) chip select 0: outputs 0 when address is within speci?d address area. column address strobe 0: outputs cas strobe for dram when address is within speci?d address area. toshiba corporation 5 TMP96C141AF pin name number of pins i/o functions p41 cs1 cas1 1 i/o output output port 41: i/o port (with pull-up resistor) chip select 1: outputs 0 if address is within speci?d address area. column address strobe 1: outputs cas strobe for dram if address is within speci?d address area. p42 cs2 cas2 1 i/o output output port 42: i/o port (with pull-up resistor) chip select 2: outputs 0 if address is within speci?d address area. column address strobe 2: outputs cas strobe for dram if address is within speci?d address area. p50 ~ p53 an0 ~ an3 4 input input port 5: input port analog input: input to a/d converter vref 1 input pin for reference voltage input to a/d converter agnd 1 input ground pin for a/d converter p60 ~ p63 pg00 ~ pg03 4 i/o output ports 60 - 63: i/o ports that allow selection of i/o on a bit basis (with pull-up resistor) pattern generator ports: 00 - 03 p64 ~ p67 pg10 ~ pg13 4 i/o output ports 64 - 67: i/o ports that allow selection of i/o on a bit basis (with pull-up resistor) pattern generator ports: 10 - 13 p70 t10 1 i/o input port 70: i/o port (with pull-up resistor) timer input 0: timer 0 input p71 t01 1 i/o output port 71: i/o port (with pull-up resistor) timer output 1: timer 0 or 1 output p72 t02 1 i/o output port 72: i/o port (with pull-up resistor) pwm output 2: 8-bit pwm timer 2 output p73 t03 1 i/o output port 73: i/o port (with pull-up resistor) pwm output 3: 8-bit pwm timer 3 output p80 ti4 int4 1 i/o input input port 80: i/o port (with pull-up resistor) timer input 4: timer 4 count/capture trigger signal input interrupt request pin 4: interrupt request pin with programmable rising/falling edge p81 ti5 int5 1 i/o input input port 81: i/o port (with pull-up resistor) timer input 5: timer 4 count/capture trigger signal input interrupt request pin 5: interrupt request pin with rising edge p82 to4 1 i/o output port 82: i/o port (with pull-up resistor) timer output 4: timer 4 output pin p83 to5 1 i/o output port 83: i/o port (with pull-up resistor) timer output 5: timer 4 output pin 6 toshiba corporation TMP96C141AF note: pull-up/pull-down resistor can be released from the pin by software. pin name number of pins i/o functions p84 ti6 int6 1 i/o input input port 84: i/o port (with pull-up resistor) timer input 6: timer 5 count/capture trigger signal input interrupt request pin 6: interrupt request pin with programmable rising/falling edge p85 ti7 int7 1 i/o input input port 85: i/o port (with pull-up resistor) timer input 7: timer 5 count/capture trigger signal input interrupt request pin 7: interrupt request pin with rising edge p86 to6 1 i/o output port 86: i/o port (with pull-up resistor) timer output 6: timer 5 output pin p87 int0 1 i/o input port 87: i/o port (with pull-up resistor) interrupt request pin 0: interrupt request pin with programmable level/rising edge p90 txd0 1 i/o output port 90: i/o port (with pull-up resistor) serial send data 0 p91 rxd0 1 i/o input port 91: i/o port (with pull-up resistor) serial receive data 0 p92 cts0 1 i/o input port 92: i/o port (with pull-up resistor) serial data send enable 0 (clear to send) p93 txd1 1 i/o output port 93: i/o port (with pull-up resistor) serial send data 1 p94 rxd1 1 i/o input port 94: i/o port (with pull-up resistor) serial receive data 1 p95 sclk1 1 i/o i/o port 95: i/o port (with pull-up resistor) serial clock i/o 1 wdtout 1 output watchdog timer output pin nmi 1 input non-maskable interrupt request pin: interrupt request pin with falling edge. can also be operated at rising edge by program. clk 1 output clock output: outputs x1 ? 4 clock. pulled-up during reset. ea 1 input external access: 0 should be inputted with TMP96C141AF 1, with tmp96cm40f/tmp96pm40f. ale 1 output address latch enable reset 1 input reset: initializes lsi. (with pull-up resistor) x1/x2 2 i/o oscillator connecting pin vcc 2 power supply pin (+ 5v) vss 3 gnd pin (0v) toshiba corporation 7 TMP96C141AF 3. operation this section describes in blocks the functions and basic oper- ations of the TMP96C141AF device. check the chapter guidelines and restrictions for proper care of the device. 3.1 cpu the TMP96C141AF device has a built-in high-performance 16-bit cpu. (for cpu operation, see tlcs-900 cpu in the book core manual architecture user manual.) this section describes cpu functions unique to TMP96C141AF that are not described in that manual. 3.1.1 reset to reset the TMP96C141AF, the reset input must be kept at 0 for at least 10 system clocks (10 states: 1 m s with a 20mhz system clock) within an operating voltage range and with a stable oscillation. when reset is accepted, the cpu sets as follows: program counter (pc) to 8000h. stack pointer (xsp) for system mode to 100h. sysm bit of status register (sr) to 1. (sets to system mode.) iff2 to 0 bits of status register to 111. (sets mask register to interrupt level 7.) max bit of status register to 0. (sets to minimum mode.) bits rfp2 to 0 of status register to 000. (sets register banks to 0.) when reset is released, instruction execution starts from address 8000h. cpu internal registers other than the above are not changed. when reset is accepted, processing for built-in i/os, ports, and other pins is as follows: initializes built-in i/o registers as per specifications. sets port pins (including pins also used as built-in i/os) to general-purpose input/output port mode (sets i/o ports to input ports). sets the wdtout pin to 0. (watchdog timer is set to enable after reset.) pulls up the clk pin to 1. sets the ale pin to 0. 8 toshiba corporation TMP96C141AF 3.2 memory map figure 3.2 is a memory map of the TMP96C141AF. figure 3.2 memory map toshiba corporation 9 TMP96C141AF 3.3 interrupts the tlcs-900 interrupts are controlled by the cpu interrupt mask ?p-?p (iff2 to 0) and the built-in interrupt controller. the TMP96C141AF have altogether the following 23 interrupt sources: a ?ed individual interrupt vector number is assigned to each interrupt source; six levels of priority (variable) can also be assigned to each maskable interrupt. non-maskable inter- rupts have a ?ed priority of 7. when an interrupt is generated, the interrupt controller sends the value of the priority of the interrupt source to the cpu. when more than one interrupt is generated simulta- neously, the interrupt controller sends the value of the highest priority (7 for non-maskable interrupts is the highest) to the cpu. the cpu compares the value of the priority sent with the value in the cpu interrupt mask register (iff2 to 0). if the value is greater than that of the cpu interrupt mask register, the interrupt is accepted. the value in the cpu interrupt mask reg- ister (iff2 to 0) can be changed using the ei instruction (con- tents of the ei num/iff<2:0> = num). for example, programming ei 3 enables acceptance of maskable interrupts with a priority of 3 or greater, and non-maskable interrupts which are set in the interrupt controller. the di instruction interrupts from the cpu 3 (software interrupts, privileged violations, and illegal (unde?ed) instruction execution) interrupts from external pins (nmi, int0, and int4 to 7) 6 interrupts from built-in i/os 14 (iff<2:0> = 7) operates in the same way as the ei 7 instruc- tion. since the priority values for maskable interrupts are 0 to 6, the di instruction is used to disable maskable interrupts to be accepted. the ei instruction becomes effective immediately after execution. (with the tlcs-90, the ei instruction becomes effective after execution of the subsequent instruction.) in addition to the general-purpose interrupt processing mode described above, there is also a high-speed micro dma processing mode. high-speed micro dma is a mode used by the cpu to automatically transfer byte or word data. it enables the cpu to process interrupts such as data saves to built-in i/os at high speed. figure 3.3 (1) is a ?wchart showing overall interrupt processing. 10 toshiba corporation TMP96C141AF figure 3.3 (1) interrupt processing flowchart toshiba corporation 11 TMP96C141AF 3.3.1 general-purpose interrupt processing when accepting an interrupt, the cpu operates as follows: (1) the cpu reads the interrupt vector from the interrupt controller. when more than one interrupt with the same level is generated simultaneously, the interrupt controller generates interrupt vectors in accordance with the default priority (which is ?ed as follows: the smaller the vector value, the higher the priority), then clears the inter- rupt request. (2) the cpu pushes the program counter and the status register to the system stack area (area indicated by the system mode stack pointer). (3) the cpu sets a value in the cpu interrupt mask register 12 toshiba corporation TMP96C141AF table 3.3 (1) TMP96C141AF interrupt table default priority type interrupt source vector value ? start address high-speed micro dma start vector 1 non- maskable reset , or sw10 instruction 0000h 8000h 2 intprev: privileged violation, or swi1 0010h 8010h 3 intundef: illegal instruction, or swi2 0020h 8020h 4 swi 3 instruction 0030h 8030h 5 swi 4 instruction 0040h 8040h 6 swi 5 instruction 0050h 8050h 7 swi 6 instruction 0060h 8060h 8 swi 7 instruction 0070h 8070h 9 nmi pin 0080h 8080h 08h 10 intwd: watchdog timer 0090h 8090h 09h 11 maskable into pin 00a0h 80a0h 0ah 12 int4 pin 00b0h 80b0h 0bh 13 int5 pin 00c0h 80c0h 0ch 14 int6 pin 00d0h 80d0h 0dh 15 int7 pin 00e0h 80e0h 0eh - (reserved) 00f0h 80f0h 0fh 16 intt0: 8-bit timer 0 0100h 8100h 10h 17 intt1: 8-bit timer 1 0110h 8110h 11h 18 intt2: 8-bit timer 2/pwm0 0120h 8120h 12h 19 intt3: 8-bit timer 3/pwm1 0130h 8130h 13h 20 inttr4: 16-bit timer 4 (treg4) 0140h 8140h 14h 21 inttr5: 16-bit timer 4 (treg5) 0150h 8150h 15h 22 inttr6: 16-bit timer 5 (treg6) 0160h 8160h 16h 23 inttr7: 16-bit timer 5 (treg7) 0170h 8170h 17h 24 intrx0: serial receive (channel.0) 0180h 8180h 18h 25 inttx0: serial send (channel.0) 0190h 8190h 19h 26 intrx1: serial receive (channel.1) 01a0h 81a0h 1ah 27 inttx1: serial send (channel.1) 01b0h 81b0h 1bh 28 intad: a / d conversion completion 0 1 c 0 h 81c0h 1ch (reserved) 01d0h 81d0h 1dh (reserved) 01e0h 81e0h 1eh (reserved) 01f0h 81f0h 1fh 3.3.2 high-speed micro dma in addition to the conventional interrupt processing, the tlcs- 900 also has a high-speed micro dma function. when an interrupt is accepted, in addition to an interrupt vector, the cpu receives data indicating whether processing is high-speed micro dma mode or general-purpose interrupt. if high-speed micro dma mode is requested, the cpu performs high-speed micro dma processing. the tlcs-900 can process at very high speed com- pared with the tlcs-90 micro dma because it has transfer parameters in dedicated registers in the cpu. since those dedicated registers are assigned as cpu control registers, they can only be accessed by the ldc (privileged) instruction. toshiba corporation 13 TMP96C141AF (1) high-speed micro dma operation high-speed micro dma operation starts when the accepted interrupt vector value matches the micro dma start vector value set in the interrupt controller. the high-speed micro dma has four channels so that it can be set for up to four types of interrupt source. when a high-speed micro dma interrupt is accepted, data is automatically transferred from the transfer source address to the transfer destination address set in the control register, and the transfer counter is decremented. if the value in the counter after decrementing is other than 0, high-speed micro dma processing is completed. if the value in the counter after decrementing is 0, general-purpose interrupt processing is performed. in read-only mode, which is provided for dram refresh, the value in the counter is ignored and dummy read is repeated. the 32-bit control registers are used for setting transfer source/destination addresses. however, the tlcs-900 has only 24 address pins for output. a 16m-byte space is available for the high-speed micro dma. also in normal mode operation, the all address space (in other words, the space for system mode which is set by the cs/wait controller) can be accessed by high-speed micro dma processing. there are two data transfer modes: one-byte mode and one-word mode. incrementing, decrementing, and ?ing the transfer source/destination address after transfer can be done in both modes. therefore data can easily be transferred betweeni/o and memory and between i/os. for details of transfer modes, see the description of transfer mode registers. the transfer counter has 16 bits, so up to 65536 trans- fers (the maximum when the initial value of the transfer counter is 0000h) can be performed for one interrupt source by high- speed micro dma processing. a the data transferred by the m dma function, the transfer nter was decreased. when this counter is ??, the processor operates gen- eral interrupt processing. at this time if the same channel of interrupt is required next interrupt, the transfer counter starts from 65536. interrupt sources processed by high-speed micro dma processing are those with the high-speed micro dma start vectors listed in table 3.3 (1). 14 toshiba corporation TMP96C141AF the following timing chart is a high-speed m dma cycle of the transfer address increment mode (the other mode exe- cept the read-only mode is same as this) (condition: min mode, 16bit bus width for 16m byte, 0 wait) (2) register con?uration (cpu control register) these control registers cannot be set only ?cd cr, r?instruction. toshiba corporation 15 TMP96C141AF (3) transfer mode register details this condition is 16-bit bus width and 0 wait of source/destination address space. note: n: corresponds to high-speed m dma channels 0 - 3. dmadn +/dmasn + : post-increment (increments register value after transfer.) dmadn -/dmasn - : post-decrement (decrement register value after transfer.) all address space (the space for system mode) can be accessed by high-speed m dma. do not use unde?ed codes for transfer mode control. 16 toshiba corporation TMP96C141AF toshiba corporation 17 TMP96C141AF figure 3.3.3 (1) block diagram of interrupt controller 18 toshiba corporation TMP96C141AF (1) interrupt priority setting register toshiba corporation 19 TMP96C141AF (2) external interrupt control 20 toshiba corporation TMP96C141AF micro dma0 start vector 76543210 bit symbol dma0v8 dma0v7 dma0v6 dma0v5 dma0v4 read / write w after reset 00000 micro dma1 start vector 76543210 bit symbol dma1v8 dma1v7 dma1v6 dma1v5 dma1v4 read / write w after reset 00000 micro dma2 start vector 76543210 bit symbol dma2v8 dma2v7 dma2v6 dma2v5 dma2v4 read / write w after reset 00000 micro dma3 start vector 76543210 bit symbol dma3v8 dma3v7 dma3v6 dma3v5 dma3v4 read / write w after reset 00000 dma0v (007ch) dma1v (007dh) dma2v (007eh) dma3v (007fh) (read-modify-write is not possible.) (read-modify-write is not possible.) (read-modify-write is not possible.) (read-modify-write is not possible.) (3) high-speed micro dma start vector when the cpu reads the interrupt vector after accepting an inter- rupt, it simultaneously compares the interrupt vector with each channel s micro dma start vector (bits 4 to 8 of the interrupt vec- tor). when both match, the interrupt is processed in micro dma mode for the channel whose value matched. if the interrupt vector matches more than one chan- nel, the channel with the lower channel number has a higher priority. (4) notes the instruction execution unit and the bus interface unit of this cpu operate independently of each other. therefore, if the instruc- tion used to clear an interrupt request ?g of an interrupt is fetched before the interrupt is generated, it is possible that the cpu might execute the fetched instruction to clear the interrupt request ?g while reading the interrupt vector after accepting the inter- rupt. if so, the cpu would read the default vector 00a0h and start the interrupt processing from the address 80a0h. to avoid this, make sure that the instruction used to clear the interrupt request ?g comes after the di instruction. toshiba corporation 21 TMP96C141AF 3.4 standby function when the halt instruction is executed, the TMP96C141AF enters run, idle, or stop mode depending on the contents of the halt mode setting register. (1) run : only the cpu halts; power consumption remains unchanged. (2) idle : only the built-in oscillator operates, while all other built-in circuits halt. power consump- tion is reduced to 1/10 or less than that dur- ing normal operation. (3) stop : all internal circuits including the built-in oscil- lator halt. this greatly reduces power con- sumption. the states of the port pins in stop mode can be set as listed in table 3.4 (1) using the i/o register wdmod 22 toshiba corporation TMP96C141AF ? input for input mode/input pin is invalid; output mode/output pin is at high impedance. input: input enable state input: input gate in operation. fix input voltage to 0 or 1 so that input pin stays constant. output: output state pu: programmable pull-up pin. fix the pin to avoid through current since the input gate operates when a pull-up resistor is not set. pd: programmable pull-down pin. fix the pin like a pull-up pin when a pull-down resistor is not set. *: input gate disable state. no through current even if the pin is set to high impedance. x: cannot set. note: port registers are used for controlling programmable pull-up/pull-down. if a pin is also used for an output function (e.g., to1) and the output function is speci?d, whether pull-up or pull-down is selected depends on the output function data. if a pin is also used for an input function, whether pull-up or pull-down is selected depends on the port register setting value only. table 3. 4 (1) pin states in stop mode pin name i/o 96c141af 96cm40/96pm40 drve = 0 drve = 1 drve = 0 drve = 1 p0 input mode/ad0 ~ 7 output mode x x output p1 input mode/ad8 ~ 15 output mode/a8 ~ 15 x x output p2 input mode output mode/a0 ~ 7, a16 ~ 23 pd* pd* pd* output pd* pd* pd* output p30 (rd ), p31 (wr ) output ??output output p32 ~ p37 input mode output mode pu pu pu output ? p40, p41 input mode output mode pu* pu* pu output p42 (cs2 /cas2 ) input mode output mode pd* pd* pd output p5 input p6 input mode output mode pu* pu* pu output p7 input mode output mode pu* pu* pu output p80 ~ p86 input mode output mode pu* pu* pu output p87 (int0) input mode output mode pu pu pu output p9 input mode output mode pu* pu* pu output nmi input input input wdtout output output output ale output ? ? clk output ? reset input input input ea input input input x1 input x2 output ? ? toshiba corporation 23 TMP96C141AF 15, rd , and wr . these port pins have i/o functions for the built-in cpu and internal i/os as well as general-purpose i/o port func- tions. table 3.5 lists the function of each port pin. (r: - = with programmable pull-up resistor = with programmable pull-down 3.5 functions of ports the tmp96cm40f/tmp96pm40f has 65 bits for i/o ports. the TMP96C141AF, tmp96c041af has 47 bits for i/o ports because port0, port1, p30, and p31 are dedicated pins for ad0 to 7, ad8 to table 3.5 functions of ports port name pin name number of pins direction r direction setting unit pin name for built-in function port0 p00 ~ p07 8 i/o bit ad0 ~ ad7 port1 p10 ~ p17 8 i/o bit ad8 ~ ad15/ a8 ~ a15 port2 p20 ~ p27 8 i/o bit a0 ~ a7/ a16 ~ a23 port 3 p30 p31 p32 p33 p34 p35 p36 p37 1 1 1 1 1 1 1 1 output output i/o i/o i/o i/o i/o i/o - - - - - - (fixed) (fixed) bit bit bit bit bit bit rd wr hwr w ait busrq busak r/w ras port4 p40 p41 p42 1 1 1 i/o i/o i/o - - bit bit bit cs0 / cas0 cs1 / cas1 cs2 / cas2 port5 p50 ~ p53 4 input (fixed) an0 ~ an3 port6 p60 ~ p67 8 i/o - bit pg00 ~ pg03, pg10 ~ pg13 port7 p70 p71 p72 p73 1 1 1 1 i/o i/o i/o i/o - - - - bit bit bit bit t10 to1 to2 to3 port8 p80 p81 p82 p83 p84 p85 p86 p87 1 1 1 1 1 1 1 1 i/o i/o i/o i/o i/o i/o i/o i/o - - - - - - - - bit bit bit bit bit bit bit bit t14/int4 t15/int5 to4 to5 t16 / int6 t17 / int7 to6 int0 port9 p90 p91 p92 p93 p94 p95 1 1 1 1 1 1 i/o i/o i/o i/o i/o i/o - - - - - - bit bit bit bit bit bit txd0 rxd0 cts0 txd1 rxd1 sclk1 24 toshiba corporation TMP96C141AF pin name pin state at bus release port mode function mode p00 - p07 (ad0 - ad7) p10 - p17 (ad8 - ad15) no status change (these pins are not ?z? these pins are ?z? p30 (rd ) p31 (wr ) - these pins are ?z? (?z?status after these pins are driven to high level.) p32 (hwr ) p37 (ras ) - the output buffer is ?ff?after these pins are drinen high. these pins are added in the internal resistor of pull-up. it s no relation for the value of output latch. p36 (r/w ) p40 (cs0 /cas0 ) p41 (cs1 /cas1 ) -- p42 (cs2 /cas2 ) - (*) - p20 - p27 (a16 - a23) p42 (cs2 /cas2 ) - the output buffer is ?ff?after these pins are drinen high. these pins are added in the internal resistor of pull-down. it s no relation for the value of output latch. (*) p42 has the resistor of programmable pull-down, but when the bus are released, p42 pin is added a resistor of pull- up. that is, when it is used for bus release (busak = ??, the pins of below need pull-up or pull-down resistor for an external circuit. p00 - p07 (ad07) p10 - p17 (ad8 - ad15) p30 (rd) p31 (wr) when the bus is released, both internal memory and internal i/o cannot be accessed. but the internal i/o continues to run. therefore, be careful about releasing time and set the setection time wdt. resetting makes the port pins listed below function as general-purpose i/o ports. i/o pins programmable for input or output function as input ports. to set port pins for built-in functions, a program is required. since the TMP96C141AF has an external rom, some ports are permanently assigned to the cpu. p00 ~ p07 ? ad0 ~ ad7 p10 ~ p17 ? ad8 ~ ad15 p30 ? rd p31 ? wr bus release function the TMP96C141AF has the internal pull-up and pull- down resistors to ? the bus control signals at bus release. table 3.5 (1) shows the pin condition at bus release (busak ) = ??. figure 3.5. example of external bus interface using bus release function. toshiba corporation 25 TMP96C141AF 3.5.2 port 1 (p10 - p17) port 1 is an 8-bit general-purpose i/o port. i/o can be set on a bit basis using control register p1cr and function register p1fc. resetting resets all bits of output latch p1, control reg- ister p1cr, and function register p1fc to 0 and sets port 1 to input mode. in addition to functioning as a general purpose i/o port, port 1 also functions as an address data bus (ad8 to 15) or an address bus (a8 to 15). with the TMP96C141AF/tmp96c041af, which comes with an external rom, port 1 always functions as an address data bus (ad8 to 15) regardless of the value set in control reg- ister p1cr. 3.5.1 port 0 (p00 - p07) port 0 is an 8-bit general-purpose i/o port. i/o can be set on a bit basis using control register p0cr to 0 and sets port 0 to input mode. in addition to functioning as a general purpose i/o port, port 0 also functions as an address data bus (ad0 to 7). to access external memory, port 0 functions as an address data bus (ad 0 to 7) and all bits of the control register p0cr are cleared to 0. with the TMP96C141AF/tmp96c041af, which comes with an external rom, port 0 always functions as an address data bus (ad0 to 7) regardless of the value set in control regis- ter p0cr. figure 3.5 (1). port 0 figure 3.5 (2). port 1 26 toshiba corporation TMP96C141AF port 0 register figure 3.5 (3). registers for ports 0 and 1 toshiba corporation 27 TMP96C141AF 3.5.3 port 2 (p20 - p27) port 2 is an 8-bit general-purpose i/o port. i/o can be set on bit basis using the control register p2cr and function register p2fc. resetting resets all bits of output latch p2, control regis- ter p2cr and function register p2fc to 0. it also sets port 2 to input mode and connects a pull-down resistor. to disconnect the pull-down resistor, write 1 in the output latch. in addition to functioning as a general-purpose i/o port, port 2 also functions as an address data bus (a0 to 7) and an address bus (a16 to 23). figure 3.5 (4). port 2 28 toshiba corporation TMP96C141AF figure 3.5 (5). registers for port 2 toshiba corporation 29 TMP96C141AF 3.5.4 port 3 (p30 - p37) port 3 is an 8-bit general-purpose i/o port. i/o can be set on a bit basis, but note that p30 and p31 are used for output only. i/o is set using control register p3cr and function register p3fc. resetting resets all bits of output latch p3, control register p3cr (bits 0 and 1 are unused), and function register p3fc to 0. resetting also outputs 1 from p30 and p31, sets p32 to p37 to input mode, and connects a pull- up resistor. in addition to functioning as a general-purpose i/o port, port 3 also functions as an i/o for the cpu s control/status sig- nal. with the TMP96C141AF, when p30 pin is de?ed as rd signal output mode ( 30 toshiba corporation TMP96C141AF figure 3.5 (6). port 3 (p30, p31, p32, p35, p36, p37) toshiba corporation 31 TMP96C141AF figure 3.5 (7). port 3 (p33, p34) 32 toshiba corporation TMP96C141AF port 3 register note: when p33/w ait pin is used as a w ait pin, set p#cr toshiba corporation 33 TMP96C141AF 3.5.5 port 4 (p40 - p42) port 4 is a 3-bit general-purpose i/o port. i/o can be set on a bit basis using control register p4cr and function register p4fc. resetting does the following: - sets the p40 and p42 output latch registers to 1. - resets all bits of the p42 output latch register, the control register p4cr, and the function register p4fc to 0. - sets p40 and p41 to input mode and connects a pull-up resistor. - sets p42 to input mode and connects a pull-down resistor. in addition to functioning as a general-purpose i/o port, port 4 also functions as a chip select output signal (cs0 to cs2 or cas0 to cas2 ). 34 toshiba corporation TMP96C141AF figure 3.5 (9). port 4 toshiba corporation 35 TMP96C141AF port 4 register note: to output chip select signal (cs0 /cas0 to cs2 /cas2 ), set the corresponding bits of the control register p4cr and the function register to p4fc. the bocs, b1cs, and b2cs registers of the chip select/wait controller are used to select the cs /cas function. figure 3.5 (10). registers for port 4 36 toshiba corporation TMP96C141AF 3.5.6 port 5 (p50 - p53) port 5 is a 4-bit input port, also used as an analog input pin. figure 3.5 (11). port 5 note: the input channel selection of a/d converter is set by a/d converter mode register admod2. figure 3.5 (12). registers for port 5 port 5 register 76543210 bit symbol p53 p52 p51 p50 read/write r after reset input mode p5 (000dh) toshiba corporation 37 TMP96C141AF 3.5.7 port 6 (p60 - p67) port 6 is an 8-bit general-purpose i/o port. i/o can be set on bit basis. resetting sets port 6 as an input port and connects a pull-up resistor. it also sets all bits of the output latch to 1. in addition to functioning as a general-purpose i/o port, port 6 also functions as a pattern generator pg0/pg1 output. pg0 is assigned to p60 to p63; pg1, to p64 to p67. writing 1 in the corresponding bit of the port 6 function register (p6fc) enables pg output. resetting resets the function register p6fc value to 0, and sets all bits to ports. figure 3.5 (13). port 6 38 toshiba corporation TMP96C141AF port 6 register figure 3.5 (14). registers for port 6 toshiba corporation 39 TMP96C141AF 3.5.8 port 7 (p70 - p73) port 7 is a 4-bit general-purpose i/o port. i/o can be set on bit basis. resetting sets port 7 as an input port and connects a pull-up resistor. in addition to functioning as a general-purpose i/o port, port 70 also functions as an input clock pin ti0; port 71 as an 8-bit timer output (to1), port 72 as a pwm0 output (to2), and port 73 as a pwm1 output (to3) pin. writing 1 in the corresponding bit of the port 7 function register (p7fc) enables output of the timer. resetting resets the function regis- ter p7fc value to 0, and sets all bits to ports. figure 3.5 (15). port 7 40 toshiba corporation TMP96C141AF figure 3.5 (16). registers for port 7 toshiba corporation 41 TMP96C141AF 3.5.9 port 8 (p80 - p83) port 8 is an 8-bit general-purpose i/o port. i/o can be set on a bit basis. resetting sets port 8 as an input port and connects a pull-up resistor. it also sets all bits of the output latch register p8 to 1. in addition to functioning as a general-purpose i/o port, port 8 also functions as an input for 16-bit timer 4 and 5 clocks, an output for 16-bit timer f/f 4, 5 and 6 output, and an input for int0. writing 1 in the corresponding bit of the port 8 function register (p8fc) enables those functions. resetting resets the function register p8fc value to 0, and sets all bits to ports. (1) p80 ~ p86 figure 3.5 (17). port 8 (p80 - p86) 42 toshiba corporation TMP96C141AF (2) p87 (int0) port 87 is a general-purpose i/o port, and also used as an int0 pin for external interrupt request input. figure 3.5 (18). port 87 toshiba corporation 43 TMP96C141AF figure 3.5 (19). registers for port 8 44 toshiba corporation TMP96C141AF 3.5.10 port 9 (p90 - p95) port 9 is a 6-bit general-purpose i/o port. i/os can be set on a bit basis. resetting sets port 9 to an input port and connects a pull-up resistor. it also sets all bits of the output latch register to 1. in addition to functioning as a general-purpose i/o port, port 9 can also function as an i/o for serial channels 0 and 1. writing 1 in the corresponding bit of the port 9 function register (p9fc) enables this function. figure 3.5 (20). ports 90 and 93 resetting resets the function register value to 0 and sets all bits to ports. (1) port 90 and 93 (txd0/txd1) ports 90 and 93 also function as serial channel txd output pins in addition to i/o ports. they have a programmable open drain function. toshiba corporation 45 TMP96C141AF (2) ports 91 and 94 (rxd0, 1) ports 91 and 94 are i/o ports, and also used as rxd input pins for serial channels. figure 3.5 (21). ports 91 and 94 (3) port 92 (cts/ sckl0) port 92 is an i/o port. it is also used as a cts input pin for serial channel0; additionally, the cts0 pin, and also as a sckl0 i/o pin. figure 3.5 (22). port 92 46 toshiba corporation TMP96C141AF (4) port 95 (sclk) port 95 is a general-purpose i/o port. it is also used as an sclk i/o pin for serial channel 1. figure 3.5 (23). port 95 toshiba corporation 47 TMP96C141AF figure 3.5 (24). registers for port 9 48 toshiba corporation TMP96C141AF 3.6 chip select/wait control TMP96C141AF has a built-in chip select/wait controller used to control chip select (cs0 - cs2 pins), wait (w ait pin), and data bus size (8 or 16 bits) for any of the three block address areas. 3.6.1 control registers table 3.6 (1) shows control registers one block address areas are controlled by 1-byte cs/ wait control registers (b0cs, b1cs, and b2cs). registers can be written to only when the cpu is in system mode. (there are two cpu modes: system and normal.) the reason is that the settings of these registers have an important effect on the system. (1) enable control register bit 7 (b0e, b1e, and b2e) is a master bit used to specify enable (1)/disable (0) of the setting. resetting b0e and b1e to disable (0) and b2e to enable (1). (2) system only speci?ation control register bit 6 (b0sys, b1sys, and b2sys) is used to specify enable/disable of the setting depend- ing on the cpu operating mode (system or normal). setting this bit to 0 enables setting (address space for cs , wait state, bus size, etc.) regardless of the cpu operating mode; setting it to 1 enables setting in sys- tem mode but disables setting in normal mode. resetting clears bit 6 to 0. bit 6 is mainly used when external memory data should not be accessed in normal mode (i.e., for system mode only memory data for the operating system). (3) cs/cas waveform select control register bit 5 (b0cas, b1cas, and b2cas) is used to specify waveform mode output from the chip select pin (cs0 /cas 0 - cs2 /cas2 ). setting this bit to 0 speci?s cs0 to cs2 waveforms; setting it to 1 speci?s cas0 to cas2 waveforms. resetting clears bit 5 to 0. (4) data bus size select bit 4 (b0bus, b1bus, and b2bus) of the control reg- ister is used to specify data bus size. setting this bit to 0 accesses the memory in 16-bit data bus mode; set- ting it to 1 accesses the memory in 8-bit data bus mode. changing data bus size depending on the access address is called dynamic bus sizing. table 3.6 (2) shows the details of the bus operation. (5) wait control control register bits 3 and 2 (b0w1, 0; b1w1, 0; b2w1, 0) are used to specify the number of waits. setting these bits to 00 inserts a 2-state wait regardless of the w ait pin status. setting them to 01 inserts a 1-state wait regardless of the w ait status. setting them to 10 inserts a 1-state wait and samples the w ait pin status. if the pin is low, inserting the wait maintains the bus cycle until the pin goes high. setting them to 11 com- pletes the bus cycle without a wait regardless of the w ait pin status. resetting sets these bits to 00 (2-state wait mode). (6) address area speci?ation control register bits 1 and 0 (b0c1, 0; b1c1, 0; b2c1, 0) are used to specify the target address area. setting these bits to 00 enables settings (cs output, wait state, bus size, etc.) as follows: * cs0 setting enabled when 7f00h to 7fffh is accessed. * cs1 setting enabled when 480h to 7fffh is accessed. * cs2 setting enabled when 8000h to 3ffffffh is accessed, for the tmp96c141, which does not have a built-in rom. cs2 setting enabled when 10000h to 3fffffh is accessed for the tmp96cm40/tmp96pm40, which has built-in rom/prom setting bits to 01 enables setting for all cs s blocks and outputs a low strobe signal (cs0 /cas0 ~ cs2 / cas2 ) from chip select pins when 400000h to 7fffffh is accessed. setting bits to 10 enables them 800000h to bfffffh is accessed. setting bits to 11 enables them when c00000h to ffffffh is accessed. toshiba corporation 49 TMP96C141AF note: with only block 2, enable (16-bit data bus, 2-wait mode) after reset. table 3.6 (1) chip select/wait control register code name address 7654 3210 b0cs block0 cs/wait control register 0068h b0e b0sys b0cas b0bus b0w1 b0w0 b0c1 b0c0 wwww wwww 0000 0000 1 : cs/cas enable 1 : system only 0 : cso 1 : cas0 0 : 16-bit bus 1 : 8-bit bus 00 : 2wait 01 : 1wait 10 : 1wait + n 11 : 0wait 00 : 7f00h ~ 7fffh 01 : 400000h ~ 10 : 800000h ~ 11 : c00000h ~ b1cs block1 cs/wait control register 0069h b1e b1sys b1cas b1bus b1w1 b1w0 b1c1 b1c0 wwww wwww 0000 0000 1 : cs/cas enable 1 : system only 0 : cs1 1 : cas1 0 : 16-bit bus 1 : 8-bit bus 00 : 2wait 01 : 1wait 10 : 1wait + n 11 : 0wait 00 : 480h ~ 7fffh 01 : 400000h ~ 10 : 800000h ~ 11 : c00000h ~ b2cs block2 cs/wait control register 006ah b2e b2sys b2cas b2bus b2w1 b2w0 b2c1 b2c0 wwww wwww 1000 0000 1 : cs/cas enable 1 : system only 0 : cs2 1 : cas2 0 : 16-bit bus 1 : 8-bit bus 00 : 2wait 01 : 1wait 10 : 1wait +n 11 : 0wait 00 : 8000h ~ 01 : 400000h ~ 10 : 800000h ~ 11 : c00000h ~ 50 toshiba corporation TMP96C141AF table 3.6 (2) dynamic bus sizing 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. operand data size operand start address memory data size cpu address cpu data d15 - d8 d7 - d0 8 bits 2n + 0 (even number) 8 bits 2n + 0 xxxxx b7 - b0 16 bits 2n + 0 xxxxx b7 - b0 2n + 1 (odd number) 8 bits 2n + 1 xxxxx b7 - b0 16 bits 2n + 1 b7 - b0 xxxxx 16 bits 2n + 0 (even number) 8 bits 2n + 0 2n + 1 xxxxx xxxxx b7 - b0 b15 - b8 16 bits 2n + 0 b15 - b8 b7 - b0 2n + 1 (odd number) 8 bits 2n + 1 2n + 2 xxxxx xxxxx b7 - b0 b15 - b8 16 bits 2n + 1 2n + 2 b7 - b0 xxxxx xxxxx b15 - b8 32 bits 2n + 0 (even number) 8 bits 2n + 0 2n + 1 2n + 2 2n + 3 xxxxx xxxxx xxxxx xxxxx b7 - b0 b15 - b8 b23 - b16 b31 - b24 16 bits 2n + 0 2n + 2 b15 - b8 b31 - b24 b7 - b0 b23 - b16 2n + 1 (odd number) 8 bits 2n + 1 2n + 2 2n + 3 2n + 4 xxxxx xxxxx xxxxx xxxxx b7 - b0 b15 - b8 b23 - b16 b31 - b24 16 bits 2n + 1 2n + 2 2n + 4 b7 - b0 b23 - b16 xxxxx xxxxx b15 - b8 b31 - b24 toshiba corporation 51 TMP96C141AF 3.6.2 chip select image an image of the actual chip select is shown below. out of the whole memory area, address areas that can be speci?d are divided into four parts. addresses from 000000h to 3fffffh are divided differently: 7f00h to 7fffh is speci?d for cs0; 480h to 7fffh, for cs1; and 8000h to 3fffffh, for cs2. the reason is that a device other than rom (i.e., ram or i/o) might be connected externally. the addresses 7f00 to 7fffh (256 bytes) for cs0 are mapped mainly for possible expansions to external i/o. the addresses 480h to 7fffh (approximately 31k supplement 1: access priority is highest for built-in i/o, then built-in memory, and lowest for the chip select/wait controller. supplement 2: external areas other than cs0 to cs2 are accessed in 16-bit data bus (0 wait) mode. when using the chip select/wait controller, do not specify the same address area more than once. (however, when addresses 7f00h - 7fffh for cs0 and 480h - 7fffh for cs1 are speci?d, in other words, speci?ations overlap, only the cs0 setting/pin is active.) cs0 cs1 cs2 000000h 7f00h b1c1, 0 = ?0 8000h b0c1, 0 = ?0 400000h b2c1, 0 = ?0 800000h b0c1, 0 = ?1 b1c1, 0 = ?1 b2c1, 0 = ?1 c00000h b0c1, 0 = ?0 b1c1, 0 = ?0 b2c1, 0 = ?0 ffffffh b0c1, 0 = ?1 b1c1, 0 = ?1 b2c1, 0 = ?1 (mainly for i/o) (mainly for ram) (mainly for rom) bytes) for cs1 are mapped there mainly for possible exten- sions to external ram. the addresses 8000h to 3ffffffh (approximately 4mbytes) for cs2 are mapped mainly for possible extensions to external rom. after reset, cs2 is enabled in 16-bit bus and 2-wait. with the TMP96C141AF, which does not have a built- in rom, the program is externally read at address 8000h in this setting (16-bit bus, 2-wait). with the tmp96cm40f/ tmp96pm40f, which has a built-in rom, addresses from 8000h to fffffh are used as the internal rom area; cs2 is disabled in this area. after reset, the cpu reads the program from the built-in rom in 16-bit bus, 0-wait mode. 52 toshiba corporation TMP96C141AF 3.6.3 example of usage figure 3.6 (1) is an example in which an external memory is con- nected to the TMP96C141AF. in this example, a rom is con- nected using 16-bit bus; a ram is connected using 8-bit bus. figure 3.6 (1). example of external memory connection (rom = 16 bits, ram and i/o = 8 bits) resetting sets pins cs0 to cs2 to input port mode. cs0 and cs1 are set high due to an internal pull-up resistor; cs2 , low due to an internal pull-down resistor. the program used to set these pins is as follows: p4cr equ 0eh p4fc equ 10h b0cs equ 68h b1cs equ 69h b2cs equ 6ah ld (bocs), 90h ; cs0 = 8 bits, 2wait, 7f00h ~ 7fffh ld (b1cs), 9ch ; cs1 = 8 bits, 0wait, 480h ~ 7effh ld (b2cs), 84h ; cs2 = 16 bits, 1wait, 8000h ~ 3fffffh ld (p4cr), 07h ld (p4fc), 07h ) cso , cs1 , cs2 output mode setting toshiba corporation 53 TMP96C141AF 3.6.4 how to start with an 8-bit data bus resetting sets the cs2 pin low due to an internal pull-down resistor; memory access starts in 16-bit data bus (2-wait) mode. to start in 8-bit data bus mode, a special operation is required. operation is as described in the example below: b2cs equ 6ah ; cs2 register address org 8000h ; reset address ldx (b2cs), 9ch ; cs2 8-bit, 0wait, 8000h ~ after reset, the program reads the ldx (b2cs), 9ch instruction in 16-bit data bus mode. ldx is a 6-byte instruc- tion: the 2nd, 4th and 6th bytes are handled as dummies (i.e., only codes in the 1st, 3rd and 5th bytes are actually used). even if starting in 8-bit data bus mode, it is possible to pro- gram so that the ldx instruction is executed and the block 2 area (8000h - 3fffffh) is accessed in 8-bit data bus mode without any problem. the above program does not include setting the p42/ cs2 pin to output; add a program to set the p4cr and p4fc registers as required. 54 toshiba corporation TMP96C141AF 3.7 8-bit timers the TMP96C141AF contains two 8-bit timers (timers 0 and 1), each of which can be operated independently. the cascade connection allows these timers to be used as 16-bit timer. the following four operating modes are provided for the 8-bit tim- ers. 8-bit interval timer mode (2 timers) 16-bit interval timer mode (1 timer) 8-bit programmable square wave pulse generation (ppg : variable duty with variable cycle) output mode (1 timer) 8-bit pulse width modulation (pwm: variable duty with con- stant cycle) output mode (1 timer) figure 3.7 (1) shows the block diagram of 8-bit timer (timer 0 and timer 1). each interval timer consists of an 8-bit up-counter, 8-bit comparator, and 8-bit timer register. besides, one timer ?p- ?p (tff1) is provided for pair of timer 0 and timer 1. among the input clock sources for the interval timers, the internal clocks of f t1, f t4, f t16, and f t256 are obtained from the 9-bit prescaler shown in figure 3.7 (2). the operation modes and timer ?p-?ps of the 8-bit timer are controlled by three control registers tmod, tffcr, and trun. toshiba corporation 55 TMP96C141AF figure 3.7 (1). block diagram of 8-bit timers (timers 0 and 1) 56 toshiba corporation TMP96C141AF prescaler this 9-bit prescaler generates the clock input to the 8- bit timers, 16-bit timer/event counters, and baud rate generators by further dividing the fundamental clock (fc) after it has been divided by 4 (fc/4). among them, 8-bit timer uses four types of clock: f t1, f t4, f t16, and f t256. this prescaler can be run or stopped by the timer operation control register trun toshiba corporation 57 TMP96C141AF a timer register this is an 8-bit register for setting an interval time. when the set value of timer registers treg0, treg1, matches the value of up-counter, the comparator match detect signal becomes active. if the set value is 00h, this signal becomes active when the up-counter over?ws. timer register treg0 is of double buffer structure, each of which makes a pair with register buffer. the timer ?p-?p control register tffcr 58 toshiba corporation TMP96C141AF figure 3.7 (4). timer operation control register (trun) toshiba corporation 59 TMP96C141AF figure 3.7 (5). timer mode control register (tmod) 60 toshiba corporation TMP96C141AF figure 3.7 (6). timer flip-flop control register (tffcr) toshiba corporation 61 TMP96C141AF the operation of 8-bit timers will be described below: (1) 8-bit timer mode two interval timers 0, 1, can be used independently as 8-bit interval timer. all interval timers operate in the same manner, and thus only the operation of timer 1 will be explained below. note: x; don t care ? no change use the following table for selecting the input clock. note: the input clock of timer 0 and timer 1 are different from as follows: timer 0: t10 input, f t1, f t4, f t16 timer 1: match output of timer 0, f t1, f t16, f t256 msb lsb 76543210 trun ? 0 stop timer 1, and clear it to ?? tmod 0 0 x x 0 1 set the 8-bit timer mode, and select f t1 (0.5 m s @ fc = 16mhz) as the input clock. treg1 01010000 set the timer register at 40 m s f t1 = 50h. intet10 1101 enable intt1, and set it to ?evel 5? trun 1x 1 start timer 1 counting. table 3.7 (1) 8-bit timer interrupt cycle and input clock input clock interrupt cycle (at fc = 16mhz) resolution interrupt cycle (at fc = 20mhz) resolution f t1 (8/fc) 0.5 m s ~ 128 m s 0.5 m s 0.4 m s ~ 102.4 m s 0.4 m s f t4 (32/fc) 2 m s ~ 512 m s2 m s 1.6 m s ~ 409.6 m s 1.6 m s f t16 (128/fc) 8 m s ~ 2.048ms 8 m s 6.4 m s ~ 1.638ms 6.4 m s f t256 (2048/fc) 128 m s ~ 32.708ms 128 m s 102.4 m s ~ 2.621ms 128 m s generating interrupts in a fixed cycle to generate timer 1 interrupt at constant intervals using timer 1 (intt1), ?st stop timer 1 then set the operation mode, input clock, and a cycle to tmod and treg1 register, respectively. then, enable interrupt intt1 and start the counting of timer 1. example: to generate timer 1 interrupt every 40 microseconds at fc = 16 mhz, set each register in the following manner. 62 toshiba corporation TMP96C141AF generating a 50% duty square wave pulse the timer ?p-?p (tff1) is inverted at constant inter- vals, and its status is output to timer output pin (to1). example: to output a 3.0 m s square wave pulse from to1 pin at fc = 16mhz, set each register in the following procedures. either timer 0 or timer 1 may be used, but this example uses timer 1. note: x; don t care ? no change figure 3.7 (7). square wave (50% duty) output timing chart 76543210 trun ? 0 stop timer 1, and clear it to ?? tmod 0 0 x x 0 1 set the 8-bit timer mode, and select f t1 (0.5 m s @ fc = 16mhz) as the input clock. treg1 00000011 set the timer register at 3.0 m s f t1 2 = 3. tffcr 1011 clear tff1 to ?? and set to invert by the match detect signal from timer 1. p7cr xxxx 1 p7fc xxxx 1x trun 1x 1 start timer 1 counting. ) select p71 as to1 pin. toshiba corporation 63 TMP96C141AF a making timer 1 count up by match signal from timer 0 comparator set the 8-bit timer mode, and set the comparator out- put of timer 0 as the input clock to timer 1. figure 3.7 (8). timer 1 count up by timer 0 ? output inversion with software the value of timer ?p-?p (tff1) can be inverted, inde- pendent of timer operation. writing ?0?into tffcr 64 toshiba corporation TMP96C141AF the lower 8 bits of the timer (interrupt) cycle are set by the timer register treg0, and the upper 8 bits are set by treg1. note that treg0 always must be set ?st. (writing data into treg0 disables the comparator tem- porarily, and the comparator is restarted by writing data into treg1.) setting example: to generate an interrupt intt1 every 0.5 seconds at fc = 16mhz, set the following values for timer registers treg0 and treg: when counting with input clock of f t16 (8 m s @ 16mhz) 0.5 sec 8 m s = 62500 = f424h therefore, set treg1 = f4h and treg0 = 24h, respectively. the comparator match signal is output from timer 0 each time the up-counter uc0 matches treg0, where the up-counter uc0 is not to be cleared. with the timer 1 comparator, the match detect signal is output at each comparator timing when up-counter uc1 and treg1 values match. when the match detect signal is output simultaneously from both com- parators of timer 0 and timer 1, the up-counters uc0 and uc1 are cleared to ?? and the interrupt intt1 is generated. if inversion is enabled, the value of the timer ?p-?p tff1 is inverted. example: when treg1 = 04h and treg0 = 80h figure 3.7 (9). output timer by 16-bit timer mode (3) 8-bit ppg (programmable pulse generation) output mode square wave pulse can be generated at any frequency and duty by timer 0 and timer 1. the output pulse may be either low-active or high-active. in this mode, timer 1 cannot be used. timer 0 outputs pulse to to1 pin (also used as p70). in this mode, a programmable square wave is gener- ated by inverting timer output each time the 8-bit up- counter (uc0) matches the timer registers treg0 and treg1. however, it is required that the set value of treg0 is smaller than that of treg1. though the up-counter (uc1) of timer 1 is not used in this mode, uc1 should be set for counting by setting trun toshiba corporation 65 TMP96C141AF figure 3.7 (10). 8-bit ppg output waveforms figure 3.7 (11). block diagram of 8-bit ppg output mode 66 toshiba corporation TMP96C141AF when the double buffer of treg0 is enabled in this mode, the value of register buffer will be shifted in treg0 each time treg1 matches uc0. use of the double buffer makes easy handling of low duty waves (when duty is varied). figure 3.7 (12). operation of register buffer example: generating 1/4 duty 50khz pulse @ fc = 16mhz) calculate the value to be set for timer register. to obtain the frequency 50khz, the pulse cycle t should be: t = 1/50khz = 20 m s. given f t1 = 0.5 m s @ 16mhz), 20 m s 0.5 m s = 40 consequently, to set the timer register 1 (treg1) to treg1 = 40 = 28h and then duty to 1/4, t x 1/4 = 20 m s x 1/4 = 5 m s 5 m s 0.5 m s = 10 therefore, set timer register 0 (treg0) to treg0 = 10 = 0ah. note : x; don t care ? no change 76543210 trun ? 00 stop timer 0, and clear it to ?? tmod 10xxxx01 set the 8-bit ppg mode, and select f t1 as input clock. treg0 00001010 write ?ah? treg1 00101000 write ?8h? tffcr 1011x sets tff1 and enables the inversion and double buffer enable. writing ?0?provides negative logic pulse. p7cr xxxx 1 p7fc xxxx 1x trun 1x 11 start timer 0 and timer 1 counting. ) set p71 as to1 pin. toshiba corporation 67 TMP96C141AF (4) 8-bit pwm output mode this mode is valid only for timer 0. in this mode, maxi- mum 8-bit resolution of pwm pulse can be output. pwm pulse is output to to1 pin (also used as p71) when using timer 0. timer 1 can also be used as 8-bit timer. timer output is inverted when up-counter (uc0) matches the set value of timer register treg0 or when 2n - 1 (n = 6, 7, or 8; speci?d by t01mod 68 toshiba corporation TMP96C141AF figure 3.7 (14) shows the block diagram of this mode. figure 3.7 (14). block diagram of 8-bit pwm mode in this mode, the value of register buffer will be shifted in treg0 if 2 n - 1 over?w is detected when the double buffer of treg0 is enabled. use of the double buffer makes the handling of small duty waves easy. figure 3.7 (15). operation of register buffer example: to output the following pwm waves to to1 pin at fc = 16mhz. to realize 63.5 m s of pwm cycle by f t1 = 0.5 m s (@ fc = 16mhz), 63.5 m s 0.5 m s = 127 = 2 7 - 1 consequently, n should be set to 7. as the period of low level is 36 m s, for f t1 = 0.5 m s, set the following value for treg0: 36 m s 0.5 m s = 72 = 48h toshiba corporation 69 TMP96C141AF note: x; don t care ? no change (5) table 3.7 (4) shows the list of 8-bit timer modes. note: ? don t care msb lsb 76543210 trun - x ? stop timer 0, and clear it to ?? tmod 1110 01 set 8-bit pwm mode (cycle: 2 7 - 1) and select f t1 as the input clock. treg0 01001000 write ?8h? tffcr xxxx 101x clears tff1, enables the inversion and double buffer. p7cr xxxx 1 p7fc xxxx 1x trun 1x ? start timer 0 counting. table 3.7 (3) pwm cycle and the setting of 2 n -1 counter pwm cycle (@ fc =16mhz) pwm cycle (@ fc = 20 mhz) f t1 f t4 f t16 f t1 f t4 f t16 2 6 -1 31.5 m sec (31.7khz) 126msec (7.9khz) 0.50 m sec (1.9khz) 25.2 m sec (39.0khz) 100 m sec (10.0khz) 0.40msec (2.4khz) 2 7 -1 63.5 m sec (15.7khz) 254msec (3.9khz) 1.01 m sec (0.98khz) 50.8 m sec (19.7khz) 203 m sec (4.9khz) 0.81msec (1.2khz) 2 8 -1 127 m sec (7.8khz) 510msec (1.9khz) 2.04 m sec (0.49khz) 102 m sec (9.80khz) 408 m sec (2.4khz) 1.63msec (0.61khz) table 3.7 (4) timer mode setting registers register name tmod tffcr name of function in t10m pwmm t1clk t0clk tff1is function timer mode pwm0 cycle upper timer input clock lower timer input clock timer f/f invert signal select 16-bit timer mode 01 external clock, f t1, f t4, f t16 (00, 01, 10, 11) 8-bit timer x 2 channels 00 lower timer match : f t1, f t16, f t256 (00, 01, 10, 11) external clock, f t1, f t4, f t16 (00, 01, 10, 11) 0 : lower timer output 1 : upper timer output 8-bit ppg x 1 channel 10 external clock, f t1, f t4, f t16 (00, 01, 10, 11) 8-bit pwm x 1 channel 11 2 6 - 1, 2 7 - 1, 2 8 - 1 (01, 10, 11) external clock, f t1, f t4, f t16 (00, 01, 10, 11) 8-bit timer x 1 channel 11 f t1, f t16, f t256 (01, 10, 11) output disabled ) set p71 as the to1 pin. 70 toshiba corporation TMP96C141AF 3.8 8-bit pwm timer the TMP96C141AF/tmp96cm40f/tmp96pm40f has two built-in 8-bit pwm timers (timers 2 and 3). they have two operating modes. 8-bit pwm (pulse width modulation: variable duty at fixed interval) output mode 8-bit interval timer mode figure 3.8 (1) is a block diagram of 8-bit pwm timer (tim- ers 2 and 3). pwm timers consist of an 8-bit up-counter, 8-bit com- parator, and 8-bit timer register. two timer ?p-?ps (tff2 for timer 2 and tff3 for timer 3) are provided. input clocks f p1, f p4, and f p16 for the pwm timers can be obtained using the built-in prescaler. pwm timer operating mode and timer ?p-?ps are con- trolled by four control registers (p0mod, p1mod, pffcr, and trun). toshiba corporation 71 TMP96C141AF figure 3.8 (1). block diagram of 8-bit pwm timer 0 (timer 2) note: block diagram for 8-bit pwm timer 1 (timer 3) is the same as the above diagram. 72 toshiba corporation TMP96C141AF prescaler generates input clocks dedicated to pwm timers by further dividing the fundamental clock (fc) after it has been divided by 2 (fc/2). since the register used to control the prescaler is the same as the one for other timers, the prescaler cannot be operated indepen- dently. the pwm timer uses three input clocks: f /p1, f /p4, and f /p16. like the 9-bit prescaler described in the 8-bit timer section, this prescaler can be counted/stopped using bit 7 toshiba corporation 73 TMP96C141AF treg2 and treg3 are controlled double buffer enable/disable by p0mod 74 toshiba corporation TMP96C141AF figure 3.8 (4). 8-bit pwm0 mode control register toshiba corporation 75 TMP96C141AF figure 3.8 (5). 8-bit pwm1 mode control register 76 toshiba corporation TMP96C141AF figure 3.8 (6). 8-bit pwm f/f control register toshiba corporation 77 TMP96C141AF figure 3.8 (7). timer operation control register (trun) 78 toshiba corporation TMP96C141AF the following explains pwm timer operations. (1) pwm timer mode both pwm timers can output 8-bit resolution pwm independently. since both timers operate in exactly the same way, pwm0 is used for purposes of explanation. pwm output changes under the following two condi- tions. condition 1: tff2 is cleared to 0 when the value in the up- counter (uc2) and the value set in the treg2 match. tff2 is set to 1 when a 2 n - 1 counter over?w (n = 6, 7, or 8) occurs. pwm timing figure 3.8 (8). output waves in pwm timer mode note: the above waves are obtained in a mode where the f/f is set by a match with the timer register (treg) and reset by an over?w. condition 2: tff2 is set to 1 when the value in the up-counter (uc2) and the value set in treg2 match. tff2 is cleared to 0 when a 2 n - 1 counter over ?w (n = 6, 7, or 8) occurs. the up-counter (uc2) is cleared by a 2 n - 1 counter over?w. the pwm timer can output 0% - 100% duty pulses because a 2 n - 1 counter over?w has a higher priority. that is, to obtain 0% output (always low), the mode used to set tff2 to 0 due to over?w (pffcr toshiba corporation 79 TMP96C141AF figure 3.8 (9) is a block diagram of this mode. figure 3.8 (9). block diagram of pwm timer mode (pwm0) in this mode, enabling double buffer is very useful. the register buffer value shifts into treg2 when a 2 n -1 over?w is detected, when double buffer is enabled. using double buffer makes handling small duty waves easy. figure 3.8 (10). register buffer operation 80 toshiba corporation TMP96C141AF example: to output the following pwm waves to to2 pin using pwm0 at fc = 16mhz. to implement 31.75 m s pwm cycle by f p1 = 0.25 m s (@ fc = 16mhz) 31.75 m s 0.25 m s = 127 = 2 7 -1. consequently, set n to 7. since the low level cycle = 15 m s; for f p1 = 0.25 m s 15 m s 0.25 = 60 = 3ch set the 3ch in treg2. note: x; don t care ? no change 76543210 trun ? ? stops pwm0 and clears it to 0. p0mod - 0000001 sets pwm (2 7 - 1) mode, input clock f p1, over?w interrupt, and disables double buffer. treg2 00111100 writes 3ch. p0mod 1000001 enables double buffer. pffcr 0111 sets tff2 and a mode where tff2 is set by compare and match, and cleared by over?w. p7cr xxxx 1 p7fc xxxx 1 x trun 1x ? starts pwm0 counting. table 3.8 (1) pwm cycle and 2 n -1 counter setting formula 16mhz 20mhz f p1 f p4 f p16 f p1 f p4 f p16 2 6 -1 2 6 -1 - f pn 15.8 m sec (63khz) 63.0 m sec (16khz) 252 m sec (3.9khz) 12.6 m sec (79khz) 50.4 m sec (20khz) 201 m sec (4.9khz) 2 7 -1 2 7 -1 - f pn 31.8 m sec (31khz) 127.0 m sec (7.9khz) 508 m sec (1.9khz) 25.4 m sec (39khz) 101.6 m sec (9.8khz) 406 m sec (2.5khz) 2 8 -1 2 8 -1 - f pn 63.8 m sec (16khz) 255.0 m sec (3.9khz) 1020 m sec (0.98khz) 51.0 m sec (20khz) 204.0 m sec (4.9khz) 816 m sec (1.2khz) ) sets p72 as the to2 pin. toshiba corporation 81 TMP96C141AF (2) 8-bit timer mode both pwm timers can be used independently as 8-bit interval timers. since both timers operate in exactly the same way, pwm0 (timer 2) is used for the purposes of explanation. note: x; don t care ? no change select an input clock using the table below. note: to generate interrupts in 8-bit timer mode, bit 5 (interrupt control bit 82 toshiba corporation TMP96C141AF generating a 50% square wave to generate a 50% square wave, invert the timer ?p- ?p at a ?ed interval and output the timer ?p-?p value to the timer output pin (to2). example: to output a 3.0 m s square wave at fc = 16mhz from to2 pin, set register as fol- lows: note: x; don t care ? no change figure 3.8 (11). square wave (50% duty) output timing chart 76543210 trun ? ? stops pwm0 and clears it to 0. p0mod x01100xx sets 8-bit timer mode and selects f p1 (0.25 m s) as the input clock. treg2 00000110 sets 3.0 m s/0.25 m s/2 = 6 in the timer register. pffcr 1001 clears tff2 to 0 and inverts using comparator output. p7cr xxxx 1 p7fc xxxx 1 x trun 1x ? ) sets p72 as the to2 pin. toshiba corporation 83 TMP96C141AF this mode is as shown in figure 3.8 (12) below. figure 3.8 (12). block diagram of 8-bit timer mode 84 toshiba corporation TMP96C141AF 3.9 16-bit timer the TMP96C141AF has two (timer 4 and timer 5) multifunc- tional 16-bit timer/event counter with the following operation modes. 16-bit interval timer mode 16-bit event counter mode 16-bit programmable pulse generation (ppg) mode frequency measurement mode pulse width measurement mode time differential measurement mode timer/event counter consists of 16-bit up-counter, two 16-bit timer registers, two 16-bit capture registers (one of them applies double-buffer), two comparators, capture input con- troller, and timer ?p-?p and the control circuit. timer/event counter is controlled by four control regis- ters: t4mod/t5mod, t4ffcr/t5ffcr, trun and t45cr. figure 3.9 (1) and (2) show the block diagram of 16-bit timer/event counter (timer 4 and timer 5). toshiba corporation 85 TMP96C141AF figure 3.9 (1). block diagram of 16-bit timer (timer 4) 86 toshiba corporation TMP96C141AF figure 3.9 (2). block diagram of 16-bit timer (timer 5) toshiba corporation 87 TMP96C141AF figure 3.9 (3). 16-bit timer mode controller register (t4mod) (1/2) 88 toshiba corporation TMP96C141AF figure 3.9 (4). 16-bit controller register (t4mod) (2/2) toshiba corporation 89 TMP96C141AF figure 3.9 (5). 16-bit timer 4 f/f control (t4ffcr) 90 toshiba corporation TMP96C141AF figure 3.9 (6). 16-bit timer mode control register (t5mod) (1/2) toshiba corporation 91 TMP96C141AF figure 3.9 (7). 16-bit timer control register (t5mod) (2/2) 92 toshiba corporation TMP96C141AF figure 3.9 (8). 16-bit timer 5 f/f control (t5ffcr) cap4t6 : invert when the up-counter value is loaded to cap4 cap3t6 : invert when the up-counter value is loaded to cap3 eq7t6 : invert when up-counter matches treg7 eq6t6 : invert when up-counter matches treg6 toshiba corporation 93 TMP96C141AF figure 3.9 (9). 16-bit timer (timer 4, 5) control register (t45cr) figure 3.9 (10). timer operation control register (trun) db6en : double buffer of treg6 db4en : double buffer of treg4 94 toshiba corporation TMP96C141AF up-counter (uc4/uc5) uc4/uc5 is a 16-bit binary counter which counts up according to the input clock speci?d by t4mod toshiba corporation 95 TMP96C141AF when t4mod 96 toshiba corporation TMP96C141AF note: x; don t care ? no change figure 3.9 (11). programmable pulse generation (ppg) output waveforms 76543210 trun ? ? stop timer 4. treg4 ******** set the duty (16 bits). treg5 ******** set the cycle (16 bits). t45cr 0x x x ? double buffer of treg4 enable. (changes the duty and cycle at the interrupt inttr5) t4ffcr 11001100 set the mode to invert tff4 at the match with treg4/treg5, and also sets tff4 to ?? t4mod 001001** select internal clock for input and disables the capture function. (** = 01, 10, 11) p8cr ? p8fc x xx 1xx trun 1x ? start timer 4. note: when used as an event counter, set the prescaler in run mode. 76543210 trun ? ? stop timer 4. p8cr ? set p80 to input mode. intet54 11001000 enable inttr5 and sets interrupt level 4, while disables inttr4. t4ffcr 11000011 disable trigger. t4mod 00100100 select ti4 as the input clock. treg5 ******** set the number of counts (16 bits). trun 1x ? start timer 4. ) assign p82 as to4. (3) 16-bit programmable pulse generation (ppg) output mode since both timers operate in exactly the same way, timer 4 is used for the purposes of explanation. the ppg mode is obtained by inversion of the timer ?p-?p tff4 that is to be enabled by the match of the up-counter uc4 with the timer register treg4 or 5 and to be output to to4 (also used as p82). in this mode, the following conditions must be satis?d. (set value of treg4) < (set value of treg5) toshiba corporation 97 TMP96C141AF when the double buffer of treg4 is enabled in this mode, the value of register buffer 4 will be shifted in treg4 at match with treg5. this feature makes easy the handling of low duty waves. figure 3.9 (12). operation of register buffer shows the block diagram of this mode. figure 3.9 (13). block diagram of 16-bit ppg mode 98 toshiba corporation TMP96C141AF (4) application examples of capture function the loading of up-counter (uc4) values into the cap- ture registers cap1 and cap2, the timer ?p-?p tff4 inversion due to the match detection by comparators cp4 and cp5, and the output of tff4 status to to4 pin can be enabled or disabled. combined with inter- rupt function, they can be applied in many ways, for example: one-shot pulse output from external trigger pulse frequency measurement a pulse width measurement ? time difference measurement figure 3.9 (14). one-shot pulse output (with delay) one-shot pulse output from external trigger pulse set the up-counter uc4 in free-running mode with the internal input clock, input the external trigger pulse from ti4 pin, and load the value of up-counter into capture register cap1 at the rise edge of the ti4 pin. then set to t4mod toshiba corporation 99 TMP96C141AF setting example: to output 2ms one-shot pulse with 3ms delay to the external trigger pulse to ti4 pin. note: x; don t care ? no change keep counting (free-running). main setting count with f t1. t4mod 101001 load the up-counter value into cap1 at the rise edge of ti4 pin input. t4ffcr 11000010 clear tff4 to zero. disable tff4 inversion. p8cr ? p8fc x xx 1xx inte45 1100 enable int4, and disables inttr4 and inttr5. intet54 10001000 trun 1x ? start timer 4. setting of int4 treg4 cap1 + 3ms/ f t1 treg5 treg4 + 2ms/ f t1 t4ffcr 11 enable tff4 inversion when the up-counter value matches treg4 or 5. intet54 1100 enable inttr5. setting of int5 t4ffcr 00 disable tff4 inversion when the up-counter value matches treg 4 or 5. intet54 1000 disable inttr5. ) select p82 as the to4 pin. when delay time is unnecessary, invert timer ?p-?p tff4 when the up-counter value is loaded into capture register 1 (cap1), and set the cap1 value (c) plus the one-shot pulse width (p) to treg5 when the interrupt int4 occurs. the tff4 inversion should be enabled when the up-counter (uc4) value matches treg5, and disabled when generating the interrupt inttr5. 100 toshiba corporation TMP96C141AF figure 3.9 (15). one-shot pulse output (without delay) frequency measurement the frequency of the external clock can be measured in this mode. the clock is input through the ti4 pin, and its frequency is measured by the 8-bit timers (timer 0 and timer 1) and the 16-bit timer/event counter (timer 4). the ti4 pin input should be selected for the input clock of timer 4. the value of the up-counter is loaded figure 3.9 (16). frequency measurement for example, if the value for the level ??width of tff1 of the 8-bit timer is set to 0.5 sec. and the differ- ence between cap1 and cap2 is 100, the frequency will be 100/0.5 [sec.] = 200 [hz]. into the capture register cap1 at the rise edge of the timer ?p-?p tff1 of 8-bit timers (timer 0 and timer 1), and into cap2 at its fall edge. the frequency is calculated by the difference between the loaded values in cap1 and cap2 when the interrupt (intt0 or intt1) is generated by either 8-bit timer. toshiba corporation 101 TMP96C141AF a pulse width measurement this mode allows measuring the ??level width of an external pulse. while keeping the 16-bit timer/event counter counting (free-running) with the internal clock input, the external pulse is input through the ti4 pin. then the capture function is used to load the uc4 values into cap1 and cap2 at the rising edge and falling edge of the external trigger pulse respectively. the interrupt int4 occurs at the falling edge of ti4. the pulse width is obtained from the difference between the values of cap1 and cap2 and the internal clock cycle. for example, if the internal clock is 0.8 microseconds and the difference between cap1 and cap2 is 100, the pulse width will be 100 x 0.8 = 80 microseconds. figure 3.9 (17). pulse width measurement note: only in this pulse width measuring mode (t4mod 102 toshiba corporation TMP96C141AF figure 3.9 (18). time difference measurement (5) different phased pulses output mode in this output mode, signals with any different phase can be outputted by free-running up-counter uc4. when the value in up-counter uc4 and the value in treg4 (treg5) match, the value in tff4 (tff5) is inverted and output to to4 (to5). this mode can only be used by 16-bit timer 4. figure 3.9 (19). phase output cycles (counter over?w time) of the above output waves are listed below. 16mhz 20mhz f t1 1.024msec 0.819msec f t4 4.096msec 3.277msec f t16 16.38 msec 13.11 msec toshiba corporation 103 TMP96C141AF 3.10 stepping motor control/pattern generation port the TMP96C141AF has two channels (pg0 and pg1) of 4-bit hardware stepping motor control/pattern generation (herein after called pg) which actuate in synchronization with the (8- bit/16-bit) timers. the pg (pg0 and pg1) are shared in 8-bit i/ o ports p6. channel 0 (pg0) is synchronous with 8-bit timer 0 or timer 1, 16-bit timer 5, to update the output. the pg ports are controlled by control registers (pg01cr) and can select either stepping motor control mode or pattern generation mode. each bit of the p6 can be used as the pg port. pg0 and pg1 can be used independently. all pg operate in the same manner except the following points, and thus only the operation of pg0 will be explained below. differences between pg0 and pg1 pg0 pg1 trigger signal from timer 4 from timer 5 figure 3.10 (1). port 6/pg circuit 104 toshiba corporation TMP96C141AF figure 3.10 (2a). pattern generation control register (pg01cr) toshiba corporation 105 TMP96C141AF figure 3.10 (2b). pattern generation control register (pg01cr) 106 toshiba corporation TMP96C141AF figure 3.10 (3). pattern generation 0 register (pg0reg) figure 3.10 (4). pattern generation 1 register (pg1reg) 76543210 bit symbol pg03 pg02 pg01 pg00 sa03 sa02 sa01 sa00 read/write w r/w after reset 0000 unde?ed function pattern generation 0 (pg0) output latch register (reading the p6 that is set to the pg port allows to read-out.) shift alternate register 0 for the pg mode (4-bit write) register 76543210 bit symbol pg13 pg12 pg11 pg10 sa13 sa12 sa11 sa10 read/write w r/w after reset 0000 unde?ed function pattern generation 1 (pg1) output latch register (reading the p6 that is set to the pg port allows to read-out.) shift alternate register 1 for the pg mode (4-bit write) register pg0reg (004ch) prohibit read modify write pg1reg (004dh) prohibit read modify write toshiba corporation 107 TMP96C141AF figure 3.10 (5). 16-bit timer trigger control register (t45cr) 108 toshiba corporation TMP96C141AF figure 3.10 (6). connection of timer and pattern generator (1) pattern generation mode pg functions as a pattern generation according to the setting of pg01cr toshiba corporation 109 TMP96C141AF figure 3.10 (7). pattern generation mode block diagram (pg0) - shift due to the shift trigger from timer in this pattern generation mode, only writing the output latch is disabled by hardware, but other functions do the same operation as 1-2 excitation in stepping motor control port mode. accordingly, the data shifted by trigger signal from a timer must be written before the next trigger signal is output. 110 toshiba corporation TMP96C141AF (2) stepping motor control mode 4-phase 1-step/2-step excitation figure 3.10 (8) and figure 3.10 (9) show the output waveforms of 4-phase 1 excitation and 4-phase 2 excita- tion, respectively when channel 0 (pg0) is selected. note: bn indicates the initial value of pg0reg ? b7 b6 b5 b4 x x x x normal rotation reverse rotation figure 3.10 (8). output waveforms of 4-phase 1-step excitation (normal rotation and reverse rotation) - initial value of pg0reg ? 0100 x x x x - initial value of pg0reg ? 0100 x x x x toshiba corporation 111 TMP96C141AF figure 3.10 (9). output waveforms of 4-phase 2-step excitation (normal rotation) - initial value of pg0reg ? 0100 x x x x the operation when channel 0 is selected is explained below. the output latch of pg0 (also used as p6) is shifted at the rising edge of the trigger signal from the timer to be output to the port. the direction of shift is speci?d by pg01cr 112 toshiba corporation TMP96C141AF 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. note: bn denotes the initial value of pg0reg ? b7 b6 b5 b4 b3 b2 b1 b0 normal rotation reverse rotation figure 3.10 (11). output waveforms of 4-phase 1-2 step excitation (normal rotation and reverse rotation) - initial value of pg0reg ? 11001000 - initial value of pg0reg ? 10001100 toshiba corporation 113 TMP96C141AF the initialization for 4-phase 1-2 step excitation is as follows: by rearranging the initial value ?7 b6 b5 b4 b3 b2 b1 b0?to ?7 b3 b6 b2 b5 b1 b4 b0? the consecutive 3 bits are set to ??and other bits are set to ??(positive logic). for example, if b7, b3, and b6 are set to ?", the ini- tial value becomes ?1001000? obtaining the output waveforms as shown in figure 3.10 (11). to get an output waveform of negative logic, set val- ues 1s and 0 s of the initial value should be inverted. for example, to change the output waveform shown in fig- ure 3.10 (11) into negative logic, change the initial value to ?0110111? the operation will be explained below for channel 0. the output latch of pg0 (shared by p6) and the shifter alternate register (sa0) for pattern generation are shifted at the rising edge of trigger signal from the timer to be output to the port. the direction of shift is set by pg01cr 114 toshiba corporation TMP96C141AF setting example: to drive channel 0 (pg0) by 4-phase 1-2 step excitation (normal rotation) when timer 0 is selected, set each register as follows: note: x; don t care ? no change 76543210 trun ? ? ? stop timer 0, and clears it to zero. tmod ? 0 0 x x 0 1 set 8-bit timer mode and selects f t1 as the input clock of timer 0. tffcr ? xxx01010 clear tff1 to zero and enables the inversion trigger by timer 0. treg0 ? ******** set the cycle in timer register. p6cr ? 1111 set p60 ~ p63 bits to the output mode. p6fc ? 1111 set p60 ~ p63 bits to the pg output. pg01cr ? 0011 select pg0 4-phase 1 - 2 step excitation mode and normal rotation. pg0reg ? 11001000 set an initial value. trun ? 11 start timer 0. note: to shift pg, tffcr toshiba corporation 115 TMP96C141AF figure 3.10 (13). output waveforms of 4-phase 1-step excitation setting example: note: x; don t care ? no change 76543210 trun ? 00 stop timer 0, and clears it to zero. tmod ? 10xxxx01 set timer 0 and timer 1 in ppg output mode and selects f t1 as the input clock. tffcr ? xxx0011x enable tff1 inversion and sets tff1 to ?? treg0 ? ******** set the duty of to1 to treg0. treg1 ? ******** set the cycle of to1 to treg1. p7cr ? xxxx 1 p7fc ? xxxx 1x p6cr ? 1111 p6fc ? 1111 pg01cr ? 0001 set pg0 in 4-phase 1-step excitation mode. pg0reg ? ******** set an initial value. trun ? 1x 11 start timer 0 and timer 1. (4) application of pg and timer output as explained in ?rigger signal from timer? the timing to shift pg and invert tff differs depending on the mode of timer. an application to operate pg while operating an 8-bit timer in ppg mode will be explained below. to drive a stepping motor, in addition to the value of each phase (pg output), synchronizing signal is often required at the timing when excitation is changed over. in this application, port 6 is used as a stepping motor control port to output a synchro- nizing signal to the to1 pin (shared by p71). ) assign p71 as to1. ) assign p60 - 63 as pg0. 116 toshiba corporation TMP96C141AF 3.11 serial channel the TMP96C141AF contains two serial i/o channels for full duplex asynchronous transmission (uart) as well as for i/o extension. the serial channel has the following operation modes: l i/o interface mode mode 0: to transmit and receive i/o data as well as (channel 1 only) the synchronizing signal sclk for extending i/o. mode 1: 7-bit data l asynchronous transmission mode 2: 8-bit data (uart) mode (channel 0 and 1) mode 3: 9-bit data note: TMP96C141AF/tmp96c041af/ tmp96cm40f/tmp96pm40f with channel 0 and 1. in mode 1 and mode 2, a parity bit can be added. mode 3 has wake-up function for making the master controller start slave controllers in serial link (multi-controller system). figure 3.11 (1) shows the data format (for one frame) in each mode. when bit 8 = 1, address (select code) is denoted. when bit 8 = 0, data is denoted. figure 3.11 (1). data formats toshiba corporation 117 TMP96C141AF the serial channel has a buffer register for transmitting and receiving operations, in order to temporarily store trans- mitted or received data, so that transmitting and receiving operations can be done independently (full duplex). however, in i/o interface mode, sclk (serial clock) pin is used for both transmission and receiving, the channel becomes half-duplex. the receiving data register is of a double buffer structure to prevent the occurrence of overrun error and provides one frame of margin before cpu reads the received data. the receiving data register stores the already received data while the buffer register receives the next frame data. by using cts and rts (there is no rts pin, so any one port must be controlled by software), it is possible to halt data send until cpu ?ishes reading receive data every time a frame is received (handshake function). in the uart mode, a check function is added not to start the receiving operation by error start bits due to noise. the channel starts receiving data only when the start bit is detected to be normal at least twice in three samplings. when the transmission buffer becomes empty and requests the cpu to send the next transmission data, or when data is stored in the receiving data register and the cpu is requested to read the data, inttx or intrx interrupt occurs. besides, if an overrun error, parity error, or framing error occurs during receiving operation, ?g sc0cr/sc1cr 118 toshiba corporation TMP96C141AF note: there is sc1mod (56h) in channel 1 figure 3.11 (2). serial mode control register (channel 0, sc0mod) toshiba corporation 119 TMP96C141AF note: serial control register for channel 1 is sc1cr (55h). as all error ?gs are cleared after reading, do not test only a single bit with a bit-testing instruction. figure 3.11 (3). serial control register (channel, sc0cr) 120 toshiba corporation TMP96C141AF note: as all error ?gs are cleared after reading, do not test only a single bit with a bit-testing instruction. figure 3.11 (4). serial channel control (channel 0, br0cr) figure 3.11 (5). serial transmission/receiving buffer registers (channel 0, sc0buf) 76543210 tb7 tb6 tb5 tb4 tb3 tb2 tb1 tb0 76543210 rb7 rb6 rb5 rb4 rb3 rb2 rb1 rb0 (transmission) (receiving) sc0buf (50h) toshiba corporation 121 TMP96C141AF figure 3.11 (6). serial mode control register (channel 1, sc1mod) 122 toshiba corporation TMP96C141AF note: as all error ?gs are cleared after reading, do not test only a single bit with a bit-testing instruction. figure 3.11 (7). serial control register (channel 1, sc1cr) toshiba corporation 123 TMP96C141AF note: to use baud rate generator, set trun 124 toshiba corporation TMP96C141AF figure 3.11 (10). port 9 function register (p9fc) port 3.11 (11). port 9 open drain enable register (ode) toshiba corporation 125 TMP96C141AF 3.11.2 con?uration figure 3.11 (12) shows the block diagram of the serial channel 0. figure 3.11 (12). block diagram of the serial channel 0 126 toshiba corporation TMP96C141AF figure 3.11 (13) shows the block diagram of the serial channel 1. figure 3.11 (13). block diagram of the serial channel 1 toshiba corporation 127 TMP96C141AF l uart mode transfer rate = input clock of baud rate generator fr equency divisor of baud rate generator l i/o interface mode transfer rate = input clock of baud rate generator fr equency divisor of baud rate generator the relation between the input clock and the source clock (fc) is as follows: f t0 = fc/4 f t2 = fc/16 f t8 = fc/64 f t32 = fc/256 accordingly, when source clock fc is 12.288 mhz, input clock is f t2 (fc/16), and frequency divisor is 5, the transfer rate in uart mode becomes as follows: transfer rate = fc/16 5 = 12.288 x 10 6 /16/5/16 = 9600 (bps) table 3.11 (1) shows an example of the transfer rate in uart mode. also with 8-bit timer 0, the serial channel can get a transfer rate. table 3.11 (2) shows an example of baud rate using timer 0. note: transfer rate in i/o interface mode is 8 times as fast as the values given in the above table. table 3.11 (1) selection of transfer rate (1) (when baud rate generator is used) unit (kbps) fc [mhz] input clock frequency divisor f t0 (fc/4) f t2 (fc/16) f t8 (fc/64) f t32 (fc/256) 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 - 0 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 baud rate generator baud rate generator comprises a circuit that gener- ates transmission and receiving clocks to determine the transfer rate of the serial channel. the input clock to the baud rate generator, f t0 (fc/ 4), f t2 (fc/16), f t8 (fc/64), or f t32 (fc/256) is generated by the 9-bit prescaler which is shared by the timers. one of these input clocks is selected by the baud rate genera- tor control register br0cr/br1cr 128 toshiba corporation TMP96C141AF how to calculate the transfer rate (when timer 0 is used): transfer rate = fc treg0 x 8 x 16 (when timer 0 (input clock f t1) is used) input clock of timer 0 f t1 = fc /8 f t4 = fc /32 f t16 = fc /128 note: timer 0 match detect signal cannot be used as the transfer clock in i/o interface mode. table 3.11 (2) selection of transfer rate (1) (when timer 0 (input clock f t1) is used) unit (kbps) fc treg0 12.288mhz 12mhz 9.8304mhz 8mhz 6.144mhz 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 - serial clock generation circuit this circuit generates the basic clock for transmitting and receiving data. 1) i/o interface mode (channel 1 only) when in sclk output mode with the set- ting of sc1cr toshiba corporation 129 TMP96C141AF 2) asynchronous communication (uart) mode the receiving control has a circuit for detecting the start bit by the rule of majority. when two or more ??are detected during 3 samples, it is recognized as start bit and the receiving operation is started. data being received is also evaluated by the rule of majority. ? receiving buffer to prevent overrun error, the receiving buffer has a double buffer structure. received data is stored one bit by one bit in the receiving buffer 1 (shift register type). when 7 bits or 8 bits of data are stored in the receiving buffer 1, the stored data is transferred to another receiving buffer 2 (sc0buf/ sc1buf), generating an interrupt intrx0/intrx1. the cpu reads only receiving buffer 2 (sc0buf/sc1buf). even before the cpu reads the receiving buffer 2 (sc0buf/sc1buf), the received data can be stored in the receiving buffer 1. however, unless the receiving buffer 2 (sc0buf/sc1buf) is read before all bits of the next data are received by the receiving buffer 1, an over- run error occurs. if an overrun error occurs, the contents of the receiving buffer 1 will be lost, although the contents of the receiving buffer 2 and sc0cr 130 toshiba corporation TMP96C141AF handshake function serial channel 0 has a cts0 pin. using this pin, data can be sent in units of one frame; thus, overrun errors can be avoided. the handshake function is enabled/disabled by sc0mod toshiba corporation 131 TMP96C141AF generating timing 1) uart mode 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. 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 transmitting mode 9-bit 8-bit + parity 8-bit, 7-bit + parity, 7-bit interrupt timing just before last bit is transmitted. ?? 11 ? transmission buffer transmission buffer (sc0buf/sc1buf) shifts to and sends the transmission data written from the cpu from the least signi?ant bit (lsb) in order, using transmission shift clock txdsft which is generated by the transmis- sion control. when all bits are shifted out, the transmis- sion buffer becomes empty and generates inttx0/ inttx1 interrupt. parity control circuit when serial channel control register sc0cr 132 toshiba corporation TMP96C141AF 2) i/o interface mode transmission interrupt timing sclk output mode immediately after rise of last sclk signal (see figure 3.11 (19) ). sclk input mode immediately after rise of last sclk signal (rising mode), or immediately after fall in falling mode (see figure 3.11 (20)). receiving interrupt timing sclk output mode timing used to transfer received data to data receive buffer 2 (sc1buf); that is, immediately after last sclk (see figure 3.11 (21)). sclk input mode timing used to transfer received data to data receive buffer 2 (sc1buf); that is, immediately after sclk (see figure 3.11 (22)). 3.11.3 operational description (1) mode 0 (i/o interface mode) this mode is used to increase the number of i/o pins for trans- mitting or receiving data to or from the external shifter register. this mode includes sclk output mode to output syn- chronous clock sclk and sclk input mode to input 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 133 TMP96C141AF transmission in sclk output mode, 8-bit data and synchronous clock are output from txd pin and sclk pin, respectively, each time the cpu writes data in the transmission buffer. when all data is output, intes1 134 toshiba corporation TMP96C141AF receiving in sclk output mode, synchronous clock is output from sclk pin and the data is shifted in the receiving buffer 1 whenever the receive interrupt ?g intes1 toshiba corporation 135 TMP96C141AF note: x; don t care ? no change 76543210 p9cr ? x x ? p9fc ? xx x xx1 sc0mod ? x0 x0101 set 7-bit uart mode. sc0cr ? x11xxx00 add an even parity. br0cr ? 0x100101 set transfer rate at 2400 bps. trun ? 1x start the prescaler for the baud rate generator. intes0 ? 1100 enable inttx0 interrupt and sets interrupt level 4. sc0buf ? ******** set data for transmission. direction of transmission (transmission rate: 2400 bps @ fc = 12.288mhz) (2) mode 1 (7-bit uart mode) the 7-bit mode can be set by setting serial channel mode register sc0mod 136 toshiba corporation TMP96C141AF note: x; don t care ? no change main setting 76543210 p9cr ? x x 0 select p91 (rxd) as the input pin. sc0mod ? 01x1001 enable receiving in 8-bit uart mode. sc0cr ? x01xxx00 add an odd parity. br0cr ? 0x010101 set transfer rate at 9600 bps. trun ? 1x start the prescaler for the baud rate generator. intes0 ? 1100 enable inttx0 interrupt and sets interrupt level 4. interrupt processing acc ? sc0cr and 00011100 if acc 1 0 then error acc ? sc0buf read the received data. ) check for error. (4) mode 3 (9-bit uart mode) the 9-bit uart mode can be speci?d by setting sc0mod toshiba corporation 137 TMP96C141AF protocol select the 9-bit uart mode for master and slave controllers. set sc0mod 138 toshiba corporation TMP96C141AF setting example: to link two slave controllers serially with the master controller, and use the internal clock f 1 (fc/2) as the transfer clock. since serial channels 0 and 1 operate in exactly the same way, channel 0 is used for the purposes of explanation. setting the master controller setting the slave controller 2 main setting p9cr ? x x 01 p9fc ? xx x xx1 intes0 ? 11001101 enable inttx0 and sets the interrupt level 4. enable intrx0 and sets the interrupt level 5. sc0mod ? 10101110 set f 1 (fc/2) as the transmission clock in 9-bit uart mode. sc0buf ? 00000001 set the select code for slave controller 1. inttx0 interrupt sc0mod ? ? set tb8 to ?? sc0buf ? ******** set data for transmission. main setting p9cr ? x x 01 p9fc ? xx x xx1 ode ? xxxxxx 1 intes0 ? 11011110 enable intrx0 and inttx0. sc0mod ? 00111110 set toshiba corporation 139 TMP96C141AF 3.12 analog/digital converter the TMP96C141AF contains a high-speed analog/digital con- verter (a/d converter) with 4- channel analog input that features 10-bit successive approximation. figure 3.12 (1) shows the block diagram of the a/d con- verter. the 4-channel analog input pins (an3 to an0) are shared by input-only p5 and so can be used as input port. figure 3.12 (1). block diagram of a/d converter note: 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. 140 toshiba corporation TMP96C141AF figure 3.12 (2). a/d control register toshiba corporation 141 TMP96C141AF figure 3.12 (3-1). a/d conversion result register (adreg0, 1) 76543210 bit symbol adr01 adr00 read/write r after reset unde?ed 111111 function lower 2 bits of a/d result for an0 are stored. 76543210 bit symbol adr09 adr08 adr07 adr06 adr05 adr04 adr03 adr02 read/write r after reset unde?ed function upper 8 bits of a/d result for an0 are stored. 76543210 bit symbol adr11 adr10 read/write r after reset unde?ed 111111 function lower 2 bits of a/d result for an1 are stored. 76543210 bit symbol adr19 adr18 adr17 adr16 adr15 adr14 adr13 adr12 read/write r after reset unde?ed function upper 8 bits of a/d result for an1 are stored. adreg0l (0060h) adreg0h (0061h) adreg1l (0062h) adreg1h (0063h) 142 toshiba corporation TMP96C141AF figure 3.12 (3-2). a/d conversion result register (adreg2, 3) 76543210 bit symbol adr21 adr20 read/write r after reset unde?ed 111111 function lower 2 bits of a/d result for an2 are stored. 76543210 bit symbol adr29 adr28 adr27 adr26 adr25 adr24 adr23 adr22 read/write r after reset unde?ed function upper 8 bits of a/d result for an2 are stored. 76543210 bit symbol adr31 adr30 read/write r after reset unde?ed 111111 function lower 2 bits of a/d result for an3 are stored. 76543210 bit symbol adr39 adr38 adr37 adr36 adr35 adr34 adr33 adr32 read/write r after reset unde?ed function upper 8 bits of a/d result for an3 are stored. adreg2l (0064h) adreg2h (0065h) adreg3l (0066h) adreg3h (0067h) toshiba corporation 143 TMP96C141AF 3.12.1 operation (1) analog reference voltage high analog reference voltage is applied to the vref pin, and low analog reference voltage is applied to agnd pin. the reference voltage between vreg and agnd is divided by 1024 using ladder resistance, and com- pared with the analog input voltage for a/d conversion. (2) analog input channels analog input channel is selected by admod 144 toshiba corporation TMP96C141AF note: x; don t care ? no change main setting inte0ad 1100 enable intad and sets interrupt level 4. admod xx000111 specify an3 pin as an analog input channel and starts a/d conversion in high speed mode. intad routine wa adreg3 read adreg3l and adreg3h values and writes to wa (16 bit). wa > > 6 right-shifts wa six times and writes 0 in upper bits. (00ff10h) wa writes contents of wa in memory at ff10h. when the analog input voltage of an0 ~ an2 pins is a/d converted in high speed conversion channel scan repeat mode. inte0ad 100 disable intad. admod xx110110 start the a/d conversion of analog input channels an0 ~ an2 in the high-speed scan repeat mode. 3.13 watchdog timer (runaway detecting timer) the TMP96C141AF is containing watchdog timer of runaway detecting. the watchdog timer (wdt) is used to return the cpu to the normal state when it detects that the cpu has started to malfunction (runaway) due to causes such as noise. when the watchdog timer detects a malfunction, it generates a non- maskable interrupt to notify the cpu of the malfunction, and outputs 0 externally from watchdog timer out pin wdtout to notify the peripheral devices of the malfunction. connecting the watchdog timer output to the reset pin internally forces a reset. toshiba corporation 145 TMP96C141AF 3.13.1 con?uration figure 3.13 (1) shows the block diagram of the watchdog timer (wdt). figure 3.13 (1). block diagram of watchdog timer 146 toshiba corporation TMP96C141AF the watchdog timer is a 22-stage binary counter which uses f (fc/2) as the input clock. there are four outputs from the binary counter: 2 16 /fc, 2 18 /fc, 2 20 /fc, and 2 22 /fc. selecting one of the outputs with the wdmod register generates a watch- dog interrupt, and outputs watchdog timer out when an over- ?w occurs. since the watchdog timer out pin (wdtout ) outputs ?? due to a watchdog timer over?w, the peripheral devices can figure 3.13 (2). normal mode figure 3.13 (3). reset mode be reset. the watchdog timer out pin is set to 1 by clearing the watchdog timer (by writing a clear code 4eh in the wdcr reg- ister). in other words, the wdtout keeps outputting ??until the clear code is written. the watchdog timer out pin can also be connected to the reset pin internally. in this case, the watchdog timer out pin (wdtout ) outputs 0 at 8 to 20 states (800ns to 2 m s @ 20mhz) and resets itself. toshiba corporation 147 TMP96C141AF 3.13.2 control registers watchdog timer wdt is controlled by two control registers wdmod and wdcr. (1) watchdog timer mode register (wdmod) setting the detecting time of watchdog timer 148 toshiba corporation TMP96C141AF figure 3.13 (4). watchdog timer mode register toshiba corporation 149 TMP96C141AF figure 3.13 (5). watchdog timer control register 150 toshiba corporation TMP96C141AF 3.13.3 operation the watchdog timer generates interrupt intwd after the detecting time set in the wdmod toshiba corporation 151 TMP96C141AF 4. electrical characteristics note: i-dar is guaranteed for a total of up to 8 ports. 4.1 absolute maximum (TMP96C141AF) symbol parameter rating unit v cc power supply voltage -0.5 ~ 6.5 v v in input voltage -0.5 ~ v cc + 0.5 v s iol output current (total) 100 ma s ioh output current (total) -100 ma pd power dissipation (ta = 70 c) 600 mw t solder soldering temperature (10s) 260 c t stg storage temperature -65 ~ 150 c t opr operating temperature -20 ~ 70 c 4.2 dc characteristics (TMP96C141AF) v cc = 5v 10%, ta = -20 ~ 70 c (typical values are for ta = 25 c and v cc = 5v) symbol parameter min max unit test condition v il input low voltage (ad0-15) -0.3 0.8 v v il1 p2, p3, p4, p5, p6, p7, p8, p9 -0.3 0.3v cc v v il2 reset , nmi , into (p87) -0.3 0.25v cc v v il3 ea -0.3 0.3 v v il4 x1 -0.3 0.2v cc v v ih input high voltage (ad0-15) 2.2 v cc + 0.3 v v ih1 p2, p3, p4, p5, p6, p7, p8, p9 0.7v cc v cc + 0.3 v v ih2 reset , nmi , into (p87) 0.75v cc v cc + 0.3 v v ih3 ea v cc - 0.3 v cc + 0.3 v v ih4 x1 0.8v cc v cc + 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 m a v oh1 0.75v cc v i oh = -100 m a v oh2 0.9v cc v i oh = - 20 m a i dar darlington drive current (8 output pins max.) -1.0 -3.5 ma v ext - 1.5v r ext = 1.1k w i li input leakage current 0.02 (typ) 5 m a 0.0 v in v cc i lo output leakage current 0.05 (typ) 10 m a 0.2 v in v cc - 0.2 i cc operating current (run) idle stop (ta = -20 ~ 70 c) stop (ta = 0 ~ 50 c) 26 (typ) 1.7 (typ) 0.2 (typ) 50 10 50 10 ma ma m a m a t osc = 16mhz 0.2 v in v cc - 0.2 0.2 v in v cc - 0.2 v stop power down voltage (@stop, ram back up) 2.0 6.0 v v il2 = 0.2v cc , v ih2 = 0.8v cc r rst reset pull up register 50 150 k w c io pin capacitance 10 pf tosc = 1mhz v th schmitt width reset , nmi , into (p87) 0.4 1.0 (typ) v r k pull down/up register 50 150 k w 152 toshiba corporation TMP96C141AF ac measuring conditions output level: high 2.2v /low 0.8v, cl50pf (however cl = 100pf for ad0 ~ ad15, ad0 ~ ad23, ale, rd , wr , hwr , r/w , clk, ras , cas0 ~ cas2 ) input level: high 2.4v /low 0.45v (ad0 ~ ad15) high 0.8vcc /low 0.2vcc (except for ad0 ~ ad15) 4.3 ac electrical characteristics (TMP96C141AF) v cc = 5v 10%, ta = -20 ~ 70 c (4mhz ~ 20mhz) no. symbol parameter variable 16mhz 20mhz unit min max min max min max 1t osc osc. period (= x) 50 250 62.5 50 ns 2t clk clk width 2x - 40 85 60 .0 ns 3t ak a0 - 23 valid clk hold 0.5x - 20 11 .0 5 0 ns 4t ka clk valid a0 - 23 hold 1.5x - 70 24 0 5 0 ns 5t al a0-15 valid ale fall 0.5x - 15 16 0 10 0 ns 6t la ale fall a0 - 15 hold 0.5x - 15 16 0 10 0 ns 7t ll ale high width x - 40 23 .0 10 0 ns 8t lc ale fall rd /wr fall 0.5x - 30 1 .0 -5 ns 9t cl rd /wr rise ale rise 0.5x - 20 11 .0 5 0 ns 10 t acl a0 - 15 valid rd /wr fall x - 25 38 .0 25 0 ns 11 t ach a0 - 23 valid rd /wr fall 1.5x - 50 44 .0 25 .0 ns 12 t ca rd /wr rise a0 - 23 hold 0.5x - 20 11 .0 5ns 13 t adl a0 - 15 valid d0 - 15 input 3.0x - 45 143 105 ns 14 t adh a0 - 23 valid d0 - 15 input 3.5x - 65 154 110 ns 15 t rd rd fall d0 - 15 input 2.0x - 50 75 50 ns 16 t rr rd low width 2.0x - 40 85 .0 60 .0 ns 17 t hr rd rise d0 - 15 hold 0 0 .0 0 .0 ns 18 t rae rd rise a0 - 15 output x - 15 48 .0 35 .0 ns 19 t ww wr low width 2.0x - 40 85 .0 60 .0 ns 20 t dw d0 - 15 valid wr rise 2.0x - 50 75 .0 50 .0 ns 21 t wd wr rise d0 - 15 hold 0.5x - 10 21 .0 15 .0 ns 22 t aeh a0 - 23 valid w ait input (1wait + n mode) 3.5x - 90 129 85 ns 23 t awl a0 - 15 valid w ait input (1wait + n mode) 3.0x - 80 108 70 ns 24 t cw rd /wr fall w ait hold (1wait + n mode) 2.0x + 0 125 .0 100 .0 ns 25 t aph a0 - 23 valid port input 2.5x - 120 80 36 ns 26 t aph2 a0 - 23 valid port hold 2.5x + 50 206 .0 175 .0 ns 27 t cp wr rise port valid 200 200 200 ns 28 t asrh a0 - 23 valid ras fall 1.0x - 40 23 .0 10 .0 ns 29 t asrl a0 - 15 valid ras fall 0.5x - 15 16 .0 10 .0 ns 30 t rac ras fall d0 - 15 input 2.5x - 70 130 86 ns 31 t rah ras fall a0 - 15 hold 0.5x - 15 16 .0 10 .0 ns 32 t ras ras low width 2.0x - 40 85 .0 60 .0 ns 33 t rp ras high width 2.0x - 40 85 .0 60 .0 ns 34 t rsh cas fall ras rise 1.0x - 35 28 .0 15 .0 ns 35 t rsc ras rise cas rise 0.5x - 25 6 .0 0 .0 ns 36 t rcd ras fall cas fall 1.0x - 40 23 .0 10 0 ns 37 t cac cas fall d0 - 15 input 1.5x - 65 29 10 ns 38 t cas cas low width 1.5x - 30 64 .0 40 .0 ns toshiba corporation 153 TMP96C141AF (1) read cycle 154 toshiba corporation TMP96C141AF (2) write cycle toshiba corporation 155 TMP96C141AF 4.4 a/d conversion characteristics (TMP96C141AF) v cc = 5v 10% ta = -20 ~ 70 c symbol parameter min typ max unit v ref analog reference voltage v cc - 1.5 v cc v cc v a gnd analog reference voltage v ss v ss v ss v ain analog input voltage range v ss v cc i ref analog current for analog reference voltage 0.5 1.5 ma error (quantize error of 0.5 lsb not included) 4 fc 16mhz low speed conversion mode 1.5 (tbd) 4.0 lsb high speed conversion mode 3.0 (tbd) 6.0 16 fc 20mhz low speed conversion mode 1.5 (tbd) 4.0 high speed conversion mode 4.0 (tbd) 8.0 4.5 serial channel timing - i/o interface mode v cc = 5v 10% ta = -20 ~ 70 c (1) sclk input mode symbol parameter variable 16mhz 20mhz unit min max min max min max t scy sclk cycle 16x 1 0.8 m s t oss output data rising edge of sclk t scy /2 - 5x - 50 137 100 ns t ohs sclk rising edge output data hold 5x - 100 212 150 ns t hsr sclk rising edge input data hold 0 0 0 ns t srd sclk rising edge effective data input t scy - 5x - 100 587 450 ns (2) sclk output mode symbol parameter variable 16mhz 20mhz unit min max min max min max t scy sclk cycle (programmable) 16x 8192x 1 512 0.8 409.6 m s t oss output data rising edge of sclk t scy - 2x - 150 725 550 ns t ohs sclk rising edge output data hold 2x - 80 45 20 ns t hsr sclk rising edge input data hold 0 0 0 ns t srd sclk rising edge effective data input t scy - 2x - 150 725 550 ns 4.6 timer/counter input clock (ti0, ti4, ti5, ti6, ti7) v cc = 5v 10% ta = -20 ~ 70 c symbol parameter variable 16mhz 20mhz unit min max min max min max t vck clock cycle 8x + 100 600 500 ns t vckl low level clock pulse width 4x + 40 290 240 ns t vckh high level clock pulse width 4x + 40 290 240 ns 156 toshiba corporation TMP96C141AF 4.7 interrupt operation v cc = 5v 10% ta = -20 ~ 70 c symbol parameter variable 16mhz 20mhz unit min max min max min max t intal nmi , int0 low level pulse width 4x 250 200 ns t intah nmi , int0 high level pulse width 4x 250 200 ns t intbl int4 ~ int7 low level pulse width 8x + 100 600 500 ns t intbh int4 ~ int7 high level pulse width 8x + 100 600 500 ns toshiba corporation 157 TMP96C141AF 4.8 timing chart for i/o interface mode 158 toshiba corporation TMP96C141AF 4.9 timing chart for bus request (busrq )/bus acknowledge (busak ) note 1: the bus will be released after the w ait request is inactive, when the busrq is set to ??during ?ait?cycle. note 2: this line only shows the output buffer is off-states. they don t indicate the signal levels are ?ed. after the bus is released, the signal level is kept dynamically before the bus is released by the external capacitance. therefore, to ? the signal level by an external resistance under the bus is releasing, the design must be carefully because of the level-? will be delayed. the internal programmable pull-up/pull-down resistance is switched active by the internal signal. symbol parameter variable 16mhz 20mhz unit min max min max min max t brc busrq setup time for clk 120 120 120 ns t cbal clk busak falling edge 1.5x + 120 214 195 ns t cbah clk busak rising edge 0.5x + 40 71 65 ns t aba output buffer is off to busak 0 80 080080ns t baa busak output buffer is on. 0 80 0 80 0 80 ns toshiba corporation 159 TMP96C141AF 4.10 interrupt operation v cc = 5v, ta = -25 c, unless otherwise noted 160 toshiba corporation TMP96C141AF 5. table of special function registers (sfrs) (sfr; special function register) the special function registers (sfrs) include the i/o ports and peripheral control registers allocated to the 128-byte addresses from 000000h to 00007fh. (1) i/o port (2) i/o port control (3) timer control (4) pattern generator control (5) watch dog timer control (6) serial channel control (7) a/d converter control (8) interrupt control (9) chip select/wait control con?uration of the table toshiba corporation 161 TMP96C141AF table 5 i/o register address map address name address name address name address name 000000h p0 20h trun 40h treg6l 60h adreg0l 1h p1 21h 41h treg6h 61h adreg0h 2h p0cr 22h treg0 42h treg7l 62h adreg1l 3h 23h treg1 43h treg7h 63h adreg1h 4h p1cr 24h tmod 44h cap3l 64h adreg2l 5h p1fc 25h tffcr 45h cap3h 65h adreg2h 6h p2 26h treg2 46h cap4l 66h adreg3l 7h p3 27h treg3 47h cap4h 67h adreg3h 8h p2cr 28h p0mod 48h t5mod 68h b0cs 9h p2fc 29h p1mod 49h t5ffcr 69h b1cs ah p3cr 2ah pffcr 4ah 6ah b2cs bh p3fc 2bh 4bh 6bh ch p4 2ch 4ch pg0reg 6ch dh p5 2dh 4dh pg1reg 6dh eh p4cr 2eh 4eh pg01cr 6eh fh 2fh 4fh 6fh 10h p4fc 30h treg4l 50h sc0buf 70h inte0ad 11h 31h treg4h 51h sc0cr 71h inte45 12h p6 32h treg5l 52h sc0mod 72h inte67 13h p7 33h treg5h 53h br0cr 73h intet10 14h p6cr 34h cap1l 54h sc1buf 74h intepw10 15h p7cr 35h cap1h 55h sc1cr 75h intet54 16h p6fc 36h cap2l 56h sc1mod 76h intet76 17h p7fc 37h cap2h 57h br1cr 77h intes0 18h p8 38h t4mod 58h ode 78h intes1 19h p9 39h tff4cr 59h 79h 1ah p8cr 3ah t45cr 5ah 7ah 1bh p9cr 3bh 5bh 7bh iimc 1ch p8fc 3ch 5ch wdmod 7ch dma0v 1dh p9fc 3dh 5dh wdcr 7dh dma1v 1eh 3eh 5eh admod 7eh dma2v 1fh 3fh 5fh 7fh dma3v 162 toshiba corporation TMP96C141AF (1) i/o port note: when p30 pin is de?ed as rd signal output mode (p30f = 1), clearing the output latch register p30 to ??outputs the rd strobe from p30 pin for psram, even when the internal address is accessed. if the output latch register p30 remains ?? the rd strobe is output only when the external address is accessed. read/write r/w ; either read or write is possible r ; only read is possible w ; only write is possible prohibit rwm ; prohibit read modify write. (prohibit res/set/tset/chg/stcf/andcf/orcf/xorcf instruction) symbol name address 76543210 p0 port0 00h p07 p06 p05 p04 p03 p02 p01 p00 r/w input mode unde?ed p1 port1 01h p17 p16 p15 p14 p13 p12 p11 p10 r/w input mode 00000000 p2 port2 06h p27 p26 p25 p24 p23 p22 p21 p20 r/w input mode 00000000 p3 port3 07h p37 p36 p35 p34 p33 p32 p31 p30 r/w input mode output mode 11111111 p4 port4 0ch p42 p41 p40 r/w input mode 011 p5 port5 0dh p53 p52 p51 p50 r input mode p6 port6 12h p67 p66 p65 p64 p63 p62 p61 p60 r/w input mode 11111111 p7 port7 13h p73 p72 p71 p70 r/w input mode 1111 p8 port8 18h p87 p86 p85 p84 p83 p82 p81 p80 r/w input mode 11111111 p9 port9 19h p95 p94 p93 p92 p91 p90 r/w input mode 111111 toshiba corporation 163 TMP96C141AF (2) i/o port control (1/2) note: with the tmp96c141a/tmp96c141a/tmp96c041a, which requires an external rom, port0 functions as ad0 to ad7; port1, ad8 to ad15; p30, the rd signal; p31, the wr signal, regardless of the values set in p0cr, p1cr, p1fc, p30f and p31f. symbol name address 76543210 p0cr port0 control 02h (prohibit rmw) p07c p06c p05c p04c p03c p02c p01c p00c w 00000000 0 : in 1 : out (when external access, set as ad7 - 0 and cleared to ?".) p1cr port1 control 04h (prohibit rmw) p17c p16c p15c p14c p13c p12c p11c p10c w 00000000 < 164 toshiba corporation TMP96C141AF i/o port control (2/2) symbol name address 76543210 p6cr port6 control 14h (prohibit rmw) p67c p66c p65c p64c p63c p62c p61c p60c w 00000000 0 : in 1 : out p7cr port7 control 15h (prohibit rmw) p73c p72c p71c p70c w 0000 0 : in 1 : out p6fc port6 function 16h (prohibit rmw) p67f p66f p65f p64f p63f p62f p61f p60f w 00000000 0 : port 1 : pg1 - out 0 : port 1 : pgo - out p7fc port7 function 17h (prohibit rmw) p73f p72f p71f w 000 0 : port 1 : to3 0 :port 1 : to2 0 : port 1 : to1 p8cr port8 control 1ah (prohibit rmw) p87c p86c p85c p84c p83c p82c p81c p80c w 00000000 0 : in 1 : out p9cr port9 control 1bh (prohibit rmw) p95c p94c p93c p92c p91c p90c w 000000 0:in 1:out p8fc port8 function 1ch (prohibit rmw) p86f p83f p82f www 000 0 : port 1 : to6 0 : port 1 : to5 0 : port 1 : to4 p9fc port9 function 1dh (prohibit rmw) p95f p93f p92f p90f wwww 0000 0 : port 1 : sclk1 0 : port 1 : txd1 0 : port 1 : sclk0 0 : port 1 : txd0 toshiba corporation 165 TMP96C141AF (3) timer control (1/4) symbol name address 76543210 trun timer control 20h prrun t5run t4run p1run p0run t1run t0run r/w r/w 0 000000 prescaler and timer run/stop control 0 : stop and clear 1 : run (count up) treg0 8bit timer register 0 22h (prohibit rmw) w unde?ed treg1 8bit timer register 1 23h (prohibit rmw) w unde?ed tmod 8bit timer source clk and mode 24h (prohibit rmw) t10m1 t10m0 pwmm1 pwmm0 t1clk1 t1clk0 t0clk1 t0clk0 w 00000000 00 : 8-bit timer 01 : 16-bit timer 10 : 8-bit ppg 11 : 8-bit pwm 00 : 01 : 2 6 - 1 pwm 10 : 2 7 - 1 11 : 2 8 - 1 00 : to0trg 01 : f t1 10 : f t16 11 : f t256 00 : ti0 input 01 : f t1 10 : f t4 11: f t16 tffcr 8bit timer flip-?p control 25h dben tff1c1 tff1c0 tff1ie tff1is r/w w r/w 00000 1 : double buffer enable 00 : invert tff1 01 : set tff1 10 : clear tff1 11 : don? care 1 : tff1 invert enable 0 : inverted by timer 0 treg2 pwm timer register 2 26h (r)/w (can read double buffer values.) unde?ed treg3 pwm timer register 3 27h (r)/w (can read double buffer values.) unde?ed p0mod pwm0 mode 28h (prohibit rmw) ff2rd db2en pwm0int pwm0m t2clk1 t2clk0 pwm0s1 pwm0s0 rw 0000000 tff2 output value 1 : double buffer enable 0 : over?w interrupt 1: compare/ match interrupt 0 : pwm mode 1 : timer mode 00 : f p1(fc/4) 01 : f p4(fc/16) 10 : f p16(fc/64) 11 : don? care 00 : 2 6 - 1 01 : 2 7 - 1 10 : 2 8 - 1 11 : don? care p1mod pwm1 mode 29h (prohibit rmw) ff3rd db3en pwm1int pwm1m t3clk1 t3clk0 pwm1s1 pwm1s0 rw 0000000 tff3 output value 1 : double buffer enable 0 : over?w interrupt 1 : compare/ match interrupt 0 : pwm mode 1 : timer mode 00 : f p1(fc/4) 01 : f p4(fc/16) 10 : f p16(fc/64) 11 : don? care 00 : 2 6 - 1 01 : 2 7 - 1 10:2 8 - 1 11:don? care 166 toshiba corporation TMP96C141AF timer control (2/4) symbol name address 76543210 pffcr pwm flip-?p control 2ah ff3c1 ff3c0 ff3trg1 ff3trg0 ff2c1 ff2c0 ff2trg1 ff2trg0 w r/w w r/w 00000000 00 : don? care 01 : set tff3 10 : clear tff3 11 : don? care 00 : prohibit tff3 inverted 01 : invert if matched 10 : set if matched; clear if over?wed 11 : clear if matched; set if over?wed 00 : don? care 01 : set tff2 10 : clear tff2 11 : don? care 00 : prohibit tff2 inverted 01 : invert if matched 10 : set if matched; clear if over?wed 11 : clear if matched; set if over?wed treg4l 16-bit timer register 4l 30h (prohibit rmw) w unde?ed treg4h 16-bit timer register 4h 31h (prohibit rmw) w unde?ed treg5l 16-bit timer register 5l 32h (prohibit rmw) w unde?ed treg5h 16-bit timer register 5h 33h (prohibit rmw) w unde?ed cap1l capture register 1l 34h r unde?ed cap1h capture register 1h 35h r unde?ed cap2l capture register 2l 36h r unde?ed cap2h capture register 2h 37h r unde?ed t4mod 16-bit timer 4 source clk and mode 38h cap2t5 eq5t5 cap1in cap12m1 cap12m0 cle t4clk1 t4clk0 r/w w r/w 00000000 tff5 inv trg o: trg disable 1: trg enable 0 : soft- capture 1 : don? care capture timing 00 : disable 01 : t14 t15 10 : t14 t14 11 : tff1 tff1 1 : uc4 clear enable source clock 00 : ti4 01 : f t1 10 : f t4 11 : f t16 toshiba corporation 167 TMP96C141AF timer control (3/4) symbol name address 7654 3 210 t4ffcr 16bit timer 4 flip-?p control 39h tff5c1 tff5c0 cap2t4 cap1t4 eq5t4 eq4t4 tff4c1 tff4c0 w r/w w 0000 0 000 00 : invert tff5 01 : set tff5 10 : clear tff5 11 : don? care tff4 invert trigger 0 : trigger disable 1 : trigger enable source clock 00 : invert tff4 01 : set tff4 10 : clear tff4 11 : don? care t45cr t4, t5 control 3ah pg1t pg0t db6en db4en r/w r/w 00000 fix at ? pg1 shift trigger 0 : timer 0, 1 1 : timer 5 pg0 shift trigger o : timer 0, 1 1 : timer 4 1 : double buffer enable treg6l 16bit timer register 6l 40h (prohibit rmw) w unde?ed treg6h 16bit timer register 6h 41h (prohibit rmw) w unde?ed treg7l 16bit timer register 7l 42h (prohibit rmw) w unde?ed treg7h 16bit timer register 7h 43h (prohibit rmw) w unde?ed cap3l capture register 3l 44h r unde?ed cap3h capture register 3h 45h r unde?ed cap4l capture register 4l 46h r unde?ed cap4h capture register 4h 47h r unde?ed t5mod 16bit timer 5 source clk and mode 48h cap3in cap34m1 cap34m0 cle t5clk1 t5clk0 r/w w 0000 0 000 0 : soft- capture 1 : don? care capture timing 00 : disable 01 : t16 - t17 - 10 : t16 - t16 11 : tff1 - tff1 1 : uc5 clear enable source clock 00 : invert tff6 01 : set tff6 10 : clear tff6 11 : don? care 168 toshiba corporation TMP96C141AF (4) pattern generator (5) watch dog timer t5ffcr 16bit timer 5 flip-?p control 49h cap4t6 cap3t6 eq7t6 eq6t6 tff6c1 tff6c0 r/w w 00 0 000 tff6 invert trigger 0 : trigger disable 1 : trigger enable 00 : invert tff6 01 : set tff6 10 : clear tff6 11 : don? care symbol name address 76543210 pg0reg pgo register 4ch (prohibit rmw) pg03 pg02 pg01 pg00 sa03 sa02 sa01 sa00 w r/w 0000 unde?ed pg1reg pg1 register 4dh (prohibit rmw) pg13 pg12 pg11 pg10 sa13 sa12 sa11 sa10 w r/w 0000 unde?ed pg01cr pg0, 1 control 4eh (prohibit rmw) pat1 ccw1 pg1m pg1te pat0 ccw0 pg0m pg0te r/w 00000000 0 : 8bit write 1 : 4bit write 0 : normal rotation 1 : reverse rotation 0 : 4bit step 1 : 8bit step pg1 trigger input enable 1 : enable 0 : 8bit write 1 : 4bit write 0 : normal rotation 1 : reverse rotation 0 : 4bit step 1 : 8bit step pg0 trigger input enable 1 : enable symbol name address 76543210 wd- mod watch dog timer mode 5ch wdte wdtp1 wdtp0 warm haltm1 haltm0 rescr drve r/w 10000000 1 : wdt enable 00 : 2 16 /fc 01 : 2 18 /fc 10 : 2 20 /fc 11 : 2 22 /fc warming up time 0 : 2 14 /fc 1 : 2 16 /fc standby mode 00 : run mode 01 : stop mode 10 : idle mode 11 : don? care 1 : connect internally wdt out pin to reset pin 1 : drive the pin in stop mode wdcr watch dog timer control register 5dh w b1h : wdt disable code 4eh : wdt clear code symbol name address 7654 3 210 timer control (4/4) toshiba corporation 169 TMP96C141AF (6) serial channel (1/2) symbol name address 76543210 sc0buf serial channel 0 buffer 50h rb7 tb7 rb6 tb6 rb5 tb5 rb4 tb4 rb3 tb3 rb2 tb2 rb1 tb1 rb0 tb0 r (receiving)/w (transmission) unde?ed sc0cr serial channel 0 control 51h rb8 even pe oerr perr ferr r r/w r (cleared to 0 by reading) r/w 00000000 receiving data bit 8 parity 0 : odd 1 : even 1 : parity enable 1 : error 1: input sclk0 pin (note) overrun parity framing sc0- mod serial channel 0 mode 52h tb8 ctse rxe wu sm1 sm0 sc1 sc0 r/w 00000000 transmission data bit 8 1 : cts enable 1 : receive enable 1 : wake up enable 00 : unused 01 : uart 7bit 10 : uart 8bit 11 : uart 9bit 00 : to0 trigger 01 : baud rate generator 10 : internal clock f 1 11 : don? care br0cr baud rate control 53h br0ck1 br0ck0 br053 br052 br051 br050 r/w r/w 0 000000 fix at ? 00 : f t0 (fc/4) 01 : f t2 (fc/16) 10 : f t8 (fc/64) 11 : f t32 (fc/256) set frequency divisor 0 ~ f (??prohibited) sc1buf serial channel 1 buffer 54h rb7 tb7 rb6 tb6 rb5 tb5 rb4 tb4 rb3 tb3 rb2 tb2 rb1 tb1 rb0 tb0 r (receiving)/w (transmission) unde?ed sc1cr serial channel 1 control 55h rb8 even pe oerr perr ferr sclks ioc r r/w r (cleared to 0 by reading) r/w 0000000 receiving data bit 8 parity 0 : odd 1 : even 1 : parity enable 1 : error 1 : input sclk1 pin overrun parity framing sc1- mod serial channel 1 mode 56h tb8 rxe wu sm1 sm0 sc1 sc0 r/w 00000000 transmission data bit 8 fix at ? 1 : receive enable 1 : wake up enable 00 : i/o interface 01 : uart 7bit 10 : uart 8-bit 11 : uart 9bit 00 : to0 trigger 01 : baud rate generator 10 : internal clock f 1 11 : don? care 170 toshiba corporation TMP96C141AF (7) a/d converter control *1: data to be stored in a/d conversion result reg low are the lower 2 bits of the conversion result. the contents of the lower 6 bits of this register are always read as ?? br1cr baud rate control 57h br1ck1 br1ck0 br153 br152 br151 br150 r/w r/w 0 000000 fix at ? 00 : f t0 (fc/4) 01 : f t2 (fc/16) 10 : f t8 (fc/64) 11 : f t32 (fc/256) set frequency divisor 0 ~ f (??prohibited) ode special open drain enable 58h ode1 ode0 r/w 00 1 : p93 open-drain 1 : p90 open-drain symbol name address 76543210 ad- mod a/d converter mode reg 5eh eocf adbf repet scan adcs ads adch1 adch0 r r/w 00000000 1 : end 1 : busy 1 : repeat mode 1 : scan mode 1 : slow mode 1 : start analog input channel series *1) ad reg0l ad result reg 0 low 60h adr01 adr00 r unde?ed 111111 ad reg0h ad result reg 0 high 61h adr09 adr08 adr07 adr06 adr05 adr04 adr03 adr02 r unde?ed *1) ad reg1l ad result reg 1 low 62h adr11 adr10 r unde?ed 111111 ad reg1h ad result reg 1 high 63h adr19 adr18 adr17 adr16 adr15 adr14 adr13 adr12 r unde?ed *1) ad reg2l ad result reg 2 low 64h adr21 adr20 r unde?ed 111111 ad reg2h ad result reg 2 high 65h adr29 adr28 adr27 adr26 adr25 adr24 adr23 adr22 r unde?ed *1) ad reg3l ad result reg 3 low 66h adr31 adr30 r unde?ed 111111 ad reg3h ad result reg 3 high 67h adr39 adr38 adr37 adr36 adr35 adr34 adr33 adr32 r unde?ed symbol name address 76543210 serial channel (2/2) toshiba corporation 171 TMP96C141AF (8) interrupt control (1/2) 172 toshiba corporation TMP96C141AF interrupt control (2/2) symbol name address 76543210 dma0v dma 0 request vector 7ch (prohibit rmw) m dma0 start vector dma0v8 dma0v7 dma0v6 dam0v5 dma0v4 w 00000 dma1v dma 1 request vector 7dh (prohibit rmw) m dma1 start vector dma01v8 dma1v7 dma1v6 dam1v5 dma1v4 w 00000 dma2v dma 2 request vector 7eh (prohibit rmw) m dma2 start vector dma2v8 dma2v7 dma2v6 dam2v5 dma2v4 w 00000 dma3v dma 3 request vector 7fh (prohibit rmw) m dma3 start vector dma3v8 dma3v7 dma3v6 dam3v5 dma3v4 w 00000 iimc interrupt input mode control 7bh (prohibit rmw) i0ie i0le nmiree www 000 1 : int0 input enable 0 : into edge mode 1 : into level mode 1 : operate even at nmi rise edge toshiba corporation 173 TMP96C141AF (9) chip select/wait controller note 1: after reset, only ?lock 2?is set to enable. ? after reset, the program starts in 16-bit data bus, 2-wait state. note 2: these registers can be accessed only in system mode. note 3: tmp96c141a for internal ram less is 80h ~ 7fffh. symbol name address 76543210 b0cs block 0 cs/wait control register 68h (prohibit rmw) b0e b0sys b0cas b0bus b0w1 b0w0 b0c1 b0c0 wwwwwwww 00000000 1 : cs enable 1 : system only 0 : cs0 1 : cas0 0 : 16bit bus 1 : 8bit bus 00 : 2wait 01 : 1wait 10 : 1wait + n 11 : 0wait 00 : 7f00h ~ 7fffh 01 : 400000h ~ 10 : 800000h ~ 11 : c00000h ~ b1cs block 1 cs/wait control register 69h (prohibit rmw) b1e b1sys b1cas b1bus b1w1 b1w0 b1c1 b1c0 wwwwwwww 00000000 1 : cs enable 1 : system only 0 : cs1 1 : cas1 0 : 16bit bus 1 : 8bit bus 00 : 2wait 01 : 1wait 10 : 1wait + n 11 : 0wait 00 : 480h ~ 7fffh 01 : 400000h ~ 10 : 800000h ~ 11 : c00000h ~ b2cs block 2 cs/wait control register 6ah (prohibit rmw) b2e b2sys b2cas b2bus b2w1 b2w0 b2c1 b2c0 wwwwwwww 00000000 1 : cs enable 1 : system only 0 : cs2 1 : cas2 0 : 16bit bus 1 : 8bit bus 00 : 2wait 01 : 1wait 10 : 1wait + n 11 : 0wait 00 : 8000h ~ 01 : 400000h ~ 10 : 800000h ~ 11 : c00000h ~ 174 toshiba corporation TMP96C141AF 6. port section equivalent circuit diagram reading the circuit diagram basically, the gate singles written are the same as those used for the standard cmos logic ic [74hcxx] series. the dedicated signal is described below. stop: this signal becomes active ??when the hold mode setting register is set to the stop mode and the cpu executes the halt instruction. when the drive enable bit [drive] is set to ?? however, stp remains at ?? the input protection resistor ranges from several tens of ohms to several hundreds of ohms. po (ad0 ~ ad7), p1 (ad8 ~ 15, a8 ~ 15), p2 (a2 - 23, a0 ~7) p30 (rd ), p31 (wr ) p32 ~ 37, p40 ~ 41, p6, p7, p80 ~ 86, p91 ~ 92, p94 ~ 95 toshiba corporation 175 TMP96C141AF p42 (cs2 , cas2 ) p5 (an0 ~ 3) p87 (int0) p90 (txd0), p93 (txd1) 176 toshiba corporation TMP96C141AF nmi wdtout clk ?a , am8/16 ale reset toshiba corporation 177 TMP96C141AF x1, x2 vref, agnd 178 toshiba corporation TMP96C141AF 7. guidelines and restrictions (1) special expression explanation of a built-in i/o register: register symbol |
Price & Availability of TMP96C141AF
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |