Part Number Hot Search : 
ABR1010 NL17SH08 MC3302 EK7603 2N3227UB CA2904 EP3C120 SDH30UF
Product Description
Full Text Search
 

To Download TMP91C820AFG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  toshiba original cmos 16-bit microcontroller tlcs-900/l1 series TMP91C820AFG semiconductor company
preface thank you very much for making use of toshiba microcomputer lsis. before use this lsi, refer the section, ?points of note and restrictions?. especially, take care below cautions. ** caution ** how to release the halt mode usually, interrupts can release all halts status. however, the interrupts = ( nmi , int0 to int3, intrtc, intalm0 to intalm4, intkey), which can release the halt mode may not be able to do so if they are input during the period cpu is shifting to the halt mode (for about 5 clocks of f fph ) with idle1 or stop mode (idle2 is not applicable to this case). (in this case, an interrupt request is kept on hold internally.) if another interrupt is generated after it has shifted to halt mode completely, halt status can be released without difficultly. the priority of this interrupt is compare with that of the interrupt kept on hold internally, and the interrupt with higher priority is handled first followed by the other interrupt.
tmp91c820a 2008-02-20 91c820a-1 cmos 16-bit microcontrollers TMP91C820AFG/jt5aw4-s 1. outline and features tmp91c820a/jt5aw4 is a high-speed 16-bit microcontroller designed for the control of various mid- to large-scale equipment. TMP91C820AFG comes in a 144-pin flat package. jt5aw4-s comes in a 144-pad chip. listed below are the features. (1) high-speed 16-bit cpu (900/l1 cpu) instruction mnemonics are upward compatible with tlcs-90 16 mbytes of linear address space general-purpose registers and register banks 16-bit multiplication and division instructions; bit transfer and arithmetic instructions micro dma: 4 channels (444 ns/2 bytes at 36 mhz) (2) minimum instruction execution time: 111ns (at 36 mhz) restrictions on product use 20070701-en ? the information contained herein is subject to change without notice. ? toshiba is continually working to improve the quality and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utilizing toshiba products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that toshiba products are used within specified operating ranges as set forth in the most recent toshiba products specifications. also, please keep in mind the precautions and conditions set forth in the ?handling guide for semiconductor devices,? or ?toshiba semiconductor reliability handbook? etc. ? the toshiba products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.).these toshiba products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury (?unintended usage?). unintended usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc.. unintended usage of toshiba products listed in his document shall be made at the customer?s own risk. ? the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. ? the information contained herein is presented only as a 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 patents or other rights of toshiba or the third parties. ? please contact your sales representative for product-by-product details in this document regarding rohs compatibility. please use these products in this document in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances. toshiba assumes no liability for damage or losses occurring as a result of noncompliance with applicable laws and regulations. ? for a discussion of how the reliability of microcontrollers can be predicted, please refer to section 1.3 of the chapter entitled quality and reliability assurance/handling precautions.
tmp91c820a 2008-02-20 91c820a-2 (3) built-in ram: 8 kbytes built-in rom: 8 kbytes (however, 9999 (rom code) has no internal rom.) (4) external memory expansion ? expandable up to 136 mbytes (shared program/data area) ? can simultaneously support 8- or 16-bit width external data bus ... dynamic data bus sizing ? separate bus system (5) 8-bit timers: 4 channels (6) 16-bit timer: 1 channel (7) general-purpose serial interface: 3 channels ? uart/synchronous m ode ? irda (8) serial bus interface: 1 channel i 2 c bus mode/clock synchronous select mode (9) lcd controller ? shift register/built-in ram lcd driver ? supported 16, 8 and 4 gray levels and black and white ? hardware blinking cursor (10) sdram controller supported 16-m, 64-m and 128-mbit sdram with 16-bit data bus (11) timer for real time clock (rtc) ? based on tc8521a (12) key-on wakeup (interrupt key input) (13) 10-bit ad converter: 8 channels (14) watchdog timer (15) melody/alarm generator ? m elody: output of clock 4 to 5461 hz ? alarm: output of the 8 kinds of alarm pattern ? output of the 5 kinds of interval interrupt (16) chip select/wait controller: 4 channels (17) mmu ? expandable up to 136 mbytes (4 local area/8-bank method) (18) interrupts: 46 interrupts ? 9 cpu interrupts: software interrupt instruction and illegal instruction ? 31 internal interrupts: seven selectable priority levels ? 6 external interrupts: seven selectable priority levels (4-edge selectable) (19) input/output ports: 77 pins (at external 16-bit data bus memory) (20) standby function three halt modes: idle2 (programmable), idle1, stop (21) hardware standby function (power save function)
tmp91c820a 2008-02-20 91c820a-3 (22) triple-clock controller clock doubler (dfm) clock gear function: select a high-frequency clock fc to fc/16 rtc (fs = 32.768 khz) (23) operating voltage ? vcc = 2.7 v to 3.6 v (fc = 27 mhz) ? vcc = 3.0 v to 3.6 v (fc max = 36 mhz) (24) package ? 144-pin qfp: lqfp144-p-1616-0.40c ? chip form supply also available. for details, contact your local toshiba sales representative.
tmp91c820a 2008-02-20 91c820a-4 note: when rom code is 9999, it has no rom. figure 1.1 tmp91c820a block diagram 8-kbyte sram cpu (tlcs-900/l1) 10-bit 8ch ad converter h-osc sio/uart/irda (sio0) 8-bit timer (tmra0) 32 bits f sr xwa xbc xde xhl xix xiy xiz xsp w a ix iy iz sp txd0 (pc0) rxd0 (pc1) txd1 (pc3) rxd1 ( pc4 ) dvcc [3] x1 x2 p00 to p07(d0 to d7) p10 to p17(d8 to d15) p20 to p27 (a16 to a23) p30 to p37(a8 to a15) p40 to p47(a0 to a7) a n0 to a n7 (p80 to p87) avcc, avss vrefh, vrefl reset am0 a m1 wdt (watchdog timer) pc clock gear, clock doubler sio/uart (sio1) rd (pz0) l-osc emu0 emu1 port 4 cs0 to cs3 , cs2a interrupt controller int0 to int3,ta3out, keyboard i/f ki0 to ki7 (p90 to p97) ko0 to ko7 (pa0 to pa7) melody/ alarm out mldalm (pd7) 8-bit timer (tmra1) rxd2/ta1out (pb1) 8-bit timer (tmra2) 8-bit timer (tmra3) ta3out/int2 (pb5) ( ): initial function after reset b c d e h l adtrg (p83) sclk1/ cts1 ( pc5 ) (p60 to p63) port 3 d1bscp (pd0) d2blp (pd1) d3bfr (pd2) dlebcd (pd3) doffb (pd4) port 6 port 7 msk (p76), veeclk (p77) tb0out0 (pb3 to pb6) sclk0/ cts0 (pc2) optrx0, sck (p70) opttx0, so/sda (p71) serial bus i/f (sbi) si/scl (p72) rtc a larm , mldalm (pd6) xt1 xt2 txd2/ta0in (pb0) nmi / ps ea24, cs2b (p64), ld0 to ld7 (pe0 to pe7) sdram controller sdcke (pf5) sdclk (pf6) sdldqm (pf3) sdudqm (pf4) sdwe (pf2) sdras (pf0) sdcas (pf1) sdcs (p61) sio/uart (sio2) txd2/ta0in (pb0) rxd2/ta1out (pb1) dvss [7] 8-kbyte mrom (note) tb0out0/int3 (pb6) cs2e / srub (p67) cs2f (p73) cs2g (p74) csexa (p75) port 1 port 0 wr (pz1) hwr (pz2) w / r , srwr (pz3) wait (p56) port 2 port 5/ port z cs/wait controller (4 blocks) mmu lcd controller port 8 port 9 port a port b port c port d port e port f 16-bit timer (tmrb0) cs2f (p73) cs2g (p74) csexa (p75) ea25, cs2c (p65), cs2d / srlb (p66),
tmp91c820a 2008-02-20 91c820a-5 2. pin assignment and pin functions the assignment of input/output pins for the tmp91c820a, their names and functions are as follows: 2.1 pin assignment diagram figure 2.1.1 shows the pin assignment of the TMP91C820AFG. figure 2.1.1 pin assignment diagram (144-pin qfp) p64/ea24/ cs2a cs2 p62 / / srub srlb cs2c cs2b pz2/ dvcc3 p75/ p74/ p73/ cs0 cs1 wait r/w hwr alarm mldalm csexa cs2g cs2e cs2f cs2d txd1/pc3 rxd0/pc1 vrefl p87/an7 a vss vrefh TMP91C820AFG qfp144 to p v i e w 1 5 10 15 20 25 30 40 45 50 55 60 75 80 85 90 95 110 115 120 125 avcc ki2/p92 ki3/p93 ki4/p94 ki 5/p95 ki6/p96 ki7/p97 ko0/pa0 ko1/pa1 ko2/pa2 ko3/pa3 ko4/pa4 ko5/pa5 ko6/pa6 k o 7 / pa7 txd2/ta0in/pb0 rxd2/ta1out/pb1 int0/pb3 int1/pb4 ta3out/int2/pb5 tb0out0/int3/pb6 txd 0/ p c0 sclk0 / cts 0 /pc2 pz0/ rd p27/a23 p26/a22 p25/a21 p24/a20 p2 3/ a1 9 p22/a18 p21/a17 dvcc2 p20/a16 p37/a15 p36/a14 p35/a13 p34/a12 p33/a11 p32/a10 p31/a9 p30/a8 p47/a7 p46/a6 p45/a5 p44/a4 p43/a3 p42/a2 p41/a1 p40/a0 p07/d7 p06/d6 p05/d5 p04/d4 p03/d3 p02/d2 p01/d1 p00/d0 doffb/pd4 dlebcd/pd3 d3bfr/pd2 d2blp/pd1 d1bscp/pd0 /pf2 emu1 emu0 xt2 xt1 am1 x1 x2 p82/an2 pd6/ / p77/veeclk p76/msk p72/si/scl p71/so/sda/opttx0 p70/sck/optrx0 p67/ / p66 / / p65/ea25/ 35 65 70 100 105 130 135 140 rxd1/pc4 ld0/pe0 ld1/pe1 ld2/pe2 ld3/pe3 sclk1/ cts1 /pc5 ld4/pe4 ld5/pe5 ld6/pe6 ld7/pe7 d13/p15 d14/p16 d15/p17 p61/ / dvss1 dvss2 dvss3 dvss4 dvss5 dvss6 dvcc1 am0 /pf1 /pf0 d8/p10 d9/p11 d10/p12 d11/p13 d12/p14 pz1/ p83/an3/ adtrg p84/an4 p85/an5 p86/an6 p81/an1 p80/an0 p91/ki1 p90/ki0 pf7 pf6/sdclk dvss7 pf5/sdcke pf4/sdudqm pf3/sdldqm pd7/mldalm sdwe sdras sdcas sdcs cs3 srwe wr reset pz3/ / p63/ p60/ p56/ / ps nmi
tmp91c820a 2008-02-20 91c820a-6 2.2 pad layout (chip size 5.75 mm 5.63 mm) unit: m pin no. name x point y point pin no. name x point y point pin no. name x point y point 1 p81 ? 2742 2128 49 xt2 ? 485 ? 2682 97 p37 2736 758 2 p82 ? 2742 2004 50 emu0 ? 370 ? 2682 98 dvcc2 2736 872 3 p83 ? 2742 1888 51 emu1 ? 256 ? 2682 99 p20 2736 986 4 p84 ? 2742 1774 52 pd1 ? 142 ? 2682 100 dvss5 2736 1202 5 p85 ? 2742 1660 53 pd2 ? 28 ? 2682 101 p21 2736 1318 6 p86 ? 2742 1546 54 pd3 86 ? 2682 102 p22 2736 1432 7 p87 ? 2742 1432 55 pd4 200 ? 2682 103 p23 2736 1546 8 avss ? 2742 1318 56 pe0 314 ? 2682 104 p24 2736 1660 9 avcc ? 2742 1204 57 pe1 428 ? 2682 105 p25 2736 1774 10 p92 ? 2742 892 58 pe2 542 ? 2682 106 p26 2736 1888 11 p93 ? 2742 778 59 pe3 656 ? 2682 107 p27 2736 2004 12 p94 ? 2742 664 60 pe4 770 ? 2682 108 pz0 2736 2128 13 p95 ? 2742 550 61 pe5 884 ? 2682 109 pz1 2188 2676 14 p96 ? 2742 436 62 pe6 998 ? 2682 110 pz2 2062 2676 15 p97 ? 2742 322 63 pe7 1112 ? 2682 111 pz3 1948 2676 16 pa0 ? 2742 208 64 dvss3 1246 ? 2682 112 p56 1834 2676 17 pa1 ? 2742 94 65 p00 1378 ? 2682 113 p60 1720 2676 18 pa2 ? 2742 ? 20 66 p01 1492 ? 2682 114 p61 1606 2676 19 pa3 ? 2742 ? 134 67 p02 1606 ? 2682 115 p62 1492 2676 20 pa4 ? 2742 ? 248 68 p03 1720 ? 2682 116 dvss6 1378 2676 21 pa5 ? 2742 ? 362 69 p04 1834 ? 2682 117 p63 1264 2676 22 pa6 ? 2742 ? 476 70 p05 1948 ? 2682 118 p64 1150 2676 23 pa7 ? 2742 ? 590 71 p06 2062 ? 2682 119 p65 1036 2676 24 pb0 ? 2742 ? 704 72 p07 2188 ? 2682 120 p66 922 2676 25 pb1 ? 2742 ? 818 73 p10 2736 ? 2134 121 p67 808 2676 26 pb3 ? 2742 ? 932 74 p11 2736 ? 2010 122 p70 694 2676 27 pb4 ? 2742 ? 1046 75 p12 2736 ? 1894 123 p71 580 2676 28 dvss1 ? 2742 ? 1210 76 p13 2736 ? 1780 124 p72 382 2676 29 pb5 ? 2742 ? 1324 77 p14 2736 ? 1666 125 dvcc3 268 2676 30 pb6 ? 2742 ? 1438 78 p15 2736 ? 1552 126 p73 68 2676 31 pc0 ? 2742 ? 1552 79 p16 2736 ? 1438 127 p74 ? 46 2676 32 pc1 ? 2742 ? 1666 80 dvss4 2736 ? 1318 128 p75 ? 160 2676 33 pc2 ? 2742 ? 1780 81 p17 2736 ? 1066 129 p76 ? 274 2676 34 pc3 ? 2742 ? 1894 82 p40 2736 ? 952 130 p77 ? 388 2676 35 pc4 ? 2742 ? 2010 83 p41 2736 ? 838 131 pd6 ? 520 2676 36 pc5 ? 2742 ? 2134 84 p42 2736 ? 724 132 pd7 ? 634 2676 37 pf0 ? 2194 ? 2682 85 p43 2736 ? 610 133 pf3 ? 748 2676 38 pf1 ? 2068 ? 2682 86 p44 2736 ? 496 134 pf4 ? 862 2676 39 pf2 ? 1954 ? 2682 87 p45 2736 ? 382 135 pf5 ? 976 2676 40 pd0 ? 1840 ? 2682 88 p46 2736 ? 268 136 dvss7 ? 1090 2676 41 am0 ? 1726 ? 2682 89 p47 2736 ? 154 137 pf6 ? 1204 2676 42 dvcc1 ? 1612 ? 2682 90 p30 2736 ? 40 138 pf7 ? 1318 2676 43 x2 ? 1410 ? 2682 91 p31 2736 74 139 p90 ? 1432 2676 44 dvss2 ? 1244 ? 2682 92 p32 2736 188 140 p91 ? 1546 2676 45 x1 ? 1079 ? 2682 93 p33 2736 302 141 nmi ? 1660 2676 46 am1 ? 963 ? 2682 94 p34 2736 416 142 vrefl ? 1954 2676 47 reset ? 849 ? 2682 95 p35 2736 530 143 vrefh ? 2068 2676 48 xt1 ? 734 ? 2682 96 p36 2736 644 144 p80 ? 2194 2676
tmp91c820a 2008-02-20 91c820a-7 2.3 pin names and functions the names of the input/output pins and their functions are described below. table 2.3.1 pin names and functions (1/4) pin name number of pins i/o functions p00 to p07 d0 to d7 8 i/o i/o port 0: i/o port that allows i/o to be selected at the bit level data (lower): bits 0 to 7 of data bus p10 to p17 d8 to d15 8 i/o i/o port 1: i/o port that allows i/o to be selected at the bit level (when used to the external 8-bit bus) data (upper): bits 8 to15 of data bus p20 to p27 a16 to a23 8 output output port 2: i/o port address: bits 16 to 23 of address bus p30 to p37 a8 to a15 8 output output port 3: i/o port address: bits 8 to 15 of address bus p40 o p47 a0 to a7 8 output output port 4: i/o port address: bits 0 to 7 of address bus pz0 rd 1 output output port z0: output port read: strobe signal for reading external memory pz1 wr 1 output output port z1: output port write: strobe signal for writing data to pins d0 to d7 pz2 hwr 1 i/o output port z2: i/o port (with pull-up resistor) high write: strobe signal for writing data to pins d8 to d15 pz3 r/ w srwr 1 i/o output output port z3: i/o port (with pull-up resistor) read/write: 1 represents read or dummy cycle; 0 represents write cycle. write for sram: strobe signal for writing data. p56 wait 1 i/o input port 56: i/o port (with pull-up resistor) wait: pin used to request cpu bus wait p60 cs0 1 output output port 60: output port chip select 0: outputs 0 when address is within specified address area. p61 cs1 sdcs 1 output output output port 61: output port chip select 1: outputs 0 when address is within specified address area chip select for sdram: outputs 0 when address is within sdram address area p62 cs2 cs2a 1 output output output port 62: output port chip select 2: outputs 0 when address is within specified address area expand chip select 2a: outputs 0 when address is within specified address area p63 cs3 1 output output port 63: output port chip select 3: outputs 0 when address is within specified address area p64 ea24 cs2b 1 output output output port 64: output port chip select 24: outputs 0 when address is within specified address area expand chip select 2b: outputs 0 when address is within specified address area p65 ea25 cs2c 1 output output output port 65: output port chip select 25: outputs 0 when address is within specified address area expand chip select 2c: outputs 0 when address is within specified address area p66 cs2d srlb 1 output output output port 66: output port expand chip select 2d: outputs 0 when address is within specified address area lower byte enable for sram: outputs 0 when lower data is enable. p67 cs2e srub 1 output output output port 67: output port expand chip select 2e: outputs 0 when address is within specified address area upper byte enable for sram: outputs 0 when upper data is enable.
tmp91c820a 2008-02-20 91c820a-8 table 2.3.2 pin names and functions (2/4) pin name number of pins i/o functions p70 sck optrx0 1 i/o i/o input port 70: i/o port serial bus interface clock i/o data at sio mode serial 0 recive data p71 s0 sda optrx0 1 i/o output i/o output port 71: i/o port serial bus interface send data at sio mode serial bus interface send/recive data at i 2 c bus mode (open-drain output mode by programmable) serial 0 send data p72 si scl 1 i/o input i/o port 72: i/o port serial bus interface recive data at sio mode serial bus interface clock i/o data at i 2 c bus mode (open-drain output mode by programmable) p73 cs2f 1 i/o output port 73: i/o port expand chip select 2f: outputs 0 when address is within specified address area p74 cs2g 1 i/o output port 74: i/o port expand chip select 2g: outputs 0 when address is within specified address area p75 csexa 1 i/o output port 75: i/o port expand chip select exa: outputs 0 when address is within specified address area p76 msk 1 i/o input port 76: i/o port mask: use for disable to output veeclk for lcd driver p77 veeclk 1 i/o output port 77: i/o port output 32.768 khz clock to lcd driver. (can be disabled by msk pin.) p80 to p87 an0 to an7 adtrg 8 input input input port 80 to 87: pin used to input ports analog input 0 to 7: pin used to input to ad conveter ad trigger: signal used to request ad start (with used to p83) p90 to p97 ki0 to ki7 8 input input port 90 to 97: pin used to input ports key input 0 to 7: pin used of key-on wakeup 0 to 7 (schmitt input, with pull-up resistor) pa0 to pa7 ko0 to ko7 8 output output port a0 to a7: pin used to output ports key output 0 to 7: pin used of key-scan strobe 0 to 7 pb0 ta0in txd2 1 i/o input output port b0: i/o port 8-bit timer 0 input: timer 0 input serial 2 send data: open-drain output pin by programmable pb1 ta1out rxd2 1 i/o output input port b1: i/o port 8-bit timer 1 output: timer 1 output serial 2 receive data pb3 int0 1 i/o input port b3: i/o port interrupt request pin0: interrupt request pin with programmable level/rising/falling edge pb4 int1 1 i/o input port b4: i/o port interrupt request pin1: interrupt request pin with programmable rising/falling edge
tmp91c820a 2008-02-20 91c820a-9 table 2.3.3 pin names and functions (3/4) pin name number of pins i/o functions pb5 int2 ta3out 1 i/o input output port b5: i/o port interrupt request pin2: interrupt request pin with programmable rising/falling edge 8-bit timer 3 output: timer 3 output pb6 int3 tb0out0 1 i/o input outout port b6: i/o port interrupt request pin3: interrupt request pin with programmable rising/falling edge timer b0 output pc0 txd0 1 i/o output port c0: i/o port serial 0 send data: open-drain output pin by programmable pc1 rxd0 1 i/o input port c1: i/o port serial 0 receive data pc2 sclk0 cts0 1 i/o i/o input port c2: i/o port serial 0 clock i/o serial 0 data send enable (clear to send) pc3 txd1 1 i/o output port c3: i/o port serial 1 send data (open-drain output pin by programmable) pc4 rxd1 1 i/o input port c4: i/o port serial 1 receive data pc5 sclk1 cts1 1 i/o i/o input port c5: i/o port serial 1 clock i/o serial 1 data send enable (clear to send) pd0 d1bscp 1 output output port d0: output port lcd driver output pin pd1 d2blp 1 output output port d1: output port lcd driver output pin pd2 d3bfr 1 output output port d2: output port lcd driver output pin pd3 dlebcd 1 output output port d3: output port lcd driver output pin pd4 doffb 1 output output port d4: output port lcd driver output pin pd6 alarm mldalm 1 output output output port d6: output port rtc alarm output pin melody/alarm output pin (inverted) pd7 mldalm 1 output output port d7: output port melody/alarm output pin pe0 to pe7 ld0 to ld7 8 i/o output port e0 to e7: i/o port data bus for lcd driver pf0 sdras 1 i/o output port f0: output port row address storobe for sdram: outputs 0 when address is within sdram address area pf1 sdcas 1 i/o output port f1: output port column address storobe for sdram: outputs 0 when address is within sdram address area
tmp91c820a 2008-02-20 91c820a-10 table 2.3.4 pin names and functions (4/4) pin name number of pins i/o functions pf2 sdwe 1 output output port f2: output port write enable for sdram pf3 sdldqm 1 output output port f3: output port lower data enable for sdram pf4 sdudqm 1 output output port f4: output port upper data enable for sdram pf5 sdcke 1 output output port f5: output port clock enable for sdram pf6 sdclk 1 output output port f6: output port clock for sdram pf7 1 output port f7: output port ps nmi (note) 1 input input power save mode setting terminal non-maskable interrupt request: interrupt request pin with programmable falling edge level or with both edge levels programmable am0 to am1 2 input operation mode: fixed to am1 = 1, am0 = 1 when using internal rom (when rom code is 9999, setting is prohibitted). fixed to am1 = 0, am0 = 1 when using external rom by 16-bit external bus, or 8- or 16-bit dynamic sizing. fixed to am1 = 0, am0 = 0 when using external rom by 8-bit external bus. emu0 1 output open pin emu1 1 output open pin reset 1 input reset: initializes tmp91c820a (with pull-up resistor). vrefh 1 input pin for reference voltage input to ad converter (h) vrefl 1 input pin for reference voltage input to ad converter (l) x1/x2 2 i/o high-frequency oscillator connection pins xt1/xt2 2 i/o low-frequency oscillator connection pins avcc 1 power supply pin for ad converter avss 1 gnd pin for ad converter (0 v) dvcc 3 power supply pins (all vcc pins should be connecyed with the power supply pin). dvss 7 gnd pins (all pins should be connected with gnd (0 v).) note: please input 1 into nmi / ps pin, because nmi / ps = 0 means power save mode after reset.
tmp91c820a 2008-02-20 91c820a-11 3. operation this following describes block by block the functions and operation of the tmp91c820a. notes and restrictions for eatch b ook are outlined in 6 ?points of note and restrictions? at the end of this manual. 3.1 cpu the tmp91c820a incorporates a high-performance 16-bit cpu (the 900/l1 cpu). for cpu operation, see the ?tlcs-900/l1 cpu?. the following describe the unique function of the cpu used in the tmp91c820a; these functions are not covered in the tlcs-900/l1 cpu section. 3.1.1 reset when resetting the tmp91c820a microcontroller, ensure that the power supply voltage is within the operating voltage range, and that the internal high-frequency oscillator has stabilized. then hold the reset input to low level for at least 10 system clocks (9 s at 36mhz). thus, when turn on the switch, be set to the power supply voltage is within the operating voltage range, and that the internal high-frequ ency oscillator has stabilized. then hold the reset input to low level at least for 10 system clocks. clock gear is initialized 1/16 mode by reset operation. it means that the system clock mode f sys is set to fc/32 ( = fc/16 1/2). when the reset is accept, the cpu: ? sets as follows the program counter (pc) in accordance with the reset vector stored at address ffff00h to ffff02h: pc<7:0> value at ffff00h address pc<15:8> value at ffff01h address pc<23:16> value at ffff02h address ? sets the stack pointer (xsp) to 100h. ? sets bits of the status register (sr) to 111 (sets the interrupt level mark register to level 7). ? sets the bit of the status register to 1 (max mode). (note: as this product does not support min mode, do not write a 0 to the .) ? clears bits of the status register to 000 (sets the register bank to 0). when reset is released,the cpu starts exec uting instructions in accordance with the program counter settings. cpu internal registers not mentioned above do not change when the reset is released. when the reset is accepted, the cpu sets internal i/o, ports, and other pins as follows. initializes the internal i/o registers. sets the port pins, including the pins that also act as internal i/o, to general-purpose input or output port mode. note: the cpu internal register (except to pc, sr, xsp) and internal ram data do not change by resetting. figure 3.1.1 is a reset timing of the tmp91c820a-9999.
tmp91c820a 2008-02-20 91c820a-12 read write f fph a23 to a0 data-in d0 to d15 d0 to d15 sampling (after reset released, startting 2 waits read cycle) : pull up (internal) : high-z data-out sampling (pz2 input mode) 0ffff00h data-in xt1, xt2 reset cs0, cs1, cs3 cs2 rd w r hw r figure 3.1.1 tmp91c820a-9999 reset timing example (the case of using external rom)
tmp91c820a 2008-02-20 91c820a-13 3.2 memory map figure 3.2.1 is a memory map of the tmp91c820a. 000000h 001000h 16-mbyte area (r) ( ? r) (r + ) (r + r8/16) (r + d8/16) (nnn) direct area ( n ) 64-kbyte area (nn) internal i/o (4 kbytes) 003000h 010000h ( = internal area ) ffff00h ffffffh vector table ( 256 b y tes ) external memory 000100h 000fe0h mask rom (8 kbytes ) ffe000h internal ram (8 kbytes) figure 3.2.1 memory map note: address 000fe0h to 000fffh is assigned for the external memory area of built-in ram type lcd driver. and when rom code is 9999, internal mask rom area also defines external memory area.
tmp91c820a 2008-02-20 91c820a-14 3.3 triple clock function and standby function tmp91c820a contains (1) clock gear, (2) clock doubler (dfm), (3) standby controller, and (4) noise-reducing circuit. it is used for low-power, low-noise systems. this chapter is organized as follows: 3.3.1 block diagram of system clock 3.3.2 sfrs 3.3.3 system clock controller 3.3.4 prescaler clock controller 3.3.5 clock doubler (dfm) 3.3.6 noise reduction circuits 3.3.7 standby controller
tmp91c820a 2008-02-20 91c820a-15 the clock operating modes are as follows: (a) single clock mode (x1, x2 pins only), (b) dual clock mode (x1, x2, xt1 and xt2 pins) and (c) triple clock mode (the x1, x2, xt1 and xt2 pins and dfm). figure 3.3.1 shows a transition figure. using dfm instruction reset (f osch /32) release reset instruction interrupt stop mode (stops all circuits) normal mode (f osch /gear value/2) idle2 mode (i/o operate) idle1 mode (operate only oscillator) (a) single clock mode transition figure (b) dual clock mode transition fiigure stop mode (stops all circuits) slow mode (fs/2) reset (f osch /32) release reset normal mode (f osch /gear value/2) idle2 mode (i/o operate) idle1 mode (operate only oscillator) idle2 mode (i/o operate) idle1 mode (operate only oscillator) reset (f osch /32) release reset normal mode (f osch /gear value/2) idle2 mode (i/o operate) idle1 mode (operate only oscillator) stop mode (stops all circuits) slow mode (fs/2) normal mode (4 f osch /gear value/2) idle2 mode (i/o operate) idle1 mode (operate oscillator and dfm) idle2 mode (i/o operate) idle1 mode (operate only oscillator) (c) triple clock mode transition figure instruction instruction interrupt interrupt instruction instruction interrupt interrupt instruction instruction interrupt interrupt instruction interrupt instruction instruction interrupt interrupt instruction instruction instruction interrupt * note * note note 1: it?s prohibited to control dfm in slow mode when shiftin g from slow mode to normal mode with use o f dfm. (dfm start up/stop/change write to dfmcr0 register.) note 2: if you shift from normal mode with use of dfm to normal mode, the instruction should be separated into two procedures as below. change cpu clock stop dfm circuit. note 3: it?s prohibited to shift from normal mode with use of dfm to stop mode directly. you should set normal mode once, and then shift to stop mode. (you should stop high frequency oscillator after you stop dfm.) instruction instruction interrupt instruction instruction interrupt interrupt instruction instruction interrupt interrupt figure 3.3.1 system clock block diagram the clock frequency input from the x1 and x2 pins is called fc and the clock frequency input from the xt1 and xt2 pins is called fs. the clock frequency selected by syscr1 is called the system clock f fph . the system clock f sys is defined as the divided clock of f fph , and one cycle of f sys is defined to as one state.
tmp91c820a 2008-02-20 91c820a-16 3.3.1 block diagram of system clock clock gear syscr1 tmra0 to tmra3,tmrb0 syscr0 selector fs f osch low-frequency oscillator xt1 xt2 syscr0 warm-up timer (high-/low-frequency oscillator), lockup timer (dfm) syscr0 syscr2 dfmcr0 x1 x2 clock doubler (dfm) f dfm = f osch 4 2 16 4 fc/16 fc/8 fc/4 fc/2 fc dfmcr0 syscr1 2 4 fc/16 f fph f sys 2 f sys cpu ram adc interrupt controller wdt i/o ports prescaler t0 sio0 to 2 sbi rtc t fs t0 fs t syscr0 high-frequency oscillator 8 prescaler prescaler lcdc mld/alm sdramc rom figure 3.3.2 block diagram of system clock
tmp91c820a 2008-02-20 91c820a-17 3.3.2 sfrs 7 6 5 4 3 2 1 0 bit symbol xen xten rxen rxten rsysck wuef prck1 prck0 read/write r/w after reset 1 1 1 0 0 0 0 0 function high- frequency oscillator (fc) 0: stop 1: oscillation low- frequency oscillator (fs) 0: stop 1: oscillation (note 1) high- frequency oscillator (fc) after release of stop mode 0: stop 1: oscillation low- frequency oscillator (fs) after release of stop mode 0: stop 1: oscillation selects clock after release of stop mode 0: fc 1: fs warm-up timer 0: write don?t care 1: write start timer 0: read end warm up 1: read do not end warm up select prescaler clock 00: f fph (note 2) 01: reserved 10: fc/16 11: reserved 7 6 5 4 3 2 1 0 bit symbol sysck gear2 gear1 gear0 read/write r/w after reset 0 1 0 0 function select system clock 0: fc 1: fs select gear value of high frequency (fc) 000: fc 001: fc/2 010: fc/4 011: fc/8 100: fc/16 101: (reserved) 110: (reserved) 111: (reserved) 7 6 5 4 3 2 1 0 bit symbol psenv wuptm1 wuptm0 haltm1 haltm0 seldrv drve read/write r/w r/w r/w r/w r/w r/w r/w after reset 0 1 0 1 1 0 0 function 1:disable 0:power save mode enable (note 3) warm-up timer 00: reserved 01: 2 8 inputted frequency 10:2 14 11:2 16 halt mode 00: reserved 01: stop mode 10: idle1 mode 11: idle2 mode mode select 1: stop 0: idle1 (note 4) pin state control in stop/idle1 mode 0: i/o off 1: remains the state before halt syscr0 (00e0h) syscr1 (00e1h) syscr2 (00e2h) note 1: by reset, low-frequency oscillator is enabled. note 2: it?s prohibit to use to fc/16 prescaler clock when sbi block use. (i 2 c bus and clock synchronous.) note 3: when use nmi / ps pin as nmi function, set to 1. note 4: 0 means idle1, and 1 means stop. please be careful because this setting is sometimes different from others. figure 3.3.3 sfr for system clock
tmp91c820a 2008-02-20 91c820a-18 symbol name address 7 6 5 4 3 2 1 0 act1 act0 dlupfg dluptm r/w r/w r r/w 0 0 0 0 dfm lup select f fph dfmcr0 dfm control register 0 e8h 00 01 10 11 stop run run run stop run stop stop f osch f osch f dfm f osch lockup status flag 0: end 1: not end lockup time 0: 2 12 /f osch 1: 2 10 /f osch d7 d6 d5 d4 d3 d2 d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w 0 0 0 1 0 0 1 1 dfmcr1 dfm control register 1 e9h dfm revision input frequency 4 to 9 mhz (at 2.7 v to 3.6 v): write 0bh figure 3.3.4 sfr for dfm limitation point on the use of dfm 1. it?s prohibited to execute dfm enable/disable control in the slow mode (fs) (write to dfmcr0 = ?10?). you should control dfm in the normal mode. 2. if you stop dfm operation during using dfm (dfmcr0 = ?10?), you shouldn?t execute that change the clock f dfm to f osch and stop the dfm at the same time. therefore the above executions should be separated into two procedures as showing below. ld (dfmcr0), c0h ; change the clock f dfm to f osch . ld (dfmcr0), 00h ; dfm stop. 3. if you stop high-frequency oscillator during using dfm (dfmcr0 = ?10?), you should stop dfm before you stop high-frequency oscillator. please refer to 3.3.5 ?clock doubler (dfm)? for the details .
tmp91c820a 2008-02-20 91c820a-19 7 6 5 4 3 2 1 0 bit symbol protect ta3lcde ahold ta3mlde ? extin drvosch drvoscl read/write r r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 1 1 function protect flag 0: off 1: on lcdc source clock 0: 32 khz 1: ta3out address hold (note) 0: disable 1: enable melody/alarm source clock 0: 32 khz 1: ta3out always write ?0?. 1: external clock fc oscillator driver ability 1: normal 0: weak fs oscillator driver ability 1: normal 0: weak bit symbol read/write after reset function bit symbol read/write after reset function switching the protect on/off by write to following 1st-key, 2nd-key 1st-key: emccr1 = 5ah, emccr2 = a5h in succession write 2nd-key: emccr1 = a5h, emccr2 = 5ah in succession write bit symbol enfrom endrom enprom fflag dflag pflag read/write r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 cs1a write operation flag cs2b 2g write operation flag cs2a write operation flag function cs1a area detect control 0: disable 1: enable cs2b 2g area detect control 0: disable 1: enable cs2a area detect control 0: disable 1: enable when reading 0: not written 1: written when writing 0: clear flag note1: when getting access to the logic address 000000h to 000fdfh, 001000h to 002fffh and ffe000h to ffffffh, a0 to a23 holds the previous address of external access. note2: in case restarting the oscillator in the stop oscillation state (e.g. restart the oscillator in stop mode), set emccr0, = ?1?. figure 3.3.5 sfr for noise reducing emccr0 (00e3h) emccr1 (00e4h) emccr2 (00e5h) emccr3 (00e6h)
tmp91c820a 2008-02-20 91c820a-20 3.3.3 system clock controller the system clock controller generates the system clock signal (f sys ) for the cpu core and internal i/o. it contains two oscillation circuits and a clock gear circuit for high-frequency (fc) operation. the register syscr1 changes the system clock to either fc or fs, syscr0 and syscr0 control enabling and disabling of each oscillator, and syscr1 sets the high-frequency clock gear to either 1, 2, 4, 8 or 16 (fc, fc/2, fc/4, fc/8 or fc/16). these functions can reduce the power consumption of the equipment in which the device is installed. the combination of settings = 1, = 0, = 0 and = 100 will cause the system clock (f sys ) to be set to fc/32 (fc/16 1/2) after a reset. for example, f sys is set to 1.1 mhz when the 36-mhz oscillator is connected to the x1 and x2 pins. (1) switching from normal mode to slow mode when the resonator is connected to the x1 and x2 pins, or to the xt1 and xt2 pins, the warm-up timer can be used to change the operation frequency after stable oscillation has been attained. the warm-up time can be selected using syscr2. this warm-up timer can be programmed to start and stop as shown in the following examples 1 and 2. table 3.3.1 shows the warm-up times. note 1: when using an oscillator (other than a resonator) with stable oscillation, a warm-up timer is not needed. note 2: the warm-up timer is operated by an oscillation clock. hence, there may be some variation in warm-up time. table 3.3.1 warm-up times warm-up time syscr2 change to normal mode change to slow mode 01 (2 8 /frequency) 7.1 [ s] 7.8 [ms] 10 (2 14 /frequency) 0.455 [ms] 500 [ms] 11 (2 16 /frequency) 1.820 [ms] 2000 [ms] at f osch = 36 mhz, fs = 32.768 khz
tmp91c820a 2008-02-20 91c820a-21 example 1: setting the clock changing from high frequency (fc) to low frequency (fs). syscr0 equ 00e0h syscr1 equ 00e1h syscr2 equ 00e2h ld (syscr2), ? x11 ? ? ? ? b ; sets warm-up time to 2 16 /fs. set 6, (syscr0) ; enables low-frequency oscillation. set 2, (syscr0) ; clears and starts warm-up timer. wup: bit 2, (syscr0) ; jr nz, wup ; detects stopping of warm-up timer. set 3, (syscr1) ; changes f sys from fc to fs. res 7, (syscr0) ; disables high-frequency oscillation. x: don?t care, ? : no change fc fs counts up by fs x1, x2 pins xt1, xt2 pins warm-up timer end of warm-up timer system clock f sys enables low frequency clears and starts warm-up timer end of warm-up timer chages f sys from fc to fs disables high frequency counts up by f sys
tmp91c820a 2008-02-20 91c820a-22 example 2: setting the clock changing from low frequency (fs) to high frequency (fc). syscr0 equ 00e0h syscr1 equ 00e1h syscr2 equ 00e2h ld (syscr2), ? x10 ? ? ? ? b ; sets warm-up time to 2 14 /fc. set 7, (syscr0) ; enables high-frequency oscillation. set 2, (syscr0) ; clears and starts warm-up timer. wup: bit 2, (syscr0) ; jr nz, wup ; detects stopping of warm-up timer. res 3, (syscr1) ; changes f sys from fs to fc. res 6, (syscr0) ; disables low-frequency oscillation. x: don?t care, ? : no change counts up by f sys counts up by f osch x1, x2 pins xt1, xt2 pins warm-up timer end of warm-up timer system clock f sys enables high frequency clears and starts warm-up timer end of warm-up timer chages f sys from fs to fc disables low frequency fc fs
tmp91c820a 2008-02-20 91c820a-23 (2) clock gear controller when the high-frequency clock fc is selected by setting syscr1 = 0, f fph is set according to the contents of the clock gear select register syscr1 to either fc, fc/2, fc/4, fc/8 or fc/16. using the clock gear to select a lower value of f fph reduces power consumption. example 3: changing to a high-frequency gear syscr1 equ 00e1h ld (syscr1), xxxx0000b ; changes f sys to fc/2. ld (syscr1), xxxx0100b ; changes f sys to fc/32. x: don?t care (high-speed clock gear changing) to change the clock gear, write the register value to the syscr1 register. it is necessary the warm-up time until changing after writing the register value. there is the possibility that the instruction next to the clock gear changing instruction is executed by the clock gear before changing. to execute the instruction next to the clock gear switching instruction by the clock gear after changing,input the dummy instruction as follows (instruction to execute the write cycle). (example) syscr1 equ 00e1h ld (syscr1), xxxx0001b ; changes f sys to fc/4. ld (dummy), 00h ; dummy instruction. instruction to be executed after clock gear has changed.
tmp91c820a 2008-02-20 91c820a-24 3.3.4 prescaler clock controller for the internal i/o (tmra01 to tmra23, sio0 to sio1,sbi) there is a prescaler which can divide the clock. the t clock input to the prescaler is either the clock f fph divided by 2 or the clock fc/16 divided by 2. the setting of the syscr0 register determines which clock signal is input. when it?s used internal sbi circuit, register must be set to 00. 3.3.5 clock doubler (dfm) dfm outputs the f dfm clock signal, which is four times as fast as f osch . it can use the low-frequency oscillator, even though the internal clock is high frequency. a reset initializes dfm to stop status, setting to dfmcr0 register is needed before use. like an oscillator, this circuit requires time to stabilize. this is called the lockup time. the following example shows how dfm is used. dfmcr0 equ 00e8h dfmcr1 equ 00e9h ld (dfmcr1), 0bh ; parameter setting. ld (dfmcr0), 01x0xxxxb ; set lockup time to 2 12 /4 mhz. enables dfm operation and starts lockup. lup: bit 5, (dfmcr0) ; jr nz, lup ; detects end of lockup. ld (dfmcr0), 10x0xxxxb ; changes fc from 4 mhz to 16 mhz. x: don?t care 10 01 counts up by f osch during lockup act1 to act0 dfm output: f dfm lockup timer system clock f sys starts dfm operation. starts lockup. ends of lockup changes from 4 mhz to 16 mhz. after lockup note: input frequency limitation and correction for dfm. recommend to use input frequency (high-speed oscillation) for dfm in the following condition. f osch = 4 mhz to 9 mhz (vcc = 2.7 v to 3.6 v): write 0bh to dfmcr1.
tmp91c820a 2008-02-20 91c820a-25 limitation point on the use of dfm 1. it?s prohibited to execute dfm enable/disable control in the slow mode (fs) (write to dfmcr0 = ?10?). you should control dfm in the normal mode. 2. if you stop dfm operation during using dfm (dfmcr0 = ?10?), you shouldn?t execute the commands that change the clock f dfm to f osch and stop the dfm at the same time. therefore the above execution should be separated into two procedures as showing below. ld (dfmcr0), c0h ; change the clock f dfm to f osch . ld (dfmcr0), 00h ; dfm stop. 3. if you stop high-frequency oscillator during using dfm (dfmcr0 = ?10?), you should stop dfm before you stop high-frequency oscillator. examples of settings are below. (1) start up/change control (ok) low-frequency oscillator operation mode (fs) (high-frequency oscillator stop) high-frequency oscillator start up high-frequency oscillator operation mode (f osch ) dfm start up dfm use mode (f dfm ) ld (syscr0), 11 ? ? ? 1 ? ? b ; high-frequency oscillator start-up/warm-up start. wup: bit 2, (syscr0) ; jr nz, wup ; check for the flag of lockup end. ld (syscr1), ? ? ? ? 0 ? ? ? b ; change the system clock f s to f osch . ld (dfmcr0), 01 ? 0 ? ? ? ? b ; dfm start-up/lockup start. lup: bit 5, (dfmcr0) ; jr nz, lup ; check for the flag of lockup end. ld (dfmcr0), 10 ? 0 ? ? ? ? b ; change the system clock. (ok) low-frequency oscillator operation mode (fs) (high-frequency oscillator operate) high-frequency oscillator operation mode (f osch ) dfm start up dfm use mode (f dfm ) ld (syscr1), ? ? ? ? 0 ? ? ? b ; change the system clock fs to f osch . ld (dfmcr0), 01 ? 0 ? ? ? ? b ; dfm start-up/lockup start. lup: bit 5, (dfmcr0) ; jr nz, lup ; check for the flag of lockup end. ld (dfmcr0), 10 ? 0 ? ? ? ? b ; change the system clock f osch to f dfm . (error) low-frequency oscillator operation mode (fs) (high-frequency oscillator stop) high-frequency oscillator start up dfm start up dfm use mode (f dfm ) ld (syscr0), 11 ? ? ? 1 ? ? b ; high-frequency oscillator start-up/warm-up start. wup: bit 2, (syscr0) ; jr nz, wup ; check for the flag of lockup end. ld (dfmcr0), 01 ? 0 ? ? ? ? b ; dfm start-up/lockup start. lup: bit 5, (dfmcr0) ; jr nz, lup ; check for the flag of lockup end. ld (dfmcr0), 10-0 ? ? ? ? b ; change the internal clock f osch to f dfm . ld (syscr1), ? ? ? ? 0 ? ? ? b ; change the system clock f s to f dfm .
tmp91c820a 2008-02-20 91c820a-26 (2) change/stop control (ok) dfm use mode (f dfm ) high-frequency oscillator operation mode (f osch ) dfm stop low-frequency oscillator operation mode (fs) high-frequency oscillator stop ld (dfmcr0), 11 ? ? ? ? ? ? b ; change the system clock f dfm to f osch . ld (dfmcr0), 00 ? ? ? ? ? ? b; dfm stop. ld (syscr1), ? ? ? ? 1 ? ? ? b ; change the system clock f osch to fs. ld (syscr0), 0 ? ? ? ? ? ? ? b ; high-frequency oscillator stop. (error) dfm use mode (f dfm ) low-frequency oscillator operation mode (fs) dfm stop high-frequency oscillator stop ld (syscr1), ? ? ? ? 1 ? ? ? b ; change the system clock f dfm to fs. ld (dfmcr0), 11 ? ? ? ? ? ? b ; change the internal clock (fc) f dfm to f osch . ld (dfmcr0), 00 ? ? ? ? ? ? b; dfm stop. ld (syscr0), 0 ? ? ? ? ? ? ? b ; high-frequency oscillator stop. (ok) dfm use mode (f dfm ) set the stop mode high-frequency oscillator operation mode (f osch ) dfm stop halt (high-frequency oscillator stop) ld (syscr2), ? ? ? ? 01 ? ? b ; set the stop mode. (this command can execute before use of dfm.) ld (dfmcr0), 11 ? ? ? ? ? ? b ; change the system clock f dfm to f osch . ld (dfmcr0), 00 ? ? ? ? ? ? b; dfm stop. halt ; shift to stop mode. (error) dfm use mode (f dfm ) set the stop mode halt (high-frequency oscillator stop) ld (syscr2), ? ? ? ? 01 ? ? b ; set the stop mode. (this command can execute before use of dfm.) halt ; shift to stop mode.
tmp91c820a 2008-02-20 91c820a-27 3.3.6 noise reduction circuits noise reduction circuits are built in, allowing implementation of the following features. (1) reduced drivability for high-frequency oscillator (2) reduced drivability for low-frequency oscillator (3) single drive for high-frequency oscillator (4) runaway provision with sfr protection register (5) runaway provision with rom protection register the above functions are performed by making the appropriate settings in the emccr0 to emccr3 registers. (1) reduced drivability for high-frequency oscillator (purpose) reduces noise and power for oscillator when a resonator is used. (block diagram) (setting method) the drivability of the oscillator is reduced by writing 0 to emccr0 register. by reset, is initialized to 1 and the oscillator starts oscillation by normal drivability when the power supply is on. resonator c2 c1 enable oscillation (stop + emccr0) x1 pin emccr0 f osch x2 pin
tmp91c820a 2008-02-20 91c820a-28 (2) reduced drivability for low-frequency oscillator (purpose) reduces noise and power for oscillator when a resonator is used. (block diagram) (setting method) the drivability of the oscillator is reduced by writing 0 to the emccr0 register. by reset, is initialized to 1. (3) single drive for high-frequency oscillator (purpose) not need twin-drive and protect mistake operation by inputted noise to x2 pin when the external oscillator is used. (block diagram) (setting method) the oscillator is disabled and starts operation as buffer by writing 1 to emccr0 register. x2 pin is always outputted 1. by reset, is initialized to 0. note: do not write emccr0 = ?1? when using external resonator. xt1 pin resonator c2 c1 enable oscillation emccr0 fs xt2 pin x1 pin x2 pin enable oscillation (stop + emccr0) emccr0 f osch
tmp91c820a 2008-02-20 91c820a-29 (4) runaway provision with sfr protection register (purpose) provision in runaway of program by noise mixing. write operation to specified sfr is prohibited so that provision program in runaway prevents that it is it in the state which is fetch impossibility by stopping of clock, memory control register (cs/wait controller, mmu) is changed. and error handling in runaway becomes easy by intp0 interruption. specified sfr list 1. cs/wait controller b0cs, b1cs, b2cs, b3cs, bexcs, msar0, msar1, msar2, msar3, mamr0, mamr1, mamr2, mamr3 2. mmu local0/1/2/3 3. clock gear syscr0, syscr1, syscr2, emccr0, emccr3 4. dfm dfmcr0/1 (operation explanation) execute and release of protection (write operation to specified sfr) become possible by setting up a double key to emccr1 and emccr2 register. (double key) 1st-key: succession writes in 5ah at emccr1 and a5h at emccr2 2nd-key: succession writes in a5h at emccr1 and 5ah at emccr2 a state of protection can be confirmed by reading emccr0. by reset, protection becomes off. and intp0 interruption occurs when write operation to specified sfr was executed with protection on state.
tmp91c820a 2008-02-20 91c820a-30 (5) runaway provision with rom protection register (purpose) provision in runaway of program by noise mixing. (operation explanation) when writes operation was executed for external three kinds of rom by runaway of program, intp1 is occurred and detects runaway function. three kinds of rom is fixed as for flash rom (option program rom), data rom, program rom are as follows on the logical address memory map. 1. flash rom: address 400000h to 7fffffh 2. data rom: address 800000h to bfffffh 3. program rom: address c00000h to ffffffh for these address, admission/prohibition of detection of write operation sets it up with emccr3. and intp1 interruption occurred with which rom area in the case that occurred can confirm each with emccr3. this flag is cleared when write in 0.
tmp91c820a 2008-02-20 91c820a-31 3.3.7 standby controller (1) halt modes when the halt instruction is executed, the operating mode switches to idle2, idle1 or stop mode, depending on the contents of the syscr2 register. the subsequent actions performed in each mode are as follows: a. idle2: only the cpu halts. the internal i/o is available to select operation during idle2 mode by setting the following register. table 3.3.2 shows the registers of setting operation during idle2 mode . table 3.3.2 sfr setting operation during idle2 mode internal i/o sfr tmra01 ta01run tmra23 ta23run tmrb0 tb0run sio0 sc0mod1 sio1 sc1mod1 ad converter admod1 wdt wdmod sbi sbi0br0 b. idle1: only the oscillator and the rtc (real time clock) and mld continue to operate. c. stop: all internal circuits stop operating. the operation of each of the different halt modes is described in table 3.3.3. table 3.3.3 i/o operation during halt modes halt mode idle2 idle1 stop syscr2 11 10 01 cpu stop i/o ports keep the state when the halt instruction was executed. table 3.3.6 and table 3.3.7 tmra,tmrb0 sio, sbi ad converter wdt available to select operation block lcdc, sdramc interrupt controller stop block rtc, mld operate operational available
tmp91c820a 2008-02-20 91c820a-32 (2) how to release the halt mode these halt states can be released by resetti ng or requesting an interrupt. the halt release sources are determined by the combination between the states of interrupt mask register and the halt modes. the details for releasing the halt status are shown in table 3.3.4. released by requesting an interrupt the operating released from the halt mode depends on the interrupt enabled status. when the interrupt request level set before executing the halt instruction exceeds the value of interrupt mask register,the interrupt due to the source is processed after releasing the halt mode, and cpu status executing an instruction that follows the halt instruction. when the interrupt request level set before executing the halt instruction is less than the value of the interrupt mask register, releasing the halt mode is not executed (in non-maskable interrupts, interrupt processing is processed after releasing the halt mode regardless of the value of the mask register). however only for int0 to int3 and intkey and intrtc, intalm0 to intalm4, even if the interrupt request level set before executing the halt instruction is less than the value of the interrupt mask register, releasing the the halt mode is executed. in this case, interrupt processing, and cpu starts executing the instruction next to the halt instruction, but the interrupt request flag is held at 1. note: usually, interrupts can release all halt status. however, the interrupts ( nmi , int0 to int3, intkey, intrtc, intalm 0 to intalm4) which can release the halt mode may not be able to do so if they are input during the period cpu is shifting to the halt mode (for about 5 clocks of f fph ) with idle1 or stop mode (idle2 is not applicable to this case). (in this case, an interrupt request is kept on hold internally.) if another interrupt is generated after it has shifted to the halt mode completely, halt status can be released without difficulty. the priority of this interrupt is compared with that of the interrupt kept on hold internally, and the interrupt with higher priority is handled first followed by the other interrupt. ? releasing by resetting releasing all halt status is executed by resetting. when the stop mode is released by rese t, it is necessry enough resetting time (see table 3.3.5) to set the operation of the oscillator to be stable. when releasing the halt mode by resetting, the internal ram data keeps the state before the halt instruction is executed. however the other settings contents are initialized. (releasing due to interrupts keeps the state before the halt instruction is executed.)
tmp91c820a 2008-02-20 91c820a-33 table 3.3.4 source of halt state clearance and halt clearance operation status of received interrupt interrupt enabled (interrupt level) (interrupt mask) interrupt disabled (interrupt level) < (interrupt mask) halt mode idle2 idle1 stop idle2 idle1 stop nmi ? ? ? * 1 ? ? ? intwdt ? ? ? ? int0 to int3 (note 1) ? ? ? * 1 * 1 intalm0 to intalm4 ? ? intta0 to intta3, inttb00 to inttb01 ? intrx0 to intrx2, tx0 to tx2 ? intss0 to intss2 ? intad ? intkey ? ? ? * 1 * 1 intrtc ? ? intsbi ? interrupt intlcd ? source of halt state clearance reset initialize lsi. ? : after clearing the halt mode, cpu starts interrupt processing. : after clearing the halt mode, cpu resumes executing starting from instruction following the halt instruction. : it can not be used to release the halt mode . ? : the priority level (interrupt request level) of non-maskable interrupts is fixed to 7, the highest priority level. there is not this combination type. * 1: releasing the halt mode is executed after passing the warm-up time. note: when the halt mode is cleared by an int0 interrupt of the level mode in the interrupt enabled status, hold level h until starting interrupt processing. if level l is set before holding level l, interrupt processing is correctly started. (example releasing idle1 mode) an int0 interrupt clears the halt state when the device is in idle1 mode. address 8200h ld (pbfc), 08h ; sets pb3 to int0. 8203h ld (iimc), 00h ; selects int0 interrupt rising edge. 8206h ld (inte0ad), 06h ; sets int0 interrupt level to 6. 8209h ei 5 ; sets interrupt level to 5 for cpu. 820bh ld (syscr2), 88h ; sets halt mode to idle1 mode. 820eh halt ; halts cpu. int0 int0 interrupt routine reti 820fh ld xx, xx
tmp91c820a 2008-02-20 91c820a-34 (3) operation a. idle2 mode in idle2 mode only specific internal i/o operations, as designated by the idle2 setting register, can take place. instruction execution by the cpu stops. figure 3.3.6 illustrates an example of the timing for clearance of the idle2 mode halt state by an interrupt. x1 a0 to a23 d0 to d15 data data idle2 mode interrupt fo r release rd wr figure 3.3.6 timing chart for idle2 mode halt state cleared by interrupt b. idle1 mode in idle1 mode, only the internal oscillator and the rtc, mld continue to operate. the system clock in the mcu stops. the pin status in the idle1 mode is depended on setting the register syscr2.,table 3.3.6 and table 3.3.7 summarizes the state of these pins in the idle1 mode. in the halt state, the interrupt request is sampled asynchronously with the system clock; however, clearance of the halt state (e.g., restart of operation) is synchronous with it. figure 3.3.7 illustrates the timing for clearance of the idle1 mode halt state by an interrupt. x1 a0 to a 23 rd wr interrup t for release idle1 mode d0 to d15 data data figure 3.3.7 timing chart for idle1 mode halt state cleared by interrupt
tmp91c820a 2008-02-20 91c820a-35 c. stop mode when stop mode is selected, all internal circuits stop, including the internal oscillator pin status in stop mode depends on the settings in the syscr2 register. table 3.3.6, table 3.3.7 summarizes the state of these pins in stop mode. after stop mode has been cleared system clock output starts when the warm-up time has elapsed, in order to allow oscillation to stabilize. after stop mode has been cleared, either normal mode or slow mode can be selected using the syscr0 register. therefore, , and must be set see the sample warm-up times in table 3.3.5. figure 3.3.8 illustrates the timing for clearance of the stop mode halt state by an interrupt. figure 3.3.8 timing chart for stop mode halt state cleared by interrupt table 3.3.5 sample warm-up times after clearance of stop mode at f osch = 36 mhz, fs = 32.768 khz syscr2 syscr0 01 (2 8 ) 10 (2 14 ) 11 (2 16 ) 0 (fc) 7.1 s 0.455 ms 1.820 ms 1 (fs) 7.8 ms 500 ms 2000 ms stop mode interrupt for release warm-up time x1 a0 to a23 rd wr d0 to d15 data data
tmp91c820a 2008-02-20 91c820a-36 (setting example) the stop mode is entered when the low frequency operates, and high frequency operates after releasing due to nmi. address syscr0 equ 00e0h syscr1 equ 00e1h syscr2 equ 00e2h 8ffdh ld (syscr1), 08h ; f sys = fs/2. 9000h ld (syscr2), ? x1001x1b ; sets warm-up time to 2 14 /f osch . 9002h ld (syscr0), 011000 ? ? b ; operates high-frequency after released. 9005h halt nmi 9006h ld xx, xx reti ? : no change note: when different m odes are used before and after stop mode as the above mentioned, there is possible to release the halt mode without changing the operation mode by acceptance of the halt release interrupt request during execution of halt instruction (during 6 state). in the system which accepts the interrupts during execution halt instruction, set the same operation mode before and after the stop mode. clears and starts hit warm-up timer (high frequency) end nmi interrupt routine
tmp91c820a 2008-02-20 91c820a-37 table 3.3.6 input buffer state table (1/2) input buffer state in halt mode(idle1/stop) when the cpu is operating in halt mode (idle2) condition a (note) condition b (note) port name input function name during reset when used as function pin when used as input port when used as function pin when used as input port when used as function pin when used as input port when used as function pin when used as input port p00-p07 d0-d7 off on upon port read p10-p17 d8-d15 8bit start: off 16bit start: on built-in rom start: on on upon external read on upon external read of lcdc off off p20-p27 ? p30-p37 ? p40-p47 ? 8bit start: off 16bit start: off built-in rom start: on pz2 (*1) ? pz3 (*1) ? ? ? off ? ? off p56 (*1) wait p70 sck, optrx0 p71 sda off p72 si, scl on on on on p73 ? p74 ? p75 ? ? ? ? ? p76 msk on on on off on p77 ? on on on on p80 (*2) ? p81 (*2) ? p82 (*2) ? ? ? ? ? p83 (*2) adtrg on on on on p84 (*2) ? p85 (*2) ? p86 (*2) ? p87 (*2) ? off ? on upon port read ? off ? off ? off p90 (*1) ki0 p91 (*1) ki1 p92 (*1) ki2 p93 (*1) ki3 p94 (*1) ki4 p95 (*1) ki5 p96 (*1) ki6 p97 (*1) ki7 on on pb0 ta0in pb1 rxd2 off off pb3 int0 on on on pb4 int1 pb5 int2 pb6 int3 on on on on off on off on off
tmp91c820a 2008-02-20 91c820a-38 input buffer state table (2/2) input buffer state in halt mode(idle1/stop) when the cpu is operating in halt mode (idle2) condition a (note) condition b (note) port name input function name during reset when used as function pin when used as input port when used as function pin when used as input port when used as function pin when used as input port when used as function pin when used as input port pb0 ta0in pb1 rxd2 off off pb3 int0 on on on pb4 int1 pb5 int2 pb6 int3 on on off on on off pc0 ? ? ? ? ? pc1 rxd0 pc2 sclk0, cts0 on on off on pc3 ? ? ? ? ? pc4 rxd1 pc5 sclk1, cts1 on on on off on on pe0-pe7 ? ? on ? off ? off ? off nmi/ps ? reset (*1) ? am0, am1 ? on ? on ? x1, xt1 ? on on ? on ? idle1: on, stop: off *1: port having a pull-up/pull-down resistor. on: the buffer is always turned on. a current flows the input buffer if the input pin is not driven. *2: ain input does not cause a current to flow through the buffer. off: the buffer is always turned off. ? : no applicable note: condition a/b are as follows. syscr2 register setting halt mode idle1 stop 0 0 condition a 0 1 condition a 1 0 1 1 condition b condition b
tmp91c820a 2008-02-20 91c820a-39 table 3.3.7 output buffer state table (1/2) output buffer state in halt mode (idle1/stop) when the cpu is operating in halt mode (idle2) condition a (note) condition b (note) port name output function name during reset when used as function pin when used as output port when used as function pin when used as output port when used as function pin when used as output port when used as function pin when used as output port p00-p07 d0-d7 p10-p17 d8-d15 off on upon external read off off p20-p27 a16-a23 p30-p37 a8-a15 p40-p47 a0-a7 8bit start: on 16bit start: on built-in rom start: off pz0 rd pz1 wr on pz2 hwr pz3 r/w, srwe on on off on p56 ? off (*1) ? ? ? ? p60 cs0 p61 cs1, sdcs p62 cs2, cs2a p63 cs3 p64 ea24, cs2b p65 ea25, cs2c p66 cs2d, srlb p67 cs2e, srub on p70 sck p71 so, sda, opttx0 p72 scl p73 cs2f p74 cs2g p75 csexa on on off on p76 ? ? ? ? ? p77 veeclk pa0 ko0 pa1 ko1 pa2 ko2 pa3 ko3 pa4 ko4 pa5 ko5 pa6 ko6 pa7 ko7 off on on on on off off on on
tmp91c820a 2008-02-20 91c820a-40 output buffer state table (1/2) output buffer state in halt mode (idle1/stop) when the cpu is operating in halt mode (idle2) condition a (note) condition b (note) port name output function name during reset when used as function pin when used as output port when used as function pin when used as output port when used as function pin when used as output port when used as function pin when used as output port pb0 txd2 pb1 ta1out on on off on pb3 ? pb4 ? ? ? ? ? pb5 ta3out pb6 tb0out0 pc0 txd0 on on off on pc1 ? ? ? ? ? pc2 sclk0 pc3 txd1 on on off on pc4 ? ? ? ? ? pc5 sclk1 off pd0 d1bscp pd1 d2blp pd2 d3bfr pd3 dlebcd pd4 doffb pd6 alarm, mldalm pd7 mldalm on pe0-7 ld0-ld7 off pf0 sdras pf1 sdcas pf2 sdwe pf3 sdldqm pf4 sdudqm off pf5 sdcke on in self refresh cycle pf6 sdclk on on off off on on x2, xt2 ? on on ? on ? idle1: on, stop: output ?h? level on: the buffer is always turned on. off: the buffer is always turned off. ? : no applicable note: condition a/b are as follows. syscr2 register setting halt mode idle1 stop 0 0 condition a 0 1 condition a 1 0 1 1 condition b condition b
tmp91c820a 2008-02-20 91c820a-41 3.4 interrupts interrupts are controlled by the cpu interrupt mask register sr and by the built-in interrupt controller. the tmp91c820a has a total of 43 interrupts divided into the following 5 types: ? interrupts generated by cpu: 9 sources (software interrupts, illegal instruction interrupt) ? internal interrupts: 28 sources ? interrupts on external pins ( nmi and int0 to int3, intkey): 6 sources a (fixed) individual interrupt vector number is assigned to each interrupt. one of six (variable) priority levels can be assigned to each maskable interrupt. the priority level of non-maskable interrupts is fixed at 7, the highest level. when an interrupt is generated, the interrupt controller sends the piority of that interrupt to the cpu. if multiple interrupts are generated simultaneously,the interrupt controller sends the interrupt with the highest priority to the cpu. (the highest priority possible is level 7, used for non-maskable interrupts.) the cpu compares the priority level of the interrupt with the value of the cpu interrupt mask register . if the priority level of the interrupt is higher than the value of the interrupt mask register, the cpu accepts the interrupt. however, software interrupts and illegal instruction interrupts generated by the cpu are processed without comparison with the value. the interrupt mask register value can be updated using the value of the ei instruction (executing ei num sets the content of to num). for example, specifying ei3 enables the acceptance of maskable interrupts whose priority level set in the interrupt controller is 3 or higher, and enables the acceptan ce of non-maskable interrupts. however, if ei or ei0 is specified, maskable interrupts with a priority level of 1 or higher and non-maskable interrupts are accepted (operationally identical to ?ei? 1). operationally, the di instruction ( is 7) is identical to the ei 7 instruction, but as the priority level of maskable interrupts is 1 to 6, the di instruction is used to dasable maskable interrupt. the ei instruction is vaild immediately after execution begins. (with tlcs-90, the ei instruction is vaild after execution of the instruction following the ei insutruction.) in addition to the general-purpose interrupt processing mode described above, tlcs-900/l1 interrupts have a micro dma processing mode as well. because the cpu transfers (byte transfer, or 4-byte transfer) automatically in micro dma mode, this mode can be used for speeding up interrupt processing, such as transferring data to i/o. tmp91c820a also has a micro dma soft start function for requesting micro dma processing by software not by interrupt. figure 3.4.1 shows the overall interrupt processing flow.
tmp91c820a 2008-02-20 91c820a-42 figure 3.4.1 interrupt and micro dma processing sequence general-purpose interrupt processing interrupt specified by micro dma start vector? yes interrupt processing push pc push sr sr level of accepted interrupt + 1 intnest intnest + 1 end pc (ffff00h + v) interrupt processing program count count ? 1 count = 0 no yes no micro dma processing reti instruction pop sr pop pc intnest intnest ? 1 clear vector register generating micro dma transfer and interrupt (inttc0 to inttc3) clear interrupt request flag interrupt vector value ?v? read interrupt request f/f clear micro dma soft start request data transfer by micro dma
tmp91c820a 2008-02-20 91c820a-43 3.4.1 general-purpose interrupt processing when the cpu accepts an interrupt, it usua lly performs the following sequence of operations. however, in the case of software interrupts and illegal instruction interrupts generated by the cpu, the cpu skips steps a and c and executes only steps b, d and e. a. the cpu reads the interrupt vector from the interrupt controller. if there are simultaneous interrupts set to same level, the interrupt controller generates an interrupt vector in accordance with the default priority and clears the interrupt request. (the default priority is already fixed for each interrupt: the smaller the vector value, the higher the priority level.) b. the cpu pushes the program counter (pc) and status register (sr) onto the top of the stack (pointed to by xsp). c. the cpu sets the value of the cpu?s in terrupt mask register to the priority level for the accepted interrupt plus 1. however, if the priority level for the accepted interrupt is 7, the register?s value is set to 7. d. the cpu increments the interrupt nesting counter intnest by 1. e. the cpu jumps to the address indicated by the data at address ffff00h + interrupt vector, and starts the interrupt processing routine. the above processing time is 18 states (1.00 s at 36 mhz) as the best case (16-bit data bus width and 0 waits). when the cpu completed the interrupt processing, use the reti instruction to return to the main routine. reti restores the conten ts of the program counter and the status register from the stack and decrements the interrupt nesting counter intnest by 1. non-maskable interrupts cannot be disabled by a user program. maskable interrupts, however, can be enabled or disabled by a user program. a program can set the priority level for each interrupt source. (a priority level setting of 0 or 7 will disable an interrupt request.) if an interrupt request is received for an interrupt with a priority level equal to or greater than the value set in the cpu interrupt mask register , the cpu will accept the interrupt. the cpu interrupt mask register is then set to the value of the priority level for the accepted interrupt plus 1. if, during interrupt processing, an interrupt is generated with a higher level than the interrupt begin currently processed, or if, during non-maskable interrupt processing, a non-maskable interrupt request is generated from another source, the cpu suspends the currently processing routine and accepts the later interrupt. then, after the cpu finished processing the later interrupt, the cpu return s to the interrupt it previously suspended and resumes processing. if the cpu receives a request for another interrupt while performing processing steps a to e, the second interrupt is sampled immediately after execution of the first instruction for its interrupt processing routine. specifying di as the start instruction disables maskable interrupt nesting. (note: in the 900 and 900/l , sampling is performed before execution of the start instruction.) a reset initializes the interrupt mask register to 111, disabling all maskable interrupts. table 3.4.1 shows the tmp91c820a interrupt vectors and micro dma start vectors. ffff00h to ffffffh (256 bytes) is designated as the interrupt vector area.
tmp91c820a 2008-02-20 91c820a-44 table 3.4.1 tmp91c820a interrupt vectors and micro dma start vectors default priority type interrupt source and source of micro dma request vector value (v) vector reference address micro dma start vector 1 ?reset? or ?swi0? instruction 0000h ffff00h ? 2 ?swi1? instruction 0004h ffff04h ? 3 intundef: illegal instruction or ?swi2? instruction 0008h ffff08h ? 4 ?swi3? instruction 000ch ffff0ch ? 5 ?swi4? instruction 0010h ffff10h ? 6 ?swi5? instruction 0014h ffff14h ? 7 ?swi6? instruction 0018h ffff18h ? 8 ?swi7? instruction 001ch ffff1ch ? 9 nmi pin 0020h ffff20h ? 10 non- maskable intwd: watchdog timer 0024h ffff24h ? ? (micro dma) ? ? ? 11 int0 pin 0028h ffff28h 0ah 12 int1 pin 002ch ffff2ch 0bh 13 int2 pin 0030h ffff30h 0ch 14 int3 pin 0034h ffff34h 0dh 15 intalm0: alm0 (8 khz) 0038h ffff38h 0eh 16 intalm1: alm1 (512 hz) 003ch ffff3ch 0fh 17 intalm2: alm2 (64 hz) 0040h ffff40h 10h 18 intalm3: alm3 (2 hz) 0044h ffff44h 11h 19 intalm4: alm4 (1 hz) 0048h ffff48h 12h 20 intta0: 8-bit timer 0 004ch ffff4ch 13h 21 intta1: 8-bit timer 1 0050h ffff50h 14h 22 intta2: 8-bit timer 2 0054h ffff54h 15h 23 intta3: 8-bit timer 3 0058h ffff58h 16h 24 intrx0: serial receives (channel 0) 005ch ffff5ch 17h 25 inttx0: serial transmission (channel 0) 0060h ffff60h 18h 26 intrx1: serial receives (channel 1) 0064h ffff64h 19h 27 inttx1: serial transmission (channel 1) 0068h ffff68h 1ah 28 intad: ad conversion end 006ch ffff6ch 1bh 29 intkey: key-on wakeup 0070h ffff70h 1ch 30 intrtc: rtc (alarm interrupt) 0074h ffff74h 1dh 31 intsbi: sbi interrupt 0078h ffff78h 1eh 32 intlcd: lcdc/lp pin 007ch ffff7ch 1fh 33 intp0: protect 0 (wr to special sfr) 0080h ffff80h 20h 34 intp1: protect 1 (wr to rom) 0084h ffff84h 21h 35 inttc0: micro dma end (channel 0) 0088h ffff88h ? 36 inttc1: micro dma end (channel 1) 008ch ffff8ch ? 37 inttc2: micro dma end (channel 2) 0090h ffff90h ? 38 inttc3: micro dma end (channel 3) 0094h ffff94h ? 39 reserved ? ? ? 40 reserved ? ? ? 41 reserved ? ? ? 42 intrx2: serial receive (channel 2) 00a4h ffffa4h 29h 43 inttx2: serial transmission (channel 2) 00a8h ffffa8h 2ah 44 inttb00: 16-bit timer 0 (tb0rg0) 00ach ffffach 2bh 45 inttb01: 16-bit timer 1 (tb0rg1) 00b0h ffffb0h 2ch maskable (reserved) to (reserved) 00b4h to 00fch ffffb4h to fffffch ? to ?
tmp91c820a 2008-02-20 91c820a-45 3.4.2 micro dma processing in addition to general-purpose interrupt processing, the tmp91c 820a supprots a micro dma function. interrupt requests set by micr o dma perform micro dma processing at the highest priority level for maskable interrupts (l evel 6), regardless of the priority level of the particular interrupt source. because the micro dma function has been im plemented with the cooperative operation of cpu, when cpu is a state of standby by halt instruction, the requirement of micro dma will be ignored (pending). (1) micro dma operation when an interrupt request is generated by an interrupt source specified by the micro dma start vector register, the micro dma triggers a micro dma request to the cpu at interrupt priority level 6 and starts processing the request. the four micro dma channels allow micro dma processing to be set for up to four types of interrupts at any one time. when micro dma is accepted, the interrupt request flip-flop assigned to that channel is cleared. the data are automatically transferred from the transfer source address to the transfer destination address set in the control register, and the transfer counter is decremented by 1. if the decr emented counter reads other than 0, dma processing ends with no change in the valu e of the micro dma start vector register. if the decremented reading is 0, the micro dma transfer end interrupt (inttc0 to inttc3) passes from the cpu to the interru pt controller. in addition, the micro dma start vector register is cleared to 0, the next micro dma is disabled and micro dma processing completes. if a micro dma request is set for more than one channel at a time, the priority is not based on the interrupt priority level but on the channel number: the smaller the channel number the higher the priority (channel 0 (high) channel 3 (low)). if an interrupt request is triggered for the interrupt source in use during the interval between the clearing of the micro dma start vector and the next setting, general-purpose interrupt processing executes at the interrupt level set. therefore, if only using the interrupt for starting the micro dma (not using the interrupts as a general-purpose interrupt), first set the in terrupts level to 0 (interrupt requests disabled). if using micro dma and general-purpose interrupts together as described above, first set the level of the interrupt used to start micro dma processing lower than all the other interrupt levels. in this case, the cause of general interrupt is limited to the edge interrupt. (note) as with other maskable interrupts, the priority of the micro dma transfer end interrupts is determined by the interrupt level and by the default priority. note: if the priority level of micro dma is set higher than that of other interrupts, cpu operates as follows. in case intxxx interrupt is generated first and t hen intyyy interrup t is generated between checking ?interrupt specified by micro dma start vector? (in the figure 3.4.1) and reading interrupt vector with setting below. the vector shifts to that of intyyy at the time. this is because the priority level of intyyy is higher than that of intxxx. in the interrupt routine, cpu reads the vector of intyyy because cheking of micro dma has finished. and intyyy is generated regardless of transfer counter of micro dma. intxxx: level 1 without micro dma intyyy: level 6 with micro dma
tmp91c820a 2008-02-20 91c820a-46 while the register for setting the transfer source/transfer destination addresses is a 32-bit control register, this register can only effectively output 24-bit addresses. accordingly, micro dma can access 16 mbytes (the upper 8 bits of the 32 bits are not valid). three micro dma transfer modes are supported: 1-byte transfer, 2-byte (one-word) transfer, and 4-byte transfer. after a transfer in any mode, the transfer source/destination addresses are incremented, decremented, or remain unchanged. this simplifies the transfer of data from i/o to memory, from memory to i/o, and from i/o to i/o. for details of the transfer modes, see 3.4.2 (4) ?detailed description of the transfer mode register?. as the transfer counter is a 16-bit counter, micro dma processing can be set for up to 65536 times per interrupt source. (the micro dma processing count is maximized when the transfer counter initial value is set to 0000h.) micro dma processing can be started by the 31 interrupts shown in the micro dma start vectors of table 3.4.1 and by the micro dma soft start, making a total of 32 interrupts. figure 3.4.2 shows the word transfer micro dma cycle in transfer destination address inc mode (except for counter mode, the same as for other modes). (the conditions for this cycle are based on an external 16-bit bus, 0 waits, transfer source/transfer destination addresses both even-numberd values). output input transfer destination address one state d0 to d15 x1 a0 to a23 dm1 dm2 dm3 dm4 dm5 dm6 dm7 dm8 (note 1) (note 2) rd wr / hwr transfer source address figure 3.4.2 timing for micro dma cycle states 1 to 3: instruction fetch cycle (gets next address code). if three or more instruction codes are inserted in the instruction queue buffer, this cycle becomes a dummy cycle. states 4 to 5 : micro dma read cycle. state 6 : dummy cycle (the address bus remains unchanged from state 5). states 7 to 8 : micro dma write cycle. note 1: if the source address area is an 8-bit bus, it is incremented by two states. if the source address area is a 16-bit bus and the address starts from an odd number, it is incremented by two states. note 2: if the destination address area is an 8-bit bus, it is incremented by two states. if the destination address area is a 16-bit bus and the address starts from an odd number, it is incremented by two states.
tmp91c820a 2008-02-20 91c820a-47 (2) soft start function in addition to starting the micro dma function by interrupts, tmp91c820a includes a micro dma software start function that starts micro dma on the generation of the write cycle to the dmar register. writing 1 to each bit of dmar register causes micro dma once (if write ?0? to each bit, micro dma doesn?t operate). at the end of transfer, the corresponding bit of the dmar register which support the end ch annel are automatically cleared to 0. only one channel can be set for dma request at once. (do not write 1 to plural bits) when writing again 1 to the dmar regist er, check whether the bit is 0 before writing 1. if read ?1?, micro dma transfer isn?t started yet. when a burst is specified by dmab register, data is continuously transferred until the value in the micro dma transfer counter is 0 after start up of the micro dma. if execute soft start during micro dma transfer by interrupt source, micro dma transfer counter doesn?t change. don?t use read-modif y-write instruction to avoid writing to other bits by mistake. symbol name address 7 6 5 4 3 2 1 0 dma request dmar3 dmar2 dmar1 dmar0 r/w dmar dma request register 89h (prohibit rmw) 0 0 0 0 (3) transfer control registers the transfer source address and the transfer destination address are set in the following registers. an instruction of the form ?ldc cr, r? can be used to set these registers. channel 0 dmas0 dma source address register 0. dmad0 dma destination address register 0. dmac0 dma counter register 0. dmam0 dma mode register 0. channel 3 dmas3 dma source address register 3. dmad3 dma destination address register 3. dmac3 dma counter register 3. dmam3 dma mode register 3. 8 bits 16 bits 32 bits
tmp91c820a 2008-02-20 91c820a-48 (4) detailed description of the transfer mode register 8 bits 0 0 0 mode number of transfer bytes mode description number of execution states ( * ) minimum execution time at fc = 36 mhz 000 (fixed) 000 00 byte transfer 8 states 444 ns 01 word transfer 10 4-byte transfer transfer destination address inc mode ................................................. i/o to memory (dmadn + ) (dmasn) dmacn dmacn ? 1 if dmacn = 0, then inttcn is generated. 12 sates 667 ns 001 00 byte transfer 8 states 444 ns 01 word transfer 10 4-byte transfer transfer destination address dec mode ................................................. i/o to memory (dmadn ? ) (dmasn) dmacn dmacn ? 1 if dmacn = 0, then inttcn is generated. 12 sates 667 ns 010 00 byte transfer 8 states 444 ns 01 word transfer 10 4-byte transfer transfer source address inc mode ................................................. memory to i/o (dmadn) (dmasn + ) dmacn dmacn ? 1 if dmacn = 0, then inttcn is generated. 12 sates 667 ns 011 00 byte transfer 8 states 444 ns 01 word transfer 10 4-byte transfer transfer source address dec mode ................................................. memory to i/o (dmadn) (dmasn ? ) dmacn dmacn ? 1 if dmacn = 0, then inttcn is generated. 12 sates 667 ns 100 00 byte transfer 8 states 444 ns 01 word transfer 10 4-byte transfer fixed address mode ......................................................... i/o to i/o (dmadn) (dmasn ? ) dmacn dmacn ? 1 if dmacn = 0, then inttcn is generated. 12 sates 667 ns 101 00 counter mode .....................for counting number of times interrupt is generated. dmasn dmasn + 1 dmacn dmacn ? 1 if dmacn = 0, then inttcn is generated. 5 sates 278 ns note: when setting a value in this register, write 0 to the upper three bits. dmam0 to dmam3 ( * ) for external 16-bit bus, 0 waits, word/4-byte transfer mode, transfer source/transfer destination addresses both have even-numbered values. note: n: corresponding micro dma channels 0 to 3. dmadn + /dmasn + : post increment (increments register value after transfer). dmadn ? /dmasn ? : post decrement (decrements register value after transfer). the i/os in the table mean fixed address; memory means increment and decrement addresses. do not use undefined code, that is, codes other than those listed above for the transfer mode register.
tmp91c820a 2008-02-20 91c820a-49 3.4.3 interrupt controller operation the block diagram in figure 3.4.3 shows the interrupt circuits. the left-hand side of the diagram shows the interrupt controller circuit. the right-hand side shows the cpu interrupt request signal circuit and the halt release circuit. for each of the 36 interrupt channels there is an interrupt request flag (consisting of a flip-flop), an interrupt priority setting register and a micro dma start vector register. the interrupt request flag latches interrupt requests from the peripherals. the flag is cleared to zero in the following cases: when reset occurs, when the cpu reads the channel vector of an interrupt it has received, when the cpu receives a micro dma request (when micro dma is set), when the micro dma burst transfer is terminated, and when an instruction that clears the interrupt for that channel is executed (by writing 0 to the clear bit in the interrupt priority setting register). an interrupt priority can be set independently for each interrupt source by writing the priority to the interrupt priority setting register (e.g., inte0ad or inte12). six interrupt priorities levels (1 to 6) are provided. setting an interrupt source?s priority level to 0 (or 7) disables interrupt requests from that source. the priority of non-maskable interrupts (nmi pin interrupts and watchdog timer interrupts) is fixed at 7. if interrupt request with the same level are generated at the same time, the default priority (the interrupt with the lowest priority or, in other words, the interrupt with the lowest vector value) is used to determine which interrupt request is accepted first. the 3rd and 7th bits of the interrupt priority setting register indicate the state of the interrupt request flag and thus whether an interrupt request for a given channel has occurred. the interrupt controller sends the interrupt request with the highest priority among the simulateous interrupts and its vector address to the cpu. the cpu compares the priority value et in the status register by the interrupt request signal with the priority value set; if the latter is higher, the interrupt is accepted. then the cpu sets a value higher than the priority value by 1 in the cpu sr. interrupt request where the priority value equals or is higher th an the set value are accepted simultaneously during the previous interrupt routine. when interrupt processing is completed (after execution of the reti instruction), the cpu restores the priority value saved in the stack before the interrupt was generated to the cpu sr. the interrupt controller also has four registers used to store the micro dma start vector. writing the start vector of the interrupt source for the micro dma processing (see table 3.4.1), enables the corres ponding interrupt to be processed by micro dma processing. the values must be set in the micro dma parameter register (e.g., dmas and dmad) prior to the micro dma processing.
tmp91c820a 2008-02-20 91c820a-50 interrupt request signal to cpu if iff = 7 then 0 micro dma start vector setting register reserved intrx2 inttx2 inttb00 inttb01 v = a4h v = a8h v = ach v = b0h soft start 6 inttc0 during idle1 36 3 3 3 1 6 1 7 2 2 4 6 34 4 input or int0 to int3, intkey, intrtc, intalm micro dma channel priority encoder priority encoder dma0v dma1v dma2v dma3v reset interrupt request f/f reset decoder reset priority setting register v = 20h v = 24h interrupt controller cpu s q r v = 28h v = 2ch v = 30h v = 34h v = 38h v = 3ch v = 40h v = 44h v = 48h v = 4ch d q clr y1 y2 y3 y4 y5 y6 a b c dn dn + 1 dn + 2 interrupt request f/f interrupt vector read micro dma acknowledge interrupt request f/f dn + 3 a b c interrupt vector read d2 d3 d4 d5 d6 d7 selector s q r 0 1 2 3 a b d0 d1 interrupt vector read interrupt mask f/f micro dma request halt release nmi if intrq2 to 0 iff2 to 0 then 1. intrq2 to intrq0 iff2:0 interrupt level detect reset ei1 to 7 di interrupt request signal during stop micro dma channel specification reset nmi intwd int0 int1 int2 int3 intalm0 intalm1 intalm2 intalm3 intalm4 intta0 s interrupt vector generator highest priority interrupt level select 1 2 3 4 5 6 7 d5 d4 d3 d2 d1 d0 d q clr figure 3.4.3 block diagram of interrupt controller
tmp91c820a 2008-02-20 91c820a-51 (1) interrupt level setting registers symbol name address 7 6 5 4 3 2 1 0 intad int0 iadc iadm2 iadm1 iadm0 i0c i0m2 i0m1 i0m0 r r/w r r/w inte0ad int0 and intad enable 90h 0 0 0 0 0 0 0 0 int2 int1 i2c i2m2 i2m1 i2m0 i1c i1m2 i1m1 i1m0 r r/w r r/w inte12 int1 and int2 enable 91h 0 0 0 0 0 0 0 0 intalm4 int3 ia4c ia4m2 ia4m1 ia4m0 i3c i3m2 i3m1 i3m0 r r/w r r/w inte3alm4 int3 and intalm4 enable 92h 0 0 0 0 0 0 0 0 intalm1 intalm0 ia1c ia1m2 ia1m1 ia1m0 ia0c ia0m2 ia0m1 ia0m0 r r/w r r/w intealm01 intalm0 and intalm1 enable 93h 0 0 0 0 0 0 0 0 intalm3 intalm2 ia3c ia3m2 ia3m1 ia3m0 ia2c ia2m2 ia2m1 ia2m0 r r/w r r/w intealm23 intalm2 and intalm3 enable 94h 0 0 0 0 0 0 0 0 intta1 (tmra1) intta0 (tmra0) ita1c ita1m2 ita1m1 ita1m0 ita0c ita0m2 ita0m1 ita0m0 r r/w r r/w inteta01 intta0 and intta1 enable 95h 0 0 0 0 0 0 0 0 intta3 (tmra3) intta2 (tmra2) ita3c ita3m2 ita3m1 ita3m0 ita2c ita2m2 ita2m1 ita2m0 r r/w r r/w inteta23 intta2 and intta3 enable 96h 0 0 0 0 0 0 0 0 intkey intrtc ikc ikm2 ikm1 ikm0 irc irm2 irm1 irm0 r r/w r r/w intertckey intrtc and intkey enable 97h 0 0 0 0 0 0 0 0 inttx0 intrx0 itx0c itx0m2 itx0m1 itx0m0 irx0c irx0m2 irx0m1 irx0m0 r r/w r r/w intes0 interrupt enable serial 0 98h 0 0 0 0 0 0 0 0 interrupt request flag lxxm2 lxxm1 lxxm0 function (write) 0 0 0 disables interrupt requests 0 0 1 sets interrupt priority level to 1 0 1 0 sets interrupt priority level to 2 0 1 1 sets interrupt priority level to 3 1 0 0 sets interrupt priority level to 4 1 0 1 sets interrupt priority level to 5 1 1 0 sets interrupt priority level to 6 1 1 1 disables interrupt requests
tmp91c820a 2008-02-20 91c820a-52 symbol name address 7 6 5 4 3 2 1 0 inttx1 intrx1 itxt1c itx1m2 itx1m1 itx1m0 irx1c irx1m2 irx1m1 irx1m0 r r/w r r/w intes1 intrx1 and inttx1 enable 99h 0 0 0 0 0 0 0 0 intlcd intsbi ilcd1c ilcdm2 ilcdm1 ilcdm0 isbic isbim2 isbim1 isbim0 r r/w r r/w intes2lcd intsbi and intlcd enable 9ah 0 0 0 0 0 0 0 0 inttc1 inttc0 itc1c itc1m2 itc1m1 itc1m0 itc0c itc0m2 itc0m1 itc0m0 r r/w r r/w intetc01 inttc0 and inttc1 enable 9bh 0 0 0 0 0 0 0 0 inttc3 inttc2 itc3c itc3m2 itc3m1 itc3m0 itc2c itc2m2 itc2m1 itc2m0 r r/w r r/w intetc23 inttc2 and inttc3 enable 9ch 0 0 0 0 0 0 0 0 intp1 intp0 ip1c ip1m2 ip1m1 ip1m0 ip0c ip0m2 ip0m1 ip0m0 r r/w r r/w intep01 intp0 and intp1 enable 9dh 0 0 0 0 0 0 0 0 inttx2 intrx2 itx2c itx2m2 itx2m1 itx2m0 irx2c irx2m2 irx2m1 irx2m0 r r/w r r/w intes3 intrx2 and inttx2 enable a0h 0 0 0 0 0 0 0 0 inttb01 inttb00 itb1c itb1m2 itb1m1 itb1m0 itb0c itb0m2 itb0m1 itb0m0 r r/w r r/w intetb0 inttb00 and inttb01 enable a1h 0 0 0 0 0 0 0 0 interrupt request flag lxxm2 lxxm1 lxxm0 function (write) 0 0 0 disables interrupt requests 0 0 1 sets interrupt priority level to 1 0 1 0 sets interrupt priority level to 2 0 1 1 sets interrupt priority level to 3 1 0 0 sets interrupt priority level to 4 1 0 1 sets interrupt priority level to 5 1 1 0 sets interrupt priority level to 6 1 1 1 disables interrupt requests
tmp91c820a 2008-02-20 91c820a-53 (2) external interrupt control symbol name address 7 6 5 4 3 2 1 0 ? ? i3edge i2edge i1edge i0edge i0le nmiree w 0 0 0 0 0 0 0 0 iimc interrupt input mode control 8ch (prohibit rmw) always write ?0?. always write ?0?. int3edge 0: rising 1: falling int2edge 0: rising 1: falling int1edge 0: rising 1: falling int0edge 0: rising 1: falling 0: int0 edge mode 1: int0 level mode 1: operates even on rising/ falling edge of nmi int0 level enable 0 edge detect int 1 h level int nmi rising edge enable 0 int request generation at falling edge 1 int request generation at rising/falling edge (3) interrupt request flag clear register the interrupt request flag is cleared by writing the appropriate micro dma start vector, as given in table 3.4.1 to the register intclr. for example, to clear the interrupt flag int0, perform the following register operation after execution of the di instruction. intclr 0ah: clears interrupt request flag int0. symbol name address 7 6 5 4 3 2 1 0 clrv5 clrv4 clrv3 clrv2 clrv1 clrv0 w 0 0 0 0 0 0 intclr interrupt clear control 88h (prohibit rmw) interrupt vector (4) micro dma start vector registers this register assigns micro dma processing to an interrupt source. the interrupt source with a micro dma start vector that matches the vector set in this register is assigned as the micro dma start source. wh en the micro dma transfer counter value reaches zero, the micro dma transfer end interrupt corresponding to the channel is sent to the interrupt controller, the micro dma start vector register is cleared, and the micro dma start source for the channel is cleared. therefore, to continue micro dma processing, set the micro dma start vector re gister again during the processing of the micro dma transfer end interrupt. if the same vector is set in the micro dm a start vector registers of more than one channel; the channel with the lowest number has a higher priority. accordingly, if the same vector is set in the micro dma start vector registers of two channels, the interrupt generated in the channel with the lower number is executed until micro dma transfer is complete. if the micro dma start vector for this channel is not set again, the next micro dma is started for the channel with the higher number. (micro dma chaining.)
tmp91c820a 2008-02-20 91c820a-54 symbol name address 7 6 5 4 3 2 1 0 dma0 start vector dma0v5 dma0v4 dma0v3 dma0v2 dma0v1 dma0v0 r/w dma0v dma0 start vector 80h 0 0 0 0 0 0 dma1 start vector dma1v5 dma1v4 dma1v3 dma1v2 dma1v1 dma1v0 r/w dma1v dma1 start vector 81h 0 0 0 0 0 0 dma2 start vector dma2v5 dma2v4 dma2v3 dma2v2 dma2v1 dma2v0 r/w dma2v dma2 start vector 82h 0 0 0 0 0 0 dma3 start vector dma3v5 dma3v4 dma3v3 dma3v2 dma3v1 dma3v0 r/w dma3v dma3 start vector 83h 0 0 0 0 0 0 (5) micro dma burst specification specifying the micro dma burst continues the micro dma transfer until the transfer counter register reaches zero after micro dm a start. setting a bit which corresponds to the micro dma channel of the dmab registers mentioned below to 1 specifies a burst. symbol name address 7 6 5 4 3 2 1 0 dmar3 dmar2 dmar1 dmar0 r/w r/w r/w r/w 0 0 0 0 dmar dma software request register 89h (prohibit rmw) 1: dma software request dmab3 dmab2 dmab1 dmab0 r/w 0 0 0 0 dmab dma burst register 8ah 1: dma burst request
tmp91c820a 2008-02-20 91c820a-55 (6) notes the instruction execution unit and the bus interface unit of this cpu operate independently. therefore, immediately before an interrupt is generated, if the cpu fetches an instruction that clears the corresponding interrupt request flag, the cpu may execute the instruction that clears the interrupt request flag between accepting and reading the interrupt vector. in this case, the cpu reads the default vector 0008h and reads the interrupt vector address ffff08h. to avoid the above problem, place instructions that clear interrupt request flags after a di instruction. and in the case of setting an interrupt enable again by ei instruction after the execution of clearing instruction, execute ei instruction after clearing and more than 1 instructions (ex. ?nop? 1 time). if placed ei instruction without waiting nop instruction after execution of clearing instruction, interrupt will be enable before request flag is cleared. in the case of changing the value of the interrupt mask register by execution of pop sr instruction, disable an interrupt by di instruction before execution of pop sr instruction. in addition, take care as the following 2 circuits are exceptional and demand special attention. in level mode int0 is not an edge-triggered interrupt. hence, in level mode the interrupt request flip-flop for int0 does not function. the peripheral interrupt request passes through the s input of the flip-flop and becomes the q output. if the interrupt input mode is changed from edge mode to level mode, the interrupt request flag is cleared automatically. ;int0 level mode if the cpu enters the interrupt response sequence as a result of int0 going from 0 to 1, int0 must then be held at 1 until the interrupt response sequence has been completed. if int0 is set to level mode so as to release a halt state, int0 must be held at 1 from the time int0 changes from 0 to 1 until the halt state is released. (hence, it is necessary to ensure that input noise is not interpreted as a 0, causing int0 to revert to 0 before the halt state has been released.) when the mode changes from level mode to edge mode, interrupt request flags which were set in level mode will not be cleared. interrupt request flags must be cleared using the following sequence. di ld (iimc), 00h ; switches interrupt input mode from level mode to edge mode. ld (intclr), 0ah ; clears interrupt request flag. nop ; wait ei instruction ei intrx the interrupt request flip-flop can only be cleared by a reset or by reading the serial channel receive buffer. it cannot be cleared by writing intclr register. note: the following instructions or pin input state changes are equivalent to instructions that clear the interrupt request flag. int0: instructions which switch to level mode after an interrupt request has been generated in edge mode. the pin input changes from high to low after an interrupt request has been generated in level mode. (h l) intrx: instructions which read the receive buffer.
tmp91c820a 2008-02-20 91c820a-56 3.5 port functions the tmp91c820a features 126-bit settings which relate to the various i/o ports. as well as general-purpose i/o port functionality, the port pins also have i/o functions which relate to the built-in cpu and internal i/os. table 3.5.1 and table 3.5.2 list the functions of each port pin. table 3.5.3, table 3.5.4 and table 3.5.5 list i/o registers and their specifications. table 3.5.1 port functions (1/2) (r: pu = with programmable pull-up resistor) (u = with pull-up resistor) port name pin name number of pins direction r direction setting unit pin name for built-in function port 0 p00 to p07 8 i/o ? bit d0 to d7 port 1 p10 to p17 8 i/o ? bit d8 to d15 port 2 p20 to p27 8 i/o ? bit a16 to a23 port 3 p30 to p37 8 i/o ? bit a8 to a15 port 4 p40 to p47 8 i/o ? bit a0 to a7 port z pz0 1 output ? bit rd pz1 1 output ? bit wr pz2 1 i/o pu bit hwr pz3 1 i/o pu bit w / r , srwe port 5 p56 1 i/o pu bit wait port 6 p60 1 output ? (fixed) cs0 p61 1 output ? (fixed) cs1 , sdcs p62 1 output ? (fixed) cs2 , cs2a p63 1 output ? (fixed) cs3 p64 1 output ? (fixed) ea24, cs2b p65 1 output ? (fixed) ea25, cs2c p66 1 output ? (fixed) cs2c , srlb p67 1 output ? (fixed) cs2e , srub port 7 p70 1 i/o ? bit sck, optrx0 p71 1 i/o ? bit so, sda , opttx0 p72 1 i/o ? bit si/scl p73 1 i/o ? bit cs2f p74 1 i/o ? bit cs2g p75 1 i/o ? bit csexa p76 1 i/o ? bit msk p77 1 i/o ? bit veeclk port 8 p80 to p87 8 input ? (fixed) an0 to an7, adtrg (p83) port 9 p90 to p97 8 input u (fixed) ki0 to ki7 port a pa0 to pa7 8 output ? (fixed) ko0 to ko7 port b pb0 1 i/o ? bit ta0in, txd2 pb1 1 i/o ? bit ta1out, rxd2 pb3 1 i/o ? bit int0 pb4 1 i/o ? bit int1 pb5 1 i/o ? bit int2, ta3out pb6 1 i/o ? bit int3, tb0out0 port c pc0 1 i/o ? bit txd0 pc1 1 i/o ? bit rxd0 pc2 1 i/o ? bit sclk0, cts0 pc3 1 i/o ? bit txd1 pc4 1 i/o ? bit rxd1 pc5 1 i/o ? bit sclk1, cts1
tmp91c820a 2008-02-20 91c820a-57 table 3.5.2 port functions (2/2) (r: pu = with programmable pull-up resistor) (u = with pull-up resistor) port name pin name number of pins direction r direction setting unit pin name for built-in function port d pd0 1 output ? (fixed) d1bscp pd1 1 output ? (fixed) d2blp pd2 1 output ? (fixed) d3bfr pd3 1 output ? (fixed) dlebcd pd4 1 output ? (fixed) doffb pd6 1 output ? (fixed) alarm , mldalm pd7 1 output ? (fixed) mldalm port e pd0 to pd7 8 i/o ? bit ld0 to ld7 port f pf0 1 output ? (fixed) sdras pf1 1 output ? (fixed) sdcas pf2 1 output ? (fixed) sdwe pf3 1 output ? (fixed) sdldqm pf4 1 output ? (fixed) sdudqm pf5 1 output ? (fixed) sdcke pf6 1 output ? (fixed) sdclk pf7 1 output ? (fixed)
tmp91c820a 2008-02-20 91c820a-58 table 3.5.3 i/o registers and specifications (1/3) i/o register port pin name specification pn pncr pnfc pnfc2 input port x 0 output port x 1 port 0 p00 to p07 d0 to d7 bus x x none none input port x 0 0 output port x 1 0 port 1 p10 to p17 d8 to d15 bus x 0 1 none input port x 0 x output port x 1 0 port 2 p20 to p27 a16 to a23 output x 1 1 none input port x 0 x output port x 1 0 port 3 p30 to p47 a8 to a15 output x 1 1 none input port x 0 x output port x 1 0 port 4 p30 to p47 a0 to a7 output x 1 1 none output port x 0 pz0 rd output x 1 output port x 0 pz1 wr output x none 1 input port (without pu) 0 0 0 input port (with pu) 1 0 0 pz2, pz3 output port x 1 0 pz2 hwr output x 1 1 r/w output x 0 1 port z pz3 srwe output x 1 1 input port (without pu) 0 0 input port (with pu) 1 0 output port x 1 wait input (without pu) 0 0 port 5 p56 wait input (with pu) 1 0 none none p60 to p67 output port x 0 0 p60 cs0 output x 1 0 cs1 output x 1 0 p61 sdcs output x x 1 cs2 output x 1 0 p62 cs2a output x x 1 p63 cs3 output x 1 0 ea24 output x 1 0 p64 cs2b output x x 1 ea25 output x 1 0 p65 cs2c output x x 1 srlb output x 1 0 p66 cs2d output x x 1 srub output x 1 0 port 6 p67 cs2e output x none x 1 x: don?t care
tmp91c820a 2008-02-20 91c820a-59 table 3.5.4 i/o registers and specifications (2/3) i/o register port pin name specification pn pncr pnfc pnfc2 input port x 0 0 0 p70 to p77 output port x 1 0 0 sck input x 0 0 0 sck output x 1 1 0 p70 optrx0 input (note 1) 1 0 x 1 sda input x 0 0 0 sda output (note 2) x 1 1 0 so output x 1 1 0 p71 opttx0 output (note 1) 1 1 x 1 si input x 0 0 scl input x 0 0 p72 scl output (note 2) x 1 1 none p73 cs2f output x 1 x 1 p74 cs2g output x 1 x 1 p75 csexa output x 1 x 1 p76 msk input (note 3) x 0 0 0 port 7 p77 veeclk output x 1 1 0 input port x p80 to p87 an0 to an7 input (note 4) x port 8 p83 adtrg input (note 5) x none input port x 0 port 9 p90 to p97 ki0 to ki7 input x none 1 output port x 0 ko0 to ko7 output (cmos) x 0 port a pa0 to pa7 ko0 to ko7 output (open drain) x none 1 none input port x 0 0 pb0 to pb6 output port x 1 0 ta0in input x 0 0 pb0 txd2 output (note 1) x 1 1 ta1out output x 1 1 pb1 rxd2 input (note 1) x 0 0 pb3 int0 input x 0 1 pb4 int1 input x 0 1 int2 input 0 0 1 pb5 ta3out 1 1 1 int3 input 0 0 1 port b pb6 tb0out0 1 1 1 none x: don?t care
tmp91c820a 2008-02-20 91c820a-60 table 3.5.5 i/o registers and specifications (3/3) i/o register port pin name specification pn pncr pnfc pnfc2 input port x 0 0 pc0 to pc5 output port x 1 0 pc0 txd0 output (note 1) 1 1 1 pc1 rxd0 input (note 1, 6) 1 0 none sclk0 input (note 1) 1 0 0 sclk0 output (note 1) 1 1 1 pc2 cts0 input (note 1) 1 0 0 pc3 txd1 output (note 1) 1 1 1 pc4 rxd1 input (note 1) 1 0 none sclk1 input (note 1) 1 0 0 sclk1 output (note 1) 1 1 1 port c pc5 cts1 input (note 1) 1 0 0 pd0 to pd7 output port x 0 pd0 d1bscp output x 1 pd1 d2blp output x 1 pd2 d3bfr output x 1 pd3 dlebcd output x 1 pd4 doffb output x 1 alarm output 1 1 pd6 mldalm output 0 1 port d pd7 mldalm output x none 1 input port x 0 0 output port x 1 0 port e pe0 to pe7 ld0 to ld7 output x 1 1 pf0 to pf7 output port x 0 pf0 sdras output x 1 pf1 sdcas output x 1 pf2 sdwe output x 1 pf3 sdldqm output x 1 pf4 sdudqm output x 1 pf5 sdcke output x 1 port f pf6 sdclk output x none 1 none x: don?t care note 1: as for input ports of sio1 to sio3: (opttx0, optrx0, txd0, rxd0, sclk0, cts0 , txd1, rxd1, sclk1, cts1 , txd2, rxd2), logical selection for output data or input data is determined by the output latch register pn of each port. note 2: when p71/p72 are used as sda/scl open-drain outputs, p70de is used to set the open-drain output mode. note 3: in case using p76 for msk port, set to p7fc. note 4: when p80 to p87 are used as ad converter input channels, admod1 is used to select the channel. note 5: when p83 is used as adtrge input, admod1 is used to enable external-trigger input. note 6: in case using pc1 for rxd0 port, set ?0? to p7fc2.
tmp91c820a 2008-02-20 91c820a-61 3.5.1 port 0 (p00 to p07) port 0 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p0cr. resetting resets all bits of the output latch p0, the control register p0cr to 0 and sets port 0 to input mode. in addition to functioning as a general-purpose i/o port, port 0 can also function as an data bus (d0 to d7). when external memory is accesed, the port automatically functions as the data bus (d0 to d7) and all bits of p0cr are cleared to 0. internal data bus direction control (on bit basis) p0cr write p00 to p07 (d0 to d7) output buffer reset p0 read p0 write output latch selector a b s d0 to d7 external access (data read) external access (data write) external access figure 3.5.1 port 0 port 0 register 7 6 5 4 3 2 1 0 bit symbol p07 p06 p05 p04 p03 p02 p01 p00 read/write r/w after reset data from external port (output latch register is cleared to 0.) port 0 control register 7 6 5 4 3 2 1 0 bit symbol p07c p06c p05c p04c p03c p02c p01c p00c read/write w after reset 0 0 0 0 0 0 0 0 function port 0 input/output settings 0: input 1:output note 1: read-modify-write is prohibited for p0cr. note 2: when functionin g as a data bus ( d0 to d7 ) , p0cr is cleared to 0. p0 (0000h) p0 (0000h) p0cr (0002h) figure 3.5.2 register for port 0
tmp91c820a 2008-02-20 91c820a-62 3.5.2 port 1 (p10 to p17) port 1 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p1cr and the function register p1fc. resetting resets all bits of the output latch p1, the control register p1cr and the function register p1fc to 0 and sets port 1 to input mode. in addition to functioning as a general-purpose i/o port, port 1 can also function as an data bus (d8 to d15). am1 am0 p1xf function setting after reset is released 0 0 1 1 0 1 0 1 0 1 ? 0 input port data bus (d8 to d15) don?t use this setting input port internal data bus direction control (on bit basis) function control (on bit basis) p1cr write p1fc write p10 to p17 (d8 to d15) output buffer reset p1 read p1 write port 1 output latch selector a b s d8 to d15 external access (data read) external access (data write) figure 3.5.3 port 1
tmp91c820a 2008-02-20 91c820a-63 port 1 register 7 6 5 4 3 2 1 0 bit symbol p17 p16 p15 p14 p13 p12 p11 p10 read/write r/w after reset data from external port (output latch register is cleared to 0.) port 1 control register 7 6 5 4 3 2 1 0 bit symbol p17c p16c p15c p14c p13c p12c p11c p10c read/write w after reset 0 0 0 0 0 0 0 0 function port 1 function settings port 1 function register 7 6 5 4 3 2 1 0 bit symbol p17f p16f p15f p14f p13f p12f p11f p10f read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 1 function settings port 1 function settings note 1: read-modify-write is prohibited for p1cr and p1fc. note 2: is bit x in register p1fc; , in register p1cr. note 3: it is set to ?port? or ?data bus ? by am pins state. p0 (0000h) p1 (0001h) p1cr (0004h) p1fc p1cr 0 1 0 input port data bus (d15 to d8) 1 output port don?t set p1fc (0005h) figure 3.5.4 register for port 1
tmp91c820a 2008-02-20 91c820a-64 3.5.3 port 2 (p20 to p27) port 2 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p2cr and the function register p2fc. in addition to functioning as a general-purpose i/o port, port 2 can also function as an address bus (a16 to a23). setting the am1 and am0 pins as shown below and resetting the device initialize port 2 to the following function pins. am1 am0 p2xc p2xf function setting after reset is released 0 0 1 1 0 1 0 1 1 1 ? 0 1 1 ? 0 address bus (a16 to a23) address bus (a16 to a23) don?t use this setting input port a b internal data bus function control (on bits basis) p2fc write p20 to p27 (a16 to a23) output buffer reset output latch p2 write selector s direction control (on bit basis) p2cr write internal address bus p2 read a16 to a23 figure 3.5.5 port 2
tmp91c820a 2008-02-20 91c820a-65 port 2 register 7 6 5 4 3 2 1 0 bit symbol p27 p26 p25 p24 p23 p22 p21 p20 read/write r/w after reset data from external port (output latch register is cleared to 0.) port 2 control register 7 6 5 4 3 2 1 0 bit symbol p27c p26c p25c p24c p23c p22c p21c p20c read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 2 function settings port 2 function register 7 6 5 4 3 2 1 0 bit symbol p27f p26f p25f p24f p23f p22f p21f p20f read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 2 function settings port 2 function settings note 1: read-modify-write is prohibited for p2cr and p2fc. note 2: is bit x in register p2fc; , in register p2cr. note 3: it is set to ?port? or ?address bus ? by am pins state. p0 (0000h) p2 (0006h) p2cr (0008h) p2fc p2cr 0 1 0 input port 1 output port address bus (a16 to a23) p2fc (0009h) figure 3.5.6 register for port 2
tmp91c820a 2008-02-20 91c820a-66 3.5.4 port 3 (p30 to p37) port 3 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p3cr and the function register p3fc. in addition to functioning as a general-purpose i/o port, port 3 can also function as an address bus (a8 to a15). setting the am1 and am0 pins as shown below and resetting the device initialize port 3 to the following function pins. am1 am0 p3xc p3xf function setting after reset is released 0 0 1 1 0 0 0 1 1 1 ? 0 1 1 ? 0 address bus (a8 to a15) address bus (a8 to a15) don?t use this setting input port a b internal data bus function control (on bit basis) p3fc write p30 to p37 (a8 to a15) output buffer reset output latch p3 write selector s internal address bus direction control (on bit basis) p3cr write p3 read a8 to a15 figure 3.5.7 port 3
tmp91c820a 2008-02-20 91c820a-67 port 3 register 7 6 5 4 3 2 1 0 bit symbol p37 p36 p35 p34 p33 p32 p31 p30 read/write r/w after reset data from external port (output latch register is cleared to 0.) port 3 control register 7 6 5 4 3 2 1 0 bit symbol p37c p36c p35c p34c p33c p32c p31c p30c read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 3 function settings port 3 function register 7 6 5 4 3 2 1 0 bit symbol p37f p36f p35f p34f p33f p32f p31f p30f read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 3 function settings port 3 function settings note 1: read-modify-write is prohibited for p3cr and p3fc. note 2: is bit x in register p3fc; , in register p3cr. note 3: it is set to ?port? or ?address bus? by am pins state. p0 (0000h) p3 (0007h) p3cr (000ah) p3fc p3cr 0 1 0 input port 1 output port address bus (a8 to a15) p3fc (000bh) figure 3.5.8 register for port 3
tmp91c820a 2008-02-20 91c820a-68 3.5.5 port 4 (p40 to p47) port 4 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p4cr and the function register p4fc. in addition to functioning as a general-purpose i/o port, port 4 can also function as an address bus (a0 to a7). setting the am1 and am0 pins as shown below and resetting the device initialize port 4 to the following function pins. am1 am0 p4xc p4xf function setting after reset is released 0 0 1 1 0 1 0 1 1 1 ? 0 1 1 ? 0 address bus (a0 to a7) address bus (a0 to a7) don?t use this setting input port a b internal data bus function control (on bit basis) p4fc write p40 to p47 (a0 to a7) output buffer reset output latch p4 write selector s internal address bus direction control (on bit basis) p4cr write p4 read a0 to a7 figure 3.5.9 port 4
tmp91c820a 2008-02-20 91c820a-69 port 4 register 7 6 5 4 3 2 1 0 bit symbol p47 p46 p45 p44 p43 p42 p41 p40 read/write r/w after reset data from external port (output latch register is cleared to 0.) port 4 control register 7 6 5 4 3 2 1 0 bit symbol p47c p46c p45c p44c p43c p42c p41c p40c read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 4 function settings port 4 function register 7 6 5 4 3 2 1 0 bit symbol p47f p46f p45f p44f p43f p42f p41f p40f read/write w after reset (note3) 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 function port 4 function settings port 4 function settings note 1: read-modify-write is prohibited for p4cr and p4fc. note 2: is bit x in register p4fc; , in register p4cr. note 3: it is set to ?port? or ?address bus? by am pins state. p0 (0000h) p4 (000ch) p4cr (000eh) p4fc p4cr 0 1 0 input port 1 output port address bus (a0 to a7) p4fc (000fh) figure 3.5.10 register for port 4
tmp91c820a 2008-02-20 91c820a-70 3.5.6 port z (pz0 to pz3) port z is an 4-bit general-purpose i/o port (p50 and p51 are used for output only). i/o is set using control register pzcr and pzfc. resetting resets all bits of the output latch pz to 1. in addition to functioning as a general-purpose i/o port, port z also functions as i/o for the cpu?s control/status signal. when pz0 pin is defined as rd strobe signal output mode ( = 1), clearing the output latch register to 0 outputs the rd strobe (used for the peused static ram) from the pz0 pin even when the internal addressed. if the output latch register remains 1, the rd strobe signal is output only when the external address are is accessed. resetting initializes pz2 and pz3 pins to input mode with pull-up resistor. setting the am1 and am0 pins as shown below and resetting the device initialize pz0 and pz1 pins to the following function pins. function setting after reset is released am1 am0 pz0f pz1f pz0 function pz1 function 0 0 1 1 0 1 0 1 1 1 ? 0 rd pin rd pin don?t use this setting output port wr pin wr pin don?t use this setting output port internal data bus function control (on bit basis) pzfc write output buffer reset pz read output latch pz write pz0 ( rd ) selector s a b rd internal address area figure 3.5.11 port z (pz0)
tmp91c820a 2008-02-20 91c820a-71 internal data bus function control (on bit basis) pzfc write output buffer reset pz read output latch pz write pz1 ( wr ) selector s a b wr internal address area function conrtol (on bit basis) s output latch pz2 ( hwr ) selector internal data bus direction control (on bit basis) pzcr write p-ch (programmable pull up) reset pzfc write pz write output buffer pz read s a b hwr figure 3.5.12 port z (pz1, pz2)
tmp91c820a 2008-02-20 91c820a-72 function conrtol (on bit basis) s output latch pz3 ( w / r , srwe ) selector internal data bus direction control (on bit basis) pzcr write p-ch ( pro g rammable pull up) reset pzfc write pz write output buffer p5 read s a b srwe c w / r figure 3.5.13 port z (pz3)
tmp91c820a 2008-02-20 91c820a-73 port z register 7 6 5 4 3 2 1 0 bit symbol pz3 pz2 pz1 pz0 read/write r/w after reset data form external port (note 1) 1 1 function 0(output latch register): pull-up resistor off 1(output latch register): pull-up resistor on ? ? port z control register 7 6 5 4 3 2 1 0 bit symbol pz3c pz2c read/write w after reset 0 0 function 0: input 1: output port z function register 7 6 5 4 3 2 1 0 bit symbol pz3f pz2f pz1f pz0f read/write w after reset 0 0 0 0 function 0: port 1: w / r , srwe 0: port 1: hwr 0: port 1: wr 0: port 1: rd pzfc (007fh) pz (007dh) note 1: output latch register is set to 1. note 2: read-modify-write is prohibited for registers pzcr and pzfc. note 3: when port z is used in input mode, the pz register controls the built-in pull-up resistor. read-modify-write is prohibited in input mode or i/o mode. setting the built-in pull-up resistor may be depended on the states of the input pin. 0 1 0 output output 1 prohibit this setting rd pz0 ( rd ) function setting 0 1 0 output output 1 wr pz1 ( wr ) function setting hwr setting pzfc 1 pzcr 1 pzcr (007eh) 0 1 0 input output 1 r/w srwe w / r , srwe setting figure 3.5.14 register for port z
tmp91c820a 2008-02-20 91c820a-74 3.5.7 port 5 (p56) port 5 is an 1-bit general-purpose i/o port. i/o is set using control register p5cr and p5fc. resetting resets all bits of the output latch p5 to p1. in addition to functioning as a general-purpose i/o port, port 5 also functions as i/o for the cpu?s control/status signal. resetting initializes p56 pins to input mode with pull-up resistor. internal wait s output latch p5 write p5 read internal data bus direction control (on bit basis) p5cr write p-ch (programmable pull up) reset p56 ( wait ) output buffer figure 3.5.15 port 5 (p56)
tmp91c820a 2008-02-20 91c820a-75 port 5 register 7 6 5 4 3 2 1 0 bit symbol p56 read/write r/w after reset data from external port (output latch register is set to 1.) function 0(output latch register): pull-up resistor off 1(output latch register): pull-up resistor on port 5 control register 7 6 5 4 3 2 1 0 bit symbol p56c read/write w after reset 0 function 0: input 1: output p5 (000dh) p5cr (0010h) note: when the p53/wait pin is to be use as the wait pin, p5cr must be set to 0 and in the chip select/wait control register must be set 010. figure 3.5.16 register for port 5
tmp91c820a 2008-02-20 91c820a-76 3.5.8 port 6 (p60 to p67) port 60 to 67 are 8-bit output ports. resetting sets output latch of p62 to 0 and output latches of p60 to p61 and p63 to p67 are set to 1. port 6 also function as chip-select output ( cs0 to cs3 ), extend address output (ea24, ea25), extend chip-select output ( cs2a , cs2b , cs2c , cs2d , cs2e ), sram byte control output ( srub , srlb ), and sdram chip-select output ( sdcs ). writing 1 in the corresponding bit of p6fc, p6fc2 enables the respective functions. resetting reset the p6fc and p6fc2 to 0, and sets all bits to output ports. internal data bus function control ( on bit basis ) output lacth p6 read reset p60 ( cs0 ) p61 ( cs1 , sdcs ) p62 ( cs2 , cs2a ) p63 ( cs3 ) p64 (ea24, cs2b ) p65 (ea25, cs2c ) p66 ( srlb , cs2d ) p67 ( srub , cs2e ) cs0 , cs1 , cs2 , cs3 , ea24, ea25, srlb , srub selector p6fc write p6 write s a b function control 2 (on bit basis) p6fc2 write sdcs , cs2a , cs2b , cs2c , cs2d , cs2e c figure 3.5.17 port 6 port 6 register 7 6 5 4 3 2 1 0 bit symbol p67 p66 p65 p64 p63 p62 p61 p60 read/write r/w after reset 1 1 1 1 1 0 1 1 port 6 function register 7 6 5 4 3 2 1 0 bit symbol p67f p66f p65f p64f p63f p62f p61f p60f read/write w after reset 0 function 0: port 1: srub 0: port 1: srlb 0: port 1: ea25 0: port 1: ea24 0: port 1: cs3 0: port 1: cs2 0: port 1: cs1 0: port 1: cs0 port 6 function register 2 7 6 5 4 3 2 1 0 bit symbol p67f2 p66f2 p65f2 p64f2 ? p62f2 p61f2 ? read/write w after reset 0 function 0: 1: cs2e 0: 1: cs2d 0: 1: cs2c 0: 1: cs2b always write ?0?. 0: 1: cs2a 0: 1: sdcs always write ?0?. p6 (0012h) p6fc (0015h) p6fc2 (001bh) note: read-modify-write is prohibited for p6fc and p6fc2. figure 3.5.18 register for port 6
tmp91c820a 2008-02-20 91c820a-77 3.5.9 port 7 (p70 to p77) port 7 is an 8-bit general-purpose i/o port. i/o can be set on bit basis using the control register. resetting sets port 7 to input port and all bits of output latch to 1. in addition to functioning as a general-purpose i/o port, port 7 also functions as follows. 1. input/output function for serial bus interface (sck, so/sda, si/scl) 2. input/output function for irda (optrx0, opttx0) 3. extend chip-select output ( cs2f , cs2g , csexa ) 4. clock control function for voltage boos ter of external lcd driver (msk, veeclk) writing 1 in the corresponding bit of p7fc, p7fc2 enables the respective functions. resetting resets the p7fc, p7fc2 to 0, and sets all bits to input ports. (1) port 70 (sck, optrx0) port 70 is a general-purpose i/o port. it is also used as sck (clock signal for sio mode) and optrx0 (receive input for irda mode of sio0). used as optrx0, it is possible to logical invert by p7. for port c1, rxd0 or optrx0 is used p7fc2. internal data bus selector a b s selector a b s p70 (sck, optrx0) sck output p7 read direction control ( on bit basis ) p7cr write function control ( on bit basis ) s output latch p7 write reset p7fc write sck input function control 2 ( on bit basis ) p7fc2 write rxd0pc1 ( from portc1 ) rxd0 (to sio0) logical invert selector a b s figure 3.5.19 port 70
tmp91c820a 2008-02-20 91c820a-78 (2) port 71 (so/sda/opttx0) port 71 is a general-purpose i/o port. it is also used as sda (data input for i 2 c bus mode), so (data output for sio mode) for serial bus interface and opttx0 (transmit output for irda mode of sio0). used as opttx0, it is possible to logical invert by p7. sda input open-drain possible: p7ode so output internal data bus selector a b s p71(so/sda, opttx0) p7 read direction control ( on bit basis ) p7cr write function control (on bit basis) p7fc write s output latch p7 write reset function control 2 (on bit basis) p7fc2 write c txd0 output logical invert selector a b s figure 3.5.20 port 71
tmp91c820a 2008-02-20 91c820a-79 (3) port 72 (si/scl) port 72 is a general-purpose i/o port. it is also used as si (data input for sio mode), scl (clock input/output for i 2 c bus mode) for serial bus interface. open-drain possible: p7ode scl output internal data bus selector a b s selector a b s p72 (si/scl) p7 read direction control (on bit basis) p7cr write function control (on bit basis) p7fc write p7 write reset si input scl input s output latch figure 3.5.21 port 72
tmp91c820a 2008-02-20 91c820a-80 (4) port 73 ( cs2f ), 74 ( cs2g ), 75 ( csexa ) port 73 to 75 are general-purpose i/o ports. these are also used as control signal for sequential mask rom and extend chip-select output. internal data bus selector a s selector a b s p73 ( cs2f ), p74 ( cs2g ), p75 ( csexa ) p7 read direction control ( on bit basis ) p7cr write funtcion control (on bit basis) p7fc write s output latch p7 write reset function control 2 ( on bit basis ) p7fc2 write b cs2f , cs2g , csexa figure 3.5.22 port 73, 74, 75
tmp91c820a 2008-02-20 91c820a-81 (5) port 76 (msk), 77 (veeclk) port 76 and 77 are general-purpose i/o ports. these are also used as clock control function for voltage booster of external lcd driver. msk pin (p76) is an input pin from external lcd driver, clock output from veeclk pin is controlled by state of this pin. logic of this pin is controlled with p7fc. veeclk pin outputs clock of 32 khz for vo ltage booster or 0 level according to request from msk pin. veeclk output is controlled with p7fc. internal data bus selector a b s p76 (msk) p7cr write function control (on bit basis) p7fc write s output latch p7 write reset internal data bus selector a s selector a b s p7 read p7cr write p7fc write p7 write reset fs clock veeclk direction control (on bit basis) s output latch function control (on bit basis) b p77 (veeclk) p7 read direction control (on bit basis) figure 3.5.23 port 76, 77
tmp91c820a 2008-02-20 91c820a-82 port 7 register 7 6 5 4 3 2 1 0 bit symbol p77 p76 p75 p74 p73 p72 p71 p70 read/write r/w after reset data from external port (output latch register is set to 1.) port 7 control register 7 6 5 4 3 2 1 0 bit symbol p77c p76c p75c p74c p73c p72c p71c p70c read/write w after reset 0 0 0 0 0 0 0 0 function 0: input 1: output port 7 function register 7 6 5 4 3 2 1 0 bit symbol p77f p76f p75f p74f p73f p72f p71f p70f read/write w after reset 0 function 0:port 1:veeclk msk select 0: enable 1: enable 0: port 0: port 0: port 0: port 1: scl/si 0: port 1: sda/so 0: port 1: sck port 7 function register 2 7 6 5 4 3 2 1 0 bit symbol ? ? p75f2 p74f2 p73f2 ? p71f2 p70f2 read/write w after reset 0 function always write ?0?. always write ?0?. 0: 1: csexa 0: 1: cs2g 0: 1: cs2f always write ?0?. 0: 1: opttx0 sio0/rxd0 pin select 0: rxd0(pc1) 1: optrx0 (p70) p7fc (0017h) p7 (0013h) p7cr (0016h) p7fc2 (001ch) port 7 ode register 7 6 5 4 3 2 1 0 bit symbol ? ? odep72 odep71 read/write w w after reset 0 0 0 0 function always write ?0?. 0: 3 states 1: open drain p7ode (001fh) note: read-modify-write is prohibited for p7cr, p7fc, p7fc2 and p7ode. figure 3.5.24 register for port 7
tmp91c820a 2008-02-20 91c820a-83 3.5.10 port 8 (p80 to p87) port 8 is an 8-bit input port and can also be used as the analog input pins for the internal ad converter. p83 can also be used as adtrg pin for the ad converter. figure 3.5.25 port 8 port 8 register 7 6 5 4 3 2 1 0 bit symbol p87 p86 p85 p84 p83 p82 p81 p80 read/write r after reset data from external port note: the input channel selection of ad converter and the permission of adtrg input are set by ad converter mode register admod1. p8 (0018h) figure 3.5.26 register for port 8 internal data bus ad read conversion result register ad converter channel selector port 8 read port 8 p80 to p87 (an0 to an7) adtrg (for p83 only)
tmp91c820a 2008-02-20 91c820a-84 3.5.11 port 9 (p90 to p97) port 90 to 97 are 8-bit input ports with pull-up resistor. in addition to functioning as general-purpose i/o port, port 90 to 97 can also key-on wakeup function as keyboard interface. the various functions can each be enabled by writing a 1 to the corresponding bit of the port 9 function register (p9fc). resetting resets all bits of the register p9fc to 0 and sets all pins to be input port. figure 3.5.27 port 9 when p9fc = 1, if either of input of ki0 to ki7 pins falls down, intkey interrupt is generated. intkey interrupt can be used to release all halt mode. port 9 register 7 6 5 4 3 2 1 0 bit symbol p97 p96 p95 p94 p93 p92 p91 p90 read/write r after reset data from external port port 9 function register 7 6 5 4 3 2 1 0 bit symbol p97f p96f p95f p94f p93f p92f p91f p90f read/write w after reset 0 0 0 0 0 0 0 0 function 0: key-in disable 1: key-in enable p9fc (001dh) p9 (0019h) note: read-modify-write is prohibited for the registers p9fc. key-in of port 9 disable 0 enable 1 figure 3.5.28 register for port 9 internal data bus p90 to p97 (ki0 to ki7) pull-up resistor p9fc write key-on enable ( on bit basis ) rising edge detection intkey p90 to p97 8-or reset p9 read
tmp91c820a 2008-02-20 91c820a-85 3.5.12 port a (pa0 to pa7) port pa0 to pa7 are 8-bit output ports, and also used key board interface pin ko0 to ko7 which can set open-drain output buffer. writing 1 in the corresponding bit of the po rt a function register (pafc) enable the open-drain output. resetting reset bits of the registers pa to 1 and pafc to 0, and all pin outputs 1. figure 3.5.29 port a port a register 7 6 5 4 3 2 1 0 bit symbol pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 read/write r/w after reset 1 1 1 1 1 1 1 1 port a function register 7 6 5 4 3 2 1 0 bit symbol pa7f pa6f pa5f pa4f pa3f pa2f pa1f pa0f read/write w after reset 0 0 0 0 0 0 0 0 function 0: cmos output 1: open drain note: read-modify-write is prohibited for pafc. pa (001eh) pafc (0021h) figure 3.5.30 register for port a internal data bus p a read pa0 to pa7 (ko0 to ko7) output buffer set p a fc write reset s output latch p a write programmable open drain
tmp91c820a 2008-02-20 91c820a-86 3.5.13 port b (pb0 to pb6) port b is a 6-bit general-purpose i/o port. each bit can be set individually for input or output. resetting sets port b to be an input port. in addition to functioning as a general-purpose i/o port, port b can also function as i/o pin for timers (ta0in, ta1out, ta3out, tb0out0), input pin for external interruption (int0 to int3), and i/o for serial channels 2 (txd2, rxd2). above setting is used the function register pbfc and pbfc2. edge select of external interruption establishes it with iimc register, which there is in interruption controller. (1) pb0 (ta0in, txd2) as well as functioning as i/o port pins, port b0 can also function as serial channel txd output pins. in case of use txd2, it is possible to logical invert by setting the register pb. and port b0 has a programmable open-drain function which can be control the register pbode. ta0in pb read internal data bus selector a b s pb0 (ta0in, txd2) direction control (on bits basis) s output latch pbcr write pb write reset selector a s function control ( on bit basis ) pbfc write b txd2 open-drain possible: pbode figure 3.5.31 port b0
tmp91c820a 2008-02-20 91c820a-87 (2) pb1 (ta1out, rxd2) port b1 is i/o port pins and can also is used as rxd input for the serial channels. in case of use rxd2, it is possible to logical invert by setting the register pb. rxd2 pb read internal data bus selector a b s pb1 (ta1out, rxd2 ) direction control (on bits basis) s output latch pbcr write pb write reset selector a s function control ( on bit basis ) pbfc write b ta1out figure 3.5.32 port b1 (3) pb3 (int0) internal data bus selector a b s pb3 (int0) pb read direction control (on bits basis) pbcr write function control (on bits basis) s output latch pb write reset pbfc write int0 iimc level/edge select and rising/falling select figure 3.5.33 port b3
tmp91c820a 2008-02-20 91c820a-88 (4) pb4 (int1), pb5 (int2, ta3out), pb6 (int3, tb0out0) pb read internal data bus selector a b s pb4 (int1) direction control (on bits basis) s output latch pbcr write pb write reset function control ( on bit basis ) pbfc write rising/falling edge detection iimc int1 pb read internal data bus selector a b s pb5 (int2, ta3out) pb6 (int3, tb0out0) direction control (on bits basis) s output latch pbcr write pb write reset selector a s function control (on bit basis) pbfc write b ta3out tb0out0 rising/falling edge detection iimc< i2edge, i3edge > int2 to int3 figure 3.5.34 pb4 to pb6
tmp91c820a 2008-02-20 91c820a-89 port b register 7 6 5 4 3 2 1 0 bit symbol pb6 pb5 pb4 pb3 pb1 pb0 read/write r/w r/w after reset data from external port (output latch register is set to 1.) data from external port (output latch register is set to 1.) function ? ? ? ? (note 3) ? port b control register 7 6 5 4 3 2 1 0 bit symbol pb6c pb5c pb4c pb3c pb1c pb0c read/write w w after reset 0 0 0 0 0 0 function 0: input 1: output 0: input 1: output port b function register 7 6 5 4 3 2 1 0 bit symbol pb6f pb5f pb4f pb3f pb1f pb0f read/write w w after reset 0 0 0 0 0 0 function 0: port 1: int3 tb0out0 0: port 1: int2 ta3out 0: port 1: int1 0: port 1: int0 0: port 1: ta1out 0:port 1:txd2 port b ode register 7 6 5 4 3 2 1 0 bit symbol odepb0 read/write w after reset 0 function txd2 0: cmos 1: open drain pbfc (0025h) pb (0022h) pbcr (0024h) note 1: read-modify-write is prohibited for the registers pbcr, pbfc and pbode. note 2: pb0/ta0in pin does not have a register changing port/function. for example, when it is used as an input port, the input signal is inputted to 8-bit timer. note 3: pb1/rxd1 pin does not have a register changing port/function. for example, when it is used as an input port, the input signal is inputted to sio as the serial receive data. pbode (002bh) 0 1 0 input port output port 1 int2 ta3out int2, ta3out setting 0 1 0 input port output port 1 int3 tb0out0 int3, tb0out0 setting figure 3.5.35 register for port b
tmp91c820a 2008-02-20 91c820a-90 3.5.14 port c (pc0 to pc5) port c0 to c5 are 6-bit general-purpose i/o ports. each bit can be set individually for input or output. resetting sets pc0 to pc5 to be an input ports. it also sets all bits of the output latch register to 1. in addition to functioning as general-purpose i/o port pins, pc0 to pc5 can also function as the i/o for serial channels 0 and 1. a pin can be enabled for i/o by writing a 1 to the corresponding bit of the port c function register (pcfc). resetting resets all bits of the registers pccr and pcfc to 0 and sets all pins to be input ports. (1) port c0, c3 (txd0/txd1) as well as functioning as i/o port pins, port c0 and c3 can also function as serial channel txd output pins. in case of use txd0/txd1, it is possible to logical invert by setting the register pc. and ports c0 to c3 have a programmable open-drain function, which can be control the register pcode. pcode open-drain possible: selector a b s selector a b s pc0 (txd0) pc3 (txd1) txd0, txd1 pc read direction control (on bit basis) pccr write function control (on bit basis) pcfc write s output latch pc write reset internal data bus logical invert figure 3.5.36 port c0 and port c3
tmp91c820a 2008-02-20 91c820a-91 (2) port c1, c4 (rxd0, 1) port c1 and c4 are i/o port pins and can also be used as rxd input for the serial channels. in case of use rxd0/rxd1, it is possible to logical invert by setting the register pc. and input data of sio0 can be select from rxd/pc1 pin or optrx0/p70 by setting the register pcfc2. rxd0, rxd1 selector a b s pc read pc1 (rxd0) pc4 (rxd1) ditection control (on bit basis) pccr write reset s output latch internal data bus pc write logical invert figure 3.5.37 port c1 and port c4 (3) port c2 ( cts0 , sclk0), c5 ( cts1 , sclk1) port c2 and c4 are i/o port pins and can also be used as cts input or sclk input/output for the serial channels. in case of use cts , sclk, it is possible to logical invert by setting the register pc. selector a b s selector a b s pc2 (sclk0, cts0 ) pc5 (sclk1, cts1 ) sclk0 , sclk1 output pc read ditection control (on bit basis) pccr write function control (on bit basis) pcfc write s output latch pc write reset cts0 , cts1 , sclk0, sclk1 input internal data bus logical invert logical invert figure 3.5.38 port c2 and port c5
tmp91c820a 2008-02-20 91c820a-92 port c register 7 6 5 4 3 2 1 0 bit symbol pc5 pc4 pc3 pc2 pc1 pc0 read/write r/w after reset data from external port (output latch register is set to 1.) port c control register 7 6 5 4 3 2 1 0 bit symbol pc5c pc4c pc3c pc2c pc1c pc0c read/write w after reset 0 0 0 0 0 0 function 0: input 1: output port c functon register 7 6 5 4 3 2 1 0 bit symbol pc5f pc3f pc2f pc0f read/write w w w w after reset 0 0 0 0 function 0: port 1: sclk1 output 0: port 1: txd1 0: port 1: sclk0 output 0: port 1: txd0 port c ode register 7 6 5 4 3 2 1 0 bit symbol odepc3 odepc0 read/write w w after reset 0 0 function txd1 0: cmos 1: open drain txd0 0: cmos 1: open drain pcfc (0027h) pc (0023h) pccr (0026h) pcode (0028h) note 1: read-modify-write is prohibited for the registers pccr, pcfc and pcode. note 2: pc1/rxd0, pc4/rxd1 pins do not have a register changing port/function. for example, when it is used as an input port, the input signal is inputted to sio as the serial receive data. figure 3.5.39 register for port c
tmp91c820a 2008-02-20 91c820a-93 3.5.15 port d (pd0 to pd7) port d is an 8-bit output port. resetting sets the output latch pd to 1, and pd0 to pd7 pin output 1. in addition to functioning as output port, port d also function as output pin for lcd controller (dibscp, d2blp, d3bfr, dlebcd and doffb), output pin for rtc alarm ( alarm ) and output pin for melody/alarm generator (mldalm, mldalm ). above setting is used the function register pdfc. only pd6 has two output function which are alarm and mldalm . this selection is used pd. resetting resets the function register pdfc to 0, and sets all ports to output ports. internal data bus function control (on bit basis) output latch pd read reset pd0 (d1bscp), pd1 (d2blp), pd2 (d3bfr), pd3 (dlebcd), pd4 (doffb), pd7 (mldalm) d1bscp, d2blp, d3bfr, dlebcd, doffb, mldalm output buffer selector pdfc write pd write s a b figure 3.5.40 port d0 to d4, d7 internal data bus mldalm rese t pd write pd read function control (on bit basis) pdfc write s a y selector b alarm pd6 ( alarm , mldalm ) a s y selector b s output latch figure 3.5.41 port d6
tmp91c820a 2008-02-20 91c820a-94 port d register 7 6 5 4 3 2 1 0 bit symbol pd7 pd6 pd4 pd3 pd2 pd1 pd0 read/write r/w r/w after reset 1 1 1 1 1 1 1 port d function register 7 6 5 4 3 2 1 0 bit symbol pd7f pd6f pd4f pd3f pd2f pd1f pd0f read/write w w after reset 0 0 function 0: port 1: mldalm 0: port 1: alarm at = 1 1: mldalm at = 0 0: port 1: doffb 0: port 1: dlebcd 0: port 1: d3bfr 0: port 1: d2blp 0: port 1: d1bscp pd (0029h) pdfc (002ah) note: read-modify-write is prohibited for the registers pdfc. figure 3.5.42 register for port d
tmp91c820a 2008-02-20 91c820a-95 3.5.16 port e (pe0 to pe7) port e is an 8-bit general-purpose i/o ports. each bit can be set individually for input or output using the control register pecr. resetting, the control register pecr to 0 and sets port e to input ports. it also sets all bits of the output latch register to 1. in addition to functioning as a general-purpose i/o port, port e can also function as an data bus for lcd controller (ld0 to ld7). ab ove setting is used the function register pefc. internal data bus selector a b s selector a b s pe0 to pe7 (ld0 to ld7) pe read direction control (on bit basis) pecr write function control ( on bit basis ) pefc write s output latch pe write reset ld7 to ld0 figure 3.5.43 port e port e register 7 6 5 4 3 2 1 0 bit symbol pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 read/write r/w after reset data from external port (output latch register is set to 1.) port e control register 7 6 5 4 3 2 1 0 bit symbol pe7c pe6c pe5c pe4c pe3c pe2c pe1c pe0c read/write w after reset 0 0 0 0 0 0 0 0 function 0: input 1: output port e function register 7 6 5 4 3 2 1 0 bit symbol pe7f pe6f pe5f pe4f pe3f pe2f pe1f pe0f read/write w after reset 0 0 0 0 0 0 0 0 function 0: port 1: data bus for lcdc (ld7 to ld0) pe (002ch) note: read-modify-write is prohibited for pecr and pefc. pefc (002eh) pecr (002dh) figure 3.5.44 register for port e
tmp91c820a 2008-02-20 91c820a-96 3.5.17 port f (pf0 to pf7) port f is an 8-bit output port. resetting sets the output latch pf to 1, and pf0 to pf7 pin output 1. in addition to functioning as output port, port f also function as output pin for sdram controller (sdcke, sdclk, sdldqm, sdudqm, sdwe ), and output pin for ssio (ssclk). above setting is used the function register pffc. function control (on bit basis) output latch pf read reset pf0 ( sdras ) pf1 ( sdcas ) pf2 ( sdwe ) pf3 (sdldqm) pf4 (sdudqm) pf5 (sdcke) pf6 (sdclk) pf7 sdras , sdcas , sdwe , sdldqm, sdudqm, sdcke, sdclk output buffer selector pffc write pf write s a b internal data bus figure 3.5.45 port f port f register 7 6 5 4 3 2 1 0 bit symbol pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 read/write r/w after reset 1 1 1 1 1 1 1 1 port f function register 7 6 5 4 3 2 1 0 bit symbol ? pf6f pf5f pf4f pf3f pf2f pf1f pf0f read/write w after reset 0 1 0 0 0 0 0 0 function always write ?0?. 0: port 1: sdclk 0: port 1: sdcke 0: port 1: sdudqm 0: port 1: sdldqm 0: port 1: sdwe 0: port 1: sdcas 0: port 1: sdras pf (0030h) pffc (0032h) note: read-modify-write is prohibited for the registers pffc. figure 3.5.46 register for port f
tmp91c820a 2008-02-20 91c820a-97 3.6 chip select/wait controller on the tmp91c820a, four user-specifiable address areas ( cs0 to cs3 ) can be set. the data bus width and the number of waits can be set independently for each address area ( cs0 to cs3 and others). the pins cs0 to cs3 (which can also function as port pins p60 to p63) are the respective output pins for the areas cs0 to cs3. when the cpu specifies an address in one of these areas, the corresponding cs0 to cs3 pin outputs the chip select signal for the specified address area (in rom or sram). however, in order for the chip select signal to be output, the port 6 function register (p6fc) must be set. cs2a to cs2g and csexa (cs pin except cs0 to cs3 ) are made by mmu. these pins are cs pin that area and bank value is fixed without concern in setting of cs/wait controller. the areas cs0 to cs3 are defined by the valu es in the memory start address registers msar0 to msar3 and the memory address mask registers mamr0 to mamr3. the chip select/wait control registers b0cs to b3cs and bexcs should be used to specify the master enable/disable status the data bus width and the number of waits for each address area. the input pin controlling these states is the bus wait request pin ( wait ). 3.6.1 specifying an address area the cs0 to cs3 address areas are specified using the start address registers (msar0 to msar3) and memory address mask registers (mamr0 to mamr3). at each bus cycle, a compare operation is performed to determine if the address on the specified a location in the cs0 to cs3 area. if the result of the comparison is a match, this indicates an access to the corresponding cs area. in this case, the cs0 to cs3 pin outputs the chip select signal and the bus cycle operates in accordance with the settings in chip select/wait control register b0cs to b3cs. (see 3.6.2 ?chip select/wait control registers?.)
tmp91c820a 2008-02-20 91c820a-98 (1) memory start address registers figure 3.6.1 shows the memory start address registers. the memory start address registers msar0 to msar3 set the start addresses for the cs0 to cs3 areas. set the upper eight bits (a23 to a16) of the start address in . the lower 16 bits of the start address (a15 to a0) are permanently set to 0. accordingly, the start address can only be set in 64-kbyte increments, starting from 000000h. figure 3.6.2 shows the relationship between the start address and the start address register value. memory start address registers (for areas cs0 to cs3) 7 6 5 4 3 2 1 0 bit symbol s23 s22 s21 s20 s19 s18 s17 s16 read/write r/w after reset 1 1 1 1 1 1 1 1 function determines a23 to a16 of start address. msar0 (00c8h) msar1 (00cah) msar2 (00cch) msar3 (00ceh) sets start addresses for areas cs0 to cs3. figure 3.6.1 memory start address register 64 kbytes a ddress 000000h ffffffh 000000h ... ................. 00h 010000h ... ................. 01h 020000h ... ................. 02h 030000h ... ................. 03h 040000h ... ................. 04h 050000h ... ................. 05h 060000h ... ................. 06h ff0000h .................... ffh start address value in start address register (msar0 to msar3). to to figure 3.6.2 relationship between start address and start address register value
tmp91c820a 2008-02-20 91c820a-99 (2) memory address mask registers figure 3.6.3 shows the memory address mask registers. memory address mask registers mamr0 to mamr3 are used to set the size of the cs0 to cs3 areas by specifying a mask for each bit of the start address set in memory start address registers mamr0 to mamr3. the compare oper ation used to determine if an address is in the cs0 to cs3 areas is only performe d for bus address bits corresponding to bits set to 0 in these registers. also, the address bits that can be masked by mamr0 to mamr3 differ between cs0 to cs3 areas. accordingly, the size that can be each area is different. memory address mask register (for cs0 area) 7 6 5 4 3 2 1 0 bit symbol v20 v19 v18 v17 v16 v15 v14 to v9 v8 read/write r/w after reset 1 1 1 1 1 1 1 1 function sets size of cs0 area 0: used for address compare range of possible settings for cs0 area size: 256 bytes to 2 mbytes memory address mask register (cs1) 7 6 5 4 3 2 1 0 bit symbol v21 v20 v19 v18 v17 v16 v15 to v9 v8 read/write r/w after reset 1 1 1 1 1 1 1 1 function sets size of cs1 area 0: used for address compare range of possible settings for cs1 area size: 256 bytes to 4 mbytes. memory address mask register (cs2, cs3) 7 6 5 4 3 2 1 0 bit symbol v22 v21 v20 v19 v18 v17 v16 v15 read/write r/w after reset 1 1 1 1 1 1 1 1 function sets size of cs2 or cs3 area 0: used for address compare range of possible settings for cs2 and cs3 area sizes: 32 kbytes to 8 mbytes. mamr0 (00c9h) mamr1 (00cbh) mamr2 (00cdh) mamr3 (00cfh) figure 3.6.3 memory address mask registers
tmp91c820a 2008-02-20 91c820a-100 (3) setting memory start addresses and address areas figure 3.6.4 shows an example of specifying a 64-kbyte address area starting from 010000h using the cs0 areas. set 01h in memory start address register msar0 (corresponding to the upper 8 bits of the start address). next, calculate the difference between the start address and the anticipated end address (01ffffh) based on the size of the cs0 area. bits 20 to 8 of the result correspond to the mask value to be set for the cs0 area. setting this value in memory address mask register mamr0 sets the area size. this example sets 07h in mamr0 to specify a 64k-byte area. 0 0 0 0 0 0 0 1 1 1 11111111111111 0 1 f f f f s23 s22 s21 s20 s19 s18 s17 s16 0 0 0 0 0 0 0 1 0 1 h v20 v19 v18 v17 v16 v15 v14 to v9 v8 0 0 0 0 0 0 0 0 1 1 11111111111111 0 7 h h memory end address memory start address cs0 area size (64 kbytes) memory address mask register setting msar0 msmr0 setting of 07h specifies a 64-kbyte area. figure 3.6.4 example showing how to set the cs0 area after a reset, msar0 to msar3 and mamr0 to mamr3 are set to ffh. b0cs, b1cs and b3cs are reset to 0. this disabling the cs0, cs1 and cs3 areas. however, as b2cs to 0 and b2cs to 1, cs2 is enabled from 000fe0h to 000fffh and 003000h to ffffffh in tmp91c820a. also, the bus width and number of waits specified in bexcs are used for accessing addresses outside the specified cs0 to cs3 area. (see 3.6.2 ?chip select/wait control registers?.)
tmp91c820a 2008-02-20 91c820a-101 (4) address area size specification table 3.6.1 shows the relationship between cs area and area size. ? ? ? indicates areas that cannot be set by memory start address register and address mask register combinations. when setting an area size using a combination indicated by ? ? ?, set the start address mask register in the desired steps starting from 000000h. if the cs2 area is set to 16 mbytes or if two or more areas overlap, the smaller cs area number has the higher priority. example: to set the area size for cs0 to 128 kbytes: a. valid start addresses 000000h 020000h 040000h 060000h 128 kbytes 128 kbytes 128 kbytes any of these addresses may be set as the start address. : b. invalid start addresses 000000h 010000h 030000h 050000h 64 kbytes 128 kbytes 128 kbytes this is not an integer multiple of the desired area size setting. hence, none of these addresses can be set as the start address. : table 3.6.1 valid area sizes for each cs area size (bytes) cs area 256 512 32 k 64 k 128 k 256 k 512 k 1 m 2 m 4 m 8 m cs0 ? ? ? ? ? cs1 ? ? ? ? ? ? cs2 ? ? ? ? ? ? ? cs3 ? ? ? ? ? ? ? note: ? ? ? indicates areas that cannot be set by memory start address register and address mask register combinations. 3.6.2 chip select/wait control registers figure 3.6.5 lists the chip select/wait control registers. the master enable/disable, chip select output waveform, data bus width and number of wait states for each address area (cs0 to cs3 and others) are set in their respective chip select/wait control registers, b0cs to b3cs and bexcs.
tmp91c820a 2008-02-20 91c820a-102 chip select/wait control registers 7 6 5 4 3 2 1 0 bit symbol b0e b0om1 b0om0 b0bus b0w2 b0w1 b0w0 read/write w w after reset 0 0 0 0 0 0 0 function 0: disable 1: enable chip select output waveform selection 00: for rom/sram 01: 10: don?t care 11: data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits bit symbol b1e b1om1 b1om0 b1bus b1w2 b1w1 b1w0 read/write w w after reset 0 0 0 0 0 0 0 function 0: disable 1: enable chip select output waveform selection 00: for rom/sram 01: 10: don?t care 11: data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits bit symbol b2e b2m b2om1 b2om0 b2bus b2w2 b2w1 b2w0 read/write w after reset 1 0 0 0 0 0 0 0 function 0: disable 1: enable cs2 area selection 0: 16-mbyte area 1: cs area chip select output waveform selection 00: for rom/sram 01: 10: don?t care 11: data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits bit symbol b3e b3om1 b3om0 b3bus b3w2 b3w1 b3w0 read/write w w after reset 0 0 0 0 0 0 0 function 0: disable 1: enable chip select output waveform selection 00: for rom/sram 01: 10: don?t care 11: data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits bit symbol bexbus bexw2 bexw1 bexw0 read/write 0 after reset 0 0 0 0 function data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits chip select output waveform selection 00 for rom/sram 01 10 11 don?t care master enable bit 0 disable 1 enable b0cs (00c0h) read- modify- write instructions are prohibited. b1cs (00c1h) read- modify- write instructions are prohibited. b2cs (00c2h) read- modify- write instructions are prohibited. b3cs (00c3h) read- modify- write instructions are prohibited. bexcs (00c7h) read- modify- write instructions are prohibited. cs2 area selection 0 16-mbyte area 1 specified address area data bus width selection 0 16-bit data bus 1 8-bit data bus number of address area waits (see 3.6.2 (3) ?wait control?.) figure 3.6.5 chip select/wait control registers
tmp91c820a 2008-02-20 91c820a-103 (1) master enable bits bit 7 (, , or ) of a chip select/wait control register is the master bit, which is used to enable or disable settings for the corresponding address area. writing 1 to this bit enables the settings. reset disables (sets to 0) , and , and enabled (sets to 1) . this enables area cs2 only. (2) data bus width selection bit 3 (, , , or ) of a chip select/wait control register specifies the width of the data bus. this bit should be set to 0 when memory is to be accessed using a 16-bit data bus and to 1 when an 8-bit data bus is to be used. this process of changing the data bus width according to the address being accessed is known as dynamic bus sizing. for details of this bus operation see table 3.6.2.
tmp91c820a 2008-02-20 91c820a-104 table 3.6.2 dynamic bus sizing l h h l h l h l h h l h l l h l l h l l l h l l l l h l l h h l h l h l h h l h l l h l l h l l l h l l l l h l l h control for write cycle r/w l h h h l h l h l h h l h l l h l l h l l l h l l l l h l l h h l control for read cycle r/w h d7 to d0 b7 to b0 b7 to b0 b7 to b0 xxxx b7 to b0 b15 to b8 b7 to b0 b7 to b0 b15 to b8 xxxx b15 to b8 b7 to b0 b15 to b8 b23 to b16 b31 to b24 b7 to b0 b23 to b16 b7 to b0 b15 to b8 b23 to b16 b31 to b24 xxxx b15 to b8 b31 to b24 cpu data d15 to d8 xxxx xxxx xxxx b7 to b0 xxxx xxxx b15 to b8 xxxx xxxx b7 to b0 xxxx xxxx xxxx xxxx xxxx b15 to b8 b31 to b24 xxxx xxxx xxxx xxxx b7 to b0 b23 to b16 xxxx cpu address 2n + 0 2n + 0 2n + 1 2n + 1 2n + 0 2n + 1 2n + 0 2n + 1 2n + 2 2n + 1 2n + 2 2n + 0 2n + 1 2n + 2 2n + 3 2n + 0 2n + 2 2n + 1 2n + 2 2n + 3 2n + 4 2n + 1 2n + 2 2n + 4 memory data bus width 8 bits 16 bits 8 bits 16 bits 8 bits 16 bits 8 bits 16 bits 8 bits 16 bits 8 bits 16 bits operand start address 2n + 0 (even number) 2n + 1 (odd number) 2n + 0 (even number) 2n + 1 (odd number) 2n + 0 (even number) 2n + 1 (odd number) operand data bus width 8 bits 16 bits 32 bits xxxx: indicates that the input data from these bits are ignored during a read. during a write, indicates that the bus for these bits goes to high impedance; also, that the write strobe signal for the bus remains inactive. rd w r hw r srlb srub srwr rd w r hw r srlb srub srwr
tmp91c820a 2008-02-20 91c820a-105 (3) wait control bits 0 to 2 (, , , , ) of a chip select/wait control register spec ify the number of waits that are to be inserted when the corresponding memory area is accessed. the following types of wait operation can be specified using these bits. bit settings other than those listed in the table should not be made. table 3.6.3 wait operation settings number of waits wait operation 000 2 waits inserts a wait of 2 states, irrespective of the wait pin state. 001 1 wait inserts a wait of 1 state, irrespective of the wait pin state. 010 (1 + n) waits samples the state of the wait pin after inserting a wait of one state. if the wait pin is low, the waits continue and the bus cycle is extended until the pin goes high. 011 0 waits ends the bus cycle without a wait, regardless of the wait pin state. 100 reserved invalid setting 101 3 waits inserts a wait of 3 states, irrespective of the wait pin state. 110 4 waits inserts a wait of 4 states, irrespective of the wait pin state. 111 8 waits inserts a wait of 8 states, irrespective of the wait pin state. a reset sets these bits to 000 (2 waits). (4) bus width and wait control for an area other than cs0 to cs3 t he chip select/wait control register bexcs controls the bus width and number of waits when memory locations, which are not in one of the four users specified address areas (cs0 to cs3), are accessed. the bexcs register settings are always enabled for areas other than cs0 to cs3. (5) selecting 16-mbyte area/specified address area setting b2cs (bit6 of the chip select/wait control register for cs2) to 0 designates the 16-mbyte area (000fe0h to 000fffh, 003000h to ff7fffh) as the cs2 area. setting b2cs to 1 designates the address area specified by the start address register msar2 and the address mask register mamr2 as cs2 (e.g., if b2cs = 1, cs2 is specified in the same manner as cs0, cs1 and cs3 are). a reset clears this bit to 0, specifying cs2 as 16-mbyte address area. (6) procedure for setting chip select/wait control when using the chip select/wait control function, set the registers in the following order: a. set the memory start address registers msar0 to msar3. set the start addresses for cs0 to cs3. b. set the memory address mask registers mamr0 to mamr3. set the sizes of cs0 to cs3. c. set the chip select/wait control registers b0cs to b3cs. set the chip select output waveform, data bus width, number of waits and master enable/disable status for cs0 to cs3 . the cs0 to s3 pins can also function as pins p60 to p63. to output a chip select signal using one of these pins, set the corresponding bit in the port 6 function register (p6fc) to 1.
tmp91c820a 2008-02-20 91c820a-106 if a cs0 to s3 address is specified which is actually an internal i/o and ram area address, the cpu accesses the internal address area and no chip select signal is output on any of the cs0 to cs3 pins. example: in this example cs0 is set to be the 64-kbyte area 010000h to 01ffffh. the bus width is set to 16 bits and the number of waits is set to 0. msar0 = 01h .......... start address: 010000h mamr0 = 07h ......... address area: 64 kbytes b0cs = 83h.............. rom/sram, 16-bit data bus, 0 waits, cs0 area settings enabled 3.6.3 connecting external memory figure 3.6.6 shows an example of how to connect external memory to the tmp91c820a. in this example the rom is connected using a 16-bit bus. the ram and i/o are connected using an 8-bit bus. address bus c s 8-bit ram oe we tmp91c820a cs upper byte rom oe c s lower byte rom oe c s 8-bit i/o oe we a0-a23 cs0 cs1 cs2 a0 to a23 d8 to d15 d0 to d7 rd wr figure 3.6.6 example of external memory connection (rom uses 16-bit bus; ram and i/o use 8-bit bus.) a reset clears all bits of the port 6 control register (p6cr) and the port 6 function register (p6fc) to 0 and disables output of the cs si gnal. to output the cs signal, the appropriate bit must be set to 1.
tmp91c820a 2008-02-20 91c820a-107 figure 3.6.7 how to connect to 16-bit sram for tmp91c820a oe lds uds r/w ce i/o [16:1] a0 a1 a2 rd srlb srub srwr cs0 d [15:0] a0 a1 a2 a3 tmp91c820a 16-bit sram not connect ... ... ...
tmp91c820a 2008-02-20 91c820a-108 3.7 8-bit timers (tmra) the tmp91c820a features 4 built-in 8-bit timers. these timers are paired into four modules: tmra01 and tmra23. each module consists of two channels and can operate in any of the following four operating modes. ? 8-bit interval timer mode ? 16-bit interval timer mode ? 8-bit programmable square wave pulse generation output mode (ppg: variable duty cycle with variable period) ? 8-bit pulse width modulation output mode (pwm: variable duty cycle with constant period) figure 3.7.1 and 3.7.2 show block diagrams for tmra01 and tmra23. each channel consists of an 8-bit up counter, an 8-bit comparator and an 8-bit timer register. in addition, a timer flip-flop and a prescale r are provided for each pair of channels. the operation mode and timer flip-flops are controlled by five controls sfrs (special function registers). each of the two modules (tmra01 and tmra23) can be operated independently. all modules operate in the same manner; hence only the operation of tmra01 is explained here. the contents of this chapter are as follows. 3.7.1 block diagrams 3.7.2 operation of each circuit 3.7.3 sfrs 3.7.4 operation in each mode (1) 8-bit timer mode (2) 16-bit timer mode (3) 8-bit ppg (programmable pulse generation) output mode (4) 8-bit pwm (pulse width modulation) output mode (5) settings for each mode (6) lcdc and melody/alarm circuit supply mode table 3.7.1 registers and pins for each module module tmra01 tmra23 input pin for external clock ta0in (shared with pb0) no external pin output pin for timer flip-flop ta1out (shared with pb1) ta3out (shared with pb5) timer run register ta01 run (0100h) ta23run (0108h) timer register ta0reg (0102h) ta1reg (0103h) ta2reg (010ah) ta3reg (010bh) timer mode register ta01mod (0104h) ta23mod (010ch) sfr (address) timer flip-flop control register ta1ffcr (0105h) ta3ffcr (010dh)
tmp91c820a 2008-02-20 91c820a-109 3.7.1 block diagrams run/clear prescaler clock: t0 ta0trg external input clock: ta0in ta01mod selector 8-bit up counter (uc1) 8-bit comparator (cp1) 8-bit up counter (uc0) 8-bit timer register ta1reg 8-bit comparator (cp0) match detect register buffer 0 8-bit timer register ta0reg ta01run ta01run t1 t4 t16 2 n over flow tmra0 interrupt output: intta0 ta01mod tmra0 match output : ta0trg selector t1 t16 t256 internal bus ta01mod ta01mod match detect tmra1 interrupt output: intta1 ta01run timer flip-flop ta1ff ta1ffcr timer flip-flop output: ta1out 512 256 128 64 32 16 8 4 2 t1 t4 t16 t256 prescaler ta01run internal bus figure 3.7.1 tmra01 block diagram
tmp91c820a 2008-02-20 91c820a-110 run/clear prescaler clock: t0 ta2tr ta23mod selector 8-bit comparator (cp3) 8-bit up counter (uc2) 8-bit timer register ta3reg 8-bit comparator (cp2) match detect register buffer 2 ta23run ta23run t1 t4 t16 2 n over flow tmra2 interrupt output: intta2 ta23mod tmra2 match output: ta2trg selector t1 t16 t256 internal bus ta23mod match detect tmra3 interrupt output: intta3 ta23run timer flip-flop ta3ff ta3ffcr timer flip-flop output: ta3out (supply to mld, lcdc) 512 256 128 64 32 16 8 4 2 t1 t4 t16 t256 prescaler ta23run internal bus 8-bit up counter (uc3) 8-bit timer register ta2reg ta23mod figure 3.7.2 tmra23 block diagram
tmp91c820a 2008-02-20 91c820a-111 3.7.2 operation of each circuit (1) prescaler a 9-bit prescaler generates the input clock to tmra01. the clock t0 is divided by 4 and input to this prescaler. t0 can be either f fph or fc/16 and is selected using the prescaler clock selection register syscr0. the prescaler operation can be controlled using ta01run in the timer control register. setting to 1 starts the count; setting to 0 clears the prescaler to 0 and stops operation. table 3.7.2 shows the various prescaler output clock resolutions. table 3.7.2 prescaler output clock resolution at fc = 36 mhz, fs = 32.768 khz prescaler output clock resolution system clock selection prescaler clock selection gear value t1 t4 t16 t256 1 (fs) xxx 2 3 /fs (244 s) 2 5 /fs (977 s) 2 7 /fs (3.9 ms) 2 11 /fs (62.5 ms) 000 (fc) 2 3 /fc (0.2 s) 2 5 /fc (0.9 s) 2 7 /fc (3.6 s) 2 11 /fc (56.9 s) 001 (fc/2) 2 4 /fc (0.4 s) 2 6 /fc (1.8 s) 2 8 /fc (7.1 s) 2 12 /fc (113.8 s) 010 (fc/4) 2 5 /fc (0.9 s) 2 7 /fc (3.6 s) 2 9 /fc (14.2 s) 2 13 /fc (227.6 s) 011 (fc/8) 2 6 /fc (1.8 s) 2 8 /fc (7.1 s) 2 10 /fc (28.4 s) 2 14 /fc (455.1 s) 00 (f fph ) 100 (fc/16) 2 7 /fc (3.6 s) 2 9 /fc (14.2 s) 2 11 /fc (56.9 s) 2 15 /fc (910.2 s) 0 (fc) 10 (fc/16 clock) xxx 2 7 /fc (3.6 s) 2 9 /fc (14.2 s) 2 11 /fc (56.9 s) 2 15 /fc (910.2 s) xxx: don?t care (2) up counters (uc0 and uc1) these are 8-bit binary counters which count up the input clock pulses for the clock specified by ta01mod. the input clock for uc0 is selectable and ca n be either the external clock input via the ta0in pin or one of the three internal clocks t1, t4 or t16. the clock setting is specified by the value set in ta01mod. the input clock for uc1 depends on the operation mode. in 16-bit timer mode, the overflow output from uc0 is used as the input clock. in any mode other than 16-bit timer mode, the input clock is selectable and can either be one of the internal clocks t1, t16 or t256, or the comparator output (the match detection signal) from tmra0. for each interval timer the timer operation control register bits ta01run and ta01run can be used to stop and clear the up counters and to control their count. a reset clears both up counters, stopping the timers.
tmp91c820a 2008-02-20 91c820a-112 (3) timer registers (ta0reg and ta1reg) these are 8-bit registers, which can be used to set a time interval. when the value set in the timer register ta0reg or ta1reg matches the value in the corresponding up counter, the comparator match detect signal goes active. if the value set in the timer register is 00h, the signal goes ac tive when the up counter overflows. the ta0reg are double buffer structure, ea ch of which makes a pair with register buffer. the setting of the bit ta01run determines whether ta0reg?s double buffer structure is enabled or disabled. it is disabled if = 0 and enabled if = 1. when the double buffer is enabled, data is transferred from the register buffer to the timer register when a 2 n overflow occurs in pwm mode, or at the start of the ppg cycle in ppg mode. hence the double buffer cannot be used in timer mode. a reset initializes to 0, disabling the double buffer. to use the double buffer, write data to the timer register, set to 1, and write the following data to the register buffer. figure 3.7.3 shows the configuration of ta0reg. figure 3.7.3 configuration of ta0reg note: the same memory address is allocated to the timer register and the register buffer. when = 0, the same value is written to the register buffer and the timer register; when = 1, only the register buffer is written to. the address of each timer register is as follows. ta0reg: 000102h ta1reg: 000103h ta2reg: 00010ah ta3reg: 00010bh all these registers are writ e only and cannot be read. y b a selector write shift trigger write to ta0reg 2 n overflow of pwm ta01run timer registers 0 (ta0reg) register buffers 0 internal data bus matching detection in ppg cycle s
tmp91c820a 2008-02-20 91c820a-113 (4) comparator (cp0) the comparator compares the value in an up counter with the value set in a timer register. if they match, the up counter is cleared to 0 and an interrupt signal (intta0 or intta1) is generated. if timer flip-flop inversion is enabled, the timer flip-flop is inverted at the same time. (5) timer flip-flop (ta1ff) t he timer flip-flop (ta1ff) is a flip-flop inverted by the match detects signal (8-bit comparator output) of each interval timer. whether inversion is enabled or disabled is determined by the setting of the bit ta1ffcr in the timer flip-flops control register. a reset clears the value of ta1ff to 0. writing 01 or 10 to ta1ffcr sets ta1ff to 0 or 1. writing 00 to these bits inverts the value of ta1ff. (this is known as software inversion.) the ta1ff signal is output via the ta1out pin. when this pin is used as the timer output, the timer flip-flop should be set beforehand using the port b function register pbcr, pbfc. note: when the double buffer is enabled for an 8-bit timer in pwm or ppg mode, caution is required as explained below. if new data is written to the register buffer immediately before an overflow occurs by a match between the timer register value and the up-counter value, the timer flip-flop may output an unexpected value. for this reason, make sure that in pwm mode new data is written to the register buffer by six cycles (f sys 6) before the next overflow occurs by using an overflow interrupt. in the case of using ppg mode, make sure that new data is written to the register buffer by six cycles before the next cycle compare match occurs by using a cycle compare match interrupt. example when using pwm mode ta1out 2 n overflow interrupt (intta0) t pwm (pwm cycle) match between ta0reg and up-counter desired pwm cycle change point write new data to the register buffer before the next overflow occurs by using an overflow interrupt
tmp91c820a 2008-02-20 91c820a-114 3.7.3 sfrs tmra01 run register 7 6 5 4 3 2 1 0 bit symbol ta0rde i2ta01 ta01prun ta1run ta0run read/write r/w r/w after reset 0 0 0 0 0 function double buffer 0: disable 1: enable idle2 0: stop 1: operate 8-bit timer run/stop control 0: stop and clear 1: run (count up) ta01run (0100h) timer run/stop control 0 stop and clear 1 run (count up) ta0reg double buffer control 0 disable 1 enable i2ta01: operation in idle2 mode ta01prun: run prescaler ta1run: run tmra1 ta0run: run tmra0 note: the values of bits 4 to 6 of ta01run are undefined when read. tmra23 run register 7 6 5 4 3 2 1 0 bit symbol ta2rde i2ta23 ta23prun ta3run ta2run read/write r/w r/w after reset 0 0 0 0 0 function double buffer 0: disable 1: enable idle2 0: stop 1: operate 8-bit timer run/stop control 0: stop and clear 1: run (count up) ta23run (0108h) timer run/stop control 0 stop and clear 1 run (count up) ta2reg double buffer control 0 disable 1 enable i2ta23: operation in idle2 mode ta23prun: run prescaler ta3run: run tmra3 ta2run: run tmra2 note: the values of bits 4 to 6 of ta23run are undefined when read. figure 3.7.4 register for tmra
tmp91c820a 2008-02-20 91c820a-115 tmra01 mode register 7 6 5 4 3 2 1 0 bit symbol ta01m1 ta01m0 pwm01 pwm00 ta1clk1 ta1clk0 ta0clk1 ta0clk0 read/write r/w after reset 0 0 0 0 0 0 0 0 function operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 source clock for tmra1 00: ta0trg 01: t1 10: t16 11: t256 source clock for tmra0 00: ta0in pin 01: t1 10: t4 11: t16 00 ta0in (external input) 01 t1 (prescaler) 10 t4 (prescaler) 11 t16 (prescaler) ta01mod 01 ta01mod = 01 00 comparator output from tmra0 01 t1 10 t16 11 t256 overflow output from tmra0 (16-bit timer mode) 00 reserved 01 2 6 source clock 10 2 7 source clock 11 2 8 source clock 00 two 8-bit timers 01 16-bit timer 10 8-bit ppg 11 8-bit pwm (tmra0) + 8-bit timer (tmra1) ta01mod (0104h) pwm cycle selection tmra0 source clock selection tmra1 source clock selection tmra01 operation mode selection figure 3.7.5 register for tmra
tmp91c820a 2008-02-20 91c820a-116 tmra23 mode register 7 6 5 4 3 2 1 0 bit symbol ta23m1 ta23m0 pwm21 pwm20 ta3clk1 ta3clk0 ta2clk1 ta2clk0 read/write r/w after reset 0 0 0 0 0 0 0 0 function operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 tmra3 clock for tmra3 00: ta2trg 01: t1 10: t16 11: t256 tmra2 clock for tmra2 00: reserved 01: t1 10: t4 11: t16 00 do not set 01 t1 (prescaler) 10 t4 (prescaler) 11 t16 (prescaler) ta23mod 01 ta23mod = 01 00 comparator output from tmra2 01 t1 10 t16 11 t256 overflow output from tmra2 (16-bit timer mode) 00 reserved 01 2 6 source clock 10 2 7 source clock 11 2 8 source clock 00 two 8-bit timers 01 16-bit timer 10 8-bit ppg 11 8-bit pwm (tmra2) + 8-bit timer (tmra3) ta23mod (010ch) pwm cycle selection tmra2 source clock selection tmra3 source clock selection tmra23 operation mode selection figure 3.7.6 register for tmra
tmp91c820a 2008-02-20 91c820a-117 tmra1 flip-flop control register 7 6 5 4 3 2 1 0 bit symbol ta1ffc1 ta1ffc0 ta1ffie ta1ffis read/write r/w r/w after reset 1 1 0 0 function 00: invert ta1ff 01: set ta1ff 10: clear ta1ff 11: don?t care ta1ff control for inversion 0: disable 1: enable ta1ff inversion select 0: tmra0 1: tmra1 0 inversion by tmra0 1 inversion by tmra1 0 disabled 1 enabled 00 inverts the value of ta1ff 01 sets ta1ff to 1 10 clears ta1ff to 0 11 don?t care ta1ffcr (0105h) control of ta1ff inverse signal for timer flip-flop 1 (ta1ff) (don?t care except in 8-bit timer mode) inversion of ta1ff read- modify- write instructions are prohibited. figure 3.7.7 register for tmra
tmp91c820a 2008-02-20 91c820a-118 tmra3 flip-flop control register 7 6 5 4 3 2 1 0 bit symbol ta3ffc1 ta3ffc0 ta3ffie ta3ffis read/write r/w r/w after reset 1 1 0 0 function 00: invert ta3ff 01: set ta3ff 10: clear ta3ff 11: don?t care ta3ff control for inversion 0: disable 1: enable ta3ff inversion select 0: tmra2 1: tmra3 0 inversion by tmra2 1 inversion by tmra3 0 disabled 1 enabled 00 inverts the value of ta3ff 01 sets ta3ff to 1 10 clears ta3ff to 0 11 don?t care ta3ffcr (010dh) control of ta3ff inverse signal for timer flip-flop 3 (ta3ff) (don?t care except in 8-bit timer mode) inversion of ta3ff read- modify- write instructions are prohibited. figure 3.7.8 register for tmra
tmp91c820a 2008-02-20 91c820a-119 tmra register 7 6 5 4 3 2 1 0 bit symbol ? read/write w ta0reg (0102h) after reset undefined bit symbol ? read/write w ta1reg (0103h) after reset undefined bit symbol ? read/write w ta2reg (010ah) after reset undefined bit symbol ? read/write w ta3reg (010bh) after reset undefined note: the above registers are prohibited read-modify-write instruction. figure 3.7.9 register for tmra
tmp91c820a 2008-02-20 91c820a-120 3.7.4 operation in each mode (1) 8-bit timer mode both tmra0 and tmra1 can be used independently as 8-bit interval timers. a. generating interrupts at a fixed interval (using tmra1) to generate interrupts at constant intervals using tmra1 (intta1), first stop tmra1 then set the operation mode, input clock and a cycle to ta01mod and ta1reg register respectively. then, enable the interrupt intta1 and start tmra1 counting. example: to generate an intta1 interrupt every 8.0 s at fc = 36 mhz, set each register as follows: * clock state system clock: high frequency (fc) prescaler clock: f fph msb lsb 7 6 5 4 3 2 1 0 ta01run ? ? x x ? ? 0 ? stop tmra1 and clear it to 0. ta01mod 0 0 x x 1 0 ? ? select 8-bit timer mode and select t1 (0.2 s at fc = 36 mhz) as the input clock. ta1reg 0 0 1 0 1 0 0 0 set ta1reg to 8.0 s t1 = 40 = 28h. inteta01 x 1 0 1 ? ? ? ? enable intta1 and set it to level 5. ta01run ? x x x ? 1 1 ? start tmra1 counting. x: don?t care, ? : no change select the input clock using table 3.7.2. note: the input clocks for tmra0 and tmra1 are different from as follows. tmra0: ta0in input, t1, t4 or t16. tmra1: match output of tmra0, t1, t16, t256.
tmp91c820a 2008-02-20 91c820a-121 b. generating a 50% duty ratio square wave pulse the state of the timer flip-flop (ta1ff) is inverted at constant intervals and its status output via the timer output pin (ta1out). example: to output a 1.2 s square wave pulse from the ta1out pin at fc = 36mhz, use the following procedure to make the appropriate register settings. this example uses tmra1; however, either tmra0 or tmra1 may be used. * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph 7 6 5 4 3 2 1 0 ta01run ? x x x ? ? 0 ? stop tmra1 and clear it to 0. ta01mod 0 0 x x 0 1 ? ? select 8-bit timer mode and select t1 (0.2 s at fc = 36 mhz) as the input clock. ta1reg 0 0 0 0 0 0 1 1 set the timer register to 1.2 s t1 2 = 3. ta1ffcr x x x x 1 0 1 1 clear ta1ff to 0 and set it to invert on the match detects signal from tmra1. pbcr x ? ? ? ? x 1 ? pbfc x ? ? ? ? x 1 ? set pb1 to function as the ta1out pin. ta01run ? x x x ? 1 1 ? start tmra1 counting. x: don?t care, ? : no change 0.6 s at fc = 36 mhz bit7 to 2 t1 intta1 uc1 clea r ta1ff bit0 bit1 ta01run up counter comparator timing comparator output (match detect) ta1out 0 1 1 1 2 2 2 3 3 3 0 00 figure 3.7.10 square wave output timing chart (50% duty)
tmp91c820a 2008-02-20 91c820a-122 c. making tmra1 count up on the match signal from the tmra0 comparator select 8-bit timer mode and set the comp arator output from tmra0 to be the input clock to tmra1. tmra1 up counter (when ta1reg = 2) tmra0 up counter (when ta0reg = 5) 1 2 3 4 5 1 1 22 33 45 12 1 comparaot output (tmra0 match) tmra1 match output figure 3.7.11 tmra1 count up on signal from tmra0
tmp91c820a 2008-02-20 91c820a-123 (2) 16-bit timer mode pairing the two 8-bit timers tmra0 and tmra1 configures a 16-bit interval timer. to make a 16-bit interval timer in which tmra0 and tmra1 are cascaded together, set ta01mod to 01. in 16-bit timer mode, the over flow output from tmra0 is used as the input clock for tmra1, regardless of the value set in ta01mod. table 3.7.2 shows the relationship between the timer (interrupt) cycle and the input clock selection. setting example: to generate an intta1 interrupt every 0.22 s at fc = 36 mhz, set the timer registers ta0reg and ta1reg as follows: * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph if t16 ((2 7 /fc)s at 36 mhz) is used as the input clock for counting, set the following value in the registers: 0.22 s (2 7 /fc)s 62500 = f424h (e.g. set ta1reg to f4h and ta0reg to 24h). as a result, intta1 interrupt can be generated every 0.23 [s]. the comparator match signal is output from tmra0 each time the up counter uc0 matches ta0reg, though the up counter uc0 is not be cleared. in the case of the tmra1 comparator, the match detect signal is output on each comparator pulse on which the values in the up counter uc1 and ta1reg match. when the match detect signal is output simultaneously from both the comparator tmra0 and tmra1, the up counters uc0 and uc1 are cleared to 0 and the interrupt intta1 is generated. also, if inversion is enabled, the value of the timer flip-flop ta1ff is inverted. example: when ta1reg = 04h and ta0reg = 80h figure 3.7.12 timer output by 16-bit timer mode 0080h 0180h 0280h 0380h 0480h value of up counter (uc1, uc0) tmra0 comparator match detect signal intta0 0080h inversion ta1out tmra0 comparator match detect signal intta1
tmp91c820a 2008-02-20 91c820a-124 (3) 8-bit ppg (programmable pu lse generation) output mode square wave pulses can be generated at any frequency and duty ratio by tmra0. the output pulses may be active-low or active-high. in this mode tmra1 cannot be used. tmra0 outputs pulses on the ta1out pin. figure 3.7.13 8-bit ppg output waveforms t ta0reg and uc0 match (interrupt intta0) t h t l ta0reg ta1reg ta1reg and uc0 match ( interru p ut intta1 ) ta1out t t l t h when =?10? when =?01? example when =?01?
tmp91c820a 2008-02-20 91c820a-125 in this mode a programmable square wave is generated by inverting the timer output each time the 8-bit up counter (uc0) matches the value in one of the timer registers ta0reg or ta1reg. the value set in ta0reg must be smaller than the value set in ta1reg. although the up counter for tmra1 (uc1) is not used in this mode, ta01run should be set to 1 so that uc1 is set for counting. figure 3.7.14 shows a block diagram representing this mode. figure 3.7.14 block diagram of 8-bit ppg output mode if the ta0reg double buffer is enabled in this mode, the value of the register buffer will be shifted into ta0reg each time ta1reg matches uc0. use of the double buffer facilitates the handling of low-duty waves (when duty is varied). q 3 shift from register buffer match with ta0reg and up counte r match with ta1reg ta0reg (value to be compared) register buffe r (up counter = q 1 ) q 1 ta0reg (register buffer) write (up countner = q 2 ) q 2 q 2 figure 3.7.15 operation of register buffer selector t1 shift trigger t4 t16 ta01run 8-bit up counter (uc 0) comparator comparator ta0reg register buffer ta01run ta1reg internal data bus ta1ff intta0 intta1 inversion ta01mod selector ta1ffcr ta0reg-wr ta1out ta0in
tmp91c820a 2008-02-20 91c820a-126 example: to generate 1/4 duty 50 khz pulses (at fc = 36 mhz): * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph calculate the value, which should be set in the timer register. to obtain a frequency of 50 khz, the pulse cycle t should be: t = 1/50 khz = 20 s t1 = (2 3 /fc)s (at 36 mhz); 20 s (2 3 /fc)s 90 therefore set ta1reg to 90 (5ah) the duty is to be set to 1/4: t 1/4 = 20 s 1/4 = 5 s 5 s (2 3 /fc)s 22 therefore, set ta0reg = 22 = 16h. 7 6 5 4 3 2 1 0 ta01run 0 x x x ? 0 0 0 stop tmra0 and tmra01 and clear it to 0. ta01mod 1 0 x x x x 0 1 set the 8-bit ppg mode, and select t1 as input clock. ta0reg 0 0 0 1 0 1 1 0 write16h. ta1reg 0 1 0 1 1 0 1 0 write 5ah. ta1ffcr x x x x 0 1 1 x set ta1ff, enabling both inversion and the double buffer. writing 10 provides negative logic pulse. pbcr x ? ? ? ? x 1 ? pbfc x ? ? ? ? x 1 ? set pb1 as the ta1out pin. ta01run 1 x x x ? 1 1 1 start tmra0 and tmra01 counting. x: don?t care, ? : no change 20 s
tmp91c820a 2008-02-20 91c820a-127 (4) 8-bit pwm (pulse width modulation) output mode this mode is only valid for tmra0. in this mode, a pwm pulse with the maximum resolution of 8 bits can be output. when tmra0 is used the pwm pulse is output on the ta1out pin. tmra1 can also be used as an 8-bit timer. the timer output is inverted when the up counter (uc0) matches the value set in the timer register ta0reg or when 2 n counter overflow occurs (n = 6, 7 or 8 as specified by ta01mod). the up counter uc0 is cleared when 2 n counter overflow occurs. the following conditions must be satisfied before this pwm mode can be used. value set in ta0reg < value set for 2 n counter overflow value set in ta0reg 0 ta1out 2 n overflow (intta0 interrupt) t pwm (pwm cycle) ta0reg and uc0 match figure 3.7.16 8-bit pwm waveforms figure 3.7.17 shows a block diagram representing this mode. figure 3.7.17 block diagram of 8-bit pwm mode ta01mod ta1ffcr internal data bus shift trigger clear 8-bit up counter (uc0) ta01run selector ta0in t1 t4 t16 taff1 ta1out ta0reg register buffer selector ta01run invert ta0reg-wr intta0 ta01mod overflo w 2 n overflow control comparator
tmp91c820a 2008-02-20 91c820a-128 in this mode the value of the register buffer will be shifted into ta0reg if 2 n overflow is detected when the ta 0reg double buffer is enabled. use of the double buffer facilitates the handling of low duty ratio waves. q 2 up counter = = figure 3.7.18 register buffer operation example: to output the following pwm waves on the ta1out pin at fc = 36 mhz: * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph to achieve a 28.4 s pwm cycle by setting t1 to (2 3 /fc)s (at fc = 36 mhz): 28.4 s (2 3 /fc)s 128 = 2 n therefore n should be set to 7. since the low-level period is 16.0 s when t1 = 0.5 s, set the following value for ta0reg: 16.0 s (2 3 /fc)s 72 = 48h msb lsb 7 6 5 4 3 2 1 0 ta01run ? x x x ? ? ? 0 stop tmra0 and clear it to 0. ta01mod 1 1 1 0 ? ? 0 1 select 8-bit pwm mode (cycle: 2 7 ) and select t1 as the input clock. ta0reg 0 1 0 0 1 0 0 0 write 48h. ta1ffcr x x x x 1 0 1 x clear ta1ff to 0; enable the inversion and double buffer. pbcr x ? ? ? ? x 1 ? pbfc x ? ? ? ? x 1 ? set pb1 and the ta1out pin. ta01run 1 x x x ? 1 ? 1 start tmra0 counting. x: don?t care, ? : no change 16.0 s 28.4 s
tmp91c820a 2008-02-20 91c820a-129 table 3.7.3 pwm cycle at fc = 36 mhz, fs = 32.768 khz pwm cycle 2 6 2 7 2 8 select system clock select prescaler clock gear value t1 t4 t16 t1 t4 t16 t1 t4 t16 1 (fs) xxx 15.6 ms 62.5 ms 250 ms 31.3 ms 125 ms 500 ms 62.5 ms 250 ms 1000 ms 000 (fc) 14.2 s 56.8 s 227 s 28.4 s 113 s 455 s 56.8 s 227 s 910 s 001 (fc/2) 28.4 s 113 s 455 s 56.8 s 227 s 910 s 113 s 455 s 1820 s 010 (fc/4) 56.8 s 227 s 910 s 113 s 455 s 1820 s 227 s 910 s 3640 s 011 (fc/8) 113 s 455 s 1820 s 227 s 910 s 3640 s 455 s 1820 s 7281 s 00 (f fph ) 100 (fc/16) 227 s 910 s 3640 s 455 s 1820 s 7281 s 910 s 3640 s 14563 s 0 (fc) 10 (fc/16 clock) xxx 227 s 910 s 3640 s 455 s1820 s 7281 s 910 s 3640 s 14563 s xxx: don?t care (5) settings for each mode table 3.7.4 shows the sfr settings for each mode. table 3.7.4 timer mode setting registers register name ta01mod ta1ffcr ta1ffis function timer mode pwm cycle upper timer input clock lower timer input clock timer f/f invert signal select 8-bit timer 2 channels 00 ? lower timer match t1, t16, t256 (00, 01, 10, 11) external clock t1, t4, t16 (00, 01, 10, 11) 0: lower timer output 1: upper timer output 16-bit timer mode 01 ? ? external clock t1, t4, t16 (00, 01, 10, 11) ? 8-bit ppg 1 channel 10 ? ? external clock t1, t4, t16 (00, 01, 10, 11) ? 8-bit pwm 1 channel 11 2 6 , 2 7 , 2 8 (01, 10, 11) ? external clock t1, t4, t16 (00, 01, 10, 11) ? 8-bit timer 1 channel 11 ? t1, t16, t256 (01, 10, 11) ? output disabled ? : don?t care
tmp91c820a 2008-02-20 91c820a-130 (6) lcdc and melody/alarm circuit supply mode this function can operate only tmra3. it can use lcdc or melody/alarm source clock ta3 clock generated by tmra3. and keep the rule under below. operate 1. clock generate by timer 3 2. clock supply start ( = 1 or = 1) 3. need setup time 4. lcdc or melody/alarm start to operate stop 1. l cdc or melody/alarm stop to operate 2. clock supply cut off ( = 0 or = 0) 7 6 5 4 3 2 1 0 bit symbol protect ta3lcde ahold ta3mlde hresena extin drvosch drvoscl read/write r r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 1 1 function protect flag 0: off 1: on lcdc source clock 0: 32 khz 1: ta3out address hold 0: normal 1: enable melody/alarm source clock 0: 32 khz 1: ta3out hreset 0: disable 1: enable 1: external clock fc oscillator driver ability 1: normal 0: weak fs oscillator driver ability 1: normal 0: weak emccr0 (00e3h)
tmp91c820a 2008-02-20 91c820a-131 3.8 external memory extension function (mmu) this is mmu function which can expand program/data area to 136 mbytes by having 4 local areas. address pins to external memory are 2 extended address bus pins (ea24, ea25) and 8 extended chip select pins ( cs2a to cs2g and csexa ) in addition to 24 address bus pins (a0 to a23) which are common specification of tlcs-900 family and 4 chip select pins ( cs0 to cs3 ) output from cs/wait controller. the feature and the recommendation setting method of two types are shown below. in addition, ?ah? in the table is the value which number address 23 to 16 displayed as hex. purpose item recommendation setting method maximum memory size 16mbytes (16 mbytes 1 pcs) used local area, bank number local2 (ah = c0 ? df: 2 mbytes 7 bank) setting cs/wait setup ah = 80 ? ff to cs2 program rom used cs pin cs2a maximum memory size 96 mbytes (16 mbytes 6 pcs) used local area, bank number local3 (ah = 80 ? bf: 4 mbytes 24 bank) setting cs/wait setup ah = 80 ? ff to cs2 data rom used cs pins cs2b , cs2c , cs2d , cs2e , cs2f , cs2g maximum memory size 16 mbyte (16 mbytes 1 pcs) used local area, bank number local1 (ah = 40 ? 5f: 2 mbytes 7 bank) setting cs/wait setup ah = 40 ? 7f to cs1 option program rom used cs pin cs1 maximum memory size 8 mbytes (8 mbytes 1pcs) used local area, bank number local0 (ah = 10 ? 1f: 1 mbyte 7 bank) setting cs/wait setup ah = 00 ? 1f to cs3 data ram used cs pin cs3 maximum memory size 1 mbyte (1 mbyte 1 pcs) used local area, bank number none setting cs/wait setup ah = 20 ? 2f to cs0 extended memory 1 used cs pin cs0 maximum memory size 256 kbytes (256 kbytes 1 pcs) used local area, bank number none setting cs/wait setup ah = 30 ? 3f to csex extended memory 2 used cs pin csexa maximum memory size 256 kbytes (64 kbytes 4 pcs) used local area, bank number none setting cs/wait setup ah = 30 ? 3f to csex extended memory 3 (direct address assigned built-in type lcd driver) used cs pin d1bscp, d2blp, d3bfr, dlebcd maximum memory size 512 kbytes used local area, bank number none setting cs/wait setup ah = 30 ? 3f to csex extended memory 4 used cs pin none note: sdram must be mapped in local1 area. it can?t use other area.
tmp91c820a 2008-02-20 91c820a-132 3.8.1 recommendable memory map the recommendation logic address memory map at the time of variety extension memory correspondence is shown in figure 3.8.1. and, a physical-address map is shown in figure 3.8.2. however, when memory area is less than 16 mbytes and is not expanded, please refer to section of cs/wait controller. setting of register in mmu is not necessary. the area which can be set as bank is called local-area. while the area for managing the bank is called common-area. since they are being fixed, the address of a common-area and a local-area cannot be changed. 000000h local0 local1 common1 local3 local2 common2 vector area : internal area : overlapped with common area 012 22 23 01234567 01234567 1 mbyte 100000h 200000h 300000h 380000h 3c0000h 3d0000h 3e0000h 3f0000h 400000h 1 mbyte 1 mbyte 512 kbytes 256 kbytes 64 kbytes 64 kbytes 64 kbytes 64 kbytes 2 mbytes 2 mbytes 4 mbytes 2 mbytes 2 mbytes 256 b y tes 600000h 800000h c00000h e00000h ffff00h ffffffh cs3 csex cs1 cs2 cs2a csex csex csex csex csex cs3 ? cs1 cs2b (bank0 to bank3) cs2c (bank4 to bank7) cs2d (bank8 to bank11) cs2e (bank12 to bank15) cs2f (bank16 to bank19) cs2g (bank20 to bank23) cs2a csexa d1bsc d2blp d3bfr dlebcd address size memory map bank cs/wait cs pin 01234567 common0 cs0 cs0 figure 3.8.1 recommendation address map (physical address)
tmp91c820a 2008-02-20 91c820a-133 cs2b for data rom (16 mbytes 6) cs1 for option program rom (sdram support) (16 mbytes) cs3 for data ram (sdram non support) (8 mbytes) reset and interrupt vector area local0 local1 local2 cs2a for program rom (16 mbytes) local3 bank0 bank1 bank2 bank3 bank4 bank5 bank6 bank7 bank0 bank1 bank2 bank3 800000h 1000000h bank0 bank1 bank2 bank3 bank4 bank5 bank6 bank7 : overlapped with common area bank0 bank1 bank2 bank3 bank4 bank5 bank6 bank7 bank4 bank5 bank6 bank7 bank8 bank9 bank10 bank11 bank16 bank17 bank18 bank19 bank20 bank21 bank22 bank23 bank12 bank13 bank14 bank15 cs2e cs2c cs2f cs2d cs2g 000000h 1000000h 000000h 1000000h figure 3.8.2 physical address map
tmp91c820a 2008-02-20 91c820a-134 3.8.2 explanation of sfr there are 4 registers; local0 to local3. each register is for enabling bank and setting bank. setup local registers in common area. and, a combination pin and the cs/wait controller need to be set. when cpu outputs logical address of the local area, mmu outputs physical address to the outside address bus pin according to value of bank setting register. access of external memory becomes possible therefore. local0 register 7 6 5 4 3 2 1 0 bit symbol l0e l0ea22 l0ea21 l0ea20 read/write r/w r/w after reset 0 0 0 0 function bank for local0 0: disable 1: enable setting bank number for local0 do not set ?000? because of common area local1 register 7 6 5 4 3 2 1 0 bit symbol l1e l1ea23 l1ea22 l1ea21 read/write r/w r/w after reset 0 0 0 0 function bank for local1 0: disable 1: enable setting bank number for local1 do not set ?001? because of common area local2 register 7 6 5 4 3 2 1 0 bit symbol l2e l2ea23 l2ea22 l2ea21 read/write r/w r/w after reset 0 0 0 0 function bank for local2 0: disable 1: enable setting bank number for local2 do not set ?111? because of common area local3 register 7 6 5 4 3 2 1 0 bit symbol l3e l3ea26 l3ea25 l3ea24 l3ea23 l3ea22 read/write r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 function bank for local3 0: disable 1: enable 01000 to 01011: cs2d 01100 to 01111: cs2e 00000 to 00011: cs2b 10000 to 10011: cs2f 00100 to 00111: cs2c 10100 to 10111: cs2g 11000 to 11111: set prohibition figure 3.8.3 register for local0 to local3 local0 (0350h) local1 (0351h) local2 (0352h) local3 (0353h)
tmp91c820a 2008-02-20 91c820a-135 data/stack sram cs3 000000h to 1fffffh (logical) 000000h to 7fffffh (physical) display sdram cs1 400000h to 7fffffh (logical) 000000h to ffffffh (physical) program rom cs2 c00000h to ffffffh (logical) 000000h to ffffffh (physical) data rom cs3 800000h to bfffffh (logical) 0000000h to 3ffffffh (physical) * in case of 16-bit bus memory * in case of 8-bit bus memory control si g nals control si g nals tmp91c820a tmp91c820a d [0:15] d [0:15] a 0 a 0 : : a 1 a 15 a 1 a 2 a 16 open memory memory control si g nals control si g nals d [0:7] d [0:7] a 0 a 0 : : a 1 a 7 a 1 a 2 a 7 a 2 tmp91c820a sdram 16 mbytes 16 bits sram 8 mbytes 8 bits mrom 16 mbytes 16 bits mrom 64 mbytes 16 bits data address rd , ( wr , hwr : sram) sdclk, sdcke, sdldqm, sdudqm sdcs , sdras , sdcas sdwe cs0 cs1 cs2 cs3 ea24, ea25 figure 3.8.4 h/w setting example at figure 3.8.4, it shows example of connection tmp91c820a and some memories: program rom: mrom, 16 mbyte, data rom: mrom, 64 mbyte, data ram: sram, 8 mbyte, 8-bit bus, display ram: sdram, 16 mbytes. in case of 16-bit bus memory connection, it need to shift 1-bit address bus from tmp91c820a and 8-bit bus case, direct connection address bus from tmp91c820a. in that figure, logical address and physical address are shown. and each memory allot each chip select signal, ram: cs0 , sdram: cs1 , program mrom: cs2 , data mrom: cs3 in case of this example, as data mrom is 64 mbyte, this mrom connect to ea24 and ea25. initial condition after reset, because tmp91c820a access from cs2 area, cs2 area allots to program rom. it can set free setting except program rom.
tmp91c820a 2008-02-20 91c820a-136 ;initial setting ;cs0 ld (msar0),00h ; logical address area: 000000h to 1fffffh ld (mamr0),ffh ; logical address size: 2 mbytes ld (b0cs),89h ; condition: 8 bits, 1 wait (8 mbytes, sram) ;cs1 ld (msar1),40h ; logical address area: 400000h to 5fffffh ld (mamr1),ffh ; logical address size: 4 mbytes ld (b1cs),83h ; condition: 16 bits, 0 waits (16 mbytes, sdram) ;cs2 ld (msar2),c0h ; logical address area: c00000h to ffffffh ld (mamr2),7fh ; logical address size: 4 mbytes ld (b2cs),c3h ; condition: 16 bits, 0 waits (16 mbytes, mrom) ;cs3 ld (msar3),80h ; logical address area: 800000h to bfffffh ld (mamr3),7fh ; logical address size: 4 mbytes ld (b3cs),85h ; condition: 16 bits, 3 waits (64 mbytes, mrom) ;csx ld (bexcs),00h ; other: 16 bits, 2 waits (don?t care) ;port ld (p6fc),3fh ; cs0 to cs3 , ea24, ea25: port 6 setting ld (p6fc2),02h ; cs1 sdcs setting to ldw (pzcr),0707h ; hwr , wr , rd ld (pffc),7fh ; pf [6:0] = sdram control ld (sdacr),0adh ; add-mux enable, 128-m select to ; sdram setup time ld (sdacr),06dh ; add mux enable, 128-m select ld (sdrcr),01h ; interval reflesh figure 3.8.5 bank operation s/w example 1 secondly, it shows example of initial setting at figure 3.8.5. because cs0 connect to ram: 8-bit bus, 8 mbytes, it need to set 8-bit bus. at this example, it set 1-wait setting. in the same way cs1 set to 16-bit bus and 0 waits, cs2 set 16-bit bus and 0 waits, cs3 set 16-bit bus and 3 waits. by cs/wait controller, each ch ip selection signal?s memory size, don?t set actual connect memory size, need to set that logical address size: fitting to each local area. actual physical address is set by each area?s bank register setting. csex setting of cs/wait controller is except above cs0 to cs3?s setting. this program example isn?t used csex setting. finally pin condition is set. port60 to 65 set to cs0 , cs1 , cs2 , cs3 , ea24, ea25 and sdram condition.
tmp91c820a 2008-02-20 91c820a-137 ;bank operation ; ***** cs2 ***** org 000000h ; program rom: start address at bank0 of local2 org 200000h ; program rom: start address at bank1 of local2 org 400000h ; program rom: start address at bank2 of local2 org 600000h ; program rom: start address at bank3 of local2 org 800000h ; program rom: start address at bank4 of local2 org a00000h ; program rom: start address at bank5 of local2 org c00000h ; program rom: start address at bank6 of local2 org e00000h ; program rom: start address at bank7( = common2) of local2 ; logical address e00000h to ffffffh ; physical address 0e00000h to 0ffffffh ld (local3),85h ; local3 bank5 set 14xxxxh ldw hl,(800000h) ; load data (5555h) form bank5 (140000h: physical address) of local3 ( cs3 ) ld (local3),88h ; local3 bank8 set 20xxxxh ldw bc,(800000h) ; load data (aaaah) form bank8 (200000h: physical address) of local3 ( cs3 ) to org ffffffh ; program rom: end address at bank7 ( = common2) of local2 ; ***** cs3 ***** org 0000000h ; data rom: start address at bank0 of local3 org 0400000h ; data rom: start address at bank1 of local3 org 0800000h ; data rom: start address at bank2 of local3 org 0c00000h ; data rom: start address at bank3 of local3 org 1000000h ; data rom: start address at bank4 of local3 org 1400000h ; data rom: start address at bank5 of local3 dw 5555h to org 1800000h ; data rom: start address at bank6 of local3 org 1c00000h ; data rom: start address at bank7 of local3 org 2000000h ; data rom: start address at bank8 of local3 dw aaaah to org 2400000h ; data rom: start address at bank9 of local3 org 2800000h ; data rom: start address at bank10 of local3 org 2c00000h ; data rom: start address at bank11 of local3 org 3000000h ; data rom: start address at bank12 of local3 org 3400000h ; data rom: start address at bank13 of local3 org 3800000h ; data rom: start address at bank14 of local3 org 3c00000h ; data rom: start address at bank15 of local3 org 3ffffffh ; data rom: end address at bank15 of local3 figure 3.8.6 bank operation s/w example 2 here shows example of data access between on e bank and other bank. figure 3.8.6 is one software example. a dot line square area shows one memory and each dot line square shows cs2 ?s program rom and cs3 ?s data rom. program start from e00000h address, firstly, write to bank register of local3 area upper 5-bit address of access point. in case of this example, because most upper address bit of physical address is ea25, most upper address bit of bank register is meaningless. 4-bits of upper 5-bits address means 16 banks. after setting bank5, accessing 800000h to bfffffh address: logical local3 address, actually access to physical 1400000h to 1700000h address.
tmp91c820a 2008-02-20 91c820a-138 ;bank operation ; ***** cs2 ***** org 000000h ; program rom: start address at bank0 of local2 org 200000h ; program rom: start address at bank1 of local2 nop ; operation at bank1of local2 to jp e00100h ; jump to bank7( = common2) of local2 org 400000h ; program rom: start address at bank2 of local2 org 600000h ; program rom: start address at bank3 of local2 nop ; operation at bank3 of local2 to jp e00200h ; jump to bank7( = common2) of local2 org 800000h ; program rom: start address at bank4 of local2 org a00000h ; program rom: start address at bank5 of local2 org c00000h ; program rom: start address at bank6 of local2 !!!! program start !!!! org e00000h ; program rom: start address at bank7( = common2) of local2 ; logical address e00000h to ffffffh ; physical address 0e00000h to 0ffffffh ld (local2),81h ; local2 bank1 set 20xxxxh jp c00000h ; jump to bank1 (200000h: physical address) of local2 to org e00100h ld (local2),83h ; local2 bank3 set 60xxxxh jp c00000h ; jump to bank3 (600000h: physical address) of local2 to org e00200h ld (local1),00h ; disable bank to ; lcd display set ld (lsarch),60h ; c_area start address ld (lsarcm),00h ; c_area start address ld (lsarcl),00h ; c_area start address set 0,(lctctl) ; lcd display start org ffffffh ; program rom: end address at bank7( = common2) of local2 ; ***** cs1 ***** org 000000h ; sdram: start address at bank0 of local1 org 200000h ; sdram: start address at bank1 of local1 org 400000h ; sdram: start address at bank2 of local1 org 600000h ; sdram: start address at bank3( = common1) of local1 dl 01234567h ; display data to org 800000h ; sdram: start address at bank4 of local1 org a00000h ; sdram: start address at bank5 of local1 org c00000h ; sdram: start address at bank6 of local1 org e00000h ; sdram: start address at bank7 of local1 org ffffffh ; sdram: end address at bank7 of local1 figure 3.8.7 bank operation s/w example 3
tmp91c820a 2008-02-20 91c820a-139 at figure 3.8.7, it shows example of program jump. in the same way with before example, two dot line squares show each cs2 ?s program rom and cs1 ?s (sdcs) sdram. program start from e00000h common address, firstly, write to bank register of local2 area upper 3-bit address of jumping point. after setting bank1, jumping c00000h to dfffffh address: logical local2 address, actually jump to physical 200000h to 3fffffh address. when return to common area, it can only jump to e00000h to ffffffh without writing to bank register of local2 area. by a way of setting of bank register, the setting that bank address and common address conflict with is possible. when two kinds or more logical addresses to show common area exist, management of bank is confused. we recommend not using the bank setting, bank address and common address conflict with. when using lcd display data for sdram, we recommend setting display area to common area in sdram. because of, lcd displays dm a occur at sycronousless. if sdram bank is changed, you don?t need to care only common area. it is a mark paid attention to here, it needs to go by way of common area by all means when moves from a bank to a bank. in other words, it must write to bank register only in common area and it prohibits writing the bank registers in bank area. if it modify the bank register?s data in bank area, program runaway. please do not set bank function of mmu as display ram. this is because reading lcdc display data is not controlled by the cpu. therefore if bank of display area is changed during lcd displaying, it cannot display. it is recommended to allocate display data to a common area.
tmp91c820a 2008-02-20 91c820a-140 3.9 serial channels tmp91c820a includes three serial i/o channels. for each channels either uart mode (asynchronous transmission) or i/o interface mode (synchronous transmission) can be selected. (channel 2 can be selected only uart mode.) in mode 1 and mode 2 a parity bit can be added. mode 3 has a wakeup function for making the master controller start slave controllers via a serial link (a multi-controller system). figure 3.9.2, 3.9.3, 3.9.4 are block diagrams for each channel. each channel can be used independently. each channel operates in the same fashion ex cept for the following points, hence only the operation of channel 0 is explained below. table 3.9.1 differences between channels 0 to 2 channel 0 channel 1 channel 2 pin name txd0 (pc0) rxd0 (pc1) 0 cts /sclk0 (pc2) txd1 (pc3) rxd1 (pc4) 1 cts /sclk1 (pc5) txd2 (pb0) rxd2 (pb1) irda mode yes no no this chapter contains the following sections: 3.9.1 block diagrams 3.9.2 operation of each circuit 3.9.3 sfrs 3.9.4 operation in each mode 3.9.5 support for irda ? i/o interface mode mode 0: for transmitting and receiving i/o data using the synchronizing signal sclk for extending i/o. ? uart mode mode 1: 7-bit data mode 2: 8-bit data mode 3: 9-bit data
tmp91c820a 2008-02-20 91c820a-141 bit0 1 2 3 456 start stop bit0 1 2 3 456 start stop parity bit0 1 2 3 456 bit0 1 2 3 456 start stop start stop parity 7 7 7 bit0 1 2 3 456 start 8 7 stop bit0 1 2 3 456 start stop bit8 7 when bit8 = 1, address (select code) is denoted. when bit8 = 0, data is denoted. ? mode 0 (i/o interface mode) transfer direction ? mode 1 (7-bit uart mode) ? mode 2 (8-bit uart mode) ? mode 3 (9-bit uart mode) no parity parity no parity parity 7 bit0 1 2 3 456 wake up figure 3.9.1 data formats
tmp91c820a 2008-02-20 91c820a-142 3.9.1 block diagrams figure 3.9.2 is a block diagram representing serial channel 0. prescaler br0cr ta0trg (from tmra0) 16 32 64 8 4 2 t2 t8 t32 t0 br0cr br0add selector selector selector prescaler t0 t2 t8 t32 br0cr f sys i/o interface mode 16) serial channel interrupt control transmision counter (only uart 16) transmission control receive control receive buffer 1 (shift register) rb8 receive buffer 2 (sc0buf) error flag sioclk uart mode sc0mod0 sc0mod0 tb8 transmission buffer (sc0buf) int request intrx0 inttx0 sc0cr cts0 shared with pc2 sc0mod0 rxd0 shared with pc1 sc0cr txdclk sc0mod0 parity control serial clock generation circuit sclk0 shared with pc2 sclk0 shared with pc2 baud rate generator rxdclk txd0 shared with pc0 internal data bus i/o interface mode figure 3.9.2 block diagram of the serial channel 0
tmp91c820a 2008-02-20 91c820a-143 prescaler br1cr ta0trg (from tmra0) 16 32 64 8 4 2 t2 t8 t32 t0 br1cr br1add selector selector selector prescaler t0 t2 t8 t32 br1cr f sys i/o interface mode 16) serial channel interrupt control transmision counter (only uart 16) transmission control receive control receive buffer 1 (shift register) rb8 receive buffer 2 (sc1buf) error flag sioclk uart mode sc1mod0 sc1mod0 tb8 transmission buffer ( sc1buf) int request intrx1 inttx1 sc1cr cts1 shared with pc5 sc1mod0 rxd1 shared with pc4 sc1cr txdclk sc1mod0 parity control serial clock generation circuit sclk1 shared with pc5 sclk1 shared with pc5 baud rate generator rxdclk txd1 shared with pc3 internal data bus figure 3.9.3 block diagram of the serial channel 1
tmp91c820a 2008-02-20 91c820a-144 prescaler br2cr ta0trg (from tmra0) 16 32 64 8 4 2 t2 t8 t32 t0 br2cr br2add selector selector selector prescaler t0 t2 t8 t32 br2cr f sys 16) serial channel interrupt control transmision counter (only uart 16) transmission control receive control receive buffer 1 (shift register) rb8 receive buffer 2 (sc2buf) error flag sioclk uart mode sc2mod0 sc2mod0 tb8 transmission buffer (sc2buf) int request intrx2 inttx2 sc2cr rxd2 shared with pb1 sc2cr txdclk sc2mod0 parity control serial clock generation circuit baud rate generator rxdclk txd2 shared with pb0 internal data bus figure 3.9.4 block diagram of the serial channel 2
tmp91c820a 2008-02-20 91c820a-145 3.9.2 operation of each circuit (1) prescaler, prescaler clock selects there is a 6-bit prescaler for waking serial clock. the clock selected using syscr is divided by 4 and input to the prescaler as t0. the prescaler can be run by selecting the baud rate generator as the waking serial clock. table 3.9.2 shows prescaler clock resolution into the baud rate generator. table 3.9.2 prescaler clock resolution to baud rate generator prescaler output clock resolution select system clock select prescaler clock gear value t0 t2 t8 t32 1 (fs) xxx 2 2 /fs 2 4 /fs 2 6 /fs 2 8 /fs 000 (fc) 2 2 /fc 2 4 /fc 2 6 /fc 2 8 /fc 001 (fc/2) 2 3 /fc 2 5 /fc 2 7 /fc 2 9 /fc 010 (fc/4) 2 4 /fc 2 6 /fc 2 8 /fc 2 10 /fc 011 (fc/8) 2 5 /fc 2 7 /fc 2 9 /fc 2 11 /fc 00 (f fph ) 100 (fc/16) 2 6 /fc 2 8 /fc 2 10 /fc 2 12 /fc 0 (fc) 10 (fc/16 clock) xxx ? 2 8 /fc 2 10 /fc 2 12 /fc x: don?t care, ? : cannot be used the baud rate generator selects between 4-clock inputs: t0, t2, t8, and t32 among the prescaler outputs.
tmp91c820a 2008-02-20 91c820a-146 (2) baud rate generator the baud rate generator is a circuit, which generates transmission and receiving clocks that determine the transfer rate of the serial channels. the input clock to the baud rate generator, t0, t2, t8 or t32, is generated by the 6-bit prescaler which is shared by the timers. one of these input clocks is selected using the br0cr field in the baud rate generator control register. the baud rate generator includes a frequency divider, which divides the frequency by 1 or n + (16 ? k)/16 or 16 values, determining the transfer rate. the transfer rate is determined by the settings of br0cr and br0add. ? in uart mode (1) when br0cr = 0 the settings br0add are ignored. the baud rate generator divides the selected prescaler clock by n, which is set in br0ck. (n = 1, 2, 3 ... 16) (2) when br0cr = 1 the n + (16 ? k)/16 division function is enabled. the baud rate generator divides the selected prescaler clock by n + (16 ? k)/16 using the value of n set in br0cr (n = 2, 3 ... 15) and the value of k set in br0add. (k = 1, 2, 3 ... 15) note: if n = 1 or n = 16, the n + (16 ? k)/16 division function is disabled. set br0cr to 0. ? in i/o interface mode the n + (16 ? k)/16 division function is not available in i/o interface mode. set br0cr to 0 before dividing by n. the method for calculating the transfer rate when the baud rate generator is used is explained below. ? in uart mode baud rate = 16 ? in i/o interface mode baud rate = 2 input clock of baud rate generator frequency divider for baud rate generator input clock of baud rate generator frequency divider for baud rate generator
tmp91c820a 2008-02-20 91c820a-147 ? integer divider (n divider) for example, when the source clock frequency (fc) = 12.288 mhz, the input clock frequency = t2 (fc/16), the frequency divider n (br0cr) = 5, and br0cr = 0, the baud rate in uart mode is as follows: * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: system clock baud rate = 16 = 12.288 10 6 16 5 16 = 9600 (bps) note: the n + (16 ? k)/16 division function is disabled and setting br0add is invalid. ? n + (16 ? k)/16 divider (only uart mode) accordingly, when the source clock frequency (fc) = 4.8 mhz, the input clock frequency = t0, the frequency divider n (br0cr) = 7, k (br0add) = 3, and br0cr = 1, the baud rate in uart mode is as follows: * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: system clock baud rate = 16 = 4.8 10 6 4 (7 + 13/16) 16 = 9600 (bps) table 3.9.3 show examples of uart mode transfer rates. additionally, the external clock input is available in the serial clock. (serial channels 0, 1). the method for calculat ing the baud rate is explained below: ? in uart mode baud rate = external clock input frequency 16 it is necessary to satisfy (external clock input cycle) 4/fc ? in i/o interface mode baud rate = external clock input frequency it is necessary to satisfy (external clock input cycle) 16/fc fc/16 5 fc/4 7 + (16 ? 3)/16
tmp91c820a 2008-02-20 91c820a-148 table 3.9.3 transfer rate selection (when baud rate generator is used and br0cr = 0) fc [mhz] input clock frequency divider n (br0cr) t0 t2 t8 t32 9.830400 2 76.800 19.200 4.800 1.200 4 38.400 9.600 2.400 0.600 8 19.200 4.800 1.200 0.300 0 9.600 2.400 0.600 0.150 12.288000 5 38.400 9.600 2.400 0.600 a 19.200 4.800 1.200 0.300 14.745600 2 115.200 28.800 7.200 1.800 3 76.800 19.200 4.800 1.200 6 38.400 9.600 2.400 0.600 c 19.200 4.800 1.200 0.300 19.6608 1 307.200 76.800 19.200 4.800 2 153.600 38.400 93.600 2.400 4 76.800 19.10 4.800 1.200 8 38.400 9.600 2.400 0.600 10 19.200 4.800 1.200 0.300 22.1184 3 115.200 28.800 7.200 1.800 24.576 1 384.000 96.000 24.000 6.000 2 192.000 48.000 12.000 3.000 4 96.000 24.000 6.000 1.500 5 76.800 19.200 4.800 1.200 8 48.000 12.000 3.000 0.750 a 38.400 9.600 2.400 0.600 10 24.000 6.000 1.500 0.375 27.0336 b 38.400 9.600 2.400 0.600 29.4912 1 460.800 115.200 28.800 7.200 3 153.600 38.400 9.600 2.400 4 115.200 28.800 7.200 1.800 6 76.800 19.200 4.800 1.200 9 51.200 12.800 3.200 1.800 c 38.400 9.600 2.400 1.600 f 30.720 7.680 1.920 1.480 10 28.800 7.200 1.800 0.450 31.9488 d 38.400 9.600 2.400 0.600 34.4064 7 76.800 19.200 4.800 1.200 note 1: transfer rates in i/o interface mode are eight times faster than the values given above. note 2: the values in this table are calculated for when fc is selected as the system clock, the clock gear is set for fc and the system clock is the prescaler clock input. timer out clock (ta0trg) can be used for source clock of uart mode only. calculation method the frequency of ta0trg frequency of ta0trg = baud rate 16 note: the tmra0 match detect signal cannot be used as the transfer clock in i/o interface mode.
tmp91c820a 2008-02-20 91c820a-149 (3) serial clock generation circuit this circuit generates the basic clock for transmitting and receiving data. ? in i/o interface mode in sclk output mode with the setting sc0cr = 0, the basic clock is generated by dividing the output of the baud rate generator by 2, as described previously. in sclk input mode with the setting sc0cr = 1, the rising edge or falling edge will be detected according to the setting of the sc0cr register to generate the basic clock. ? in uart mode the sc0mod0 setting determines whether the baud rate generator clock, the internal system clock f sys , the match detect signal from timer tmra0 or the external clock (sclk0) is used to generate the basic clock sioclk. (4) receiving counter the receiving counter is a 4-bit binary counter used in uart mode, which counts up the pulses of the sioclk clock. it takes 16 sioclk pulses to receive 1 bit of data; each data bit is sampled three times ? on the 7th, 8th and 9th clock cycles. the value of the data bit is determined from these three samples using the majority rule. for example, if the data bit is sampled respectively as 1, 0 and 1 on 7th, 8th and 9th clock cycles, the received data bit is taken to be 1. a data bit sampled as 0, 0 and 1 is taken to be 0. (5) receiving control ? in i/o interface mode i n sclk output mode with the setting sc0cr = 0, the rxd0 signal is sampled on the rising or falling edge of the shift clock which is output on the sclk0 pin, according to the sc0cr setting. in sclk input mode with the setting sc0cr = 1, the rxd0 signal is sampled on the rising or falling edge of the sclk0 input, according to the sc0cr setting. ? in uart mode the receiving control block has a circuit, which detects a start bit using the majority rule. received bits are sampled three times; when two or more out of three samples are 0, the bit is recognized as the start bit and the receiving operation commences. the values of the data bits that are received are also determined using the majority rule.
tmp91c820a 2008-02-20 91c820a-150 (6) the receiving buffers to prevent overrun errors, the receiving buffers are arranged in a double-buffer structure. received data is stored one bit at a time in receiving buffer 1 (which is a shift register). when 7 bits or 8 bits of data have been stored in receiving buffer 1, the stored data is transferred to receiving buffer 2 (sc0buf); this causes an intrx0 interrupt to be generated. the cpu only reads receivin g buffer 2 (sc0buf). even before the cpu reads receiving buffer 2 (sc0buf), the received data can be stored in receiving buffer 1. however, unless receiving buffer 2 (sc0buf) is read before all bits of the next data are received by receiving buffer 1, an overrun error occurs. if an ov errun error occurs, the contents of receiving buffer 1 will be lost, although the contents of receiving buffer 2 and sc0cr will be preserved. sc0cr is used to store either the parity bit ? added in 8-bit uart mode ? or the most significant bit (msb) ? in 9-bit uart mode. in 9-bit uart mode the wakeup function for the slave controller is enabled by setting sc0mod0 to 1; in this mode intrx0 interrupts occur only when the value of sc0cr is 1. (7) transmission counter the transmission counter is a 4-bit binary counter which is used in uart mode and which, like the receiving counter, counts the sioclk clock pulses; a txdclk pulse is generated every 16 sioclk clock pulses. sioclk txdclk 15 16 12 456 78 910 11 12 13 14 15 16 3 1 2 figure 3.9.5 generation of the transmission clock (8) transmission control ? in i/o interface mode in sclk output mode with the setting sc0cr = 0, the data in the transmission buffer is output one bit at a time to the txd0 pin on the rising or falling edge of the shift clock which is output on the sclk0 pin, according to the sc0cr setting. in sclk input mode with the setting sc0cr = 1, the data in the transmission buffer is output one bit at a time on the txd0 pin on the rising or falling edge of the sclk0 input, according to the sc0cr setting. ? in uart mode when transmission data sent from the cpu is written to the transmission buffer, transmission starts on the rising edge of the next txdclk, generating a transmission shift clock txdsft.
tmp91c820a 2008-02-20 91c820a-151 handshake function use of cts pin allows data can be sent in units of one frame; thus, overrun errors can be avoided. the handshake f unctions is enabled or disabled by the sc0mod setting. when the cts0 pin goes high on completion of the current data send, data transmission is halted until the cts0 pin goes low again. however, the inttx0 interrupt is generated, it requests the next data send to the cpu. the next data is written in the transmission buffer and data sending is halted. though there is no rts pin, a handshake function can be easily configured by setting any port assigned to be the rts function. the rts should be output high to request send data halt after data receive is completed by software in the rxd interrupt routine. rxd rts (any port) receiver txd cts tmp91c820a sender tmp91c820a figure 3.9.6 handshake function timing to writing to the transmission buffe r cts (a) (b) 13 14 15 16 1 2 3 14 15 16 1 2 3 sioclk txdclk txd bit0 start bit send is suspended from (a) and (b). note 1: if the cts signal goes high during transmission, no more data will be sent after completion of the current transmission. note 2: transmission starts on the first falling edge of the txdclk clock after the cts signal has fallen. figure 3.9.7 cts (clear to send) timing
tmp91c820a 2008-02-20 91c820a-152 (9) transmission buffer the transmission buffer (sc0buf) shifts out and sends the transmission data written from the cpu form the least significant bit (lsb) in order. when all the bits are shifted out, the transmission buffer becomes empty and generates an inttx0 interrupt. (10) parity control circuit when sc0cr in the serial channel control register is set to 1, it is possible to transmit and receive data with parity. however, parity can be added only in 7-bit uart mode or 8-bit uart mode. the sc0cr field in the serial channel control register allows either even or odd parity to be selected. in the case of transmission, parity is automatically generated when data is written to the transmission buffer sc0buf. the data is transmitted after the parity bit has been stored in sc0buf in 7-bit uart mode or in sc0mod0 in 8-bit uart mode. sc0cr and sc0cr must be set before the transmission data is written to the transmission buffer. in the case of receiving, data is shifted into receiving buffer 1, and the parity is added after the data has been transferred to receiving buffer 2 (sc0buf), and then compared with sc0buf in 7-bit uart mode or with sc0cr in 8-bit uart mode. if they are not equal, a parity error is generated and the sc0cr flag is set. (11) error flags three error flags are provided to incre ase the reliability of data reception. 1. overrun error if all the bits of the next data item have been received in receiving buffer 1 while valid data still remains stored in receiving buffer 2 (sc0buf), an overrun error is generated. (intrx interrupt routine) 1) read receiving buffer 2) read error flag 3) if = 1 then a) set to disable receiving (write 0 to sc0mod0) b) wait to terminate current frame c) read receiving buffer d) read error flag e) set to enable receiving (write 1 to sc0mod0) f) request to transmit again 4) other 2. parity error the parity generated for the data shifted into receiving buffer 2 (sc0buf) is compared with the parity bit received via the rxd pin. if they are not equal, a parity error is generated. 3. framing error the stop bit for the received data is sampled three times around the center. if the majority of the samples are 0, a framing error is generated.
tmp91c820a 2008-02-20 91c820a-153 (12) timing generation a. in uart mode receiving mode 9 bits (note) 8 bits + parity (note) 8 bits, 7 bits + parity, 7 bits interrupt timing center of last bit (bit8) center of last bit (parity bit) center of stop bit framing error timing center of stop bit center of stop bit center of stop bit parity error timing ? center of last bit (parity bit) center of stop bit overrun error timing center of last bit (bit8) center of last bit (parity bit) center of stop bit note: in 9 bits and 8 bits + parity modes, interrupts coincide with the ninth bit pulse. thus, when servicing the interrupt, it is necessary to wait for a 1-bit period (to allow the stop bit to be transferred) to allow checking for a framing error. transmitting mode 9 bits 8 bits + parity 8 bits, 7 bits + parity, 7 bits interrupt timing just before stop bit is transmitted just before stop bit is transmitted just before stop bit is transmitted b. i/o interface sclk output mode immediately after last bit data. (see figure 3.9.25) transmission interrupt timing sclk input mode immediately after rise of last sclk signal rising mode, or immediately after fall in falling mode. (see figure 3.9.26) sclk output mode timing used to transfer received to data receive buffer 2 (sc0buf) (e.g., immediately after last sclk). (see figure 3.9.27) receiving interrupt timing sclk input mode timing used to transfer received data to receive buffer 2 (sc0buf) (e.g., immediately after last sclk). (see figure 3.9.28)
tmp91c820a 2008-02-20 91c820a-154 3.9.3 sfrs 7 6 5 4 3 2 1 0 bit symbol tb8 ctse rxe wu sm1 sm0 sc1 sc0 read/write r/w after reset 0 0 0 0 0 0 0 0 function transfer data bit8 handshake 0: cts disable 1: cts enable receive function 0: receive disable 1: receive enable wakeup function 0: disable 1: enable serial transmission mode 00: i/o interface mode 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: tmra0 trigger 01: baud rate generator 10: internal clock f sys 11: external clcok (sclk0 input) serial transmission clock source (uart) 00 timer tmra0 match detect signal 01 baud rate generator 10 internal clock f sys 11 external clock (sclk0 input) note: the clock selection for the i/o interface mode is controlled by the serial bontrol register (sc0cr). serial transmission mode 00 i/o interface mode 01 7-bit mode 10 8-bit mode 11 uart mode 9-bit mode wakeup function 9-bit uart other modes 0 interrupt generated when data is received 1 interrupt generated only when sc0cr = 1 0 receive disabled 1 receive enabled receiving function 0 disabled (always transferable) 1 enabled cts transmission data bit8 don?t care sc0mod0 (0202h) handshake function ( pin) figure 3.9.8 serial mode control register (channel 0, sc0mod0)
tmp91c820a 2008-02-20 91c820a-155 7 6 5 4 3 2 1 0 bit symbol tb8 ctse rxe wu sm1 sm0 sc1 sc0 read/write r/w after reset 0 0 0 0 0 0 0 0 function transfer data bit8 handshake 0: cts disable 1: cts enable receive function 0: receive disable 1: receive enable wakeup function 0: disable 1: enable serial transmission mode 00: i/o interface mode 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: tmra0 trigger 01: baud rate generator 10: internal clock f sys 11: external clcok (sclk1 input) serial transmission clock source (for uart) 00 timer tmra0 match detect signal 01 baud rate generator 10 internal clock f sys 11 external clock (sclk1 input) serial transmission mode 00 i/o interface mode 01 7-bit mode 10 8-bit mode 11 uart mode 9-bit mode wakeup function 9-bit uart other modes 0 interrupt generated when data is received 1 interrupt generated only when sc1cr = 1 0 receive disabled 1 receive enabled receiving function 0 disabled (always transferable) 1 enabled handshake function ( pin) transmission data bit8 don?t care sc1mod0 (020ah) cts figure 3.9.9 serial mode control register (channel 1, sc1mod0)
tmp91c820a 2008-02-20 91c820a-156 7 6 5 4 3 2 1 0 bit symbol tb8 ? rxe wu sm1 sm0 sc1 sc0 read/write r/w after reset 0 0 0 0 0 0 0 0 function transfer data bit8 always write ?0?. receive function 0: receive disable 1: receive enable wakeup function 0: disable 1: enable serial transmission mode 00: reserved 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: tmra0 trigger 01: baud rate generator 10: internal clock f sys 11: reserved serial transmission clock source (for uart) 00 timer tmra0 match detect signal 01 baud rate generator 10 internal clock f sys 11 reserved serial transmission mode 00 reserved 01 7-bit mode 10 8-bit mode 11 uart mode 9-bit mode wakeup function 9-bit uart other modes 0 interrupt generated when data is received 1 interrupt generated only whensc2cr = 1 0 receive disabled 1 receive enabled receiving function transmission data bit8 don?t care sc2mod0 (0212h) figure 3.9.10 serial mode control register (channel 2, sc2mod0)
tmp91c820a 2008-02-20 91c820a-157 7 6 5 4 3 2 1 0 bit symbol rb8 even pe oerr perr ferr sclks ioc read/write r r/w r (cleared to 0 when read) r/w after reset undefined 0 0 0 0 0 0 0 function received data bit8 parity 0: odd 1: even parity addition 0: disable 1: enable overrun parity framing 0: sclk0 1: sclk0 0: baud rate generator 1: sclk0 pin input sc0cr (0201h) i/o interface input clock selection framing error flag parity error flag overrun error flag 0 transmits and receivers data on rising edge of sclk0. 1 transmits and receivers data on falling edge sclk0. edge selection for sclk pin (input/output mode) 0 disabled 1 enabled parity addition enable even parit y addition/check 1: error 0 baud rate generator 1 sclk0 pin input cleared to ?0? when read 0odd parity 1 even parity received data bit8 note: as all error flags are cleared after reading, do not test only a single bit with a bit testing instruction. figure 3.9.11 serial control register (channel 0, sc0cr)
tmp91c820a 2008-02-20 91c820a-158 7 6 5 4 3 2 1 0 bit symbol rb8 even pe oerr perr ferr sclks ioc read/write r r/w r (cleared to 0 when) r/w after reset undefined 0 0 0 0 0 0 0 function received data bit8 parity 0: odd 1: even parity addition 0: disable 1: enable overrun parity framing 0: sclk1 1: sclk1 0: baud rate generator 1: sclk1 pin input sc1cr (0209h) i/o interface input clock select framing error flag parity error flag overrun error flag 0 transmits and receives data on rising edge of sclk1. 1 transmits and receives data on falling edge of sclk1. edge selection for sclk pin (input/output mode) 0 disabled 1 enabled parity addition enable even p arit y addition/check 1: error 0 baud rate generator 1 sclk1 pin input cleared to ?0? when read 0odd parity 1 even parity received data bit8 note: as all error flags are cleared after reading, do not test only a single bit with a bit testing instruction. figure 3.9.12 serial control register (channel 1, sc1cr)
tmp91c820a 2008-02-20 91c820a-159 7 6 5 4 3 2 1 0 bit symbol rb8 even pe oerr perr ferr ? ? read/write r r/w r (cleared to 0 when) r/w after reset undefined 0 0 0 0 0 0 0 function received data bit8 parity 0: odd 1: even parity addition 0: disable 1: enable overrun parity framing always write ?0?. always write ?0?. sc2cr (0211h) framing error flag parity error flag overrun error flag 0 disabled 1 enabled parity addition enable even parity addition/check cleared to ?0? when read 0 odd parity 1 even parity received data bit8 1: error note: as all error flags are cleared after reading, do not test only a single bit with a bit testing instruction. figure 3.9.13 serial control register (channel 2, sc2cr)
tmp91c820a 2008-02-20 91c820a-160 7 6 5 4 3 2 1 0 bit symbol ? br0adde br0ck1 br0ck0 br0s3 br0s2 br0s1 br0s0 read/write r/w after reset 0 0 0 0 0 0 0 0 function always write ?0?. + (16 ? k)/16 division 0: disable 1: enable 00: t0 01: t2 10: t8 11: t32 7 6 5 4 3 2 1 0 bit symbol br0k3 br0k2 br0k1 br0k0 read/write r/w after reset 0 0 0 0 function sets frequency divisor ?k? (divided by n + (16 ? k)/16) sets baud rate generator frequency divisor br0cr = 1 br0cr = 0 br0cr br0add 0000 (n = 16) or 0001 (n = 1) 0010 (n = 2) to 1111 (n = 15) 0001 (n = 1) (only uart) to 1111 (n = 15) 0000 (n = 16) 0000 disable disable 0001 (k = 1) to 1111 (k = 15) disable divided by n + (16 ? k)/16 divided by n br0cr (0203h) + (16 ? k)/16 division enable 00 internal clock t0 01 internal clock t2 10 internal clock t8 11 internal clock t32 setting the input clock of baud rate generator 0 disable 1 enable setting of the divided frequency ?n? (0 to f) br0add (0204h) note1:availability of +(16-k)/16 division function n uart mode i/o mode 2 to 15 1 , 16 the baud rate generator can be set ?1? in uart mode and disable +(16-k)/16 division function.don?t use in i/o interface mode. note2:set br0cr to 1 after setting k (k = 1 to 15) to br0add when +(16-k)/16 division function is used. writes to unused bits in the br0add register do not affext operation, and undefined data is read from these unused bits. figure 3.9.14 baud rate generator control (channel 0, br0cr, br0add)
tmp91c820a 2008-02-20 91c820a-161 7 6 5 4 3 2 1 0 bit symbol ? br1adde br1ck1 br1ck0 br1s3 br1s2 br1s1 br1s0 read/write r/w after reset 0 0 0 0 0 0 0 0 function always write ?0?. + (16 ? k)/16 division 0: disable 1: enable 00: t0 01: t2 10: t8 11: t32 7 6 5 4 3 2 1 0 bit symbol br1k3 br1k2 br1k1 br1k0 read/write r/w after reset 0 0 0 0 function sets frequency divisor ?k? (divided by n + (16 ? k)/16) baud rate generator frequency divisor setting br1cr = 1 br1cr = 0 br1cr br1add 0000(n = 16) or 0001(n = 1) 0010 (n = 2) to 1111 (n = 15) 0001(n = 1) (only uart) to 1111 (n = 15) 0000 (n = 16) 0000 disable disable 0001 (k = 1) to 1111 (k = 15) disable disabled by n + (16 ? k)/16 divided by n br1cr (020bh) + (16 ? k)/16 division enable 00 internal clock t0 01 internal clock t2 10 internal clock t8 11 internal clock t32 input clock selection for baud rate generator 0 disabled 1 enabled setting of the divided frequency ?n? (0 to f) br1add (020ch) note1:availability of +(16-k)/16 division function n uart mode i/o mode 2 to 15 1 , 16 the baud rate generator can be set ?1? in uart mode and disable +(16-k)/16 division function. don?t use in i/o interface mode. note2:set br1cr to 1 after setting k (k = 1 to 15) to br1add when +(16-k)/16 division function is used. writes to unused bits in the br1add register do not affext operation, and undefined data is read from these unused bits. figure 3.9.15 baud rate generator control (channel 1, br1cr, br1add)
tmp91c820a 2008-02-20 91c820a-162 7 6 5 4 3 2 1 0 bit symbol ? br2adde br2ck1 br2ck0 br2s3 br2s2 br2s1 br2s0 read/write r/w after reset 0 0 0 0 0 0 0 0 function always write ?0?. + (16 ? k)/16 division 0: disable 1: enable 00: t0 01: t2 10: t8 11: t32 7 6 5 4 3 2 1 0 bit symbol br2k3 br2k2 br2k1 br2k0 read/write r/w after reset 0 0 0 0 function sets frequency divisor ?k? (divided by n + (16 ? k)/16) baud rate generator frequency divisor setting br2cr = 1 br2cr = 0 br2cr br2add 0000 (n = 16) or 0001 (n = 1) 0010 (n = 2) to 1111 (n = 15) 0001 (n = 1) (only uart) to 1111 (n = 15) 0000 (n = 16) 0000 disable disable 0001 (k = 1) to 1111 (k = 15) disable disabled by n + (16 ? k)/16 divided by n br2cr (0213h) + (16 ? k)/16 division enable 00 internal clock t0 01 internal clock t2 10 internal clock t8 11 internal clock t32 input clock selection for baud rate generator 0 disabled 1 enabled setting of the divided frequency ?n? (0 to f) br2add (0214h) note1:availability of +(16-k)/16 division function n uart mode i/o mode 2 to 15 1 , 16 the baud rate generator can be set ?1? in uart mode and disable +(16-k)/16 division function. don?t use in i/o interface mode. note2:set br2cr to 1 after setting k (k = 1 to 15) to br2add when +(16-k)/16 division function is used. writes to unused bits in the br2add register do not affext operation, and undefined data is read from these unused bits figure 3.9.16 baud rate generator control (channel 2, br2cr, br2add)
tmp91c820a 2008-02-20 91c820a-163 tb7 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 sc0buf (0200h) (transmission) (reveiving) tb6 tb5 tb4 tb3 tb2 tb1 tb0 rb7rb6rb5rb4rb3rb2rb1rb0 note: prohibit read-modify-write for sc0buf. figure 3.9.17 serial transmission/receiving buffer registers (channel 0, sc0buf) 7 6 5 4 3 2 1 0 bit symbol i2s0 fdpx0 read/write r/w r/w after reset 0 0 function idle2 0: stop 1: run duplex 0: half 1: full figure 3.9.18 serial mode control register 1 (channel 0, sc0mod1) tb7 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 sc1buf (0208h) (transmission) (receiving) tb6 tb5 tb4 tb3 tb2 tb1 tb0 rb7rb6rb5rb4rb3rb2rb1rb0 note: prohibit read-modify-write for sc1buf. figure 3.9.19 serial transmission/receiving buffer registers (channel 1, sc1buf) 7 6 5 4 3 2 1 0 bit symbol i2s1 fdpx1 read/write r/w r/w after reset 0 0 function idle2 0: stop 1: run duplex 0: half 1: full figure 3.9.20 serial mode control register 1 (channel 1, sc1mod1) sc0mod1 (0205h) sc1mod1 (020dh)
tmp91c820a 2008-02-20 91c820a-164 tb7 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 sc2buf (0210h) (transmission) (receiving) tb6 tb5 tb4 tb3 tb2 tb1 tb0 rb7rb6rb5rb4rb3rb2rb1rb0 note: prohibit read-modify-write for sc2buf. figure 3.9.21 serial transmission/receiving buffer registers (channel 2, sc2buf) 7 6 5 4 3 2 1 0 bit symbol i2s2 fdpx2 read/write r/w r/w after reset 0 0 function idle2 0: stop 1: run duplex 0: half 1: full figure 3.9.22 serial mode control register 1 (channel 2, sc2mod1) sc2mod1 (0215h)
tmp91c820a 2008-02-20 91c820a-165 3.9.4 operation in each mode (1) mode 0 (i/o interface mode) this mode allows an increase in the number of i/o pins available for transmitting data to or receiving data from an external shift register. this mode includes the sclk output mode to output synchronous clock sclk and sclk input mode to input external synchronous clock sclk. figure 3.9.23 sclk output mode connection example figure 3.9.24 example of sclk input mode connection output extension tmp91c820 a txd sclk port input extension tc74hc595 or equivalent tc74hc165 or equivalent tmp91c820 a a b c d e f g h rxd sclk port shift register a b c d e f g h si sck rck qh clock s/ l shift register tmp91c820 a txd sclk port tmp91c820 a a b c d e f g h rxd sclk port shift register a b c d e f g h si sck rck qh clock s/ l external clock output extension input extension tc74hc595 or equivalent tc74hc165 or equivalent external clock shift register
tmp91c820a 2008-02-20 91c820a-166 a. transmission in sclk output mode 8-bit data and a synchronous clock are output on the txd0 and sclk0 pins respectively each time the cpu writes the data to the transmission buffer. when all data is output, intes0 will be set to generate the inttx0 interrupt. figure 3.9.25 transmitting operation in i/o interface mode (sclk0 output mode) (channel 0) in sclk input mode, 8-bit data is output on the txd0 pin when the sclk0 input becomes active after the data has been written to the transmission buffer by the cpu. when all data is output, intes0 will be set to generate inttx0 interrupt. figure 3.9.26 transmitting operation in i/o interface mode (sclk0 input mode) (channel 0) sclk1input ( = 0 rising edge mode) sclk1 input ( = 1 falling edge mode) bit0 bit1 txd1 itx1c (inttx1 interrupt request) bit5 bit6 bit7 timing to write transmission data sclk1 output (=0 rising edge mode) bit0 bit6 bit7 bit1 txd1 itx1c (inttx1 interru p t re q uest ) sclk1 output (=1 falling edge mode) (internal clock timing)
tmp91c820a 2008-02-20 91c820a-167 b. receiving in sclk output mode, the synchronous clock is outputted from sclk0 pin and the data is shifted to receiving buffer 1. this starts when the receive interrupt flag intes0 is cleared by reading the received data. when 8-bit data are received, the data will be transferred to receiving buffer 2 (sc0buf according to the timing shown below) and intes0 will be set to generate intrx0 interrupt. the outputting for the first sclk0 starts by setting sc0mod0 to 1. figure 3.9.27 receiving operation in i/o interface mode (sclk0 output mode) (channel 0) in sclk input mode, the data is shifted to receiving buffer 1 when the sclk input becomes active after the receive interrupt flag intes0 is cleared by reading the received data. when 8-bit data is received, the data will be shifted to receiving buffer 2 (sc0buf according to the timing shown below) and intes0 will be set again to be generate intrx0 interrupt. figure 3.9.28 receiving operation in i/o interface mode (sclk0 input mode) (channel 0) note: the system must be put in the receive enable state (scmod0 = 1) before data can be received. sclk1 input ( = 0: rising edge mode) bit0 bit6 bit7 irx1c bit1 rxd1 (intrx1 ) bit5 sclk1 input ( = 1: falling edge mode) sclk1 output (=0 rising edge mode) rxd1 irx1c (intrx1 interrupt request) bit0 bit6 bit7 bit1 sclk1 output (=1 fallingf edge mode)
tmp91c820a 2008-02-20 91c820a-168 c. transmission and receiving (full duplex mode) when the full duplex mode is used, set the level of receive interrupt to 0 and set enable the level of transmit interrupt. in the transmit interrupt program, read the receiving buffer before setting the next transmit data. the example is following. example: channel 0, sclk output baud rate = 9600 bps fc = 14.7456 mhz * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph main routine 7 6 5 4 3 2 1 0 set the inttx0 level to 1. intes0 0 0 0 1 0 0 0 0 set the intrx0 level to 0. pccr ? ? ? ? ? 1 0 1 set pc0, pc1 and pc2 to function as the txd0, rxd0 and sclk0 pins respectively. pcfc ? ? ? ? ? 1 ? 1 sc0mod0 0 0 0 0 0 0 0 0 select i/o interface mode. sc0mod1 1 1 0 0 0 0 0 0 select full duplex mode. sc0cr 0 0 0 0 0 0 0 0 sclk output, transmit on negative edge, receive on positive edge. br0cr 0 0 1 1 0 0 1 1 baud rate = 9600 bps. sc0mod0 0 0 1 0 0 0 0 0 enable receiving. sc0buf * * ****** set the transmit data and start. inttx0 interrupt routine acc sc0buf read the receiving buffer. sc0buf * * ****** set the next transmit data. x: don?t care, ? : no change
tmp91c820a 2008-02-20 91c820a-169 (2) mode 1 (7-bit uart mode) 7-bit uart mode is selected by setting the serial channel mode register sc0mod0 field to 01. in this mode a parity bit can be added. use of a parity bit is enabled or disabled by the setting of the serial channel control register sc0cr bit; whether even parity or odd parity will be used is determined by the sc0cr setting when sc0cr is set to 1 (enabled). example: when transmitting data of the fo llowing format, the control registers should be set as described below. this explanation applies to channel 0. transmission direction (transmission rate: 2400 bps at fc = 12.288 mhz) start bit0 1 2 3 5 4 6 even parity stop * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: system clock 7 6 5 4 3210 pccr ? ? ? ? ? ? ? 1 pcfc ? ? ? ? ? ? ? 1 set pc0 to function as the txd0 pin. sc0mod x 0 ? x 0 1 0 1 select 7-bit uart mode. sc0cr x 1 1 x x x 0 0 add even parity. br0cr 0 0 1 0 0 1 0 1 set the transfer rate to 2400 bps. intes0 1 1 0 0 ? ? ? ? enable the inttx0 interrupt and set it to interrupt level 4. sc0buf * * * * * * * * set data for transmission. x: don?t care, ? : no change (3) mode 2 (8-bit uart mode) 8-bit uart mode is selected by setting sc0mod0 to 10. in this mode a parity bit can be added (use of a parity bit is enabled or disabled by the setting of sc0cr); whether even parity or odd parity will be used is determined by the sc0cr setting when sc0cr is set to 1 (enabled). example: when receiving data of the following format, the control registers should be set as described below. transmission direction (transmission rate: 9600 bps at fc = 12.288 mhz) start bit0 1 2 3 5 4 6 odd parity stop 7
tmp91c820a 2008-02-20 91c820a-170 * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: system clock main settings 7 6 5 43210 pccr ? ? ? ? ? ? 0 ? set pc1 to function as the rxd0 pin. sc0mod ? 0 1 x 1 0 0 1 enable receiving in 8-bit uart mode. sc0cr x 0 1 x x x 0 0 add even parity. br0cr 0 0 0 1 0 1 0 1 set the transfer rate to 9600 bps. intes0 ? ? ? ? 1 1 0 0 enable the intrx0 interrupt and set it to interrupt level 4. interrupt processing acc sc0cr and 00011100 if acc 0 then error check for errors. acc sc0buf read the received data. x: don?t care, ? : no change (4) mode 3 (9-bit uart mode) 9-bit uart mode is selected by setting sc0mod0 to 11. in this mode parity bit cannot be added. in the case of transmission the msb (9th bit) is written to sc0mod0. in the case of receiving it is stored in sc0cr. when the buffer is written and read, the msb is read or written first, before the rest of the sc0buf data. wakeup function in 9-bit uart mode, the wakeup function for slave controllers is enabled by setting sc0mod0 to 1. the interrupt intrx0 occurs only when = 1. txd master slave 1 slave 2 slave 3 rxdtxd rxdtxd txd rxd rxd note: the txd pin of each slave controller must be in open-drain output mode. figure 3.9.29 serial link using wakeup function
tmp91c820a 2008-02-20 91c820a-171 protocol a. select 9-bit uart mode on the master and slave controllers. b. set the sc0mod0 bit on each slave controller to 1 to enable data receiving. c. the master controller transmits one-frame data including the 8-bit select code for the slave controllers. the msb (bit8) is set to 1. select code of slave controller start bit0 1 2 3 5 4 6 stop 7 8 1 d. each slave controller receives the above fr ame. each controller checks the above select code against its own select code. the controller whose code matches clears its wu bit to 0. e. the master controller transmits data to the specified slave controller whose sc0mod bit is cleared to 0. the msb (bit8) is cleared to 0. data 0 start bit0 1 2 3 5 4 6 stop 7 bit8 f. the other slave controllers (whose bits remain at 1) ignore the received data because their msb (bit8 or ) are set to 0, disabling intrx0 interrupts. the slave controller (wu bit = 0) can transmit data to the master controller, and it is possible to indicate the end of data receiving to the master controller by this transmission.
tmp91c820a 2008-02-20 91c820a-172 example: to link two slave controllers serially with the master controller using the internal clock f sys as the transfer clock. txd master slave 1 slave 2 select code 00000001 rxd txd rxd txd rxd select code 00001010 since serial channels 0 and 1 operate in exactly the same way, channel 0 only is used for the purposes of this explanation. ? setting the master controller main pccr ? ? ? ? ? ? 01 pcfc ? ? ? ? ? ? x1 set pc0 and pc1 to function as the txd0 and rxd0 pins respectively. intes0 1 1 0 0 1 1 0 1 enable the inttx0 interrupt and set it to interrupt level 4. enable the intrx0 interrupt and set it to interrupt level 5. sc0mod0 1 0 101110 set f sys as the transmission clock for 9-bit uart mode. sc0buf 0 0 0 0 0 0 0 1 set the select code for slave controller 1. inttx0 interrupt sc0mod0 0 ? ? ? ? ? ? ? set tb8 to 0. sc0buf * * ****** set data for transmission. ? setting the slave controller main pccr ? ? ? ? ? ? 01 pcfc ? ? ? ? ? ? x1 pcode x x x x ? xx1 select pc1 and pc0 to function as the rxd0 and txd0 pins respectively (open-drain output). intes0 1 1 0 1 1 1 1 0 enable intrx0 and inttx0. sc0mod0 0 0 111110 set to 1 in 9-bit uart transmission mode using f sys as the transfer clock. intrx0 interrupt acc sc0buf if acc = select code then sc0mod0 ? ? ? 0 ? ? ? ? clear to 0.
tmp91c820a 2008-02-20 91c820a-173 3.9.5 support for irda sio0 includes support for the irda 1.0 infrared data communication specification. figure 3.9.30 shows the block diagram. receive data transmisison data ir demodulator ir modulator modem ir transmitter and led ir receiver sio0 tmp91c820a txd0 rxd0 ir output ir input figure 3.9.30 block diagram (1) modulation of the transmission data when the transmit data is 0, the modem outputs 1 to txd0 pin with either 3/16 or 1/16 times for width of baud rate. the puls e width is selected by the sircr. when the transmit data is 1, the modem outputs 0. t xd0 pin 1001100stop 0 start t ransmission data figure 3.9.31 transmission example (2) demodulation of the receive data when the receive data is the effective width of pulse 1, the modem outputs 0 to sio0. otherwise the modem outputs 1 to sio0. the effective pulse width is selected by sircr. receive pulse = ?0? stop 0 1 0 1 0 1 start 1 0 demodulated data receive pulse = ?1? figure 3.9.32 receiving example (3) data format the data format is fixed as follows: ? data length: 8 bits ? parity bits: none ? stop bits: 1
tmp91c820a 2008-02-20 91c820a-174 (4) sfr figure 3.9.33 shows the control register sircr. set the data sircr during sio0 is stopping. the following example describes how to set this register: 1) sio setting ; set the sio to uart mode. 2) ld (sircr), 07h ; set the receive data pulse width to 16 . 3) ld (sircr), 37h ; txen, rxen enable the transmission and receiving. 4) start transmission and receiving for sio0 ; the modem operates as follows: ? sio0 starts transmitting. ? ir receiver starts receiving. (5) notes 1) baud rate generator for irda to generate baud rate for irda, use baud rate generator in sio0 by setting ?01? to sc0mod0. to use another source (ta0trg, f sys and sclk0 input) are not allowed. 2) as the irda 1.0 physical layer specification, the data transfer speed and infra-red pulse width is specified. the irda 1.0 specification is defined in table 3.9.5. table 3.9.5 baud rate and pulse width specifications baud rate modulation rate tolerance (% of rate) pulse width (minimum) pulse width (typical) pulse width (maximum) 2.4 kbps rzi 0.87 1.41 s 78.13 s 88.55 s 9.6 kbps rzi 0.87 1.41 s 19.53 s 22.13 s 19.2 kbps rzi 0.87 1.41 s 9.77 s 11.07 s 38.4 kbps rzi 0.87 1.41 s 4.88 s 5.96 s 57.6 kbps rzi 0.87 1.41 s 3.26 s 4.34 s 115.2 kbps rzi 0.87 1.41 s 1.63 s 2.23 s the pulse width is defined either baud rate tx 3/16 or 1.6 s (1.6 s is equal to 3/16 pulse width when baud rate is 115.2 kbps). the tmp91c820a has the function selects the pulse width of transmission either 3/16 or 1/16. but 1/16 pulse width can be selected when the baud rate is equal or less than 38.4 kbps. as the same reason, + (16 ? k)/16 division function in the baud rate generator of sio0 can not be used to generate 115.2 kbps baud rate. also when the 38.4 kbps and 1/16 pulse width, + (16 ? k)/16 division function can not be used. table 3.9.6 baud rate and pulse width for (16 ? k)/16 division function baud rate pulse width 115.2 kbps 57.6 kbps 38.4 kbps 19.2 kbps 9.6 kbps 2.4 kbps t 3/16 t 1/16 ? ? : can be used (16 ? k)/16 division function. : can not be used (16 ? k)/16 division function. ? : can not be set to 1/16 pulse width.
tmp91c820a 2008-02-20 91c820a-175 7 6 5 4 3 2 1 0 bit symbol plsel rxsel txen rxen sirwd3 sirwd2 sirwd1 sirwd0 read/write r/w after reset 0 0 0 0 0 0 0 0 function select transmit pulse width 0: 3/16 1: 1/16 receive data 0: h pulse 1: l pulse transmit 0: disable 1: enable receive 0: disable 1: enable select receive pulse width set effective pulse width for equal or more than 2x (value + 1) + 100 ns can be set: 1 to 14 can not be set: 0, 15 select receive pulse width formula: effective pulse width 2x (value + 1) + 100 ns x = 1/f fph 0000 cannot be set 0001 equal or more than 4x + 100ns to 1110 equal or more than 30x + 100ns 1111 can not be set receive operation 0 disabled 1 enabled transmit operation 0 disabled 1 enabled select transmit pulse width 0 3/16 1 1/16 sircr (0207h) note: if pulse width compl y in g with the irda 1.0 standard (1.6 s min. ) can be g uaranteed with a low baud rate, setting this bit to ?1? shortens the duration of infrared ra y activation, resulting in reduced power dissipation. figure 3.9.33 irda control register
tmp91c820a 2008-02-20 91c820a-176 3.10 serial bus interface (sbi) the tmp91c820a has a one-channel serial bus interface which employs a clocked synchronous 8-bit sio mode and an i 2 c bus mode. the serial bus interface is connected to an external device through p71 (sda) and p72 (scl) in the i 2 c bus mode; and through p70 (sck), p71 (so), p72 (si) in the clocked synchronous 8-bit sio mode. each pin is specified as follows. p7ode p7cr p7fc i 2 c bus mode 11 11x 11x clocked synchronous 8-bit sio mode xx 011 010 111 x: don?t care 3.10.1 configuration i 2 c bus clock sysn. + control noise canceller shift register sbi0cr2/ sbi0sr sbi0dbr intsbi interrupt request t sbi control register 2/ sbi status register i 2 c bus address register sbi data buffer register sbi control register 1 sbi baud rate register 0, 1 sda so si scl sck p70 p71 p72 (sck) (so/sda) (si/scl) sio clock control divider transfer control circuit sbi0cr1 sbi0br0, 1 i2c0ar noise canceller i 2 c bus data control sio data control input/ output control figure 3.10.1 serial bus interface (sbi)
tmp91c820a 2008-02-20 91c820a-177 3.10.2 serial bus interface (sbi) control the following registers are used to contro l the serial bus interface and monitor the operation status. ? serial bus interface control register 1 (sbi0cr1) ? serial bus interface control register 2 (sbi0cr2) ? serial bus interface data buffer register (sbi0dbr) ? i2c bus address register (i2c0ar) ? serial bus interface status register (sbi0sr) ? serial bus interface baud rate register 0 (sbi0br0) ? serial bus interface baud rate register 1 (sbi0br1) the above registers differ depending on a mode to be used. refer to section 3.10.4 ?i 2 c bus mode control? and 3.10.7 ?clocked synchronous 8-bit sio mode control?. 3.10.3 the data formats in the i 2 c bus mode the data formats in the i 2 c bus mode is shown below. s (a) addressing format (b) addressing format (with restart) (c) free data format (data transferred from master device to slave device) slave address data a c k p s s sp p 8 bits 1 to 8 bits r / w 1 1 1 or more 1 to 8 bits a c k a c k slave address data data 1 1 a c k a c k a c k a c k 8 bits 1 to 8 bits 8 bits 1 to 8 bits 11 1 1 1 1 8 bits 1 to 8 bits 1 to 8 bits data data data data a c k a c k a c k 1 1 1 slave address 1 or more 1 1 or more 1 or more s: start condition r/ w : direction bit ack: acknowledge bit p: stop condition r / w r / w figure 3.10.2 data format in the i 2 c bus mode
tmp91c820a 2008-02-20 91c820a-178 3.10.4 i 2 c bus mode control the following registers are used to control and monitor the operation status when using the serial bus interface (sbi) in the i 2 c bus mode. seirial bus interface conrol register 1 7 6 5 4 3 2 1 0 bit symbol bc2 bc1 bc0 ack sck2 sck1 sck0/ swrmon read/write w r/w w r/w after reset 0 0 0 0 0 0 0/1 (note 3) function number of transferred bits (note 1) acknowledge mode specification 0: not generate 1: generate internal serial clock selection and software reset monitor (note 2) internal serial clock selection at write 000 001 010 011 100 101 110 111 n = 5 n = 6 n = 7 n = 8 n = 9 n = 10 n = 11 ? ( note4) ? ( note4) ? ( note4) ? ( note4) 69.2 khz 34.9 khz 17.5 khz (reserved) system clock: fc clock gear: fc/1 fc = 36 mhz (internal scl output) fscl = [ hz ] software reset state monitor at read 0 during software reset 1 initial data acknowledge mode specification 0 not generate clock pulse for acknowledge signal 1 generate clock pulse for acknowledge signal number of bits transferred = 0 = 1 number of clock pulses bits number of clock pulses bits 000 001 010 011 100 101 110 111 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 9 2 3 4 5 6 7 8 8 1 2 3 4 5 6 7 prohibit read- modify- write sbi0cr1 (0240h) note 1: set the to 000 before switching to a clock synchronous 8-bit sio mode. note 2: for the frequency of the scl line clock, see 3.10.5 (3) ?serial clock?. note 3: initial data of sck0 is ?0?, swrmon is ?1?. note 4: this i 2 c bus circuit dose not support fast mode, it supports standard mode only. although the i 2 c bus circuit itsel f allows the setting of a baud rate over 100 kbps, the compliance with the i 2 c specification is not g uaranteed in that case. fc 2 n + 8 figure 3.10.3 registers for the i 2 c bus mode
tmp91c820a 2008-02-20 91c820a-179 serial bus interface control register 2 7 6 5 4 3 2 1 0 bit symbol mst trx bb pin sbim1 sbim0 swrst1 swrst0 read/write w w (note 1) w (note 1) after reset 0 0 0 1 0 0 0 0 function master/ slave selection transmitter/ receiver selection start/stop condition generation cancel intsbi interrupt request serial bus interface operating mode selection (note 2) 00: port mode 01: sio mode 10: i 2 c bus mode 11: (reserved) software reset generate write 10 and 01, then an internal reset signal is generated. serial bus interface operating mode selection (note 2) 00 port mode (serial bus interface output disabled) 01 clocked synchronous 8-bit sio mode 10 i 2 c bus mode 11 (reserved) intsbi interrupt request 0don?t care 1 cancel interrupt request start/stop condition generation 0 generates the stop condition 1 generates the start condition transmitter/receiver selection 0receiver 1 transmitter master/slave selection 0slave 1master prohibit read- modify- write sbi0cr2 (0243h) note 1: reading this register function as sbi0sr register. note 2: switch a mode to port mode after confirming that the bus is free. switch a mode between i 2 c bus mode and clock synchronous 8-bit sio mode after confirmin g that input si g nals via port are high level. figure 3.10.4 registers for the i 2 c bus mode
tmp91c820a 2008-02-20 91c820a-180 serial bus interface status register 7 6 5 4 3 2 1 0 bit symbol mst trx bb pin al aas ad0 lrb read/write r after reset 0 0 0 1 0 0 0 0 function master/ slave status monitor transmitter/ receiver status monitor i 2 c bus status monitor intsbi interrupt request monitor arbitration lost detection monitor 0: undetected 1: detected slave address match detection monitor 0: undetected 1: detected general call detection monitor 0: undetected 1: detected last received bit monitor 0: 0 1: 1 last received bit monitor 0 last received bit was 0 1 last received bit was 1 general call detection monitor 0 undetected 1 general call detected slave address match detection monitor 0 undetected 1 slave address match or general call detected arbitration lost detection monitor 0 ? 1 arbitration lost intsbi interrupt request monitor 0 interrupt requested 1 interrupt canceled i 2 c bus status monitor 0 free 1busy transmitter/receiver status monitor 0 receiver 1 transmitter master/slave status monitor 0slave 1master prohibit read- modify- write sbi0sr (0243h) note: writing in this register functions as sbi0cr2. figure 3.10.5 registers for the i 2 c bus mode
tmp91c820a 2008-02-20 91c820a-181 serial bus interface baud rate regster 0 7 6 5 4 3 2 1 0 bit symbol ? i2sbi0 read/write w r/w after reset 0 0 function always write ?0?. idle2 0: stop 1: run operation during idle 2 mode 0 stop 1 operation serial bus interface baud rate register 1 7 6 5 4 3 2 1 0 bit symbol p4en ? read/write w w after reset 0 0 function internal clock 0: stop 1: operate always write ?0?. baud rate clock control 0 stop 1 operate sirial bus interface data buffer register 7 6 5 4 3 2 1 0 bit symbol db7 db6 db5 db4 db3 db2 db1 db0 read/write r (received)/w (transfer) after reset undefined note 1: when writing transmitted data, start from the msb (bit7). receiving data is placed from lsb (bit0). note 2: sbi0dbr can?t be read the written data. therefore read-modify-write instruction (e.g., ?bit? instruction) is prohibitted. note 3: written data in sbi0dbr is cleared by intsbi signal. i 2 c bus address register 7 6 5 4 3 2 1 0 bit symbol sa6 sa5 sa4 sa3 sa2 sa1 sa0 als read/write w after reset 0 0 0 0 0 0 0 0 function slave address selection for when device is operating as slave device address recognition mode specification address recognition mode specification 0 slave address recognition 1 non slave address recognition sbi0br0 (0244h) sbi0dbr (0241h) i2c0ar (0242h) prohibit read- modify- write prohibit read- modify- write sbi0br1 (0245h) prohibit read- modify- write prohibit read- modify- write figure 3.10.6 registers for the i 2 c bus mode
tmp91c820a 2008-02-20 91c820a-182 3.10.5 control in i 2 c bus mode (1) acknowledge mode specification set the sbi0cr1 to 1 for operation in the acknowledge mode. the tmp91c820a generates an additional clock pulse for an acknowledge signal when operating in master mode. in the transmitter mode during the clock pulse cycle, the sda pin is released in order to receive the acknowledge signal from the receiver. in the receiver mode during the clock pulse cycle, the sda pin is set to the low in order to generate the acknowledge signal. clear the to 0 for operation in the non-acknowledge mode. the tmp91c820a does not generate a clock pulse for the ac knowledge signal when operating in the master mode. (2) number of transfer bits the sbi0cr1 is used to select a number of bits for next transmitting and receiving data. since the is cleared to 000 as a start condition, a slave address and direction bit transmission are executed in 8 bits. other than these, the retains a specified value. (3) serial clock a. clock source the sbi0cr1 is used to select a maximum transfer frequency outputted on the scl pin in master mode. set a communication baud rate that meets the i 2 c bus specification, such as the shortest pulse width of t low , based on the equations shown below. t high t low 1/fscl t low = 2 n ? 1 /f sbi t high = 2 n ? 1 /f sbi + 8/f sbi fscl = 1/(t low + t high ) note 1: f sbi shows f fph . note 2: it?s prohibit to use fc/16 prescaler clock when using sbi block. (i 2 c bus and clock synchronous.) sbi0cr1 n 000 001 010 011 100 101 110 5 6 7 8 9 10 11 = f sbi 2 n + 8 figure 3.10.7 clock source
tmp91c820a 2008-02-20 91c820a-183 b. clock synchronization in the i 2 c bus mode, in order to wired-and a bus, a master device which pulls down a clock line to low level, in the first place, invalidate a clock pulse of another master device which generates a high-level clock pulse. the master device with a high-level clock pulse needs to detect the situation and implement the following procedure. the tmp91c820a has a clock synchronization function for normal data transfer even when mo re than one master exists on the bus. the example explains the clock synchron ization procedures when two masters simultaneously exist on a bus. internal scl output (master a) internal scl output (master b) scl line reset a acounter of high-level width of a clock pulse wait counting high-level width of a clock pulse start couting high-level width of a clock pulse a b c figure 3.10.8 clock synchronization as master a pulls down the internal scl output to the low level at point a, the scl line of the bus becomes the low level. after detecting this situation, master b resets a counter of high-level width of an own clock pulse and sets the internal scl output to the low level. master a finishes counting low-level width of an own clock pulse at point b and sets the internal scl output to the high level. since master b holds the scl line of the bus at the low level, master a wait for counting high-level width of an own clock pulse. after master b finishes counting low-level width of an own clock pulse at point c and master a detects the scl line of the bus at the high-level, and starts counting high level of an own clock pulse. the clock pulse on the bus is determined by the master device with the shortest high-level width and the master device with the longest low-level width from among those master devices connected to the bus. (4) slave address and address recognition mode specification when the tmp91c820a is used as a slave device, set the slave address and to the i2c0ar. clear the to 0 for the address recognition mode. (5) master/slave selection set the sbi0cr2 to 1 for operating the tmp91c820a as a master device. clear the sbi0cr2 to 0 for operation as a slave device. the is cleared to 0 by the hardware after a stop condition on the bus is detected or arbitration is lost.
tmp91c820a 2008-02-20 91c820a-184 (6) transmitter/receiver selection set the sbi0cr2 to 1 for operating the tmp91c820a as a transmitter. clear the to 0 for operation as a receiver. when data with an addressing format is transferred in slave mode, when a slave address with the same value that an i2c0ar or a general call is received (all 8-bit data are 0 after a start condition), the is set to 1 by the hardware if the direction bit (r/ w ) sent from the master device is 1, and is cleared to 0 by the hardware if the bit is 0. in the master mode, after an acknowledge signal is retu rned from the slave device, the is cleared to 0 by the hardware if a transmitted direction bit is 1, and is set to 1 by the hardware if it is 0. when an acknowledge signal is not returned, the current condition is maintained. the is cleared to 0 by the hard ware after a stop condition on the i 2 c bus is detected or arbitration is lost. (7) start/stop condition generation when the sbi0sr is 0, slave address and direction bit which are set to sbi0dbr are output on a bus after generating a start condition by writing 1 to the sbi0cr2 . it is necessary to set transmitted data to the data buffer register (sbi0dbr) and set 1 to beforehand. scl line start condition a6 slave address and the direction bit a cknowledge signal 1 sda line 23456789 a5 a4 a3 a2 a1 a0 r/ w figure 3.10.9 start condition generation and slave address generation when the is 1, a sequence of generating a stop condition is started by writing 1 to the , and 0 to the . do not modify the contents of until a stop condition is generated on a bus. stop condition scl line sda line figure 3.10.10 stop condition generation the state of the bus can be ascertained by reading the contents of sbi0sr. sbi0sr will be set to 1 if a start condition has been detected on the bus, and will be cleared to 0 if a stop condition has been detected. and about generation of stop condition in master mode, there are some limitation point. please refer to 3.10.6 (4) ?stop condition generation?.
tmp91c820a 2008-02-20 91c820a-185 (8) interrupt service requests and interrupt cancellation when a serial bus interface interrupt re quest (intsbi) occurs, the sbi0cr2 is cleared to 0. during the time that the sbi0cr2 is 0, the scl line is pulled down to the low level. the is cleared to 0 when a 1 word of data is transmitted or received. either writing/reading data to/from sbi0dbr sets the to 1. the time from the being set to 1 until the scl line is released takes t low . in the address recognition mode ( = 0), is cleared to 0 when the received slave address is the same as the value set at the i2c0ar or when a general call is received (all 8-bit data are 0 after a start condition). although sbi0cr2 can be set to 1 by the program, the is not clear it to 0 when it is written 0. (9) serial bus interface operation mode selection sbi0cr2 is used to specify the serial bus interface operation mode. set sbi0cr2 to 10 when the device is to be used in i 2 c bus mode after confirming pin condition of serial bus interface to ?h?. switch a mode to port after confirming a bus is free. (10) arbitration lost detection monitor since more than one master device ca n exist simultaneously on the bus in i 2 c bus mode, a bus arbitration procedure has been implemented in order to guarantee the integrity of transferred data. data on the sda line is used for i 2 c bus arbitration. the following shows an example of a bus arbitration procedur e when two master devices exist simultaneously on the bus. master a and master b output the same data until point a. after master a outputs l and master b, h, the sda line of the bus is wire-and and the sda line is pulled down to the low-level by master a. when the scl line of the bus is pulled up at point b, the slave device reads the data on the sda line, that is, data in master a. a data transmitted from master b becomes invalid. the state in master b is called ?arbitration lost?. master b device, which loses arbitration releases the internal sda output in order not to affect data, transmitted from other masters with arbitration. when more than one master sends the same data at the first word, arbitration occurs conti nuously after the second word. internal sda output becomes 1 after arbitration has been lost. scl line internal sda output (master a) internal sda output (master a) sd a line ab figure 3.10.11 arbitration lost
tmp91c820a 2008-02-20 91c820a-186 the tmp91c820a compares th e levels on the bus?s sda line with those of the internal sda output on the rising edge of the scl line. if the levels do not match, arbitration is lost and sbi0sr is set to 1. when sbi0sr is set to 1, sbi0sr are cleared to 00 and the mode is switched to slave receiver mode. thus, clock output is stopped in data transfer after setting = ?1?. sbi0sr is cleared to 0 when data is written to or read from sbi0dbr or when data is written to sbi0cr2. stop the clock pulse 1 keep internal sda output to high level as losing arbitration accessed to sbi0dbr or sbi0cr2 internal sda output internal scl output master a master b 2 3456789 1 2 3 4 d7a d6b d4a d3a d2a d1a d0a d7a? d6a? d5a? d4a? 1 2 3 4 d7b d6a internal sda output internal scl output figure 3.10.12 example of when tmp91c820a is a master device b (d7a = d7b, d6a = d6b) (11) slave address match detection monitor sbi0sr is set to 1 in slave mode, in address recognition mode (e.g., when i2c0ar = 0), when a general call is received, or when a slave address matches the value set in i2c0ar. when i2c0ar = 1, sbi0sr is set to 1 after the first word of data has been receiv ed. sbi0sr is cleared to 0 when data is written to or read from the data buffer register sbi0dbr. (12) general call detection monitor sbi0sr is set to 1 in slave mode, when a general call is received (all 8-bit received data is 0, after a start condition). sbi0sr is cleared to 0 when a start condition or stop condition is detected on the bus. (13) last received bit monitor the sda line value stored at the rising edge of the scl line is set to the sbi0sr. in the acknow ledge mode, immediately after an intsbi interrupt request is generated, an acknowledge signal is read by reading the contents of the sbi0sr.
tmp91c820a 2008-02-20 91c820a-187 (14) software reset function the software reset function is used to initialize the sbi circuit, when sbi is rocked by external noises, etc. an internal reset signal pulse can be generated by setting sbi0cr2 to 10 and 01. this initializes the sbi circuit internally. all command (except sbi0cr2) registers and status registers are initialized as well. sbi0cr1 is automatically set to 1 after the sbi circuit has been initialized. (15) serial bus interface data buffer register (sbi0dbr) the received data can be read and transferred data can be written by reading or writing the sbi0dbr. in the master mode, after the start condition is generated the slave address and the direction bit are set in this register. (16) i2cbus address register (i2c0ar) i2c0ar is used to set the slav e address when the tmp91c820a functions as a slave device. the slave address output from the master device is recognized by setting the i2c0ar to 0. the data format is the addressing format. when the slave address is not recognized at the = 1, the data format is the free data format. (17) baud rate register (sbi0br1) write 1 to sbi0br1 before operation commences. (18) setting register for idle2 mode operation (sbi0br0) sbi0br0 is the register setting operation/stop during idle2 mode. therefore, setting is necessary before the halt instruction is executed.
tmp91c820a 2008-02-20 91c820a-188 3.10.6 data transfer in i 2 c bus mode (1) device initialization set the sbi0br1, sbi0cr1, set sbi0br1 to 1 and clear bits 7 to 5 and 3 in the sbi0cr1 to 0. set a slave address and the ( = 0 when an addressing format) to the i2c0ar. for specifying the default setting to a slave receiver mode, clear 0 to the and set 1 to the , 10 to the . (2) start condition and slave address generation a. master mode in the master mode, the start condition and the slave address are generated as follows. check a bus free status (when = 0). set the sbi0cr1 to 1 (acknowledge mode) and specify a slave address and a direction bit to be transmitted to the sbi0dbr. when sbi0cr2 = 0, the start condition are generated by writing 1111 to sbi0cr2. subsequently to the start condition, nine clocks are output from the scl pin. while eight clocks are output, th e slave address and the direction bit which are set to the sbi0dbr. at the 9th clock, the sda line is released and the acknowledge signal is received from the slave device. an ints2 interrupt request occurs at the falling edge of the 9th clock. the is cleared to 0. in the master mode, the scl pin is pulled down to the low-level while is 0. when an interrupt request occurs, the is changed according to the direction bit only when an acknowledge signal is returned from the slave device. b. slave mode in the slave mode, the start condition and the slave address are received. after the start condition is received from the master device, while eight clocks are output from the scl pin, the slave address and the direction bit which are output from the master device are received. when a general call or the same address as the slave address set in i2c0ar is received, the sda line is pulled down to the low level at the 9th clock, and the acknowledge signal is output. an intsbi interrupt request occurs on the falling edge of the 9th clock. the is cleared to 0. in slave mode the scl line is pulled down to the low level while the = 0. scl line start condtion a6 slave address + direction bit acknowledge signal from a slave device 1 sda line 2 3 4 5 6 7 8 9 a5 a4 a3 a2 a1 a0 w r/ intsbi interrupt request ack output of master output of slave figure 3.10.13 start condition generation and slave address transfer
tmp91c820a 2008-02-20 91c820a-189 (3) 1-word data transfer check the by the intsbi interrupt process after the 1-word data transfer is completed, and determine whether the mode is a master or slave. a. if = 1 (master mode) check the and determine whether the mode is a transmitter or receiver. when the = 1 (transmitter mode) check the . when is 1, a receiver does not request data. implement the process to generate a stop condition (refer to 3.10.6 (4)) and terminate data transfer. when the is 0, the receiver is requests new data. when the next transmitted data is 8 bits, write the transmitted data to sbi0dbr. when the next transmitted data is other than 8 bits, set the , set the to 1 and write the transmitted data to sbi0dbr. after written the data, becomes 1, a serial clock pulse is generated for transferring a new 1 word of data from the scl pin, and then the one-word data is transmitted. after the data is transmitted, an intsbi interrupt request occurs. the becomes 0 and the scl line is pulled down to the low level. if the data to be transferred is more than one word in length, repeat the procedure fr om the checking above. scl line d7 a cknowledge signal from a receiver 1 sda line 2 3 456789 d6 d5 d4 d3 d2 d1 intsbi interrupt request ack output from master output from slave d0 write to sbi0dbr figure 3.10.14 example in which = 000 and = 1 in transmitter mode
tmp91c820a 2008-02-20 91c820a-190 when the < trx > = 0 (receiver mode) when the next transmitted data is other than 8 bits, set again. set to 1 and read the received data from sbi0dbr to release the scl line (data which is read immediately after a slave address is sent is undefined). after the data is read, becomes 1. serial clock pulse for transferring new 1 data is defined scl and outputs ?l? level from sda pin with acknowledge timing. an intsbi interrupt request then occurs and the becomes 0. then the tmp91c820a pulls down the scl pin to the low level. the tmp91c820a outputs a clock pulse for 1 word of data transfer and the acknowledge signal each time that received data is read from the sbi0dbr. scl line d7 a cknowledge signal to a transmitter 1 sda line 2 3 456789 d6 d5 d4 d3 d2 d1 intsbi interrupt request ack output from master output from slave d0 read sbi0dbr new d7 figure 3.10.15 example of when = 000, = 1 in receiver mode in order to terminate the transmission of data to a transmitter, clear to 0 before reading data which is 1 word before the last data to be received. the last data word does not generate a clock pulse as the acknowledge signal. after the data has been transmitted and an interrupt request has been generated, set to 001 and read the data. the tmp91c820a generates a clock pulse for a 1-bit data transfer. since the master device is a receiver, the sda line on the bus remains high. the transmitter interprets the high signal as an ack signal. the receiver indicates to the transmitter that data transfer is complete. after the one data bit has been received and an interrupt request been generated, the tmp91c820a generates a stop condition (see section 3.10.6 (4)) and terminates data transfer. scl line d7 a cknowledge signal sent to a transmitter 1 sda line 2 3456781 d6 d5 d4 d3 d2 d1 intsbi interrupt request output of master output of slave d0 0 read sbi0dbr 001 read sbi0dbr figure 3.10.16 termination of data transfer in master receiver mode
tmp91c820a 2008-02-20 91c820a-191 b. if = 0 (slave mode) in the slave mode the tmp91c820a operates either in normal slave mode or in slave mode after losing arbitration. in the slave mode, an intsbi interrupt request occurs when the tmp91c820a receives a slave address or a general call from the master device, or when a general call is received and data transfer is complete, or after matching received address. in the master mode, the tmp91c820a operates in a slave mode if it losing arbitration. an intsbi interrupt request occurs when a word data transfer terminates after losing arbitration. when an intsbi interrupt request occurs the is cleared to 0 and the scl pin is pulled down to the low-level. either reading/writing from/to the sbi0dbr or setting the to 1 will release the scl pin after taking t low time. check the sbi0sr, , , and and implements processes according to conditions listed in the next table. table 3.10.1 operation in the slave mode conditions process 1 1 0 the tmp91c820a loses arbitration when transmitting a slave address and receives a slave address for which the value of the direction bit sent from another master is 1. 1 0 in salve receiver mode the tmp91c820a receives a slave address for which the value of the direction bit sent from the master is 1. set the number of bits a word in and write the transmitted data to sbi0dbr. 1 0 0 0 in salve transmitter mode a single word of is transmitted. set to the number of bits in a word. check the setting. if is set to 1, set to 1 since the receiver win no request the data which follows. then, clear to 0 to release the bus. if is cleared to 0 of and write the transmitted data to sbi0dbr since the receiver requests next data. 1 1/0 the tmp91c820a loses arbitration when transmitting a slave address and receives a slave address or general call for which the value of the direction bit sent from another master is 0. 1 0 0 the tmp91c820a loses arbitration when transmitting a slave address or data and terminates word data transfer. 1 1/0 in slave receiver mode the tmp91c820a receives a slave address or general call for which the value of the direction bit sent from the master is 0. read the sbi0dbr for setting the to 1 (reading dummy data) or set the to 1. 0 0 0 1/0 in slave receiver mode the tmp91c820a terminates receiving word data. set to the number of bits in a word and read the received data from sbi0dbr.
tmp91c820a 2008-02-20 91c820a-192 (4) stop condition generation when the sbi0sr is ?1?, the sequence of generating a stop condition is started by setting ?111? to the sbi0cr2 and ?0? to the sbi0cr2. do not modify the contents of the sbi0cr2 until a stop condition is generated on a bus. when a scl line of bus is pulled down by other devices, this device generates a stop condition after they release a scl line and the sda becomes ?1?. figure 3.10.17 stop condition generation (single master) figure 3.10.18 stop condition generation (multi master) scl0 line sda0 line (read) stop condition 1 1 0 1 scl pin sda pin (read) stop condition 1 1 0 1 internal scl the case of pulled low by another device
tmp91c820a 2008-02-20 91c820a-193 (5) restart restart is used to change the direction of data transfer between a master device and a slave device during transferring data. the following explains how to restart when the tmp91c820a is in the master mode. clear 0 to the sbi0cr2, and set 1 to the and release the bus. the sda line remains the high level and the scl pin is released. since a stop condition is not generated on a bus, a bus is assumed to be in a busy state from other devices. check the sbi0sr until it becomes 0 to check that the tmp91c820a is released. check the until it becomes 1 to check that the scl line on a bus is not pulled down to the low level by other devices. after confirming that a bus stays in a free state, generate a start condition with procedure 3.10.6 (2). in order to meet setup time when restarting, take at least 4.7 s of waiting time by software from the time of restarting to confirm that the bus is free until the time to generate the start condition. 0 0 0 1 1 1 1 1 scl line internal scl output (tmp91c820a) sda line 4.7 [ figure 3.10.19 timing diagram for tmp91c820a restart
tmp91c820a 2008-02-20 91c820a-194 3.10.7 clocked synchronous 8-bit sio mode control the following registers are used to control and monitor the operation status when the serial bus interface (sbi) is being operat ed in clocked synchronous 8-bit sio mode. serial bus interface control register 1 7 6 5 4 3 2 1 0 bit symbol sios sioinh siom1 siom0 sck2 sck1 sck0 read/write w w w after reset 0 0 0 0 0 0 0 function transfer start 0: stop 1: start continue/ abort transfer 0: continue transfer 1: abort transfer transfer mode select 00: transmit mode 01: (reserved) 10: transmit/receive mode 11: receive mode serial clock selection and reset monitor serial clock selection at write 000 001 010 011 100 101 110 111 n = 4 n = 5 n = 6 n = 7 n = 8 n = 9 n = 10 ? 2.3 mhz 1125.0 khz 562.5 khz 281.3 khz 140.6 khz 70.3 khz 35.2 khz external clock (inputted from sck pin ) system clcok: fc clock gear: fc/1 fc = 36 mhz (output to sck pin) fscl = [hz] transfer mode selection 00 8-bit transmit mode 01 (reserved) 10 8-bit transmit/received mode 11 8-bit received mode continue/abort transfer 0 continue transfer 1 abort transfer (automatically cleared after transfer aborted) transfer start/stop 0 stopped 1 started serial bus interface data buffer register 7 6 5 4 3 2 1 0 bit symbol db7 db6 db5 db4 db3 db2 db1 db0 read/write r (receiver)/w (transfer) after reset undefined sbi0cr1 (0240h) note: set the tranfer mode and the serial clock after setting to 0 and to 1. prohibit read- modify- write sbi0dbr (0241h) prohibit read- modify- write fc 2 n figure 3.10.20 register for the sio mode (1/3)
tmp91c820a 2008-02-20 91c820a-195 serial bus interface control register 2 7 6 5 4 3 2 1 0 bit symbol sbim1 sbim0 ? ? read/write w w w after reset 0 0 0 0 function serial bus interface operation mode selection 00: port mode 01: sio mode 10: i 2 c bus mode 11: (reserved) (note 2) (note 2) serial bus interface operation mode selection 00 port mode (serial bus interface output disabled) 01 clocked synchronous 8-bit sio mode 10 i 2 c bus mode 11 (reserved) note 1: set the sbi0cr1 000 before switching to a clocked synchronous 8-bit sio mode. note 2: please always write ?00? to sbicr2<1:0>. serial bus interface status register 7 6 5 4 3 2 1 0 bit symbol siof sef read/write r after reset 0 0 function serial transfer operation status monitor shift operation status monitor shift operation status monitor 0 shift operation terminated 1 shift operation in progress serial transfer operating status monitor 0 transfer terminated 1 transfer in progress sbi0cr2 (0242h) sbi0sr (0243h) prohibit read- modify- write figure 3.10.21 registers for the sio mode (2/3)
tmp91c820a 2008-02-20 91c820a-196 serial bus interface baud rate register 0 7 6 5 4 3 2 1 0 bit symbol ? i2sbi0 read/write w r/w after reset 0 0 function always write ?0?. idle2 0: stop 1: run operation in idle 2 mode 0 stop 1 operate serial bus interface baud rate register 1 7 6 5 4 3 2 1 0 bit symbol p4en ? read/write w w after reset 0 0 function internal clock 0: stop 1: operate always write ?0?. baud rate clock control 0 stop 1 operate sbi0br0 (0244h) sbi0br1 (0245h) prohibit read- modify- write prohibit read- modify- write figure 3.10.22 registers for the sio mode (3/3)
tmp91c820a 2008-02-20 91c820a-197 (1) serial clock a. clock source sbi0cr1 is used to select the following functions: internal clock in internal clock mode one of seven frequencies can be selected. the serial clock signal is output to the outside on the sck pin. when the device is writing (in transmit mode) or reading (in receive mode), data cannot follow the serial clock rate, so an automatic wait function is executed which automatically stops the serial clock and holds the next shift operation until reading or writing has been completed. sck pin output so pin output write transmitted data 3 17 2 8 12 678123 c 0 abc automatic wait function a 0 a 1 a 2 a 5 a 6 a 7 b 0 b 5 b 6 b 7 c 1 c 2 b 1 b 4 figure 3.10.23 automatic wait function external clock ( = 111) an external clock input via the sck pin is used as the serial clock. in order to ensure the integrity of shift operations, both the high and low-level serial clock pulse widths shown below must be maintained. the maximum data transfer frequency is 2.3 mhz (when fc = 36 mhz). t sckh t sckl , t sckh > 8/fc at prescaler clock = fc sck pin t sckl figure 3.10.24 maximum data transfer frequency when external clock input used
tmp91c820a 2008-02-20 91c820a-198 b. shift edge data is transmitted on the leading edge of the clock and received on the trailing edge. leading edge shift data is shifted on the leading edge of the serial clock (on the falling edge of the sck pin input/output). trailing edge shift data is shifted on the trailing edge of the serial clock (on the rising edge of the sck pin input/output). bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 76543210 * 7654321 ** 765432 *** 76543 **** 7654 ***** 765 ****** 76 ****** 7 so pin output 6543210 * 543210 ** 0 ******* 10 ****** 210 ***** 3210 **** 43210 *** ******** 76543210 sck pin output shift register sck pin si pin shift register (a) leading edge (b) trailing edge * : don?t care bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 figure 3.10.25 shift edge
tmp91c820a 2008-02-20 91c820a-199 (2) transfer modes the sbi0cr1 is used to select a transmit, receive or transmit/receive mode. a. 8-bit transmit mode set a control register to a transmit mode and write transmit data to the sbi0dbr. after the transmit data is written, set the sbi0cr1 to 1 to start data transfer. the transmitted data is transferred from sbi0dbr to the shift register and output to the so pin in synchronized with the serial clock, starting from the least significant bit (lsb), when the transmission data is transferred to the shift register, the sbi0dbr becomes empty. an intsbi (buffer empty) interrupt request is generated to request new data. when the internal clock is used, the seri al clock will stop and automatic-wait function will be initiated if new data is not loaded to the data buffer register after the specified 8-bit data is transmitted. when new transmit data is written, automatic-wait function is canceled. when the external clock is used, data should be written to sbi0dbr before new data is shifted. the transfer speed is determined by the maximum delay time between the time when an interrupt request is generated and the time when data is written to sbi0dbr by the interrupt service program. when the transmit is started, after the sbi0sr goes 1 output from the so pin holds final bit of the last data until falling edge of the sck. transmitting data is ended by clearing the to 0 by the buffer empty interrupt service program or setting the to 1. when the is cleared, the transmitted mode ends when all data is output. in order to confirm if data is surely transmitted by the program, set the (bit3 of sbi0sr) to be sensed. the sbi0sr is cleared to 0 when transmitting is complete. when the is set to 1, transmitting data stops. sbi0sr turns 0. when an external clock is used, it is al so necessary to clea r sbi0sr to 0 before new data is shifted; otherwise, dummy data is transmitted and operation ends.
tmp91c820a 2008-02-20 91c820a-200 example: program to stop data transmi ssion (when an external clock is used) sbi0dbr intsbi interrupt request sck pin (output) so pin b a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 * clear a write transmitted data (a) internal clock sbi0dbr intsbi interrupt request sck pin (input) so pin b a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 * clear a write transmitted data (b) external clock figure 3.10.26 transfer mode stest1: bit 2, (sbi0sr) ; if = 1 then loop jr nz, stest1 stest2: bit 0, (p7) ; if sck = 0 then loop jr z, stest2 ld (sbi0cr1), 00000111b ; 0
tmp91c820a 2008-02-20 91c820a-201 b. 8-bit receive mode bit7 sck pin siof so pin bit6 t sodh = min 3.5/f fph [s] figure 3.10.27 transmitted data hold time at end of transmission set the control register to receive mode and set sbi0cr1 to 1 for switching to receive mode. data is received into the shift register via the si pin and synchronized with the serial clock, starting from the least significant bit (lsb). when 8-bit data is received, the data is transferred from the shift register to sbi0dbr. an intsbi (buffer full) interrupt request is generated to request that the received data be read. the data is then read from sbi0dbr by the interrupt service program. when an internal clock is used, the serial clock will stop and the automatic wait function will be in effect until the received data has been read from sbi0dbr. when an external clock is used, since sh ift operation is synchronized with an external clock pulse, the received data should be read from sbi0dbr before the next serial clock pulse is input. if the received data is not read, any further data, which is to be received, is canceled. the maximum transfer speed when an external clock is used is determined by the delay time between the time when an interrupt request is generated and the time when the received data is read. receiving of data ends when is cleared to 0 by the buffer full interrupt service program or when is set to 1. if is cleared to 0, received data is transferred to sbi0dbr in complete blocks. the received mode ends when the transfer is complete. in order to confirm whether data is being received properly by the program, set sbi0sr to be sensed. is cleared to 0 when receiving has been completed. when it is confirmed that receiving has been completed, the last data is read. when is set to 1, data receiving stops. is cleared to 0. (the received data becomes invalid, therefore no need to read it.) note: when the transfer mode is changed, the contents of sbi0dbr will be lost. if the mode must be changed, conclude data receiving by clearing to 0, read the last data, and then change the mode.
tmp91c820a 2008-02-20 91c820a-202 sbi0dbr intsbi interrupt request sck pin (output) si pin b clear a a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 read receiver data read receiver data figure 3.10.28 receiver mode (example: internal clock) c. 8-bit transmit/receive mode set a control register to a transmit/rec eive mode and write data to sbi0dbr. after the data has been written, set sbi0cr to 1 to start transmitting/receiving. when data is transmitted, the data is output via the so pin, starting from the least significant bit (lsb) and synchronized with the leading edge of the serial clock signal. when data is received, the data is input via the si pin on the trailing edge of the serial clock signal. 8-bit data is transferred from the shift register to sbi0dbr and an intsbi interrupt request is generated. the interrupt service program reads the received data from the data buffer register and writes the data which is to be transmitted. sbi0dbr is used for both transmitting and receiving. transmitted data should always be written after received data has been read. when an internal clock is used, the automatic wait function will be in effect until the received data has been read and the next data has been written. when an external clock is used, since the shift operation is synchronized with the external clock, received data is read and transmitted data is written before a new shift operation is executed. the maximum transfer speed when an external clock is used is determined by the delay time between the time when an interrupt request is generated and the time at which received data is read and transmitted data is written. when the transmit is started, after the sbi0sr goes 1 output from the so pin holds final bit of the last data until falling edge of the sck. transmitting/receiving data ends when is cleared to 0 by the intsbi interrupt service program or when sbi0cr 1 is set to 1. when is cleared to 0, received data is transferred to sbi0dbr in complete blocks. the transmit/receive mode ends when the transfer is complete. in order to confirm whether data is being transmitted/received properly by the program; set sbi0sr to be sensed. is set to 0 when transmitting/receiving has been completed. when is set to 1, data transm itting/receiving stops. is then cleared to 0. note: when the transfer mode is changed, the contents of sbi0dbr will be lost. if the mode must be changed, conclude data transmitting/receiving by clearing to 0, read the last data, then change the transfer mode.
tmp91c820a 2008-02-20 91c820a-203 sbi0dbr intsbi interrupt request sck pin (output) so pin si pin clear c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 write transmitted data (a) read received data (d) a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 b 0 b 1 b 2 b 3 b 4 b 5 b 6 b 7 * d b c a read received data (c) write transmitted data (b) figure 3.10.29 transmit/received mode (example using internal clock) bit7 in last transmitted word sck pin siof so pin bit6 t sodh = min 4/f fph [s] figure 3.10.30 transmitted data hold time at end of transmit/receive
tmp91c820a 2008-02-20 91c820a-204 3.11 analog/digital converter the tmp91c820a incorporates a 10-bit successive approximation-type analog/digital converter (ad converter) with 8-channel analog input. figure 3.11.1 is a block diagram of the ad converter. the 8-channel analog input pins (an0 to an7) are shared with the input-only port 8 and can thus be used as an input port. note: when idle2, idle1 or stop mode is selected, so as to reduce the power, with some timings the system may enter a standby mode even though the internal comparator is still enabled. therefore be sure to check that ad converter operations are halted before a halt instruction is executed. intad interrupt an7 (p87 ) an6 (p86 ) an5 (p85 ) an4 (p84 ) an3/adtrg (p83 ) an2 (p82 ) an1 (p81 ) an0 (p80 ) comparator vrefh vrefl multiplexer sample and hold ad mode control register 1 admod1 admod1 scan repeat interrupt busy end start + ? internal data bus decoder ad mode control register 0 admod0 adtrg ad conversion result register adreg04l to adreg37l adreg04h to adreg37h da converter ad converter control circuit channel select analog input figure 3.11.1 block diagram of ad converter
tmp91c820a 2008-02-20 91c820a-205 3.11.1 analog/digital converter registers the two ad mode control registers control the ad converter: admod0 and admod1. the eight ad conversion data upper and lower registers (adreg04h/l, adreg15h/l, adreg26h/l and adreg37h/l) store the results of ad conversion. figure 3.11.2 shows the registers related to the ad converter. ad mode control register 0 7 6 5 4 3 2 1 0 bit symbol eocf adbf ? ? itm0 repeat scan ads read/write r r r/w after reset 0 0 0 0 0 0 0 0 function ad conversion end flag 0: conversion in progress 1: conversion complete ad conversion busy flag 0: conversion stopped 1: conversion in progress always write ?0?. always write ?0?. interrupt specification in conversion channel fixed repeat mode 0: every conversion 1: every fourth conversion repeat mode specification 0: single conversion 1: repeat conversion mode scan mode specification 0: conversion channel fixed mode 1: conversion channel scan mode ad conversion start 0: don?t care 1: start conversion always ?0? when read. ad conversion start 0 don?t care 1 start ad conversion note: always read as ?0?. ad scan mode setting 0 ad conversion channel fixed mode 1 ad conversion channel scan mode ad repeat mode setting 0 ad single conversion mode 1 ad repeat conversion mode specify ad conversion interrupt for channel fixed repeat conversion mode channel fixed repeat conversion mode = 0, = 1 0 generates interrupt every conversion. 1 generates interrupt every fourth conversion. ad conversion busy flag 0 ad conversion stopped 1 ad conversion in progress ad conversion end flag 0 before or during ad conversion 1 ad conversion complete admod0 (02b0h) figure 3.11.2 ad converter related register
tmp91c820a 2008-02-20 91c820a-206 ad mode control register 1 7 6 5 4 3 2 1 0 bit symbol vrefon i2ad adtrge adch2 adch1 adch0 read/write r/w r/w r/w after reset 0 0 0 0 0 0 function vref application control 0: off 1: on idle2 0: stop 1: operate ad external trigger start control 0: disable 1: enable analog input channel selection analog input channel selection 0 channel fixed 1 channel scanned 000 an0 an0 001 an1 an0 an1 010 an2 an0 an1 an2 011 (note) an3 an0 an1 an2 an3 100 an4 an4 101 an5 an4 an5 110 an6 an4 an5 an6 111 an7 an4 an5 an6 an7 ad conversion start control by external trigger ( adtrg input) 0 disabled 1 enabled idle2 control 0 stopped 1 in operation control of application of reference voltage to ad converter 0off 1on before starting conversion (before writing 1 to admod0), set the bit to 1. admod1 (02b1h) note: as pin an3 also functions as the adtrg input pin, do not set = 011 when using adtrg with set to 1. figure 3.11.3 ad converter related register
tmp91c820a 2008-02-20 91c820a-207 ad conversion data low register 0/4 7 6 5 4 3 2 1 0 bit symbol adr01 adr00 adr0rf read/write r r after reset undefined 0 function stores lower 2 bits of ad conversion result. ad conversion data storage flag 1: conversion result stored ad conversion data upper register 0/4 7 6 5 4 3 2 1 0 bit symbol adr09 adr08 adr07 adr06 adr05 adr04 adr03 adr02 read/write r after reset undefined function stores upper 8 bits ad conversion result. ad conversion data lower register 1/5 7 6 5 4 3 2 1 0 bit symbol adr11 adr10 adr1rf read/write r r after reset undefined 0 function stores lower 2 bits of ad conversion result. ad conversion result flag 1: conversion result stored ad conversion data upper register 1/5 7 6 5 4 3 2 1 0 bit symbol adr19 adr18 adr17 adr16 adr15 adr14 adr13 adr12 read/write r after reset undefined function stores upper 8 bits of ad conversion result. 9 8 76543210 channel x conversion result 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 adreg04l (02a0h) adreg04h (02a1h) adreg15l (02a2h) adreg15h (02a3h) adregxh adregxl ? bits 5 to 1 are always read as 1 ? bit0 is the ad conversion data storage flag . when the ad conversion result is stored, the flag is set to 1. when either of the registers (adregxh, adregxl) is read, the flag is cleared to 0. figure 3.11.4 ad converter related registers
tmp91c820a 2008-02-20 91c820a-208 ad conversion result lower register 2/6 7 6 5 4 3 2 1 0 bit symbol adr21 adr20 adr2rf read/write r r after reset undefined 0 function stores lower 2 bits of ad conversion result. ad conversion data storage flag 1: conversion result stored ad conversion data upper register 2/6 7 6 5 4 3 2 1 0 bit symbol adr29 adr28 adr27 adr26 adr25 adr24 adr23 adr22 read/write r after reset undefined function stores upper 8 bits of ad conversion result. ad conversion data lower register 3/7 7 6 5 4 3 2 1 0 bit symbol adr31 adr30 adr3rf read/write r r after reset undefined 0 function stores lower 2 bits of ad conversion result. ad conversion data storage flag 1: conversion result stored ad conversion result upper register 3/7 7 6 5 4 3 2 1 0 bit symbol adr39 adr38 adr37 adr36 adr35 adr34 adr33 adr32 read/write r after reset undefined function stores upper 8 bits of ad conversion result. 9 8 76543210 channel x conversion result 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 adreg26l (02a4h) adreg26h (02a5h) adreg37l (02a6h) adreg37h (02a7h) adregxh adregxl ? bits 5 to1 are always read as 1. ? bit0 is the ad conversion data storage flag . when the ad conversion result is stored, the flag is set to 1. when either of the registers (adregxh, adregxl) is read, the flag is cleared to 0. figure 3.11.5 ad converter related registers
tmp91c820a 2008-02-20 91c820a-209 3.11.2 description of operation (1) analog reference voltage a high-level analog reference voltage is applied to the vrefh pin; a low-level analog reference voltage is applied to the vrefl pi n. to perform ad conversion, the reference voltage, the difference between vrefh and vrefl, is divided by 1024 using string resistance. the result of the division is then compared with the analog input voltage. to turn off the switch between vrefh and vrefl, write a 0 to admod1 in ad mode control register 1. to start ad conversion in the off state, first write a 1 to admod1, wait 3 s until the internal reference voltage stabilizes (this is not related to fc), then set admod0 to 1. (2) analog input channel selection the analog input channel selection varies depends on the operation mode of the ad converter. ? in analog input channel fixed mode (admod0 = 0) setting admod1 selects one of the input pins an0 to an7 as the input channel. ? in analog input channel scan mode (admod0 = 1) setting admod1 selects one of the eight scan modes. table 3.11.1 illustrates analog input channel selection in each operation mode. on a reset, admod0 is set to 0 and admod1 is initialized to 000. thus pin an0 is selected as the fixed input channel. pins not used as analog input channels can be used as standard input port pins. table 3.11.1 analog input channel selection channel fixed = 0 channel scan = 1 000 an0 an0 001 an1 an0 an1 010 an2 an0 an1 an2 011 an3 an0 an1 an2 an3 100 an4 an4 101 an5 an4 an5 110 an6 an4 an5 an6 111 an7 an4 an5 an6 an7
tmp91c820a 2008-02-20 91c820a-210 (3) starting ad conversion to start ad conversion, writ e a 1 to admod0 in ad mode control register 0 or admod1 in ad mode control register 1, and input falling edge on adtrg pin. when ad conversion starts, the ad conversion busy flag admod0 will be set to 1, indicating that ad conversion is in progress. writing a 1 to admod0 during ad conversion restarts conversion. at that time, to determine whether the ad conversion results have been preserved, check the value of the conversion data storage flag ad regxl. during ad conversion, a falling edge input on the adtrg pin will be ignored. (4) ad conversion modes and th e ad conversion end interrupt the four ad conversion modes are: ? channel fixed single conversion mode ? channel scan single conversion mode ? channel fixed repeat conversion mode ? channel scan repeat conversion mode the admod0 and admod0 settings in ad mode control register 0 determine the ad mode setting. completion of ad conversion triggers an intad ad conversion end interrupt request. also, admod0 will be set to 1 to indicate that ad conversion has been completed. a. channel fixed single conversion mode setting admod0 and admod0 to 00 selects conversion channel fixed single conversion mode. in this mode data on one specified channel is converted once only. when the conversion has been completed, the admod0 flag is set to 1, admod0 is cleared to 0, and an intad interrupt request is generated. b. channel scan single conversion mode setting admod0 and admod0 to 01 selects conversion channel scan single conversion mode. in this mode data on the specified scan channels is converted once only. when scan conversion has been completed, admod0 is set to 1, admod0 is cleared to 0, and an intad interrupt request is generated.
tmp91c820a 2008-02-20 91c820a-211 c. channel fixed repeat conversion mode setting admod0 and admod0 to 10 selects conversion channel fixed repeat conversion mode. in this mode data on one specified channel is converted repeatedly. when conversion has been completed, admod0 is set to 1 and admod0 is not cleared to 0 but held at 1. intad interrupt request generation timing is determined by the setting of admod0. setting to 0 generates an interrupt request every time an ad conversion is completed. setting to 1 generates an interrupt request on completion of every fourth conversion. d. channel scan repeat conversion mode setting admod0 and admod0 to 11 selects conversion channel scan repeat conversion mode. in this mode data on the specified scan channels is converted repeatedly. when each scan conversion has been completed, admod0 is set to 1 and an intad interrupt request is generated. admod0 is not cleared to 0 but held at 1. to stop conversion in a repeat conversion mode (e.g., in cases c and d), write a 0 to admod0. after the current conversion has been completed, the repeat conversion mode terminates and admod0 is cleared to 0. switching to a halt state (idle2 mode with admod1 cleared to 0, idle1 mode or stop mode) immediately stops operation of the ad converter even when ad conversion is still in progre ss. in repeat conversion modes (e.g., in cases c and d), when the halt is released, conversion restarts from the beginning. in single conversion modes (e.g., in cases a and b), conversion does not restart when the halt is released (the converter remains stopped). table 3.11.2 shows the relationship be tween the ad conversion modes and interrupt requests. table 3.11.2 relationship between ad conversion modes and interrupt requests admod0 mode interrupt request generation channel fixed single conversion mode after completion of conversion x 0 0 channel scan single conversion mode after completion of scan conversion x 0 1 every conversion 0 channel fixed repeat conversion mode every forth conversion 1 1 0 channel scan repeat conversion mode after completion of every scan conversion x 1 1 x: don?t care
tmp91c820a 2008-02-20 91c820a-212 (5) ad conversion time 84 states (4.7 s at f fph = 36 mhz) are required for the ad conversion of one channel. (6) storing and reading the results of ad conversion the ad conversion data upper and lower registers (adreg04h/l to adreg37h/l) store the results of ad conversion. (adreg04h/l to adreg37h/l are read-only registers.) in channel fixed repeat conversion mode, the conversion results are stored successively in registers adreg04h/l to adreg37h/l. in other modes the an0 and an4, an1 and an5, an2 and an6, and an3 and an7 conversion results are stored in adreg04h/l, adreg15h/l, adreg26h/l and adreg37h/l respectively. table 3.11.3 shows the correspondence be tween the analog input channels and the registers, which are used to hold the results of ad conversion. table 3.11.3 correspondence between analog input channels and ad conversion result registers ad conversion result register a nalog input channel (port 8) conversion modes other than at right channel fixed repeat conversion mode ( = 1) an0 adreg04h/l an1 adreg15h/l an2 adreg26h/l an3 adreg37h/l an4 adreg04h/l an5 adreg15h/l an6 adreg26h/l an7 adreg37h/l adreg04h/l adreg15h/l adreg26h/l adreg37h/l bit0 of the ad conversion data lower register is used as the ad conversion data storage flag. the storage flag indicates whether the ad conversion result register has been read or not. when a conversion result is stored in the ad conversion result register, the flag is set to 1. when either of the ad conversion result registers (adregxh or adregxl) is read, the flag is cleared to 0. reading the ad conversion result also clears the ad conversion end flag admod0 to 0.
tmp91c820a 2008-02-20 91c820a-213 setting example: a. convert the analog input voltage on the an3 pin and write the result, to memory address 1000h using the ad interrupt (intad) processing routine. main routine: 7 6 5 4 3 2 1 0 inte0ad x 1 0 0 ? ? ? ? enable intad and set it to interrupt level 4. admod1 1 1 x x 0 0 1 1 set pin an3 to be the analog input channel. admod0 x x 0 0 0 0 0 1 start conversion in channel fixed single conversion mode. interrupt routine processing example: wa adreg37 read value of adreg37l and adreg37h into 16-bit general-purpose register wa. wa > > 6 shift contents read into wa six times to right and zero-fill upper bits. (1000h) wa write contents of wa to memory address 1000h. b. this example repeatedly converts the analog input voltages on the three pins an0, an1 and an2, using channel scan repeat conversion mode. inte0ad x 0 0 0 ? ? ? ? disable intad. admod1 1 x x x 0 0 1 0 set pins an0 to an2 to be the analog input channels. admod0 x x 0 0 0 1 1 1 start conversion in channel scan repeat conversion mode. x: don?t care, ? : no change
tmp91c820a 2008-02-20 91c820a-214 3.12 watchdog timer (runaway detection timer) the tmp91c820a features a watchdog timer for detecting runaway. the watchdog timer (wdt) is used to return the cpu to normal state when it detects that the cpu has started to malfunction (runaway) due to causes such as noise. when the watchdog timer detects a malfunction, it generates a non-maskable interrupt intwd to notify the cpu of the malfunction. connecting the watchdog timer output to the reset pin internally forces a reset. (the level of external reset pin is not changed.) 3.12.1 configuration figure 3.12.1 is a block diagram of he watchdog timer (wdt). figure 3.12.1 block diagram of watchdog timer note: the watchdog timer cannot operate by disturbance noise in some case. take care when design the device. internal reset wdmod wdmod reset wdt control register wdcr q r s 2 21 internal reset wdmod wdti interrupt f sys (f fph /2) selector 2 19 2 17 2 15 internal data bus write b1h write 4eh reset reset control binary counter (22 stage)
tmp91c820a 2008-02-20 91c820a-215 the watchdog timer consists of a 22-stage binary counter which uses the system clock (f sys ) as the input clock. the binary counter can output f sys /2 15 , f sys /2 17 , f sys /2 19 and f sys /2 21 . 0 wdt interrupt wdt clea r (soft ware) clear write code wdt counter n overflow figure 3.12.2 normal mode the runaway is detected when an overflow occurs, and the watchdog timer can reset device. in this case, the reset time will be between 22 and 29 states (19.6 to 25.8 s at f fph = 36mhz, f osch = 2.25 state) is f fph /2, where f fph is generated by dividing the high-speed oscillator clock (f osch ) by sixteen through the clock gear function. overflow wdt counter n wdt interrupt 22 to 29 states (19.6 to 25.8 s at f osch = 36 mhz, f fph = 2.25 mhz) internal reset figure 3.12.3 reset mode
tmp91c820a 2008-02-20 91c820a-216 3.12.2 control registers the watchdog timer wdt is controlled by two controls registers wdmod and wdcr. (1) watchdog timer mode register (wdmod) a. setting the detection time for the watchdog timer in this 2-bit register is used for setting the watchdog timer interrupt time used when detecting runaway. on a reset this register is initialized to wdmod = 00. the detection times for wdt are shown in figure 3.12.4. b. watchdog timer enable/disable control register on a reset wdmod is initialized to 1, enabling the watchdog timer. to disable the watchdog timer, it is necessary to set this bit to 0 and to write the disable code (b1h) to the watchdog timer control register (wdcr). this makes it difficult for the watchdog timer to be disabled by runaway. however, it is possible to return the watchdog timer from the disabled state to the enabled state merely by setting to 1. c. watchdog timer out reset connection this register is used to connect the output of the watchdog timer with the reset terminal internally. since wdmodis initialized to 0 on a reset, a reset by the watchdog timer will not be performed. (2) watchdog timer control register (wdcr) this register is used to disable and clear the binary counter for the watchdog timer. disable control the watchdog timer can be disabled by clearing wdmod to 0 and then writing the disable code (b1h) to the wdcr register. wdmod 0 ? ? ? ? ? ? 0 clear wdmod to 0. wdcr 1 0 1 1 0 0 0 1 write the disable code (b1h). ? enable control set wdmod to 1. ? watchdog timer clear control to clear the binary counter and cause counting to resume, write the clear code (4eh) to the wdcr register. wdcr 0 1 0 0 1 1 1 0 write the clear code (4eh). note1: if it is used disable control, set the disable code (b1h) to wdcr after write the clear code (4eh) once. (please refer to setting example.) note2: if it is changed watchdog timer setting, change setting after set to disable condition once.
tmp91c820a 2008-02-20 91c820a-217 7 6 5 4 3 2 1 0 bit symbol wdte wdtp1 wdtp0 i2wdt rescr ? read/write r/w r/w r/w r/w after reset 1 0 0 0 0 0 function wdt control 1: enable select detecting time 00: 2 15 /f sys 01: 2 17 /f sys 10: 2 19 /f sys 11: 2 21 /f sys idle2 0: stop 1: operate 1: internally connects wdl out to the reset pin always write ?0?. watchdog timer out control 0 ? 1 connects wdt out to a reset 0stop 1 operation watchdog timer detection time wdmod syscr1 system clock selection syscr1 gear value 00 01 10 11 1 (fs) xxx 2.00 s 8.00 s 32.00 s 128.00 s 000 (fc) 1.82 ms 7.28 ms 29.13 ms 116.51 ms 001 (fc/2) 3.64 ms 14.56 ms 58.25 ms 233.02 ms 010 (fc/4) 7.28 ms 29.13 ms 116.51 ms 466.03 ms 011 (fc/8) 14.56 ms 58.25 ms 233.02 ms 932.07 ms 0 (fc) 100 (fc/16) 29.13 ms 116.51 ms 466.03 ms 1864.14 ms 0 disabled 1 enabled figure 3.12.4 watchdog timer mode register 7 6 5 4 3 2 1 0 bit symbol ? read/write w after reset ? function b1h: wdt disable code 4eh: wdt clear code b1h disable code 4eh clear code others don?t care figure 3.12.5 watchdog timer control register wdmod (0300h) watchdo g timer enable/disable control idle2 control watchdog timer detection time at fc = 36 mhz, fs = 32.768 khz disable/clear wdt wdcr (0301h) prohibit read- modify- write
tmp91c820a 2008-02-20 91c820a-218 3.12.3 operation the watchdog timer generates an intwd interrupt when the detection time set in the wdmod has elapsed. the watchdog timer must be 0 cleared in software before an intwd interrupt will be generated. if the cpu malfunctions (e.g., if runaway occurs) due to causes such as noise, but does not execute the instruction used to clear the binary counter, the binary counter will overflow and an intwd interrupt will be generated. the cpu will detect malfunction (runaway) due to the intwd interrupt and in this case it is possible to return to the cpu to normal operation by means of an anti-multifunction program. the watchdog timer does not operate in idle1 or stop mode, as the binary counter continues counting during bus release (when busak goes low). when the device is in idle2 mode, the operation of wdt depends on the wdmod setting. ensure that wdmod is set before the device enters idle2 mode. example: a. clear the binary counter. wdcr 0 1 0 0 1 1 1 0 write the clear code (4eh). b. set the watchdog timer detection time to 2 17 /f sys . wdmod 1 0 1 ? ? ? ? 0 c. disable the watchdog timer. wdmod 0 ? ? ? ? ? ? 0 clear wdte to 0. wdcr 1 0 1 1 0 0 0 1 write the disable code (b1h).
tmp91c820a 2008-02-20 91c820a-219 3.13 real time clock (rtc) 3.13.1 function description for rtc 1) clock function (hour, minute, second) 2) calendar function (month and day, day of the week, and leap year) 3) 24- or 12-hour (am/pm) clock function 4) + / ? 30 second adjustment function (by software) 5) alarm output 1hz/16hz (from alarm pin) 6) interrupt generate by alarm output 1hz/16hz 3.13.2 block diagram figure 3.13.1 rtc block diagram note 1: the christian era year column: this product has year column toward only lower two columns. therefore the next year in 99 works as 00 years. in system to use it, please manage upper two columns with the system side when handle year column in the christian era. note 2: leap year: a leap year is the year, which is divisible with 4, but the year, which there is exception, and is divisible with 100, is not a leap year. however, the year is divisible with 400, is a leap year. but there is not this product for the correspondence to the above exception. because there are only with the year which is divisible with 4 as a leap year, please cope with the system side if this function is problem. carry hold (1 s) alarm register clock comparator 32 khz clock: fs intrtc adjust read/write control address bus data bus wr d0 to d7 address rd alarm select 16 hz clock 1 hz clock divider alarm alarm
tmp91c820a 2008-02-20 91c820a-220 3.13.3 control registers table 3.13.1 page 0 (clock function) registers symbol address bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 function read/write secr 0320h 40 s 20 s 10 s 8 s 4 s 2 s 1 s second column r/w minr 0321h 40 min. 20 min. 10 min. 8 min. 4 min. 2 min. 1 min. minute column r/w hourr 0322h 20 /pm/am 10 hours 8 hours 4 hours 2 hours 1 hour hour column r/w dayr 0323h w2 w1 w0 day of the week column r/w dater 0324h day 20 day 10 day 8 day 4 day 2 day 1 day column r/w monthr 0325h oct. aug. apr. feb. jan. month column r/w yearr 0326h year 80 year 40 year 20 year 10 year 8 year 4 year 2 year 1 year column (lower two columns) r/w pager 0327h interrupt enable adjustment function clock enable alarm enable page setting page register w, r/w restr 0328h 1hz enable 16hz enable clock reset alarm reset always write ?0? reset register write only note: as for secr, minr, hourr, dayr, monthr, yearr of page0, current state is read when read it. table 3.13.2 page 1 (alarm function) registers symbol address bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 function read/write secr 0320h r/w minr 0321h 40 min. 20 min. 10 min. 8 min. 4 min. 2 min. 1 min. minute column for alarm r/w hourr 0322h 20 /pm/am 10 hours 8 hours 4 hours 2 hours 1 hour hour column for alarm r/w dayr 0323h w2 w1 w0 day of the week column for alarm r/w dater 0324h day 20 day 10 day 8 day 4 day 2 day 1 day column for alarm r/w monthr 0325h 24/12 24-hour clock mode r/w yearr 0326h leap-year setting leap-year mode r/w pager 0327h interrupt enable clock enable alarm enable page setting page register w, r/w restr 0328h 1hz enable 16hz enable clock reset alarm reset always write ?0? reset register write only note2: as for secr, minr, hourr, dayr, monthr, yearr of page1, current state is read when read it
tmp91c820a 2008-02-20 91c820a-221 3.13.4 detailed explanation of control register rtc is not initialized by reset. therefore, all registers must be initialized at the beginning of the program. (1) second column register (for page0 only) 7 6 5 4 3 2 1 0 bit symbol se6 se5 se4 se3 se2 se1 se0 secr (0320h) read/write r/w after reset undefined function "0" is read. 40 sec. column 20 sec. column 10 sec. column 8 sec. column 4 sec. column 2 sec. column 1 sec. column 0 0 0 0 0 0 0 0 s 0 0 0 0 0 0 1 1 s 0 0 0 0 0 1 0 2 s 0 0 0 0 0 1 1 3 s 0 0 0 0 1 0 0 4 s 0 0 0 0 1 0 1 5 s 0 0 0 0 1 1 0 6 s 0 0 0 0 1 1 1 7 s 0 0 0 1 0 0 0 8 s 0 0 0 1 0 0 1 9 s 0 0 1 0 0 0 0 10 s : 0 0 1 1 0 0 1 19 s 0 1 0 0 0 0 0 20 s : 0 1 0 1 0 0 1 29 s 0 1 1 0 0 0 0 30 s : 0 1 1 1 0 0 1 39 s 1 0 0 0 0 0 0 40 s : 1 0 0 1 0 0 1 49 s 1 0 1 0 0 0 0 50 s : 1 0 1 1 0 0 1 59 s note: do not set the data other than showing above.
tmp91c820a 2008-02-20 91c820a-222 (2) minute column register (for page0/1) 7 6 5 4 3 2 1 0 bit symbol mi6 mi5 mi4 mi3 mi2 mi1 mi0 minr (0321h) read/write r/w after reset undefined function "0" is read. 40 min, column 20 min, column 10 min, column 8 min, column 4 min, column 2 min, column 1 min, column 0 0 0 0 0 0 0 0 min. 0 0 0 0 0 0 1 1 min. 0 0 0 0 0 1 0 2 min. 0 0 0 0 0 1 1 3 min. 0 0 0 0 1 0 0 4 min. 0 0 0 0 1 0 1 5 min. 0 0 0 0 1 1 0 6 min. 0 0 0 0 1 1 1 7 min. 0 0 0 1 0 0 0 8 min. 0 0 0 1 0 0 1 9 min. 0 0 1 0 0 0 0 10 min. : 0 0 1 1 0 0 1 19 min. 0 1 0 0 0 0 0 20 min. : 0 1 0 1 0 0 1 29 min. 0 1 1 0 0 0 0 30 min. : 0 1 1 1 0 0 1 39 min. 1 0 0 0 0 0 0 40 min. : 1 0 0 1 0 0 1 49 min. 1 0 1 0 0 0 0 50 min. : 1 0 1 1 0 0 1 59 min. note: do not set the data other than showing above.
tmp91c820a 2008-02-20 91c820a-223 (3) hour column register (for page0/1) a. in case of 24-hour clock mode (monthr = 1) 7 6 5 4 3 2 1 0 bit symbol ho5 ho4 ho3 ho2 ho1 ho0 hourr (0322h) read/write r/w after reset undefined function "0" is read. 20 hour column 10 hour column 8 hour column 4 hour column 2 hour column 1 hour column 0 0 0 0 0 0 0 o?clock 0 0 0 0 0 1 1 o?clock 0 0 0 0 1 0 2 o?clock : 0 0 1 0 0 0 8 o?clock 0 0 1 0 0 1 9 o?clock 0 1 0 0 0 0 10 o?clock : 0 1 1 0 0 1 19 o?clock 1 0 0 0 0 0 20 o?clock : 1 0 0 0 1 1 23 o?clock note: do not set the data other than showing above. b. in case of 12-hour clock mode (monthr = 0) 7 6 5 4 3 2 1 0 bit symbol ho5 ho4 ho3 ho2 ho1 ho0 hourr (0322h) read/write r/w after reset undefined function "0" is read. pm/am 10 hour column 8 hour column 4 hour column 2 hour column 1 hour column 0 0 0 0 0 0 0 o?clock (am) 0 0 0 0 0 1 1 o?clock 0 0 0 0 1 0 2 o?clock : 0 0 1 0 0 1 9 o?clock 0 1 0 0 0 0 10 o?clock 0 1 0 0 0 1 11 o?clock 1 0 0 0 0 0 0 o?clock (pm) 1 0 0 0 0 1 1 o?clock note: do not set the data other than showing above.
tmp91c820a 2008-02-20 91c820a-224 (4) day of the week column register (for page0/1) 7 6 5 4 3 2 1 0 bit symbol we2 we1 we0 dayr (0323h) read/write r/w after reset undefined function "0" is read. w2 w1 w0 0 0 0 sunday 0 0 1 monday 0 1 0 tuesday 0 1 1 wednesday 1 0 0 thursday 1 0 1 friday 1 1 0 saturday note: do not set the data other than showing above. (5) day column register (for page0/1) 7 6 5 4 3 2 1 0 bit symbol da5 da4 da3 da2 da1 da0 dater (0324h) read/write r/w after reset undefined function "0" is read. day 20 day 10 day 8 day 4 day 2 day 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1st day 0 0 0 0 1 0 2nd day 0 0 0 0 1 1 3rd day 0 0 0 1 0 0 4th day : 0 0 1 0 0 1 9th day 0 1 0 0 0 0 10th day 0 1 0 0 0 1 11th day : 0 1 1 0 0 1 19th day 1 0 0 0 0 0 20th day : 1 0 1 0 0 1 29th day 1 1 0 0 0 0 30th day 1 1 0 0 0 1 31st day note1: do not set the data other than showing above. note2: do not set the day which is not existed. (ex: 30 th feb)
tmp91c820a 2008-02-20 91c820a-225 (6) month column register (for page0 only) 7 6 5 4 3 2 1 0 bit symbol mo4 mo4 mo2 mo1 mo0 monthr (0325h) read/write r/w after reset undefined function "0" is read. 10 months 8 months 4 months 2 months 1 month 0 0 0 0 1 january 0 0 0 1 0 february 0 0 0 1 1 march 0 0 1 0 0 april 0 0 1 0 1 may 0 0 1 1 0 june 0 0 1 1 1 july 0 1 0 0 0 august 0 1 0 0 1 september 1 0 0 0 0 october 1 0 0 0 1 november 1 0 0 1 0 december note: do not set the data other than showing above. (7) select 24-hour clock or 12-hour clock (for page1 only) 7 6 5 4 3 2 1 0 bit symbol mo0 monthr (0325h) read/write r/w after reset undefined function "0" is read. 1: 24-hour 0: 12-hour
tmp91c820a 2008-02-20 91c820a-226 (8) year column register (for page0 only) 7 6 5 4 3 2 1 0 bit symbol ye7 ye6 ye5 ye4 ye3 ye2 ye1 ye0 yearr (0326h) read/write r/w after reset undefined function 80 years 40 years 20 years 10 years 8 years 4 years 2 years 1 year 0 0 0 0 0 0 0 0 00 years 0 0 0 0 0 0 0 1 01 years 0 0 0 0 0 0 1 0 02 years 0 0 0 0 0 0 1 1 03 years 0 0 0 0 0 1 0 0 04 years 0 0 0 0 0 1 0 1 05 years : 1 0 0 1 1 0 0 1 99 years note: do not set the data other than showing above. (9) leap-year register (for page1 only) 7 6 5 4 3 2 1 0 bit symbol leap1 leap0 read/write r/w after reset undefined function ?0? is read. 00: leap-year 01: one year after leap year 10: two years after leap year 11: three years after leap year 0 0 current year is leap year 0 1 present is next year of a leap year 1 0 present is two years after a leap year 1 1 present is three years after leap year yearr (0326h)
tmp91c820a 2008-02-20 91c820a-227 (10) setting page register (for page0/1) 7 6 5 4 3 2 1 0 bit symbol intena adjust enatmr enaalm page pager (0327h) read/write r/w w r/w r/w after reset 0 undefined undefined undefined read-modify write instruction are prohibited function intrtc 1: enable 0: disable ?0? is read. 0:don?t care 1:adjust clock 1: enable 0: disable alarm 1: enable 0: disable ?0? is read. page selection note: pleas keep the setting order below and don?t set same time. (set difference time to clock/alarm setting and interrupt setting) (example) clock setting/alarm setting ld (pager), 0ch : clock, alarm enable ld (pager), 8ch : interrupt enable 0 select page0 page 1 select page1 0 don?t care adjust 1 adjust sec. counter. when set this bit to ?1? the sec. counter become to ?0? when the value of sec. counter is 0 ? 29. and in case that value of sec. counter is 30-59, min. counter is carried and become sec. counter to "0". output adjust signal during 1 cycle of f sys . after being adjusted once, adjust is released automatically. (page0 only) (11) setting reset register (for page0/1) 7 6 5 4 3 2 1 0 bit symbol dis1hz dis16hz rsttmr rstalm re3 re2 re1 re0 restr (1328h) read/write w after reset undefined read-modify write instruction are prohibited function 1hz 0: enable 1: disable 16hz 0: enable 1: disable 1: clock reset 1: alarm reset always write ?0? 0 unused rstalm 1 reset alarm register note: when write ?1?, reset alarm during 1 cycle of f sys . after that, reset is released automatically. 0 unused rsttmr 1 reset divider note: when write ?1?, reset alarm during 1 cycle of f sys . after that, reset is released automatically. (pager) source signal 1 1 1 alarm 0 1 0 1hz 1 0 0 16hz others output ?0?
tmp91c820a 2008-02-20 91c820a-228 3.13.5 operational description (1) reading clock data there is the case, which reads wrong data when carry of the inside counter happens during the operation which clock data reads. therefore please read two times with the following way for reading correct data. figure 3.13.2 flowchart of clock data read start pager = ?0?, select page0 read the clock data (1st) read the clock data (2nd) 1st data = 2nd data yes no end
tmp91c820a 2008-02-20 91c820a-229 (2) timing of intrtc and clock data when time is read by interrupt, read clock data within 0.5s(s) after generating interrupt. this is because count up of clock data occurs by rising edge of 1hz pulse cycle. figure 3.13.3 timing of intrtc and clock data 56 57 58 59 0 1 2 3 4 a larm intrtc 1s counter (internal signal) 1s count up (internal signal)
tmp91c820a 2008-02-20 91c820a-230 (3) writing clock data when there is carry on the way of write op eration, expecting data can not be wrote exactly. therefore, in order to write in data exactly please follow the below way. 1. resetting a divider inside of rtc, there is 15-stage divider which generates 1 hz clock from 32.768 khz. carry of a clock is not done for 0.5 se cond when reset this divider. so write in data at this interval. figure 3.13.4 flowchart of data write start pager = ?0? select page0 end note: this period is within 0.5 [s]. write the clock data restr = ?1? divider reset
tmp91c820a 2008-02-20 91c820a-231 2. disabling the clock carry of a clock is prohibited when write ?0? to pager and can prevent malfunction by 1s carry hold circuit. during a clock prohibited, 1s carry hold circuit holds one second carry signal , which is generated from divider. after becoming clock enable state, output the carry signal to clock and revise time and continue operation. however, clock is late when clock-disabling state continues for one second or more. figure 3.13.5 flowchart of clock disable start disable the clock end enable the clock write the clock data
tmp91c820a 2008-02-20 91c820a-232 3.13.6 explanation of the alarm function can use alarm function by setting of register of page1 and output either of three signal from alarm pin as follows by write ?1? to pager. intrtc outputs 1shot pulse when the falling edge is detected. rtc is not in itializes by reset. therefore, when clock or alarm function is used, clear interrupt request flag in intc (interrupt controller). (1) in accordance of alarm register and the clock, output ?0?. (2) output clock of 1hz. (3) output clock of 16hz. (1) in accordance with alarm register and a clock, output ?0? when value of a clock of page0 accorded with alarm register of page1 with a state of pager= ?1?, output ?0? to alarm pin and occur intrtc. follows are ways using alarm. initialization of alarm is done by writing in ?1? at restr, setting value of all alarm becomes don?t care. in this case, always accorded with value of a clock and request intrtc interrupt if pager is ?1?. setting alarm min., alarm hour, alarm day and alarm the day week are done by writing in data at each register of page1. when all setting contents accorded, rtc generates intrtc interrupt, if pager is ?1?. however, contents (don't care state) which does not set it up is considered to always accord. the contents, which set it up once, cannot be returned to don't care state in independence. initialization of alarm and resetting of alarm register set to ?don?t care?. the following is an example program for outputting alarm from alarm -pin at noon (pm12:00) every day. ld (pager), 09h ; alarm disable, setting page1 ld (restr), d0h ; alarm initialize ld (dayr), 01h ; w0 ld (datar),01h 1 day ld (hourr), 12h ; setting 12 o?clock ld (minr), 00h ; setting 00 min ; set up time 31 s (note) ld (pager), 0ch ; alarm enable ( ld (pager), 8ch ; interrupt enable ) when cpu is operated by high frequency oscillation, it may take a maximum of one clock at 32 khz (about 30 s) for the time register setting to become valid. in the above example, it is necessary to set 31 s of set up time between setting the time register and enabling the alarm register. note: this set up time is unnecessary when you use only internal interruption.
tmp91c820a 2008-02-20 91c820a-233 (2) when output clock of 1hz rtc outputs clock of 1hz to alarm pin by setting up pager= ?0?, restr= ?0?, = ?1?. and rtc generates intrc interrupt by falling edge of the clock. (3) when output clock of 16hz rtc outputs clock of 16hz to alarm pin by setting up pager= ?0?, restr= ?1?, = ?0?. and rtc generates intrc interrupt by falling edge of the clock.
tmp91c820a 2008-02-20 91c820a-234 3.14 lcd controller (lcdc) the tmp91c820a incorporates two types liquid crystal display driving circuit for controlling lcd driver lsi. ? shift-register type lcd driver control mode (sr type) set the mode of operation, start address of display data save memory and lcd size to sfr before start sr type. after started sr type lcdc outputs bus release request to cpu and read data from display data memory. after that lcdc transmits data of volume of lcd size to external lcd driver through exclusive data bus (ld7:0). at this time, control signals connected lcd driver output specified waveform synchronizes with data transmission. after finish display data reading, lcdc cancels the bus release request and cpu will restart. as the display ram, sdram burst mode can be used in tmp91c820a. ? ram built-in type lcd driver control mode (ram mode) data transmission to lcd driver is ex ecuted by move instruction of cpu. after setting mode of operation to sfr, when moves instruction of cpu is executed lcdc outputs chip select signal to lcd driver connected to the outside from control pin (d1bscp etc.). therefore control of data transm ission numbers corresponding to lcd size is controlled by software. at this time, lcd cont roller output only chip enable signal, and transmission data output from data bus (d7:0). this section is constituted as follows. 3.14.1 feature of lcdc of each mode 3.14.2 block diagram 3.14.3 sfr 3.14.4 shift-register type lcd driver control mode (sr type) 3.14.4.1 operation 3.14.4.2 gray scale mode indication 3.14.4.3 memory mapping 3.14.4.4 hardware cursor 3.14.4.5 frame signal settlement 3.14.4.6 timing charts of interpreting memory codes 3.14.4.7 interface examples at sr mode 3.14.4.8 sample program 3.14.5 ram built-in type lcd driver control mode (ram type) 3.14.5.1 operation 3.14.5.2 interface examples at internal ram mode 3.14.5.3 sample program
tmp91c820a 2008-02-20 91c820a-235 3.14.1 feature of lcdc of each mode each feature and operation of pin is as follows. table 3.14.1 feature of lcdc of each mode (example: toshiba made lcd driver t6c13b, t6b66a) shift register type lcd driver control mode ram built-in type lcd driver control mode the number of picture elements can be handled common (row): 128, 160, 200, 240, 320, 400, 480 segment (column): 128, 160, 240, 320, 400, 480, 560, 640 there is not a limitation display memory data bus width 16-bit fixed lcd driver data bus width 8-bit fixed depend on the setting of cs/wait controller. transfer rate (at f fph = 36 [mhz]) min 55 ns/1 word at sdram/burst min 111 ns/1 word at sram data bus (d7 to d0) not used data bus; connect to data bus of lcd driver. lcd data bus: (ld7 to ld0) data bus; connect to data bus of lcd driver. not used bus state not used bus state; connect with write enable pin of segment/common driver. address bus: (a0) not used address 0; connect with d/i pin of segment driver. when a0 = 1 data bus value means display data, when a0 = 0 data bus means instruction data. shift clock pulse: (d1bscp) shift clock pulses; connect with scp pin of segment driver. driver latches data bus value by falling edge of this pin. chip enable for segment driver 1; connect with ce pin of segment driver 1. latch pulse: (d2blp) latch pulses output; connect with lp pin of segment/common driver. display data is renewed in output register in lcd driver by rising edge of this pin. chip enable for segment driver 2; connect with ce pin of segment driver 2. frame: (d3bfr) lcd frame output; connect with fr pin of segment/common driver. chip enable for segment driver 3; connect with ce pin of segment driver 3. cascade pulse: (dlebcd) cascade pulses output; connect with dio1 pin of row driver. these pin outputs 1 shot pulse by every d3bfr pin changes. chip enable for common driver; connect with le pin of common driver. external pins display off: ( doff ) display off output; connect with dspof terminal of segment/common driver. l means display off and h means display on.
tmp91c820a 2008-02-20 91c820a-236 3.14.2 block diagram note: row means common, and column means segment. figure 3.14.1 lcdc block diagram column counter (9 bits) incrementor (14bits) innerscp generator fp register row incrementor column incrementor selector cpu address bus: a 0 to a23 mmu external data bus a 0 to a23 lcd exclusive data bus ld0 to ld7 clear system clock: f sys cpu busak output comparator column register r s q scpen external d1bscp column end cpu busrq input internal data bus lower rate clock: fs ta3out shift register increment ( 14 bits ) lp generato r row registe r external d2blp bcd generator external dlebcd row counter fr generator external d3bfr internal data bus internal data bus to internal int (rising edge) lp output circuit cursor control gray scale control external data bus d0 to d15 fr output driver dvm register fr driver emccr0 80-byte fifo and scp generator 2 , 4 , 8
tmp91c820a 2008-02-20 91c820a-237 3.14.3 sfr lcd mode register 7 6 5 4 3 2 1 0 bit symbol bae aae scpw1 scpw0 ? bulk ramtype mode read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 1 0 0 0 0 0 function used by b area 0: disable 1: enable used by a area 0: disable 1: enable 00: base scp 01: 2 clocks 10: 4 clocks 11: 8 clocks always write ?0?. sdram bulk 0: 64 mbits 1: 128 mbits display ram 0: sram 1: sdram lcd driver type selection 0: ram 1: sr note 1: is effective only if 1 is set to . note 2: scpw [1:0] is introduced in section 3.14.4.6. divide frame register 7 6 5 4 3 2 1 0 bit symbol fmn7 fmn6 fmn5 fmn4 fmn3 fmn2 fmn1 fmn0 read/write r/w after reset 0 function setting frame invert adjustment function bit7 to bit0 lcd size setting register 7 6 5 4 3 2 1 0 bit symbol com3 com2 com1 com0 seg3 seg2 seg1 seg0 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function setting the lcd common number for sr mode 0000: 128 0101: 400 0001: 160 0110: 480 0010: 200 0011: 240 0100: 320 other: reserved setting the lcd segment number for sr type 0000: 128 0101: 480 0001: 160 0110: 560 0010: 240 0111: 640 0011: 320 0100: 400 other: reserved lcdmode (04b0h) lcddvm (04b1h) lcdsize (04b2h)
tmp91c820a 2008-02-20 91c820a-238 lcd control register 7 6 5 4 3 2 1 0 bit symbol lcdon all0 frmon ? fp9 mmulcd fp8 start read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function doff pin 0: display off 1: display on transfer data of exclusive bus for lcd 0: normal 1: all display data 0 divided fr mode 0: disable 1: enable always write ?0?. setting bit9 for f fp [9:0] specify address of lcd driver with built-in ram 0: sequential 1: random setting bit8 for f fp [9:0] start control in sr type 0: stop 1: start 0 lcdc start 1 lcdc stop 0 sequential access type (no address pin in lcd driver) 1 random access type (address pin in lcd driver) 0 disable 1 enable 0 normal 1 all 0 0 driver off 1driver on lcdctl (04b3h) note:this bit forces sending data to lcd driver to 0 (data off) by writing 1. usually this bit is 0. note: this bit determines the status o f doff pin 0: doff pin outputs 0 1: doff pin outputs 1 lcdc start/stop bit type select for internal ram lcd driver frame invert adjustment function a ll data of exclusive bus for lcd ( ld7:0 ) lcd driver pin doff
tmp91c820a 2008-02-20 91c820a-239 lcd f fp register 7 6 5 4 3 2 1 0 bit symbol fp7 fp6 fp5 fp4 fp3 fp2 fp1 fp0 read/write r/w after reset 0 function setting bit7 to bit0 for f fp lcd gray level setting register 7 6 5 4 3 2 1 0 bit symbol gray1 gray0 read/write r/w after reset 0 0 function 00: monochrome 01: 4 levels 10: 8 levels 11: 16 levels table 3.14.2 lcd start/end address register start address register end address register h (bit23 to bit16) m (bit15 to bit8) l (bit7 to bit0) h (bit23 to bit16) m (bit15 to bit8) l (bit7 to bit0) a-area lsarah (04c1h) lsaram (04c0h) ? learah (04c3h) learam (04c2h) ? after reset 40h 00h 40h 00h b-area lsarbh (04c5h) lsarbm (04c4h) ? learbh (04c7h) learbm (04c6h) ? after reset 40h 00h 40h 00h c-area lsarch (04cah) lsarcm (04c9h) lsarcl (04c8h) ? ? ? after reset 40h 00h 00h note: all registers are available for r (read)/w (write). lcdffp (04b4h) lcdgl (04b5h)
tmp91c820a 2008-02-20 91c820a-240 lcd cursor setting register 7 6 5 4 3 2 1 0 bit symbol cde ccs cbe1 cbe0 read/write r/w r/w r/w r/w after reset 0 0 0 0 function cursor 0: off 1: on cursor color 0: white 1: black cursor blink interval (fs:32 khz) 00: don?t blink 01: 2 hz 10: 1 hz 11: 0.5 hz note 1: the function of cursor blink is effective only when low-frequency oscillator is input. note 2: the function of cursor blink depends on the low-frequency oscillator (fs) even if you use timer out (ta3out) as lcdck. lcd cursor width setting register 7 6 5 4 3 2 1 0 bit symbol cw4 cw3 cw2 cw1 cw0 read/write r/w r/w r/w r/w r/w after reset 0 0 0 0 0 function cursor width 00000: 1 dot (min) 11111: 32 dots (max) lcd cursor height setting register 7 6 5 4 3 2 1 0 bit symbol ch4 ch3 ch2 ch1 ch0 read/write r/w r/w r/w r/w r/w after reset 0 0 0 0 0 function cursor height 00000: 1 dot (min) 11111: 32 dots (max) lcdcm (04b6h) lcdcw (04b7h) lcdch (04b8h)
tmp91c820a 2008-02-20 91c820a-241 lcd cursor start address setting register 7 6 5 4 3 2 1 0 bit symbol cap7 cap6 cap5 cap4 cap3 cap2 cap1 cap0 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function setting bit7 to bit0 for cursor start address lcd cursor start address setting register 7 6 5 4 3 2 1 0 bit symbol cap15 cap14 cap13 cap12 cap11 cap10 cap9 cap8 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function setting bit15 to bit8 for cursor start address lcd cursor start address setting register 7 6 5 4 3 2 1 0 bit symbol cap23 cap22 cap21 cap20 cap19 cap18 cap17 cap16 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 1 0 0 0 0 0 0 function setting bit23 to bit16 for cursor start address lcd cursor hot point pixel number (bit correction) setting register 7 6 5 4 3 2 1 0 bit symbol apb3 apb2 apb1 apb0 read/write r/w after reset 0 function setting bit 3 to bit0 of pixel for correction of hot point (for 1-dot correction) lcdcpl (04bah) lcdcpm (04bbh) lcdcph (04bch) lcdcp (04b9h)
tmp91c820a 2008-02-20 91c820a-242 lcdc1l, lcdc1h, lcdc2l, lcdc2h, lcdc3l, lcdc3h, lcdr1l, lcdr1h register 7 6 5 4 3 2 1 0 bit symbol d7 d6 d5 d4 d3 d2 d1 d0 read/write depend on the specification of external lcd driver. after reset depend on the specification of external lcd driver. function depend on the specification of external lcd driver. these registers do not exist on tmp91c820a. these are image for instruction registers and display registers of external ram built-in sequential access type lcd driver. address as table 3.14.3 is assigned to these registers, and the following chip enable pin becomes active when accesses corresponding address. and, the area of these address is external area, so rd , wr terminal becomes active by external access. table 3.14.4 shows the address map in the case of controlling ram built-in random access type lcd driver. the explanation part of mmu circuit also explains this. this setup is performed by lcdctl . table 3.14.3 memory mapping for built-in ram sequential access type register address purpose sequential access type chip enable terminal a0 terminal lcdc1l 0fe0h instruction 0 lcdc1h 0fe1h ram built-in type driver 1 display data d1bscp 1 lcdc2l 0fe2h instruction 0 lcdc2h 0fe3h ram built-in type driver 2 display data d2blp 1 lcdc3l 0fe4h instruction 0 lcdc3h 0fe5h ram built-in type driver 3 display data d3bfr 1 lcdr1l 0fe6h instruction 0 lcdr1h 0fe7h row driver display data dlebcd 1 table 3.14.4 memory mapping for built-in ram random access type address purpose random access type chip enable te r m i n a l 3c0000h to 3cffffh ram built-in type driver 1 d1bscp 3d0000h to 3dffffh ram built-in type driver 2 d2blp 3e0000h to 3effffh ram built-in type driver 3 d3bfr 3f0000h to 3fffffh ram built-in type driver 4 dlebcd note 1: we call built-in ram sequential access type lcd driver that use register to access to display ram without address. (e.g., t6b65a, t6c84 etc: mar/2000) note 2: we call built-in ram random access type lcd driver that is same method to access to sram. (e.g., t6c23, t6k01 etc: mar/2000)
tmp91c820a 2008-02-20 91c820a-243 3.14.4 shift-register type lcd driver control mode (sr type) 3.14.4.1 operation set the mode of operation, start address of display data save memory, gray-scale level and lcd size to control registers before start sr type. after start it lcdc outputs bus release request to cpu and read data from display data memory. after that lcdc transmits data of volume of lcd size to external lcd driver through lcd personal data bus (ld7:0). at this time, control signals (d1bscp etc.) connected lcd driver output specified waveform synchronizes with data transmission. after finish data transmission, lcdc cancels the bus release request and cpu will restart. lcd controller use lcdck for generation waveform of d3bfr, dlebcd and d2blp pins. lcdck select taout that be outputted from low frequency oscillator (fs): 32.768khz or internal tmra23 by setting emccr0 register. is cleared to ?0? by external reset, and low frequency oscillator (fs) is set. note: when set lcdc to sr type, during data reading (during dma operation), cpu is stopped by internal busreq signal. when using sr type lcdc, programmer need to care the cpu stop time. for detail, see the table 3.14.8.
tmp91c820a 2008-02-20 91c820a-244 3.14.4.2 gray scale mode indication monochrome, 4-, 8- and 16-gray scale mode can be selected by setting lcdgl . and when sdram mode, you can select the size of sdram by setting (lcdmode) . tmp91c820a realize gray scale display by thinning out the frame. gray scale control palette is defined by 16-bit register (lgnl/h) shown in table 3.14.5. palette is selected according to the gray scale level (monochrome, 4, 8, 16 gray) for use. (ref. table 3.14.6). on/off for data of each level (e.g., each density) can modify by 16-bit register (lgnl/h). however each resister of palette has an initial value, it is possible to adjust finely which matches to lcd driver you use and the characteristic of lcd panel. table 3.14.5 gray scale control palette default setting level code density data setting register (address/after reset) bit012345678910 11 12 13 14 15 f 16/16 lgfh/l (04ef-e/ffffh) e 14/16 lgeh/l (04ed-c/fdfdh) d 1316 lgdh/l (04eb-a/fdddh) c 12/16 lgch/l (04e9-8/ddddh) b 11/16 lgbh/l (04e7-6/ddd5h) a 10/16 lgah/l (04e5-4/d5d5h) 9 9/16 lg9h/l (04e3-2/d555h) 8 8/16 lg8h/l (04e1-0/aaaah) 7 7/16 lg7h/l (04df-e/8aaah) 6 6/16 lg6h/l (04dd-c/8a8ah) 5 5/16 lg5h/l (04db-a/888ah) 4 4/16 lg4h/l (04d9-8/8888h) 3 3/16 lg3h/l (04d7-6/8880h) 2 2/16 lg2h/l (04d5-4/8080h) 1 1/16 lg1h/l (04d3-2/8000h) 0 0/16 lg0h/l (04d1-0/0000h) : display on, : display off table 3.14.6 gray scale control palette effective registers for each gray level lg0 l/h lg1 l/h lg2 l/h lg3 l/h lg4 l/h lg5 l/h lg6 l/h lg7 l/h lg8 l/h lg9 l/h lga l/h lgb l/h lgc l/h lgd l/h lge l/h lge l/h 16-gray level 8-gray level 4-gray level monochrome : don?t care, : effective d3bfr t
tmp91c820a 2008-02-20 91c820a-245 3.14.4.3 memory mapping the lcdc can display the lcd panel image which is divided horizontally into 3 parts; upper, middle and lower. each area calls a, b and c area that has some characteristics showing below. start/end address of each area in the physical memory space can be defined in the lcd start/end address registers (see table 3.14.2). (c area can be defined only start address.) a and b areas are selectable enable or not in lcdmode register. when a and b area are disable, the c area take over all panel space. the displaying priority is a > b > c. if the a area set to enable while the panel area is defined as all c area (that is a and b area are disable), c area is shifted to under the lcd panel and a area is inserted from th e top of the lcd panel. similarly if the b area set to enable while the panel area is defined as all c area, b area is inserted from the bottom of the c area overlapping. figure 3.14.2 memory mapping from physical memory to lcd panel memory map image lcd panel image 400000h 600000h a area b area c area logic address column address row address horizontal pan ya yb yc 2x a area b area c area x ya yb yc reserved area for horizontal pan of c area * display data cannot input closely when vertical pan vertical pan vertical pan horizontal pan
tmp91c820a 2008-02-20 91c820a-246 ? display memory mapping and panning function lcdc can change the panel window if only you change each start address of a and b area can be vertical panned by changing row address. while c area can be vertical and horizontal panned by changing row and column address. an important thing is that display data from one line to the next line, cannot be input continuously even if you don?t use the panning function. one row address of display ram corresponds to 1st line of display panel. now display data of 2nd line cannot be set within the 1st row address of display ram even if the necessary data for the size you want to display do not fill the capacity of 1st row address of display ram. adding the one line to display panel is equal to adding one address to row address of display ram. and another important thing is, this limitation is also for sram as display ram without address multiplex. when you use sdram as display ram, you can select the size for display ram capacity of one line. but in case of using sram, display ram capacity of one line is fixed to 512 bytes. figure 3.14.3 memory mapping image for sram as display ram (only a and b area) display panel of 1st line memory area reserved area (display 1st line) display panel of 2nd line memory area reserved area (display 2nd line) display panel of 3rd line memory area reserved area (display 3rd line) memory area for display 1st line (when using sram, this area is fixed to 512 bytes.) memory area for display 2nd line (when using sram, this area is fixed to 512 bytes.) memory area for display 3rd line (when using sram, this area is fixed to 512 bytes.) 16-bit bus width display memory setting start address
tmp91c820a 2008-02-20 91c820a-247 tmp91c820a can select four display scale; monochrome, 4 gray, 8 gray and 16 gray. with the intrinsic property of gray levels, a pixel is decoded in each gray level from different memory size. a pixel use a bit in memory for monochrome, while a pixel use 2 bits in memory for 4 gray, 3 bits for 8 gray and 4 bits for 16 gray. sing bits of display memory has some differences for each gray scale or sort of memory. figure 3.14.4 gray display and using bit in memory and ?px? in above figure 3.14.4 corresponds to the image of lcd panel as below (figure 3.14.5). but tmp91c820a outputs data of px0 to pe7 (ld7), and data of px7 to pe0 (ld0). therefore pe0 (ld0) should be co nnected to the msb of lcd driver (e.g., di7) according to lcd driver you use. please note that the way tmp91c820a outputs the data differs from lcd controller built in tlcs-900/l1 series of toshiba (e.g., tmp91c815, tmp91c016, tmp91c025 etc.). segment driver lcd panel ld7 ld6 ld5 ld4 ld3 ld2 ld1 ld0 di7 di6 di5 di4 di3 di2 di1 di0 px0 px1 px2 px3 px4 px5 px6 px7 px78 px8 px9 px10 px11 px12 px13 px14 px15 figure 3.14.5 connection between lcd bus of tmp91c820a and data bus of lcdd 4 gra y (sram/sdram) 8 gra y (sram/sdram) 16 gra y (sram/sdram) monochrome (sram mode) monochrome (sdram mode) don?t care px0 px1 px2 px3 px4 px5 px6 px7 px8 px9 px10 px11 px12 px13 px14 px15 px0 px1 px2 px3 px4 px5 px6 px7 px0 px1 px2 px3 px4 px5 px6 px7 px0 px1 px2 px3 px0 px1 px2 px3
tmp91c820a 2008-02-20 91c820a-248 3.14.4.4 hardware cursor tmp91c820a has a cursor that is blinking interval, color and size can be specified, and maximum size is 32x32. a programmer can control the cursor attributes easily by filling those cursor registers, for example color (white/black), blinking interval time, size and intimate pixel location. its space location is specified by left-up hot point. (see the figure 3.14.6.) the precise location of the hot point is determined by memory address (lcdcph, lcdcpm, lcdcpl) and pixel correction number (lcdcp). for example, however 1 pixel for displaying needs 2 bits of setting data under 4-gray mode, you can correct the location of hot point every pixel by setting pixel number which you want to move in the resister (lcdcp). cursor image is showed under the setting a, b, c area are enable, 4-gray mode, start address = 410004_hex and correction bit (lcdcp) = 3_hex in the following figure. note: tmp91c820a sets the hardware cursor in the memory address. if panning function is set to enable during hardware cursor displaying, the cursor in the pannel moves, but start address of cursor is not changed. figure 3.14.6 cursor hot point position and size, cursor start address memory map image lcd panel image 400000h 600000h a area b area c area cursor start address 410004h row address column address logic address a area b area c area cursor width cursor height correction pixel number : 3 hot point 410000h sdram size 128mbit = 1 64mbit = 0 ignore 0 cursor start address row address column address a 23 a 22 a 21 a 20 a 19 a 18 a 17 a 16 a 15 a 14 a 13 a 12 a 11 a 10 a 9 a 8 a 7 a 6 a 5 a 4 a 3 a 2 a 1 a 0
tmp91c820a 2008-02-20 91c820a-249 lcd cursor setting register 7 6 5 4 3 2 1 0 bit symbol cde ccs cbe1 cbe0 read/write r/w r/w r/w r/w after reset 0 0 0 0 function cursor 0: off 1: on cursor color 0: white 1: black cursor blink interval (fs: 32 khz) 00: don?t blink 01: 2 hz 10: 1 hz 11: 0.5 hz note 1: the function of cursor blink is effective only when low-frequency osdillator is input. note 2: the function of cursor blink depends on the low-frequency oscillator (fs) even if you use timer out ?ta3out? as lcdck. lcd cursor width setting register 7 6 5 4 3 2 1 0 bit symbol cw4 cw3 cw2 cw1 cw0 read/write r/w r/w r/w r/w r/w after reset 0 0 0 0 0 function cursor width 00000: 1 dot (min) 11111: 32 dots (max) lcd cursor height setting register 7 6 5 4 3 2 1 0 bit symbol ch4 ch3 ch2 ch1 ch0 read/write r/w r/w r/w r/w r/w after reset 0 0 0 0 0 function cursor height 00000: 1 dot (min) 11111: 32 dots (max) lcd cursor start address setting register 7 6 5 4 3 2 1 0 bit symbol cap7 cap6 cap5 cap4 cap3 cap2 cap1 cap0 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function setting bit7 to bit0 for cursor start address lcd cursor start address setting register 7 6 5 4 3 2 1 0 bit symbol cap15 cap14 cap13 cap12 cap11 cap10 cap9 cap8 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function setting bit15 to bit8 for cursor start address lcd cursor start address setting register 7 6 5 4 3 2 1 0 bit symbol cap23 cap22 cap21 cap20 cap19 cap18 cap17 cap16 read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 1 0 0 0 0 0 0 function setting bit23 to bit16 for cursor start address lcdcpl (04bah) lcdcpm (04bbh) lcdcph (04bch) lcdcm (04b6h) lcdcw (04b7h) lcdch (04b8h)
tmp91c820a 2008-02-20 91c820a-250 lcd cursor hot point pixel correction setting register 7 6 5 4 3 2 1 0 bit symbol apb3 apb2 apb1 apb0 read/write r/w after reset 0 function setting bit3 to bit0 for correction of hot point (for 1-dot correction) table 3.14.7 pixel correct and register setting in case of monochrome (sram mode) 0000: 0 pixel correct 0111: 7 pixels correct 1111: 15 pixels correct in case of monochrome (sdram mode) and 4 gray (sram/sdram mode) x000: 0 pixel correct x001: 1 pixel correct x010: 2 pixels correct x011: 3 pixels correct x100: 4 pixels correct x101: 5 pixels correct x110: 6 pixels correct x111: 7 pixels correct in case of 8 gray and 16 gray (sran/sdram mode) xx00: 0 pixel correct xx01: 1 pixel correct xx10: 2 pixels correct xx11: 3 pixels correct x: don?t care here, it is possible to correct the cursor per pixel from the start address set before. pixel number should be adjusted in response to the gray mode setting showing above. for example, when 4-gray and 16-bit bus mode, correction should be less than 7 pixels because the smallest pixel is 8 pixels that can set by start address setting. similarly correction pixel should be less than 15 at monochrome mode, 3- at 8- or 16-gray mode. (e.g.) when monochrome mode, correction value is (lcdcp) = 011_hex, and cursor size = (8 8) figure 3.14.7 the location hot point by setting of pixel lcdcp (04b9h) 3- p ixel move hot p oint start address (lcdcph/m/l) cursor lcd panel
tmp91c820a 2008-02-20 91c820a-251 3.14.4.5 frame signal settlement tmp91c820a defines so called frame period (refresh interval for lcd panel) by the value set in f fp [9:0]. dlebcd pin outputs pulse every frame period. dlebfr pin usually outputs the signal inverts polarity every frame period. and tmp91c820a has a special function that can set the timing of inverting frame polarity irrelevant to above frame frequency for the purpose of preventing the patches of display. lcd control register 7 6 5 4 3 2 1 0 bit symbol lcdon all0 frmon ? fp9 mmulcd fp8 start read/write r/w r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 0 function doff port 0: display off 1: display on setting all column ports to 0 0: normal 1: all display data 0 divided fr mode 0: disable 1: enable always write ?0?. setting bit9 for f fp [9:0] specify address of lcd driver with built-in ram 0: off 1: on setting bit8 for f fp [9:0] start control in sr mode 0: stop 1: start lcd f fp register 7 6 5 4 3 2 1 0 bit symbol fp7 fp6 fp5 fp4 fp3 fp2 fp1 fp0 read/write r/w after reset 0 function setting bit7 to bit0 for f fp divide frm register 7 6 5 4 3 2 1 0 bit symbol fmn7 fmn6 fmn5 fmn4 fmn3 fmn2 fmn1 fmn0 read/write r/w after reset 0 function setting dvm bit7 to bit0 lcdctl (04b3h) lcdffp (04b4h) lcddvm (04b1h)
tmp91c820a 2008-02-20 91c820a-252 (1) frame frequency setting basic frame period; dlebcd signal, is made according to the resister f fp [9:0] setting mentioned before. however this f fp [9:0] setting is generally equal to common number, frame period can be corrected by increasing f fp [9:0] with ease. this function cannot correct frame frequency higher than that of table 3.14.8. if it is necessary to set frame frequency higher or detailed, pl ease refer to (3) ?timer out lcdck?. the equation can calculate frame period. frame period = lcdck/(d f fp ) [hz] d: constant for each common (table 3.14.8) f fp : setting of f fp [9:0] register lcdck: source clock of lcd (low clock is usually selected) please select the value of f fp [9:0] as the frame period you want to set in the table 3.14.7. note: please make the value set to f fp [9:0] into the following range. com (common number) fr 1024 (e.g.) in the case where frame period is set to 72.10 hz by 240 coms. f fp = 240 (com) + 63 = 303 = 12fh (by table 3.14.8) therefore, lcdctl = 1 and lcdffp = 2fh are setup. (2) frame invert adjustment function this mode can prevent the deterioration of display (e.g., patches of display). ( * note) if n is set in (lcddvm) register while th is function is set to enable in register (lcdctl) ( ?1?), d3bfr pin outputs the signal inverted polarity every (d2blp x n) timing. if this function isn?t necessary, d3bfr pin outputs the signal inverted polarity every frequency of dlebcd pin after setting this function disable ((lcdctl) = 0). and it is no change wave and timi ng for dlebcd pin by lcddvm setting. note: effects of this function have some differences as the lcd driver or lcd panel you use actually.
tmp91c820a 2008-02-20 91c820a-253 (3) timer out lcdck lcd source clock (lcdck) can select low frequency (fs: 32.768 [khz]) or timer out (ta3out) outputs from internal tmra23. (e.g.) here indicates the method that frame period is set 70 [hz] by selecting ta3out for source clock of lcd. (fc = 6 [mhz], 128 com) the next equation calculates frame period. frame period = 1/(t lp f fp ) [hz] t lp : the period of d2blp source clock for lcdc defines as xt [hz] and then this t lp represents t lp = d/xt d: the value is 3 at 128 com therefore if you set the frame period at 70 [hz] under 128 com, xt = 128 3.5 70 = 26880 [hz] xt should be above value. in order to make xt = 26880 [hz] under fc = 6 [mhz] with t1 of timer 3, 1/xt = t3 2 8/fc [s] t3: the value of timer register (ta3reg) in short, xt = fc/(t3 2 8) [hz] however t3 = (ta3reg) is 13.95 after calculate, it?s impossible to set the value under a decimal point. so if t3 = (ta3reg) is set 0dh, xt = 28846 [hz]. and because of d = 3, frame period = 28846/(128 3) = 75.12 [hz] further if f fp is 136 (com + 8) with correction, frame period = 28846/(136 3) = 70.70 [hz] reference: to maintain quality for display, please refer to following value for each gray scale. (you have to use frame frequency setting, frame invert adjustment function and timer out lcdck.) monochrome: frame period = 70 [hz] 4 or 8 or 16 gray: frame period = 140 [hz]
tmp91c820a 2008-02-20 91c820a-254 figure 3.14.8 timing diagram for sr mode figure 3.14.9 timing diagram for sr mode (detail) d3bfr waveform (in case of 240 row + 63 (ffp) and lcddvm = 0b_hex) figure 3.14.10 d2blp and d3bfr waveform dlebcd d3bfr d2blp d1bscp ld7 to ld0 t scp = 2 states n busrq (internal) t lph = 0.5xt t stop : stop time t op r : cpu operating time n + 1 n + 28 n + 29 xt: 1/32768 [s] 1 state: 1/f sys [s] t lp lp period divided frame disable d2blp waveform divided frame enable lp1 lp2 lp3 lp10 lp304 lp303 lp302 lp301 lp11 d3bfr waveform frame period = 78.02 hz (at = = 30 byte) of volume of 1 com
tmp91c820a 2008-02-20 91c820a-255 table 3.14.8 f fp table for each common number (1/2) d 6.5 6.0 5.0 4.0 3.5 3.0 2.5 2.5 2.0 1.5 unit com number 64 68 80 100 120 128 144 160 200 240 com + 0 78.77 80.31 81.92 81.92 78.02 85.33 91.02 81.92 81.92 91.02 com + 1 77.56 79.15 80.91 81.11 77.37 84.67 90.39 81.41 81.51 90.64 com + 2 76.38 78.02 79.92 80.31 76.74 84.02 89.78 80.91 81.11 90.27 com + 3 75.24 76.92 78.96 79.53 76.12 83.38 89.16 80.41 80.71 89.90 com + 4 74.14 75.85 78.02 78.77 75.50 82.75 88.56 79.92 80.31 89.53 com + 5 73.06 74.81 77.10 78.02 74.90 82.13 87.97 79.44 79.92 89.16 com + 6 72.02 73.80 76.20 77.28 74.30 81.51 87.38 78.96 79.53 88.80 com + 7 71.00 72.82 75.33 76.56 73.72 80.91 86.80 78.49 79.15 88.44 com + 8 70.02 71.86 74.47 75.85 73.14 80.31 86.23 78.02 78.77 88.09 com + 9 69.06 70.93 73.64 75.16 72.58 79.73 85.67 77.56 78.39 87.73 com + 10 68.12 70.02 72.82 74.47 72.02 79.15 85.11 77.10 78.02 87.38 com + 11 67.22 69.13 72.02 73.80 71.47 78.58 84.56 76.65 77.65 87.03 com + 12 66.33 68.27 71.23 73.14 70.93 78.02 8.02 76.20 77.28 86.69 com + 13 65.48 67.42 70.47 72.50 70.39 77.47 83.49 75.76 76.92 86.35 com + 14 64.63 66.60 69.72 71.86 69.87 76.92 82.96 75.33 76.56 86.01 com + 15 63.81 65.80 68.99 71.23 69.35 76.38 81.92 74.90 76.20 85.67 com + 16 63.02 65.02 68.27 70.62 68.84 75.85 81.41 74.47 75.85 85.33 com + 17 62.24 64.25 67.56 70.02 68.34 75.33 80.91 74.05 75.50 85.00 com + 18 61.48 63.50 66.87 69.42 67.84 74.81 80.41 73.64 75.16 84.67 com + 19 60.74 62.77 66.20 68.84 67.35 74.30 79.92 73.22 74.81 84.34 com + 20 60.01 62.06 65.54 68.27 66.87 73.80 79.44 72.82 74.47 84.02 com + 21 59.31 61.36 64.89 67.70 66.40 73.31 78.96 72.42 74.14 83.70 com + 22 58.62 60.68 64.25 67.15 65.93 72.82 78.49 72.02 73.80 83.38 com + 23 57.95 60.01 63.63 66.60 65.47 72.34 78.02 71.62 73.47 83.06 com + 24 57.29 59.36 63.02 66.06 65.02 71.86 77.56 71.23 73.14 82.75 com + 25 56.64 58.72 62.42 65.54 64.57 71.39 77.10 70.85 72.82 82.44 com + 26 56.01 58.10 61.83 65.02 64.13 70.93 76.65 70.47 72.50 82.13 com + 27 55.40 57.49 61.25 64.50 63.69 70.47 76.20 70.09 72.18 81.82 com + 28 54.80 56.89 60.68 64.00 63.26 70.02 75.76 69.72 71.86 81.51 com + 29 54.21 56.30 60.12 63.50 62.83 69.57 75.33 69.35 71.55 81.21 com + 30 53.63 55.73 59.58 63.02 62.42 69.13 74.91 68.99 71.23 80.91 com + 31 53.07 55.16 59.04 62.53 62.00 68.70 74.47 68.62 70.93 80.61 com + 32 52.51 54.61 58.51 62.06 61.59 68.27 74.05 68.27 70.62 80.31 com + 33 51.97 54.07 58.00 61.59 61.19 67.84 67.91 70.32 80.02 com + 34 51.44 53.54 57.49 61.13 60.79 67.42 73.64 67.56 70.02 79.73 com + 35 50.92 53.02 56.99 60.68 60.40 67.01 73.22 67.22 69.72 79.44 com + 36 50.41 52.51 56.50 60.24 60.01 66.60 72.82 66.87 69.42 79.15 com + 37 49.91 52.01 56.01 59.80 59.63 66.20 72.42 66.53 69.13 78.86 com + 38 49.42 51.52 55.54 59.36 59.25 65.80 72.02 66.20 68.84 78.58 com + 39 48.94 51.04 55.17 58.94 58.88 65.41 71.62 65.87 68.55 78.30 com + 40 48.47 50.57 54.61 58.51 58.51 65.02 71.23 65.54 68.27 78.02 com + 41 48.01 50.10 54.16 58.10 58.15 64.63 70.85 65.21 67.98 77.74 com + 42 47.56 49.65 53.72 57.69 57.79 64.25 70.47 64.89 67.70 77.47 com + 43 47.11 49.20 53.28 57.29 57.44 63.88 70.09 64.57 67.42 77.19 com + 44 46.68 48.76 52.85 56.89 57.09 63.50 69.72 64.25 67.15 76.92 com + 45 46.25 48.33 52.43 56.50 56.74 63.14 69.35 63.94 66.87 76.65 com + 46 45.83 47.91 52.01 56.11 56.40 62.77 68.99 63.63 66.60 76.38 com + 47 45.42 47.49 51.60 55.73 56.06 62.42 68.62 63.32 66.33 76.12 com + 48 45.01 47.08 51.20 55.35 55.73 62.06 68.27 63.02 66.06 75.85 com + 49 44.61 46.68 50.80 54.98 55.40 61.71 67.91 62.71 65.80 75.59 com + 50 44.22 46.28 50.41 54.61 55.07 61.36 67.56 62.42 65.54 75.33 hz
tmp91c820a 2008-02-20 91c820a-256 table 3.14.9 f fp table for each common number (2/2) d 6.5 6.0 5.0 4.0 3.5 3.0 2.5 2.5 2.0 1.5 unit com number 64 68 80 100 120 128 144 160 200 240 com + 51 43.84 45.89 50.03 54.25 54.75 61.02 67.22 62.12 62.27 75.07 com + 52 43.46 45.51 49.65 53.89 54.43 60.68 66.87 61.83 65.02 74.81 com + 53 43.09 45.13 49.28 53.54 54.12 60.35 66.53 61.54 64.76 74.56 com + 54 42.72 44.77 48.91 53.19 53.81 60.01 66.20 61.25 64.50 74.30 com + 55 42.36 44.40 48.55 52.85 53.50 59.69 65.87 60.96 64.25 74.05 com + 56 42.01 44.04 48.19 52.51 53.19 59.36 65.54 60.68 64.00 73.80 com + 57 41.66 43.69 47.84 52.18 52.89 59.04 65.21 60.40 63.75 73.55 com + 58 41.32 43.34 47.49 51.85 52.60 58.72 64.89 60.12 63.50 73.31 com + 59 40.99 43.00 47.15 51.52 52.30 58.41 64.57 59.85 63.26 73.06 com + 60 40.66 42.67 46.81 51.20 52.01 58.10 64.25 59.58 63.02 72.82 com + 61 40.33 42.34 46.48 50.88 51.73 57.79 63.94 59.31 62.77 72.58 com + 62 40.01 42.01 46.15 50.57 51.44 57.49 63.63 59.04 62.53 72.34 com + 63 39.69 41.69 45.83 50.26 51.16 57.19 63.32 58.78 62.30 72.10 com + 64 39.38 41.37 45.51 49.95 50.88 56.89 63.02 58.51 62.06 71.86 com + 65 39.08 41.06 45.20 49.65 50.61 56.59 62.71 58.25 61.83 71.62 com + 66 38.78 40.76 44.89 49.35 50.33 56.30 62.42 58.00 61.59 71.39 com + 67 38.48 40.45 44.58 49.05 50.07 56.01 62.12 57.74 61.36 71.16 com + 68 38.19 40.16 44.28 48.76 49.80 55.73 61.83 57.49 61.13 70.93 com + 69 37.90 39.86 43.98 48.47 49.54 55.45 61.54 57.24 60.91 70.70 com + 70 37.62 39.57 43.69 48.19 48.28 55.16 61.25 56.99 60.68 70.47 com + 71 37.34 39.29 43.40 47.91 49.02 54.89 60.96 56.74 60.46 70.24 com + 72 37.07 39.01 43.12 47.63 48.76 54.61 60.68 56.50 60.24 70.02 com + 73 36.80 38.73 42.83 47.35 48.51 54.34 60.40 56.25 60.01 69.79 com + 74 36.53 38.46 42.56 47.08 48.26 54.07 60.12 56.01 59.80 69.57 com + 75 36.27 38.19 42.28 46.81 48.01 53.81 59.85 55.78 59.58 69.35 com + 76 36.01 37.93 42.01 46.55 47.77 53.54 59.58 55.54 59.36 69.13 com + 77 35.75 37.66 41.74 46.28 47.52 53.28 59.31 55.30 59.15 68.91 com + 78 35.50 37.41 41.48 46.02 47.28 53.02 59.04 55.07 58.94 68.70 com + 79 35.25 37.15 41.22 45.77 47.05 52.77 58.75 54.84 58.72 68.48 com + 80 35.01 36.90 40.96 45.51 46.81 52.51 58.51 54.61 58.51 68.27 hz note: above value is at fs = 32.768 [khz].
tmp91c820a 2008-02-20 91c820a-257 table 3.14.10 performance listing for each segment and common number 64-mbit sdram mode 4 gray com 128 160 200 240 320 400 480 d 3 3 2 2 2 1 1 unit t lp 91.6 76.3 61.0 45.8 45.8 30.5 30.5 s seg 128 t stop 1.22 1.22 1.22 1.22 1.22 1.22 1.22 s cpu stop rate 1.33 1.60 2.00 2.67 2.67 4.00 4.00 % 160 t stop 1.44 1.44 1.44 1.44 1.44 1.44 1.44 s cpu stop rate 1.58 1.89 2.37 3.16 3.16 4.73 4.73 % 240 t stop 2.00 2.00 2.00 2.00 2.00 2.00 2.00 s cpu stop rate 2.18 2.62 3.28 4.37 4.37 6.55 6.55 % 320 t stop 2.56 2.56 2.56 2.56 2.56 2.56 2.56 s cpu stop rate 2.79 3.35 4.19 5.58 5.58 8.37 8.37 % 400 t stop 3.11 3.11 3.11 3.11 3.11 3.11 3.11 s cpu stop rate 3.40 4.08 5.10 6.80 6.80 10.19 10.19 % 480 t stop 3.67 3.67 3.67 3.67 3.67 3.67 3.67 s cpu stop rate 4.00 4.81 6.01 8.01 8.01 12.01 12.01 % 560 t stop 4.22 4.22 4.22 4.22 4.22 4.22 4.22 s cpu stop rate 4.61 5.53 6.92 9.22 9.22 13.84 13.84 % 640 t stop 4.78 4.78 4.78 4.78 4.78 4.78 4.78 s cpu stop rate 5.22 6.26 7.83 10.44 10.44 15.66 15.66 % 64-mbit sdram mode 8 gray /16 gray com 128 160 200 240 320 400 480 d 3 3 2 2 2 1 1 unit t lp 91.6 76.3 61.0 45.8 45.8 30.5 30.5 s seg 128 t stop 2.11 2.11 2.11 2.11 2.11 2.11 2.11 s cpu stop rate 2.31 2.77 3.46 4.61 4.61 6.92 6.92 % 160 t stop 2.56 2.56 2.56 2.56 2.56 2.56 2.56 s cpu stop rate 2.79 3.35 4.19 5.58 5.58 8.37 8.37 % 240 t stop 3.67 3.67 3.67 3.67 3.67 3.67 3.67 s cpu stop rate 4.00 4.81 6.01 8.01 8.01 12.01 12.01 % 320 t stop 4.78 4.78 4.78 4.78 4.78 4.78 4.78 s cpu stop rate 5.22 6.26 7.83 10.44 10.44 15.66 15.66 % 400 t stop 5.89 5.89 5.89 5.89 5.89 5.89 5.89 s cpu stop rate 6.43 7.72 9.65 12.86 12.86 19.30 19.30 % 480 t stop 7.00 7.00 7.00 7.00 7.00 7.00 7.00 s cpu stop rate 7.65 9.18 11.47 15.29 15.29 22.94 22.94 % 560 t stop 8.11 8.11 8.11 8.11 8.11 8.11 8.11 s cpu stop rate 8.86 10.63 13.29 17.72 17.72 26.58 26.58 % 640 t stop 9.22 9.22 9.22 9.22 9.22 9.22 9.22 s cpu stop rate 10.07 12.09 15.11 20.15 20.15 30.22 30.22 %
tmp91c820a 2008-02-20 91c820a-258 sram monochrome com 128 160 200 240 320 400 480 d 3 3 2 2 2 1 1 unit t lp 91.6 76.3 61.0 45.8 45.8 30.5 30.5 s seg 128 t stop 0.89 0.89 0.89 0.89 0.89 0.89 0.89 s cpu stop rate 0.97 1.17 1.46 1.94 1.94 2.91 2.91 % 160 t stop 1.11 1.11 1.11 1.11 1.11 1.11 1.11 s cpu stop rate 1.21 1.46 1.82 2.43 2.43 3.64 3.64 % 240 t stop 1.67 1.67 1.67 1.67 1.67 1.67 1.67 s cpu stop rate 1.82 2.18 2.73 3.64 3.64 5.46 5.46 % 320 t stop 2.22 2.22 2.22 2.22 2.22 2.22 2.22 s cpu stop rate 2.43 2.91 3.64 4.85 4.85 7.28 7.28 % 400 t stop 2.78 2.78 2.78 2.78 2.78 2.78 2.78 s cpu stop rate 3.03 3.64 4.55 6.07 6.07 9.10 9.10 % 480 t stop 3.33 3.33 3.33 3.33 3.33 3.33 3.33 s cpu stop rate 3.64 4.37 5.46 7.28 7.28 10.92 10.92 % 560 t stop 3.89 3.89 3.89 3.89 3.89 3.89 3.89 s cpu stop rate 4.25 5.10 6.37 8.50 8.50 12.74 12.74 % 640 t stop 4.44 4.44 4.44 4.44 4.44 4.44 4.44 s cpu stop rate 4.85 5.83 7.28 9.71 9.71 14.56 14.56 % sram 4 gray com 128 160 200 240 320 400 480 d 3 3 2 2 2 1 1 unit t lp 91.6 76.3 61.0 45.8 45.8 30.5 30.5 s seg 128 t stop 1.78 1.78 1.78 1.78 1.78 1.78 1.78 s cpu stop rate 1.94 2.33 2.91 3.88 3.88 5.83 5.83 % 160 t stop 2.22 2.22 2.22 2.22 2.22 2.22 2.22 s cpu stop rate 2.43 2.91 3.64 4.85 4.85 7.28 7.28 % 240 t stop 3.33 3.33 3.33 3.33 3.33 3.33 3.33 s cpu stop rate 3.64 4.37 5.46 7.28 7.28 10.92 10.92 % 320 t stop 4.44 4.44 4.44 4.44 4.44 4.44 4.44 s cpu stop rate 4.85 5.83 7.28 9.71 9.71 14.56 14.56 % 400 t stop 5.56 5.56 5.56 5.56 5.56 5.56 5.56 s cpu stop rate 6.07 7.28 9.10 12.14 12.14 18.20 18.20 % 480 t stop 6.67 6.67 6.67 6.67 6.67 6.67 6.67 s cpu stop rate 7.28 8.74 10.92 14.56 14.56 21.85 21.85 % 560 t stop 7.78 7.78 7.78 7.78 7.78 7.78 7.78 s cpu stop rate 8.50 10.19 12.74 16.99 16.99 25.49 25.49 % 640 t stop 8.89 8.89 8.89 8.89 8.89 8.89 8.89 s cpu stop rate 9.71 11.65 14.56 19.42 19.42 29.13 29.13 %
tmp91c820a 2008-02-20 91c820a-259 sram 8 gray/16 gray com 128 160 200 240 320 400 480 d 3 3 2 2 2 1 1 unit t lp 91.6 76.3 61.0 45.8 45.8 30.5 30.5 s seg 128 t stop 3.56 3.56 3.56 3.56 3.56 3.56 3.56 s cpu stop rate 3.88 4.66 5.83 7.77 7.77 11.65 11.65 % 160 t stop 4.44 4.44 4.44 4.44 4.44 4.44 4.44 s cpu stop rate 4.85 5.83 7.28 9.71 9.71 14.56 14.56 % 240 t stop 6.67 6.67 6.67 6.67 6.67 6.67 6.67 s cpu stop rate 7.28 8.74 10.92 14.56 14.56 21.85 21.85 % 320 t stop 8.89 8.89 8.89 8.89 8.89 8.89 8.89 s cpu stop rate 9.71 11.65 14.56 19.42 19.42 29.13 29.13 % 400 t stop 11.11 11.11 11.11 11.11 11.11 11.11 11.11 s cpu stop rate 12.14 14.56 18.20 24.27 24.27 36.41 36.41 % 480 t stop 13.33 13.33 13.33 13.33 13.33 13.33 13.33 s cpu stop rate 14.56 17.48 21.85 29.13 29.13 43.69 43.69 % 560 t stop 15.56 15.56 15.56 15.56 15.56 15.56 15.56 s cpu stop rate 16.99 20.39 25.49 33.98 33.98 50.97 50.97 % 640 t stop 17.78 17.78 17.78 17.78 17.78 17.78 17.78 s cpu stop rate 19.42 23.30 29.13 38.84 38.84 58.25 58.25 % over 50%
tmp91c820a 2008-02-20 91c820a-260 note 1: the value of the table 3.14.8 is at f c = 36 [mhz]. note 2: bus occupation time to cpu; t stop (in the figure 3.14.11) is the time which cpu reads the memory of transferring with 0 waits. note 3: the following equation can calculate t lp listed below. t lp = d/32768 [s] (e.g.) if the row is 240 and d = 1.5 by the above table t lp = 1.5/32768 = 45.8 [ s] figure 3.14.11 bus occupation time to cpu and bus occupation rate of cpu dlebcd pin d3bfr pin 1 2 120 3 1 2 3 120 1 2 d2blp pin d1bscp pin d7 to d0 pin * bus occupation rate of cpu =
tmp91c820a 2008-02-20 91c820a-261 3.14.4.6 timing charts of interpreting memory codes tmp91c820a supports different memory accessing. they are sram with waits, sdram burst modes, and the size of sdram is 16m/64m/128mbits. the access signals for the lcd panel are shown in figure 3.14.12. to catch low speed lcd drivers, 3 types of scp rates (f sys /2, f sys /4, and f sys /8) can be selected. the output data (ld7 to ld0) will be issued from the built-in fifo at the rising edge of d1bscp when the fifo is no empty. the work of the fifo is illustrated in figure 3.14.13, where the buffer size 80 bytes. the fifo latches baseld7 to ld0 signal at the falling edge of basescp which is shown in figure 3.14.14 and 3.14.15 for sram and sdram modes respectively. the fifo is always reset to the empty state by the rising edge of d2blp. in basescp mode (e.g., for scpw1, 0 = 00), d1bcp is equal to basescp, ld7 to ld0 equal to baseld7 to ld0 and no fifo used. generally, the data input rate of fifo should be greater than the output one. to make fifo work correctly, the following condition have to be satisfied by setting sfr properly. (n/8 + 1) tcw + 24 1/f c < t lp ? t lph here, n is the segment number, and tcw is d1bscp clock cycle, t lp is d2blp cycle, and t lph is high width of d2blp signal. referring figure 3.14.16, we can know this relation means that the last ld7 to ld0 data must be generated before the rising edge of d2blp. for example, in case of f c = 36 mhz, f s = 32 khz, 4 gray, 240 com, 640 seg, and sdram burst mode, the following table can be obtained, which tells user that 8 clock mode is impossible and scpw = base/2/4 clock modes can be used. scpw d1bscp frequency (mhz) tcw (ns) (n/8 + 1) tcw + t_busdly + t_busfmax (ns) t lp ? t lph (ns) judgment base 18 55.6 5166.1 31250 ok 2 clk 9 111.2 9674.4 31250 ok 4 clk 4.5 222.4 18681.6 31250 ok 8 clk 2.25 444.8 36696 31250 error note: the speed of basescp mode is equal to 2clk mode in the 8 or 16 gray mode. figure 3.14.12 timing diagram for the lcd panel access signals f sys out ? 1 out out + + + + ? 1 out out + ?
tmp91c820a 2008-02-20 91c820a-262 note: d1bscp = basescp and baseld7 to ld0 = baseld7 to ld0 in basescp mode (e.g., for scpw [1:0] = 00) figure 3.14.13 timing diagram for fifo out out + 1 baseld7 to ld0 80 bytes fifo d1bscp ld7 to ld0 d2blp basescp f sys /2, f sys /4, f sys /8 f sys out out+1
tmp91c820a 2008-02-20 91c820a-263 figure 3.14.14 timing diagram for sram mode with basescp figure 3.14.15 timing diagram for sdram burst mode with basescp sram 0 wait mode n a 23 to a0 rd n + + + + + + + + + + + + + 2 out + 2 out + 3 out + 3 out + 4 out + 4 4 gray out ? + + + + ? out out + + 1 out + 2 out + 3 out + 4 out + 6 out + 5 out out + 1 out + 2 out + 3 out + 4 out + 6 out + 5 i in in+1 in+2 in+3 in+4 in+5 in+6 in+7
tmp91c820a 2008-02-20 91c820a-264 note 1: if base scp, t_bufmax = 0. note 2: if except base, t_bufmax tcw + 2/fc note 3: t_busdly is about 11 times as long as f sys period (22/fc). figure 3.14.16 timing diagram for maximum fifo delay time a 23 to a0 rd d15 to d0 sdram burst 1-clock mode baseld7 to ld0 basescp monochrome f sys 227 row column out t_bufmax d1bscp ld7 to ld0 tc w in in+1 in+2 in+3 in+4 in+5 in+6 in+7 out out out+1 out+1 out+2 out+2 out+3 out out + 1 d2blp t_busdly (segnum/8) +
tmp91c820a 2008-02-20 91c820a-265 3.14.4.7 interface examples at sr mode note 1: display memory should be 16-bit bus. note 2: other circuit is necessary for lcd drive power supply for lcd driver display. figure 3.14.17 interface example for shift register type lcd driver note: because the connection between the line of display ram data and output bus: ld0:7 is just the mirror reverse, please care of connection. the data lsb of display ram is output from ld7. in the above figure, ld0 shoud be connected to di7 of lcd driver, and ld1 to di6. for detail information, please refer to figure 3.14.5. com001 com240 seg001 seg240 240com ld0 to ld7 scp lp fr lp fr eio1 eio2 open dir vdd s/c vdd vss vss test dual vcclr, v0lr, v2lr, vsslr, v3lr, v5lr dlebcd eio1 eio2 open vdd vdd vss t6c13b (240-row driver selection) t6c13b ( 240-column driver selection ) tmp91c820a di7 to di0 vss vss dir test di7 to di0 dual scp s/c vccl/r, v0l/r, v1l/r, v4l/r, v5l/r doff dspof dspof control signal d0 to d15 a0 to a23 axx to axx d0 to d15 control signal display memory (sdram/sram selection) power supply circuit power supply circuit
tmp91c820a 2008-02-20 91c820a-266 3.14.4.8 sample program ? example: in case of use 240 seg 240 com, 4-level gray scale display, 64-mbit sdram. this sample program operate correctly, lcd panel shows figure 3.14.18 display. ; ***** sdram set ***** ld (sdacr), 2bh ; add-mux enable, 64-mbit select ld (sdrcr), 01h ; interval refresh ; ***** glcdc set ***** ld (lcdmode), 17h ; a/b area off, sdram 64 mbits, sr type ; scp width 2 clocks ld (lcddvm), 11 ; 11-count dvm set ld (lcdsize), 32h ; com = 240, seg = 240 ld (lcdctl), 20h ; divide frame on, display off ld (lcdffp), 240 ; frame frequency correction (91 hz) ld (lcdgl), 01h ; 4-level gray ld (lcdcm), 0c1h ; cursor on, black, 2 hz blink ld (lcdcw), 19 ; width = 20 dots ld (lcdch), 19 ; height = 20 dots ld (lcdcp), 00h ; pixel = 0 ld (lcdcpl), 00h ; cursor position ld (lcdcpm), 00h ; cursor address ld (lcdcph), 40h ; cursor address ld (lsarch), 40h ; c_area start address ld (lsarcm), 00h ; c_area start address ld (lsarcl), 00h ; c_area start address ; ***** 0/4 data write 60 row ***** ld xix, 400000h ; ld wa, 0000h ; write data 0/4 gray data (0000000000000000b) loop1: ld (xix), wa ; inc 2, xix ; cp xix, 407800h ; 400000h to 4077ffh: 60 row (dot) jr nz, loop1 ; ; ***** 2/4 data write 60 row ***** ld xix, 407800h ; ld wa, 05555h ; write data 2/4 gray data (0101010101010101b) loop2: ld (xix), wa ; inc 2, xix ; cp xix, 40f000h ; 407800h to 40efffh: 60 row (dot) jr nz, loop2 ;
tmp91c820a 2008-02-20 91c820a-267 240 com (dots) 240 seg (dots) 60 dots 60 dots 60 dots 60 dots 20 dots 20 dots cursor blink (black, 2hz) ; ***** 3/4 data write 60 row ***** ld xix, 40f000h ; ld wa, 0aaaah ; write data 3/4 gray data (1010101010101010b) loop3: ld (xix), wa ; inc 2, xix ; cp xix, 416800h ; 40f000h to 4167ffh: 60 row (dot) jr nz, loop3 ; ; ***** 4/4 data write 60 row ***** ld xix, 416800h ; ld wa, 0ffffh ; write data 4/4 gray data (1111111111111111b) loop4: ld (xix), wa ; inc 2, xix ; cp xix, 41e000h ; 416800h to 41dfffh: 60 row (dot) jr nz, loop4 ; ; ***** 4-level gray palette pattern set ***** ld (lg0l), 00h ; 0/4 gray scale palette 0000b ld (lg1l), 05h ; 2/4 gray scale palette 0101b ld (lg2l), 0eh ; 3/4 gray scale palette 1110b ld (lg3l), 0fh ; 4/4 gray scale palette 1111b ; ***** dma, display-on start ***** ld (lcdctl), 0a1h ; display on, divide on figure 3.14.18 display reference above sample program
tmp91c820a 2008-02-20 91c820a-268 3.14.5 ram built-in type lcd driver control mode (ram type) 3.14.5.1 operation data transmission to lcd driver is executed by move instruction of cpu. after setting mode of operation to sfr, when move instruction of cpu is executed lcdc outputs chip select signal to lcd dr iver connected to the outside from control pin (d1bscp etc.). therefore control of data transmission numbers corresponding to lcd size is controlled by instruction of cpu. there are 2 kinds of address of lcd driver in this case, and which is chosen determines by lcdctl register. it corresponds to lcd driver which has every 1 byte of instruction register and display data register in lcd driver at the time of = ?0?. please make the transmission place address at this time into either of fe0h to fe7f. (sequential access type: see table 3.14.3) it corresponds to address direct writing type lcd driver at the time of = ?1?. the transmission place address at this time can also assign the memory area of 3c0000h to 3fffffh to four area for every 64 kbytes. (random access type: see table 3.14.4) figure 3.14.19 example of access timing for ram built-in type lcd driver (wait = 0) system clock: f sys a 23 to a0 d1bscp, d2blp, d3bfr, dlebcd d7 to d0 data-out data-in [write cycle] [read cycle] r/w
tmp91c820a 2008-02-20 91c820a-269 3.14.5.2 interface examples at internal ram mode com001 com065 seg001 seg080 65com open vdd vss vlc2, vlc3, vlc5 dlebcd vdd vdd vss vss vlc1, vlc2, vlc3, vlc4, vlc5 t6b66a ( 65-row driver ) vdd vss t6b65a (80-column driver) tmp91c820a db7 to db0 db5 to db0 doff wr ce wr le dspof w r power supply circuit power supply circuit note: other circuit is necessary for lcd drive power supply for lcd driver display. figure 3.14.20 interface example for ram built-in type sequential access type lcd driver
tmp91c820a 2008-02-20 91c820a-270 3.14.5.3 sample program ? example: in case of use 80seg 65com lcd driver. assign external column driver to lcdc1 and row driver to lcdc4. this example used ld instruction in setting of instruction and used burst function of micro dma in transmitting of display data. ; ***** setting external terminal ***** ld (pdcr), 19h ; ce for lcdc1:d1bscp, ; le for lcdl1:dlebcd, ; setting for doff ; ***** setting for lcdc ***** ld (lcdmode), 00h ; select ram mode ld (lcdctl), 00h ; mmulcd = 0 (sequential access mode) ; ***** setting for mode of lcdc0/lcdr0 ***** ld (lcdc1l), xx ; setting instruction for lcdc1 ld (lcdc4l), xx ; setting instruction for lcdc4 ; ***** setting for micro dma and inttc (ch 0) ***** ld a, 08h ; source address inc mode ldc dmam0, a ; ld wa, 650 ; count = 650 ldc dmac0, wa ; ld xwa, 1000h ; source address = 1000h ldc dmas0, xwa ; ld xwa, 0fe1h ; destination address = fe1h (lcdc0h) ldc dmad0, xwa ; ld (intetc01), 06h ; inttc0 level = 6 ei 6 ; ld (dmab), 01h ; burst mode ld (dmar), 01h ; soft start in case of store 650 bytes transfer data to lcd driver.
tmp91c820a 2008-02-20 91c820a-271 3.15 melody/alarm generator (mld) tmp91c820a incorporates melody function and alarm function, both of which are output from the mldalm pin. five kind of fixed cycles interrupt is generate by using 15-bit counter, which is used for alarm generator. features are as follows. ? melody generator the melody function generates signals of any frequency (4 hz to 5461 hz) based on low-speed clock (32.768 khz) and outputs the signals from the mldalm pin. by connecting a loud speaker outside, melody tone can easily sound. ? alarm generator the alarm function generates eight kinds of alarm waveform having a modulation frequency (4096 hz) determined by the low-speed clock (32.768 khz). and this waveform is able to invert by setting a value to a register. by connecting a loud speaker outside, alarm tone can easily sound. five kind of fixed cycles (1 hz, 2 hz, 64 hz, 512 hz, 8192 hz) interrupts be generated by using a counter which is used for alarm generator. ? special mode it is assigned at bit0 and at bit1, of emccr0 register (00e7hex). these bits are used when you want to operate lcdc and melody circuit without low-frequency clock (xtin, xtout). after reset these two bits set to 0 and low clock is supplied each lcdc and melody circuit. if you write these bits to 1, ta3 (generate by timer 3) is supplied each lcdc and melody circuit. in this case, you should set 32 khz timer 3 frequency. for detail, look ac specification characteristics. this section is constituted as follows. 3.15.1 block diagram 3.15.2 control registers 3.15.3 operational description 3.15.3.1 melody generator 3.15.3.2 alarm generator
tmp91c820a 2008-02-20 91c820a-272 3.15.1 block diagram internal data bus melfh, melfl register comparator (cp0) 12-bit counter (uc0) melfh low-speed clock (32.768 khz) stop and clear invert f/f melout clear reset [melody generator] intalm0 (8192hz) intalm1 (512 hz) intalm2 (64 hz) intalm3 (2 hz) intalm4 (1 hz) alm register melout a lmout mldalm pin internal data bus alarm waveform generator melalmc [alarm generator] reset 4096 hz invert melalmc < melalm > melalmc < alminv > a lmint intalmh (halt release) selector 8-bit counter edge ditector 15-bit counter (uc1) selector ta30ut emccr0 figure 3.15.1 mld block diagram
tmp91c820a 2008-02-20 91c820a-273 3.15.2 control registers alm r register 7 6 5 4 3 2 1 0 bit symbol al8 al7 al6 al5 al4 al3 al2 al1 read/write r/w after reset 0 function setting alarm pattern melalmc register 7 6 5 4 3 2 1 0 bit symbol fc1 fc0 alminv ? ? ? ? melalm read/write r/w r/w r/w r/w r/w r/w r/w after reset 0 0 0 0 0 0 0 function free-run counter control 00: hold 01: restart 10: clear 11: clear and start alarm waveform invert 1: invert always write ?0?. output waveform select 0: alarm 1: melody note 1: melalmc is read always 0. note 2: when setting melalmc register except during the free-run counter is running, is kept 01. alm (0330h) melalmc ( 0331h ) melfl register 7 6 5 4 3 2 1 0 bit symbol ml7 ml6 ml5 ml4 ml3 ml2 ml1 ml0 read/write r/w after reset 0 function setting melody frequency (lower 8 bits) melfh register 7 6 5 4 3 2 1 0 bit symbol melon ml11 ml10 ml9 ml8 read/write r/w r/w after reset 0 0 function control melody counter 0: stop and clear 1: start setting melody frequency (upper 4 bits) melfl (0332h) melfh (0333h) almint register 7 6 5 4 3 2 1 0 bit symbol ? ialm4e ialm3e ialm2e ialm1e ialm0e read/write r/w r/w after reset 0 0 function always write ?0?. 1: interrupt enable for intalm4 to intalm0 almint (0334h)
tmp91c820a 2008-02-20 91c820a-274 3.15.3 operational description 3.15.3.1 melody generator the melody function generates signals of any frequency (4 hz to 5461 hz) based on low-speed clock (32.768 khz) and outputs the signals from the mldalm pin. by connecting a loud speaker outsid e, melody tone can easily sound. (operation) at first, melalmc have to be set as 1 in order to select melody waveform as output waveform from mldalm . then melody output frequency has to be set to 12-bit register melfh, melfl. followings are setting example and calculation of melody output frequency. (formula for calculating of melody waveform frequency) at fs = 32.768 [khz] melody output waveform f mld [hz] = 32768/(2 n + 4) setting value for melody n = (16384/f mld ) ? 2 (notice: n = 1 to 4095 (001h to fffh), 0 is not acceptable) (example program) in case of outputting a musical scale (440 hz) ld (melalmc), 11x00001b ; select melody waveform ld (melfl), 23h ; n = 16384/440 ? 2 = 35.2 = 023h ld (melfh), 80h ; start to generate waveform (ref: basic musical scale setting table) scale frequency [hz] register value: n c 264 03ch d 297 035h e 330 030h f 352 02dh g 396 027h a 440 023h b 495 01fh c 528 01dh
tmp91c820a 2008-02-20 91c820a-275 3.15.3.2 alarm generator the alarm function generates eight kinds of alarm waveform having a modulation frequency 4096 hz determined by the low-speed clock (32.768 khz). and this waveform is reversible by setting a value to a register. by connecting a loud speaker outside, alarm tone can easily sound. five kind of fixed cycles (1 hz, 2 hz, 64 hz, 512 hz, 8 khz) interrupt be generated by using a counter which is used for alarm generator. (operation) at first, melalmc have to be set as 0 in order to select alarm waveform as output waveform from mldalm. then 10 be set on melalmc register, and clear internal counter. finally alarm pattern has to be set on 8-bit register of alm. if it is inverted output-data, set as invert. followings are example program, setting value of alarm pattern and waveform of each setting value. (setting value of alarm pattern) setting value for alm register alarm waveform 00h 0 fixed 01h al1 pattern 02h al2 pattern 04h al3 pattern 08h al4 pattern 10h al5 pattern 20h al6pattern 40h al7 pattern 80h al8 pattern other undefined (do not set.) (example program) in case of outputting al2 pattern (31.25 ms/8 times/1 s) ld (melalmc), c0h ; set output alarm waveform ; free-run counter start ld (alm), 02h ; set al2 pattern, start
tmp91c820a 2008-02-20 91c820a-276 example: waveform of alarm pattern for each setting value (not invert). 62.5 ms 62.5 ms 31.25 ms al1 pattern (continuous output) al2 pattern (8 times/1 s) 12 8 1 1 s 1 al3 pattern (once) 500 ms al4 pattern (twice/1 s) 12 62.5 ms 1 1 s 12 1 al5 pattern (3 times/1 s) 62.5 ms 1 s 3 1 al6 pattern (once) al7 pattern (twice) 12 al8 pattern (once) 250 ms modulation frequency (4096 hz)
tmp91c820a 2008-02-20 91c820a-277 3.16 sdram controller (sdramc) tmp91c820a includes sdram controller which supports data access by cpu/lcdc. the features are as follows. (1) support sdram 16- or 64- or 128-mbit sdram ( 16 bits 2/4 banks), not support ddr (2) automatic initialize function ? all bank pre-charge command generate ? mode register set generate ? 8 times auto refresh (3) access mode cpu access lcdc access burst length 1 word full page addressing mode sequential sequential cas latency (clock) 2 2 write mode single write ? (4) access cycle ? cpu access (read/write) read cycle: 4 states (222 ns at 36 mhz) write cycle: 3 states (167 ns at 36 mhz) access data width: 8 bits/16 bits burst length: 1 word only ? lcdc burst access (read only) read cycle: 1 state (55 ns at 36 mhz) overhead: 4 states (222 ns at 36 mhz) access data width: 16 bits only burst length: full page only (5) refresh cycle auto generate ? auto refresh is generated during another area access. ? refresh interval is programmable. ? self refresh is supported notes: ? display data has to set from the head of each page. ? program is not operated on sdram. ? following condition is set by setting chip select controller cs1. ? wait setting: 0 wait setting only ? bus width: 8/16 bit only ? memory area: optional
tmp91c820a 2008-02-20 91c820a-278 3.16.1 control registers figure 3.16.1 shows the sdramc control registers. setting these registers controls the operation of sdramc. sdram access control register 7 6 5 4 3 2 1 0 bit symbol sdini swrc ? ? smuxe smuxw1 smuxw0 smac read/write r/w r/w r/w r/w r/w r/w r/w after reset 0 0 1 0 0 0 0 0 function auto initialize 0: disable 1: enable write recovery 0: 1 clock 1: 2 clock always write ?10?. address multiplex 0: disable 1: enable sdram select 00: 16 mbits 10: 128 mbits 01: 64 mbits 11: reserved sdram controller 0: disable 1: enable sdram refresh control register 7 6 5 4 3 2 1 0 bit symbol sfrc srs2 srs1 srs0 ? src read/write r/w r/w r/w r/w after reset 0 0 0 0 0 0 function self refresh 0: exit 1: entry auto refresh interval 000: 78 states 100: 195 states 001: 97 states 101: 210 states 010:124 states 110: 249 states 011:156 states 111: 312 states always write ?0?. auto refresh 0: disable 1: enable figure 3.16.1 sdramc control registers self refresh operation is controlled by setting sdrcr, and self-refresh mode become entry by writing ?1? to it. if wrote ?0? to sdrcr, self refresh mode become exit. sdacr (04f0h) sdrcr (04f1h)
tmp91c820a 2008-02-20 91c820a-279 3.16.2 operation description (1) memory access control the sdramc is enabled by setting sdacr to ?1?. when one of the bus masters (cpu, lcdc) generates a cycle to access the sdram address area, the sdramc outputs sdram control signals (sdcs, sdras, sdcas, sdwe, sdldqm, sdudqm, sdclk, sdcke). in the access cycle, address multiplex outputs row/column multiplex address through a1 to a12 pin. and multiplex width is decided by setting sdacr. the relation between multiplex width and memory size is table 3.16.1. table 3.16.1 address multiplex sdram tmp91c820a address output address column row address pin name address 16 mbits 64 mbits 128 mbits ? a0 a0 a0 a0 a0 a1 a9 a9 a10 a1 a2 a10 a10 a11 a2 a3 a11 a11 a12 a3 a4 a12 a12 a13 a4 a5 a13 a13 a14 a5 a6 a14 a14 a15 a6 a7 a15 a15 a16 a7 a8 a16 a16 a17 a8 a9 a17 a17 a18 a9 a10 a18 a18 a19 a10 a11 a19 a19 a20 a11 a12 a20 a21 bs0 a13 a20 a21 a22 bs1 a14 ? a22 a23 sdram access by cpu is performed by the 1 word burst mode. sdram access by lcdc is performed by 1 page burst mode. sdram access cycle is shown in figure 3.16.2 to figure 3.16.7. the read cycle by cpu is the 4-state fixation, and a write cycle is the 3-state fixation. in the burst read cycle by lcdc, a mode register setup, a pre-charge cycle, and a refresh cycle are automatically inserted in cpu cycle front and back. note: in sdram access cycle, wait setup by the cs/wait controller (cs1) is disregarded. the wait setting of cs1 should be 0 waits. memory size tmp91c820a address pin name effective column address
tmp91c820a 2008-02-20 91c820a-280 figure 3.16.2 sdram access timing (cpu read) sdclk bank active read with auto precharge 4 states sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a 11 d0 to d15 in ra ca a 1 to a12
tmp91c820a 2008-02-20 91c820a-281 figure 3.16.3 sdram access timing (cpu write 16 bits) sdclk bank active write with auto precharge 3 states sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a 11 d0 to d7 ra ca a 0 to a12 d8 to d15 out out
tmp91c820a 2008-02-20 91c820a-282 figure 3.16.4 sdram access timing (cpu write 16 bits, write recovery: 2 clocks) sdclk bank active write with auto precharge sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a10 d0 to d7 ra a 1 to a12 d8 to d15 3 states write recovery cycle out out ca
tmp91c820a 2008-02-20 91c820a-283 figure 3.16.5 sdram access timing (cpu lower byte write) sdclk bank active write with auto precharge sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a 11 d0 to d7 ra a 1 to a12 d8 to d15 c a out
tmp91c820a 2008-02-20 91c820a-284 figure 3.16.6 sdram access timing (cpu upper byte write) sdclk bank active write with auto precharge sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a 11 d0 to d7 ra a 1 to a12 d8 to d15 c a out
tmp91c820a 2008-02-20 91c820a-285 figure 3.16.7 sdram access timing (lcdc burst read) 220 ca ( 000 ) 165 states (160-word read) sdclk sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a 11 d0 to d15 a 1 to a12 mode register set (full page) bank active read bank precharge mode register set (1 word) 227 ra da da + 2 da + 4 ?? da + 314 da + 316 da + 318
tmp91c820a 2008-02-20 91c820a-286 (2) refresh control the tmp91c820a supports auto refresh cycle. when sdrct is set to ?1?, the auto refresh cycle is automatically generate at intervals specified by sdrcr. the auto refresh interval can be specified in a range of 78 states to the 312 states (4.3 s to 17.3 s at 36 mhz). the generating timing of a refresh cycle becomes into access cycles other than sdram area (cs1) after the interval setup by . the refresh cycle is shown in figure 3.16.8. moreover, the refreshment interval is shown in table 3.16.2. figure 3.16.8 refresh cycle table 3.16.2 auto refresh cycle insertion interval setting frequency (f sys ) srs2 srs1 srs0 insertion interval (state) 5 mhz 6.25 mhz 8 mhz 10 mhz 12.5 mhz 18mhz 0 0 0 78 15.6 12.5 9.8 7.8 6.2 4.3 0 0 1 97 19.4 15.5 12.1 9.7 7.8 5.4 0 1 0 124 24.8 19.8 15.5 12.4 9.9 6.9 0 1 1 156 31.2 25.0 19.5 15.6 12.5 8.7 1 0 0 195 39.0 31.2 24.4 19.5 15.6 10.8 1 0 1 210 42.0 33.6 26.3 21.0 16.8 11.7 1 1 0 247 49.4 39.5 30.9 24.7 19.8 13.7 1 1 1 312 62.4 49.9 39.0 31.2 25.0 17.3 it does not generate interval refreshment during the burst access to sdram by lcdc. the interval refreshment demand generated in the meantime is held only once. when it returns to cpu access cycle, an interval refresh cycle is generated. furthermore, tmp91c820a can generate a self refresh cycle. the timing of a self refresh cycle is shown in figure 3.16.9. sdclk auto refresh 2 states sdcke sdldqm sdudqm sdcs sdcas sdras sdwe ( unit:
tmp91c820a 2008-02-20 91c820a-287 figure 3.16.9 self refresh cycle note 1: sdclk is output in the idle2 mode. therefore if you stop sdclk, change pf6 pin to output port before the halt instruction. note 2: pin condition under the idle1/stop mode depends on the setting of syscr2. sdcke doesn?t depend on it but outputs low level. if sdrcr is set to 1, the self-refresh cycle shown in figure 3.16.9 will occur. the self refreshment mode is used when using the standby mode (stop, idle1) which an internal clock stops. before halt instruction (stop, idle1) of interval refreshment in the state of enable, please set sdrcr to 1. release of a self refresh cycle is automatically performed by release in the standby mode. it inserts automatically one interval refreshment after self refreshment release, and returns to the interval refreshment mode. (note: when halt instruction is cancelled by a reset, the i/o registers are initialized, therefore, refresh is not performed.). please do not place the command which accesses sdram just before the command which sets 1 to sdrcr. after setting sdrcr to 1, make sure that the halt instruction comes after nop or some instruction. self-refresh c y cle sdclk sdcke sdldqm sdudqm sdcs sdcas sdras sdw e self refresh entry auto refresh self refresh exit halt entry halt exit
tmp91c820a 2008-02-20 91c820a-288 (3) sdram initialize after reset release, tmp91c820a can generate the cycle of the following required at the time of the power-supply injection to sdram. the cycle is shown in figure 3.16.10. 1. precharge of all banks 2. the initial configuration to a mode registers 3. the refresh cycle of 8 cycles the above mentioned cycle is generated by setting 1 to sdacr. while this cycle is executing, the cpu operation (instruction fetch, execution) is halted. before executing the initialization sequence, appropriate port settings must be made to enable the sdram control signals and address signals (a1 to a12). figure 3.16.10 initialize cycle 8 times auto-refresh cycle sdclk sdcke sdldqm sdudqm sdcs sdcas sdras sdwe a 11 a 1 to a12 620 220 a ll bank precharge mode register set (1 word) a uto refresh a uto refresh a uto refresh a uto refresh a uto refresh
tmp91c820a 2008-02-20 91c820a-289 (4) connection example the example of connection with sdram is shown in figure 3.16.11. (1 m word 4 banks 16 bits) figure 3.16.11 connection with sdram tmp91c820a sdclk sdcke d0 to d15 a1 to a12 a 13 a 14 sdldqm sdudqm sdcs sdras sdcas sdwe sdram clk cke dq0 to dq15 a 0to a 11 bs0 bs1 ldqm udqm cs ras cas we
tmp91c820a 2008-02-20 91c820a-290 (5) limitation point to use sdram there are some points to notice when us ing sdramc. please refer to the section under below and take care. 1) wait access when using sdram, it is added some limitation of access to all other memories. under the n-wait setting of this mcu, it is prohibited inserting the time over (14 refresh interval time; in auto refresh function controlled by sdram controller). 2) execution of sdram command before halt instruction (sr(self refresh)-entry , initialize , mode-set) it requires execution time (a few stat es) to execute the command that sdramc has (sr- entry, initialize). therefore when executing halt instruct ion after the sdram command, please insert over 10 bytes nop or other 10 bytes instructions before halt instruction. 3) ar (auto refresh) interval time when using sdram, cpu clock must be set suitable speed for sdram?s specification that is minimum operating clock and minimum refresh interval time. when using sdram under slow mode or do wn the clock gear, please design the system with special care for auto refresh interval time. and please set auto refresh interval time after adding 10 states to distributed auto refresh interval time, because it might not meet the a.c specification of sdram by stopping auto refresh. (example of calculation) condition: f sys = 18mhz, sdram specification of distributed auto refresh interval time = 4096 times/64 ms 64ms/ 4096 times = 15.625 s/1 time = 281.25state/1 time 281.25 ? 10 = 271.25 state/less than 1 time is needed ? 247 state is needed
tmp91c820a 2008-02-20 91c820a-291 4) auto exit problem when exiting from self refresh mode of sdram when using self refresh function together with stand-by function of cpu or changing clock, it might not be suit specification of sdram. because automatic releasing self refresh function (auto exit function) operates by cpu releasing halt mode. following figure shows example for avoid this problem by s/w. (outline concept to control) *the target ports to change are sdcke pin and sdcs pin. *the method of self refresh entry includes the condition 4). * sr : self refresh , ar : auto refresh halt mode gear-down or change to low clock change to port change clk halt interrupt sr condition ar condition a uto exi t sr condition sr condition general port setting sdram control pin gear-up or change to high clock f sys cpu port condition sdram controller internal condition sr entry sr exit change to port change clk sr entry ar condition sdram condition a r condition ar condition a r condition sdram control pin 18mhz 32khz
tmp91c820a 2008-02-20 91c820a-292 3.17 16-bit timer (tmrb) the tmp91c820a incorporates one multifunctional 16-bit timer (tmrb0) which have the following operation modes: ? interval timer mode timer consists of a 16-bit up counter, two 16-bit timer registers (one of them with a double-buffer structure), a 16-bit capture register s, two comparators, a capture input controller, a timer flip-flop and a control circuit. timer is controlled by an 11-byte control sfr. this chapter consists of the following items: 3.17.1 block diagram 3.17.2 operation 3.17.3 sfrs 3.17.4 operation in each mode (1) 16-bit timer mode (2) 16-bit programmable pulse generation (ppg) output mode table 3.17.1 pins and sfr of tmrb0 channel spec tmrb0 external clock/capture trigger input pins none external pins timer flip-flop output pins tb0out0 (also used as pb6) timer run register tb0run (0180h) timer mode register tb0mod (0182h) timer flip-flop control register tb0ffcr (0183h) tb0rg0l (0188h) tb0rg0h (0189h) tb0rg1l (018ah) timer register tb0rg1h (018bh) tb0cp0l (018ch) tb0cp0h (018dh) tb0cp1l (018eh) sfr (address) capture register tb0cp1h (018fh)
tmp91c820a 2008-02-20 91c820a-293 3.17.1 block diagram figure 3.17.1 block diagram of tmrb0 intenal data bus intenal data bus run/ clear 16-bit comparator (cp0) 16-bit up counter (uc0) 16-bit time register tb0rg1h/l match detection count clock tb0mod tb0run selector capture external interrupt input control tb1mod prescaler clock : t0 t1 t4 t16 tb0run tb0mod capture register 0 tb0cp0h/l tb0mod 32 16 8 4 2 t1 t4 t16 tb0run internal data bus timer flip-flop control tb0ff0 timer fli p -flo p tb0out0 timer flip-flop output register0 inttb10 register 1 inttb11 int output 16-bit comparator (cp1) 16-bit timer register tb0rg0h/l register buffer 0 match detection
tmp91c820a 2008-02-20 91c820a-294 3.17.2 operation (1) prescaler the 5-bit prescaler generates the source clock for tmrb0. the prescaler clock ( t0) is divided clock (divided by 4) from selected clock by the register syscr0 of clock gear. this prescaler can be started or stopped using tb0run. counting starts when is set to 1; the prescaler is cleared to zero and stops operation when is set to 0. table 3.17.2 prescaler clock resolution at fc = 36 mhz, fs = 32.768 khz prescaler clock resolution system clock selection prescaler clock selection clock gear value t1 t4 t16 1 (fs) xxx 2 3 /fs (244 s) 2 5 /fs (977 s) 2 7 /fs (3.9 ms) 000 (fc) 2 3 /fc (0.2 s) 2 5 /fc (0.9 s) 2 7 /fc (3.6 s) 001 (fc/2) 2 4 /fc (0.4 s) 2 6 /fc (1.8 s) 2 8 /fc (7.1 s) 010 (fc/4) 2 5 /fc (0.9 s) 2 7 /fc (3.6 s) 2 9 /fc (14.2 s) 011 (fc/8) 2 6 /fc (1.8 s) 2 8 /fc (7.1 s) 2 10 /fc (28.4 s) 00 (f fph ) 100 (fc/16) 2 7 /fc (3.6 s) 2 9 /fc (14.2 s) 2 11 /fc (56.9 s) 0 (fc) 10 (fc/16 clock) xxx 2 7 /fc (3.6 s) 2 9 /fc (14.2 s) 2 11 /fc (56.9 s) xxx: don?t care (2) up counter (uc0) uc0 is a 16-bit binary counter which counts up pulses input from the clock specified by tb0mod. any one of the prescaler internal clocks t1, tb0 and t16 can be selected as the input clock. counting or stopping and clearing of the counter is controlled by tb0run. when clearing is enabled, the up counter uc0 will be cleared to zero each time its value matches the value in the timer register tb0rg1h/l. clearing can be enabled or disabled using tb0mod. if clearing is disabled, the counter operates as a free running counter. a timer overflow interrupt (inttbof0) is generated when uc0 overflow occurs.
tmp91c820a 2008-02-20 91c820a-295 (3) timer registers (tb0rg0 and tb0rg1) these two 16-bit registers are used to set th e interval time. when the value in the up counter uc0 matches the value set in this timer register, the comparator match detect signal will go active. setting data for both upper and lower timer registers is needed. for example, using 2-byte data transfer instruction or using 1-byte date transfer instruction twice for lower 8 bits and upper 8 bits in order. the tb0rg0 timer register has a double-buffer structure, which is paired with register buffer. the value set in tb0run determines whether the double-buffer structure is enabled or disabled: it is disabled when = 0, and enabled when = 1. when the double buffer is enabled, data is transferred from the register buffer to the timer register when the values in the up counter (uc0) and the timer register tb0rg1 match. after a reset, tb0rg0 and tb0rg1 are undefined. if the 16-bit timer is to be used after a reset, data should be written to it beforehand. on a reset is initialized to 0, disabling the double buffer. to use the double buffer, write data to the timer register, set to 1, then write data to the register buffer as shown below. tb0rg0 and the register buffer both have the same memory addresses (000188h and 000189h) allocated to them. if = 0, the value is written to both the timer register and the register buffer. if = 1, the value is written to the register buffer only. the addresses of the timer registers are as follows: upper 8 bits (tb0rg0h) lower 8 bits (tb0rg0l) tb0rg0 000189h 000188h upper 8 bits (tb0rg1h) lower 8 bits (tb0rg1l) tb0rg1 00018bh 00018ah tmrb0 the timer registers are write-only registers and thus cannot be read.
tmp91c820a 2008-02-20 91c820a-296 (4) capture registers (tb0cp0h/l) these 16-bit registers are used to latch the values in the up counters. data in the capture registers should be read all 16 bits. for example, using a 2-byte data load instruction or two 1-byte data load instructions. the least significant byte is read first, followed by the most significant byte. the addresses of the capture registers are as follows: ms 8 bits (tb0cp0h) ls 8 bits (tb0cp0l) tb0cp0 00018dh 00018ch tmrb0 the capture registers are read-only registers and thus cannot be written to. (5) capture input control this circuit controls the timing to latch the value of up-counter uc0 into tb0cp0. the value in the up-counter can be loaded into a capture register by software. whenever 0 is written to tb0mod, the current value in the up counter is loaded into capture register tb0cp0. it is necessary to keep the prescaler in run mode (e.g., tb0run must be held at a value of 1). (6) comparators (cp0 and cp1) cp0 and cp1 are 16-bit comparators which compare the value in the up counter uc0 with the value set in tb0rg0 or tb0rg1 respectively, in order to detect a match. if a match is detected, the comparator generates an interrupt (inttb00 or inttb01 respectively). note: as described above, whenever 0 is written to tb0mod, the current value in the up counter is loaded into capture register tb0cp0. however, note that the current value in the up counter is also loaded into capture register tb0cp0 when 1 is written to tb0mod while this bit is holding 0. (7) timer flip-flops (tb0ff0) these flip-flops are inverted by the match detect signals from the comparators and the latch signals to the capture registers. inversion can be enabled and disabled for each element using tb0ffcr. after a reset the value of tb0ff0 is undefined. if 00 is written to tb0ffcr or , tb0ff0 will be inverted. if 01 is written to the capture registers, the value of tb0ff0 will be set to 1. if 10 is written to the capture registers, the value of tb0ff0 will be set to 0. the values of tb0ff0 can be output via the timer output pins tb0out0 (which is shared with pb6). timer output should be sp ecified using the port b function register. write to tb0mod register tb0mod capture operation capture capture capture no capture notice ?0? wr ?0? wr ?1? wr ?1? wr
tmp91c820a 2008-02-20 91c820a-297 3.17.3 sfrs tmrb0 run register 7 6 5 4 3 2 1 0 bit symbol tb0rde ? i2tb0 tb0prun tb0run read/write r/w r/w r/w r/w r/w after reset 0 0 0 0 0 function double buffer 0: disable 1: enable always fixed to ?0?. idle2 0: stop 1: operate 16-bit timer run/stop control 0: stop and clear 1: run (count up) count operation 0 stop and clear 1 count tb0run (0180h) i2tb0: operation during idle2 mode tb0prun: operation of prescaler note: the 1, 4 and 5 of tb0run are read as undefined value. tb0run: operation of tmrb0 figure 3.17.2 register for tmrb tmrb0 mode register 7 6 5 4 3 2 1 0 bit symbol ? ? tb0cp01 ? ? tb0cle tb0clk1 tb0clk0 read/write r/w w * r/w r/w r/w after reset 0 0 1 0 0 0 0 0 function always write ?00?. execute software capture 0: execute 1: undefined always write ?00?. control up counter 0: disable clearing 1: enable clearing tmrb0 source clock 00: reserved 01: t1 10: t4 11: t16 tmrb0 source clock 00 reserved 01 t1 10 t4 11 t16 up counter clear control 0 disable 1 tb0rg1 clearing on match with tb0rg1. software capture 0 the value in the up counter is captured to tb0cp0. 1 undefined (note) tb0mod (0182h) note: a s described above, whenever 0 is written to tb0mod, the current value in the up counter is loaded into capture register tb0cp0. however, note that the current value in the up counter is also loaded into capture re g ister tb0cp0 when 1 is written to tb0mod while this bit is holding 0. prohibit read- modify- write figure 3.17.3 register for tmrb
tmp91c820a 2008-02-20 91c820a-298 tmrb0 flip-flop control register 7 6 5 4 3 2 1 0 bit symbol ? ? ? tb0c0t1 tb0e1t1 tb0e0t1 tb0ff0c1 tb0ff0c0 read/write w r/w r/w w * after reset 1 1 0 0 0 0 1 1 tb0ff0 inversion trigger 0: disable trigger 1: enable trigger function always write ?11?. always write ?0?. invert when the uc value is loaded in to tb0cp0. invert when the uc value matches the value in tb0rg1. invert when the uc value matches the value in tb0rg0. control tb0ff0 00: invert 01: set 10: clear 11: undefined always read as ?11?. 00 invert 01 set to 11 10 clear to 00 11 undefined (always read as ?11?) 0 disable trigger 1 enable trigger 0 disable trigger 1 enable trigger 0 disable trigger 1 enable trigger tb0ffcr (0183h) tb0ff0 control inverted when the uc value is loaded in to tb0cp0. inverted when the uc value matches the valued in tb0rg1. inverted when the uc value matches the valued in tb0rg0. prohibit read- modify- write figure 3.17.4 register for tmrb
tmp91c820a 2008-02-20 91c820a-299 timer register 7 6 5 4 3 2 1 0 bit symbol read/write w tb0rg0l (0188h) after reset undefined bit symbol read/write w tb0rg0h (0189h) after reset undefined bit symbol read/write w tb0rg1l (018ah) after reset undefined bit symbol read/write w tb0rg1h (018bh) after reset undefined note: above registers are prohibited read-modify-write instruction. figure 3.17.5 register for tmrb
tmp91c820a 2008-02-20 91c820a-300 3.17.4 operation in each mode (1) 16-bit timer mode generating interrupts at fixed intervals in this example, the interrupt inttb01 is set to be generated at fixed intervals. the interval time is set in the timer register tb0rg1. 7 6 5 4 3 2 1 0 tb0run 0 0 x x ? 0 x 0 stop tmrb0. intetb01 x 1 0 0 x 0 0 0 enable inttb01 and set interrupt level 4. disable inttb00. tb0ffcr 1 1 0 0 0 0 1 1 disable the trigger. tb0mod 0 0 1 0 0 1 ** select internal clock for input and ( ** = 01, 10, 11) disable the capture function. tb0rg1 * * * * * * * * set the interval time. * * * * * * * * (16 bits) tb0run 0 0 x x ? 1 x 1 start tmrb0. x: don?t care, ? : no change (2) 16-bit programmable pulse generation (ppg) output mode square wave pulses can be generated at any frequency and duty ratio. the output pulse may be either low active or high active. the ppg mode is obtained by inversion of the timer flip-flop tb0ff0 that is to be enabled by the match of the up counter uc0 with timer register tb0rg0 or tb0rg1 and to be output to tb0out0. in this mode the following conditions must be satisfied. (value set in tb0rg0) < (value set in tb0rg1) match with tb0rg0 (inttb00 inerrupt) match with tb0rg1 (inttb01 interrupt) tb0out0 pin figure 3.17.6 programmable pulse generation (ppg) output waveforms when the tb0rg0 double buffer is enabled in this mode, the value of register buffer 0 will be shifted into tb0rg0 at match with tb0rg1. this feature facilitates the handling of low-duty waves. q 1 q 2 q 2 q 3 shift into thetb0rg1 up counter = q 1 up counter = q 2 match with tb0rg0 match with tb0rg1 tb0rg0 (value to be compared) register buffe r write into the tb0rg0 figure 3.17.7 operation of register buffer
tmp91c820a 2008-02-20 91c820a-301 the following block diagram illustrates this mode. selector selector tb0run match 16-bit up counter uc0 f/f (tb0ff0) 16-bit comparator internal data bus tb0rg1 tb0rg0-wr t4 t16 tb0out0 (ppg output ) tb0run clear register buffer 0 tb0rg0 16-bit comparator figure 3.17.8 block diagram of 16-bit mode the following example shows how to set 16-bit ppg output mode: 7 6 5 4 3 2 1 0 tb0run 0 0 x x ? 0 x 0 disable the tb0rg0 double buffer and stop tmrb0. * * * * * * * * set the duty ratio. tb0rg0 * * * * * * * * (16 bits) * * * * * * * * set the frequency. tb0rg1 * * * * * * * * (16 bits) tb0run 1 0 x x ? 0 x 0 enable the tb0rg0 double buffer. (the duty and frequency are changed on an inttb01 interrupt.) tb0ffcr x x 0 0 1 1 1 0 set the mode to invert tb0ff0 at the match with tb0rg0/tb0rg1. set tb0ff0 to 0. tb0mod 0 0 1 0 0 1 ** select the internal clock as the input clock and disable ( ** = 01, 10, 11) the capture function. pbcr x 1 ? ? ? x ? ? pbfc x 1 ? ? ? x ? ? set pb6 to function as tb0out0. tb0run 1 0 x x ? 1 x 1 start tmrb0. x: don?t care, ? : no change
tmp91c820a 2008-02-20 91c820a-302 3.18 hardware standby function tmp91c820a have hardware standby circuit that is able to save the power consumption and protect from program runaway by supplying power voltage down. especially, it?s useful in case of battery using. it can be shifted to ?ps condition? by fixed ps pin to ?low? level. figure 3.18.1 shows timing diagram of transition of ps condition below. ps mode can release only external system reset. note 1: ps pin is effective after reset because syscr2 to 0. if you use as nmi pin, please write syscr2 to 1. note 2: shifting time is 2 to 10 clock times of f sys . figure 3.18.1 hardware standby timing diagram table 3.18.1 power save mode conditions of each halt mode halt mode setting idle2 idle1 stop ps condition idle1 mode + high-frequency stop idle1 mode + high-frequency stop stop mode note: settings of syscr2 and at halt mode are effective as well as ps condition. f sys reset ps ( note1) shifting time (note 2 power save condition reset condition (release ps mode) keep to ps pin more than 10 clock
tmp91c820a 2008-02-20 91c820a-303 4. electrical characteristics 4.1 absolute maximum ratings parameter symbol rating unit power supply voltage vcc ? 0.5 to 4.0 input voltage vin ? 0.5 to vcc + 0.5 v output current iol 2 output current ioh ? 2 output current (total) iol 80 output current (total) ioh ? 80 ma power dissipation (ta = 85c) pd 600 mw soldering temperature (10 s) tsolder 260 storage temperature tstg ? 65 to 150 operating temperature topr ? 20 to 70 c note: the absolute maximum ratings are rated values which must not be exceeded during operation, even for an instant. any one of the ratings must not be exceeded. if any absolute maximum rating is exceeded, a device may break down or its performance may be degraded, causing it to catch fire or explode resulting in injury to the user. thus, when designing products which include this device, ensure that no absolute maximum rating value will ever be exceeded. solderability of lead free products te st parameter test condition note use of sn-37pb solder bath solder bath temperature = 230 c, dipping time = 5 seconds the number of times = one, use of r-type flux solderability use of sn-3.0ag-0.5cu solder bath solder bath temperature = 245 c, dipping time = 5 seconds the number of times = one, use of r-type flux (use of lead free) pass: solderability rate until forming 95%
tmp91c820a 2008-02-20 91c820a-304 4.2 dc characteristics (1/2) parameter symbol condition min typ. max unit fc = 4 to 27 mhz 2.7 ? 3.6 power supply voltage (avcc = dvcc) (avss = dvss = 0 v) vcc fc = 4 to 36 mhz fs = 30 to 34 khz 3.0 ? 3.6 v d0 to d15 vil v cc 2.7 v ? 0.6 p52 to p7 (except pb3, p9) vil1 v cc 2.7 v ? 0.3 vcc reset , nmi , pb3 (int0), p9 vil2 v cc 2.7 v ? 0.25 vcc am0 to am1 vil3 v cc 2.7 v ? 0.3 input low voltage x1 vil4 v cc 2.7 v ? 0.3 ? 0.2 vcc d0 to d15 vih 3.6 v v cc 2.7 v 2.0 ? p52 to p7 (except pb3, p9) vih1 v cc 2.7 v 0.7 vcc ? reset , nmi , pb3 (int0), p9 vih2 v cc 2.7 v 0.75 vcc ? am0 to am1 vih3 v cc 2.7 v vcc ? 0.3 ? input high voltage x1 vih4 v cc 2.7 v 0.8 vcc ? vcc + 0.3 v output low voltage vol iol = 1.6 ma ? ? 0.45 output high voltage voh ioh = ? 400 a 2.4 ? ? v note: typical values are for when ta = 25c and vcc = 3.0 v unless otherwise noted. dc characteristics (2/2) parameter symbol condition min typ. (note 1) max unit input leakage current ili 0.0 vin vcc ? 0.02 5 output leakage current ilo 0.2 vin vcc ? 0.2 ? 0.05 10 a power down voltage (at stop, ram back up) vstop vil2 = 0.2vcc, vih2 = 0.8vcc 1.8 ? 3.6 v reset pull-up resistor rrst 3.6 v v cc 2.7 v 100 ? 400 k ? pin capacitance cio fc = 1 mhz ? ? 10 pf schmitt width reset , nmi , int0, ki0 to ki7 vth v cc 2.7 v 0.4 1.0 ? v programmable pull-up resistor rkh 3.6 v v cc 2.7 v 100 ? 400 k ? normal (note 2) ? 23.0 35.0 idle2 ? 16.0 23.0 idle1 vcc = 3.6 v fc = 36m hz ? 1.6 3.0 ma slow (note 2) ? 23.0 45.0 idle2 ? 14.0 35.0 idle1 vcc = 3.6 v fs = 32.768 khz ? 6.0 25.0 a stop icc vcc = 3.6 v ? 0.2 15.0 a note 1: typical values are for when ta = 25c and vcc = 3.0 v unless otherwise noted. note 2: icc measurement conditions (normal, slow): all functions are operational; output pins are open and input pins are fixed. cl = 30 pf loaded on data and address bus.
tmp91c820a 2008-02-20 91c820a-305 4.3 ac characteristics vcc = 2.7 to 3.6 v case of f fph = 27 mhz vcc = 3.0 to 3.6 v case of f fph = 36 mhz variable f fph = 27 mhz f fph = 36 mhz no. symbol parameter min max min max min max unit 1 t fph f fph period ( = x) 27.7 31250 37 27.7 ns 2 t ac a0 to a23 valid rd / wr fall x ? 23 14 4.7 ns 3 t car rd rise a0 to a23 hold 0.5x ? 13 5.5 0.85 ns 4 t caw wr rise a0 to a23 hold x ? 13 24 14.7 ns 5 t ad a0 to a23 valid d0 to d15 input 3.5x ? 24 105.5 72.95 ns 6 t rd rd fall d0 to d15 input 2.5x ? 24 68.5 45.25 ns 7 t rr rd low width 2.5x ? 15 77.5 54.25 ns 8 t hr rd rise d0 to d15 hold 0 0 0 ns 9 t ww wr low width 2x ? 15 59 40.4 ns 10 t dw d0 to d15 valid wr rise 1.5x ? 35 20.5 5.5 ns 11 t wd wr rise d0 to d15 hold x ? 25 12 2.7 ns 12 t sba data byte control access time for sram 3x ? 39 72 44.1 ns 13 t swp write pulse width for sram 2x ? 15 59 40.4 ns 14 t sbw data byte control to end of write for sram 3x ? 25 86 58.1 ns 15 t sas address setup time for sram 1.5x ? 35 20.5 6.55 ns 16 t swr write recovery time for sram 0.5x ? 13 5.5 0.85 ns 17 t sds data setup time for sram 2x ? 35 39 20.4 ns 18 t sdh data hold time for sram 0.5x ? 13 5.5 0.85 ns 19 t aw a0 to a23 valid wait input (1 + n) wait 3.5x ? 60 69.5 36.95 ns 20 t cw rd / wr fall wait hold (1 + n) wait 2.5x + 0 92.5 69.25 ns 21 t aph a0 to a23 valid port input 3.5x ? 89 40.5 7.95 ns 22 t aph2 a0 to a23 valid port hold 3.5x 129.5 96.95 ns 23 t apo a0 to a23 valid port valid 3.5x + 60 189.5 156.9 ns ac measuring conditions ? output level: high = 0.7 vcc, low = 0.3 vcc, cl = 50 pf ? input level: high = 0.9 vcc, low = 0.1 vcc note: symbol x in the above table means the period of clock f fph , it?s half period of the system clock f sys for cpu core. the period of f fph depends on the clock gear setting or the selection of high-/low-frequency oscillator.
tmp91c820a 2008-02-20 91c820a-306 (1) read cycle note: since the cpu accesses the internal area to read data from a port, the control signals of external pins such as rd and cs are not enabled. therefore, the above waveform diagram should be regarded as depicting internal operation. please also note that the timing and ac characteristics of port input/output shown above are typical representation. for details, contact your local toshiba sales representative. t hr f fph ea24 to ea25 a23 to a0 r/ w port input ( note ) rd d0 to d15 t fph t aw t ap t ad t ac t rr t car d0 to d15 t cw t aph2 csn wait t rd srlb srub t sba srwr
tmp91c820a 2008-02-20 91c820a-307 (2) write cycle note: since the cpu accesses the internal area to write data to a port, the control signals of external pins such as wr and cs are not enabled. therefore, the above waveform diagram should be regarded as depicting internal operation. please also note that the timing and ac characteristics of port input/output shown above are typical representation. for details, contact your local toshiba sales representative. wr , hwr d0 to d15 t wd t a po t ww t dw f fph ea24 to ea25, a23 to a0 r/ w port output (note) d0 to d15 wait csn t caw t sdh t sbw t sas t swr srlb srub srwr t sds t swp
tmp91c820a 2008-02-20 91c820a-308 4.4 sdram controller ac electrical characteristics vcc = 2.7 to 3.6 v case of f fph = 27 mhz vcc = 3.0 to 3.6 v case of f fph = 36 mhz variable 27 mhz 36 mhz no. symbol parameter min max min max min max unit 1 t rc ref/active to ref/active command period 4x 148 27.7 ns 2 t ras active to precharge command period 4x 12210 148 12210 111.1 12210 ns 3 t rcd active to read/write command delay time 2x 74 55.6 ns 4 t rp precharge to active command period 2x 74 55.6 ns 5 t rrd active to active command period 6x 222 166.7 ns 6 t wr write recovery time (cl * = 2) 2x 74 55.6 ns 7 t wr2 write recovery time 3x 111 83 8 t ck clk cycle time (cl * = 2) 2x 74 55.6 ns 9 t ch clk high level width 1x ? 15 22 12.8 ns 10 t cl clk low level width 1x ? 15 22 12.8 ns 11 t ac access time from clk (cl * = 2) 1x ? 25 12 2.8 ns 12 t oh output data hold time 0 0 0 ns 13 t ds data-in setup time 2x ? 35 39 20.6 ns 14 t dh data-in hold time 2.5x ? 20 72 49.4 ns 15 t as address setup time 1.5x ? 35 20 6.7 ns 16 t ah address hold time 0.5x ? 13 5 0.9 ns 17 t cks cke setup time 1x ? 15 22 12.8 ns 18 t cms command setup time 1x ? 15 22 12.8 ns 19 t cmh command hold time 1x ? 15 22 12.8 ns 20 t rsc mode register set cycle time 2x 74 55.6 ns * cl is cas latency. ac measuring conditions ? output level: high = 0.7 vcc, low = 0.3 vcc, cl = 50 pf ? input level: high = 0.9 vcc, low = 0.1 vcc note: symbol x in the above table means the period of clock f fph , it?s half period of the system clock f sys for cpu core. the period of f fph depends on the clock gear setting or the selection of high-/low-frequency oscillator.
tmp91c820a 2008-02-20 91c820a-309 ? sdram read timing (cpu access) f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 d0 to d15 a20 to a23 ( bs0, 1 ) ro w data-in t rp t rc t c t cl t r t c t r a t rrd t cm t cm t cm t cm t as t ah t as column t ah t ac t oh
tmp91c820a 2008-02-20 91c820a-310 ? sdram write timing (cpu access) ? sdram write timing (cpu access, write recivery enable) f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 d0 to d15 a20 to a23 ( bs0, 1 ) ro w data-out t rp t rc t c t cl t r t c t wr t ras t cm t cm t cm t rrd t as t ah t as column t ah t ds t dh t cm f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 d0 to d15 a20 to a23 ( bs0, 1 ) ro w data-out t wr2 column
tmp91c820a 2008-02-20 91c820a-311 ? sdram burst read timing (head of burst cycle) ? sdram burst read timing (end of burst cycle) f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 d0 to d15 a20 to a23 ( bs0, 1 ) ro w data-in t rc t r t c t cm t cm t cm t cm t as t ah column t ac 227 t oh t as t ah t as t cms t cm t ac data-in data-in t ac t oh f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 d0 to d15 a20 to a23 ( bs0, 1 ) data-in t c t cm t cms t cm 220 t oh t cms t cm t ac data-in data-in t ac t oh t rc t rs t cm column t as t oh
tmp91c820a 2008-02-20 91c820a-312 ? sdram initialize timing ? sdram refresh timing ? sdram self-refresh timing f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 t c t cms t rc t rc t cm f fph sdclk sdxdqm sdcs sdcas sdras sdwe a1 to a12 a20 to a23 t c t cl t cms 220 t ch t as t as t ah t rc t rs t cm t cms t cm t cms t cm f fph sdclk sdcke sdcs sdcas sdras sdwe t c t cm sdxdqm t rc t cks t cks
tmp91c820a 2008-02-20 91c820a-313 4.5 ad conversion characteristics avcc = vcc, avss = vss symbol parameter condition min typ. max unit vrefh analog reference voltage ( + ) vcc ? 0.2 v vcc vcc vrefl analog reference voltage ( ? ) vss vss vss + 0.2 v vain analog input voltage range v refl v refh v analog current for analog reference voltage = 1 0.94 1.20 ma iref (vrefl = 0v) = 0 0.02 5.0 a ? error (not including quantizing errors) vcc = 2.7 v to 3.6 v 1.0 4.0 lsb note 1: 1 lsb = (vrefh ? vrefl)/1024 [v]. note 2: the operation above is guaranteed for f fph 4 mhz. note 3: the value of icc includes the current which flows through the avcc pin.
tmp91c820a 2008-02-20 91c820a-314 4.6 serial channel timing (i/o internal mode) (1) sclk input mode vcc = 2.7 to 3.6 v case of f fph = 27 mhz vcc = 3.0 to 3.6 v case of f fph = 36 mhz variable 27 mhz 36 mhz symbol parameter min max min max min max unit t scy sclk period 16x 0.59 0.44 s t oss output data sclk rising/falling edge * t scy /2 ? 4x-110 38 0 ns t ohs sclk rising/falling edge * output data hold t scy /2 + 2x + 0 370 277 ns t hsr sclk rising/falling edge * input data hold 3x + 10 121 93 ns t srd sclk rising/falling edge * valid data input t scy ? 0 592 443 ns t rds sclk rising/falling edge * valid data input 0 0 0 ns (2) sclk output mode variable 27 mhz 36 mhz symbol parameter min max min max min max unit t scy sclk period 16x 8192x 0.59 303 0.44 227 s t oss output data sclk rising/falling edge * t scy /2 ? 40 256 181 ns t ohs sclk rising/falling edge * output data hold t scy /2 ? 40 256 181 ns t hsr sclk rising/falling edge * input data hold 0 0 0 ns t srd sclk rising/falling edge * valid data input t scy ? 1x ? 180 375 235 ns t rds sclk rising/falling edge * valid data input 1x + 180 217 207.7 ns sclk rising/falling edge * : the rising edge is used in sclk rising mode. the falling edge is used in sclk falling mode. note: above table?s data values at 27 mhz and 36 mhz are calculated from t scy = 16x base. t srd t hsr t scy output dat a txd scl k (falling down mode) scl k (rising up mode) 0 t oss t ohs 1 3 0 1 3 2 2 valid input dat a rxd valid valid valid t rds
tmp91c820a 2008-02-20 91c820a-315 4.7 timer input pulse (ta0in) variable 27 mhz (vcc = 2.7 to 3.6 v) 36 mhz (vcc = 3.0 to 3.6 v) symbol parameter min max min max min max unit t vck clock period 8x + 100 396 321 ns t vckl clock low level width 4x + 40 188 151 ns t vckh clock high level width 4x + 40 188 151 ns 4.8 interrupt, capture (1) nmi , int0 to int3 interrupts variable 27 mhz (vcc = 2.7 to 3.6 v) 36 mhz (vcc = 3.0 to 3.6 v) symbol parameter min max min max min max unit t intal nmi , int0 to int3 low level width 4x + 40 188 151 ns t intah nmi , int0 to int3 high level width 4x + 40 188 151 ns
tmp91c820a 2008-02-20 91c820a-316 4.9 lcd controller sr mode vcc = 2.7 to 3.6 v case of f fph = 27 mhz vcc = 3.0 to 3.6 v case of f fph = 36 mhz variable f fph = 27 mhz (case: tm = 0) f fph = 36 mhz (case: tm = 0) no. symbol parameter min max min max min max unit 1 t dsu data valid d1bscp fall x ? 20 + tm 17 7.7 ns 2 t dhd d1bscp fall data hold x ? 5 + tm 32 22 ns 3 t cwh d1sbcp clock high width x ? 10 + tm 27 17.7 ns 4 t cwl d1bscp clock low width x ? 10 + tm 27 17.7 ns 5 t cw d1bscp clock cycle 2x + 2tm 27 55.4 ns tm = (2 scpw ? 1) x scpw: setting of (lcdmode) x: 1/f fph example: if scpw = 3 (8 clock mode), f fph = 36 [mhz] tm = (2 3 ? 1) * 1/36 mhz = 194.4 [ns] table 4.9.1 tm at f fph = 36 [mhz] scp width tm base scp 00 0 ns 2 clocks 01 27.77 ns 4 clocks 10 83.31 ns 8 clocks 11 194.4 ns d0 to d7 out t dhd t dsu d0 to d7 d1bscp t cwl t cwh tcw
tmp91c820a 2008-02-20 91c820a-317 4.10 recommended crystal oscillation circuit tmp91c820a is evaluated by below oscillator vender. when selecting external parts, make use of this information. note: total loads value of oscillator is sum of external loads (c1 and c2) and floating loads of actual assemble board. there is a possibility of miss operating using c1 and c2 value in below table. when designing board, it should design minimum length pattern around oscillator. and we recommend that oscillator evaluation try on your actual using board. (1) connection example low-frequency oscillator c1 c2 rd xt1 xt2 high-frequency oscillator rf c1 c2 rd x1 x2
tmp91c820a 2008-02-20 91c820a-318 (2) tmp91c820a recommended ceramic oscillator: murata manufacturing co., ltd. circuit parameter recommended parameter of elements running condition mcu oscillation frequency [mhz] item of oscillator upper: old lower: new c1 [pf] c2 [pf] rf [ ? ] rd [ ? ] voltage of power [v] tc [c] 2.00 cstls2m00g56-b0 (47) (47) open 0 2.50 cstls2m50g56-b0 (47) (47) open 0 10.00 csts1000mg03 * cstls10m0g53-b0 (15) (15) open 0 csa12.5mtz093 * csala12m5t55093-b0 30 30 open 0 tmp91c820a 12.50 cst12.0mtw093 * cstla12m5t55093-b0 (30) (30) open 0 1.8 to 2.2 ? 40 to + 85 parameter of elements running condition mcu oscillation frequency [mhz] item of oscillator upper: old lower: new c1 [pf] c2 [pf] rf [ ? ] rd [ ? ] voltage of power [v] tc [c] 4.00 csts0400mg06 * cstls4m00g56-b0 (47) (47) open 0 6.750 csts0675mg06 * cstls6m75g56-b0 (47) (47) open 0 csa12.5mtz * csala12m5t55-b0 30 30 open 0 12.50 cst12.0mtw * cstla12m5t55-b0 (30) (30) open 0 csals20m0x53-b0 5 5 open 0 20.00 cstls20m0x51-b0 (5) (5) open 0 27.00 csals27m0x51-b0 open open 10k 0 tmp91c820a 32.00 csala32m0x51-b0 3 3 open 0 2.7 to 3.6 ? 40 to + 85 note: in cst *** type oscillator, capacitance c1, c2 is built in. ? the product numbers and specifications of the resonators by murata manufacturing co., ltd. are subject to change. for up-to-date information, please refer to the following url: http://www.murata.co.jp/search/index.html
tmp91c820a 2008-02-20 91c820a-319 5. table of sfrs the special function registers (sfrs) include the i/o ports and peripheral control registers allocated to the 4-kbyte address space from 000000h to 000fffh. (1) i/o ports (2) i/o port control (3) interrupt control (4) chip select/wait control (5) clock gear (6) dfm (clock doubler) (7) 8-bit timer (8) uart/serial channel (9) i 2 c bus/serial interface (10) ad converter (11) watchdog timer (12) rtc (real time clock) (13) melody/alarm generator (14) mmu (15) lcd controller (16) sdram controller (17) 16-bit timer name 1 symbol address 7 6 0 bit symbol read/write initial value after reset remarks table layout note: ?prohibit rmw? in the table means that you cannot use rmw instructions on these register. example: when setting bit0 only of the regi ster pxcr, the instruction ?set 0, (pxcr)? cannot be used. the ld (transfer) instruction must be used to write all eight bits. read/write r/w: both read and write are possible. r: only read is possible. w: only write is possible. w * : both read and write are possible (when this bit is read as 1). prohibit rmw: read-modify-write instructions are prohibited. (the ex, add, adc, bus, sbc, inc, dec, and, or, xor, stcf, res, set, chg, tset, rlc, rrc, rl, rr, sla, sra, sll, srl, rld and rrd instruction are read-modify-write instructions.) r/w * : read-modify-write is prohibited when controlling the pull-up resistor.
tmp91c820a 2008-02-20 91c820a-320 table 5.1 sfr address map (1/4) [1], [2] port address name address name address name 0000h p0 0010h p5cr 0020h 1h p1 1h 1h pafc 2h p0cr 2h p6 2h pb 3h 3h p7 3h pc 4h p1cr 4h 4h pbcr 5h p1fc 5h p6fc 5h pbfc 6h p2 6h p7cr 6h pccr 7h p3 7h p7fc 7h pcfc 8h p2cr 8h p8 8h pcode 9h p2fc 9h p9 9h pd ah p3cr ah ah pdfc bh p3fc bh p6fc2 bh pbode ch p4 ch p7fc2 ch pe dh p5 dh p9fc dh pecr eh p4cr eh pa eh pefc fh p4fc fh p7ode fh address name address name 0030h pf 0070h 1h 1h 2h pffc 2h 3h 3h 4h 4h 5h 5h 6h 6h 7h 7h 8h 8h 9h 9h ah ah bh bh ch ch dh dh pz eh eh pzcr fh fh pzfc [3] intc address name address name address name 0080h dma0v 0090h inte0ad 00a0h intes3 1h dma1v 1h inte12 1h intetb0 2h dma2v 2h inte3alm4 2h 3h dma3v 3h intealm01 3h 4h 4h intealm23 4h 5h 5h inteta01 5h 6h 6h inteta23 6h 7h 7h intertckey 7h 8h intclr 8h intes0 8h 9h dmar 9h intes1 9h ah dmab ah intes2lcd ah bh bh intetc01 bh ch iimc ch intetc23 ch dh dh intep01 dh eh eh reserved eh fh fh reserved fh note: do not access to the unnamed addresses (e.g., addresses to which no register has been allocated).
tmp91c820a 2008-02-20 91c820a-321 table 5.2 sfr address map (2/4) [4] cs/wait [5], [6] cgear, dfm address name address name 00c0h b0cs 00e0h syscr0 1h b1cs 1h syscr1 2h b2cs 2h syscr2 3h b3cs 3h emccr0 4h 4h emccr1 5h 5h emccr2 6h 6h emccr3 7h bexcs 7h 8h msar0 8h dfmcr0 9h mamr0 9h dfmcr1 ah msar1 ah bh mamr1 bh ch msar2 ch dh mamr2 dh eh msar3 eh fh mamr3 fh [7] tmra address name 0100h ta01run 1h 2h ta0reg 3h ta1reg 4h ta01mod 5h ta01ffcr 6h 7h 8h ta23run 9h ah ta2reg bh ta3reg ch ta23mod dh ta3ffcr eh fh [8] uart/sio [9] i 2 c bus/sio address name address name address name 0200h sc0buf 0210h sc2buf 0240h sbi0cr1 1h sc0cr 1h sc2cr 1h sbi0dbr 2h sc0mod0 2h sc2mod0 2h i2c0ar 3h br0cr 3h br2cr 3h sbi0cr2/sbi0sr 4h br0add 4h br2add 4h sbi0br0 5h sc0mod1 5h sc2mod1 5h sbi0br1 6h 6h 6h 7h sircr 7h 7h 8h sc1buf 8h 8h 9h sc1cr 9h 9h ah sc1mod0 ah ah bh br1cr bh bh ch br1add ch ch dh sc1mod1 dh dh eh eh eh fh fh fh note: do not access to the unnamed addresses (e.g., addresses to which no register has been allocated).
tmp91c820a 2008-02-20 91c820a-322 table 5.3 sfr address map (3/4) [10] 10-bit adc address name address name 02a0h adreg04l 02b0h admod0 1h adreg04h 1h admod1 2h adreg15l 2h 3h adreg15h 3h 4h adreg26l 4h 5h adreg26h 5h 6h adreg37l 6h 7h adreg37h 7h 8h 8h 9h 9h ah ah bh bh ch ch dh dh eh eh fh fh [11] wdt [12] rtc address name address name 0300h wdmod 0320h secr 1h wdcr 1h minr 2h 2h hourr 3h 3h dayr 4h 4h dater 5h 5h monthr 6h 6h yearr 7h 7h pager 8h 8h restr 9h 9h ah ah bh bh ch ch dh dh eh eh fh fh [13] mld [14] mmu address name address name 0330h alm 0350h local0 1h melalmc 1h local1 2h melfl 2h local2 3h melfh 3h local3 4h almint 4h 5h 5h 6h 6h 7h 7h 8h 8h 9h 9h ah ah bh bh ch ch dh dh eh eh fh fh note: do not access to the unnamed addresses (e.g., addresses to which no register has been allocated).
tmp91c820a 2008-02-20 91c820a-323 table 5.4 sfr address map (4/4) [15] lcdc address name address name 04b0h lcdmode 04c0h lsaram 1h lcddvm 1h lsarah 2h lcdsize 2h learam 3h lcdctl 3h learah 4h lcdffp 4h lsarbm 5h lcdgl 5h lsarbh 6h lcdcm 6h learbm 7h lcdcw 7h learbh 8h lcdch 8h lsarcl 9h lcdcp 9h lsarcm ah lcdcpl ah lsarch bh lcdcpm bh ch lcdcph ch dh dh eh eh fh fh address name address name 04d0h lg0l 04e0h lg8l 1h lg0h 1h lg8h 2h lg1l 2h lg9l 3h lg1h 3h lg9h 4h lg2l 4h lgal 5h lg2h 5h lgah 6h lg3l 6h lgbl 7h lg3h 7h lgbh 8h lg4l 8h lgcl 9h lg4h 9h lgch ah lg5l ah lgdl bh lg5h bh lgdh ch lg6l ch lgel dh lg6h dh lgeh eh lg7l eh lgfl fh lg7h fh lgfh [16] sdramc [17] tmrb address name address name 04f0h sdacr 0180h tb0run 1h sdrcr 1h 2h 2h tb0mod 3h 3h tb0ffcr 4h 4h 5h 5h 6h 6h 7h 7h 8h 8h tb0rg0l 9h 9h tb0rg0h ah ah tb0rg1l bh bh tb0rg1h ch ch tb0cp0l dh dh tb0cp0h eh eh tb0cp1l fh fh tb0cp1h note: do not access to the unnamed addresses (e.g., address to which no register has been allocated).
tmp91c820a 2008-02-20 91c820a-324 (1) i/o ports (1/2) symbol name address 7 6 5 4 3 2 1 0 p07 p06 p05 p04 p03 p02 p01 p00 r/w p0 port0 00h data from external port (output latch register is cleared to 0.) p17 p16 p15 p14 p13 p12 p11 p10 r/w p1 port1 01h data from external port (output latch register is cleared to 0.) p27 p26 p25 p24 p23 p22 p21 p20 r/w p2 port2 06h data from external port (output latch register is cleared to 0.) p37 p36 p35 p34 p33 p32 p31 p30 r/w p3 port3 07h data from external port (output latch register is cleared to 0.) p47 p46 p45 p44 p43 p42 p41 p40 r/w p4 port4 0ch data from external port (output latch register is cleared to 0.) pz3 pz2 pz1 pz0 r/w data from external port (output latch register is set to 1.) 1 1 pz portz 7dh (prohibit rmw * ) 0 (output latch register): pull-up resistor off 1(output latch register): pull-up resistor on ? p56 r/w data from external port (output latch register is set to 1.) p5 port5 0dh (prohibit rmw * ) 0(output latch register): pull-up resistor off 1(output latch register): pull-up resistor on p67 p66 p65 p64 p63 p62 p61 p60 r/w p6 port6 12h 1 1 1 1 1 0 1 1 p77 p76 p75 p74 p73 p72 p71 p70 r/w p7 port7 13h data from external port (output latch register is set to 1.) p87 p86 p85 p84 p83 p82 p81 p80 r p8 port8 18h data from external port p97 p96 p95 p94 p93 p92 p91 p90 r p9 port9 19h data from external port pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 r/w pa porta 1eh 1 1 1 1 1 1 1 1
tmp91c820a 2008-02-20 91c820a-325 i/o ports (2/2) symbol name address 7 6 5 4 3 2 1 0 pb6 pb5 pb4 pb3 pb1 pb0 r/w r/w pb portb 22h data from external port (output latch register is set to 1.) data from external port (output latch register is set to 1.) pc5 pc4 pc3 pc2 pc1 pc0 r/w pc portc 23h data from external port (output latch register is set to 1.) pd7 pd6 pd4 pd3 pd2 pd1 pd0 r/w r/w pd portd 29h 1 1 1 1 1 1 1 pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 r/w pe porte 2ch data from external port (output latch register is set to 1.) pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 r/w pf portf 30h 1 1 1 1 1 1 1 1
tmp91c820a 2008-02-20 91c820a-326 (2) i/o port control (1/4) symbol name address 7 6 5 4 3 2 1 0 p07c p06c p05c p04c p03c p02c p01c p00c w 0 0 0 0 0 0 0 0 p0cr port0 control 02h (prohibit rmw) 0: input 1: output p17c p16c p15c p14c p13c p12c p11c p10c w 0 0 0 0 0 0 0 0 p1cr port1 control 04h (prohibit rmw) 0: input 1: output p17f p16f p15f p14f p13f p12f p11f p10f w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p1fc port1 function 05h (prohibit rmw) 0: port, 1: data bus (d15 to d8) p27c p26c p25c p24c p23c p22c p21c p20c w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p2cr port2 control 08h (prohibit rmw) 0: input 1: output p27f p26f p25f p24f p23f p22f p21f p20f w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p2fc port2 function 09h (prohibit rmw) 0: port, 1: address bus (a23 to a16) p37c p36c p35c p34c p33c p32c p31c p30c w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p3cr port3 control 0ah (prohibit rmw) 0: input 1: output p37f p36f p35f p34f p33f p32f p31f p30f w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p3fc port3 function 0bh (prohibit rmw) 0: port, 1: address bus (a15 to a8) p47c p46c p45c p44c p43c p42c p41c p40c w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p4cr port4 control 0eh (prohibit rmw) 0: input 1: output p47f p46f p45f p44f p43f p42f p41f p40f w 0/1 0/1 0/1 0/1 0/1 0/1 0/1 0/1 p4fc port4 function 0fh (prohibit rmw) 0: port, 1: address bus (a7 to a0)
tmp91c820a 2008-02-20 91c820a-327 i/o port control (2/4) symbol name address 7 6 5 4 3 2 1 0 pz3c pz2c w 0 0 pzcr portz control 7eh (prohibit rmw) 0: input 1: output p56c w 0 p5cr port5 control 10h (prohibit rmw) 0: input 1: output pz3f pz2f pz1f pz0f w 0 0 0 0 pzfc portz function 7fh (prohibit rmw) 0: port 1: r/w, srwe 0: port 1: hwr 0: port 1: wr 0: port 1: rd p67f p66f p65f p64f p63f p62f p61f p60f w 0 0 0 0 0 0 0 0 p6fc port6 function 15h (prohibit rmw) 0: port 1: srub 0: port 1: srlb 0: port 1: ea25 0: port 1: ea24 0: port 1: cs3 0: port 1: cs2 0: port 1: cs1 0: port 1: cs0 p67f2 p66f2 p65f2 p64f2 ? p62f2 p61f2 ? w 0 0 0 0 0 0 0 0 p6fc2 port6 function 2 1bh (prohibit rmw) 0: 1: cs2e 0: 1: cs2d 0: 1: cs2c 0: 1: cs2b always write ?0?. 0: 1: cs2a 0: 1: sdcs always write ?0?. p77c p76c p75c p74c p73c p72c p71c p70c w 0 0 0 0 0 0 0 0 p7cr port7 control 16h (prohibit rmw) 0: input 1: output p77f p76f p75f p74f p73f p72f p71f p70f w 0 0 0 0 0 0 0 0 p7fc port7 function 17h (prohibit rmw) 0: port 1: veeclk msk logic select 0: clk by 1 1: clk by 0 0: port 0: port 0: port 0: port 1: scl 0: port 1: sda/so 0: port 1: sck ? ? p75f2 p74f2 p73f2 ? p71f2 p70f2 w 0 0 0 0 0 0 0 0 p7fc2 port7 function 2 1ch (prohibit rmw) always write ?0?. always write ?0?. 0: 1: csexa 0: 1: cs2g 0: 1: cs2f always write ?0?. 0: 1: opttx0 sio0/rxd0 pin select 0: rxd0 (pc1) 1: optrx0 (p70)
tmp91c820a 2008-02-20 91c820a-328 i/o port control (3/4) symbol name address 7 6 5 4 3 2 1 0 ? ? odep72 odep71 w w 0 0 0 0 p7ode port7 open drain 1fh (prohibit rmw) always write ?0?. 0: 3 states 1: open drain p97f p96f p95f p94f p93f p92f p91f p90f w 0 0 0 0 0 0 0 0 p9fc port9 function 1dh (prohibit rmw) 0: key-in disable 1:key-in enable pa7f pa6f pa5f pa4f pa3f pa2f pa1f pa0f w 0 0 0 0 0 0 0 0 pafc porta function 21h (prohibit rmw) 0: cmos output 1: open-drain output pb6c pb5c pb4c pb3c pb1c pb0c w w 0 0 0 0 0 0 pbcr portb control 24h (prohibit rmw) 0: input 1: output 0: input 1: output pb6f pb5f pb4f pb3f pb1f pb0f w w 0 0 0 0 0 0 pbfc portb function 25h (prohibit rmw) 0: port 1: int3, tb0out0 0: port 1: int2 ta3out 0: port 1: int1 0: port 1: int0 0: port 1: ta1out 0: port 1: txd2 odepb0 w 0 pbode portb open drain 2bh (prohibit rmw) 0: cmos 1: open drain pc5c pc4c pc3c pc2c pc1c pc0c w 0 0 0 0 0 0 pccr portc control 26h (prohibit rmw) 0: input 1: output pc5f pc3f pc2f pc0f w w w 0 0 0 0 pcfc portc function 27h (prohibit rmw) 0: port 1: sclk1 0: port 1: txd1 0: port 1: sclk0 0: port 1: txd0 odepc3 odepc0 w w 0 0 pcode portc open drain 28h (prohibit rmw) 0: cmos 1: open drain 0: cmos 1: open drain
tmp91c820a 2008-02-20 91c820a-329 i/o port control (4/4) symbol name address 7 6 5 4 3 2 1 0 pd7f pd6f pd4f pd3f pd2f pd1f pd0f w w 0 0 0 0 0 0 0 pdfc portd function 2ah (prohibit rmw) 0: port 1: mldalm 0: port 1: alarm mldalm 0: port 1: doffb 0: port 1: dlebcd 0: port 1:d3bfr 0: port 1: d2blp 0: port 1: d1bscp pe7c pe6c pe5c pe4c pe3c pe2c pe1c pe0c w 0 0 0 0 0 0 0 0 pecr porte control 2dh (prohibit rmw) 0: input 1: output pe7f pe6f pe5f pe4f pe3f pe2f pe1f pe0f w 0 0 0 0 0 0 0 0 pefc porte function 2eh (prohibit rmw) 0: port 1: ld7 to ld0 for lcd driver ? pf6f pf5f pf4f pf3f pf2f pf1f pf0f w 0 1 0 0 0 0 0 0 pffc portf function 32h (prohibit rmw) always write?0?. 0: port 1: sdclk 0: port 1: sdcke 0: port 1: sdudqm 0: port 1: sdldqm 0: port 1: sdwe 0: port 1: sdcas 0: port 1: sdras
tmp91c820a 2008-02-20 91c820a-330 (3) interrupt control (1/3) symbol name address 7 6 5 4 3 2 1 0 intad int0 iadc iadm2 iadm1 iadm0 i0c i0m2 i0m1 i0m0 r r/w r r/w 0 0 0 0 0 0 0 0 inte0ad interrupt enable 0 and ad 90h 1: intad interrupt level 1: int0 interrupt level int2 int1 i2c i2m2 i2m1 i2m0 i1c i1m2 i1m1 i1m0 r r/w r r/w 0 0 0 0 0 0 0 0 inte12 interrupt enable 2/1 91h 1: int2 interrupt level 1: int1 interrupt level intalm4 int3 ia4c ia4m2 ia4m1 ia4m0 i3c i3m2 i3m1 i3m0 r r/w r r/w 0 0 0 0 0 0 0 0 inte3alm4 interrupt enable 3 and alm4 92h 1: intalm4 interrupt level 1: int3 interrupt level intalm1 intalm0 ia1c ia1m2 ia1m1 ia1m0 ia0c ia0m2 ia0m1 ia0m0 r r/w r r/w 0 0 0 0 0 0 0 0 intealm01 interrupt enable alm0/1 93h 1: intalm1 interrupt level 1: intalm0 interrupt level intalm3 intalm2 ia3c ia3m2 ia3m1 ia3m0 ia2c ia2m2 ia2m1 ia2m0 r r/w r r/w 0 0 0 0 0 0 0 0 intealm23 interrupt enable alm2/3 94h 1: intalm3 interrupt level 1: intalm2 interrupt level intta1(tmra1) intta0 (tmra0) ita1c ita1m2 ita1m1 ita1m0 ita0c ita0m2 ita0m1 ita0m0 r r/w r r/w 0 0 0 0 0 0 0 0 inteta01 interrupt enable timer a 1/0 95h 1: intta1 interrupt level 1: intta0 interrupt level intta3 (tmra5) intta2 (tmra4) ita3c ita3m2 ita3m1 ita3m0 ita2c ita2m2 ita2m1 ita2m0 r r/w r r/w 0 0 0 0 0 0 0 0 inteta23 interrupt enable timer a 3/2 96h 1: intta3 interrupt level 1: intta2 interrupt level intkey intrtc ikc ikm2 ikm1 ikm0 irc irm2 irm1 irm0 r r/w r r/w 0 0 0 0 0 0 0 0 inte rtckey interrupt enable rtc and key 97h 1: intkey interrupt level 1: intrtc interrupt level
tmp91c820a 2008-02-20 91c820a-331 interrupt control (2/3) symbol name address 7 6 5 4 3 2 1 0 inttx0 intrx0 itx0c itx0m2 itx0m1 itx0m0 irx0c irx0m2 irx0m1 irx0m0 r r/w r r/w 0 0 0 0 0 0 0 0 intes0 interrupt enable serial 0 98h 1: inttx0 interrupt level 1: intrx0 interrupt level inttx1 intrx1 itx1c itx1m2 itx1m1 itx1m0 irx1c irx1m2 irx1m1 irx1m0 r r/w r r/w 0 0 0 0 0 0 0 0 intes1 interrupt enable serial 1 99h 1: inttx1 interrupt level 1: intrx1 interrupt level intlcd intsbi ilcd2c ilcdm2 ilcdm1 ilcdm0 isbic isbim2 isbim1 isbim0 r r/w r r/w 0 0 0 0 0 0 0 0 intes2lcd interrupt enable sbi/lcd 9ah 1: intlcd interrupt level 1: intsbi interrupt level inttc1 inttc0 itc1c itc1m2 itc1m1 itc1m0 itc0c itc0m2 itc0m1 itc0m0 r r/w r r/w intetc01 interrupt enable tc0/1 9bh 0 0 0 0 0 0 0 0 inttc3 inttc2 itc3c itc3m2 itc3m1 itc3m0 itc2c itc2m2 itc2m1 itc2m0 r r/w r r/w intetc23 interrupt enable tc2/3 9ch 0 0 0 0 0 0 0 0 intp1 intp0 ip1c ip1m2 ip1m1 ip1m0 ip0c ip0m2 ip0m1 ip0m0 r r/w r r/w intep01 interrupt enable pc0/1 9dh 0 0 0 0 0 0 0 0 inttx2 intrx2 itx2c itx2m2 itx2m1 itx2m0 irx2c irx2m2 irx2m1 irx2m0 r r/w r r/w 0 0 0 0 0 0 0 0 intes3 interrupt enable serial 3 a0h 1: inttx2 interrupt level 1: intrx2 interrupt level inttb01 inttb00 itb01c itb01m2 itb01m1 itb01m0 itb00c itb00m2 itb00m1 itb00m0 r r/w r r/w 0 0 0 0 0 0 0 0 intetb0 interrupt enable tmrb0 a1h 1: inttb01 interrupt level 1: inttb00 interrupt level
tmp91c820a 2008-02-20 91c820a-332 interrupt control (3/3) symbol name address 7 6 5 4 3 2 1 0 dma0v5 dma0v4 dma0v3 dma0v2 dma0v1 dma0v0 r/w 0 0 0 0 0 0 dma0v dma 0 request vector 80h dma0 start vector dma1v5 dma1v4 dma1v3 dma1v2 dma1v1 dma1v0 r/w 0 0 0 0 0 0 dma1v dma 1 request vector 81h dma1 start vector dma2v5 dma2v4 dma2v3 dma2v2 dma2v1 dma2v0 r/w 0 0 0 0 0 0 dma2v dma 2 request vector 82h dma2 start vector dma3v5 dma3v4 dma3v3 dma3v2 dma3v1 dma3v0 r/w 0 0 0 0 0 0 dma3v dma 3 request vector 83h dma3 start vector clrv5 clrv4 clrv3 clrv2 clrv1 clrv0 w 0 0 0 0 0 0 intclr interrupt clear control 88h (prohibit rmw) clears interrupt request flag by writing to dma start vector dmar3 dmar2 dmar1 dmar0 r/w r/w r/w r/w 0 0 0 0 dmar dma software request register 89h (prohibit rmw) 1: dma request in software dmab3 dmab2 dmab1 dmab0 r/w r/w r/w r/w 0 0 0 0 dmab dma burst request register 8ah 1: dma request on burst mode ? ? i3edge i2edge i1edge i0edge i0le nmiree w w w w w w w w 0 0 0 0 0 0 0 0 iimc interrupt input mode control 8ch (prohibit rmw) always write ?0?. always write ?0?. int3 edge 0: rising 1: falling int2 edge 0: rising 1: falling int1 edge 0: rising 1: falling int0 edge 0: rising 1: falling int0 0: edge 1: level 1: o pera- tion even on nmi rising edge
tmp91c820a 2008-02-20 91c820a-333 (4) chip select/wait control (1/2) symbol name address 7 6 5 4 3 2 1 0 b0e b0om1 b0om0 b0bus b0w2 b0w1 b0w0 w w w w w w w 0 0 0 0 0 0 0 b0cs block 0 cs/wait control register c0h (prohibit rmw) 0: disable 1: enable 00: rom/sram 01: 10: reserved 11: data bus width 0: 16 bits 1: 8 bits 000: 2 waits 00: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits b1e b1om1 b1om0 b1bus b1w2 b1w1 b1w0 w w w w w w w 0 0 0 0 0 0 0 b1cs block 1 cs/wait control register c1h (prohibit rmw) 0: disable 1: enable 00: rom/sram 01: 10: reserved 11: data bus width 0: 16 bits 1: 8 bits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits b2e b2m b2om1 b2om0 b2bus b2w2 b2w1 b2w0 w w w w w w w w 1 0 0 0 0 0 0 0 b2cs block 2 cs/wait control register c2h (prohibit rmw) 0: disable 1: enable 0: 16 m area 1: area set 00: rom/sram 01: 10: reserved 11: data bus width 0: 16 bits 1: 8 bits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits b3e b3om1 b3om0 b3bus b3w2 b3w1 b3w0 w w w w w w w 0 0 0 0 0 0 0 b3cs block 3 cs/wait control register c3h (prohibit rmw) 0: disable 1: enable 00: rom/sram 01: 10: reserved 11: data bus width 0: 16 bits 1: 8 bits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits bexbus bexw2 bexw1 bexw0 w w w w 0 0 0 0 bexcs external cs/wait control register c7h (prohibit rmw) data bus width 0: 16 bits 1: 8 bits 000: 2 waits 100: reserved 001: 1 wait 101: 3 waits 010: (1 + n) waits 110: 4 waits 011: 0 waits 111: 8 waits s23 s22 s21 s20 s19 s18 s17 s16 r/w 1 1 1 1 1 1 1 1 msar0 memory start address register 0 c8h start address a23 to a16 v20 v19 v18 v17 v16 v15 v14 to v9 v8 r/w 1 1 1 1 1 1 1 1 mamr0 memory address mask register 0 c9h cs0 area size 0: enable to address comparison s23 s22 s21 s20 s19 s18 s17 s16 r/w 1 1 1 1 1 1 1 1 msar1 memory start address register 1 cah start address a23 to a16 v21 v20 v19 v18 v17 v16 v15 to v9 v8 r/w 1 1 1 1 1 1 1 mamr1 memory address mask register 1 cbh cs1 area size 0: enable to address comparison
tmp91c820a 2008-02-20 91c820a-334 chip select/wait control (2/2) symbol name address 7 6 5 4 3 2 1 0 s23 s22 s21 s20 s19 s18 s17 s16 r/w 1 1 1 1 1 1 1 1 msar2 memory start address register 2 cch start address a23 to a16 v22 v21 v20 v19 v18 v17 v16 v15 r/w 1 1 1 1 1 1 1 1 mamr2 memory address mask register 2 cdh cs2 area size 0: enable to address comparison s23 s22 s21 s20 s19 s18 s17 s16 r/w 1 1 1 1 1 1 1 1 msar3 memory start address register 3 ceh start address a23 to a16 v22 v21 v20 v19 v18 v17 v16 v15 r/w 1 1 1 1 1 1 1 1 mamr3 memory address mask register 3 cfh cs3 area size 0: enable to address comparison
tmp91c820a 2008-02-20 91c820a-335 (5) clock gear (1/2) symbol name address 7 6 5 4 3 2 1 0 xen xten rxen rxten rsysck wuef prck1 prck0 r/w 1 1 1 0 0 0 0 0 syscr0 system clock control register 0 e0h high- frequency oscillator (fc) 0: stopped 1: oscillation low- frequency oscillator (fs) 0: stopped 1: oscillation high- frequency oscillator (fc) after release of stop mode 0: stopped 1: oscillation low- frequency oscillator (fs) after release of stop mode 0: stopped 1: oscillation select clock after release of stop mode 0: fc 1: fs warm-up timer 0 write: don?t care 1 write: start timer 0 read: end warm up 1 read: not end warm up select prescaler clock 00: f fph 01: reserved 10: fc/16 11: reserved sysck gear2 gear1 gear0 r/w 0 1 0 0 syscr1 system clock control register 1 e1h system clock selection 0: fc 1: fs high-frequency gear value selection (fc) 000: fc 001: fc/2 010: fc/4 011: fc/8 100: fc/16 101: (reserved) 110: (reserved) 111: (reserved) psenv wuptm1 wuptm0 haltm1 haltm0 seldrv drve r/w r/w 0 1 0 1 1 0 0 syscr2 system clock control register 2 e2h 1: disable 0: power save mode enable warm-up time 00: reserved 01: 2 8 input frequency 10: 2 14 11: 2 16 00: reserved 01: stop mode 10: idle1 mode 11: idle2 mode mode select 1: stop 0: idle 1: drive the pin in stop/ idle1 mode
tmp91c820a 2008-02-20 91c820a-336 clock gear (2/2) symbol name address 7 6 5 4 3 2 1 0 protect ta3lce ahold ta3mle ? extin drvosch drvoscl r r/w r/w r/w r/w r/w r/w r/w 0 0 0 0 0 0 1 1 emccr0 emc control register 0 e3h protection flag 0: off 1: on lcdc source clock 0: 32 khz 1: ta3out address hold 0: disable 1: enable melody/ alarm source clock 0: 32 khz 1: ta3out always write ?0?. 1: fc is external clock fc oscillator driver ability 1: normal 0: weak fs oscillator driver ability 1: normal 0: weak emccr1 emc control register 1 e4h emccr2 emc control register 2 e5h switching the protect on/off by writing following 1st-key, 2nd-key. continuation writes in 1st-key: emccr1 = 5ah, emccr2 = a5h. continuation writes in 2nd-key: emccr1 = a5h, emccr2 = 5ah. enfrom endrom enprom fflag dflag pflag r/w r/w r/w r/w r/w r/w 0 0 0 0 0 0 cs1a write operation flag cs2b-2g write operation flag cs2a write operation flag emccr3 emc control register 3 e6h cs1a area detect enable 0: disable 1: enable cs2b-2g area detect enable 0: disable 1: enable cs2a area detect enable 0: disable 1: enable when reading 0: not written 1: written when writing 0: clear flag (6) dfm (clock doubler) symbol name address 7 6 5 4 3 2 1 0 act1 act0 dlupfg dluptm r/w r/w r r/w 0 0 0 0 dfm lup f fph 00 stop stop f osch 01 run run f osch 10 run stop f dfm dfmcr0 dfm control register 0 e8h 11 run stop f osch lock-up flag 0: end lup 1: do not end lup lockup time 0: 2 12/ f osch 1: 2 10/ f osch d7 d6 d5 d4 d3 d2 d1 d0 r/w r/w r/w r/w r/w r/w r/w r/w 0 0 0 1 0 0 1 1 dfmcr1 dfm control register 1 e9h write 0bh before starting lockup operation.
tmp91c820a 2008-02-20 91c820a-337 (7) 8-bit timer (7-1) tmra01 symbol name address 7 6 5 4 3 2 1 0 ta0rde i2ta01 ta01prun ta1run ta0run r/w r/w r/w r/w r/w 0 0 0 0 0 ta01run 8-bit timer run 100h double buffer 0: disable 1: enable idle2 0: stop 1: operate 8-bit timer run/stop control 0: stop and clear 1: run (count up) ? w ta0reg 8-bit timer register 0 102h (prohibit rmw) undefined ? w ta1reg 8-bit timer register 1 103h (prohibit rmw) undefined ta01m1 ta01m0 pwm01 pwm00 ta1clk1 ta1clk0 ta0clk1 ta0clk0 r/w 0 0 0 0 0 0 0 0 ta01mod 8-bit timer source clk and mode register 104h 00: 8-bit timer 01: 16-bit timer 10: 8-bit ppg 11: 8-bit pwm 00: reserved 01: 2 6 pwm cycle 10: 2 7 11: 2 8 00: ta0trg 01: t1 10: t16 11: t256 00: ta0in pin 01: t1 10: t4 11: t16 ta1ffc1 ta1ffc0 ta1ffie ta1ffis r/w r/w 1 1 0 0 ta1ffcr 8-bit timer flip-flop control register 105h (prohibit rmw) 00: invert ta1ff 01: set ta1ff 10: clear ta1ff 11: don?t care 1: ta1ff invert enable 0: tmra0 1: tmra1 inversion
tmp91c820a 2008-02-20 91c820a-338 (7-2) tmra23 symbol name address 7 6 5 4 3 2 1 0 ta2rde i2ta23 ta23prun ta3run ta2run r/w r/w r/w r/w r/w 0 0 0 0 0 ta23run 8-bit timer run 108h double buffer 0: disable 1: enable idle2 0: stop 1: operate 8-bit timer run/stop control 0: stop and clear 1: run (count up) ? w ta2reg 8-bit timer register 0 10ah (prohibit rmw) undefined ? w ta3reg 8-bit timer register 1 10bh (prohibit rmw) undefined ta23m1 ta23m0 pwm21 pwm20 ta3clk1 ta3clk0 ta2clk1 ta2clk0 r/w 0 0 0 0 0 0 0 0 ta23mod 8-bit timer source clk and mode 10ch 00: 8-bit timer 01: 16-bit timer 10: 8-bit ppg 11: 8-bit pwm 00: reserved 01: 2 6 pwm cycle 10: 2 7 11: 2 8 00: ta2trg 01: t1 10: t16 11: t256 00: reserved 01: t1 10: t4 11: t16 ta3ffc1 ta3ffc0 ta3ffie ta3ffis r/w r/w 1 1 0 0 ta3ffcr 8-bit timer flip-flop control 10dh (prohibit rmw) 00: invert ta3ff 01: set ta3ff 10: clear ta3ff 11: don?t care 1: ta3ff invert enable 0: tmra2 1: tmra3 inversion
tmp91c820a 2008-02-20 91c820a-339 (8) uart/serial channel (1/3) (8-1) uart/sio channel 0 symbol name address 7 6 5 4 3 2 1 0 rb7/tb7 rb6/tb6 rb5/tb5 rb4/tb4 rb3/tb3 rb2/tb2 rb1/tb1 rb0/tb0 r (receiving)/w (transmission) sc0buf serial channel 0 buffer 200h (prohibit rmw) undefined rb8 even pe oerr perr ferr sclks ioc r r/w r (cleared to 0 by reading) r/w undefined 0 0 0 0 0 0 0 1: error sc0cr serial channel 0 control 201h receiving data bit8 parity 0: odd 1: even 1: parity enable overrun parity framing 0:sclk0 1:sclk0 1: input sclk0 pin tb8 ctse rxe wu sm1 sm0 sc1 sc0 r/w 0 0 0 0 0 0 0 0 sc0mod0 serial channel 0 mode0 202h transmission data bit8 1: cts enable 1: receive enable 1: wakeup enable 00: i/o interface 01: uart 7 bits 10: uart 8 bits 11: uart 9 bits 00: ta0trg 01: baud rate generator 10: internal clock f sys 11: external clock sclk0 ? br0adde br0ck1 br0ck0 br0s3 br0s2 br0s1 br0s0 r/w 0 0 0 0 0 0 0 br0cr baud rate control 203h always write ?0?. 1: (16 ? k)/16 divided enable 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? (0 to f) br0k3 br0k2 br0k1 br0k0 r/w 0 0 0 0 br0add serial channel 0 k setting register 204h sets frequency divisor ?k? (divided by n = (16 ? k)/16) i2s0 fdpx0 r/w r/w 0 0 sc0mod1 serial channel 0 mode1 205h idle2 0: stop 1: operate duplex 0: half 1: full (8-2) irda symbol name address 7 6 5 4 3 2 1 0 plsel rxsel txen rxen sirwd3 sirwd2 sirwd1 sirwd0 r/w r/w r/w r/w r/w 0 0 0 0 0 0 0 0 sircr irda control register 207h transmission pulse width 0: 3/16 1: 1/16 receiving data 0: h pulse 1: l pulse transmission 0: disable 1: enable receiving 0: disable 1: enable set the effective sirrxd pulse width pulse width more than 2x (set value + 1) + 100 ns possible: 1 to 14 not possible: 0, 15
tmp91c820a 2008-02-20 91c820a-340 uart/serial channel (2/3) (8-3) uart/sio channel 1 symbol name address 7 6 5 4 3 2 1 0 rb7/tb7 rb6/tb6 rb5/tb5 rb4/tb4 rb3/tb3 rb2/tb2 rb1/tb1 rb0/tb0 r (receiving)/w (transmission) sc1buf serial channel 1 buffer 208h (prohibit rmw) undefined rb8 even pe oerr perr ferr sclks ioc r r/w r (cleared to 0 by reading) r/w undefined 0 0 0 0 0 0 0 1: error sc1cr serial channel 1 control 209h receiving data bit8 parity 0: odd 1: even 1: parity enable overrun parity framing 0: sclk1 1: sclk1 1: input sclk1 pin tb8 ctse rxe wu sm1 sm0 sc1 sc0 r/w 0 0 0 0 0 0 0 0 sc1mod0 serial channel 1 mode 20ah transmission data bit8 1: cts enable 1: receive enable 1: wakeup enable 00: i/o interface 01: uart 7 bits 10: uart 8 bits 11: uart 9 bits 00: ta0trg 01: baud rate generator 10: internal clock f sys 11: external clock sclk1 ? br1adde br1ck1 br1ck0 br1s3 br1s2 br1s1 br1s0 r/w 0 0 0 0 0 0 0 0 br1cr baud rate control 20bh always write ?0?. 1: (16 ? k)/16 divided enable 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? (0 to f) br1k3 br1k2 br1k1 br1k0 r/w 0 0 0 0 br1add serial channel 1 k setting register 20ch sets frequency divisor ?k? (divided by n = (16 ? k)/16) i2s1 fdpx1 r/w r/w 0 0 sc1mod1 serial channel 1 mode1 20dh idle2 0: stop 1: operate duplex 0: half 1: full
tmp91c820a 2008-02-20 91c820a-341 uart/serial channel (3/3) (8-4) uart/sio channel 2 symbol name address 7 6 5 4 3 2 1 0 rb7/tb7 rb6/tb6 rb5/tb5 rb4/tb4 rb3/tb3 rb2/tb2 rb1/tb1 rb0/tb0 r (receiving)/w (transmission) sc2buf serial channel 2 buffer 210h (prohibit rmw) undefined rb8 even pe oerr perr ferr ? ? r r/w r (cleared to 0 by reading) r/w undefined 0 0 0 0 0 0 0 1: error sc2cr serial channel 2 control 211h receiving data bit8 parity 0: odd 1: even 1: parity enable overrun parity framing always write ?0?. always write ?0?. tb8 ? rxe wu sm1 sm0 sc1 sc0 r/w 0 0 0 0 0 0 0 0 sc2mod0 serial channel 2 mode 212h transmission data bit8 always write ?0?. 1: receive enable 1: wakeup enable 00: reserved 01: uart 7 bits 10: uart 8 bits 11: uart 9 bits 00: ta0trg 01: baud rate generator 10: internal clock f sys 11: reserved ? br2adde br2ck1 br2ck0 br2s3 br2s2 br2s1 br2s0 r/w 0 0 0 0 0 0 0 0 br2cr baud rate control 213h always write ?0?. 1: (16 ? k)/16 divided enable 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? (0 to f) br1k3 br1k2 br1k1 br1k0 r/w 0 0 0 0 br2add serial channel 2 k setting register 214h sets frequency divisor ?k? (divided by n = (16 ? k)/16) i2s2 fdpx2 r/w r/w 0 0 sc2mod1 serial channel 2 mode1 215h idle2 0: stop 1: operate duplex 0: half 1: full
tmp91c820a 2008-02-20 91c820a-342 (9) i 2 c bus/serial interface (1/2) symbol name address 7 6 5 4 3 2 1 0 bc2 bc1 bc0 ack sck2 sck1 sck0 /swrmon w r/w w w r/w 0 0 0 0 0 0 0/1 240h (i 2 c bus mode) (prohibit rmw) number of transfer bits 000: 8 001: 1 010: 2 011: 3 100: 4 101: 5 110: 6 111: 7 acknowledge mode 0: disable 1: enable setting for the devisor value n 000: 5 001: 6 010: 7 011: 8 100: 9 101: 10 110: 11 111: (reserved) sios sioinh siom1 siom0 sck2 sck1 sck0 w w w w w w w 0 0 0 0 0 0 0 sbi0cr1 serial bus interface control register 1 240h (sio mode) (prohibit rmw) transfer 0: stop 1: start transfer 0: continue 1: abort transfer mode 00: 8-bit transmit mode 10: 8-bit transmit/ receive mode 11: 8-bit received mode setting for the divisor value n 000: 4 001: 5 010: 6 011: 7 100: 8 101: 9 110: 10 111: sck pin db7 db6 db5 db4 db3 db2 db1 db0 r (receiving)/w (transmission) sbi0dbr sbi buffer register 241h (prohibit rmw) undefined sa6 sa5 sa4 sa3 sa2 sa1 sa0 als w w w w w w w w 0 0 0 0 0 0 0 0 i2c0ar i2cbus address register 242h (prohibit rmw) setting slave address address recognition 0: enable 1: disable mst trx bb pin al/sbim1 aas/sbim0 ad0/ swrst lrb/ swrst0 r/w r/w r/w r/w r/w r/w r/w r/w 0 0 0 1 0 0 0 0 when read sbi0sr serial bus interface status register bus status monitor 0: free 1: busy arbitration lost detection monitor 1: detect slave address match detection monitor 1: detect general call detection monitor 1: detect lost receive bit monitor 0: 0 1: 1 when write sbi0cr2 serial bus interface control register 2 243h (i 2 c bus mode) (prohibit rmw) 0: slave 1: master 0: receiver 1: transmit start/stop condition generation 0: start condition 1: stop condition intsbi request monitor 0: request 1: cancel serial bus interface operating mode selection 00: port mode 01: sio mode 10: i 2 c bus mode 11: (reserved) software reset generate write ?10? and ?01?, then an internal reset signal is generated. siof/sbim1 sef/sbim2 ? ? r r w w 0 0 0 0 when read sbi0sr serial bus interface status register transfer status monitor 0: stopped 1: terminated in process shift operation status monitor 0: stopped 1: terminated in process when write sbi0cr2 serial bus interface control register 2 243h (sio mode) (prohibit rmw) serial bus interface operating mode selection 00: port mode 01: sio mode 10: i 2 c bus mode 11: (reserved) always write ?0?. always write ?0?.
tmp91c820a 2008-02-20 91c820a-343 i 2 c bus/serial interface (2/2) symbol name address 7 6 5 4 3 2 1 0 ? i2sbi0 w r/w 0 0 sbi0br0 serial bus interface baud rate register 0 244h (prohibit rmw) always write ?0?. idle2 0: abort 1: operate p4en ? w w 0 0 sbi0br1 serial bus interface baud rate register 1 245h (prohibit rmw) clock control 0: abort 1: operate always write ?0?.
tmp91c820a 2008-02-20 91c820a-344 (10) ad converter symbol name address 7 6 5 4 3 2 1 0 eocf adbf ? ? itm0 repeat scan ads r r/w r/w r/w r/w r/w r/w 0 0 0 0 0 0 0 0 admod0 ad mode register 0 2b0h 1: end 1: busy always write ?0?. always write ?0?. interrupt in repeat mode 1: repeat 1: scan 1: start vrefon i2ad adtrge adch2 adch1 adch0 r/w r/w r/w r/w 0 0 0 0 0 0 admod1 ad mode register 1 2b1h 1: vref on idle2 0: abort 1: operate 1: enable for external start input channel 000: an0 an0 001: an1 an0 an1 010: an2 an0 an1 an2 011: an3 an0 an1 an2 an3 100: an4 an4 101: an5 an4 an5 110: an6 an4 an5 an6 111: an7 an4 an5 an6 an7 adr01 adr00 adr0rf r r adreg04l ad result register 0/4 low 2a0h undefined 0 adr09 adr08 adr07 adr06 adr05 adr04 adr03 adr02 r adreg04h ad result register 0/4 high 2a1h undefined adr11 adr10 adr1rf r r adreg15l ad result register 1/5 low 2a2h undefined 0 adr19 adr18 adr17 adr16 adr15 adr14 adr13 adr12 r adreg15h ad result register 1/5 high 2a3h undefined adr21 adr20 adr2rf r r adreg26l ad result register 2/6 low 2a4h undefined 0 adr29 adr28 adr27 adr26 adr25 adr24 adr23 adr22 r adreg26h ad result register 2/6 high 2a5h undefined adr31 adr30 adr3rf r r adreg37l ad result register 3/7 low 2a6h undefined 0 adr39 adr38 adr37 adr36 adr35 adr34 adr33 adr32 r adreg37h ad result register 3/7 high 2a7h undefined
tmp91c820a 2008-02-20 91c820a-345 (11) watchdog timer symbol name address 7 6 5 4 3 2 1 0 wdte wdtp1 wdtp0 i2wdt rescr ? r/w r/w r/w r/w r/w r/w 1 0 0 0 0 0 wdmod wdt mode register 300h 1: wdt enable 00: 2 15 /f sys 01: 2 17 /f sys 10: 2 19 /f sys 11: 2 21 /f sys idle2 0: abort 1: operate 1: reset connect internally wdt out to reset pin always write ?0?. ? w ? wdcr wd control 301h (prohibit rmw) b1h: wdt disable 4eh: wdt clear
tmp91c820a 2008-02-20 91c820a-346 (12) rtc (real time clock) symbol name address 7 6 5 4 3 2 1 0 se6 se5 se4 se3 se2 se1 se0 r/w undefined secr second register 320h ?0? is read. 40 sec 20 sec 10 sec 8 sec 4 sec 2 sec 1 sec mi6 mi5 mi4 mi3 mi2 mi1 mi0 r/w undefined minr minute register 321h ?0? is read. 40 min 20 min 10 min 8 min 4 min 2 min 1min ho5 ho4 ho3 ho2 ho1 ho0 r/w undefined hourr hour register 322h ?0? is read. 20 hour (pm/am) 10 hour 8 hour 4 hour 2 hour 1 hour we2 we1 we0 r/w undefined dayr day register 323h ?0? is read. w2 w1 w0 da5 da4 da3 da2 da1 da0 r/w undefined dater date register 324h 0 0 day 20 day 10 day 8 day 4 day 2 day 1 mo4 mo3 mo2 mo1 mo0 r/w 325h undefined page0 ?0? is read. 10 month 8 month 4 month 2 month 1 month monthr month register page1 ?0? is read. 0: indicator for 12 hours 1: indicator for 24 hours ye7 ye6 ye5 ye4 ye3 ye2 ye1 ye0 r/w 326h undefined page0 80 year 40 year 20 year 10 year 8 year 4 year 2 year 1 year yearr year register page1 ?0? is read. leap year setting intena adjust enatmr enaalm page r/w w r/w r/w 0 undefined undefined undefined pager page register 327h (prohibit rmw) intrtc 0: disable 1: enable ?0? is read. 0: don?t care 1: adjust clock 0: disable 1: enable alarm 0: disable 1: enable ?0? is read. page setting dis1hz dis16hz rsttmr rstalm re3 re2 re1 re0 w undefined restr reset register 328h (prohibit rmw) 1 hz 0: disable 1: enable 16 hz 0: disable 1: enable 1: clock reset 1: alarm reset always write ?0?.
tmp91c820a 2008-02-20 91c820a-347 (13) melody/alarm generator symbol name address 7 6 5 4 3 2 1 0 al8 al7 al6 al5 al4 al3 al2 al1 r/w 0 0 0 0 0 0 0 0 alm alarm pattern register 330h alarm ? pattern set fc1 fc0 alminv ? ? ? ? melalm r/w r/w r/w r/w 0 0 0 0 0 0 0 0 mel almc melody/ alarm control register 331h free-run counter control 00: hold 01: restart 10: clear 11: clear and start alarm waveform invert 1: invert always write ?0?. output frequency 0: alarm 1: melody ml7 ml6 ml5 ml4 ml3 ml2 ml1 ml0 r/w 0 0 0 0 0 0 0 0 melfl melody frequency register-l 332h melody frequency set (low 8 bits) melon ml11 ml10 ml9 ml8 r/w r/w 0 0 0 0 0 melfh melody frequency register-h 333h melody counter control 0: stop and clear 1: start melody frequency set (high 4 bits) ? ialm4e ialm3e ialm2e ialm1e ialm0e r/w r/w 0 0 0 0 0 0 almint alarm interrupt enable register 334h always write ?0?. intalm4 to intalm0 alarm interrupt enable
tmp91c820a 2008-02-20 91c820a-348 (14) mmu symbol name address 7 6 5 4 3 2 1 0 l0e l0ea22 l0ea21 l0ea20 r/w r/w 0 0 local0 local0 control register 350h bank for local 0 0: disable 1: enable set bank number for local0 do not set ?000? because of common area l1e l1ea23 l1ea22 l1ea21 r/w r/w 0 0 local1 local1 control register 351h bank for local 1 0: disable 1: enable set bank number for local1 do not set ?001? because of common area l2e l2ea23 l2ea22 l2ea21 r/w r/w 0 0 local2 local2 control register 352h bank for local 2 0: disable 1: enable set bank number for local2 do not set ?111? because of common area l3e l3ea26 l3ea25 l3ea24 l3ea23 l3ea22 r/w r/w 0 0 0 0 0 0 00000 to 00011 : b 2 cs 00100 to 00111 : c 2 cs 01000 to 01011 : d 2 cs 01100 to 01111 : e 2 cs 10000 to 10011 : f 2 cs 10100 to 10111 : g 2 cs local3 local3 control register 353h bank for local 3 0: disable 1: enable 11000 to 11111 : set prohibition
tmp91c820a 2008-02-20 91c820a-349 (15) lcd controller (1/5) symbol name address 7 6 5 4 3 2 1 0 bae aae scpw1 scpw0 ? bulk ramtype mode r/w 0 0 1 0 0 0 0 0 lcdmode lcd mode register 04b0h used by b area 0: disable 1: enable used by a area 0: disable 1: enable scp width 00: base mode 01: 2 clocks 10: 4 clocks 11: 8 clocks always write ?0?. sdram bank selection 0: 64 mbit 1: 128 mbit display ram selection 0: sram 1: sdram mode selection 0: ram 1: sr fmn7 fmn6 fmn5 fmn4 fmn3 fmn2 fmn1 fmn0 r/w 0 0 0 0 0 0 0 0 lcddvm divide frame register 04b1 setting frame invert adjust function bit7 to bit0 com3 com2 com1 com0 seg3 seg2 seg1 seg0 r/w 0 0 0 0 0 0 0 0 lcdsize lcd size register 04b2h setting the lcd common number for sr type 0000: 128 0101: 400 0001: 160 0110: 480 0010: 200 0011: 240 0100: 320 other: reserve setting the lcd segment number for sr type 0000: 128 0101: 480 0001: 160 0110: 560 0010: 240 0111: 640 0011: 320 0100: 400 other: reserve lcdon all0 frmon ? fp9 mmulcd fp8 start r/w 0 0 0 0 0 0 0 0 lcdctl lcd control register 04b3h doff port 0: off 1: on transfer data of exclusive bus for lcd 0:normal 1:all display data 0 divided fr mode 0: disable 1: enable always write ?0?. setting bit9 for f fp [9:0] specify address of lcd driver with built-in ram 0: off 1: on setting bit8 for f fp [9:0] start control in sr type 0: stop 1: start fp7 fp6 fp5 fp4 fp3 fp2 fp1 fp0 r/w 0 0 0 0 0 0 0 0 lcdffp lcd frame frequency register 04b4h f fp set value bit7 to bit0 gray1 gray0 r/w r/w 0 0 lcdgl lcd gray level register 04b5h 00: monochrome 01: 4 levels 10: 8 levels 11: 16 levels
tmp91c820a 2008-02-20 91c820a-350 lcd controller (2/5) symbol name address 7 6 5 4 3 2 1 0 cde ccs cbe1 cbe0 r/w r/w 0 0 0 0 lcdcm lcd cursor mode register 04b6h cursor 0: off 1: on cursor color 0: white 1: black cursor blink interval 00: don?t blink 01: 2 hz 10: 1 hz 11: 0.5 hz cw4 cw3 cw2 cw1 cw0 r/w 0 0 0 0 0 lcdcw lcd cursor width register 04b7h cursor width (x size) 00000: 1 dot (min) 11111: 32 dots (max) cw4 cw3 cw2 cw1 cw0 r/w 0 0 0 0 0 lcdch lcd cursor height register 04b8h cursor height (y size) 00000: 1 dot (min) 11111: 32 dots (max) apb 3 apb 2 apb 1 apb 0 r/w 0 0 0 0 lcdcp lcd cursor apb register 04b9h setting bit3 to bit0 for cursor absolute position cap 7 cap 6 cap 5 cap 4 cap 3 cap 2 cap 1 cap 0 r/w 0 0 0 0 0 0 0 0 lcdcpl lcd cursor ap register-l 04bah setting bit7 to bit0 for cursor absolute position cap 15 cap 14 cap 13 cap 12 cap 11 cap 10 cap 9 cap 8 r/w 0 0 0 0 0 0 0 0 lcdcpm lcd cursor ap register-m 04bbh setting bit15 to bit8 for cursor absolute position cap 23 cap 22 cap 21 cap 20 cap 19 cap 18 cap 17 cap 16 r/w 0 1 0 0 0 0 0 0 lcdcph lcd cursor ap register-h 04bch setting bit23 to bit16 for cursor absolute position
tmp91c820a 2008-02-20 91c820a-351 lcd controller (3/5) symbol name address 7 6 5 4 3 2 1 0 sa15 sa14 sa13 sa12 sa11 sa10 sa9 sa8 r/w 0 0 0 0 0 0 0 0 lsaram a area start address register-m 04c0h set start address a15 to a8 for the source data memory in a area. sa23 sa22 sa21 sa20 sa19 sa18 sa17 sa16 r/w 0 1 0 0 0 0 0 0 lsarah a area start address register-h 04c1h set start address a23 to a16 for the source data memory in a area. ea15 ea14 ea13 ea12 ea11 ea10 ea9 ea8 r/w 0 0 0 0 0 0 0 0 learam a area end address register-m 04c2h set end address a15 to a8 for the source data memory in a area. ea23 ea22 ea21 ea20 ea19 ea18 ea17 ea16 r/w 0 1 0 0 0 0 0 0 learah a area end address register-h 04c3h set end address a23 to a16 for the source data memory in a area. sa15 sa14 sa13 sa12 sa11 sa10 sa9 sa8 r/w 0 0 0 0 0 0 0 0 lsarbm b area start address register-m 04c4h set start address a15 to a8 for the source data memory in b area. sa23 sa22 sa21 sa20 sa19 sa18 sa17 sa16 r/w 0 1 0 0 0 0 0 0 lsarbh b area start address register-h 04c5h set start address a23 to a16 for the source data memory in b area. ea15 ea14 ea13 ea12 ea11 ea10 ea9 ea8 r/w 0 0 0 0 0 0 0 0 learbm b area end address register-m 04c6h set end address a15 to a8 for the source data memory in b area. ea23 ea22 ea21 ea20 ea19 ea18 ea17 ea16 r/w 0 1 0 0 0 0 0 0 learbh b area end address register-h 04c7h set end address a23 to a16 for the source data memory in b area. sa7 sa6 sa5 sa4 sa3 sa2 sa1 sa0 r/w 0 0 0 0 0 0 0 0 lsarcl c area start address register-l 04c8h set start address a7 to a0 for the source data memory in c area. sa15 sa14 sa13 sa12 sa11 sa10 sa9 sa8 r/w 0 0 0 0 0 0 0 0 lsarcm c area start address register-m 04c9h set start address a15 to a8 for the source data memory in c area. sa23 sa22 sa21 sa20 sa19 sa18 sa17 sa16 r/w 0 1 0 0 0 0 0 0 lsarch c area start address register-h 04cah set start address a23 to a16 for the source data memory in c area.
tmp91c820a 2008-02-20 91c820a-352 lcd controller (4/5) symbol name address 7 6 5 4 3 2 1 0 r/w 0 0 0 0 0 0 0 0 lg0l lcd gray level data setting register-l 04d0h r/w 0 0 0 0 0 0 0 0 lg0h lcd gray level data setting register-h 04d1h r/w 0 0 0 0 0 0 0 0 lg1l lcd gray level data setting register-l 04d2h r/w 1 0 0 0 0 0 0 0 lg1h lcd gray level data setting register-h 04d3h r/w 1 0 0 0 0 0 0 0 lg2l lcd gray level data setting register-l 04d4h r/w 1 0 0 0 0 0 0 0 lg2h lcd gray level data setting register-h 04d5h r/w 1 0 0 0 0 0 0 0 lg3l lcd gray level data setting register-l 04d6h r/w 1 0 0 0 1 0 0 0 lg3h lcd gray level data setting register-h 04d7h r/w 1 0 0 0 1 0 0 0 lg4l lcd gray level data setting register-l 04d8h r/w 1 0 0 0 1 0 0 0 lg4h lcd gray level data setting register-h 04d9h r/w 1 0 0 0 1 0 1 0 lg5l lcd gray level data setting register-l 04dah r/w 1 0 0 0 1 0 0 0 lg5h lcd gray level data setting register-h 04dbh r/w 1 0 0 0 1 0 1 0 lg6l lcd gray level data setting register-l 04dch r/w 1 0 0 0 1 0 1 0 lg6h lcd gray level data setting register-h 04ddh r/w 1 0 1 0 1 0 1 0 lg7l lcd gray level data setting register-l 04deh r/w 1 0 0 0 1 0 1 0 lg7h lcd gray level data setting register-h 04dfh
tmp91c820a 2008-02-20 91c820a-353 lcd controller (5/5) symbol name address 7 6 5 4 3 2 1 0 r/w 1 0 1 0 1 0 1 0 lg8l lcd gray level data setting register-l 04e0h r/w 1 0 1 0 1 0 1 0 lg8h lcd gray level data setting register-h 04e1h r/w 0 1 0 1 0 1 0 1 lg9l lcd gray level data setting register-l 04e2h r/w 1 1 0 1 0 1 0 1 lg9h lcd gray level data setting register-h 04e3h r/w 1 1 0 1 0 1 0 1 lgal lcd gray level data setting register-l 04e4h r/w 1 1 0 1 0 1 0 1 lgah lcd gray level data setting register-h 04e5h r/w 1 1 0 1 0 1 0 1 lgbl lcd gray level data setting register-l 04e6h r/w 1 1 0 1 1 1 0 1 lgbh lcd gray level data setting register-h 04e7h r/w 1 1 0 1 1 1 0 1 lgcl lcd gray level data setting register-l 04e8h r/w 1 1 0 1 1 1 0 1 lgch lcd gray level data setting register-h 04e9h r/w 1 1 0 1 1 1 0 1 lgdl lcd gray level data setting register-l 04eah r/w 1 1 1 1 1 1 0 1 lgdh lcd gray level data setting register-h 04ebh r/w 1 1 0 1 1 1 0 1 lgel lcd gray level data setting register-l 04ech r/w 1 1 0 1 1 1 0 1 lgeh lcd gray level data setting register-h 04edh r/w 1 1 1 1 1 1 1 1 lgfl lcd gray level data setting register-l 04eeh r/w 1 1 1 1 1 1 1 1 lgfh lcd gray level data setting register-h 04efh
tmp91c820a 2008-02-20 91c820a-354 (16) sdram controller symbol name address 7 6 5 4 3 2 1 0 sdini swrc ? ? smuxe smuxw1 smuxw0 smac r/w r/w r/w r/w r/w 0 0 1 0 0 0 0 0 sdacr sdram address control 04f0h auto initialize 0: disable 1: enable write recovery 0: 1 clock 1: 2 clocks always write ?10?. address multiplex 0: disable 1: enable sdram select 00:16 mbits 10: 128 m bits 01: 64 mbits 11: reserved access cycle 0: disable 1: enable sfrc srs2 srs1 srs0 sasfrc src r/w r/w 0 0 0 0 0 0 sdrcr sdram refresh control 04f1h self refresh 0: disable 1: enable auto refresh interval 000: 78 states 100: 195 states 001: 97 states 101: 210 states 010: 124 states 110: 249 states 011: 156 states 111: 312 states auto self refresh 0: disable 1: enable auto refresh 0: disable 1: enable
tmp91c820a 2008-02-20 91c820a-355 (17) 16-bit timer symbol name address 7 6 5 4 3 2 1 0 tb0rde ? i2tb0 tb0prun tb0run r/w r/w r/w r/w r/w 0 0 0 0 0 tb0run 16-bit timer control register 180h double buffer 0: disable 1: enable always write ?0?. idle2 0: stop 1: operate 16-bit timer run/stop control 0: stop and clear 1: run (count up) ? ? tb0cpoi ? ? tb0cle tb0clk1 tb0clk0 r/w w * r/w 0 0 1 0 0 0 0 0 tb0mod 16-bit timer source clk and mode register 182h (prohibit rmw) always write ?00?. 0: soft capture 1: undefined always write ?00?. 1: uc0 clear enable source clock 00: reserved 01: t1 10: t4 11: t16 ? ? ? tb0c0t1 tb0e1t1 tb0e0t1 tb0ff0c1 tb0ff0c0 w r/w w * 1 1 0 0 0 0 0 0 tb0ff0 invert trigger 0: trigger disable 1: trigger enable tb0ffcr 16-bit timer flip-flop control register 183h (prohibit rmw) always write ?11?. always write ?0?. invert when the uc value is loaded in to tb0cp0. invert when the uc value matches the value in tb0rg1. invert when the uc value matches the value in tb0rg0. 00: invert tb0ff0 01: set 10: clear 11: don?t care always read as ?11?. ? w tb0rg0l 16-bit timer register 0-l 188h (prohibit rmw) undefined ? w tb0rg0h 16-bit timer register 0-h 189h (prohibit rmw) undefined ? w tb0rg1l 16-bit timer register 1-l 18ah (prohibit rmw) undefined ? w tb0rg1h 16-bit timer register 1-h 18bh (prohibit rmw) undefined ? r tb0cp0l capture register 0-l 18ch undefined ? r tb0cp0h capture register 0-h 18dh undefined ? r tb0cp1l capture register 1-l 18eh undefined ? r tb0cp1h capture register 1-h 18fh undefined
tmp91c820a 2008-02-20 91c820a-356 6. points of note and restrictions (1) notation a. the notation for built-in/ i/o registers is as follows register symbol (e.g., ta01run denotes bit ta0run of register ta01run). b. read-modify-write instructions an instruction in which the cpu reads data from memory and writes the data to the same memory location in one instruction. example 1: set 3, (ta01run) ... set bit 3 of ta01run. example 2: inc 1, (100h) ... increment the data at 100h. examples of read-modify-write instructions on the tlcs-900 exchange instruction ex (mem), r arithmetic operations add (mem), r/# adc (mem), r/# sub (mem), r/# sbc (mem), r/# inc #3, (mem) dec #3, (mem) logic operations and (mem), r/# or (mem), r/# xor (mem), r/# bit manipulation operations stcf #3/a, (mem) res #3, (mem) set #3, (mem) chg #3, (mem) tset #3, (mem) rotate and shift operations rlc (mem) rrc (mem) rl (mem) rr (mem) sla (mem) sra (mem) sll (mem) srl (mem) rld (mem) rrd (mem) c. fc, fs, f fph , f sys and one state the clock frequency input on x1 and 2 is called f osch . the clock selected by dfmcr0 is called fc. the clock selected by syscr1 is called f fph . the clock frequency give by f fph divided by 2 is called f sys . one cycle of f sys is referred to as one state.
tmp91c820a 2008-02-20 91c820a-357 (2) points of note a. am0 and am1 pins this pin is connected to the v cc or the v ss pin. do not alter the level when the pin is active. b. emu0 and emu1 open pins. c. reserved address areas the tmp91c820a does not have any reserved areas. d. warm-up counter the warm-up counter operates when stop mode is released, even if the system is using an external oscillator. as a result a time equivalent to the warm-up time elapses between input of the release request and output of the system clock. e. programmable pull-up resistance the programmable pull-up resistor can be tu rned on/off by a program when the ports are set for use as input ports. when the ports are set for use as output ports, they cannot be turned on/off by a program. the data registers (e.g., p5) are used to turn the pull-up/pull-down resistors on/off. consequently read-modify-write instructions are prohibited. f. watchdog timer the watchdog timer starts operation immediately after a reset is released. when the watchdog timer is not to be used, disable it. g. ad converter the string resistor between the vrefh and vrefl pins can be cut by a program so as to reduce power consumption. when stop mode is used, disable the resistor using the program before the halt instruction is executed. h. cpu (micro dma) only the ?ldc cr, r? and ?ldc r, cr? instructions can be used to access the control registers in the cpu (e.g., the transfer source address register (dmasn)). i. undefined sfr the value of an undefined bit in an sfr is undefined when read. j. pop sr instruction please execute the pop sr instruction during di condition. k. releasing the halt mode by requesting an interruption usually, interrupts can release all halt status. however, the interrupts ( nmi , int0 to int3, intkey, intrtc, intalm0 to intalm4) which can release the halt mode may not be able to do so if they are input during the period cpu is shifting to the halt mode (for about 5 clocks of f fph ) with idle1 or stop mode (idle2 is not applicable to this case). (in this case, an interrupt request is kept on hold internally.) if another interrupt is generated after it has shifted to the halt mode completely, halt status can be released without difficulty. the priority of this interrupt is compared with that of the interrupt kept on hold internally, and the interrupt with higher priority is handled first followed by the other interrupt.
tmp91c820a 2008-02-20 91c820a-358 7. package dimensions lqfp144-p-1616-0.40c unit: mm


▲Up To Search▲   

 
Price & Availability of TMP91C820AFG

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]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X