![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c ht45r2k-b HT45R2K-A revision: 1.40 date: ? a ??? 1 ?? ? 01 ? ? a ??? 1 ?? ? 01 ?
rev. 1.40 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 3 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale table of contents eates eneal eston eleton table lo aa n ssnent n eston bsolte a atns c caatests c caatests operational amplifer electrical characteristics instrumentation amplifer electrical characteristics clo ? king and pipelining .......................................................................................................... 14 p ? og ? am counte ? C pc ............. ............................................................................................. 1 ? sta ? k ...................................................................................................................................... 16 a ? it ? meti ? and logi ? unit C alu ............................................................................................ 16 p?og?am ?emo?y ......................................................................................................... 17 st ? u ? tu ? e ................................................................................................................................. 17 spe ? ial ve ? to ? s ...................................................................................................................... 17 look-up table ............. ............................................................................................................ 18 table p ? og ? am example ......................................................................................................... 19 data ?emo?y ................................................................................................................ ?0 st ? u ? tu ? e ................................................................................................................................. ? 0 spe ? ial pu ? pose data ? emo ? y .............................................................................................. ?? spe?ial fun?tion registe?s ........................................................................................ ?? indi ? e ? t add ? essing registe ? s C iar0 ? iar1 .......................................................................... ?? ? emo ? y pointe ? s C ? p0 ? ? p1 ............................................................................................... ?? a ?? umulato ? C acc ................................................................................................................ ? 3 p ? og ? am counte ? low registe ? C pcl ................................................................................... ? 3 bank pointe ? C bp .................................................................................................................. ? 4 status registe ? C status ..................................................................................................... ? 4 system cont ? ol registe ? s C ctrl0 ? ctrl1 ............. ............................................................. ?? rev. 1.40 ? ?a??? 1?? ?01? rev. 1.40 3 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale oscillator confguration ............................................................................................. 27 exte ? nal c ? ystal/ce ? ami ? os ? illato ? C hxt ............................................................................ ? 8 exte ? nal rc os ? illato ? C erc ............. ................................................................................... ? 8 inte ? nal rc os ? illato ? C hirc ............. ................................................................................... ? 9 exte ? nal 3 ? .768khz c ? ystal os ? illato ? C lxt ............. ............................................................ ? 9 lxt os ? illato ? low powe ? fun ? tion ....................................................................................... 30 inte ? nal 1 ? khz os ? illato ? C lirc ............................................................................................ 30 watchdog timer C wdt .............................................................................................. 30 wat ?? dog time ? clo ? k sou ?? e ............................................................................................... 30 wat ?? dog time ? ope ? ation .................................................................................................... 30 operating modes ......................................................................................................... 34 powe ? down ? ode ................................................................................................................. 34 reset and initialisation ............................................................................................... 36 reset fun ? tions ............. ........................................................................................................ 36 reset initial conditions .......................................................................................................... 38 input/output ports ....................................................................................................... 41 pull- ? ig ? resisto ? s ................................................................................................................. 41 po ? t a wake-up ............. ........................................................................................................ 4 ? i/o po ? t cont ? ol registe ? s ...................................................................................................... 4 ? pin-s ? a ? ed fun ? tions ............. ................................................................................................ 43 i/o pin st ? u ? tu ? es ................................................................................................................... 44 p ? og ? amming conside ? ations ............. .................................................................................... 4 ? timer/event counter s ................................................................................................. 45 time ? ? ode ............................................................................................................................ ? 0 event counte ? ? ode .............................................................................................................. ? 0 pulse widt ? ? easu ? ement ? ode ............. .............................................................................. ? 1 p ? es ? ale ? ................................................................................................................................ ?? buzze ? .................................................................................................................................... ?? i/o inte ? fa ? ing ......................................................................................................................... ? 4 p ? og ? amming conside ? ations ............. .................................................................................... ? 4 time ? p ? og ? am example ........................................................................................................ ?? vibration sensor amplifer ......................................................................................... 56 touch key module ....................................................................................................... 56 tou ?? key st ? u ? tu ? e ............................................................................................................... ? 6 touch key register defnition ................................................................................................ ? 6 tou ?? key ope ? ation .............................................................................................................. 6 ? tou ?? key inte ?? upt s ............. ................................................................................................. 63 p ? og ? amming conside ? ations ............. .................................................................................... 63 charge pump and voltage regulator ........................................................................ 63 ope ? ation ............................................................................................................................... 63 dual slope a/d converter .......................................................................................... 65 dual slope a nolog digital conve ? to ? ope ? ation ..................................................................... 67 rev. 1.40 4 ? a ??? 1 ?? ? 01 ? rev. 1.40 ? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale interrupts ...................................................................................................................... 70 inte ?? upt registe ? ................................................................................................................... 70 inte ?? upt ope ? ation ................................................................................................................. 7 ? inte ?? upt p ? io ? ity ...................................................................................................................... 74 exte ? nal inte ?? upt ............. ....................................................................................................... 74 time ? /event counte ? inte ?? upt ................................................................................................ 7 ? ? ulti-fun ? tion inte ?? upt ........................................................................................................... 7 ? a/d conve ? te ? i nte ?? upt .......................................................................................................... 76 tou ?? key inte ?? upt ................................................................................................................ 76 p ? og ? amming conside ? ations ............. .................................................................................... 76 lcd driver .................................................................................................................... 77 lcd ? emo ? y .......................................................................................................................... 77 lcd registe ? s ........................................................................................................................ 78 lcd clo ? k .............................................................................................................................. 79 lcd d ? ive ? output .................................................................................................................. 79 lcd voltage sou ?? e and biasing ........................................................................................... 80 p ? og ? amming conside ? ations ............. .................................................................................... 81 confguration options ............................................................................................................ 8 ? body fat measurement function ............................................................................... 83 sine wave gene ? ato ? ............................................................................................................. 83 amplifer ............. .................................................................................................................... 8 ? filte ? ....................................................................................................................................... 87 application circuits ........... ......................................................................................... 88 instruction set ............................................................................................................. 89 int ? odu ? tion ............................................................................................................................ 89 inst ? u ? tion timing ................................................................................................................... 89 ? oving and t ? ansfe ?? ing data ................................................................................................ 89 a ? it ? meti ? ope ? ations ............................................................................................................. 89 logi ? al and rotate ope ? ations ............. .................................................................................. 89 b ? an ?? es and cont ? ol t ? ansfe ? .............................................................................................. 90 bit ope ? ations ........................................................................................................................ 90 table read ope ? ations .......................................................................................................... 90 ot ? e ? ope ? ations ............. ....................................................................................................... 90 instruction set summary ............ ................................................................................ 91 table ? onventions .................................................................................................................. 91 instruction defnition .................................................................................................. 93 package information ... .............................................................................................. 103 80-pin lqfp (10mm 10mm) outline dimensions ............................................................. 104 rev. 1.40 4 ?a??? 1?? ?01? rev. 1.40 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale features ? operating v oltage: ? f sys = 4mhz: 2.2v~5.5v ? f sys = 8mhz: 3.3v~5.5v ? oscillator types: ? external crystal -- hxt ? external low speed crystal -- lxt ? external rc -- erc ? internal high speed rc -- hirc ? internal low speed rc -- lirc ? up to 22 bidirectional i/o lines ? one external interrupt input shar e d with an i/o lines ? one 8-bit and two 16-bit programmable timer/event counter s with overfow interrupt a 8-stage prescal er ? lcd driver with 248 segments ? 16k16 program memory ? 2568 data memory ? single differential input channel dual slope analog to digital convertor with operational amplifer ? watchdog t imer with regulator power ? buzzer output ? halt and wake-up function s to reduce power consumption ? internal voltage regulator (3.3v) and charge pump ? internal reference voltage generator (1.5v) ? 8-level subroutine nesting ? bit manipulation instruction ? 16-bit table read instruction ? up to 0.5 s instruction cycle with 8mhz system clock at v dd = 5v ? 63 powerful instructions ? all instructions in 1 or 2 machine cycles ? low voltage reset function ? one vibration sensor input ? four touch-key inputs ? body fat circuit ? 80-pin lqfp package rev. 1.40 6 ? a ??? 1 ?? ? 01 ? rev. 1.40 7 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale general description the ht45r2k-c is an 8-bit high performance, risc architecture microcontroller device , which with its a/d converter and lcd driver , can directly interface to analog signals and to lcd panels. the device includes a range of other features such as low power consumption, i/o fexibility , timer functions, oscil lator opt ions, d ual slope a/d convertor, hal t and wake-up functi ons, watc hdog timer , v ibration sensor etc. however as the device includes all the circuitry associated with body fat measurement the device is especially suitable for this specific application area, being able to signifcantly reduce the need for the usual external components. selection table part no. program memory ht4 ? r ? k-a 4k16 ht4 ? r ? k-b 8k16 ht4 ? r ? k-c 16k16 block diagram ? ? ? ?? ? ?-? ? ? ? ? ? ?? ? ? ? ? ? ? ? rev. 1.40 6 ?a??? 1?? ?01? rev. 1.40 7 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale p in assignment pa2/bzb pa1/bz pa0/vib pa7/r esb nc pc0/tmr1/s e g0 pc1/tmr2/s e g1 pc2/s e g2 2 3 4 5 8 9 10 11 12 13 14 35 36 37 41 42 43 44 45 46 47 48 15 16 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 51 52 53 54 55 56 57 58 59 60 61 62 63 64 49 50 pb0/ tk 1 pb1/ tk 2 pb2/ tk 3 pb3/ tk 4 pb4/ int th / lb vobgp chpc 2 vochp voreg op 5p op 5n dopap chpc 1 seg 13 seg 14 seg 15 seg 16 seg 17 seg 18 seg 19 seg 20 seg 22 seg 23 com 7/ seg 24 com 6/ seg 25 com 5/ seg 26 seg 21 com 3 com2 com1 c1 c2 sin fvl fil rf1 fvr to cp0n rfc dscc dsrc fir dsrr vss vdd ht 45 r2k-c 80 lqfp -a avss 6 7 pb5/tmr0 avdd 17 rf2 38 39 40 seg 11 seg 12 seg 10 seg 9 se g8 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 com0 vc vab dchop pa3/xt2 dopan dopao com 4/ seg 27 pc3/s e g3 pc4/s e g4 pc5/s e g5 pc6/s e g6 pc7/s e g7 pa4/xt1 pa5/osc2 pa6/osc1 pin description pin name function opt i/t o/t description pa0/ vib pa0 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. vib vibrc vib ? ation input pa1/ bz pa1 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. bz sfs c ? os buzze ? output pa ? / bzb pa ? papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up bzb sfs c ? os complementa ? y buzze ? output pa3/ xt ? pa3 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. xt ? co lxt lxt pin pa4/ xt1 pa4 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. xt1 co lxt lxt pin rev. 1.40 8 ? a ??? 1 ?? ? 01 ? rev. 1.40 9 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale pin name function opt i/t o/t description pa ? / osc ? pa ? papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. osc ? co hxt hxt pin pa6/ osc1 pa6 papu pawk st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up and wake-up. osc1 co hxt hxt/erc pin pa7/ res pa7 pawk st n ? os gene ? al pu ? pose i/o. registe ? enabled wake-up. res co st reset input pb0/tk1 pb0 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk1 tk ? 0c1 tou ?? key 1 in put pb1/ tk ? pb1 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk ? tk ? 0c1 tou ?? key ? in put pb ? / tk3 pb ? pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk3 tk ? 0c1 tou ?? key 3 in put pb3/tk4 pb3 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. tk4 tk ? 0c1 tou ?? key 4 in put pb4/int pb4 pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. int ctrl1 intc0 st exte ? nal inte ?? upt input pb ? / t ? r0 pb ? pbpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. t ? r0 t ? r0c st exte ? nal time ? 0 ? lo ? k input pc0/ t ? r 1/ seg0 pc0 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. t ? r 1 t ? r1c st exte ? nal time ? 1 ? lo ? k input seg0 lcdout c ? os lcd segment output pc1/ t ? r ? / seg1 pc1 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. t ? r ? t ? r ? c st exte ? nal time ? ? ? lo ? k input seg1 lcdout c ? os lcd segment output p c ? / seg ? p c ? pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg ? lcdout c ? os lcd segment output pc3/seg3 pc3 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg3 lcdout c ? os lcd segment output pc4/seg4 pc4 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg4 lcdout c ? os lcd segment output p c ? / seg ? pc ? pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg ? lcdout c ? os lcd segment output pc6/seg6 pc6 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg6 lcdout c ? os lcd segment output pc7/seg7 pc7 pcpu st c ? os gene ? al pu ? pose i/o. registe ? enabled pull-up. seg7 lcdout c ? os lcd segment output seg8~seg ? 3 segn c ? os lcd segment outputs co ? 0~co ? 3 co ? n c ? os lcd ? ommon outputs co ? 4 / seg ? 7 co ? 4 lcdc c ? os lcd ? ommon output seg ? 7 lcd segment output rev. 1.40 8 ?a??? 1?? ?01? rev. 1.40 9 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale pin name function opt i/t o/t description co ?? / seg ? 6 co ?? lcdc c ? os lcd ? ommon output seg ? 6 lcd segment output co ? 6 / seg ?? co ? 6 lcdc c ? os lcd ? ommon output seg ?? lcd segment output co ? 7 / seg ? 4 co ? 7 lcdc c ? os lcd ? ommon output seg ? 4 lcd segment output vab vab ns lcd voltage pump vc vc ns lcd voltage pump c1 c1 ns lcd voltage pump c ? c ? ns lcd voltage pump vobgp vobgp band gap voltage output pin (fo ? inte ? nal use) voreg voreg pwr regulato ? output 3.3v vochp vochp pwr c ? a ? ge pump output chpc1 chpc1 ns c ? a ? ge pump ? apa ? it o ? C positive chpc ? chpc ? ns c ? a ? ge pump ? apa ? it o ? C negative dopan dopan ns opa negative input dopap dopap ns opa positive input dopao dopao ns opa output dchop dchop ns opa c ? oppe ? pin th/lb th ns tempe ? atu ? e senso ? input lb ns low batte ? y voltage input dsrr dsrr ns r efe ? en ? e signal input dsrc dsrc ns integ ? ato ? negative input dscc dscc ns c ompa ? ato ? negative input sin sin ns sine wave output fvr fvr ns foot ? esisto ? ?? annel fvl fvl ns foot ? esisto ? ?? annel fil fil ns foot ? esisto ? ?? annel fir fir ns foot ? esisto ? ?? annel rf1 rf1 ns refe ? en ? e impedan ? e ?? annel rf ? rf ? ns refe ? en ? e impedan ? e ?? annel rfc rfc adc analog input t0 t0 opac output cp0n cp0n ns t ? e inve ? ting input of cp0 op ? n op ? n ns t ? e inve ? ting input of op ? op ? p op ? p ns t ? e non-inve ? ting input of op ? vdd vdd pwr p owe ? supply vss vss pwr g ? ound a vdd a vdd pwr analog powe ? supply a vss a vss pwr analog g ? ound note: i/t: input type; o/t: output type opt: optional by confguration option (co) or register option pwr: power; co: confguration option st: schmitt t rigger input; cmos: cmos output; nmos: nmos output hxt: high frequency crystal oscillator lxt: low frequency crystal oscillator ns: non-standard input or output rev. 1.40 10 ? a ??? 1 ?? ? 01 ? rev. 1.40 11 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale absolute maximum ratings supply v oltage .............. ....................................................................................... v ss -0.3v to +6.0v input v oltage .............. ................................................................................... v ss -0.3v to v dd +0.3v storage t emperature ............... ................................................................................. -50 c to +125c operating t emperature .............. ................................................................................ -40 c to +85 c i ol t otal .............. .................................................................................................... ............... 150ma i oh t otal ................................................................................................................................ -100ma total power dissipation .............. ...................................................................................... 500mw note: these are stress ratings only . stresses exceeding the range specified under absolute maximum ratings may cause substantial damage to the device. functional operation of this device at other conditions beyond those listed in the specifcation is not implied and prolonged exposure to extreme conditions may affect device reliability. d.c. characteristics ope ? ating tempe ? atu ? e: -40c c to 8 ? c ta= ?? c typi ? al symbol parameter test conditions min. typ. max. unit vdd conditions v dd ope ? ating voltage f sys = 4 ? hz ? . ? ? . ? v f sys = 8 ? hz 3.3 ? . ? v v lcd lcd hig ? est voltage 0 v dd v i dd1 ope ? ating cu ?? ent (hxt ? erc ? hirc) ? v no load ? f sys = 8 ? hz adc off 4 8 ma i dd ? ope ? ating cu ?? ent (hxt ? erc ? hirc) 3v no load ? f sys = 4 ? hz adc off 0.8 1. ? ma ? v ? . ? 4.0 ma i dd3 ope ? ating cu ?? ent (hxt ? erc) 3v no load ? f sys = ?? hz adc off 0. ? 1.0 ma ? v 1. ? 3.0 ma i dd4 ope ? ating cu ?? ent (hxt ? erc ? hirc) ? v v oreg = 3.3v ? f sys = 4 ? hz adc on ? adc ? lo ? k is 1 ?? khz (all ot ? e ? analog devi ? es off) 3 ? ma i stb1 standby cu ?? ent 3v no load ? system halt ? adc ? lcd and wdt off 1 a ? v ? a i stb ? standby cu ?? ent 3v no load ? system halt ? adc and lcd off ? wdt on ? . ? ? .0 a ? v 8 1 ? a i stb3 standby cu ?? ent ( inte ? nal rc 1 ? khz ) 3v no load ? system os ? off ? adc and wdt off ? ? a ? v 6 10 a i stb4 standby cu ?? ent ( inte ? nal rc 1 ? khz ) ? v no load ? system os ? off ? adc and wdt off lcd on(1/3 r type) 380 ? 00 a i stb ? standby cu ?? ent 3v no load ? system halt ? lxt os ? slowly sta ? t -up ? wdtosc off ? lxt o n ? a ? v 1 ? a i stb6 standby cu ?? ent (lxt) ? v no load ? s ystem os ? off ? adc and wdt off ? lcd on (1/3 r type) ? (lcd bias current= 50a) 390 ? 10 a i stb7 standby cu ?? ent 3v no load ? only vib ? ation senso ? tu ? n on&vib pin ? onne ? ted a 0.1f cap to vss ? wdt off ? 4 a ? v 8 16 rev. 1.40 10 ?a??? 1?? ?01? rev. 1.40 11 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale symbol parameter test conditions min. typ. max. unit vdd conditions v il1 input low voltage fo ? i/o po ? ts ? t ? r0 ? t ? r1 ? t ? r ? and int ? v 0.0 1. ? v 0.0 0. ? v dd v v ih1 input hig ? voltage fo ? i/o po ? ts ? t ? r0 ? t ? r1 ? t ? r ? and int ? v 3. ? ? .0 v 0.8v dd 1.0v dd v v il ? input low voltage ( res) 0 0.4v dd v v ih ? input hig ? voltage ( res) 0.9v dd v dd v v lv r1 low v oltage reset confguration option: 2.1v ? .0 ? .1 ? . ? v v lvr ? confguration option: 2.55v ? .40 ? . ?? ? .70 v v lvr3 confguration option: 3.15v 3.00 3.1 ? 3.30 v v lvr4 confguration option: 3.8v 3.6 3.8 4.0 v i ol1 i/o po ? t sink cu ?? ent 3v v ol = 0.1v dd 4 8 ma ? v 10 ? 0 ma i oh1 i/o po ? t sou ?? e cu ?? ent 3v v oh = 0.9v dd - ? -4 ma ? v - ? -10 ma i ol ? lcd c ommon and s egment sink cu ?? ent 3v v ol = 0.1v dd ? 10 4 ? 0 a ? v 3 ? 0 700 a i oh ? lcd c ommon and s egment sou ?? e cu ?? ent 3v v oh = 0.9v dd -80 -160 a ? v -180 -360 a i ol3 pa7 sink c u ?? ent ? v ol = 0.1v dd ? 3 ma r ph pull- ? ig ? resistan ? e of i/o po ? ts 3v ? 0 60 100 k ? v 10 30 ? 0 k v vibwk ? inimum v oltage to w ake ? cu by t ? e v ib ? ation s enso ? input ? .4 v 100hz~1khz sine wave (note) ?? 0 mv 3v ? v charge pump and regulator v chp input voltage c ? a ? ge pump on ? . ? 3.6 v c ? a ? ge p ump off 3.7 ? . ? v v oreg output voltage no load 3.0 3.3 3.6 v v regdp1 regulato ? output voltage d ? op (c ompa ? e d wit ? no load) v dd = 3.7v~ ? . ? v c ? a ? ge pump off cu ?? ent<= 10ma 100 mv v regdp ? v dd = ? .4v ~ 3.6v c ? a ? ge pump on cu ?? ent <= 6ma 100 mv dual slope ad convertor , amplifer and band gap v adoff input offset range v oreg = 3.3v ? 00 800 v v rfgtc refe ? en ? e g ene ? ato ? t empe ? atu ? e coeffcient v oreg = 3.3v ? 0 ppm/c v ic ? r common ? ode input range amplifer, no load 0. ? v oreg -1. ? v integ ? ato ?? no load 1. ? v oreg -0. ? v 1rwh 7 hvw &lufxlw iru 9 90%:. rev. 1.40 1 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 13 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale a.c. characteristics ope ? ating tempe ? atu ? e: -40c to 8 ? c ta= ?? c typi ? al symbol parameter test conditions min. typ. max. unit vdd conditions f sys system clo ? k (rc) ? . ? v~ ? . ? v 400 4000 khz system clo ? k ( hxt ) ? . ? v~ ? . ? v 400 4000 khz 3.3v~ ? . ? v 400 8000 khz 4. ? v ~ ? . ? v 400 1 ? 000 khz f hirc hirc osc 3v / ? v ta= ?? c - ? % 4 + ? % ? hz 3v / ? v ta= ?? c - ? % 8 + ? % ? hz ? v ta= ?? c - ? % 1 ? + ? % ? hz 3v / ? v ta= 0~70c - ? % 4 + ? % ? hz 3v / ? v ta= 0~70c - ? % 8 + ? % ? hz ? v ta= 0~70c - ? % 1 ? + ? % ? hz ? . ? v~3.6v ta= 0~70c -8% 4 +8% ? hz 3.0v ~ ? . ? v ta= 0~70c -8% 4 +8% ? hz 3.0v ~ ? . ? v ta= 0~70c -8% 8 +8% ? hz 4. ? v ~ ? . ? v ta= 0~70c -8% 1 ? +8% ? hz ? . ? v~3.6v ta= -40~8 ? c -1 ? % 4 +1 ? % ? hz 3.0v ~ ? . ? v ta= -40~8 ? c -1 ? % 4 +1 ? % ? hz 3.0v ~ ? . ? v ta= -40~8 ? c -1 ? % 8 +1 ? % ? hz 4. ? v ~ ? . ? v ta= -40~8 ? c -1 ? % 1 ? +1 ? % ? hz f erc erc osc ? v ta= ?? c ? r= 1 ? 0k - ? % 4 + ? % ? hz ? v ta= 0~70c ? r= 1 ? 0k - ? % 4 + ? % ? hz ? v ta= -40~8 ? c ? r= 1 ? 0k -7% 4 +7% ? hz ? . ? v ~ ? . ? v ta= -40~8 ? c ? r= 1 ? 0k -11% 4 +11% ? hz f ti ? er time ? i/p f ? equen ? y (t ? r0 ? t ? r1 ? t ? r ? ) ? . ? v~ ? . ? v 0 4000 khz t wdtosc wat ?? dog os ? illato ? pe ? iod 3v 4 ? 90 180 s ? v 3 ? 6 ? 130 s t res exte ? nal reset low pulse widt ? 1 s t sst system sta ? t-up time ? pe ? iod ( wake-up f ? om halt ) ? 10 ? 4 t sys t int inte ?? upt pulse widt ? 1 s t lvr low v oltage w idt ? to reset 0. ?? 1.00 ? .00 ms note: 1. t sys = 1/f sys 2. to maintain the accuracy of the internal hirc oscillator frequency , a 0.1 f decoupling capacitor should be connected between vdd and vss and located as close to the device as possible. rev. 1.40 1? ?a??? 1?? ?01? rev. 1.40 13 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale operational amplifer electrical characteristics symbol parameter test conditions min. typ. max. unit v dd conditions dc electrical characteristics v dd supply voltage ? . ? ? . ? v i cc supply cu ?? ent pe ? signal amplifer ? v no load 1 ? 0 360 ? 00 a op0, op2 sr slew rate at unity gain 3v r l = 100k, c l = 100pf 7. ? v/s gbw gain bandwidt ? p ? odu ? t 3v r l = 100k, c l = 100pf ? ? hz op1 sr slew rate at unity gain 3v r l = 100k, c l = 100pf 7. ? v/s gbw gain bandwidt ? p ? odu ? t 3v r l = 100k, c l = 100pf ? ? hz instrumentation amplifer electrical characteristics symbol parameter test conditions min. typ. max. unit v dd condition v dd supply voltage ? . ? ? . ? v i ?? supply cu ?? ent ? v io= 0a 1. ? ma sr slew rate at unity gain 3v rl= 100k, cl= 100pf 7. ? v/s gbw gain bandwidt ? p ? odu ? t 3v rl= 100 k, cl= 100pf ? ? hz ger gain e ?? o ? -10% 10% vos input offset voltage 3v -1 ? 1 ? mv power-on reset characteristics symbol parameter test conditions min. typ. max. unit v dd conditions v por vdd sta ? t voltage to ensu ? e powe ? -on reset 100 mv rr vdd vdd rising rate to ensu ? e powe ? -on reset 0.03 ? v/ms v dcpor_ ? ax dc por ? aximum voltage 0.6 ? . ? v t por1 ? inimum time fo ? vdd stays at vpor to ensu ? e powe ? -on reset wit ? out 0.1 m f between vdd and vss ? s t por ? ? inimum time fo ? vdd stays at vpor to ensu ? e powe ? -on reset wit ? 0.1 m f between vdd and vss 10 s rev. 1.40 14 ? a ??? 1 ?? ? 01 ? rev. 1.40 1? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale system architecture a key factor in the high-performan ce features of the holtek range of microcontrollers is attributed to the internal system architecture. the range of devices take advantag e of the usual features found within ris c microcontrollers providing increas ed s peed of operation and enhanced performance. the pi pelining sc heme i s i mplemented i n suc h a wa y t hat i nstruction fe tching a nd i nstruction execution a re ove rlapped, he nce i nstructions a re e ffectively e xecuted i n one c ycle, wi th t he exception of branch or call ins tructions. a n 8-bit w ide a lu is us ed in practically all operations of t he i nstruction se t. it c arries out a rithmetic ope rations, l ogic ope rations, rot ation, i ncrement, decrement, branch decisions, etc. the internal data path is simplifed by moving data through the accumulator and the alu. cert ain internal re gisters are im plemented in the data memory and can be directly or indirectly addressed. the simple addressing methods of these registers along with additional architectural features ensure that a minimum of external components is required to provide a functional i/o and a/d control system with maximum reliability and fexibility. clocking and pipelining the system clock, derived from an rc oscillator is subdivided into four internally generated non-overlapping cl ocks, t1~t4.the program count er is inc remented at the beginning of the t1 clock d uring wh ich t ime a n ew i nstruction i s f etched. t he r emaining t 2~t4 c locks c arry o ut t he decoding and execution functions. in this way , one t1~t4 clock cycle forms one instruction cycle. although the fetching and execution of instructions takes place in consecutive instruction cycles, the pipelining st ructure o f t he m icrocontroller e nsures t hat i nstructions a re e ffectively e xecuted i n o ne instruction cycle. the exception to this are instructions where the contents of the program counter are changed, such as subroutine calls or jumps, in which case the instruction will take one more instruction cycle to execute. for instructions involving branches, such as jump or call instructions, two instruction cycles are required to complete instruction execution. an extra cycle is required as the program takes one cycle t o frst obt ain t he a ctual j ump or c all a ddress a nd t hen a nother c ycle t o a ctually e xecute t he branch. the requirement for this extra cycle should be taken into accou nt by programmers in timing sensitive applications. ? ? ? ? ? ? ? ? rev. 1.40 14 ?a??? 1?? ?01? rev. 1.40 1 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? ? ? ? ?? ? ? - ? ? ? ? ? ? ? ? ? -? program counter C pc during pro gram e xecution, t he progr am co unter i s use d t o ke ep t rack of t he a ddress of t he next instruction to be executed. it is automatically incremented by one each time an instruction is executed except for instructions, such as jmp or call that demand a jump to a non- consecutive program memory address. i t must be noted that only the lower 8 bits, known as the program counter low register, are directly addressable by user. when execut ing instructi ons re quiring jumps to non-consecutive addresses such as a jump instruction, a subroutine call, interrupt or reset, etc. the microcontroller manages program control by loading the required address into the program counter . for conditional skip instructions, once the condition has been met, the next instruction, which has already been fetched during the present instruction execut ion, is discarded and a dummy cycle takes its place while the correct instruction is obtained. program counter p ? og ? am counte ? hig ? byte pcl registe ? low byte pc13~pc8 pcl7~pcl0 the lower byte of the program counter , known as the program counter low register or pcl, is available for program control and is a readable and writeable register . by transferring data directly into t his r egister, a sh ort p rogram j ump c an b e e xecuted d irectly, h owever, a s o nly t his l ow b yte is a vailable for m anipulation, t he j umps a re l imited t o t he prese nt pa ge of m emory, whi ch i s 256 locations. when such program jumps are executed it should also be noted that a dummy cycle will be inserted. the lower byte of the program counter is fully accessible under program control. manipulating the pcl might cause program branchin g, so an extra cycle is needed to pre-fetch. further information on the pcl register can be found in the special function register section. rev. 1.40 16 ? a ??? 1 ?? ? 01 ? rev. 1.40 17 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale stack this is a special part of the memory which is used to save the contents of the program counter only. the stack is neither part of the data nor part of the program space, and is neither readable nor writeable. the activated level is indexed by the stack pointer , and is neither readable nor writeable. at a subroutine call or interrupt acknowledge signal, the contents of the program counter are pushed onto the stack. at the end of a subroutine or an interrupt routine, signaled by a return instruction, ret or reti, the program counter is restored to its previous value from the stack. after a device reset, the stack pointer will point to the top of the stack. if the stack is full and an enabled interrupt takes place, the interrupt request fag will be recorded but acknowledge signal will be inhibited. when the stack pointer is decremented, by ret or reti, the interrupt will be serviced. this feature prevents stack overfow allo wing the programmer to use the struct ure more easily . however , when the stack is full, a call subroutine instruction can still be execu ted which will result in a stack overfow . precautions should be taken to avoid such cases which might cause unpredictable program branching. arithmetic and logic unit C alu the arith metic-logic unit or alu is a critical area of the microcontrol ler that carries out arithmetic and logic operations of the instructi on set. connected to the main micro controller data bus, the alu receives related ins truction codes and performs the required arithmetic or logical operations after which the result will be placed in the specifed register . as these alu calculation or operations may result in carry , borrow or other status changes, the status register will be correspondingly updated to refect these changes. the alu supports the following functions: ? arithmetic operations: add, addm, adc, adcm, sub, subm, sbc, sbcm, daa ? logic operations: and, or, xor, andm, orm, xorm, cpl, cpla ? rotation rra, rr, rrca, rrc, rla, rl, rlca, rlc ? increment and decrement inca, inc, deca, dec ? branch decision, jmp, sz, sza, snz, siz, sdz, siza, sdza, call, ret, reti rev. 1.40 16 ?a??? 1?? ?01? rev. 1.40 17 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale program memory the program memory is the location where the user code or program is stored. the device is supplied with one-t ime programmable, otp , memory where users can program their application code into the device. by using the appropriate programming tools, otp devices of fer users the fexibility to freely develop their applications which may be useful during debug or for products requiring frequent upgrades or program changes. structure the program memory has a capacity of 16k16. the program memory is addressed by the program counter and also contains data, table information and interrupt entries. t able data, which can be setup in any location within the program memory, is addressed by separate table pointer registers. the device has its program memory divided into two banks, bank 0 and bank 1. the required bank is selected using bit 5 of the bp register. ? ? ? ? ? ? ? ? ?? -? ? ? ?? -? ? ? ? ? program memory structure special vectors within t he progra m me mory, c ertain l ocations a re re served for spe cial usa ge suc h a s re set a nd interrupts. ? reset vector this vect or is reserved for use by the device reset for program initialization. after a device reset is initiated, the program will jump to this location and begin execution. ? external interrupt vector this vect or is used by the external interrupt. if the external interrupt pin on the device receives an edge transition, the program will jump to this location and begin execution if the external interrupt is enabled and the stack is not full. the external interrupt active edge transition type, whether high to low, low to high or both is specifed in the ctrl1 register. ? timer/event 0/1 counter interrupt vector this internal vector is used by the t imer/event 0/1 counters. if a t imer/event counter overfow occurs, the program will jump to its respective location and begin exec ution if the associated t imer/ event counter interrupt is enabled and the stack is not full. rev. 1.40 18 ? a ??? 1 ?? ? 01 ? rev. 1.40 19 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? multi-function interrupt vector this vector is used by the multi-function interrupt. if t he t imer/event 2 counter overfow or t ouch key 16-bit or 10-bit counter overfow , the program will jump to this location and begin execution if the relevant interrupt is enabled and the stack is not full. ? a/d convertor interrupt vector this internal vector is used by the a/d convertor interrupt . if the a/d conversion process fnishes, the program will jump to this location and begin execution if the a/d convertor interrupt is enabled and the stack is not full. ? touch key interrupt vector this internal vector is us ed by the touch key interrupt . if the counter in the relevant t ouch key module overfow occurs , the program will jump to this location and begin execution if the touch key interrupt is enabled and the stack is not full. look-up table any location within the program memory can be defned as a look-up table where programmers can store fxed data. t o use the look-up table, the table pointer must frst be setup by placing the address of the look up data to be retrieved in the table pointer register , tblp . this register defnes the total address of the look-up table. after se tting u p t he t able p ointer, t he t able d ata c an b e r etrieved f rom t he pr ogram me mory u sing the t abrd c [m] or t abrdl[m] instructions, respectively . when the instruction is executed, the lower order table byte from the program memory will be transferred to the user defined data me mory r egister [ m] a s sp ecified i n t he i nstruction. t he h igher o rder t able d ata b yte f rom the program memory will be transferred to the tblh special register . any unused bits in this transferred higher order byte will be read as 0. the accompanying diagram illustrates the addressing data fow of the look-up table. ? rev. 1.40 18 ?a??? 1?? ?01? rev. 1.40 19 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale table program example the fol lowing exam ple shows how t he t able poi nter and t able dat a i s defned and retrie ved from t he microcontroller. this example uses raw table data located in the program memory which is stored there using the org statement. the value at this org statement is 3f00h which refers to the start address of the last page within the 16k words program memory of the device. the table pointer is setup here to have an initial value of 06h. this will ensure that the frst data read from the data table will be at the program memory address 3f06h or 6 locations after the start of the last page. note that the value for the table pointer is referenced to the frst address of the present page if the t abrd c [m] instruction is being used. the high byte of the table data which in this case is equal to zero will be transferred to the tblh register automatically when the tabrd l [m] instruction is executed. because the tblh register is a read-only register and cannot be res tored, care should be taken to ensure its protection if both the main routine and interrupt s ervice routine us e table read instructions. if using the table read instructions, the interrupt service routines may change the value of the tblh and subsequently cause errors if used again by the main routine. as a rule it is recommended that simultaneous use of the table read instructions should be avoided. however , in situations where simultaneous use cannot be avoided, the interrupts should be disabled prior to the execution of any main routine table-read instructions. note that all table related instructions require two instruction cycles to complete their operation. instruction(s) table location b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 tabrdc [m] pc13 pc1 ? pc11 pc10 pc9 pc8 @7 @6 @ ? @4 @3 @ ? @1 @0 tabrdl [m] 1 1 1 1 1 1 @7 @6 @ ? @4 @3 @ ? @1 @0 table location note: 1. pc13~pc8: current program counter bits 2. @7~@0: t able pointer tblp bits 3. b13~b0: table address location bits table read program example tempreg1 db ? ;temporary register #1 tempreg2 db ? ;temporary register #2 : : mov a,06h ;initialise low table pointer - note that this ;address mov tblp,a ;is referenced : : tabrdl tempreg1 ;transfers value in table referenced by table ;pointer data at program ;memory address 3f06h transferred to tempreg1 ;and tblh dec tblp ;reduce value of table pointer by one tabrdl ;tempreg2 ;transfers value in table referenced by table ;pointer data at program ;memory address 3f05h transferred to tempreg2 ;and tblh in this ; example the data 1ah is transferred to tempreg1 ;and data 0fh to register tempreg2 : : org 3f00h ;sets initial address of program memory dc 00ah, 00bh, 00ch, 00dh, 00eh, 00fh, 01ah, 01bh rev. 1.40 ? 0 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?1 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale data memory the data memory is a volatile area of 8-bit wide ram internal memory and is the location where temporary information is stored. structure the data memory is divided into four banks, bank0~3. the bank0 is subdivided into two sections, the frst of these is an area of ram, known as the special function data memory . here are located registers which are necessary for correct operation of the device. many of these registers can be read from and written to directly under program control, however , some remain protected from user manipulation. the second area of data memory is reserved for general purpose use. all locations within this area are read and write accessible under program control. the general purpose data memory bank1 and bank2 are dedicated for the lcd and sine pattern functions respectively while the bank3 is used for general purpose data memory . the total capacity of ge neral purpose da ta m emory, a vailable for de signer, i s 256 byt es, c omposed by ba nk0 a nd bank4. the accompanying table illustrates the data memory arrangement. capacity bank description ?? 6 8 bank 0(00h~3fh) spe ? ial fun ? tion data ? emo ? y( 64bytes) bank 0(40h~ffh) gene ? al pu ? pose data ? emo ? y(19 ? bytes) bank 1(40h~ ? bh) gene ? al pu ? pose data ? emo ? y fo ? lcd( ? 8 bytes) bank ? (40h~7fh) gene ? al pu ? pose data ? emo ? y fo ? sine p atte ? n(64 bytes) bank 3(40h~7fh) gene ? al pu ? pose data ? emo ? y(64 bytes) note: the data ram capacity consists of the general purpose data ram in bank0 and bank3, except the bank1 and bank2 which are assigned to the lcd and sine pattern functions. all microcontroller programs require an area of read/write memory where temporary data can be stored and retrieve d for use later . it is this area of ram memory that is known as general purpose data memory . this area of data memory is fully accessible by the user program for both read and write operations. by using the set [m].i and clr [m].i instructio ns individual bits can be set or reset under program control giving the user a lar ge range of fexibility for bit manipulation in the data memory. for this device, the data memory is divided into four banks, which are selected using a bank pointer. only data in bank 0 can be directly addressed, data in bank 1~ 3 must be indirectly addressed. ?? ? ? ?? ? rev. 1.40 ?0 ?a??? 1?? ?01? rev. 1.40 ? 1 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ??? ? ??? ? ??? ? ? ?? special purpose data memory rev. 1.40 ?? ? a ??? 1 ?? ? 01 ? rev. 1.40 ?3 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? ? ? ? ? ? ? ?? ? ??? general purpose data memory special purpose data memory this area of data memory is where registers, necessary for the correct operation of the microcontroller, are stored. most of the registers are both readable and writeable but some are protected and are readable only , the details of which are located under the relevant special function register section. note that for locat ions that are unused, any read instruction to these addresses will return the value 00h. special function registers to ensure successful operation of the microcontroller , certain internal registers are implemented in the data memory area. these registers ensure correct operation of internal functions such as timers, interrupts, etc., as well as external functions such as i/o data control. the location s of these registers within the data memory begin at the address 00h and are mapped into from bank 0 to bank 3 . any unused data memory locations between these special function registers and the point where the general purpose memory begins is reserved and attempting to read data from these locations will return a value of 00h. indirect addressing registers C iar0, iar1 the indirect addressing registers, iar0 and iar1, although having their locations in normal ram register space, do not actually physically exist as normal registers. the method of indirect addressing for ram data manipulation uses these indirect addressing registers and memory pointers, in contrast to direct memory addressing, where the actual memory address is specifed. actions on the iar0 and iar1 registers will result in no actual read or write operatio n to these registers but rather to the memory location specifed by their corresponding memory pointers, mp0 or mp1. acting as a pair, iar0 and mp0 can together access data from bank 0 while the iar1 and mp1 register pair can access data from any bank. as the indirect addressing registers are not physically implemented, reading the indirect addressing registers indirectly will return a result of 00h and writing to the registers indirectly will result in no operation. memory pointers C mp0, mp1 two memory pointers, known as mp0 and mp1 are provided. these memory pointers are physically implemented in the data memory and can be manipulated in the same way as normal registers providing a convenient way with which to indirectly address and track data. mp0 can only be used to indirectly address data in bank 0 while mp1 can be used to address data from bank 0 to bank 3 . when any operation to the relevant indirect addressing registers is carried out, the actual address that the microcontroller is directed to, is the address specifed by the related memory pointer . note that indirect addressing using mp1 and iar1 must be used to access any data in bank 1~bank 3. the following example shows how to clear a section of four data memory locations already defned as locations adres1 to adres4. rev. 1.40 ?? ?a??? 1?? ?01? rev. 1.40 ? 3 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale indirect addressing program example data .section data adres1 db ? adres2 db ? adres3 db ? adres4 db ? block db ? code .section at 0 code org00h start mov a 04h ;setup size of block mov block a mov a offset adres1 ;accumulator loaded with frst ram address mov mp0 a ;setup memory pointer with frst ram address loop clr iar0 ;clear the data at address defned by mp0 inc mp0 ;increment memory pointer sdz block ;check if last memory location has been cleared jmp loop continue accumulator C acc 7kh ffxpxodwru lv fhqwudo wr wkh rshudwlrq ri dq plfurfrqwuroohu dqg lv forv ho uhodwhg z lwk rshudwlrqv fduulhg rxw wkh /8 7kh ffxpxodwru lv wkh sodfh zkhuh doo lqwhuphgldwh uhvxowv iurp wkh /8 duh vwruhg : lwkrxw wkh ffxpxodwru lw zrxog h qhfhvvdu wr zulwh wkh uhvxow ri hdfk f dofxodwlrq ru o rjlfdo rsh udwlrq vxf k d v d gglwlrq vxw udfwlrq vkl iw h wf w r w kh d wd 0h pru uhvxowlqj l q kljkh u surjudp plqj dqg w lplqj ryhukhdgv d wd w udqvihu rshudw lrqv xvxdo o l qyroyh wkh w hpsrudu vw rudjh ixqf wlrq ri w kh f fxpxodwru iru h [dpsoh zk hq w udqvihuulqj gd wd h wzhhq rqh xvhu ghil qhg uhjl vwhu dqg dqrw khu lw lv qhfhvvdu wr gr wklv sdvvlqj wkh gdwd wkurxjk wkh ffxpxodwru dv qr gluhfw wudqvihu hwzhhq wzr uhjlvwhuv lv shuplwwhg program counter low register C pcl 7r surylgh dgglwlrqdo surjudp frqwuro ixqfwlrqv wkh orz wh ri wkh 3urjudp &rxqwhu lv pdgh dffhvvloh wr surjudpphuv orfdwlqj lw zlwklq wkh 6shfldo 3xusrvh duhd ri wkh dwd 0hpru pdqlsxodwlqj wklv uhjlvwhu gluhfw mxpsv wr rwkhu surjudp orfdwlrqv duh hdvlo lpsohphqwhg /rdglqj d ydoxh gluhfwo lqwr wklv 3&/ uhjlvwhu zloo fdxvh d mxps wr wkh vshflhg 3urjudp 0hpru orfdwlrq rzhyhu dv wkh uhjlvwhu lv rqo lw zlgh rqo mxpsv zlwklq wkh fxuuhqw 3urjudp 0hpru sdjh duh shuplwwhg :khq vxfk rshudwlrqv duh xvhg qrwh wkdw d gxpp ffoh zloo h lqvhuwhg rev. 1.40 ? 4 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bank pointer C bp in this device, the program and data memory are divided into several banks. selecting the required program and data memory area is achieved using the bank pointer . bit 5 of the bank pointer is used to select program memory bank 0 or 1, while bits 0~ 1 are used to select data memory banks 0~3 . the data memory is initialised to bank 0 after a reset, except for the wdt time-out reset in the power down mode, in which case, the data memory bank remains unaf fected. it should be noted that special function data memory is not af fected by the bank selection, which means that the special function registers can be accessed from within any bank. directly addressing the data memory will always result in bank 0 being accessed irrespective of the value of the bank pointer . accessing data from banks other than bank 0 must be implemented using i ndirect addressing. as both the program memory and data memory share the same bank pointer register , care must be taken during programming. bp register bit 7 6 5 4 3 2 1 0 name p ? bp0 d ? bp1 d ? bp0 r/w r/w r/w r/w por 0 0 0 bit 7 ~ 6 unimplemented, read as 0 bit 5 : program memory bank pointer 0: bank 0, program memory address is from 0000h ~ 1fffh 1: bank 1, program memory address is from 2000h ~ 3fffh bit 4 ~ 2 unimplemented, read as 0 bit 1 ~ 0 : data memory bank pointer 00: bank 0 (for general purpose) 01: bank 1 (for lcd) 10: bank 2 (for sine generator) 11: bank 3 (for general purpose) status register C status this 8-bit regis ter contains the zero flag(z), carry flag (c), auxiliary carry flag(a c), overflow flag(ov), power down flag(pdf), and watchdog time-out flag(t o). these arithmetic/logical operation and system management flags are used to record the status and operation of the microcontroller. with the exceptio n of the t o and pdf fags, bits in the status register can be altered by instructions like any other register . any data written into the status register will not change the t o and pdf flags. in addition operations related to the status register may give dif ferent results from those intended. the t o fag can be af fected only by system power -up, a wdt time-out or executing the halt or clr wdt instruction. the pdf fag can be af fected only by executing the hal t or clr wdt instruction or a system power-up. the z, ov, c, ac fags generally refect the statuses of the latest operations. in addition, on entering the interrupt sequence or executing the subroutine call, the status register will not be pushed onto stack automatically . if the contents of status are important and the subroutine can corrupt the status register , the programmer has to take precautions to save it properly. rev. 1.40 ?4 ?a??? 1?? ?01? rev. 1.40 ?? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale status register bit 7 6 5 4 3 2 1 0 name to pdf ov z ac c r/w r r r/w r/w r/w r/w por 0 0 x x x x "x" unknown bit 7~6 unimplemented, read as "0" bit 5 to : w atchdog t ime-out fag 0: after power up or executing the "clr wdt" or "halt" instruction 1: a watchdog time-out occurred. bit 4 pdf : power down fag 0: after power up or executing the "clr wdt" instruction 1: by executing the "halt" instruction bit 3 ov : overfow fag 0: no overfow 1: an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit or vice versa. bit 2 z : zero fag 0: the result of an arithmetic or logical operation is not zero 1: the result of an arithmetic or logical operation is zero bit 1 ac : auxiliary fag 0: no auxiliary carry 1: an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction bit 0 c : carry fag 0: no carry-out 1: an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation c is also affected by a rotate through carry instruction system control registers C ctrl0, ctrl1 these registers are used to provide control o ver various internal functions. some of these include the timer/event counter 2 internal source option , the lcd driver clock (fsub) option, power down mode clock control, certain system clock options, external interrupt edge trigger type, and the 32.768khz crystal oscillator (lxt) enable contr ol. ctrl0 register bit 7 6 5 4 3 2 1 0 name tcks1 tcks0 lfs lcdck1 lcdck0 fsubc fsubs lxtlp r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 0 0 1 bit ~6 tcks1~tcks0 : t imer/event counter 2 internal source selection 0 0: l (low frequency clock) 0 1: f ref (reference frequency clock generated from t ouch key module) 10: f sen (sensor frequency clock generated from t ouch key module) 11: f tmck (gated sensor frequency clock generated from t ouch key module) if the t ouch key module is disabled, the tcks1 and tcks0 bits are always set to 00 and can not be written to. rev. 1.40 ? 6 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?7 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale bit 5 lfs : low frequency clock source f l selection 0: lirc oscillator 1: lxt oscillator bit 4 ~3 lcdck1~lcdck0 : to select the lcd driver clock 00: lcd clock = f sub /3 01: lcd clock = f sub /4 10 : lcd clock = f sub /8 11: lcd clock = f sub /8 bit2 fsubc : f sub power down mode clock control 0: disabled 1: enabled bit1 fsubs : f sub clock source selection 0: lirc oscillator 1: lxt oscillator bit0 lxtlp : lxt oscillator low power control function 0: lxt oscillator quick start-up mode 1: lxt oscillator low power mode name eintc1 eintc0 bzcs lxten r/w r/w r/w r/w r/w por 0 0 0 1 bit 7 ~6 eintc1, eintc0 : external interrupt edge selection 00: disable 01: falling edge trigger 10: rising edge trigger 11: dual edge trigger bit 5 ~2 unimplemented, read as 0 bit 1 bzcs : buzzer clock source selection 0: from t imer/event counter 0 1: from t imer/event counter 1 bit 0 lxten : lxt oscillator control in power down mode 0: disabled 1: enabled rev. 1.40 ?6 ?a??? 1?? ?01? rev. 1.40 ? 7 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale oscillator confguration the device provides three system oscillator circuits known as a crystal oscillator (hxt), an external rc oscill ator (erc) and an internal high speed rc oscillator (hirc) which are used for the system clock. there are also an internal 12khz rc (lirc) and a 32.768khz crystal oscillator (lxt) which can provide a source clock for the wdt clock named f s , the lcd driver clock, named f sub and the timer/event counters low frequency clock, named f l ,for various timing purposes. erc lxt lirc high frequency oscillation ( hosc ) low frequency oscillation ( losc ) lfs f l f sys f sys /4 f sub wdt timer fs hirc hxt configuration option ?halt? oscon f sys fsubs lcd ?halt? fsubc prescaler (/3, /4, /8 ) lcdck [1:0] f sys / 4 configuration option system clock confgurations in t he po wer down m ode, t he syst em osc illator, t he i nternal 12khz rc osc illator (l irc) or t he external 3 2.768khz c rystal o scillator ( lxt) m ay b e e nabled o r d isabled d epending u pon t he corresponding clock control bit described in the relevant sections. the system can be woken-up from the power down mode by the occurrence of an interrupt, a transition determined by confguration options o n a ny o f t he po rt a p ins, a w dt o verfow o r a t imer o verfow. t he a ccompanying t able illustrates the oscillator type list. type name freq. pins exte ? nal c ? ystal hxt 400khz~ 1 ? ? hz osc1/osc ? exte ? nal rc erc 400khz~ 1 ? ? hz osc1 inte ? nal hig ? speed rc hirc 4 ? 8 o ? 1 ?? hz exte ? nal low speed c ? ystal lxt 3 ? .768khz xt1/ xt ? inte ? nal low speed rc lirc 1 ? khz oscillator types rev. 1.40 ? 8 ? a ??? 1 ?? ? 01 ? rev. 1.40 ?9 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale external crystal/ceramic oscillator C hxt the external crystal/ceramic system oscillator is one of the system oscillator choices, which is selected via confguration options. for most crystal oscillator confgurations, the simple connection of a crysta l across osc1 and osc2 will create the necessary phase shift and fe edback for oscillation, wi thout r equiring e xternal c apacitors a nd r esistors. ho wever, i f a r esonator i nstead o f crystal is connecte d between osc1 and osc2, to ensure oscillation, it may be necessary to add two small value capac itors, c1 and c2. using a ceramic resonator will usually require two small value capacitors, c1 and c2, to be connected for oscillation to occur . the values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturers specifcation. for oscillator stability and to minimise the ef fects of noise and crosstalk, it is important to ensure that the crystal and any associated resistors and capacitors along with inter connecting lines are all located as close to the mcu as possible. ? ? ?? ?? external rc oscillator C erc using t ? e erc os ? illato ? only ? equi ? es t ? a t a ? esisto ?? wit ? a value between ? 4k and 1. ?? ? is ? onne ? ted between osc1 and vdd ? and a ? apa ? ito ? is ? onne ? ted between osc1 and g ? ound ? p ? oviding a low ? ost os ? illato ? ? onfigu ? ation. it is only t ? e exte ? nal ? esisto ? t ? at dete ? mines t ? e os ? illat ion f ? equen ? y; t ? e exte ? nal ? apa ? ito ? ? as no influen ? e ove ? t ? e f ? equen ? y and is ? onne ? ted fo ? stability pu ? poses only. devi ? e t ? imming du ? ing t ? e manufa ? tu ? ing p ? o ? ess and t ? e in ? lusion of inte ? nal f ? equen ? y ? ompensation ? i ?? uits a ? e used wrhqvxuhwkdwwkhlqxhqfhriwkhsrzhuvxssoyrowdjhwhpshudwxuhdqgsurfhvvyduldwlrqv on t ? e os ? illation f ? equen ? y a ? e minimised. as a ? esistan ? e/ f ? equen ? y ? efe ? en ? e point ? it ? an be noted t ? at wit ? an exte ? nal 1 ? 0k ? esisto ? ? onne ? ted and wit ? a ? v voltage powe ? supply and tempe ? atu ? e of ?? deg ? ees ? t ? e os ? illato ? will ? ave a f ? equen ? y of 4 ? hz wit ? in a tole ? an ? e of ? %. he ? e only t ? e osc1 pin is used ? w ? i ?? is s ? a ? ed wit ? i/o pin pa6 ? leaving pin pa ? f ? ee fo ? use as a no ? mal i/o pin. fo ? os ? illato ? stability and to minimise t ? e effe ? ts of noise and ?? osstalk ? it is impo ? tant to lo ? ate t ? e ? apa ? ito ? and ? esisto ? as ? lose to t ? e ? cu as possible. external rc oscillator C erc rev. 1.40 ?8 ?a??? 1?? ?01? rev. 1.40 ? 9 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale internal rc oscillator C hirc the internal rc oscillator is a fully integrated system oscillator requiring no external components. the i nternal r c o scillator h as t hree fx ed f requencies o f e ither 4 mhz, 8 mhz o r 1 2mhz. de vice trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the infuence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. as a result, at a power supply of either 3v or 5v and at a temperature of 2 5 degrees, the fxed oscillation frequency of 4mhz, 8mhz or 12mhz will have a tolerance within 2%. note that if this internal system clock option is selected, as it requires no external pins for its operation, i/o pins pa5 and pa6 are free for use as normal i/o pins. external 32.768khz crystal oscillator C lxt the external 32.768khz crys tal o scillator is one of the low frequency oscillator choices, w hich is se lected v ia a c onfguration o ption. t his c lock so urce h as a fx ed f requency o f 3 2.768khz a nd requires a 32.768khz crystal to be connected between pins xt1 and xt2. the external resistor and capacitor components connected to the 32.768khz crystal are necessary to provide oscillation. for applications where precise frequencies are essential, these components may be required to provide frequency compen sation due to dif ferent crystal manufacturing toleranc es. during power -up there is a time delay associated with the lxt oscillator waiting for it to start-up. when t he m icrocontroller e nters t he powe r down mode , t he syst em c lock i s swi tched of f t o st op microcontroller activity and to conserve power . however , in many microcontroller applications it may be necessary to keep the internal timers operational even when the microcontroller is in the power down mode. t o do this, another clock, independent of the system clock, must be provided. the exact values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturers specifcation. the external parallel feedback resistor, rp, is required. for oscillator stability and to minimise the ef fects of noise and crosstalk, it is important to ensure that the crystal and any associated resistors and capacitors along with inter connecting lines are all located as close to the mcu as possible. ? ? ? ?? ??-? ? ? ? lxt oscillator c1 and c2 values crystal frequency c1 c2 3 ? 768hz 8pf 10pf note: 1. c1 and c ? values a ? e fo ? guida n ? e only. ? . r p 0a0lvuhfrpphqghd. 32768hz c rystal recommended capacitor values rev. 1.40 30 ? a ??? 1 ?? ? 01 ? rev. 1.40 31 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale lxt oscillator low power function the lxt oscillator can function in one of two modes, the quick start mode and the low power mode. the mode selection is executed using the lxtlp bit in the ctrl0 register. lxtlp bit lxt mode 0 qui ? k sta ? t 1 low-powe ? after power on, the lxtlp bit will be automatically cleared to zero ensuring that the lxt oscillator is in the quick start operating mode. in the quick start mode the lxt oscillator will power up and stabilise quickly . however , after the lxt oscillator has fully powered up it can be placed into t he l ow-power m ode b y se tting t he l xtlp b it h igh. t he o scillator wi ll c ontinue t o r un b ut with reduced current consumption, as the higher current consumption is only required during the lxt oscillator start-up. in power sensitive applications, such as battery applications, where power consumption must be kept to a minimum, it is therefore recommended that the application program sets the lxtlp bit high about 2 seconds after power-on. it shou ld be no ted t hat, no m atter wha t c ondition t he l xtlp bi t i s se t t o, t he l xt osc illator wi ll always function normally; the only dif ference is that it will take more time to start up if in the low- power mode. internal 12khz oscillator C lirc the internal 12khz rc oscillator is one of the low frequency oscillator choices, which is selected via confguration option. it is a fully integrated rc oscillator with a typical period of approximately 65us at 5v , requiring no external components for its implementation. if the system enters the power down mode, the internal rc oscillator can still continue to run if its clock is necessary to be used to clock the functions for timing purpose s uch as the wd t function, lcd d river or t imer/event counters . the i nternal rc osc illator c an be di sabled onl y whe n i t i s not use d a s t he c lock sourc e for a ll t he peripheral functions determined by the confguration options of the wdt function and the relevant control bits which determine the clock is enabled or disabled for related peripheral functions. watchdog timer C wdt the w atchdog t imer is provided to prevent program malfunctions or sequences from jumping to unknown locations, due to certain uncontrollable external events such as electrical noise. watchdog timer clock source the wdt is implemented using an internal 12khz rc oscillator known as lirc, the external lxt 32.768khz oscillator or the instruction clock which is the system clock divided by 4. watchdog timer operation the timer is designed to prevent a software malfunction or sequence from jumping to an unknown location with unpredictable results. a confguration option determines whether the w atchdog t imer is to be always on or whether its enable/disable control is under software control. if the confguration option chooses the always on option, then any we4~we0 values other than 01010 or 10101 will result i n a n mcu re set be ing ge nerated. if t he c onfguration opt ion c hooses t he soft ware c ontrol option then the w atchdog t imer can be disabled by setting the we4~we0 bits to a 10101 value. a value of 01010 will enable the w atchdog t imer and any other value will generate an mcu reset. the actual reset will be generated after 2~3 lirc clock cycles. rev. 1.40 30 ?a??? 1?? ?01? rev. 1.40 31 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale wdt confg. option we4 ~ we0 bits wdt function always on 01010 enabled 10101 enabled ot ? e ? values ? cu ? eset gene ? ated afte ? ? ~3 lirc ? lo ? k ? y ? les softwa ? e cont ? ol 01010 enabled 10101 disabled ot ? e ? values ? cu ? eset gene ? ated afte ? ? ~3 lirc ? lo ? k ? y ? les wdt functional control summary the application can generate a software reset by writing a value other than 01010 and 10101 into the we4~we0 bits. if this is done then the wrf fag in the wdtc1 register will be set. the w dt c lock i s di vided by a n i nternal c ounter t o gi ve a ra tio di vision wi th a ra nge of 2 8 ~2 15 selected using the ws0~ws2 bits, to give a longer watchdog time-out period. if the watchdog timer is disabled, the wdt timer will not generate a chip reset. so in the watchdog timer disable mode, the wdt timer counter can be read out and can be cleared. this function is used for the application program to access the wdt frequency to get the temperature coeffcient for analog component adjustment. the lirc oscillator can be disabled or enabled by the oscillator enable control bits lircen1 and lircen0 in the wdt control register wdtc for power saving reasons . there are three registers related to the wdt function named wdtc, wdtc1 and wdtd. the wdtc a nd w dtc1 r egisters c ontrol t he w dt o scillator e nable/disable a nd t he w dt p ower source. the wdtd register is the wdt counter content register and is read only. the wdt power source selection bits named lircpwr1 and lircpwr0 are used to choose the wdt p ower so urce. t he w dt d efault p ower so urce i s f rom voc hp. t he m ain p urpose o f t he regulator is to be used for wdt t emperature-coeffcient adjustment. in this case, the application program s hould enable the regulator before sw itching to the regulator s ource. the lircen1 and lircen0 bits can be used to enable or disable the lirc oscillator . if the application does not use the lirc oscillato r, then it needs to disable it in order to save power . when the lirc oscillator is disabled, then it is actually turned of f, regardles s of the s etting of the relevant control bits w hich select the lirc oscillator as its clock source. when the lirc oscillat or is enabled, it can be used as the clock source in the power down mode defined by the corresponding control bits of the peripheral functions. the wdt clock source may also come from the instruction clock, in which case the wdt will operate in the same manner except that in the power down mode the wdt may stop counting and lose its protecting purpose. if the device operates in a noisy environment, using the on-chip lirc oscillator is strongly recommended, since the halt instruction will stop the system clock. when the wdt overfows under normal operation a device reset will be executed and the status bit to will be set. in the power down mode, the overfow executes a warm reset, here only the pc and sp bits are reset to zero. there are three methods to clear the contents of the wdt , an external reset - a low level on res -, a software instruction or a halt instruction. there are two types of software instructions; the single clr wdt instruction, or the pair of instructions, clr wdt1 and clr wdt2. of these two types of instruction, only one type of i nstruction ca n be ac tive at a t ime depending on t he confgura tion opti on C cl r wdt t imes selection option. if the clr wdt is selected (i.e., clr wdt times equal one), any execution of the clr wdt instruction clears the wdt . if the clr wdt1 and clr wdt2 option is chosen (i.e., cl r w dt t imes e qual t wo), t hese t wo i nstructions ha ve t o be e xecuted t o c lear t he w dt, otherwise the wdt may reset the device due to a time-out. rev. 1.40 3 ? ? a ??? 1 ?? ? 01 ? rev. 1.40 33 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? ?? ? ? ? ?- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??? ?? ? ? - ? ? ? ? ? watchdog timer wdtc register bit 7 6 5 4 3 2 1 0 name ws ? ws1 ws0 lircen1 lircen0 lircpwr1 lircpwr0 r/w r/w r/w r/w r/w r/w r/w r/w por 1 1 1 s s 0 1 bit 7~5 ws2~ws0 : wdt prescaler rate select 000: 2 8 /f 001: 2 /f 010: 2 10 /f 011: 2 11 /f 100: 2 12 /f 101: 2 13 /f 110: 2 14 /f 111: 2 15 /f bit 4 unimplemented, read as "0" bit 3~2 lircen1 ~ lircen0 : lirc oscillator enable/disable control bits 00: lirc oscillator is enabled 01: lirc oscillator is disabled 10: lirc oscillator is enabled 11: lirc oscillator is enabled it is strongly recommended to use 10 for wdt osc enable bit 1~0 lircpwr1~ lircpwr0 : lirc power source select 00: wdt power comes from vochp 01: wdt power comes from vochp 10: wdt power comes from regulator 11: wdt power comes from vochp it i s st rongly re commended t o use 01 for vochp t o pre vent t he noi se t o l et t he wdt lose the power the wdt clock (f ) is further divided by an internal counter to give longer watchdog time-out period. in this device, the division ratio can be varied by selecting dif ferent values of ws2~ws0 bits to give 2 8 /f to 2 15 /f division ratio range. rev. 1.40 3? ?a??? 1?? ?01? rev. 1.40 33 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale wdtc1 register bit 7 6 5 4 3 2 1 0 name we4 we3 we ? we1 we0 lvrf lrf wrf r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 x 0 0 bit 7 ~ 3 we4~we0 : wdt enable/disable/mcu reset control 01010b: enable C power on value 10101b: function depends upon wdt confguration option. for the wdt always on option this value will enable the wdt . for the software control option this value will disable the wdt . other values: generates mcu reset after 2~3 lirc clock cycles. bit 2 lvrf : lvrf reset fag 0: lvr not active 1: lvr active this bit can be cleared to 0 by the application program, but can not be set to 1. bit 1 lrf : reset caused by l vrc setting 0: not active 1: active this bit can be cleared to 0 by the application program, but can not be set to 1. bit 0 wrf : reset generated by we4~we0 bits wdtd register bit 7 6 5 4 3 2 1 0 name wdtd7 wdtd6 wdtd ? wdtd4 wdtd3 wdtd ? wdtd1 wdtd0 r/w r r r r r r r r por 0 0 0 0 0 0 0 0 bit 7~0 wdtd7~ wdtd0 : wdt counter value (bit 4~bit 11) this register is read only and used for temperature adjusting rev. 1.40 34 ? a ??? 1 ?? ? 01 ? rev. 1.40 3? ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale operating modes the devic e has two operational modes, the normal mode and the power down mode. in the normal mode, the high speed system clock may come from external rc (erc), external crystal (hxt) or interna l rc (hirc) oscillator . when in the power down mode, the clocks in this device are all enabled or di sabled using software. the accompanying tabl e illustrates the operating modes and system clock control. operating mode control halt instruction mode system oscillator fsubc f sub clock lxten lxt oscillator (xt1/xt2) not exe ? uted no ? mal on x enable x on exe ? uted powe ? down on(oscon=1) off(oscon=0) 0 disable 1 on powe ? down on(oscon=1) off(oscon=0) 1 enable 1 on powe ? down on(oscon=1) off(oscon=0) 0 disable 0 off powe ? down on(oscon=1) off(oscon=0) 1 enable 0 off note: the lircen1 and lircen0 bits in the wdtc register can be setup to enable the lirc. if the lvr i s e nabled, t hen t he l irc wi ll a lso b e e nabled. ho wever, a s t he l irc i s p owered b y t he internal v oltage re gulator, whi ch i s c ontrolled by t he re gen bi t i n t he chprc re gister, t hen when the regen bit is cleared to zero, the lirc and the l vr will both be disabled. therefore, the regen bit should be set 1 to enable these two functions. refer to the wdt section for the details regarding the wdt osc setup. power down mode the power down mode is initialised by the halt instruction and results in the following. ? the system oscillator stops running if the system oscillator is selected to be turned off by clearing the oscon bit in the haltc register to zero. otherwise, the system oscillator will keep running if it is selected to be turned on in the power down mode. ? the contents of the data memory and of the registers remain unchanged. ? the wdt is cleared and starts recounting if the wdt clock source is from the lirc or the lxt oscillator. ? all i/o ports maintain their original status. ? the pdf fag is set but the t o fag is cleared. ? the lcd driver keeps running if the lcd clock f sub is enabled by setting the fsubc bit high and the lcdon bit in the haltc register is set high. the system leav es the power down mode by means of an external reset, an interrupt, an external transition signal on port a, or a wdt overfow . an external reset causes a device initialisation, and the wdt overfow performs a warm reset. after examining the t o and pdf fags, the reason for the device reset can be determined. the pdf fag is cleared by system power -up or by executing the clr wdt instructio n, and is set by executing the halt i nstruction. on t he ot her ha nd, t he t o fa g i s se t i f w dt t ime-out oc curs, and causes a wake-up that only resets the program counter and sp , and leaves the others in their original state. rev. 1.40 34 ?a??? 1?? ?01? rev. 1.40 3 ? ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale the port a wake-up and interrupt methods can be considered as a conti nuation of normal execution. each pin of port a can be independently selected to wake-up the device using configuration options. after awakening from an i/o port stimulus, the program will resume execution at the next instruction. however , if awakening from an interrupt, two sequences may occur . if the related interrupt i s di sabled or t he i nterrupt i s e nabled bu t t he st ack i s ful l, t he pr ogram wi ll re sume execution at the next instruction. but if the interrupt is enabled, and the stack is not full, the regular interrupt response takes place. when an interrupt request flag is set before entering the hal t status, the system cannot be awakened using that interrupt. if a wake-up events occur , it takes a number of clock cycles to resume normal operation. in other words, a dummy period is ins erted after the w ake-up. if the w ake-up res ults from an interrupt acknowledgment, t he a ctual i nterrupt subrout ine e xecution i s de layed by m ore t han one c ycle. however, if the wake-up results in the next instruction execution, the execution will be performed immediately after the dummy period is fnished. t o minimise power consumption, all the i/o pins should be carefully managed before entering the halt status. the accompanying table illustrates the wake-up delay time for dif ferent sys tem clock sources .the sst time is decided by sst confguration option and the oscon bit in the haltc register. fsys clock source sst selection oscon sst time ( n: number of fsys clock ) xtal 0 0 n= 10 ? 4 0 1 n= ? 1 0 n= 10 ? 4 1 1 n= ? erc 0 0 n= 10 ? 4 0 1 n= ? 1 0 n= ? 1 1 n= ? hirc 0 0 n= 10 ? 4 0 1 n= ? 1 0 n= ? 1 1 n= ? required wake-up clock cycles haltc register bit 7 6 5 4 3 2 1 0 name oscon lcdon r/w r/w r/w por 0 0 bit 7 oscon : system oscillator state in the power down mode 0: system oscillator stops running 1: system oscillator keeps running bit 6~1 unimplemented, read as 0 bit 0 lcdon : lcd module state in the power down mode 0: lcd state is determined by the lcd_on confguration option 1: lcd module remains on (if the f is active) regardless of the confguration option setting rev. 1.40 36 ? a ??? 1 ?? ? 01 ? rev. 1.40 37 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale reset and initialisation a reset function is a fundamental part of any microcontroller ensuring that the device can be set to some predetermined condition irrespective of outside parameters. the most important reset condition is after power is frst applied to the microcontroller . in this case, internal circuitry will ensure that the microcontroller , after a short delay , will be in a well defned state and ready to execute the frst program instruction. after this power -on reset, certain important internal registers will be set to defned states before the program commences. one of these registers is the program counter, which will be reset to zero forcing the microcontroller to begi n progra m e xecution from t he l owest program me mory a ddress. in a ddition t o t he powe r- on reset, situations may arise where it is necessary to forcefully apply a reset condition when the microcontroller i s running. one exam ple of t his is where afte r power has been appli ed and the microcontroller is already running, the res line is forcefully pulled low . in such a case, known as a n ormal o peration r eset, so me o f t he m icrocontroller r egisters r emain u nchanged a llowing t he microcontroller to proceed with normal operation after the reset line is allowed to return high. another type of reset is w hen the watchdog t imer overflow s and resets the microcontroller . a ll types of reset operations result in dif ferent register conditions being setup. another reset exists in the form of a low v oltage reset, l vr, where a full reset, similar to the res reset is implemented in situations where the power supply voltage falls below a certain threshold. reset functions there are five w ays in w hich a microcontroller res et can occur , through events occurring both internally and externally: power-on reset the m ost fund amental a nd una voidable re set i s t he one t hat oc curs a fter powe r i s frst a pplied t o the microcontroller . as well as ensuring that the program memory begins execution from the frst memory address, a pow er-on reset als o ensures that certain other registers are preset to known conditions. all the i/o port and port control registers will power up in a high condition ensuring that all pins will be frst set to inputs. 1 r w h w 5 6 7 ' l v s r z h u r q g h o d \ w \ s l f d o w l p h p v power-on reset timing chart for the applicatio n a resistor connected between vdd and the res pin and a capacitor connected between vss and the res pin will provide a suitable externa l reset circuit. any wiring connecte d to the res pin should be kept as short as possible to minimise any stray noise interference. for the application that operate s within an environment where more noise is present the enhanced reset circuit shown is recommended. rev. 1.40 36 ?a??? 1?? ?01? rev. 1.40 37 ? a ??? 1 ?? ? 01 ? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale note: * it is recommended that this component is added esd protection. ** it is recommended that this component is added in environments where power line noise is signifcant. external res circuit more information regarding external reset circuits is located in application note ha0075e on the holtek website res pin reset this type of reset occurs when the microcontroller is already running and the res pin is forcefully pulled low by exte rnal hardware such as an external switch. in this case as in the case of other reset, the program counter will reset to zero and program execution initiated from this point. 1 r w h w 5 6 7 ' l v s r z h u r q g h o d \ w \ s l f d o w l p h p v res reset timing chart low voltage reset C lvr the mi crocontroller cont ains a low volt age reset circui t in orde r to moni tor the supply volt age of the devic e . the l vr function has a specifc l vr voltage v lvr . if the supply voltage of the device drops to within a range of 0.9v~v lvr such as might occur when changing the battery , the l vr will automatically r eset t he d evice i nternally and t he l vrf b it i n t he w dtc1 r egister wi ll a lso b e se t to 1 . t he l vr i ncludes t he fol lowing spe cifcations: for a va lid l vr si gnal, a l ow vol tage, i .e., a voltage in the range between 0.9v~v lvr must exist for greater than the value t lvr specifed in the a.c. characteristics. if the low voltage state does not exceed t lvr , the l vr will ignore it and will not perform a reset function. one of a range of specifed voltage value s for v lvr can be selected by the l vs bits in the l vrc register . if the l vs7~lvs0 bits have any other value, which may perhaps occur due to adverse environmental conditions such as noise, the l vr will reset the device after 2~3 lirc clock cycles . w hen this happens, the lrf bit in the wd tc1 register w ill be set to 1. after power on the register will have the value of 01010101b. note that the l vr function will be automatically disabled when the device enters the power down mode. 1 r w h w 5 6 7 ' l v s r z h u r q g h o d \ w \ s l f d o w l p h p v low voltage reset timing chart rev. 1.40 38 ? a ??? 1 ?? ? 01 ? rev. 1.40 39 ?a??? 1?? ?01? ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ht45r2k-c/-b/-a dual slope 16k/8k/4k assp mcu for body fat scale ? lvrc register bit 7 6 5 4 3 2 1 0 name lvs7 lvs6 lvs ? lvs4 lvs3 lvs ? lvs1 lvs0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 0 1 0 1 0 1 0 1 bit 7~0 : lvr voltage select 01010101: 2.1v (default) 00110011: 2.55v 10011001: 3.15v 10101010: 3.8v other values: generates mcu reset C register is reset to por value when an actual low voltage condit ion occurs, as specifed by one of the four defned lvr voltage values above, an mcu reset will be generated. the reset operation will be activated after 2~3 lirc clock cycles . in this s ituation the regis ter contents w ill remain the same after such a reset occurs. any register value, other than the four defned register values above, will also result in the generation of an mcu reset. the reset operation will be activated after 2~3 lirc clock cycles. however in this situation the register contents will be reset to the por value. watchdog time-out reset during normal operation the w atchdog t ime-out re set duri ng norm al opera tion i s t he sam e a s a ha rdware res pi n re set except that the w atchdog time-out fag t o will be set to 1. 1 r w h w 5 6 7 ' l v s r z h u r q g h o d \ w \ s l f d o w l p h p v wdt time-out reset during normal operation timing chart watchdog time-out reset during power down mode the w atchdog tim e-out reset during power down mode is a little dif ferent from other kinds of reset. most of the conditions remain unchanged except that the program counter and the stack pointer will be c leared t o 0 a nd t he t o fa g wi ll be se t t o 1 . re fer t o t he a.c. cha racteristics for t sst details. 1 r w h 7 k h w 6 6 7 f d q e h f k r v h q w r e h h l w k h u r u f o r f n f \ f o h v y l d f r q ? j x u d w l r q r s w l r q l i w k h v \ v w h p f o r f n v r x u f h l v s u r y l g h g e \ ( 5 & r u + , 5 & |