![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b revision: v1.10 date: ?a? 0?? ?01? ?a? 0?? ?01?
rev. 1.10 ? ?a? 0?? ?01? rev. 1.10 3 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu table of contents eates cpu features ......................................................................................................................... 6 peripheral features ................................................................................................................. 6 general description ......................................................................................... 7 selection table ................................................................................................. 7 block diagram .................................................................................................. 7 pin assignment ................................................................................................ 8 pin description .............................................................................................. 10 absolute ?aximum ratings .......................................................................... 1? d.c. characteristics ....................................................................................... 1? a.c. characteristics ....................................................................................... 14 adc characteristics ...................................................................................... 15 dac electrical characteristics ..................................................................... 15 power-on reset characteristics ................................................................... 15 s?stem architecture ...................................................................................... 16 clocking and pipelining ......................................................................................................... 16 program counter ................................................................................................................... 17 stack ..................................................................................................................................... 18 arithmetic and logic unit C alu ........................................................................................... 18 program ?emor? ........................................................................................... 19 structure ................................................................................................................................ 19 special vectors ..................................................................................................................... ?0 look-up table ........................................................................................................................ ?0 table program example ........................................................................................................ ?1 data ?emor? .................................................................................................. ?? structure ................................................................................................................................ ?? special purpose data ?emor? ............................................................................................. ?3 special function registers ........................................................................... ?4 indirect addressing registers C iar0 ? iar1 ......................................................................... ?4 ?emor? pointers C ?p0? ?p1 .............................................................................................. ?4 accumulator C acc ............................................................................................................... ?7 program counter low register C pcl .................................................................................. ?7 bank pointer C bp ................................................................................................................. ?7 status register C status .................................................................................................... ?8 input/output ports and control registers ............................................................................. ?9 s?stem control registers C ctrl0? ctrl1? ctrl? ........................................................... 30 wake-up function register C pawk ..................................................................................... 3? pull-high registers C papu ? pbpu? pcpu? pdpu? pepu? pfpu ....................................... 3? software co? register C sco?c ....................................................................................... 3? rev. 1.10 ? ?a? 0?? ?01? rev. 1.10 3 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu oscillator ........................................................................................................ 32 s?stem oscillator overview .................................................................................................. 3? external cr?stal/resonator oscillator C hxt ........................................................................ 33 external rc oscillator C erc ............................................................................................... 33 internal rc oscillator C hirc ............................................................................................... 34 external 3?768hz cr?stal oscillator C lxt ........................................................................... 34 lxt oscillator low power function ...................................................................................... 35 internal low speed oscillator C lirc ................................................................................... 35 operating modes ........................................................................................... 36 ? ode t ?pes and selection .................................................................................................... 36 ?ode switching ..................................................................................................................... 37 standb? current considerations ........................................................................................... 37 wake-up ................................................................................................................................ 38 watchdog timer operation ................................................................................................... 39 reset and initialisation .................................................................................. 40 reset functions .................................................................................................................... 41 reset initial conditions ......................................................................................................... 43 input/output ports ......................................................................................... 46 pull-high resistors ................................................................................................................ 46 port a wake-up ..................................................................................................................... 46 i/o port control registers ..................................................................................................... 48 pin-shared functions ............................................................................................................ 49 pin remapping confguration ............................................................................................... 50 i/o pin structures .................................................................................................................. 50 programming considerations ................................................................................................ 5? timer/event counters ................................................................................... 52 confguring the timer/event counter input clock source .................................................... 5? timer registers C t ?r0? t?r1? t?r?l? t?r?h ............................................................... 53 timer control registers C t ?r0c? t?r1c? t?r?c ........................................................... 53 timer ?ode ........................................................................................................................... 57 event counter ?ode ............................................................................................................. 57 pulse width capture ?ode ................................................................................................... 58 prescaler ............................................................................................................................... 59 pfd function ........................................................................................................................ 59 i/o interfacing ........................................................................................................................ 60 programming considerations ................................................................................................ 60 timer program example ....................................................................................................... 61 time base ............................................................................................................................. 61 pulse width modulator .................................................................................. 62 pw? operation ..................................................................................................................... 63 6+? pw? ?ode .................................................................................................................... 63 7+1 pw? ?ode .................................................................................................................... 64 pw? output control ............................................................................................................. 65 rev. 1.10 4 ?a? 0?? ?01? rev. 1.10 5 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu analog to digital converter .......................................................................... 66 a/d overview ........................................................................................................................ 66 a/d converter data registers C adrl ? adrh ..................................................................... 66 a/d converter control registers C adcr ? acsr? ancsr1? ancsr0 ................................ 66 a/d input pins ....................................................................................................................... 7? summar? of a/d conversion steps ....................................................................................... 7? programming considerations ................................................................................................ 73 a/d transfer function ........................................................................................................... 73 a/d programming example ................................................................................................... 75 interrupts ........................................................................................................ 77 interrupt register .................................................................................................................. 77 interrupt operation ................................................................................................................ 79 interrupt priorit? ..................................................................................................................... 80 external interrupt ................................................................................................................... 81 timer/event counter interrupt ............................................................................................... 81 ?ulti-function interrupt .......................................................................................................... 81 programming considerations ................................................................................................ 8? lcd scom function ..................................................................................... 83 lcd operation ..................................................................................................................... 83 lcd bias control .................................................................................................................. 84 serial interface module C sim ....................................................................... 85 spi interface ......................................................................................................................... 85 spi registers ........................................................................................................................ 87 spi communication ............................................................................................................. 90 i ? c interface .......................................................................................................................... 9? i ? c registers ......................................................................................................................... 93 i ? c bus communication ........................................................................................................ 97 i ? c bus start signal ............................................................................................................... 98 slave address ....................................................................................................................... 98 i ? c bus read/write signal .................................................................................................... 99 i ? c bus slave address acknowledge signal ......................................................................... 99 i ? c bus data and acknowledge signal ................................................................................. 99 peripheral clock output .............................................................................. 101 peripheral clock operation ................................................................................................. 101 serial interface C spia ................................................................................. 102 spia interface operation .................................................................................................... 10? spia registers ..................................................................................................................... 104 spia communication .......................................................................................................... 106 spia bus enable/disable .................................................................................................... 108 spia operation ................................................................................................................... 108 low voltage detector C lvd ........................................................................ 110 lvd register ........................................................................................................................ 110 lvd operation ...................................................................................................................... 110 rev. 1.10 4 ?a? 0?? ?01? rev. 1.10 5 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu confguration options .................................................................................. 111 application circuit ........................................................................................ 112 instruction set ............................................................................................... 113 introduction .......................................................................................................................... 113 instruction timing ................................................................................................................. 113 ? oving and transferring data .............................................................................................. 113 arithmetic operations ........................................................................................................... 113 logical and rotate operations ............................................................................................. 114 branches and control transfer ............................................................................................ 114 bit operations ...................................................................................................................... 114 table read operations ........................................................................................................ 114 other operations .................................................................................................................. 114 instruction set summar? ...................................................................................................... 115 instruction defnition .................................................................................... 117 package information ................................................................................... 126 ? 8-pin skdip (300mil) outline dimensions ........................................................................ 1?6 ? 8-pin sop (300mil) outline dimensions ........................................................................... 1?7 ? 8-pin ssop (150mil) outline dimensions ......................................................................... 1?8 44-pin qfp (10mmx10mm) outline dimensions ................................................................ 1?9 5? -pin qfp (14mmx14mm) outline dimensions ................................................................ 130 64-pin lqfp (7mmx7mm) outline dimensions .................................................................. 131 reel dimensions ................................................................................................................. 13? carrier tape dimensions ..................................................................................................... 133 rev. 1.10 6 ?a? 0?? ?01? rev. 1.10 7 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu features cpu features ? operating voltage: f sys = 4mhz: 2.2v~5.5v f sys =8mhz: 3.0v~5.5v f sys =12mhz: 4.5v~5.5v ? up to 0.33s instruction cycle with 12mhz system clock at v dd = 5v ? idle/sleep mode and wake-up functions to reduce power consumption ? oscillator types: external high frequency crystal C hxt external rc C erc internal rc C hirc external low frequency crystal C lxt ? four operational modes: normal, slow, idle, sleep ? fully integrated internal 4mhz, 8mhz and 12mhz oscillator requires no external components ? watchdog timer function ? lirc oscillator function for watchdog timer ? all instructions executed in one or two instruction cycles ? table read instructions ? 63 powerful instructions ? up to 8-level subroutine nesting ? bit manipulation instruction ? low voltage reset function ? low voltage detect function ? wide range of available package types peripheral features ? up to 62 bidirectional i/o lines ? up to 16 channel 12-bit adc ? up to 4 channel 8-bit pwm ? single channel 12-bit dac ? serial interfaces module with dual spi and i 2 c interfaces ? single serial spi interface ? software controlled 4-scom lines lcd com driver with 1/2 bias ? external interrupt input shared with an i/o line ? t wo 8-bit programmable timer/event counter with overfow interrupt and prescaler ? single 16-bit programmable timer/event counter with overfow interrupt ? time-base function ? programmable frequency divider C pfd rev. 1.10 6 ?a? 0?? ?01? rev. 1.10 7 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu general description the enhanced a/d mcus are a series of 8-bit high performance, risc architecture microcontrollers specifcally designed for a wide range of applications. the usual holtek microcontroller features of low power consumption, i/o fexibility, timer functions, oscillator options, power down and wake- up functions, watchdog timer and low voltage reset, combine to provide devices with a huge range of functional options while still maintaining a high level of cost effectiveness. the fully integrated system oscillator hirc, which requires no external components and which has three frequency selections, opens up a huge range of new application possibilities for these devices, some of which may include industrial control, consumer products, household appliances subsystem controllers, etc. selection table part no. program memory data memory i/o 8-bit timer 16-bit timer time base hirc (mhz) rtc (lxt) lcd scom ht46r068b 16kx16 51?x8 50 ? 1 1 4/8/1? 4 ht46r069b 3?kx16 10?4x8 6? ? 1 1 4/8/1? 4 part no. a/d pwm d/a interface pfd stack package ht46r068b 1?-bitx16 8-bitx4 1?-bitx1 spi/i ? c? spi 8 ?8skdip/sop/ssop 44/5?qfp ht46r069b 1?-bitx16 8-bitx4 1?-bitx1 spi/i ? c? spi 8 44/5?qfp 64lqfp note: "*" the oscillator is connected to the xt1/xt2 pins with tinypower tm design. block diagram the following block diagram illustrates the main functional blocks. ? rev. 1.10 8 ?a? 0?? ?01? rev. 1.10 9 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu pin assignment pc 1 / an 5 pe 0 / an 8 pe 1 / an 9 pe ? / an 10 pe 3 / an 11 pe 4 / an 1? pe 5 / an 13 pe 6 / an 14 pe 7 / an 15 pg 0 pg 1 pd 0 / tc ? pd 1 / pw? 3 pc 4 / xt ? pa 7 / res pc 3 / pw? 1 pc ? / pw? ? pd 7 / sdo pd 6 / sdi / sda pd 5 / sck / scl pd 4 / scs pd 3 / pclk pd ? pf 7 pf 6 pf 5 p f 4 p f 3 p f ? p f 1 / s d i a p f 0 / s d o a p b 7 / s c k a p b 6 / s c s a p b 5 p b 4 p b 3 / s c o ? 3 p b ? / s c o ? ? p b 1 / s c o ? 1 p b 0 / s c o ? 0 p c 5 / x t 1 p a 6 / o s c 1 p a 5 / o s c ? v d d v s s p a 4 / p w ? 0 / t c 1 / a u d p a 3 / i n t / a n 3 p a ? / t c 0 / a n ? / v r e f p a 1 / p f d / a n 1 p a 0 / a n 0 p c 6 / a n 6 p c 7 / a n 7 p c 0 / a n 4 1 ? 3 4 5 6 7 8 9 10 11 1? 13 14 15 16 17 18 19 ?0 ?1 ?? 34 35 36 37 38 39 48 49 50 51 5? ?3 ?4 ?5 ?6 ?7 ?8 ?9 30 31 3? 33 40 41 4? 43 44 45 46 47 ht 46 r 068 b 52 qfp - a 1 ? 3 4 5 6 7 8 9 10 11 1? 13 14 15 16 17 18 19 ?0 ?1 ?? ?3 ?4 ?5 ?6 ?7 ?8 ?9 30 31 3? 33 34 35 36 37 38 39 40 41 4? 43 44 p c 5 / x t 1 p a 6 / o s c 1 p a 5 / o s c ? v d d v s s p a 4 / p w ? 0 / t c 1 / a u d p a 3 / i n t / a n 3 p a ? / t c 0 / a n ? / v r e f p a 1 / p f d / a n 1 p a 0 / a n 0 p c 6 / a n 6 pc 7 / an 7 pc 0 / an 4 pc 1 / an 5 pe 0 / an 8 pe 1 / an 9 pe ? / an 10 pe 3 / an 11 pe 4 / an 1? pe 5 / an 13 pe 6 / an 14 pe 7 / an 15 pc 4 / xt ? pa 7 / res pc 3 / pw? 1 pc ? / pw? ? pd 7 / sdo pd 6 / sdi / sda pd 5 / sck / scl pd 4 / scs pd 3 / pclk pd ? pf 1 / sdia p f 0 / s d o a p b 7 / s c k a p b 6 / s c s a p b 5 p b 4 p b 3 / s c o ? 3 p b ? / s c o ? ? p b 1 / s c o ? 1 p b 0 / s c o ? 0 p d 1 / p w ? 3 p d 0 / t c ? ht 46 r 068 b 44 qfp - a vss vdd pa 5 / osc ? pa 6 / osc 1 pc 5 / xt 1 pc 4 / xt ? pa 7 / res pc 3 / pw? 1 pc ? / pw? ? pd 3 / pck pd ? pb 5 pb 4 pb 3 / sco? 3 ?8 ?7 ?6 ?5 ?4 ?3 ?? ?1 ?0 19 18 17 16 15 1 ? 3 4 5 6 7 8 9 10 11 1? 13 14 pa 4 / pw? 0 / tc 1 / aud pa 3 / int pa ? / tc 0 pa 1 / pfd / an 1 pa 0 pc 6 pc 7 pc 0 pc 1 pd 0 / tc ? pd 1 / pw? 3 pb 0 / sco? 0 pb 1 / sco? 1 pb ? / sco? ? ht 46 r 068 b 28 skdip - a / ssop - a / sop - a rev. 1.10 8 ?a? 0?? ?01? rev. 1.10 9 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu 1 ? 3 4 5 6 7 8 9 10 11 1? 13 14 15 16 17 18 19 ?0 ?1 ?? ?3 ?4 ?5 ?6 ?7 ?8 ?9 30 31 3? 33 34 35 36 37 38 39 40 41 4? 43 44 p c 5 / x t 1 p a 6 / o s c 1 p a 5 / o s c ? v d d v s s p a 4 / p w ? 0 / t c 1 / a u d p a 3 / i n t / a n 3 p a ? / t c 0 / a n ? / v r e f p a 1 / p f d / a n 1 p a 0 / a n 0 p c 6 / a n 6 pc 7 / an 7 pc 0 / an 4 pc 1 / an 5 pe 0 / an 8 pe 1 / an 9 pe ? / an 10 pe 3 / an 11 pe 4 / an 1? pe 5 / an 13 pe 6 / an 14 pe 7 / an 15 pc 4 / xt ? pa 7 / res pc 3 / pw? 1 pc ? / pw? ? pd 7 / sdo pd 6 / sdi / sda pd 5 / sck / scl pd 4 / scs pd 3 / pclk pd ? pf 1 / sdia p f 0 / s d o a p b 7 / s c k a p b 6 / s c s a p b 5 p b 4 p b 3 / s c o ? 3 p b ? / s c o ? ? p b 1 / s c o ? 1 p b 0 / s c o ? 0 p d 1 / p w ? 3 p d 0 / t c ? ht 46 r 069 b 44 qfp - a pc 1 / an 5 pe 0 / an 8 pe 1 / an 9 pe ? / an 10 pe 3 / an 11 pe 4 / an 1? pe 5 / an 13 pe 6 / an 14 pe 7 / an 15 pg 0 pg 1 pd 0 / tc ? pd 1 / pw? 3 pc 4 / xt ? pa 7 / res pc 3 / pw? 1 pc ? / pw? ? pd 7 / sdo pd 6 / sdi / sda pd 5 / sck / scl pd 4 / scs pd 3 / pclk pd ? pf 7 pf 6 pf 5 p f 4 p f 3 p f ? p f 1 / s d i a p f 0 / s d o a p b 7 / s c k a p b 6 / s c s a p b 5 p b 4 p b 3 / s c o ? 3 p b ? / s c o ? ? p b 1 / s c o ? 1 p b 0 / s c o ? 0 p c 5 / x t 1 p a 6 / o s c 1 p a 5 / o s c ? v d d v s s p a 4 / p w ? 0 / t c 1 / a u d p a 3 / i n t / a n 3 p a ? / t c 0 / a n ? / v r e f p a 1 / p f d / a n 1 p a 0 / a n 0 p c 6 / a n 6 p c 7 / a n 7 p c 0 / a n 4 1 ? 3 4 5 6 7 8 9 10 11 1? 13 14 15 16 17 18 19 ?0 ?1 ?? 34 35 36 37 38 39 48 49 50 51 5? ?3 ?4 ?5 ?6 ?7 ?8 ?9 30 31 3? 33 40 41 4? 43 44 45 46 47 ht 46 r 069 b 52 qfp - a pc 1 / an 5 pe 0 / an 8 pe 1 / an 9 pe ? / an 10 pe 3 / an 11 pe 4 / an 1? pe 5 / an 13 pe 6 / an 14 pe 7 / an 15 pg 0 pg 1 pg ? pg 3 pg 4 pg 5 pg 6 pc ? / pw? ? pd 7 / sdo pd 6 / sdi / sda pd 5 / sck / scl pd 4 / scs pd 3 / pclk pd ? ph 5 ph 4 ph 3 ph ? ph 1 ph 0 pf 7 pf 6 pf 5 p f 4 p f 3 p f ? p f 1 / s d i a p f 0 / s d o a p b 7 / s c k a p b 6 / s c s a p b 5 p b 4 p b 3 / s c o ? 3 p b ? / s c o ? ? p b 1 / s c o ? 1 p b 0 / s c o ? 0 p d 1 / p w ? 3 p d 0 / t c ? p g 7 p c 3 / p w ? 1 p a 7 / r e s p c 4 / x t ? p c 5 / x t 1 p a 6 / o s c 1 p a 5 / o s c ? v d d v s s p a 4 / p w ? 0 / t c 1 / a u d p a 3 / i n t / a n 3 p a ? / t c 0 / a n ? / v r e f p a 1 / p f d / a n 1 p a 0 / a n 0 p c 6 / a n 6 p c 7 / a n 7 p c 0 / a n 4 ht 46 r 069 b 64 qfp - a 1 ? 3 4 5 6 7 8 9 10 11 1? 13 ?0 ?1 ?? ?3 ?4 ?5 ?6 ?7 ?8 60 61 6? 63 64 ?9 30 31 3? 5? 53 54 55 56 57 58 59 14 15 16 43 44 45 46 47 48 36 37 38 39 40 41 4? 33 34 35 17 18 19 5? 53 54 rev. 1.10 10 ?a? 0?? ?01? rev. 1.10 11 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu pin description pin name function opt i/t o/t descriptions pa0/an0 pa0 papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. an0 ancsr0 an a/d channel 0 pa1/pfd/an1 pa1 papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. pfd ctrl0 c?os pfd output an1 ancsr0 an a/d channel 1 pa ?/tc0/an?/vref pa ? papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. tc0 st external timer 0 clock input an? ancsr0 an a/d channel ? vref acsr an adc reference input pa3/intb/an3 pa3 papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. intb st external interrupt input an3 ancsr0 an a/d channel 3 pa4/pw ?0/tc1/aud pa4 papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. pw?0 ctrl0 c?os pw? output tc1 st external timer 1 clock input aud an dac output pa5/osc ? pa5 papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. osc? co osc oscillator pin pa6/osc1 pa6 papu pawk st c?os general purpose i/o. register enabled pull-up and wake-up. osc1 co osc oscillator pin pa7/ res pa7 pawk st n?os general purpose i/o. register enabled wake-up. res co st reset input pb0/sco?0 pb0 pbpu st c?os general purpose i/o. register enabled pull-up sco?0 sco?c sco? software controlled 1/? bias lcd co? pb1/sco?1 pb1 pbpu st c?os general purpose i/o. register enabled pull-up sco?1 sco?c sco? software controlled 1/? bias lcd co? pb?/sco?? pb? pbpu st c?os general purpose i/o. register enabled pull-up sco?? sco?c sco? software controlled 1/? bias lcd co? pb3/sco?3 pb3 pbpu st c?os general purpose i/o. register enabled pull-up sco?3 sco?c sco? software controlled 1/? bias lcd co? pb4?pb5 pb4?pb5 pbpu st c?os general purpose i/o. register enabled pull-up pb6/ scsa pb6 pbpu st c?os general purpose i/o. register enabled pull-up scsa st spi slave select pb7/scka pb7 pbpu st c?os general purpose i/o. register enabled pull-up scka st c?os spi serial clock pc0/an4 pc0 pcpu st c?os general purpose i/o. register enabled pull-up. an4 ancsr0 an a/d channel 4 pc1/an5 pc1 pcpu st c?os general purpose i/o. register enabled pull-up. an5 ancsr0 an a/d channel 5 pc?/pw?? pc? pcpu st c?os general purpose i/o. register enabled pull-up. pw?? ctrl? c?os pw? output pc3/pw?1 pc3 pcpu st c?os general purpose i/o. register enabled pull-up. pw?1 ctrl0 c?os pw? output pc4/xt? pc4 pcpu st c?os general purpose i/o. register enabled pull-up. xt? co lxt low frequenc? cr?stal pin pc5/xt1 pc5 pcpu st c?os general purpose i/o. register enabled pull-up. xt1 co lxt low frequenc? cr?stal pin rev. 1.10 10 ?a? 0?? ?01? rev. 1.10 11 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu pin name function opt i/t o/t descriptions pc6/an6 pc6 pcpu st c?os general purpose i/o. register enabled pull-up . an6 ancsr0 an a/d channel 6 pc7/an7 pc7 pcpu st c?os general purpose i/o. register enabled pull-up. an7 ancsr0 an a/d channel 7 pd0/tc? pd0 pdpu st c?os general purpose i/o. register enabled pull-up . tc? st external timer ? clock input pd1/pw?3 pd1 pdpu st c?os general purpose i/o. register enabled pull-up . pw?3 ctrl? c?os pw? output pd? pd? pdpu st c?os general purpose i/o. register enabled pull-up . pd3/pclk pd3 pdpu st c?os general purpose i/o. register enabled pull-up . pclk c?os peripheral clock output pd4/ scs pd4 pdpu st c?os general purpose i/o. register enabled pull-up . scs st c?os spi slave select pd5/sck/scl pd5 pdpu st c?os general purpose i/o. register enabled pull-up . sck st c?os spi serial clock scl st n?os i ? c clock pd6/sdi/sda pd6 pdpu st c?os general purpose i/o. register enabled pull-up . sdi st spi data input sda st n?os i ? c data pd7/sdo pd7 pdpu st c?os general purpose i/o. register enabled pull-up . sdo c?os spi data output pe0/an8 pe0 pepu st c?os general purpose i/o. register enabled pull-up . an8 ancsr1 an a/d channel 8 pe1/an9 pe1 pepu st c?os general purpose i/o. register enabled pull-up . an9 ancsr1 an a/d channel 9 pe?/an10 pe? pepu st c?os general purpose i/o. register enabled pull-up . an10 ancsr1 an a/d channel 10 pe3/an11 pe3 pepu st c?os general purpose i/o. register enabled pull-up . an11 ancsr1 an a/d channel 11 pe4/an1? pe4 pepu st c?os general purpose i/o. register enabled pull-up . an1? ancsr1 an a/d channel 1? pe5/an13 pe5 pepu st c?os general purpose i/o. register enabled pull-up . an13 ancsr1 an a/d channel 13 pe6/an14 pe6 pepu st c?os general purpose i/o. register enabled pull-up . an14 ancsr1 an a/d channel 14 pe7/an15 pe7 pepu st c?os general purpose i/o. register enabled pull-up . an15 ancsr1 an a/d channel 15 pf0/sdoa pf0 pfpu st c?os general purpose i/o. register enabled pull-up . sdoa c?os spi data output pf1/sdia pf1 pfpu st c?os general purpose i/o. register enabled pull-up . sdia st spi data input pf?~pf7 pfn pfpu st c?os general purpose i/o. register enabled pull-up . pg0~pg7 pgn pgpu st c?os general purpose i/o. register enabled pull-up . ph0~ph5 phn phpu st c?os general purpose i/o. register enabled pull-up . vdd vdd pwr power suppl? vss vss pwr ground 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 trigger input; cmos: cmos output; an: analog input or output scom: software controlled lcd com hxt: high frequency crystal oscillator lxt: low frequency crystal oscillator rev. 1.10 1? ?a? 0?? ?01? rev. 1.10 13 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu absolute maximum ratings supply voltage ................................................................................................ v ss -0.3v to v ss +6.0v input voltage .................................................................................................. v ss -0.3v to v dd +0.3v i ol total .................................................................................................. 100ma total power dissipation ........................................................................................................ 500mw storage temperature .................................................................................................. -50 c to 125c operating temperature ................................................................................................ -40 c to 85 c i oh total ................................................................................................ -100ma 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 specification is not implied and prolonged exposure to extreme conditions may affect device reliability. d.c. characteristics ta= ?5c symbol parameter test conditions min. typ. max. unit v dd conditions v dd operating voltage f sys =4?hz ?.? 5.5 v f sys =8?hz 3.0 5.5 v f sys =1??hz 4.5 5.5 v i dd1 operating current (hxt ? hirc? erc) 3v no load? f sys =4?hz 0.8 1.? ma 5v 1.5 ?.?5 ma i dd? operating current (hxt ? hirc? erc) 3v no load? f sys =8?hz 1.4 ?.1 ma 5v ?.8 4.? ma i dd3 operating current (hxt ? hirc? erc) 5v no load? f sys =1??hz 4 6 ma i dd4 operating current (hirc + lxt ? slow ?ode) 3v no load? f sys =3?768hz (lxt on osc1/osc ?? lvr disabled ? lxtlp=1) 5 10 5v 1? ?4 3v no load? f sys =3?768hz (lxt on xt1/xt ?? lvr disabled ? lxtlp=1) 5 10 5v 10 ?0 i stb1 standb? current (lirc on? lxt off) 3v no load? s? stem halt 5 5v 10 i stb? standb? current (lirc off ? lxt off) 3v no load? s? stem halt 1 5v ? i stb3 standb? current (lirc off ? lxt on? lxtlp=1) 3v no load? s? stem halt (lxt on osc1/osc ?) 5 5v 10 3v no load? s? stem halt (lxt on xt1/xt ?) 3 5v 5 v il1 input low voltage for i/o ? tcn and int 0 0.3v dd v v ih1 input high voltage for i/o ? tcn and int 0.7v dd v dd v v il? input low voltage ( res ) 0 0.4v dd v v ih? input high voltage ( res ) 0.9v dd v dd v v lvr1 low voltage reset 1 v lvr =4.?v 3.98 4.? 4.4? v v lvr ? low voltage reset ? v lvr =3.15v ?.98 3.15 3.3? v v lvr3 low voltage reset 3 v lvr =?.1v 1.98 ?.1 ?.?? v rev. 1.10 1? ?a? 0?? ?01? rev. 1.10 13 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu symbol parameter test conditions min. typ. max. unit v dd conditions v lvd1 low voltage detector voltage 1 v lvd = 4.4 v 4.1? 4.4 4.70 v v lvd ? low voltage detector voltage ? v lvd = 3.3 v 3.1? 3.3 3.50 v v lvd ? low voltage detector voltage 3 v lvd = 2.2 v ?.08 ?.? ?.3? v i ol1 i/o port sink current (pa ? pb? pc? pd? pe? pf ? pg? ph) 3v v ol =0.1v dd 4 8 ma 5v 10 ?0 ma i oh i/o port source current 3v v oh =0.9v dd -? -4 ma 5v -5 -10 ma i ol? pa7 sink current 5v v ol =0.1v dd ? 3 ma r ph pull-high resistance 3v ?0 60 100 n 5v 10 30 50 n i sco? sco? operating current 5v sco?c? isel[1:0]=00 17.5 ?5.0 3?.5 sco?c? isel[1:0]=01 35 50 65 sco?c? isel[1:0]=10 70 100 130 sco?c? isel[1:0]=11 140 ?00 ?60 v sco? v dd /? voltage for lcd co? 5v no load 0.475 0.500 0.5?5 v dd note: the standby current (i stb1 ~i stb3 ) and i dd4 are measured with all i/o pins in input mode and tied to v dd . rev. 1.10 14 ?a? 0?? ?01? rev. 1.10 15 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu a.c. characteristics ta= ?5c symbol parameter test conditions min. typ. max. unit v dd conditions f sys s?stem clock ?.?v~5.5v 3? 4000 khz 3.0v~5.5v 3? 8000 khz 4.5v~5.5v 3? 1?000 khz f hirc s?stem clock (hirc) 3v/5v ta= ?5 c -?% 4 +?% ?hz 3v/5v ta= ?5 c -?% 8 +?% ?hz 5v ta= ?5 c -?% 1? +?% ?hz 3v/5v ta=0~70 c -5% 4 +5% ?hz 3v/5v ta=0~70 c -5% 8 +5% ?hz 5v ta=0~70 c -5% 1? +5% ?hz ?.?v~3.6v ta=0~70 c -8% 4 +8% ?hz 3.0v~5.5v ta=0~70 c -8% 4 +8% ?hz 3.0v~5.5v ta=0~70 c -8% 8 +8% ?hz 4.5v~5.5v ta=0~70 c -8% 1? +8% ?hz ?.?v~3.6v ta=-40 c~85 c -1?% 4 +1?% ?hz 3.0v~5.5v ta=-40 c~85 c -1?% 4 +1?% ?hz 3.0v~5.5v ta=-40 c~85 c -1?% 8 +1?% ?hz 4.5v~5.5v ta=-40 c~85 c -1?% 1? +1?% ?hz f erc s?stem clock (erc) 5v ta= ?5 c? r=1?0 k* -?% 4 +?% ?hz 5v ta=0~70 c? r=1?0 k* -5% 4 +5% ?hz 5v ta=-40 c~85 c? r=1?0 k* -7% 4 +7% ?hz ?.?v~5.5v ta=-40 c~85 c? r=1?0 k* -11% 4 +11% ?hz f lxt s?stem clock (lxt) 3?768 hz t ti?er timer input frequenc ? (tcn) ?.?v~5.5v 0 4000 khz 3.0v~5.5v 0 8000 khz 4.5v~5.5v 0 1?000 khz f lirc lirc oscillator 3v 5 10 15 khz 5v 6.5 13 19.5 khz t res external reset low pulse width 1 s t sst s?stem start-up time period ? 1?8 t sys t sys t sys t int interrupt fulse width 1 s t lvr low voltage width to reset 0.?5 1 ? ms restd reset dela ? time 100 ms 1rwhw sys i sys i ddids dd dd i d d i d s dsd d dddyds rev. 1.10 14 ?a? 0?? ?01? rev. 1.10 15 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu adc characteristics ta= ?5 c symbol parameter test conditions min. typ. max. unit v dd conditions dnl a/c differential non-linearit ? 3v t ad =0.5 s -? ? lsb 5v inl adc integral non-linearit? 3v t ad =0.5 s -4 4 lsb 5v i adc additional power consumption if a/d converter is used 3v 0.5 0.75 ma 5v 1.0 1.5 ma dac electrical characteristics symbol parameter test conditions min. typ. max. unit v dd conditions v dac dac operating voltage ?.4 v i q dac q uiescent current 5v code= 0000h v ol =00h ? 3 ma i dac dac operating current 5v 1 khz sin wave? full-scale ( 8k sample rate ) 3 4.5 ma res resolution 1? bit v o output voltage level 0.01 0.99 v dd power-on reset characteristics ta= ?5c symbol parameter test conditions min. typ. max. unit v dd conditions v por v dd start voltage to ensure power-on reset 100 mv rrv dd v dd raising rate to ensure power-on reset 0.035 v/ms t por ? inimum time for v dd to remain at v por to e nsure power-on reset 1 ms rev. 1.10 16 ?a? 0?? ?01? rev. 1.10 17 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu system architecture a key factor in the high-performance features of the holtek range of microcontrollers is attributed to the internal system architecture. the range of devices take advantage of the usual features found within risc microcontrollers providing increased speed of operation and enhanced performance. the pipelining scheme is implemented in such a way that instruction fetching and instruction execution are overlapped, hence instructions are effectively executed in one cycle, with the exception of branch or call instructions. an 8-bit wide alu is used in practically all operations of the instruction set. it carries out arithmetic operations, logic operations, rotation, increment, decrement, branch decisions, etc. the internal data path is simplifed by moving data through the accumulator and the alu. certain internal registers are implemented 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 main system clock, derived from either a crystal/resonator or rc oscillator is subdivided into four internally generated non-overlapping clocks, t1~t4. the program counter is incremented at the beginning of the t1 clock during which time a new instruction is fetched. the remaining t2~t4 clocks carry out the 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 structure of the microcontroller ensures that instructions are effectively executed in one 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 to frst obtain the actual jump or call address and then another cycle to actually execute the branch. the requirement for this extra cycle should be taken into account by programmers in timing sensitive applications. ? ? ? ? ? system clocking and pipelining rev. 1.10 16 ?a? 0?? ?01? rev. 1.10 17 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ? ? ? ? ? ? ? ? ? ? instruction fetching program counter during program execution, the program counter is used to keep track of the address of the 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. note that the program counter width varies with the program memory capacity depending upon which device is selected. however, it must be noted that only the lower 8 bits, known as the program counter low register, are directly addressable by user. when executing instructions requiring 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 execution, is discarded and a dummy cycle takes its place while the correct instruction is obtained. device program counter program counter high byte pcl register ht46r068b pc13~pc8 pcl7~pcl0 ht46r069b pc14~pc8 14 13 1? 8 7 0 program counter bp 5 bp 6 bank pointer(bp) 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 this register, a short program jump can be executed directly, however, as only this low byte is available for manipulation, the jumps are limited to the present page of memory, that is 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 branching, 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.10 18 ?a? 0?? ?01? rev. 1.10 19 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu 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 or program memory space, and is neither readable nor writeable. the activated level is indexed by the stack pointer, sp, 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. device stack levels ht46r068b ht46r069b 8 if the stack is full and an enabled interrupt takes place, the interrupt request fag will be recorded but the 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 allowing the programmer to use the structure more easily. however, when the stack is full, a call subroutine instruction can still be executed 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 arithmetic-logic unit or alu is a critical area of the microcontroller that carries out arithmetic and logic operations of the instruction set. connected to the main microcontroller data bus, the alu receives related instruction 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.10 18 ?a? 0?? ?01? rev. 1.10 19 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu program memory the program memory is the location where the user code or program is stored. the device is supplied with one-time programmable, otp, memory where users can program their application code into the device. by using the appropriate programming tools, otp devices offer 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 16kx16/32kx16. the program memory is addressed by the program counter and also contains data, table information and interrupt entries. table data, which can be setup in any location within the program memory, is addressed by separate table pointer registers. device capacity banks ht46r068b 16kx16 0?1 ht46r069b 3?kx16 0~3 the devices have their program memory divided into a number of banks which are selected using the bank pointer register. the ht46r068b 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. the ht46r069b has its program memory divided into four banks, from bank0 to bank3. the required bank is selected using bit 5 and bit 6 of the bp register. ? ? ?? ? ? ? ?? ? rev. 1.10 ?0 ?a? 0?? ?01? rev. 1.10 ?1 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu special vectors within the program memory, certain locations are reserved for special usage such as reset and interrupts. ? reset vector this vector is reserved for use by the device reset for program initialisation. after a device reset is initiated, the program will jump to this location and begin execution. ? external interrupt vector this vector 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/2 counter interrupt vector this internal vector is used by the timer/event counters. if a timer/event counter overflow occurs, the program will jump to its respective location and begin execution if the associated timer/event counter interrupt is enabled and the stack is not full. ? multi-function interrupt vector the multi-function interrupt vector is shared by several internal functions: a time base overfow, an spi/i 2 c or spia data transfer completion. the program will jump to this location and begin execution if the relevant 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. to use the look-up table, the table pointer must frst be setup by placing the lower order address of the look up data to be retrieved in the table pointer register, tblp. this register defnes the lower 8-bit address of the look-up table. after setting up the table pointer, the table data can be retrieved from the current program memory page or last program memory page using the "tabrdc[m]" or "tabrdl[m]" instructions, respectively. when these instructions are executed, the lower order table byte from the program memory will be transferred to the user defined data memory register [m] as specified in the instruction. the higher order table data byte from 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 following diagram illustrates the addressing/data fow of the look-up table: ? ? rev. 1.10 ?0 ?a? 0?? ?01? rev. 1.10 ?1 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu table program example the accompanying example shows how the table pointer and table data is defned and retrieved from the device. this example uses raw table data located in the last page which is stored there using the org statement. the value at this org statement is "7f00h" which refers to the start address of the last page within the 32k program memory of the microcontrollers. 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 "7f06h" 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 "tabrdc [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 "tabrdl [m]" instruction is executed. because the tblh register is a read-only register and cannot be restored, care should be taken to ensure its protection if both the main routine and interrupt service routine use the table read instructions. if using the table read instructions, the interrupt service routines may change the value of 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 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 tabrdc [m] pc14 pc13 pc1? pc11 pc10 pc9 pc8 @7 @6 @5 @4 @3 @? @1 @0 tabrdl [m] 1 1 1 1 1 1 1 @7 @6 @5 @4 @3 @? @1 @0 note: pc14~pc8: current program counter bits @7~@0: table pointer tblp bits for the ht46r068b, the table address location is 14 bits, i.e. from b13~b0 for the ht46r069b, the table address location is 15 bits, i.e. from b14~b0 table read program example tempr eg1 db ? ; temporary register #1 tempreg2 db ? ; temporary register #2 : : mov a, 060h mov bp, a ; select the last bank of prog. memory mov a, 06h ; initialise table pointer - note that this address is referenced mov tblp,a ; to the last page or present page : : tabrdl tempreg1 ; transfers value in table referenced by table pointer to tempregl ; data at prog. memory address "7f06" transferred to tempreg1 and tblh dec tblp ; reduce value of table pointer by one tabrdl tempreg2 ; transfers value in table referenced by table pointer to tempreg2 ; data at prog.memory address "7f06" transferred to tempreg2 and tblh ; in this example the data "1ah" is transferred to ; tempreg1 and data "0fh" to register tempreg2 ; the value "00h" will be transferred to the high byte register tblh : : org 7f00h ; sets initial address of last page dc 00ah, 00bh, 00ch, 00dh, 00eh, 00fh, 01ah, 01bh : : rev. 1.10 ?? ?a? 0?? ?01? rev. 1.10 ?3 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu 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 divided into two sections, the frst of these is an area of ram where special function registers are located. these registers have fxed locations and 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. device capacity banks ht46r068b 51?x8 0~3 ht46r069b 10?4x8 0~7 the two sections of data memory, the special purpose and general purpose data memory are located at consecutive locations. all are implemented in ram and are 8 bits wide but the length of each memory section is dictated by the type of microcontroller chosen. the start address of the data memory for all devices is the address "00h". all microcontroller programs require an area of read/write memory where temporary data can be stored and retrieved 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" instructions individual bits can be set or reset under program control giving the user a large range of fexibility for bit manipulation in the data memory. for some devices, the data memory is subdivided into several banks, which are selected using a bank pointer. only data in bank 0 can be directly addressed, data in bank 1~bank 7 must be indirectly addressed. rev. 1.10 ?? ?a? 0?? ?01? rev. 1.10 ?3 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b ht46r069b data memory structure note: most of the data memory bits can be directly manipulated using the "set [m].i" and "clr [m].i" with the exception of a few dedicated bits. the data meomory can also be accessed through the memory pointer registers. 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 locations that are unused, any read instruction to these addresses will return the value "00h". rev. 1.10 ?4 ?a? 0?? ?01? rev. 1.10 ?5 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu 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 of these registers within the data memory begins at the address "00h" and are mapped from bank 0 to bank 7. 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 operation to these registers but rather to the memory location specifed by their corresponding memory pointer, mp0 or mp1. acting as a pair, iar0 with mp0 and iar1 with mp1 can together access data from the data memory. 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 and bank 7. 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 7 . the following example shows how to clear a section of four data memory locations already defned as locations adres1 to adres4. ht46r068b ht46r069b 00h iar0 iar0 01h ?p0 ?p0 0?h iar1 iar1 03h ?p1 ?p1 04h bp bp 05h acc acc 06h pcl pcl 07h tblp tblp 08h tblh tblh 09h wdts wdts 0ah status status 0bh intc0 intc0 0ch t?r0 t?r0 0dh t?r0c t?r0c 0eh t?r1 t?r1 rev. 1.10 ?4 ?a? 0?? ?01? rev. 1.10 ?5 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b ht46r069b 0fh t?r1c t?r1c 10h pa pa 11h pac pac 1?h papu papu 13h pawk pawk 14h pb pb 15h pbc pbc 16h pbpu pbpu 17h pc pc 18h pcc pcc 19h pcpu pcpu 1ah ctrl0 ctrl0 1bh ctrl1 ctrl1 1ch sco?c sco?c 1dh pw?1 pw?1 1eh intc1 intc1 1fh pw?0 pw?0 ?0h adrl adrl ?1h adrh adrh ??h adcr adcr ?3h acsr acsr ?4h ?fic ?fic ?5h pd pd ?6h pdc pdc ?7h pdpu pdpu ?8h pe pe ?9h pec pec ?ah pepu pepu ?bh pf pf ?ch pfc pfc ?dh pfpu pfpu ?eh ?fh 30h pw?? pw?? 31h ctrl? ctrl? 3?h 3ah 3bh pg pg 3ch pgc pgc 3dh pgpu pgpu 3eh ph 3fh phc 40h phpu 41h t?r?l t?r?l 4?h t?r?h t?r?h rev. 1.10 ?6 ?a? 0?? ?01? rev. 1.10 ?7 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b ht46r069b 43h t?r?c t?r?c 44h pw?3 pw?3 45h 46h si?c0 si?c0 47h si?c1 si?c1 48h si?d si?d 49h si?a/si?c? si?a/si?c? 4ah spiac0 spiac0 4bh spiac1 spiac1 4ch spiad spiad 4dh ancsr0 ancsr0 4eh ancsr1 ancsr1 4fh 50h dal dal 51h dah dah 5?h vol vol 53h 54h lvdc lvdc .. 7fh genernal purpose data memor? 514 b?tes 4 banks (80h~ffh) 10?4 b?tes 8 banks (80h~ffh) indirect addressing program example data .section 'data' adres1 db ? adres2 db ? adres3 db ? adres4 db ? block db ? code .section at 0 code org 00h 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: 7hlsudslhhuhldlhhdsohdeyhuhihuhfhldhshflf 'dd0huduhh rev. 1.10 ?6 ?a? 0?? ?01? rev. 1.10 ?7 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu accumulator C acc the accumulator is central to the operation of any microcontroller and is closely related with operations carried out by the alu. the accumulator is the place where all intermediate results from the alu are stored. without the accumulator it would be necessary to write the result of each calculation or logical operation such as addition, subtraction, shift, etc., to the data memory resulting in higher programming and timing overheads. data transfer operations usually involve the temporary storage function of the accumulator; for example, when transferring data between one user defined register and another, it is necessary to do this by passing the data through the accumulator as no direct transfer between two registers is permitted. program counter low register C pcl to provide additional program control functions, the low byte of the program counter is made accessible to programmers by locating it within the special purpose area of the data memory. by manipulating this register, direct jumps to other program locations are easily implemented. loading a value directly into this pcl register will cause a jump to the specifed program memory location, however, as the register is only 8-bit wide, only jumps within the current program memory page are permitted. when such operations are used, note that a dummy cycle will be inserted. bank pointer C bp in the ht46r068b and ht46r069b devices, the data memory is divided into several banks, from bank 0 to bank 7. a bank pointer is used to select the required data memory bank. only data in bank 0 can be directly addressed as data in bank 1~bank 7 must be indirectly addressed using memory pointer mp1 and indirect addressing register iar1. using memory pointer mp0 and indirect addressing register iar0 will always access data from bank 0, irrespective of the value of the bank pointer. memory pointer mp1 and indirect addressing register iar1 can indirectly address data in either bank 0 or bank 1~bank 7 depending upon the value of the bank pointer. the data memory is initialised to bank 0 after a reset, except for the wdt time-out reset in the idle/ sleep mode, in which case, the data memory bank remains unaffected. it should be noted that special function data memory is not affected by the bank selection, which means that the special function registers can be accessed from within either bank 0 or bank 1~bank 7. directly addressing the data memory will always result in bank 0 being accessed irrespective of the value of the bank pointer. ? ht46r068b 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 pmbp0 : program memory bank p oint 0: bank 0 1: bank 1 bit 4~2 unimplemented, read as "0" bit 1,0 dmbp1, dmbp0 : data memory ank p oint 00:bank 0 01:bank 1 10:bank 2 11:bank 3 rev. 1.10 ?8 ?a? 0?? ?01? rev. 1.10 ?9 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ? ht46r069b bit 7 6 5 4 3 2 1 0 bp p?bp1 p?bp0 d?bp? d?bp1 d?bp0 r/w r/w r/w r/w r/w r/w por 0 0 0 0 0 %lw xqlpsohphqwhguhdgdv %lw pmbp1, pmbp0 3urudp0hprudn3rlwhu dn dn dn dn lw xlpsohphwhguhdgdv lw dmbp2, dmbp1, dmbp0 dwd0hprudn3rlwhu dn dn dn dn dn dn dn dn status register C status 7klv elw uhjlvwhu frqwdlqv wkh ]hur dj = fduu dj & dx[loldu fduu dj & ryhurz dj 29 srzhu grzq dj 3) dqg zdwfkgrj wlphrxw dj 72 7khvh dulwkphwlforjlfdo rshudwlrq dqgvvwhppdqdjhphqwdjvduhxvhgwruhfrugwkhvwdwxvdqgrshudwlrqriwkh plfurfrqwuroohu :lwk wkh h[fhswlrq ri wkh 72 dqg 3) djv elwv lq wkh vwdwxv uhjlvwhu fdq eh dowhuhg e lqvwuxfwlrqv olnhprvwrwkhuuhjlvwhuv qgdwdzulwwhqlqwrwkhvwdwxvuhjlvwhuzlooqrwfkdqjhwkh 72 ru3)dj ,q dgglwlrq rshudwlrqv uhodwhg wr wkh vwdwxv uhjlvwhu pd jlyh gliihuhqw uhvxowv gxh wr wkh gliihuhqw lqvwuxfwlrq rshudwlrqv 7kh 72 dj fdq eh diihfwhg rqo e d vvwhp srzhuxs d :7 wlphrxw ru e h[hfxwlqj wkh &/5 :7 ru +/7 lqvwuxfwlrq 7kh 3) dj lv diihfwhg rqo e h[hfxwlqj wkh +/7ru&/5 :7lqvwuxfwlrqrugxulqjdvvwhp srzhuxs 7kh= 29 &dqg&djvjhqhudoouhhfwwkhvwdwxvriwkhodwhvwrshudwlrqv ,q dgglwlrq rq hqwhulqj dq lqwhuuxsw vhtxhqfh ru h[hfxwlqj d vxeurxwlqh fdoo wkh vwdwxv uhjlvwhu zloo qrw eh sxvkhg rqwr wkh vwdfn dxwrpdwlfdoo ,i wkh frqwhqwv ri wkh vwdwxv uhjlvwhuv duh lpsruwdqw dqg li wkh lqwhuuxsw urxwlqh fdq fkdqjh wkh vwdwxv uhjlvwhu suhfdxwlrqv pxvw eh wdnhq wr fruuhfwo vdyh lw 1rwhwkdwelwvariwkh 67786uhjlvwhuduherwkuhdgdeohdqgzulwhdeohelwv rev. 1.10 ?8 ?a? 0?? ?01? rev. 1.10 ?9 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu input/output ports and control registers within the area of special function registers, the port pa, pb, etc data i/o registers and their associated control register pac, pbc, etc play a prominent role. these registers are mapped to specific addresses within the data memory as shown in the data memory table. the data i/o registers, are used to transfer the appropriate output or input data on the port. the control registers specifes which pins of the port are set as inputs and which are set as outputs. to setup a pin as an input, the corresponding bit of the control register must be set high, for an output it must be set low. during program initialisation, it is important to first setup the control registers to specify which pins are outputs and which are inputs before reading data from or writing data to the i/o ports. one fexible feature of these registers is the ability to directly program single bits using the "set [m].i" and "clr [m].i" instructions. the ability to change i/o pins from output to input and vice versa by manipulating specifc bits of the i/o control registers during normal program operation is a useful feature of these devices. ? 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 : watchdog time-out fag 0: after power up or executing the "clr wdt" or "halt" instruction 1: a watchdog time-out occured. 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 not 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. rev. 1.10 30 ?a? 0?? ?01? rev. 1.10 31 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu system control registers C ctrl0, ctrl1, ctrl2 these registers are used to provide control over various internal functions. some of these include the pfd control, pwm control, certain system clock options, the lxt oscillator low power control, external interrupt edge trigger type, watchdog timer enable function, time base function division ratio, and the lxt oscillator enable control. ? ctrl0 register bit 7 6 5 4 3 2 1 0 name pcfg pfdcs pw?sel pw?c1 pw?c0 pfdc lxtlp clk?od 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 0 bit 7 pcfg : i/o confguration 0: (pwm0/tc1)/int/pfd pin-shared with pa4/pa3/pa1 1: (pwm0/tc1)/int/pfd pin-shared with pb5/pb4/pb3 bit 6 pfdcs : pfd clock source 0: timer0 1: timer1 bit 5 pwmsel : pwm type selection 0: 6+2 1: 7+1 bit 4 pwmc1 : i/o or pwm1 0: i/o 1: pwm1 bit 3 pwmc0 : i/o or pwm0 0: i/o 1: pwm0 bit 2 pfdc : i/o or pfd 0: i/o 1: pfd bit 1 lxtlp : lxt oscillator low power control function 0: lxt oscillator quick start-up mode 1: lxt oscillator low power mode bit 0 clkmod : system clock mode selection. 0: high speed system clock 1: lxt system clock, high speed oscillator stopped note: if pwm0/1/2/3 output is selected by pwmc0/1/2/3 bit, f tp comes always from . (f tp is the clock source for timer0, time base and pwm) rev. 1.10 30 ?a? 0?? ?01? rev. 1.10 31 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ? ctrl1 register bit 7 6 5 4 3 2 1 0 name integ1 integ0 tbsel1 tbsel0 wdten3 wdten? wdten1 wdten0 r/w r/w r/w r/w r/w r/w r/w r/w r/w por 1 0 0 0 1 0 1 0 b i1 i dss d id d bs1 bs ds i 11 i i i d d d1 d id d yd dyd i d d d s d dd d d 11 dy ii 1 d dsd d 11 d dsd 11 ? ctrl2 register bit 7 6 5 4 3 2 1 0 name dacen pw?c3 pw?c? lxten r/w r/w r/w r/w r/w por 0 0 0 1 %lw da cen '&glvdeohhqdeohfrqwuro glvdeoh hqdeoh %lw xqlpsohphqwhguhdgdv %lw pw?c3 ??ru3:0frqwuro ?? 3:0rxwsxw %lw pw?c? ??ru3:0frqwuro ?? 3:0rxwsxw %lw a xqlpsohphqwhguhdgdv %lw lxten /7 ?vfloodwru rqriifrqwurodiwhuh[hfxwlrqri +/7 lqvwuxfwlrq /7 riilq?goh0rgh /7 rqlq?gohprgh rev. 1.10 3? ?a? 0?? ?01? rev. 1.10 33 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu wake-up function register C pawk when the microcontroller enters the idle/sleep mode, various methods exist to wake the device up and continue with normal operation. one method is to allow a falling edge on the i/o pins to have a wake-up function. this register is used to select which port a i/o pins are used to have this wake-up function. pull-high registers C papu, pbpu, pcpu, pdpu, pepu, pfpu the i/o pins, if confgured as inputs, can have internal pull-high resistors connected, which eliminates the need for external pull-high resistors. this register selects which i/o pins are connected to internal pull-high resistors. software com register C scomc the pins pb0~pb3 on port b can be used as scom lines to drive an external lcd panel. to implement this function, the scomc register is used to setup the correct bias voltages on these pins. oscillator various oscillator options offer the user a wide range of functions according to their various application requirements. the flexible features of the oscillator functions ensure that the best optimisation can be achieved in terms of speed and power saving. oscillator selections and operation are selected through a combination of confguration options and registers. system oscillator overview in addition to being the source of the main system clock the oscillators also provide clock sources for other functions such as the watchdog timer, timer/event counter, time base etc. the system oscillator can be provided from a choice of three high speed oscillators, the hxt, erc or hirc oscillators, or a single low speed, lxt crystal oscillator. the lirc oscillator is used only as a watchdog timer clock source. type name freq. pins function external cr?stal hxt 400khz~1??hz osc1/ osc? high speed s?stem clock external rc erc 400khz~1??hz osc1 high speed s?stem clock internal highb speed rc hirc 4? 8 or 1??hz high speed s?stem clock external low speed cr?stal lxt 3?768hz xt1/ xt? low speed s?stem clock clock source for: watchdog ? time base? timer/event counters 0/1 clock/spi/spia internal low speed rc lirc 13khz watchdog timer clock rev. 1.10 3? ?a? 0?? ?01? rev. 1.10 33 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu external crystal/resonator oscillator C hxt the simple connection of a crystal across osc1 and osc2 will create the necessary phase shift and feedback for oscillation. however, for some crystals and most resonator types, to ensure oscillation and accurate frequency generation, it is necessary to add two small value external capacitors, c1 and c2. the exact values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturer's specifcation. ? ? ?? crystal/resonator oscillator hxt crystal oscillator c1 and c2 values crystal frequency c1 c2 1??hz 8pf 10pf 8?hz 8pf 10pf 4?hz 8pf 10pf 1?hz 100pf 100pf note: c1 and c? values are for guidance onl? . crystal recommended capacitor values external rc oscillator C erc using the erc oscillator only requires that a resistor, with a value between 24k and 1.5m, is connected between osc1 and v dd , and a capacitor is connected between osc and ground, providing a low cost oscillator configuration. it is only the external resistor that determines the oscillation frequency; the external capacitor has no infuence over the frequency and is connected for stability purposes only. device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the influence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. as a resistance/frequency reference point, it can be noted that with an external 120k resistor connected and with a 5v voltage power supply and temperature of 25 degrees, the oscillator will have a frequency of 4mhz within a tolerance of 2%. here only the osc1 pin is used, which is shared with i/o pin pa6, leaving pin pa5 free for use as a normal i/o pin. external rc oscillator erc rev. 1.10 34 ?a? 0?? ?01? rev. 1.10 35 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu internal rc oscillator C hirc the internal rc oscillator is a fully integrated system oscillator requiring no external components. the internal rc oscillator has three fixed frequencies of either 4mhz, 8mhz or 12mhz. device 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 25 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. internal rc oscillator hirc external 32768hz crystal oscillator C lxt the lxt oscillator is used both as the slow system clock and also as a selectable source clock for some peripheral functions including the watchdog timer, time base, timer/event counters and spi functions. it must be frst enabled using a confguration option. to select the lxt oscillator to be the low speed system oscillator, the clkmod bit in the ctrl0 register should be set high. when a halt instruction is executed, the system clock is stopped, but the lxten bit in the ctrl2 register determines if the lxt oscillator continues running when the microcontroller powers down. setting the lxten bit high will enable the lxt to keep running after a halt instruction is executed and enable the lxt oscillator to remain as a possible clock source for the watchdog timer, the time-base and the timer/event counter 0/1. the lxt oscillator is implemented using a 32768hz crystal connected to pins xt1/xt2. however, for some crystals and to ensure oscillation and accurate frequency generation, it is normally necessary to add two small value external capacitors, c1 and c2. the exact values of c1 and c2 should be selected in consultation with the crystal or resonator manufacturer specification. the external parallel feedback resistor, rp, may also be required. rev. 1.10 34 ?a? 0?? ?01? rev. 1.10 35 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ? ? ???? - external lxt oscillator - hxt lxt oscillator c1 and c2 values crystal frequency c1 c2 3?768hz 8pf 10pf note: 1. c1 and c? values are for guidance onl? . ?. r p =5?~10? is recommended. 32768hz crystal recommended capacitor values 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 quick start 1 low-power 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 the low-power mode by setting the lxtlp bit high. the oscillator will continue to run but 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 should be noted that, no matter what condition the lxtlp bit is set to, the lxt oscillator will always function normally, the only difference is that it will take more time to start up if in the low- power mode. internal low speed oscillator C lirc the lirc is a fully self-contained free running on-chip rc oscillator with a typical frequency of 13khz at 5v requiring no external components. when the device enters the idle/sleep mode, the system clock will stop running but the wdt oscillator continues to free-run and to keep the watchdog active. however, to preserve power in certain applications the lirc can be disabled via a confguration option. rev. 1.10 36 ?a? 0?? ?01? rev. 1.10 37 ?a? 0?? ?01? ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu ht46r068b/ht46r069b enhanced a/d type 8-bit otp mcu operating modes by using the lxt low frequency oscillator in combination with a high frequency oscillator, the system can be selected to operate in a number of different modes. these modes are normal, slow, idle and sleep. mode types and selection the higher frequency oscillators provide higher performance but carry with it the disadvantage of higher power requirements, while the opposite is of course true for the lower frequency oscillators. with the capability of dynamically switching between fast and slow oscillators, the device has the fexibility to optimise the performance/power ratio, a feature especially important in power sensitive portable applications. for these devices the lxt oscillator can run together with any of the high speed oscillators, namely the hxt, erc or the hirc. the clkmod bit in the ctrl0 register can be used to switch the system clock from the selected high speed oscillator to the low speed lxt oscillator. when the halt instruction is executed the lxt oscillator can be chosen to run or not using the lxten bit in the ctrl2 register. ? ? ?? ? ?? ? - ?? ? ?? 6 \ v w h p & |