![]() |
|
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-90 series TMP90CM38 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 8?it microcontroller TMP90CM38f/TMP90CM38t 1. outline and characteristics the TMP90CM38 is a high-speed, high performance 8-bit microcontroller developed for application in the control of various devices. the TMP90CM38, cmos 8-bit microcontroller, integrates an 8-bit cpu, rom, ram, a/d converter, d/a converter, multi-func- tion timer/event counter, general-purpose serial interface, signal measure circuit, timing pulse generation circuit and pwm output in a single chip, and with which external program memory and data memory can be extended up to 31kb. the TMP90CM38f uses an 80-pin ?t package. the TMP90CM38t uses an 84-pin qf (plcc) package. the following are the features of TMP90CM38: (1) highly ef?ient instruction set: 167 basic instructions instructions, including division and multiplication instructions, 16-bit opera- tion instructions and bit operation instructions (2) minimum instruction executing time: 250ns (at 16mhz) (3) built-in rom: 32k bytes (4) built-in ram: 1k bytes (5) memory extension capability external program memory: 31k bytes external data memory: 31k bytes (6) interrupt functions: 13 internal, 5 external (7) 8-bit a/d converter (8 channels) (8) 8-bit d/a converter (2 channels) (9) general-purpose serial interface mode (2 channels) with asynchronous mode and i/o interface mode (1 channel) with synchronous mode (1 channel) i/o interface mode (1 channels) (10) timer function (1) 16-bit timer/event counter (1 channel) ----- built-in 2 capture register and 2 comparator (2) 8-bit timer (4 channels) ----- built-in 1 comparator in each channel (3) watchdog timer function (wdtout pin having) (11) i/o ports: max. 66 pins (12) hdma function (2 channels) ----- 1 byte transmission: 1.75 m s (@16.0mhz) (13) software standby function ----- run, stop, idle modes hardware standby function ----- stop mode
2 toshiba corporation TMP90CM38 figure 1. TMP90CM38 block diagram toshiba corporation 3 TMP90CM38 2. pin assignment and functions the assignment of input/output pins for TMP90CM38, their name and outline functions are described below. 2.1 pin layout diagram figure 2.1 (1) shows the pin assignment of TMP90CM38f. figure 2.1 (1). pin assignments (flat package) 4 toshiba corporation TMP90CM38 figure 2.1 (2) shows the pin assignment of TMP90CM38t. figure 2.1 (2). pin assignments (qfj (plcc) package) toshiba corporation 5 TMP90CM38 2.2 pin names and functions the names of input/output pins and their functions are described below. table 2.2 shows the input/output pin names and functions. table 2.2. pin names and functions (1/3) 6 toshiba corporation TMP90CM38 table 2.2. pin names and functions (2/3) toshiba corporation 7 TMP90CM38 table 2.2. pin names and functions (3/3) 8 toshiba corporation TMP90CM38 3. operation this section explains the functions and basic operations of the TMP90CM38 in blocks. 3.1 cpu the TMP90CM38f has a built-in, high performance 8 bit cpu. for the operation of the cpu, see the book tlcs 90 series cpu core architecture. this section explains the cpu functions unique to the TMP90CM38 that are not explained in ?hat book. 3.1.1 reset figure 3.1 (1) shows the basic timing of reset. to reset TMP90CM38, it is required that the power supply voltage is within operating range, the internal oscillator is sta- bly functioning, and reset input be kept at ??for at least 10 system clocks (10 states: 2 microseconds with a 10mhz sys- tem clock) when a reset is accepted, among i/o common ports, port 0 (address data bus a0 - a7), port 1 (address bus a8 - a15) and port 2 are set to input status (with high impedance). output ports p30 (rd ), p31 (wr ), clk, and wdtout (p80) are set to ??and ale (p83) is cleared to ?? cpu registers and external memory are not changed. however, program counter pc and interrupt enable/disable ?g iff are cleared to ?? the a register becomes unde?ed. when the reset is released, instruction execution starts from address 0000h. figure 3.1 (1). reset timing of TMP90CM38 toshiba corporation 9 TMP90CM38 3.1.2 exf (exchange flag) the exchange ?g exf is inverted when the exx instruction is executed to exchange data between the TMP90CM38 main registers and auxiliary registers. this ?g is allocated to bit 7 at memory address ffe1h. 3.1.3 wait control for the TMP90CM38, a wait control register (w aitc) is assigned to bits 4 and 5 at memory address ffb0h. 10 toshiba corporation TMP90CM38 3.2 memory map the TMP90CM38 can provide a maximum 64k byte program memory and data memory. the program and data memories may be allocated to the addresses 0000h ~ ffffh. (1) built-in rom the TMP90CM38 has an internal 32k byte rom. this rom is located at addresses 0000h ~ 7fffh. pro- gram execution starts from address 000h after a reset operation. addresses 0010h ~ 00c7h in the internal rom area are used as the interrupt processing entry area. (2) built-in ram the TMP90CM38 contains a 1k byte built-in ram which is allocated to the addresses fba0h ~ ff9fh. the cpu can also access some portions of the ram (160 byte area ff00h ~ ff9fh) using short instruction codes in the direct addressing mode. (3) built-in i/o the TMP90CM38 uses 96 bytes of the address space as a built-in i/o area. the area is allocated to the addresses ffa0h ~ ffffh. the cpu can access the built-in i/o using short instruction codes in the direct addressing mode. figure 3.2 shows the memory map and the access ranges of the cpu for each addressing mode. figure 3.2. memory map toshiba corporation 11 TMP90CM38 3.3 interrupt functions the TMP90CM38 has a general-purpose interrupt process- ing routine for responding to both internal and external inter- rupt request, and a high-speed micro dma (hdma) processing mode in which the cpu automatically transfers data. immediately after a reset is released, all responses to interrupt requests are set to the general-purpose interrupt processing mode. the high-speed dma processing mode can be set by loading a vector value to the dmav 0/1 register. figure 3.3 (1) shows the interrupt response ?w. figure 3.3 (1). interrupt response flow when an interrupt request is generated, this is reported to the cpu via the built-in interrupt controller. if the request is for a non-maskable interrupt or an enabled maskable interrupt, the cpu starts interrupt processing. if for a disabled maskable interrupt, the request is ignored and not received. if the interrupt is received, the cpu ?st reads the interrupt vector from the built-in interrupt controller to determine the source of the interrupt request. next, a check is made as to whether this request is for general-purpose interrupt processing, micro dma processing or high-speed dma (hdma) processing, and then the corresponding processing is performed. the interrupt vector is read in an internal operation cycle so the bus cycle becomes a dummy cycle. 12 toshiba corporation TMP90CM38 3.3.1 general-purpose interrupt processing figure 3.3 (2) shows the general-purpose interrupt processing ?w. the cpu ?st saves the contents of the program counter pc and register af (including the interrupt enable/disable ?g iff immediately before an interrupt) to the stack and then resets the interrupt enable/disable ?g iff to ??(interrupt disable). finally, the interrupt vector contents [v] are transferred to the program counter and a jump is made to the interrupt processing pr ogram. there is a 20-state overhead from the time when the interrupt is received until the jump is made to the interrupt processing program. figure 3.3 (2). general-purpose interrupt processing flow interrupt processing program is ended with the reti instruction for both maskable and non-maskable interrupts. executing this instruction restores the program counter pc and register af contents from the stack. (resets the interrupt enable/disable ?g immediately before an interrupt.) when the cpu reads the interrupt vector, the interrupt request source con?ms that the interrupt has been received and then clears the interrupt request. non-maskable interrupts cannot be disabled by program. maskable interrupts, how- ever, can be enabled and disabled by program. bit 5 of cpu reg- ister f is an interrupt enable/disable ?p?p (iff). interrupts are enabled by setting this bit to ??with the ei (interrupt enable) instruction and disabled by resetting this bit to ??with the di (interrupt disable) instruction. iff is reset to ??by resetting and when an interrupt is received (including non-maskable interrupts). the ei instruction is actually executed after the next instruction is executed. table 3.3 (1) shows the interrupt sources. toshiba corporation 13 TMP90CM38 table 3.3 (1) interrupt sources the ?riority sequence?shown in table 3.3 (1) indicates the sequence in which interrupt sources are received by the cpu when multiple interrupt requests are generated simultaneously. for example, if interrupt requests with the priority sequences 4 and 5 are generated simultaneously, the cpu will receive the interrupt request with priority sequence 4 ?st. when processing of the interrupt with priority sequence 4 is ended with the reti instruction, the cpu will then receive the interrupt with priority sequence 5. if the interrupt processing program for the priority sequence 4 interrupt is interrupted by executing the ei instruction, the cpu will receive the priority sequence 5 interrupt request. when multiple interrupt requests are generated simultaneously, the built-in interrupt controller only determines the priority sequence of the interrupt sources received by the cpu. there is no function to compare the priority sequence of the interrupt currently being processed and the interrupt currently being requested. another interrupt can be enabled while another interrupt is being processed by resetting the interrupt enable/disable ?g iff to enable. 14 toshiba corporation TMP90CM38 3.3.2 high-speed micro dma processing the TMP90CM38 has two built-in dma channels called hdma. hdma has three times the processing capacity of m dma and is used for high-speed data transfers. hdma execution time (decrease the value of transfer number and the value is not ??data) is 14 states, regardless of whether the 1-byte transfer mode or 2-byte transfer mode is used. hdma and micro dma (the TMP90CM38 has not the micro dma) transfer speeds. table 3.3 (4) shows the hdma functions. table 3.3 (3) transfer speeds table 3.3 (4) shows the dhma functions (1) hdma setting registers the following describes the registers required for hdma operation. toshiba corporation 15 TMP90CM38 16 toshiba corporation TMP90CM38 (2) register loading note: it is ineffective to set decrement for a destination address when a source address being increment; and to set increment for a destination address when a source address being decrement. toshiba corporation 17 TMP90CM38 (3) hdma start hdma can be started by any of the following TMP90CM38 maskable interrupt sources (a) internal start factors internal i/o interrupts assign starting of hdma channel 0 or channel 1 to the int0 - int3 external interrupts, connect any of the bits of ports 0 - 8 (output mode) externally to int0 - int3 to genrate a start interrupt. (b) external start factors int0 ~ 3 pin (4) hdma channel 0 and channel 1 priority sequence the channel where an interrupt is generated ?st has priority note: hdma, regardless of an interrupt enable ?g, compares the vector and the values of the dma v0/1 register. if they match in ei mode, the hdma starts. do not write the vector value of the non- maskable interrupt to the dma v0/1 register. if doing so, the hdma does not operate normally. to stop the hdma from being started, set di mode before generating the interrupt to start the hdma, or set the dma v0/1 register to 00h. 18 toshiba corporation TMP90CM38 (5) hdma operation flow figure 3.3 (6). hdma operation flow toshiba corporation 19 TMP90CM38 (6) hdma operation timing figure 3.3 (7a). hdma operation timing 20 toshiba corporation TMP90CM38 figure 3.3 (7b). hdma operation timing toshiba corporation 21 TMP90CM38 3.3.3 interrupt controller figure 3.3 (9) shows an abbreviated interrupt circuit diagram. the left half of this diagram shows the interrupt controller and the right half shows the cpu interrupt request signal circuit and hold release circuit. the interrupt controller has an interrupt request ?p?p and interrupt enable/disable ?g for each interrupt channel (total: 18 channels), and a micro dma enable/disable ?g. the interrupt request ?p-?p latches interrupt requests that arrive from the periphery. this ?p?p is reset to ??when there is a reset, when the cpu receives an interrupt and reads the vector of that interrupt channel, and when an instruction that clears the interrupt request (writes ?ector value/8?to memory address ffe0h) for that channel is executed. ld (0ffe0h), 60h/8 for example, when ld (0ffe0h), 38h/8 is executed, the interrupt request ?p?p for the interrupt channel [intt1] with the vector value 38h is reset to ??(to clear the ?p?p, also write to address ffc9h when the interrupt request ?g is assigned to ffe1h and ffe2h). table 3.3 (5) shows the ?nterrupt vector value/8?values. the status of the interrupt request ?p?p can be determined by reading memory address ffc9h, ffcah or ffcbh. ?? means no interrupt request and ??means an interrupt request. figure 3.3 (8) shows the bit layout when the interrupt request ?p?p is read. 22 toshiba corporation TMP90CM38 table 3.3 (4) interrupt vector value/8 values figure 3.3 (5). interrupt request flip?p read (1/2) toshiba corporation 23 TMP90CM38 figure 3.3 (6). interrupt request flip?p read (2/2) 24 toshiba corporation TMP90CM38 figure 3.3 (7). interrupt controller block toshiba corporation 25 TMP90CM38 the interrupt enable/disable ?gs for each interrupt request channel are assigned to memory addresses ffe3h - ffe5h. interrupts are enabled for a channel by setting the ?g to ?? the ?gs are reset to ??by reseting. interrupt common terminal mode how to set int0 p81 level inte2 26 toshiba corporation TMP90CM38 int0 level mode as the int0 is not an edge type interrupt, the interrupt request flip-flop is cancelled, and thus an interrupt request from peripheral devices passes through s input of the flip-flop to become q output. when the mode is changed over (from edge type to level type), the previous interrupt request flag will be cleared automatically. when the mode is changed from level to edge, the interrupt request flag set in the level mode is not cleared. thus, use the following sequence to clear the interrupt request flag. di set 6, (0ffe5h): switch the mode from level to edge ld (0ffe0h), 05h: clear interrupt request flag ei intrx1, intrx2 the interrupt request flip-flop cannot be cleared only by reset operation or reading the serial channel receiving buffer, and cannot be cleared by an instruction. toshiba corporation 27 TMP90CM38 figure 3.3 (8). interrupt enable flags 28 toshiba corporation TMP90CM38 figure 3.3 (9). interrupt processing flow chart toshiba corporation 29 TMP90CM38 3.4 standby functions when a halt instruction is executed, TMP90CM38 enters the run, idle1 or stop mode according to the contents of the halt mode setting register. the features are as follows: (1) run: only the cpu halts, power consumption remains unchanged. (2) idle: only the internal oscillators operate, while all other internal circuits halt. power consump- tion is 1/10 or less than that during normal operation. (3) stop: all internal circuits halt, including the internal oscillator. power consumption is extremely reduced. the halt mode setting register wdmod 30 toshiba corporation TMP90CM38 3.4.1 run mode figure 3.4 (2) shows the timing for releasing the halt state by an interrupt during run mode. in the run mode, the system clock inside mcu does not stop even after halt instruction has been executed; the cpu merely stops executing instruc- tions. accordingly, the cpu repeats dummy cycle until halt state, interrupt r equests are sampled at the fall edge of clk signal. figure 3.4 (2). halt release timing using interrupts in run mode toshiba corporation 31 TMP90CM38 3.4.2 idle1 mode figure 3.4 (3) shows the timing used for releasing the halt mode by interrupts in the idle1 mode. in the idle1 mode, only the internal oscillator operates, the system clock inside mcu stops and clk signal is ?ed to ?? in the halt state, interrupt requests are sampled asyn- chronously with the system clock but sampling is performed synchronously with the system clock, whereas the halt release (restart of operation) is performed synchronously with it. figure 3.4 (3). halt release timing using interrupts in the idle1 mode 32 toshiba corporation TMP90CM38 3.4.3 stop mode figure 3.4 (4) shows the timing of halt release caused by interrupts in stop mode. in the stop mode, all interval circuits stop, including internal oscillator. when the stop mode is activated, all pins except special ones are put in the high-impedance state, iso- lated from the internal operation of mcu. table 3.4 (1) shows the state of each pin in the stop mode. however, if wdmod toshiba corporation 33 TMP90CM38 the internal oscillator can also be restarted by inputting the reset signal ??to the cpu. however, the warming up counter remains inactive in order to make the cpu rapidly operate when the power is turned on. accordingly, wrong operation may occur due to unstable clocks immediately after the internal oscillator has restarted. to release the halt state by resetting in the stop mode, reset signal must be kept at ??for a suf?ient period of time. 34 toshiba corporation TMP90CM38 : indicates that input mode/input pin cannot be used for input and that the output mode/output pin have been set to high impedance. input: input is enabled. input: the input gate is operating. fix the input voltage at either ??or ??to prevent the pin ?ating. ouput: output status. table 3.4 (1) state of pins in stop mode in/out drve = 0 drve = 1 p00 ~ p07 input mode output mode output p10 ~ p17 input mode output mode input output p20 ~ p23 input mode output mode input output p30 ~ p31 output mode output p32 ~ p33 input mode output mode input output p40 ~ p47 input mode output mode input output p56 ~ p57 input mode output mode input output p60 ~ p67 input mode p70 ~ p77 input mode output mode input output nmi clk x1 x2 ea input mode output mode input mode output mode input mode input ? input input ? input p80 (wdtout ) p81 (int0) p82 (stby ) p83 (ale) output mode input mode input mode output mode input input output input input output p90 ~ p93 input mode output mode output input output p100, p101 input mode output mode input output toshiba corporation 35 TMP90CM38 table 3.4 (2) i/o operation release in halt mode 36 toshiba corporation TMP90CM38 3.4.5 hardware standby function stby input pin this pin is used for setting mcu-standby mode. when this pin is set ?ow? the oscillator stops and internal clock is frozen. the power consumption is extremely reduced. this function sets every pin to a condition as same as stop mode which a halt instruction is executed. figure 3.4 (5) indicates the block diagram of standby mode. figure 3.4 (5). standby mode block diagram toshiba corporation 37 TMP90CM38 3.5 function of ports the TMP90CM38 contains total of 66 i/o port pins. these port pins function not only as the general-purpose i/o ports but also as the i/o ports for the internal cpu and built-in i/o. table 3.5 shows the functions of these port pins. table 3.5 functions of ports these port pins function as the general-purpose i/o port pins by r esetting (except p30, p31, p60 ~ p67, p80 ~ p83). the port pins, for which input or output is programmably selectable, function as input ports by resetting. a separate program is required to use them for an internal function. 38 toshiba corporation TMP90CM38 3.5.1 port 0 (p00 ~ p07) port 0 is the 8-bit general-purpose i/o port p0, each bit of which can be set independently for input or output. the con- trol register p0cr is used to set input or output. reset opera- tions clear all output latch and control register bits to ??and set port 0 to the input mode. in addition to the general-purpose i/o port function, port 0 also functions as an address/data bus (ad0 ~ ad7). when the external memory is accessed, port 0 automatically functions as the address/data bus. figure 3.5 (1). port 0 (p00 ~ p07) toshiba corporation 39 TMP90CM38 figure 3.5 (2). registers for port 0 40 toshiba corporation TMP90CM38 3.5.2 port 1 (p10 ~ p17) port 1 is the 8-bit general-purpose i/o port p1, each bit of which can be set to input or output. the port 1 control register p1cr is used to set input or output. reset operations clear all output latch and the control register bits to ??and sets all port 1 bits to the input mode. in addition to the general-purpose i/o port function, port 1 also functions as an address bus (a8 ~ a15). this is speci?d by setting the external extended speci?ation register irfl toshiba corporation 41 TMP90CM38 figure 3.5 (4). registers for port 1 42 toshiba corporation TMP90CM38 3.5.3 port 2 (p20 ~ p27) port 2 is a 4-bit general-purpose i/o port, each bit of which can be set to input or output. the control register p29cr toshiba corporation 43 TMP90CM38 3.5.4 port 9 (p90 ~ p93) port 9 is a 4-bit general-purpose i/o port, each bit of which can be set for input or output. the control register p29cr 44 toshiba corporation TMP90CM38 figure 3.5 (7). registers for port 2 and port 9 (1/2) toshiba corporation 45 TMP90CM38 figure 3.5 (8). registers for port 2 and port 9 (2/2) 46 toshiba corporation TMP90CM38 3.5.5 port 3 (p30 ~ p33) p32, p33 are a 2-bit general-purpose i/o port. the control register p38cr toshiba corporation 47 TMP90CM38 figure 3.5 (10). port 3 48 toshiba corporation TMP90CM38 figure 3.5 (11). register for port 3 toshiba corporation 49 TMP90CM38 3.5.6 port 4 (p40 ~ p47) port 4 is the 8-bit general-purpose i/o port, each bit of which can be set for input or output. the control register p4cr is used to set input or output. all bits of the control register are cleared to ??by reset- ting, and the port turns of input port mode (output latch is set to ??by resetting). figure 3.5 (12). port 4 50 toshiba corporation TMP90CM38 figure 3.5 (13). register for port 4 toshiba corporation 51 TMP90CM38 3.5.7 port 5 (p50 ~ p57) port 4 is the 8-bit general-purpose i/o port, each bit of which can be set for input or output. the control register p5cr is used to set input or output. by reset operation, the output latch is set to ??and the control register is set to ?? and port 5 is placed in the input mode. in addition to the general-purpose i/o port function, these ports function as interrupt request input, clock input for timer or event counter, or timer output, or wait input. (1) p55, p57, p51, p52 when speci?d by port 5 function register p5fr 52 toshiba corporation TMP90CM38 (2) p56 p56 is also used as clock input (ti2) for 8-bit timer 0 as external interrupt request input (int3). figure 3.5 (15). port 5 (p56) toshiba corporation 53 TMP90CM38 (3) p53, p54 these ports are also used as the clock input for 16-bit timer or event counter as well as external interrupt request input. figure 3.5 (16). port 5 (p53, p54) 54 toshiba corporation TMP90CM38 (4) p50 figure 3.5 (17). port (p50) toshiba corporation 55 TMP90CM38 figure 3.5 (18). registers for port 5 56 toshiba corporation TMP90CM38 3.5.8 port 6 (p60 - p67) port 6 is an 8-bit general-purpose input port with ?ed input function. in addition to its general-purpose input port function, these ports function as analog input pins (an0 ~ an7). figure 3.5 (19). port 6 (p60 ~ p67) figure 3.5 (20). registers for port 6 toshiba corporation 57 TMP90CM38 3.5.9 port 7 (p70 ~ p77) port 7 is the 8-bit general-purpose i/o port, each bit of which can be set for input or output. the control register p7cr is used to set input or output. by reset operations, all bits of the output latch are set to ?? while all bits of control register are to ?? and port 7 is placed in the input mode. in addition to the general-purpose i/o port function, port 7 have an internal serial interface input/output function. this is speci?d by func- tion register p7fr. all bits of the function register are cleared to ??by resetting, and the port turns to general-purpose i/o mode. figure 3.5 (21). port 7 58 toshiba corporation TMP90CM38 figure 3.5 (22). registers for port 7 toshiba corporation 59 TMP90CM38 figure 3.5 (23). registers for port 7 60 toshiba corporation TMP90CM38 3.5.10 port 8 (p80 - p83) port 8 is the 4-bit general-purpose i/o port, p81, p82 are input-only ports. p80, p83 are output-only ports. in addition to its general-purpose input port function, or watch dog timer out output, these port function as external interrupt request input, or hardware input, or ale output. (1) p81/int0 p81 is the general-purpose input port, is also used as external interrupt request input (int0). int0 is to be used as ??level detection interrupt or rise edge detection interrupt by control register inte2 toshiba corporation 61 TMP90CM38 (2) p80 p80 is used both as a general-purpose output port and for wdtout output. bit 1 of the watchdog timer mode register (wdmod: memory address ffech) and bit 1 of the p38 control register (p38cr: memory address ffa7h) is used to set p80 for wdtout out- put. p80 is wdtout output after reset. figure 3.5 (25). port 8 (p80) 62 toshiba corporation TMP90CM38 (3) p82/stby p82 is a general purpose input port, and this port can be used also as hardware standby. by reset opera- tions, the control register p38cr toshiba corporation 63 TMP90CM38 (4) p83 p83 is output port, and is also used as ale pin. when p83 was 1 chip mode (ea = 1), by reset operations, the control register p38cr 64 toshiba corporation TMP90CM38 figure 3.5 (28). registers for port 8 toshiba corporation 65 TMP90CM38 3.5.11 port 10 (p100, 101) port 10 is a 2-bit general-purpose i/o port. it is speci?d by the control register p10cr in bit basis. all bits of the output latch are initialized to ??by resetting, and port 10 turns to the input mode. figure 3.5 (29). port 10 (p100, 101) 66 toshiba corporation TMP90CM38 figure 3.5 (30). register for port 10 toshiba corporation 67 TMP90CM38 3.6 timers the TMP90CM38 contains four 8-bit timers (timers 0, 1, 2 and 3), each of which can be operated independently. the cas- cade connection allows these timers to be used as 16-bit tim- ers. the following four operating modes are provided for the 8- bit timers. 8-bit interval timer mode (4 timers) 16-bit interval timer mode (2 timers) 8-bit programmable square wave pulse generation (ppg: variable duty with variable cycle) output mode (2 timers) 8-bit pulse width modulation (pwm: variable duty with con- stant cycle) output mode (2 timers the upper two can be combined (two 8-bit timers and one 16-bit timer). figure 3.6 (1) shows the block diagram of 8-bit timer (timer 0 and timer 1). 8-bit timer (timer 2, 3) are connected to the external clock pin ti2 in the timer 2 up counter input clock. other timer 2 and timer 3 have the same circuit con?ura- tion as timer 0 and timer 1. each interval consists of an 8-bit up-counter, 8-bit comparator, and 8-bit timer register. besides, one timer ?p-?p (tff1 or tff3) is provided for each pair of timer 0 and timer 1 as well as timer 2 and timer 3. among the input clock sources for the interval timers, the internal clocks of ?1, ?4, ?16, and ?256 are obtained from the 9-bit prescaler shown in figure 3.6 (2). the operation modes and timer ?p-?ps of the 8-bit timer are controlled by ?e control registers t01mod, t23mod, tffcr, trun, and trdc. 68 toshiba corporation TMP90CM38 figure 3.6 (1). block diagram of 8-bit timers (timers 0 and 1) toshiba corporation 69 TMP90CM38 prescaler this 9-bit prescaler generates the clock input to the 8-bit timers, 16-bit timer/event counters, and baud rate genera- tors by further dividing the fundamental clock (fc) after it has been divided by 4 (fc/4). among them, 8-bit timer uses 4 types of clock: ?1, ?4, ?16, and ?256. this prescaler can be run or stopped by the timer opera- tion control register trun 70 toshiba corporation TMP90CM38 up-counter this is an 8-bit binary counter that counts up the input clock pulse speci?d by the timer 0/timer 1 mode reg- ister t01mod and timer 2/timer 3 mode register t23mod. the input clock pulse for timer 0 is selected from ?1 (8/fc), ?4 (32/fc) and ?16 (128/fc). timer 2 input clock is selected from external clock (ti2 pin = p55/ int3) and same the timer 0 in three kinds internal clock. according to the set value of t01mod and t23mod. the input clock of timer 1 and timer 3 differs depend- ing on the operating mode. when set to 16-bit timer mode, the over?w output of timer 0 and timer 2 is used as the input clock. when set to any other mode than 16-bit timer mode, the input clock is selected from the internal clocks ?1 (8/fc), ?16 (128/fc), and ?256 (2048/fc) as well as the comparator output (match detection signal) of timer 0 and timer 2, according to the set value of t01mod and t23mod. example:when tmod toshiba corporation 71 TMP90CM38 figure 3.6 (3). con?uation of timer registers 0 and 2 note: timer register and the register buffer are allo- cated to the same memory address. when 72 toshiba corporation TMP90CM38 figure 3.6 (4). timer 0/timer 1 mode register (t01mod) toshiba corporation 73 TMP90CM38 figure 3.6 (5). timer 2/timer 3 mode register (t23mod) 74 toshiba corporation TMP90CM38 figure 3.6 (6). 8-bit timer flip-?p control register (tffcr) toshiba corporation 75 TMP90CM38 figure 3.6 (7). timer operation control register (trun) 76 toshiba corporation TMP90CM38 figure 3.6 (8). timer register double buffer control register (trdc) toshiba corporation 77 TMP90CM38 ? comparator a comparator compares the value in the up-counter with the values to which the timer register is set. when they match, the up-counter is cleared to zero and an interrupt signal (intt0 ~ intt3) is generated. if the timer ?p-?p inversion is enabled, the timer ?p-?p is inverted at the same time. ? timer flip-flop (timer f/f) the status of the timer ?p-?p is inverted by the match detect signal (comparator output) of each interval timer and the value can be output to the timer output pins to1 (also used as p55) and to3 (also used as p57). a timer f/f is provided for each pair of timer 0 and timer 1 as well as that of timer 2 and timer 3 and is called tff1 and tff3. tff1 is output to to1 pin, while tff3 is output to to3 pin. the operation of 8-bit timers will be described below: (1) 8-bit timer mode four interval timers 0, 1, 2, and 3 can be used inde- pendently as an 8-bit interval timers. all interval timers operate in the same manner, thus only the operation of timer 1 will be explained below. generating interrupts in a fixed cycle to generate timer 1 interrupt at constant intervals using using timer 1 (intt1), ?st stop timer 1 then set the operation mode, input clock, and synchronization to t01mod and treg1, respectively. then, enable interrupt intt1 and start the counting of timer 1. example: to generate timer 1 interrupt every 40 microseconds at fc = 16mhz, set each reg- ister in the following manner. use the following table for selecting the input clock: table 3.6 (1) 8-bit timer interrupt cycle and input clock interrupt cycle (at fc = 16mhz) resolution input clock 0.5 m s ~ 128ms 0.5 m s ?1 (8/fc) 2 m s ~ 512ms 2 m s ?16 (32/fc) 8 m s ~ 2.048ms 8 m s ?256 (128/fc) 128 m s ~ 32.768ms 128 m s ?256 (2048/fc) 78 toshiba corporation TMP90CM38 generating a 50% duty square wave pulse the timer ?p-?p is inverted at constant intervals, 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. figure 3.6 (9). square wave (50% duty) output timing chart toshiba corporation 79 TMP90CM38 a making timer 1 count up by match signal from timer 0 comparator set the 8-bit timer mode, and set the comparator output of timer 0 as the input clock to timer 1. figure 3.6 (10) ? output inversion with software the value of timer ?p-?p (timer f/f) can be inverted, independent of the timer operation. writing ?0?to tffcr 80 toshiba corporation TMP90CM38 table 3.6 (2) 16-bit timer (interrupt) cycle and input clock interrupt cycle (at fc = 16mhz) resolution input clock 0.5 m s ~ 32.768ms 0.5 m s ?1 (8/fc) 2 m s ~ 131.072ms 2 m s ?16 (32/fc) 8 m s ~ 524.288ms 8 m s ?256 (128/fc) 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 temporarily, and the comparator is restarted by writing data into treg1.) setting example: to generate interrupt intt1 every 0.5 seconds at fc = 16mhz, set the following values for timer registers treg0 and treg1. when counting by using ?16 (8 m s @16mhz), 0.5s ? 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 matches uc0, where the up-counter uc0 is not 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 comparators 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. toshiba corporation 81 TMP90CM38 example: when treg1 = 04h and treg0 = 80h figure 3.6 (11) (3) 8-bit ppg (programmable pulse generation) mode square wave pulse can be generated at any frequency and duty by timer 0 or timer 2. the output pulse may be either low-active or high-active. in this mode, timer 1 and timer 3 cannot be used. timer 0 outputs pulse to to1 pin, (also used as p55), and timer 2 outputs to to3 pin (also used as p57). as an example, the case of timer 0 will be explained below. (timer 2 also functions in the same way). 82 toshiba corporation TMP90CM38 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 cannot be used in this mode, timer 1 can be used for counting by setting trun toshiba corporation 83 TMP90CM38 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: 1/50khz = 20 m s. given ?1 = 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 the 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. 84 toshiba corporation TMP90CM38 (4) 8-bit pwm (pulse width modulation) mode this mode is valid only for timer 0 and timer 2. in this mode, maximum two pwms of 8-bit resolution (pwm0 and pwm2) can be output. pwm pulse is output to to1 pin (also used as p55) when using timer 0, and to to3 pin (also used as p57) when using timer 2. timer 1 and timer 3 can also be used as 8-bit timer. as an example, the case of timer 0 will be explained below. (timer 2 also operates in the same way.) timer output is inverted when up-counter (uc0) matches the set value of timer register treg0 or when 2n - (n = 6, 7, or 8; speci?d by t01mod toshiba corporation 85 TMP90CM38 figure 3.6 (13) shows the block diagram of this mode. figure 3.6 (13). block diagram of 8-bit pwm mode 86 toshiba corporation TMP90CM38 in this mode, the value of register buffer will be shifted in treg0 2 n - 1 over?w is detected when the double buffer of treg0 is enabled. use of the double buffer makes easy the handling of small duty waves. toshiba corporation 87 TMP90CM38 (5) table 3.6 (4) shows the list of 8-bit timer modes . (note) ? don t care lower timer external input clock has t2clk. but it does not have t0clk. table 3.6 (3) pwm cycle and the setting of 2 n - 1 counter formula pwm cycle (@ fc = 16mhz) ?1 (8/fc) ?4 (32/fc) ?16 (128/fc) 2 6 - 1 (2 6 - 1) x ?n 31.5 m s 126 m s 504 m s 2 7 - 1 (2 7 - 1) x ?n 63.5 m s 254 m s 1.01ms 2 8 - 1 (2 8 - 1) x ?n 127 m s 510 m s 2.04ms table 3.6 (4) timer mode setting registers register name t01mod (t23mod) tffcr name of bit in register t01m (t32m) pwm1 (pwm3) t1clk (t3clk) t0clk (t2clk) ff1is (ff3is) function timer mode pwm cycle upper timer input clock lower timer input clock timer f/f invert signal select 16-bit timer mode 01 external clock ?1, ?16, ?256 (01, 10, 11) 8-bit timer x 2 channels 00 lower timer match ?1, ?16, ?256 (01, 01, 10, 11) external clock ?1, ?16, ?256 (01, 01, 10, 11) 0: lower timer output 1: upper timer output 8-bit ppg x 1 channel 10 external clock ?1, ?16, ?256 (01, 01, 10, 11) 8-bit pwm x 1 channel 11 2 6 - 1, 2 7 - 1, 2 8 - 1 (01, 10, 11) external clock ?1, ?16, ?256 (01, 01, 10, 11) 8-bit timer x 1 channel 11 ?1, ?14, ?16 (01, 10, 11) output disabled 88 toshiba corporation TMP90CM38 3.7 multi-function 16-bit timer/event counter (timer 4) the TMP90CM38 contains one multifunctional 16-bit timer/ event counter with the following operation modes: 16-bit timer 16-bit event counter 16-bit programmable pulse generation (ppg) frequency measurement pulse width measurement time differential measurement figure 3.7 (1) shows the block diagram of 16-bit timer/ event counter. toshiba corporation 89 TMP90CM38 figure 3.7 (1). block diagram of 16-bit timer/event counter (timer 4) 90 toshiba corporation TMP90CM38 timer/event counter con sists of 16-bit up-counter, two 16- bit timer registers, two 16-bit capture registers, two compara- tors, register buffer, capture input controller, a timer ?p-?p and the control circuit. timer/event counter is controlled by 4 control registers: t4mod, t4ffcr, trun, and trdc. trun register includes 8-bit timer controller. for trun and trdc registers, see fig- ure 3.6 (7) and figure 3.6 (8). figure 3.7 (2). 16-bit timer/event counter (timer 4) control/mode register (1/2) toshiba corporation 91 TMP90CM38 figure 3.7 (2). 16-bit timer/event counter (timer 4) control/mode register (2/2) 92 toshiba corporation TMP90CM38 figure 3.7 (3). 16-bit timer/event counter timer flip-?p control register toshiba corporation 93 TMP90CM38 up-counter (uc16) uc16 is a 16-bit binary counter which counts up according to the input clock speci?d by t4mod 94 toshiba corporation TMP90CM38 ? capture input control circuit this circuit controls the timing to latch the value of up- counter uc16 into cap1 and cap2. the latch timing of capture register is controlled by register t4mod toshiba corporation 95 TMP90CM38 (1) 16-bit timer mode in this example, the interval time is set in the timer reg- ister treg5 to generate the interrupt intt5. (2) 16-bit event counter mode in timer mode as described in above (1), the timer can be used as an event counter by selecting the external clock (ti4 pin input) as the input clock. to read the value of the counter, ?st perform ?oftware capture?once and read the captured value. the counter counts at the rising edge of ti4 pin input. ti4 pin can also be used as p53/int1. 96 toshiba corporation TMP90CM38 (3) 16-bit programmable pulse generation (ppg) mode the ppg mode is entered by inversion of the timer ?p- ?p tff4 that is to be enabled bu the match of the up- counter uc16 with the timer register treg4 or 5 and to be output to to4 (also used as p51). in this mode, the following conditions must be satis?d. 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 (when duty rate is varied). (4) application examples of capture function the loading of up-counter (uc16) vaules 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 the tff4 status to to4 pin can be enabled or disabled. combined with interrupt function, they can be applied in many ways, for example. one-shot pulse output by using external trigger pulse frequency measurement a pulse width measurement ? time difference measurement one-shot pulse output from the rising edge of exter- nal trigger pulse. set the up-counter uc16 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 cap- ture register cap1 at the rise edge of the ti4 pin. then set to t4mod toshiba corporation 97 TMP90CM38 figure 3.7 (4). one-shot pulse output (with delay) 98 toshiba corporation TMP90CM38 when delay time is unnecessary, invert timer ?p-?p tff4 when the up-counter value is loaded into loaded into capture register 1 (cap1), and set the cap1 value (c) plus the one-shot pulse width (p) to treg5 when the interrupt int1 occurs. the tff4 inversion should be enabled when the up-counter (uc16) value matches treg5, and disabled when generating the interrupt intt5. figure 3.7 (5). one-shot pulse output (without delay) toshiba corporation 99 TMP90CM38 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 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 cap2 at its fall edge. the frequency is 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. figure 3.7 (6). 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 difference between cap1 and cap2 is 100, the frequency will be 100/0.5 [sec.] = 200[hz]. 100 toshiba corporation TMP90CM38 a pulse width measurement this mode allows to measure 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 though the ti4. then the capture function is used to load the uc16 values into cap1 and cap2 at the rising edge and falling edge of the external trigger pulse, respectively. the interrupt int1 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.7 (7). pulse width measurement note: only in this pulse width measuring mode ( t4mod toshiba corporation 101 TMP90CM38 ? time difference measurement this mode is used to measure the difference in time between the rising edges of external pulses input through ti4 and ti5. keep the 16-bit timer/event counter (timer 4) counting (free-running) with the internal clock, and load the uc16 value into cap1 at the rising edge of the input pulse to ti4. then the interrupt int1 is generated. similarly, the uc16 value is loaded into cap2 at the rising edge of the input pulse to ti5, generating the interrupt int2. the time difference between these pulses can be obtained from the difference between the time counts at which loading the up-counter value into cap1 and cap2 has been done. figure 3.7 (8). time difference measurement 102 toshiba corporation TMP90CM38 3.8 stepping motor control/pattern generation ports (p2 and p9) TMP90CM38 contains 2 channels (m0 and m1) of 4-bit hard- ware stepping motor control/pattern generation ports (herein after called smc) which actuate in synchronization with the (8- bit/16-bit) timers. the smc s ports (m0 and m1) are shared by 4-bit i/o ports p2 and p9. channel 0 (m0) is synchronous with 8-bit timer 0 or timer 1, and channel 1 (m1) is synchronous with 8-bit timer 2 or timer 3 or 16-bit timer 4, to update the output. the smc ports are controlled by three control registers p29cr, p29fr, and trdc, and can select either stepping motor control mode or pattern generation mode. 3.8.1 control registers (1) ports 2 and 9 i/o selection register (p29cr) this register speci?s either input or output for each bit of the 4-bit i/o ports 6 and 7. when reset, all bits of p29cr are cleared to ?? so that port 2 and port 9 function as input ports. to use port 6 and port 7 as smc, set all bits of p29cr to ?? specifying them as output pins. p29cr is a write-only register and so cannot be read. (2) port 2 and 9 function control register (p29fr) this register is used for setting port 2 and port 9 as smc. to use port 2 and port 9 as smc, set p29fr toshiba corporation 103 TMP90CM38 figure 3.8 (1). port 2 and port 9 i/o selection register (p29cr) 104 toshiba corporation TMP90CM38 figure 3.8 (2a). port 2 and port 9 function control register (p29fr) toshiba corporation 105 TMP90CM38 figure 3.8 (2b). port 2 and 9 function control register (p29fr) 106 toshiba corporation TMP90CM38 figure 3.8 (3). timer register double buffer control register (trdc) figure 3.8 (4). port 2 and port 9 toshiba corporation 107 TMP90CM38 3.8.2 pattern generation mode smc functions as a pattern generation port according to the setting of p29fr 108 toshiba corporation TMP90CM38 3.8.3 stepping motor control mode (1) 4-phase 1-step/2-step excitation figure 3.8 (6) and figure 3.8 (7) show the output waveforms of 4-phase 1 excitation and 4-phase 2 excitation, respectively when channel 0 is selected . figure 3.8 (6). output waveforms of 4-phase 1-step excitation (normal rotation and reverse rotation) toshiba corporation 109 TMP90CM38 figure 3.8 (7). output waveforms of 4-phase 2-step excitation (normal rotation) the operation when channel 0 is selected is explained below. the output latch of m0 (also used as p2) rotates at the rising edge of the tff1 trigger pulse (that inverts the value of tff1) and is output to the port. the direction of shift is speci?d by p29fr 110 toshiba corporation TMP90CM38 (2) 4 phase 1-2 step excitation figures 3.8 (9) shows the output waveforms of 4-phase 1-2 step excitation when channel 0 is selected . figure 3.8 (9). output waveforms of 4-phase 1-2 step excitation (normal rotation and reverse rotation) 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 ?3 b7 b2 b6 b1 b5 b0 b4? the consecutive 3 bits are set to ??and other bits are set to ??(positive logic). for example, if b3, b7 and b2 are set to ??provided the ini- tial value becomes ?0001100? obtaining the waveforms as shown in figure 3.8 (9). to get an output waveform of negative logic, set values 1 s and 0 s of the initial value should be inverted. for example, to change the output waveform shown in figure 3.8 (9) into negative logic, change the initial value to ?11110011? the operation will be explained below for channel 0. the output latch of m0 (shared by p2) and the shifter alternate register (sa6) for stepping motor control 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 p29fr toshiba corporation 111 TMP90CM38 figure 3.8 (10). block diagram of 4-phase 1-2 step excitation (normal rotation) 112 toshiba corporation TMP90CM38 setting example: to drive channel 0 (m0) by 4-phase 1-2 step excitation (normal rotation) when timer 0 is selected, set each register as follows. 3.8.4 trigger signal from timer the trigger signal from the timer which is used by smc is not equal to the reverse trigger signal of each timer ?p-?p (tff1, tff3, tff4, and tff5) and differs as shown in table 3.8 (1) depending on the operation mode of the timer. note: to shift smc, tffcr toshiba corporation 113 TMP90CM38 3.8.5 application of smc and timer output as explained in 3.8.4 ?rigger signal from timer? the timing to shift smc and invert tff differs depending on the mode of timer. an application to operate smc while operating an 8-bit timer ppg mode will be explained below. to drive a stepping motor, in addition to the value of each phase (smc output), synchronizing signal is often required at the timing when excitation is changed over. in this application, noting this fact, port 6 is used as a stepping motor control port to output a synchronizing signal to the to1 pin (shared by p55). output waveforms of 4-phase 1-step excitation 114 toshiba corporation TMP90CM38 3.9 serial channels the tmp90cm36 contains three serial channels (sio0,1, 2).the three serial channels have the following operation modes. in mode 1 and mode 2, parity bit can be added. mode 3 has a wake-up function for making the master controller start slave controllers in serial link (multi-controller system). figure 3.9 (1) shows the data format (1 frame) for each mode. figure 3.9 (1). data formats toshiba corporation 115 TMP90CM38 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 commonly used for both transmission and receiving, the chan- nel becomes half-duplex. the receiving buffer 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. namely, the one buffer stores the already received data while the other buffer receives the next frame data. 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 transmission buffer and the cpu is requested to read the data, inttx or intrx interrupt occurs. besides, if an overrun error, parity error, or framing error occors during receiving operation, ?g sccr 116 toshiba corporation TMP90CM38 (1) serial channel (sio0) (3.8.4 ~ 3.8.6) 3.9.1 control registers the serial channel sio1 is controlled by 4 control registers scmod1, sccr1, brgcr1, and p7fr. transmitted and received data are stored in register scbuf1. figure 3.9 (2). serial channel mode register (scmod1) toshiba corporation 117 TMP90CM38 figure 3.9 (3). serial channel mode register (sccr1) figure 3.9 (4). serial transmission/receiving buffer registers (scbuf1) 118 toshiba corporation TMP90CM38 figure 3.9 (5). baud rate generator control registers (brgcr1) toshiba corporation 119 TMP90CM38 figure 3.9 (6). port 7 function register 120 toshiba corporation TMP90CM38 3.9.2 con?uration figure 3.9 (7) shows the block diagram of the serial channel. figure 3.9 (7). serial channel (sio1) block diagram toshiba corporation 121 TMP90CM38 baud rate generator baud rate generator comprises of a circuit that gener- ates transmission and receiving clocks that determine the transfer rate of the serial channel. the input clock to the baud rate generator, ?0 (fc/4), ?2 (fc/16), ?8 (fc/64), or ?32 (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 genorator control register brgcr1 122 toshiba corporation TMP90CM38 table 3.9 (2) selection of transfer rate (2) (when timer 0 (input clock ?1) is used)) unit: kbps fc 12.288 mhz 12 mhz 9.8304 mhz 8 mhz 6.144 mhz treg2 1h 96 76.8 62.5 48 2h 48 38.4 31.25 24 3h 32 31.25 16 4h 24 19.2 12 5h 19.2 9.6 8h 12 9.6 6 ah 9.6 4.8 10h 6 4.8 3 14h 4.8 2.4 how to calculate the transfer rate (when timer 2 is used0) input clock of timer 2 ?1 = fc/8 ?4 = fc/32 ?16 = fc/128 serial clock generation circuit this circuit generates the basic clock for transmitting and receiving data. 1) i/o interface mode when in sclk1 output mode with the setting of sccr1 toshiba corporation 123 TMP90CM38 when in sclk1 input mode with the setting of sccr1 124 toshiba corporation TMP90CM38 mission unit halts transmission, after completing the current data transmission, until the pin turns to the ?? level. at this time, the interrupt inttx is generated, to request the cpu to transfer data. then the data is writ- ten into the transmission buffer, and the transmission unit is placed in the standby until the cts pin turned to the ??level. when the received data are read by the cpu, the r ts pin returns to the ??level, requesting that the trans- mission is restarted. figure 3.9 (8). hand-shake function figure 3.9 (9). hand-shake cts (clear to send) signal toshiba corporation 125 TMP90CM38 3 transmission buffer transmission buffer scbuf1 shifts out and sends the transmission data written from the cpu from the least signi?ant bit (lsb) in order, using transmission shift clock txdsft1 which is generated by the transmission control. when all bits are shifted out, the transmission buffer becomes empty and generates inttx1 interrupt. parity control circuit when serial channel control register sccr1 126 toshiba corporation TMP90CM38 3.9.3 operational description (1) mode 0 (i/o interface mode) this mode is used to increase the number of i/o pins of tmp90cm36 for transmitting or receiving data to or from the external shifter register. this mode incudes sclk1 output mode to output synchronous clock sclk1 and sclk1 input mode to input external synchronous clock sclk1. figure 3.9 (10). i/o interface mode toshiba corporation 127 TMP90CM38 transmission in sclk1 output mode, 8-bit data and synchronous clock are output from txd1 pin and sclk1 pin, respectively, each time the cpu writes data in the transmission buffer. when all data is output, irf2 128 toshiba corporation TMP90CM38 receiving in sclk1 output mode, received data are read by the cpu, and synchronous clock is output from sclk1 pin and the next data are shifted in the receiving buffer 1 whenever the receive interrupt ?g irf2 toshiba corporation 129 TMP90CM38 (2) mode 1 (7-bit uart mode) the 7-bit mode can be set by setting serial channel mode register scmod1 130 toshiba corporation TMP90CM38 (3) mode 2 (8-bit uart mode) the 8-bit uart mode can be set by setting serial channel mode register scmod1 toshiba corporation 131 TMP90CM38 (4) mode 3 (9-bit uart mode) the 9-bit uart mode can be speci?d by setting scmod1 132 toshiba corporation TMP90CM38 protocol select the 9-bit uart mode for the master and slave controllers. set the scmod1 toshiba corporation 133 TMP90CM38 134 toshiba corporation TMP90CM38 3.9.4 con?uration the serial channels are connected to external circuits through three-pin serial ports: sclk2 (p76), txd2 (p77) and rxd2 (p75). figure 3.9 (16). block diagram of serial channels (sio2) toshiba corporation 135 TMP90CM38 serial clock sio2 pulses make the following selections through the serial channel mode register scmod2. clock source selection 136 toshiba corporation TMP90CM38 3.9.5 explanation of operations the send, receive and simultaneous send-receive modes for scmod2 toshiba corporation 137 TMP90CM38 figure 3.9 (17). chart of serial channel 0 send mode timing 138 toshiba corporation TMP90CM38 (2) receive mode setting the command register to receive mode, then setting serial serial transfer control scmod2 toshiba corporation 139 TMP90CM38 figure 3.9 (18) - 1. chart of serial channel ?send-receive mode (falling edge shift) timing 140 toshiba corporation TMP90CM38 figure 3.9 (18) - 2. chart of serial channel ?send-receive mode (falling edge shift) timing toshiba corporation 141 TMP90CM38 figure 3.9 (19) - 1. serial channel control register 142 toshiba corporation TMP90CM38 figure 3.9 (19) - 2. serial channel buffer registers toshiba corporation 143 TMP90CM38 3.10 analog/digital converter the TMP90CM38 contains a high-speed, high-accuracy ana- log/digital converter (a/d converter) with 8-channel analog input that features 8-bit sequential comparison. figure 3.10 (1) shows the block diagram of the a/d con- verter. 8-channel analog input pins (an7 to an0) are shared by input-only port p6 and so can be used as input port. figure 3.10 (1). block diagram of a/d converter 144 toshiba corporation TMP90CM38 3.10.1 control registers figure 3.10 (2). a/d conversion mode register (admod) toshiba corporation 145 TMP90CM38 figure 3.10 (3). a/d conversion result register (adreg0 ~ 3) figure 3.10 (4). a/d converter channel select register 146 toshiba corporation TMP90CM38 3.10. 2 operation (1) analog reference voltage high analog reference voltage is applied to the avcc pin, and the low analog voltage is applied to avss pin. the reference voltage between avcc and avss is divided by 256 using ladder resistance, and compared with the analog input voltage for a/d conversion. (2) analog input channels analog input channel is selected by admod toshiba corporation 147 TMP90CM38 148 toshiba corporation TMP90CM38 3.11 watchdog timer (looping detection timer) the purpose of the watchdog timer (wdt) is to detect the start of cpu misoperation due to noise, etc., and bring it back to normal. 3.11 .1 con?uration the TMP90CM38 multiplexes the watchdog timer output (wdtout ) and p80. p80 (output port) is switched to the wdtout pin and reset is returned inside the chip by setting bit wdmod toshiba corporation 149 TMP90CM38 the watchdog timer is a 22-stage binary counter that uses (fc/2) as the input clock. the binary counter outputs are 2 16 /fc, 2 18 /fc, 2 20 /fc and 2 22 /fc. one of these outputs is used for watchdog timer output wdtout . wdtout outputs ??to reset the peripheral devices when the watchdog timer over?ws. wdtout also is connected to reset inside the wdtout TMP90CM38. in this case, wdtout outputs ??in a 32/fxtal = 2.0 m sec (fxtal = 16mhz) cycle and simultaneously resets the TMP90CM38. 3.11.2 control registers the watchdog timer (wdt) is controlled by two control registers (wdmode and wdcr). (1) watchdog timer mode register (wdmod watchdog timer detection time setting (wdtp) this is a 2-bit ?g used to set the watchdog timer interrupt time for looping (runaway) detection. this ?g is initialized to wdmod 150 toshiba corporation TMP90CM38 figure 3.11 (2). flowchart of p80/wdtout pin switching toshiba corporation 151 TMP90CM38 figure 3.11 (3). watchdog timer mode register 152 toshiba corporation TMP90CM38 (2) watchdog timer control register (wdcr) this register enables and disables the watchdog timer, and clears the binary counter. disable control the watch timer is disabled by clearing wdmod toshiba corporation 153 TMP90CM38 3.11.3 operation the watchdog timer is a timer that outputs ??level from the watchdog timer output pin (wdtout ) after the detection time set with wdmod 154 toshiba corporation TMP90CM38 4. electrical characteristics TMP90CM38f/TMP90CM38t note: i dar is guaranteed for up to 8 optional ports. 4.1 maximum ratings symbol item rating unit v cc power supply voltage -0.5 ~ + 7 v v in input voltage -0.5 ~ v cc + 0.5 v ? iol output current (total) 100 ma ? ioh output current (total) -70 ma p d power dissipation (ta = 85 c) f 500 mw t 600 t solder soldering temperature (10s) 260 c t stg storage temperature -65 ~ 150 c t opr operating temperature -20 ~ 70 c 4.2 dc electrical characteristics v cc = 5v 10%, ta = -20 ~ 70 c (1 ~ 16mhz) typical values are for ta = 25 c, v cc = 5v. symbol item min max unit conditions v il input low voltage (p0) -0.3 0.8 v v il1 p1, p2, p3, p4 , p5, p5, p6, p7, p9, p10 -0.3 0.3v cc v v il2 reset , p81 (int0), p82 (stby ), nmi -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 low voltage (p0) 2.2 v cc + 0.3 v v ih1 reset , p81 (int0), p82 (stby ), nmi 0.7v cc v cc + 0.3 v v ih2 reset , p81 (int0), p82 (stby ) 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 v oh1 v oh2 output high voltage 2.4 0.75v cc 0.9v cc v v v i oh = -400 m a i oh = -100 m a i oh = -20 m a i dar darlington drive current (8 i/o 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 vin v cc i lo output leakage current 0.05 (typ) 10 m a 0.2 vin v cc - 0.2 i cc operating current (run) idle 35 (typ) 1.5 (typ) 50 5 ma ma t osc = 16mhz stop (ta = -20 ~ 70 c) stop (ta = 0 ~ 50 c) 0.2 (typ) 40 10 m a m a 0.2 vin v cc - 0.2 v stop power down voltage of (@stop) (ram back up) 2.0 6.0 v v il1 = 0.2vcc, v il2 = 0.8vcc r rst reset pull up register 50 150 k w cio pin capacitance 10 pf testfreq = 1mhz v th schmitt width (reset , p81, p82) 0.4 1.0 (typ) v toshiba corporation 155 TMP90CM38 ac measurement conditions output level: high 2.2v/low 0.8v,c l = 50pf - (however, cl = 100pf for ad0 ~ 7, a8 ~ 15, ale, rd , wr ) input level high 2.4v/low 0.45v (ad0 ~ ad7) high 0.8v cc /low 0.2v cc (excluding ad0 ~ ad7) 4.3 ac electrical characteristics v cc = 5v 10% ta = -20 ~ 70 c symbol item variable 12.5mhz clock 16mhz clock unit min max min max min max t osc oscillation cycle ( = x) 62.5 1000 80 62.5 ns t al a0 ~ a7 effective address ? ale fall 0.5x - 15 25 16 ns t la ale fall ? a0 ~ a7 hold 0.5x - 15 25 16 ns t ll ale pulse width x - 40 40 23 ns t lc ale fall ? rd /wr fall 0.5x - 30 10 1 ns t cl rd /wr rise ? ale rise 0.5x - 20 20 11 ns t acl a0 ~ a7 effective address ? rd /wr fall x - 25 55 38 ns t ach upper effective address ? rd /wr fall 1.5x - 50 70 44 ns t ca rd /wr fall ? upper address hold 0.5x - 20 20 11 ns t adl a0 ~ a7 effective address ? effective data input 3.0x - 35 205 153 ns t adh upper effective address ? effective data input 3.5x - 55 225 164 ns t rd rd fall ? effective data input 2.0x - 50 110 75 ns t rr rd pulse width 2.0x - 40 120 85 ns t hr rd rise ? data hold 0 0 0 ns t rae rd rise ? address enable x - 15 65 48 ns t ww wr pulse width 2.0x - 40 120 85 ns t dw effective data ? wr rise 2.0x - 50 100 65 ns t wd wr rise ? effective data hold 0.5x - 10 30 21 ns 156 toshiba corporation TMP90CM38 4.4 a/d conversion characteristics v cc = 5v 10% ta = -20 ~ 70 c f = 1 ~ 16mhz symbol item min typ max unit avcc analog reference voltage vcc - 1.5 vcc vcc v a gnd analog reference voltage vss vss vss v ain analog input voltage range vss vcc i ref analog reference voltage power supply current 0.5 1.0 ma error (quantize error of 0.5 lsb not included) total error (ta = 25 c, vcc = v ref = 5.0v) 1.0 lsb total error 2.5 4.5 timer/counter input clock (ti2, ti4) v cc = 5v 10% ta = -20 ~ 70 c f = 1 ~ 16mhz symbol item variable 12.5mhz clock 16mhz clock unit min max min max min max t vck clock cycle 8x + 100 740 600 ns t vckl low clock pulse width 4x + 40 360 290 ns t vckh high clock pulse width 4x + 40 360 290 ns 4.6 interrupt operation v cc = 5v 10% ta = -20 ~ 70 c f = 1 ~ 16mhz symbol item variable 12.5mhz clock 16mhz clock unit min max min max min max t intal int0 low level pulse width 4x 320 250 ns t intah int0 high level pulse width 4x 320 250 ns t intbl int1, int2 low level pulse width 8x + 100 740 600 ns t intbh int1, int2 high level pulse width 8x + 100 740 600 ns toshiba corporation 157 TMP90CM38 (2) sclk1 output mode 4.7 serial channel sio1 timing - i/o interface mode (1) sclk1 input mode v cc = 5v 10% ta = -20 ~ 70 c f = 1 ~ 16mhz symbol item variable 12.5mhz clock 16mhz clock unit min max min max min max t scy sclk1 cycle 16x 1.28 1 m s t oss output data ? rising edge of sclk t scy /2 - 5x - 50 190 137 ns t ohs sclk1 rising edge ? output data hold 5x - 100 300 212 ns t hsr sclk1 rising edge ? input data hold 0 0? ns t srd sclk1 rising edge ? effective data input t scy - 5x - 100 780 587 ns symbol item variable 12.5mhz clock 16mhz clock unit min max min max min max t scy sclk cycle (programmable) 16x 8192x 1.28 655.4 1 512 m s t oss output data setup ? sclk rising edge t scy - 2x - 50 970 725 ns t ohs sclk rising edge ? output data hold 2x - 80 80 45 ns t hsr sclk rising edge ? input data hold 0 0? ns t srd sclk rising edge ? effective data input t scy - 2x - 150 970 725 ns 158 toshiba corporation TMP90CM38 4.8 serial channel sio2 timing symbol item condition 10mhz clock variableclock unit min max min max t scr serial port clock cycle time internal 800 12800 8x 128x ns external 1600 16x t scl sclk2 low width internal **** ns external **** t sch sclk2 high width internal **** ns external **** t skdo sclk2 ? txd2 (output data) delay time internal *? ns external *? t srd sclk2 rising edge to input data valid internal *? ns external *? t hsr input data hold after sclk2 rising edge internal *? ns external *? toshiba corporation 159 TMP90CM38 4.9 timing chart 160 toshiba corporation TMP90CM38 4.10 serial channel sio1 i/o interface mode timing chart 4.11 serial channel sio2 timing chart toshiba corporation 161 TMP90CM38 5. special function register list the special function registers (sfr) are the input/output ports, peripheral control registers. these sfr are assigned to 96- byte address areas from 0ffa0h ~ 0ffffh. (1) input/output port (2) input/output port control (3) timer/event counter control (4) a/d converter control (5) interrupt control (6) hdma control (7) wdt control (8) serial channel control (9) time base counter control (10) timing pulse generation control (11) capture control (12) d/a converter (13) pwm control 162 toshiba corporation TMP90CM38 tmp90cm36 special function register list toshiba corporation 163 TMP90CM38 (1) i/o port 164 toshiba corporation TMP90CM38 (2) i/o port control (1/2) toshiba corporation 165 TMP90CM38 (2) i/o port control (2/2) 166 toshiba corporation TMP90CM38 (3) timer/event counter control (1/3) toshiba corporation 167 TMP90CM38 (3) timer/event counter control (2/3) 168 toshiba corporation TMP90CM38 (3) timer/event counter control (3/3) toshiba corporation 169 TMP90CM38 (4) a/d converter control 170 toshiba corporation TMP90CM38 (5) interrupt control toshiba corporation 171 TMP90CM38 (6) hda control (7) wdt control 172 toshiba corporation TMP90CM38 (8) serial channel control |
Price & Availability of TMP90CM38
![]() |
|
|
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] |