![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
8 bit microcontroller tlcs-870/c1 series tmp89fw20a
? 2012 toshiba corporation all rights reserved revision history date revision comment 2012/5/18 1 first release table of contents tmp89fw20a 1.1 features......................................................................................................................................1 1.2 pin assignment..........................................................................................................................4 1.3 block diagram........................................................................................................................... 5 1.4 pin names and functions..........................................................................................................6 2. cpu core 2.1 configuration........................................................................................................................... 11 2.2 memory space......................................................................................................................... 11 2.2.1 code area........................................................................................................................................................................... 11 2.2.1.1 ram 2.2.1.2 bootrom 2.2.1.3 flash 2.2.2 data area............................................................................................................................................................................ 15 2.2.2.1 sfr 2.2.2.2 ram 2.2.2.3 bootrom 2.2.2.4 flash 2.3 system clock controller........................................................................................................... 17 2.3.1 configuration..................................................................................................................................................................... 17 2.3.2 control............................................................................................................................................................................... 17 2.3.3 functions............................................................................................................................................................................ 20 2.3.3.1 clock generator 2.3.3.2 clock gear 2.3.3.3 timing generator 2.3.4 warm-up counter ............................................................................................................................................................... 27 2.3.4.1 warm-up counter operation when the oscillation is enabled by the hardware 2.3.4.2 warm-up counter operation when the oscillation is enabled by the software 2.3.5 operation mode control circuit......................................................................................................................................... 29 2.3.5.1 single-clock mode 2.3.5.2 dual-clock mode 2.3.5.3 stop mode 2.3.5.4 transition of operation modes 2.3.6 operation mode control................................................................................................................................................... 35 2.3.6.1 stop mode 2.3.6.2 idle1/2 and sleep1 modes 2.3.6.3 idle0 and sleep0 modes 2.3.6.4 slow mode 2.4 reset control circuit............................................................................................................... 47 2.4.1 configuration..................................................................................................................................................................... 47 2.4.2 control............................................................................................................................................................................... 47 2.4.3 functions............................................................................................................................................................................ 49 2.4.4 reset signal enerating factors....................................................................................................................................... 51 2.4.4.1 power-on reset 2.4.4.2 external reset input (reset pin input) 2.4.4.3 voltage detection reset 2.4.4.4 watchdog timer reset 2.4.4.5 system clock reset 2.4.4.6 internal factor reset detection status register 2.4.4.7 how to use the external reset input pin as a port i 3. interrupt control circuit 3.1 configuration........................................................................................................................... 57 3.2 interrupt latches ( il30 to il3)............................................................................................... 58 3.3 interrupt enable register ( eir).............................................................................................. 59 3.3.1 interrupt master enable flag ( imf)................................................................................................................................... 59 3.3.2 individual interrupt enable flags (ef30 to ef4) .............................................................................................................. 59 3.4 maskable interrupt priority change function........................................................................ 62 3.5 interrupt sequence................................................................................................................... 64 3.5.1 initial setting..................................................................................................................................................................... 64 3.5.2 interrupt acceptance processing........................................................................................................................................ 64 3.5.3 saving/restoring general-purpose registers ....................................................................................................................... 66 3.5.3.1 using push and pop instructions 3.5.3.2 using data transfer instructions 3.5.3.3 using a register bank to save/restore general-purpose registers 3.5.4 interrupt return ...................................................................................................................................................................68 3.6 software interrupt ( intsw)................................................................................................... 69 3.6.1 address error detection..................................................................................................................................................... 69 3.6.2 debugging..........................................................................................................................................................................69 3.7 undefined instruction interrupt ( intundef)....................................................................... 69 4. external interrupt control circuit 4.1 configuration........................................................................................................................... 71 4.2 control..................................................................................................................................... 71 4.3 function................................................................................................................................... 75 4.3.1 low power consumption function.................................................................................................................................... 76 4.3.2 external interrupt 0 ............................................................................................................................................................ 76 4.3.3 external interrupts 1/2/3.................................................................................................................................................... 77 4.3.3.1 interrupt request signal generating condition detection function 4.3.3.2 a noise canceller pass signal monitoring function when interrupt request signals are generated 4.3.3.3 noise cancel time selection function 4.3.4 external interrupt 4............................................................................................................................................................78 4.3.4.1 interrupt request signal generating condition detection function 4.3.4.2 a noise canceller pass signal monitoring function when interrupt request signals are generated 4.3.4.3 noise cancel time selection function 4.3.5 external interrupt 5............................................................................................................................................................80 5. watchdog timer ( wdt) 5.1 configuration........................................................................................................................... 81 5.2 control..................................................................................................................................... 82 5.3 functions.................................................................................................................................. 84 5.3.1 setting of enabling/disabling the watchdog timer operation............................................................................................ 84 5.3.2 setting the clear time of the 8-bit up counter................................................................................................................... 84 5.3.3 setting the overflow time of the 8-bit up counter............................................................................................................ 85 5.3.4 setting an overflow detection signal of the 8-bit up counter...........................................................................................85 5.3.5 writing the watchdog timer control codes....................................................................................................................... 86 5.3.6 reading the 8-bit up counter.............................................................................................................................................86 5.3.7 reading the watchdog timer status................................................................................................................................... 86 6. power-on reset circuit 6.1 configuration........................................................................................................................... 89 ii 6.2 function................................................................................................................................... 89 7. voltage detection circuit 7.1 configuration........................................................................................................................... 91 7.2 control..................................................................................................................................... 92 7.3 function................................................................................................................................... 93 7.3.1 enabling/disabling the voltage detection operation.......................................................................................................... 93 7.3.2 selecting the voltage detection operation mode ............................................................................................................... 93 7.3.3 selecting the detection voltage level................................................................................................................................ 94 7.3.4 voltage detection flag and voltage detection status flag.................................................................................................. 94 7.4 register settings...................................................................................................................... 96 7.4.1 setting procedure when the operation mode is set to generate intvltd interrupt request signals............................. 96 7.4.2 setting procedure when the operation mode is set to generate voltage detection reset signals..................................... 96 7.5 caution in the using voltage detevtion circuit........................................................................ 97 8. io ports 8.1 i/o port control registers.....................................................................................................101 8.2 list of i/o port settings........................................................................................................ 102 8.3 i/o port registers.................................................................................................................. 105 8.3.1 port p0 ( p03 ~ p00) ....................................................................................................................................................... 105 8.3.2 p1 ( p13 ~ p10) ............................................................................................................................................................... 109 8.3.3 port p2 ( p25 ~ p20)........................................................................................................................................................ 113 8.3.4 port p4 ( p47 ~ p40)........................................................................................................................................................ 118 8.3.5 port p5 ( p57 ~ p50)........................................................................................................................................................ 121 8.3.6 port p6 ( p67 ~ p60) ....................................................................................................................................................... 124 8.3.7 port p7 ( p77 ~ p70)........................................................................................................................................................ 126 8.3.8 port p9 ( p97 ~ p90)........................................................................................................................................................ 128 8.4 peripheral input/output select function................................................................................. 130 9. special function registers 9.1 sfr1 ( 0x00000 to 0x0003f).................................................................................................135 9.2 sfr2 ( 0x00f00 to 0x00fff)................................................................................................ 136 9.3 sfr3 ( 0x00e40 to 0x00eff)................................................................................................ 138 10. low power consumption function for peripherals 10.1 control................................................................................................................................. 142 11. divider output ( dvo) 11.1 configuration....................................................................................................................... 145 11.2 control ................................................................................................................................. 146 11.3 function............................................................................................................................... 147 iii 12. time base timer (tbt) 12.1 time base timer................................................................................................................. 149 12.1.1 configuration................................................................................................................................................................. 149 12.1.2 control........................................................................................................................................................................... 149 12.1.3 functions........................................................................................................................................................................ 150 13. 16-bit timer counter ( tca) 13.1 configuration....................................................................................................................... 154 13.2 control................................................................................................................................. 155 13.3 low power consumption function.................................................................................... 160 13.4 timer function.................................................................................................................... 161 13.4.1 timer mode.................................................................................................................................................................... 161 13.4.1.1 setting 13.4.1.2 operation 13.4.1.3 auto capture 13.4.1.4 register buffer configuration 13.4.2 external trigger timer mode.......................................................................................................................................... 165 13.4.2.1 setting 13.4.2.2 operation 13.4.2.3 auto capture 13.4.2.4 register buffer configuration 13.4.3 event counter mode....................................................................................................................................................... 167 13.4.3.1 setting 13.4.3.2 operation 13.4.3.3 auto capture 13.4.3.4 register buffer configuration 13.4.4 window mode................................................................................................................................................................ 169 13.4.4.1 setting 13.4.4.2 operation 13.4.4.3 auto capture 13.4.4.4 register buffer configuration 13.4.5 pulse width measurement mode.................................................................................................................................... 171 13.4.5.1 setting 13.4.5.2 operation 13.4.5.3 capture process 13.4.6 programmable pulse generate ( ppg) mode.................................................................................................................. 174 13.4.6.1 setting 13.4.6.2 operation 13.4.6.3 register buffer configuration 13.5 noise canceller................................................................................................................... 177 13.5.1 setting............................................................................................................................................................................ 177 14. 16-bit timer counter ( tcb) 14.1 configuration....................................................................................................................... 180 14.2 control................................................................................................................................. 181 14.3 low power consumption function.................................................................................... 185 14.4 timer function.................................................................................................................... 186 14.4.1 timer mode.................................................................................................................................................................... 186 14.4.1.1 setting 14.4.1.2 operation 14.4.1.3 auto capture 14.4.1.4 register buffer configuration 14.4.2 external trigger timer mode.......................................................................................................................................... 190 14.4.2.1 setting 14.4.2.2 operation 14.4.2.3 auto capture 14.4.2.4 register buffer configuration iv 14.4.3 event counter mode....................................................................................................................................................... 192 14.4.3.1 setting 14.4.3.2 operation 14.4.3.3 auto capture 14.4.3.4 register buffer configuration 14.4.4 window mode................................................................................................................................................................ 194 14.4.4.1 setting 14.4.4.2 operation 14.4.4.3 auto capture 14.4.4.4 register buffer configuration 14.4.5 pulse width measurement mode....................................................................................................................................196 14.4.5.1 setting 14.4.5.2 operation 14.4.5.3 capture process 14.4.6 programmable pulse generate ( ppg) mode..................................................................................................................199 14.4.6.1 setting 14.4.6.2 operation 14.4.6.3 register buffer configuration 14.5 noise canceller................................................................................................................... 202 14.5.1 setting............................................................................................................................................................................202 15. 10-bit timer/counter ( tcc) 15.1 configuration....................................................................................................................... 204 15.2 control................................................................................................................................. 205 15.3 low power consumption function.................................................................................... 211 15.4 configuring control and data registers............................................................................. 212 15.5 features ................................................................................................................................ 214 15.5.1 programmable pulse generator output ( ppg output)....................................................................................................214 15.5.1.1 50% duty mode 15.5.1.2 variable duty mode 15.5.1.3 ppgc01/ppgc02 independent mode 15.5.2 starting a count.............................................................................................................................................................. 218 15.5.2.1 command start and capture mode(tc0cr2 16. 8-bit timer counter ( tc0) 16.1 configuration....................................................................................................................... 236 16.2 control................................................................................................................................. 237 16.2.1 timer counter 00 ........................................................................................................................................................... 237 16.2.2 timer counter 01 ........................................................................................................................................................... 239 16.2.3 common to timer counters 00 and 01 .......................................................................................................................... 241 16.2.4 operation modes and usable source clocks.................................................................................................................. 243 16.3 low power consumption function.................................................................................... 244 16.4 functions.............................................................................................................................. 245 16.4.1 8-bit timer mode............................................................................................................................................................ 245 16.4.1.1 setting 16.4.1.2 operation 16.4.1.3 double buffer 16.4.2 8-bit event counter mode............................................................................................................................................... 248 16.4.2.1 setting 16.4.2.2 operation 16.4.2.3 double buffer 16.4.3 8-bit pulse width modulation ( pwm) output mode..................................................................................................... 250 16.4.3.1 setting 16.4.3.2 operations 16.4.3.3 double buffer 16.4.4 8-bit programmable pulse generate ( ppg) output mode.............................................................................................. 255 16.4.4.1 setting 16.4.4.2 operation 16.4.4.3 double buffer 16.4.5 16-bit timer mode.......................................................................................................................................................... 259 16.4.5.1 setting 16.4.5.2 operations 16.4.5.3 double buffer 16.4.6 16-bit event counter mode............................................................................................................................................. 263 16.4.6.1 setting 16.4.6.2 operations 16.4.6.3 double buffer 16.4.7 12-bit pulse width modulation ( pwm) output mode................................................................................................... 265 16.4.7.1 setting 16.4.7.2 operations 16.4.7.3 double buffer 16.4.8 16-bit programmable pulse generate ( ppg) output mode............................................................................................ 271 16.4.8.1 setting 16.4.8.2 operations 16.4.8.3 double buffer 17. real time clock ( rtc) 17.1 configuration....................................................................................................................... 275 17.2 control................................................................................................................................. 275 17.3 function............................................................................................................................... 276 17.3.1 low power consumption function .............................................................................................................................. 276 17.3.2 enabling/disabling the real time clock operation......................................................................................................... 276 17.3.3 selecting the interrupt generation interval.................................................................................................................... 276 17.4 real time clock operation................................................................................................ 277 17.4.1 enabling the real time clock operation......................................................................................................................... 277 17.4.2 disabling the real time clock operation........................................................................................................................ 277 18. asynchronous serial interface ( uart) 18.1 configuration....................................................................................................................... 280 18.2 control................................................................................................................................. 281 vi 18.3 low power consumption function.................................................................................... 285 18.4 protection to prevent uart0cr1 and uart0cr2 registers from being changed .... 286 18.5 activation of stop, idle0 or sleep0 mode..................................................................287 18.5.1 transition of register status........................................................................................................................................... 287 18.5.2 transition of txd pin status........................................................................................................................................ 287 18.6 transfer data format.......................................................................................................... 288 18.7 infrared data format transfer mode..................................................................................288 18.8 transfer baud rate..............................................................................................................289 18.8.1 transfer baud rate calculation method.......................................................................................................................... 290 18.8.1.1 bit width adjustment using uart0cr2 20. serial bus interface ( sbi) 20.1 communication format....................................................................................................... 332 20.1.1 i2c bus........................................................................................................................................................................... 332 20.1.2 free data format............................................................................................................................................................. 333 20.2 configuration....................................................................................................................... 334 20.3 control................................................................................................................................. 335 20.4 functions.............................................................................................................................. 338 20.4.1 low power consumption function .............................................................................................................................. 338 20.4.2 selecting the slave address match detection and the general call detection.................................................... 338 20.4.3 selecting the number of clocks for data transfer and selecting the acknowledgement or non-acknowledgment mode ....................................................................................................................................................................................... 338 20.4.3.1 number of clocks for data transfer 20.4.3.2 output of an acknowledge signal 20.4.4 serial clock....................................................................................................................................................................340 20.4.4.1 clock source 20.4.4.2 clock synchronization 20.4.5 master/slave selection.................................................................................................................................................... 342 20.4.6 transmitter/receiver selection....................................................................................................................................... 342 20.4.7 start/stop condition generation ...................................................................................................................................... 343 20.4.8 interrupt service request and release.............................................................................................................................343 20.4.9 setting of serial bus interface mode............................................................................................................................. 344 20.4.10 software reset.............................................................................................................................................................. 344 20.4.11 arbitration lost detection monitor...............................................................................................................................344 20.4.12 slave address match detection monitor...................................................................................................................... 346 20.4.13 general call detection monitor......................................................................................................................... 346 20.4.14 last received bit monitor............................................................................................................................................ 347 20.4.15 slave address and address recognition mode specification........................................................................................ 347 20.5 data transfer of i2c bus.................................................................................................... 348 20.5.1 device initialization.......................................................................................................................................................348 20.5.2 start condition and slave address generation................................................................................................................348 20.5.3 1-word data transfer....................................................................................................................................................... 349 20.5.3.1 when sbi0sr2 22.7 precautions about the ad converter.................................................................................. 370 22.7.1 analog input pin voltage range..................................................................................................................................... 370 22.7.2 analog input pins used as input/output ports ............................................................................................................... 370 22.7.3 noise countermeasure.................................................................................................................................................... 370 23. lcd driver 23.1 configuration....................................................................................................................... 372 23.2 control................................................................................................................................. 373 23.3 low power consumption function.................................................................................... 376 23.4 functions.............................................................................................................................. 377 23.4.1 lcd display control ( lcdcr1 24.5.4 . bterasechip................................................................................................................................................................. 431 24.5.5 .btgetsp.......................................................................................................................................................................431 24.5.6 .btsetsp ........................................................................................................................................................................431 24.5.7 . bterssp........................................................................................................................................................................ 432 24.5.8 .btconvadr ..................................................................................................................................................................432 24.5.9 . btcalcuart............................................................................................................................................................... 433 24.5.10 . btupdsd................................................................................................................................................................... 434 25. shadow ram 25.1 configuration....................................................................................................................... 437 25.2 control................................................................................................................................. 438 25.3 memory map....................................................................................................................... 440 25.4 functions.............................................................................................................................. 441 25.4.1 copying the flash memory........................................................................................................................................... 441 25.4.2 powering off the flash memory ( sdwcr1 26.12.2.2 enabling or disabling security program 26.12.3 option codes ................................................................................................................................................................ 484 26.12.4 recommended settings................................................................................................................................................ 486 26.13 flowchart........................................................................................................................... 487 26.14 ac characteristics ( uart) .............................................................................................. 488 26.14.1 reset timing................................................................................................................................................................. 490 26.14.2 flash memory erase command ( 0xf0)........................................................................................................................ 490 26.14.3 flash memory write command (0x30) ........................................................................................................................ 491 26.14.4 flash memory read command (0x40) ......................................................................................................................... 491 26.14.5 ram loader command (0x60) .................................................................................................................................... 492 26.14.6 flash memory sum output command (0x90) ............................................................................................................ 492 26.14.7 product id code output command (0xc0)..................................................................................................................492 26.14.8 flash memory status output command (0xc3) ........................................................................................................... 493 26.14.9 flash memory security setting command ( 0xfa)...................................................................................................... 493 26.14.10 clock change command ( 0xa0)............................................................................................................................... 493 26.15 ac characteristics ( sio)................................................................................................... 494 26.15.1 sio transfer timing...................................................................................................................................................... 496 26.15.2 reset timing................................................................................................................................................................. 496 26.15.3 flash memory erase command ( 0xf0)........................................................................................................................ 497 26.15.4 flash memory write command (0x30) ........................................................................................................................ 498 26.15.5 flash memory read command (0x40) ......................................................................................................................... 499 26.15.6 ram loader command (0x60) .................................................................................................................................. 500 26.15.7 flash memory sum output command (0x90) ............................................................................................................ 501 26.15.8 product id code output command (0xc0)..................................................................................................................501 26.15.9 flash memory status output command (0xc3) ........................................................................................................... 501 26.15.10 flash memory security setting command ( 0xfa).................................................................................................... 502 27. on-chip debug function ( ocd) 27.1 features................................................................................................................................ 503 27.2 control pins......................................................................................................................... 503 27.3 how to connect the on-chip debug emulator to a target system ...................................505 27.4 security................................................................................................................................ 505 28. input/output circuit 28.1 control pins......................................................................................................................... 507 29. electrical characteristics 29.1 absolute maximum ratings................................................................................................ 509 29.2 operating conditions........................................................................................................... 510 29.2.1 mcu mode (flash programming or erasing)............................................................................................................... 510 29.2.2 mcu mode ( except flash programming or erasing)................................................................................................... 511 29.2.3 serial prom mode....................................................................................................................................................... 512 29.3 dc characteristics .............................................................................................................. 513 29.4 ad conversion characteristics .......................................................................................... 515 29.5 power-on reset circuit characteristics.............................................................................. 516 29.6 voltage detecting circuit characteristics........................................................................... 517 29.7 16-bit timer counter(tcb) characteristics....................................................................... 518 29.8 lcd characteristics............................................................................................................ 518 29.9 ac characteristics............................................................................................................... 519 29.9.1 mcu mode (flash programming or erasing)............................................................................................................... 519 29.9.2 mcu mode ( except flash programming or erasing)................................................................................................... 519 29.9.3 serial prom mode....................................................................................................................................................... 520 xi 29.10 flash characteristics ......................................................................................................... 520 29.10.1 write characteristics.. ..................................................................................................................................................520 29.11 recommended oscillating condition ...............................................................................521 29.12 handling precaution ..........................................................................................................522 30. package dimensions xii cmos 8-bit microcontroller tmp89fw20a the tmp89fw20a is a single-chip 8-bit high-speed and high-functionality microcomputer incorporating 126976 bytes of flash memory. product no. rom (flash) ram package emulation chip TMP89FW20AUG 126976 bytes 3072 bytes lqfp64-p-1010-0.50e - 1.1 features 1. 8-bit single chip microcomputer tlcs-870/c1 series - instruction execution time : 62.5 ns (at 16 mhz) 122 s (at 32.768 khz) - 133 types & 732 basic instructions 2. 30 interrupt sources (external : 5 internal : 25 , except reset) 3. input / output ports (52 pins) - large current output: 7 pins (typ. 10ma) 4. input ports (1) 5. watchdog timer - interrupt or reset can be selected by the program. 6. power-on reset circuit 7. voltage detection circuit 8. divider output function 9. time base timer 10. 16-bit timer counter (tca) : 1 ch - timer, external trigger, event counter, window, pulse width measurement, ppg output modes 11. 16-bit timer counter (tcb) : 1 ch - timer, external trigger, event counter, window, pulse width measurement, ppg output modes 12. 10-bit timer counter (tcc) : 1 ch (2 output pins) - 2ports output ppg (programmed pulse generator) - variable duty output mode - 50%duty output mode - external-triggered start and stop tmp89fw20a page 1 2012/5/18 ra000 - emargency stop pin 13. 8-bit timer counter (tc0) : 4 ch - timer, event counter, pwm, ppg output modes - usable as a 16-bit timer, 12-bit pwm output and 16-bit ppg output by the cascade connection of two channels. 14. real time clock 15. uart : 3ch 16. sio : 1ch note : two sio channels can be used at the same time. 17. i 2 c/sio : 1ch 18. key-on wake-up : 3 ch 19. 10-bit successive approximation type ad converter - analog input : 8ch 20. lcd driver / controller - lcd direct drive capability (32 seg 4 com) - 1/4, 1/3, 1/2 duties or static drive are programmably selectable - internal bleeder resistance for lcd bias voltage (usable as an external bleeder resistance by exter- nal bleeder resistance connection pins) 21. shadow ram 22. on-chip debug function - break/event - trace - ram monitor - flash memory writing 23. internal high-frequency clock oscillation circuit (typ. 10 mhz) system clock is started by internal high frequency after reset. 24. clock operation mode control circuit : 2 circuit single clock mode / dual clock mode 25. low power consumption operation (8 mode) - stop mode: oscillation stops. (battery/capacitor back-up.) - slow1 mode: low power consumption operation using low-frequency clock.(high-frequency clock stop.) - slow2 mode: low power consumption operation using low-frequency clock.(high-frequency clock oscillate.) - idle0 mode: cpu stops, and only the time-based-timer(tbt) on peripherals operate using high frequency clock. released when the reference time set to tbt has elapsed. - idle1 mode: tmp89fw20a 1.1 features page 2 2012/5/18 ra000 the cpu stops, and peripherals operate using high frequency clock. release by interruputs(cpu re- starts). - idle2 mode: cpu stops and peripherals operate using high and low frequency clock. release by interruputs. (cpu restarts). - sleep0 mode: cpu stops, and only the time-based-timer(tbt) on peripherals operate using low frequency clock. released when the reference time set to tbt has elapsed. - sleep1 mode: cpu stops, and peripherals operate using low frequency clock. release by interruput.(cpu restarts). 26. wide operation voltage: 2.7 v to 5.5 v at 16mhz /32.768 khz 1.8 v to 5.5 v at 8 mhz /32.768 khz tmp89fw20a page 3 2012/5/18 ra000 1.2 pin assignment p73 (seg4) p72 (seg5) p71 (seg6) p70 (seg7) p67 (seg8) p66 (seg9) p65 (seg10) p64 (seg11) p63 (seg12) p62 (seg13) p61 (seg14) p60 (seg15) p57 (seg16) p56 (seg17) p55 (seg18) p54 (seg19/sclk0/int3) (seg3) p74 p53 (seg20/si0/rxd0/int2) (seg2) p75 p52 (seg21/so0/txd0/int1) (seg1) p76 p51 (seg22/rxd1/rxd0) (seg0) p77 p50 (seg23/txd1/txd0) com0 p25 (seg24/si1) com1 p24 (seg25/so1/scl0) com2 p23 (seg26/sclk1/sda0) com3 p22 (seg27/sclk0/tcb0/ ppgb0) (rxd2/tca0/tcc0) p90 p21 (seg28/rxd0/si0/ocdio) (txd2/ ppga0/ ppgc01) p91 p20 (seg29/txd0/so0/ocdck) (txd1/ ppgc02) p92 p13 (seg30/lv1) (rxd1/ emg0) p93 p12 (seg31/lv2) (int1/ pwm00/ ppg00/tc00) p94 vlc (int2/ pwm01/ ppg01/tc01) p95 p47 (ain7/ stop/ int5) ( dvo/ pwm02/ ppg02/tc02) p96 p46 (ain6/kwi2) (int3/ pwm03/ ppg03/tc03) p97 p45 (ain5/kwi1/rxd2) vdd (xin) p00 vss (xout) p01 ( reset) p10 (xtin) p02 (xtout) p03 mode avss avdd varef (ain0) p40 (tcb0/ain1) p41 ( ppgb0/ain2) p42 ( int0/ain3) p43 (txd2/kwi0/ain4) p44 figure 1-1 pin assignment tmp89fw20a 1.2 pin assignment page 4 2012/5/18 ra000 1.3 block diagram figure 1-2 block diagram tmp89fw20a page 5 2012/5/18 ra000 1.4 pin names and functions the tmp89fw20a has mcu mode, parallel prom mode, and serial prom mode. table 1-1 shows the pin func- tions in mcu mode. the serial prom mode is explained later in a separate chapter. table 1-1 pin names and functions (1/5) pin name input/output functions p03 xtout io o port03 low frequency osc output p02 xtin io i port02 low frequency osc input p01 xout io o port01 high frequency osc output p00 xin io i port00 high frequency osc input p13 seg30 lv1 io o i port13 lcd segment output 30 external bleeder resistance connection pins. p12 seg31 lv2 io o i port12 lcd segment output 31 external bleeder resistance connection pins. p10 reset io i port10 reset signal input p25 seg24 si1 io o i port25 lcd segment output 24 serial data input 1 p24 seg25 so1 scl0 io o o io port24 lcd segment output 25 serial data output 1 i2c bus clock input/output 0 p23 seg26 sclk1 sda0 io o io io port23 lcd segment output 26 serial clock input/output 1 i2c bus data input/output 0 p22 seg27 sclk0 tcb0 ppgb0 io o io i o port22 lcd segment output 27 serial clock input/output 0 tcb0 input ppgb0 output p21 seg28 rxd0 si0 ocdio io o i i io port21 lcd segment output 28 uart data input 0 serial data input 0 ocd data input/output tmp89fw20a 1.4 pin names and functions page 6 2012/5/18 ra000 table 1-2 pin names and functions (2/5) pin name input/output functions p20 seg29 txd0 so0 ocdck io o o o i port20 lcd segment output 29 uart data output 0 serial data output 0 ocd clock input p47 ain7 stop int5 io i i i port47 analog input 7 stop mode release input external interrupt 5 input p46 ain6 kwi2 io i i port46 analog input 6 key-on wake-up input 2 p45 ain5 kwi1 rxd2 io i i i port45 analog input 5 key-on wake-up input 1 uart data input 2 p44 ain4 kwi0 txd2 io i i o port44 analog input 4 key-on wake-up input 0 uart data output 2 p43 ain3 int0 io i i port43 analog input 3 external interrupt 0 input p42 ain2 ppgb0 io i o port42 analog input 2 ppgb0 output p41 ain1 tcb0 io i i port41 analog input 1 tcb0 input p40 ain0 io i port40 analog input 0 p57 seg16 io o port57 lcd segment output 16 p56 seg17 io o port56 lcd segment output 17 p55 seg18 io o port55 lcd segment output 18 p54 seg19 sclk0 int3 io o io i port54 lcd segment output 19 serial clock input/output 0 external interrupt 3 input tmp89fw20a page 7 2012/5/18 ra000 table 1-2 pin names and functions (3/5) pin name input/output functions p53 seg20 si0 rxd0 int2 io o i i i port53 lcd segment output 20 serial data input 0 uart data input 0 external interrupt 2 input p52 seg21 so0 txd0 int1 io o o o i port52 lcd segment output 21 serial data output 0 uart data output 0 external interrupt 1 input p51 seg22 rxd1 rxd0 io o i i port51 lcd segment output 22 uart data input 1 uart data input 0 p50 seg23 txd1 txd0 io o o o port50 lcd segment output 23 uart data output 1 uart data output 0 p67 seg8 io o port67 lcd segment output 8 p66 seg9 io o port66 lcd segment output 9 p65 seg10 io o port65 lcd segment output 10 p64 seg11 io o port64 lcd segment output 11 p63 seg12 io o port63 lcd segment output 12 p62 seg13 io o port62 lcd segment output 13 p61 seg14 io o port61 lcd segment output 14 p60 seg15 io o port60 lcd segment output 15 p77 seg0 io o port77 lcd segment output 0 p76 seg1 io o port76 lcd segment output 1 p75 seg2 io o port75 lcd segment output 2 p74 seg3 io o port74 lcd segment output 3 p73 seg4 io o port73 lcd segment output 4 tmp89fw20a 1.4 pin names and functions page 8 2012/5/18 ra000 table 1-2 pin names and functions (4/5) pin name input/output functions p72 seg5 io o port72 lcd segment output 5 p71 seg6 io o port71 lcd segment output 6 p70 seg7 io o port70 lcd segment output 7 p97 tc03 ppg03 pwm03 int3 io i o o i port97 tc03 input ppg03 output pwm03 output external interrupt 3 input p96 tc02 ppg02 pwm02 dvo io i o o o port96 tc02 input ppg02 output pwm02 output divider output p95 tc01 ppg01 pwm01 int2 io i o o i port95 tc01 input ppg01 output pwm01 output external interrupt 2 input p94 tc00 ppg00 pwm00 int1 io i o o i port94 tc00 input ppg00 output pwm00 output external interrupt 1 input p93 emg0 rxd1 i i i port93 emergency stop input0 uart data input 1 p92 ppgc02 txd1 io o o port92 ppgc02 output uart data output 1 p91 ppgc01 ppga0 txd2 io o o o port91 ppgc01 output ppga0 output uart data output 2 p90 tcc0 tca0 rxd2 io i i i port90 tcc0 input tca0 input uart data input 2 com3 o lcd common output 3 tmp89fw20a page 9 2012/5/18 ra000 table 1-2 pin names and functions (5/5) pin name input/output functions com2 o lcd common output 2 com1 o lcd common output 1 com0 o lcd common output 0 mode i test pin for out-going test (fix to low level). varef i analog reference voltage input pin for a/d conversion. avdd i analog power supply pin. vlc i power supply pin for lcd driver. avss i analog gnd pin vdd i vdd pin vss i gnd pin tmp89fw20a 1.4 pin names and functions page 10 2012/5/18 ra000 2. cpu core 2.1 configuration the cpu core consists of a cpu, a system clock controller and a reset circuit. this chapter describes the cpu core address space, the system clock controller and the reset circuit. 2.2 memory space the 870/c1 cpu memory space consists of a code area to be accessed as instruction operation codes and oper- ands and a data area to be accessed as sources and destinations of transfer and calculation instructions. both the code and data areas have independent 64-kbyte address spaces. 2.2.1 code area the code area stores operation codes, operands, vector tables for vector call instructions and interrupt vec- tor tables. the ram, the bootrom and the flash are mapped in the code area. 0x10000 flash (64 bytes) flash (4096 bytes) flash (64 bytes) 0x1003f 0x10040 ram (3072 bytes) ram (3072 bytes) 0x10c3f flash (65536 bytes) flash (62400 bytes) flash (960 bytes) 0x11000 bootrom (2048 bytes) bootrom (2048 bytes) 0x117ff 0x11800 flash (59392 bytes) flash (59392 bytes) 0x1ffa0 vector table for vec- tor call instructions (32 bytes) vector table for vec- tor call instructions (32 bytes) vector table for vec- tor call instructions (32 bytes) vector table for vec- tor call instructions (32 bytes) 0x1ffbf 0x1ffc2 interrupt vector ta- ble (62 bytes) interrupt vector ta- ble (62 bytes) interrupt vector ta- ble (62 bytes) interrupt vector ta- ble (62 bytes) 0x1ffff immediately after reset release when the ram is mapped in the code area when the boot- rom is mapped in the code area when the ram and the bootrom are mapped in the code area figure 2-1 memory map in the code area note: only the first 2 kbytes of the bootrom are mapped in the memory map, except in the serial prom mode. tmp89fw20a page 11 2012/5/18 ra000 2.2.1.1 ram the ram is mapped in the data area immediately after reset release. by setting syscr3 note 3: after irstsr note:the flash memory control register 1 has a double-buffer structure comprised of the register flscr1 and a shift register. writing "0xd5" to the register flscr2 allows a register setting to be reflected and take effect in the shift register. this means that a register setting value does not take effect until "0xd5" is written to the register flscr2. the value of the shift register can be checked by reading the register flscrm. flash memory control register 2 flscr2 7 6 5 4 3 2 1 0 (0x00fd1) bit symbol cr1en read/write w after reset * * * * * * * * cr1en flscr1 register enable/disable control 0xd5 others enable a change in the flscr1 setting reserved 2.2.1.3 flash the flash is mapped to 0x10000 to 0x1ffff in the code area after reset release. tmp89fw20a 2. cpu core 2.2 memory space page 14 2012/5/18 ra000 2.2.2 data area the data area stores the data to be accessed as sources and destinations of transfer and calculation instructions. the sfr, the ram, the bootrom and the flash are mapped in the data area. 0x00000 sfr1 (64 bytes) sfr1 (64 bytes) 0x0003f 0x00040 ram (3072 bytes) ram (3072 bytes) 0x00c3f 0xff is read 0xff is read 0x00e40 sfr3 (192 bytes) sfr3 (192 bytes) 0x00eff 0x00f00 sfr2 (256 bytes) sfr2 (256 bytes) 0x00fff 0x01000 bootrom (2048 bytes) 0x017ff 0x01800 flash (61440 bytes) flash (59392 bytes) 0x0ffff immediately after re- set release when the boot- rom is mapped in the data area figure 2-2 memory map in the data area note: only the first 2 kbytes of the bootrom are mapped in the memory map, except in the serial prom mode. 2.2.2.1 sfr the sfr is mapped to 0x00000 to 0x0003f (sfr1), 0x00f00 to 0x00fff (sfr2) and 0x00e40 to 0x00eff (sfr3) in the data area after reset release. note:don't access the reserved sfr. 2.2.2.2 ram the ram is mapped to 0x00040 to 0x00c3f in the data area after reset release. note:the contents of the ram become unstable when the power is turned on and immediately after a re- set is released. to execute the program by using the ram, transfer the program to be executed in the initialization routine. tmp89fw20a page 15 2012/5/18 ra000 example: ram initialization program ld hl, ram_top_address ;head of address of the ram to be initialized ld a, 0x00 ;initialization data ld bc, byte_of_clear_bytes ;number of bytes of ram to be initialized -1 clr_ram: ld (hl), a ;initialization of the ram inc hl ;initialization address increment dec bc ;have all the rams been initialized? j f, code_addr(clr_ram) 2.2.2.3 bootrom the bootrom is not mapped in the code area or the data area after reset release. setting flscr1 2.3 system clock controller 2.3.1 configuration the system clock controller consists of a clock generator, a clock gear, a timing generator, a warm-up coun- ter and an operation mode control circuit. figure 2-3 system clock controller 2.3.2 control the system clock controller is controlled by system control register 1 (syscr1), system control register 2 (syscr2), the warm-up counter control register (wuccr), the warm-up counter data register (wucdr) and the clock gear control register (cgcr). tmp89fw20a page 17 2012/5/18 ra000 external high-frequency clock oscillation circuit clock gear ( 1/4, 1/2, 1) warm-up counter fcgck dv9ck fcgcksel oscsel intwuc interrupt request xen/xten/oscen stop system clock oscillation/stop control clock generator xin xout xtin xtout fc fh fosc fs fs/4 1/4 timing generator operation mode control circuit syscr1 tbtcr cgcr 0 1y s syscr2 wuccr wucdr external low-frequency clock oscillation circuit internal bus internal bus internal high-frequency clock oscillation circuit system control register 1 syscr1 (0x00fdc) 7 6 5 4 3 2 1 0 bit symbol stop relm outen dv9ck oscsel - - - read/write r/w r/w r/w r/w r/w r r r after reset 0 0 0 0 0 0 0 0 stop activates the stop mode 0 : 1 : operate the cpu and the peripheral circuits stop the cpu and the peripheral circuits (activate the stop mode) relm selects the stop mode release method 0 : edge-sensitive release mode (release the stop mode at the rising edge of the stop mode release signal) 1 : level-sensitive release mode (release the stop mode at the "h" level of the stop mode release signal) outen selects the port output state in the stop mode 0 : 1 : high impedance output hold dv9ck selects the input clock to stage 9 of the divider 0 : 1 : fcgck/2 9 fs/4 oscsel selects the high-frequency refer- ence clock (fh) 0 : 1 : internal high-frequency clock (fosc) external high-frequency clock (fc) note 1: fosc: internal high-frequency clock [hz], fc: external high-frequency clock [hz], fcgck: gear clock [hz], fs: external low- frequency clock [hz] note 2: bits 2, 1 and 0 of syscr1 are read as "0". note 3: if the stop mode is activated with syscr1 note 1: fosc: internal high-frequency clock [hz], fc: external high-frequency clock [hz], fcgck: gear clock [hz], fs: external low- frequency clock [hz] note 2: wdt: watchdog timer, tg: timing generator note 3: don't set both syscr2 clock gear control register cgcr (0x00fcf) 7 6 5 4 3 2 1 0 bit symbol - - - - - - fcgcksel read/write r r r r r r r/w after reset 0 0 0 0 0 0 0 0 fcgcksel clock gear setting 00 : 01 : 10 : 11 : fcgck = fh / 4 fcgck = fh / 2 fcgck = fh reserved note 1: fh: high-frequency reference clock [hz], fcgck: gear clock [hz] note 2: don't change cgcr table 2-1 prohibited combinations of oscillation enable register conditions p0fc0 syscr2 after making sure that the external high-frequency clock (fc) has achieved stable oscilla- tion by using the warm-up counter, set syscr1 example: setting ports p00 and p01 as oscillation pins and switching the high-frequency reference clock from fosc to fc (warm-up time: approx. 300 s at fc = 8 mhz) ld (wuccr), 0y00000001 ;wuccr ? switching from fc to fosc set syscr1 example: switching the high-frequency reference clock from fc to fosc (warm-up time: approx. 100 s = at fosc = 5 mhz) ld (wuccr), 0y00000000 ;wuccr 2.3.3.3 timing generator the timing generator is a circuit that generates system clocks to be supplied to the cpu core and the pe- ripheral circuits from the gear clock (fcgck) or the clock that is a quarter of the external low-frequency clock (fs). the timing generator has the following functions: 1. generation of the main system clock (fm) 2. generation of clocks for the timer counter, the time base timer and other peripheral circuits figure 2-7 configuration of timing generator (1) configuration of timing generator the timing generator consists of a main system clock generator, a prescaler, a 21-stage divider and a machine cycle counter. 1. main system clock generator this circuit selects the gear clock (fcgck) or the clock that is a quarter of the external low- frequency clock (fs) for the main system clock (fm) to operate the cpu core. clearing syscr2 3. machine cycle instruction execution is synchronized with the main system clock (fm). the minimum instruction execution unit is called a "machine cycle". one machine cycle corresponds to one main system clock. there are a total of 11 different types of instructions for the tlcs-870/c1 series: 10 types ranging from 1-cycle instructions, which require one machine cycle for execution, to 10-cycle instructions, which require 10 machine cycles for execution, and 13-cycle instruc- tions, which require 13 machine cycles for execution. 2.3.4 warm-up counter the warm-up counter is a circuit that counts the internal high-frequency clock (fosc), the external high-fre- quency clock (fc) and the external low-frequency clock (fs), and it consists of a source clock selection cir- cuit, a 3-stage frequency division circuit and a 14-stage counter. the warm-up counter is used to secure the time after a power-on reset is released before the supply volt- age becomes stable and secure the time after the stop mode is released or the operation mode is changed be- fore the oscillation by the oscillation circuit becomes stable. figure 2-8 warm-up counter circuit 2.3.4.1 warm-up counter operation when the oscillation is enabled by the hardware (1) when a power-on reset is released or a reset is released the warm-up counter serves to secure the time after a power-on reset is released before the sup- ply voltage becomes stable and the time after a reset is released before the oscillation by the high-fre- quency clock oscillation circuit becomes stable. when the power is turned on and the supply voltage exceeds the power-on reset release voltage, the warm-up counter reset signal is released. at this time, the cpu and the peripheral circuits are held in the reset state. a reset signal initializes wuccr when a reset is released for the warm-up counter, the internal high-frequency clock (fosc) is in- put to the warm-up counter, and the 14-stage counter starts counting the internal high-frequency clock (fosc). when the upper 8 bits of the warm-up counter become equal to wucdr, counting is stopped and a reset is released for the cpu and the peripheral circuits. wucdr is initialized to 0x66 after reset release, which makes the warm-up time 0x66 2 9 /fosc [s]. note:the clock output from the oscillation circuit is used as the input clock to the warm-up coun- ter. the warm-up time contains errors because the oscillation frequency is unstable until the os- cillation circuit becomes stable. (2) when the stop mode is released the warm-up counter serves to secure the time after the oscillation is enabled by the hardware be- fore the oscillation becomes stable at the release of the stop mode. the clock that was used to generate the main system clock when stop mode was activated is se- lected as the input clock for the frequency division circuit, regardless of wuccr 2.3.4.2 warm-up counter operation when the oscillation is enabled by the software the warm-up counter serves to secure the time after the oscillation is enabled by the software before the oscillation becomes stable, at a mode change from normal1 to normal2 or from slow1 to slow2. select the input clock to the frequency division circuit at wuccr 2.3.5.1 single-clock mode only the gear clock (fcgck) is used for the operation in the single-clock mode. the main system clock (fm) is generated from the gear clock (fcgck). therefore, the machine cycle time is 1/fcgck [s]. the gear clock (fcgck) is generated from the high-frequency reference clock (fh). the high-frequency reference clock (fh) can be selected from the external high-frequency clock (fc) and the internal high-frequency clock (fosc). when the internal high-frequency clock (fosc) is used as the high-frequency reference clock (fh), pins p00 (xin) and p01 (xout) of the external high-frequency clock oscillation circuit can be used as general- purpose i/o ports. before switching the operating mode, be sure to select either the external high-frequency clock (fc) or the internal high-frequency clock (fosc) and then stop either of the high-frequency clocks not to be used. if a mode transition is made with both the external and internal high-frequency clocks enabled, the transi- tion may not be performed properly. for how to switch the high-frequency reference clock (fh), refer to "(1) high-frequency reference clock (fh)". in the single-clock mode, pins p02 (xtin) and p03 (xtout) of the external low-frequency clock oscil- lation circuit can be used as general-purpose i/o ports. (1) normal1 mode in this mode, the cpu core and the peripheral circuits operate using the gear clock (fcgck). after reset release, the normal1 mode becomes active and the internal high-frequency clock (fosc) is used as the high-frequency reference clock (fh). (2) idle1 mode in this mode, the cpu and the watchdog timer stop and the peripheral circuits operate using the gear clock (fcgck). the idle1 mode is activated by setting syscr2 when the idle0 mode is activated, the cpu stops and the timing generator stops the clock sup- ply to the peripheral circuits except the time base timer. when the falling edge of the source clock selected at tbtcr (2) slow2 mode in this mode, the cpu core and the peripheral circuits operate using the clock that is a quarter of the low-frequency clock (fs). in the slow mode, some peripheral circuits become the same as the states when a reset is re- leased. for operations of the peripheral circuits in the slow mode, refer to the section of each periph- eral circuit. set syscr2 in the sleep0 mode, the peripheral circuits stop in the states when the sleep0 mode is activa- ted or become the same as the states when a reset is released. for operations of the peripheral cir- cuits in the sleep0 mode, refer to the section of each peripheral circuit. the sleep0 mode can be activated and released in the same way as for the idle0 mode. the op- eration returns to the slow1 mode after this mode is released. in the sleep0 mode, the cpu stops and the timing generator stops the clock supply to the periph- eral circuits except the time base timer. 2.3.5.3 stop mode in this mode, all the operations in the system, including the oscillation circuits, are stopped and the inter- nal states in effect before the system was stopped are held with low power consumption. in the stop mode, the peripheral circuits stop in the states when the stop mode is activated or be- come the same as the states when a reset is released. for operations of the peripheral circuits in the stop mode, refer to the section of each peripheral circuit. the stop mode is activated by setting syscr1 2.3.5.4 transition of operation modes note 1: the normal1 and normal2 modes are generically called the normal mode; the slow1 and slow2 modes are called the slow mode; the idle0, idle1 and idle2 modes are called the idle mode; and the sleep0 and sleep1 are called the sleep mode. note 2: the mode is released by the falling edge of the source clock selected at tbtcr table 2-5 operation modes and conditions operation mode oscillation circuit cpu core watchdog timer time base timer ad converter other pe- ripheral cir- cuits machine cy- cle time high- frequency reference clock (fh) low-fre- quency clock (fs) single clock reset oscillation stop reset reset reset reset reset 1 / fcgck [s] normal1 operate operate operate operate operate idle1 stop stop idle0 stop stop stop stop stop ? dual clock normal2 oscillation oscillation operate with the high fre- quency operate with the high / low frequen- cy operate operate operate 1 / fcgck [s] idle2 stop stop slow2 operate with the low fre- quency operate with the low fre- quency stop 4/ fs [s] slow1 stop operate with the low fre- quency operate with the low fre- quency sleep1 stop stop sleep0 stop stop stop stop ? 2.3.6 operation mode control 2.3.6.1 stop mode the stop mode is controlled by system control register 1 (syscr1) and the stop mode release signals. (1) start the stop mode the stop mode is started by setting syscr1 (2) release the stop mode the stop mode is released by the following stop mode release signals. it is also released by a re- set by the reset pin, a power-on reset and a reset by the voltage detection circuits. when a reset is released, the warm-up starts. after the warm-up operation and copying of the shadow ram are com- pleted, the normal1 mode becomes active. 1. release by the stop pin 2. release by key-on wakeup 3. release by the voltage detection circuits note:during the stop period (from the start of the stop mode to the end of the warm-up), due to changes in the external interrupt pin signal, interrupt latches may be set to "1" and inter- rupts may be accepted immediately after the stop mode is released. before starting the stop mode, therefore, disable interrupts. also, before enabling interrupts after stop mode is released, clear unnecessary interrupt latches. 1. release by the stop pin release the stop mode by using the stop pin. the stop mode release by the stop pin includes the level-sensitive release mode and the edge-sensitive release mode, either of which can be selected at syscr1 example: starting the stop mode from the slow mode with an int5 interrupt (warm-up time at release of the stop mode is about 450ms at fs=32.768 khz.) pint5: test (p4prd). 7 ;to reject noise, the stop mode does not start j f, code_addr(sint5) ;if the stop pin input is high. ld (syscr1), 0x40 ;sets up the level-sensitive release mode ld (wuccr), 0x03 ;wuccr note: if the rising edge is input to the stop pin within 1 machine cycle after syscr1 note:when the stop mode is released with a low hold voltage, the following cautions must be ob- served. the supply voltage must be at the operating voltage level before releasing the stop mode. the reset pin input must also be "h" level, rising together with the supply voltage. in this case, if an external time constant circuit has been connected, the reset pin input voltage will increase at a slower pace than the power supply voltage. at this time, there is a danger that a reset may occur if the input voltage level of the reset pin drops below the non-invert- ing high-level input voltage (hysteresis input). table 2-6 oscillation start operation at release of the stop mode operation mode before the stop mode is started high-frequency ref- erence clock low-frequency reference clock oscillation start operation after release single-clock mode normal1 internal high-frequency clock - the internal high-frequency clock oscillation circuit starts oscillation. the external high-frequency clock oscillation circuit is inactive. the external low-frequency clock oscillation circuit is inactive. external high-frequency clock - the internal high-frequency clock oscillation circuit is inactive. the external high-frequency clock oscillation circuit starts oscillation. the external low-frequency clock oscillation circuit is inactive. dual-clock mode normal2 internal high-frequency clock external low-frequency clock the internal high-frequency clock oscillation circuit starts oscillation. the external high-frequency clock oscillation circuit is inactive. the external low-frequency clock oscillation circuit starts oscillation. external high-frequency clock external low-frequency clock the internal high-frequency clock oscillation circuit is inactive. the external high-frequency clock oscillation circuit starts oscillation. the external low-frequency clock oscillation circuit starts oscillation. slow1 - external low-frequency clock the internal high-frequency clock oscillation circuit is inactive. the external high-frequency clock oscillation circuit is inactive. the external low-frequency clock oscillation circuit starts oscillation. 2.3.6.2 idle1/2 and sleep1 modes the idle1/2 and sleep1 modes are controlled by the system control register 2 (syscr2) and maska- ble interrupts. the following states are maintained during these modes. 1. the cpu and the watchdog timer stop their operations. the peripheral circuits continue to oper- ate. 2. the data memory, the registers, the program status word and the port output latches are all held in the status in effect before idle1/2 or sleep1 mode was started. 3. the program counter holds the address of the instruction 2 ahead of the instruction which starts the idle1/2 or sleep1 mode. tmp89fw20a page 39 2012/5/18 ra000 figure 2-12 idle1/2 and sleep 1 modes tmp89fw20a 2. cpu core 2.3 system clock controller page 40 2012/5/18 ra000 cpu and wdt stop interrupt processing reset yes no no no no imf = "1" reset input yes yes (interrupt release mode) (normal release mode) interrupt request starting idle1/2 mode or sleep1 mode by an instruction execution of the instruction which follows the idle1/2 mode or sleep1 mode start instruction (1) start the idle1/2 and sleep1 modes after the interrupt master enable flag (imf) is set to "0", set the individual interrupt enable flag (ef) to "1", which releases idle1/2 and sleep1 modes. to start the idle1/2 or sleep1 mode, set syscr2 figure 2-13 idle0 and sleep0 modes ? start the idle0 and sleep0 modes stop (disable) the peripherals such as a timer counter. to start the idle0 or sleep0 mode, set syscr2 (1) normal release mode (imf, ef5, tbtcr figure 2-14 switching of the main system clock (fm) (switching from fcgck to fs/4) example 1: switching from the normal2 mode to the slow1 mode (when fc is used as the basic clock for the high-fre- quency clock) set (syscr2).4 ;syscr2 vintwuc: dw code_addr(pintwuc) ;intwuc vector table (2) switching from the slow1 mode to the normal1 mode set syscr2 |