background image

HT46R46/C46/R47/C47/R48A/C48A/R49

Rev. 1.41

22

December 30, 2008

Configuring the Timer Mode

In this mode, the timer can be utilised to measure fixed
time intervals, providing an internal interrupt signal each
time the counter overflows. To operate in this mode, bits
TM1 and TM0 of the TMRC register must be set to 1 and
0 respectively. In this mode, the internal clock is used as
the timer clock. The input clock frequency to the timer is
f

SYS

divided by the value programmed into the timer

prescaler, the value of which is determined by bits
PSC0~PSC2 of the TMRC register. The timer-on bit,
TON must be set high to enable the timer to run. Each
time an internal clock high to low transition occurs, the
timer increments by one. When the timer is full and over-
flows, the timer will be reset to the value already loaded
into the preload register and continue counting. If the
timer interrupt is enabled, an interrupt signal will also be
generated. The timer interrupt can be disabled by ensur-
ing that the ETI bit in the INTC register is cleared to zero.
It should be noted that a timer overflow is one of the
wake-up sources.

Configuring the Event Counter Mode

In this mode, a number of externally changing logic
events, occurring on external pin PA4/TMR, can be re-
corded by the internal timer. For the timer to operate in
the event counting mode, bits TM1 and TM0 of the
TMRC register must be set to 0 and 1 respectively. The
timer-on bit, TON must be set high to enable the timer to
count. With TE low, the counter will increment each time
the PA4/TMR pin receives a low to high transition. If the
TE bit is high, the counter will increment each time TMR
receives a high to low transition. As in the case of the
other two modes, when the counter is full and overflows,
the timer will be reset to the value already loaded into
the preload register and continue counting. If the timer
interrupt is enabled, an interrupt signal will also be gen-
erated. The timer interrupt can be disabled by ensuring
that the ETI bit in the INTC register is cleared to zero. To
ensure that the external pin PA4/TMR is configured to
operate as an event counter input pin, two things have to
happen. The first is to ensure that the TM0 and TM1 bits
place the timer/event counter in the event counting

mode, the second is to ensure that the port control regis-
ter configures the pin as an input. It should be noted that
a timer overflow is one of the wake-up sources. Also in
the Event Counting mode, the Timer/Event Counter will
continue to record externally changing logic events on
the timer input pin, even if the microcontroller is in the
Power Down Mode. As a result when the timer over-
flows it will generate a wake-up and if the interrupts are
enabled also generate a timer interrupt signal.

Configuring the Pulse Width Measurement Mode

In this mode, the width of external pulses applied to the
pin-shared external pin PA4/TMR can be measured. In
the Pulse Width Measurement Mode, the timer clock
source is supplied by the internal clock. For the timer to
operate in this mode, bits TM0 and TM1 must both be
set high. If the TE bit is low, once a high to low transition
has been received on the PA4/TMR pin, the timer will
start counting until the PA4/TMR pin returns to its origi-
nal high level. At this point the TON bit will be automati-
cally reset to zero and the timer will stop counting. If the
TE bit is high, the timer will begin counting once a low to
high transition has been received on the PA4/TMR pin
and stop counting when the PA4/TMR pin returns to its
original low level. As before, the TON bit will be automat-
ically reset to zero and the timer will stop counting. It is
important to note that in the Pulse Width Measurement
Mode, the TON bit is automatically reset to zero when
the external control signal on the external timer pin re-
turns to its original level, whereas in the other two
modes the TON bit can only be reset to zero under pro-
gram control. The residual value in the timer, which can
now be read by the program, therefore represents the
length of the pulse received on pin PA4/TMR. As the
TON bit has now been reset any further transitions on
the PA4/TMR pin will be ignored. Not until the TON bit is
again set high by the program can the timer begin fur-
ther pulse width measurements. In this way single shot
pulse measurements can be easily made. It should be
noted that in this mode the counter is controlled by logi-
cal transitions on the PA4/TMR pin and not by the logic
level.

I n c r e m e n t

T i m e r   C o n t r o l l e r

P r e s c a l e r   O u t p u t

T i m e r   +   1

T i m e r   +   2

T i m e r   +   N

T i m e r   +   N   +   1

Timer Mode Timing Chart

T i m e r + 2

E x t e r n a l   E v e n t

I n c r e m e n t

T i m e r   C o u n t e r

T i m e r + 3

T i m e r + 1

Event Counter Mode Timing Chart

Summary of Contents for HT46R47

Page 1: ...pplication possibil ities such as sensor signal processing motor driving in dustrial control consumer products subsystem controllers etc Many features are common to all de vices however they differ in...

Page 2: ...y C o n f i g u r a t i o n O p t i o n P r o g r a m M e m o r y A d d r e s s D e c o d e r S t a c k S t a c k P o i n t e r P r o g r a m C o u n t e r L o o k u p T a b l e P o i n t e r T o P r...

Page 3: ...P A 5 I N T P A 6 P A 7 O S C 2 O S C 1 V D D R E S P D 0 P W M N C 2 0 1 9 1 8 1 7 1 6 1 5 1 4 1 3 1 2 1 1 1 2 3 4 5 6 7 8 9 1 0 P A 3 P F D P A 2 P A 1 P A 0 P B 3 A N 3 N C P B 2 A N 2 P B 1 A N 1...

Page 4: ...instructions determine if the pin is a CMOS output or Schmitt Trigger input Configuration options determine which pins on the port have pull high resistors PD0 PWM I O Pull high I O or PWM Bidirectio...

Page 5: ...guration option determines if this pin has a pull high resistor The PWM output are pin shared with pins PD0 and PD1 selected via a configuration option OSC1 OSC2 I O Crystal or RC OSC1 OSC2 are connec...

Page 6: ...rent WDT Disabled 3V No load system HALT 1 mA 5V 2 mA VIL1 Input Low Voltage for I O Ports TMR and INT 0 0 3VDD V VIH1 Input High Voltage for I O Ports TMR and INT 0 7VDD VDD V VIL2 Input Low Voltage...

Page 7: ...riod System Clock 217 218 tSYS tRES External Reset Low Pulse Width 1 ms tSST System Start up Timer Period Wake up from HALT 1024 tSYS tLVR Low Voltage Reset Time 0 25 1 2 ms tINT Interrupt Pulse Width...

Page 8: ...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...

Page 9: ...le and writable 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 limite...

Page 10: ...sion JMP SZ SZA SNZ SIZ SDZ SIZA SDZA CALL RET RETI Program Memory The Program Memory is the location where the user code or program is stored For microcontrollers two types of Program Memory are usua...

Page 11: ...2K Program Memory of the HT46R47 microcontroller The table pointer is setup here to have an initial value of 06H This will ensure that the first data read from the data table will be at the Program Me...

Page 12: ...mended that simultaneous use of the table read instructions should be avoided However in situations where simultaneous use cannot be avoided the inter rupts should be disabled prior to the execution o...

Page 13: ...ocations between these special function registers and the point where the General Pur pose Memory begins is reserved for future expansion purposes attempting to read data from these locations will ret...

Page 14: ...ses 0 0 H 0 1 H 0 2 H 0 3 H 0 4 H 0 5 H 0 6 H 0 7 H 0 8 H 0 9 H 0 A H 0 B H 0 C H 0 D H 0 E H 0 F H 1 0 H 1 1 H 1 2 H 1 3 H 1 4 H 1 5 H 1 6 H 1 7 H 1 8 H 1 9 H 1 A H 1 B H 1 C H 1 D H 1 E H 1 F H 2 0...

Page 15: ...s transferred to a user de fined location Status Register STATUS This 8 bit register contains the zero flag Z carry flag C auxiliary carry flag AC overflow flag OV power down flag PDF and watchdog tim...

Page 16: ...also mapped to specific addresses with the Data Memory The control register specifies which pins of that port are set as inputs and which are set as outputs To setup a pin as an input the correspondi...

Page 17: ...h or without pull high resistor structures can be re configured dynamically under software control Each pin of the I O ports is directly mapped to a bit in its associ ated port control register For th...

Page 18: ...options asso ciated with the A D function If used as I O pins then full pull high resistor configuration options remain however if used as A D inputs then any pull high resis tor options associated wi...

Page 19: ...R 0 W e a k P u l l u p A n a l o g I n p u t S e l e c t o r D Q C K S Q D Q C K S Q PB Input Output Ports V D D P F D o r P W M W a v e f o r m M U X R e a d D a t a R e g i s t e r C o n t r o l B...

Page 20: ...they should be connected to pull high resistors Timer Event Counters The provision of timers form an important part of any microcontroller giving the designer a means of carrying out time related func...

Page 21: ...programmed with the right data to ensure its correct operation a process that is normally carried out during program initialisation To choose which of the three modes the timer is to oper ate in the...

Page 22: ...s to ensure that the port control regis ter configures the pin as an input It should be noted that a timer overflow is one of the wake up sources Also in the Event Counting mode the Timer Event Counte...

Page 23: ...will not function however the pin can still be used as a normal input pin The PFD output will only be activated if bit PA3 is set to 1 This output data bit is used as the on off control bit for the P...

Page 24: ...an be turned on and off by controlling the en able bit in the timer control register Note that setting the timer enable bit high to turn the timer on should only be executed after the timer mode bits...

Page 25: ...cycles enables the generation of higher PWM frequencies which allow a wider range of applications to be served As long as the periods of the generated PWM pulses are less than the time constants of th...

Page 26: ...used as an on off control for the PWM function Note that if the configuration options have selected the PWM function but a 1 has been written to its corresponding bit in the PDC control register to c...

Page 27: ...high byte register ADRH utilises its full 8 bit contents The low byte register utilises only 1 bit of its 8 bit contents as it contains only the lowest bit of the 9 bit converted value In the followi...

Page 28: ...S0 bits in the ACSR register Although the A D clock source is determined by the sys tem clock fSYS and by bits ADCS1 and ADCS0 there are some limitations on the maximum A D clock source speed that can...

Page 29: ...on bits have changed then within a time frame of one to ten instruction cycles the START bit in the ADCR register must first be set high and then immediately cleared to zero This will ensure that the...

Page 30: ...ry powered applications Another important programming consideration is that when the A D channel selection bits change value the A D converter must be re initialised This is achieved by pulsing the ST...

Page 31: ...I disable ADC interrupt mov a 00000001B mov ACSR a setup the ACSR register to select fSYS 8 as the A D clock mov a 00100000B setup ADCR register to configure Port PB0 PB3 as A D inputs mov ADCR a and...

Page 32: ...wing START signal 0 1 0 must be issued within 10 instruction cycles Start_conversion clr START set START reset A D clr START start A D clr ADF clear ADC interrupt request flag set EADI enable ADC inte...

Page 33: ...ut value for the A D converters Note that to reduce the quantisation error a 0 5 LSB off set is added to the A D Converter input Except for the digitised zero value the subsequent digitised values wil...

Page 34: ...p to another section of program which is known as the interrupt service routine Here is located the code to control the appropriate interrupt The interrupt service routine must be terminated with a RE...

Page 35: ...utine call to the external interrupt vector at location 04H will take place When the interrupt is serviced the external inter rupt request flag EIF will be automatically reset and the EMI bit will be...

Page 36: ...voltage falls below a certain threshold Reset Functions There are five ways in which a microcontroller reset can occur through events occurring both internally and ex ternally Power on Reset The most...

Page 37: ...ways These flags known as PDF and TO are located in the status register and are controlled by various microcontroller operations such as the Power Down function or Watchdog Timer The reset flags are s...

Page 38: ...u u u u INTC 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u TMR x x x x x x x x x x x x x x x x x x x x x x x x u u u u u u u u TMRC 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 u u u u u u u P...

Page 39: ...u INTC 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u TMR x x x x x x x x x x x x x x x x x x x x x x x x u u u u u u u u TMRC 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 u u u u u u u PA 1 1 1...

Page 40: ...u u u u u u TMR x x x x x x x x x x x x x x x x x x x x x x x x u u u u u u u u TMRC 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 u u u u u u u PA 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u...

Page 41: ...u u u u u u u u TMRC 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 u u u u u u u PA 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u u PAC 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u...

Page 42: ...crystal manufacturer specified load capacitor value Crystal Recommended Capacitor Values Resonator C1 and C2 Values Resonator Frequency C1 C2 3 58MHz TBD TBD 1MHz TBD TBD 455kHz TBD TBD Note C1 and C...

Page 43: ...en into account by the circuit designer if the power consumption is to be minimized Special atten tion must be made to the I O pins on the device All high impedance input pins must be connected to eit...

Page 44: ...der chain for this reason the actual division ratio and corresponding Watchdog Timer time out can vary by a factor of two The exact division ratio depends upon the residual value in the Watchdog Timer...

Page 45: ...evelopment tools As these options are programmed into the device using the hardware programming tools once they are selected they cannot be changed later as the application software has no control ove...

Page 46: ...re a range of add and subtract instruction mnemonics to enable the necessary arithmetic to be carried out Care must be taken to ensure correct handling of carry and borrow data when results exceed 255...

Page 47: ...related sections Instruction Set Summary The following table depicts a summary of the instruction set categorised according to function and can be con sulted as a basic instruction reference using th...

Page 48: ...emory is zero with result in ACC Skip if decrement Data Memory is zero with result in ACC Subroutine call Return from subroutine Return from subroutine and load immediate data to ACC Return from inter...

Page 49: ...in the Accumulator Operation ACC ACC x Affected flag s OV Z AC C ADDM A m Add ACC to Data Memory Description The contents of the specified Data Memory and the Accumulator are added The result is store...

Page 50: ...T Clear Watchdog Timer Description The TO PDF flags and the WDT are all cleared Operation WDT cleared TO 0 PDF 0 Affected flag s TO PDF CLR WDT1 Pre clear Watchdog Timer Description The TO PDF flags a...

Page 51: ...flag is set then a value of 6 will be added to the high nibble Essentially the decimal conversion is performed by add ing 00H 06H 60H or 66H depending on the Accumulator and flag conditions Only the...

Page 52: ...d flag s None MOV A m Move Data Memory to ACC Description The contents of the specified Data Memory are copied to the Accumulator Operation ACC m Affected flag s None MOV A x Move immediate data to AC...

Page 53: ...the restored address Operation Program Counter Stack ACC x Affected flag s None RETI Return from interrupt Description The Program Counter is restored from the stack and the interrupts are re enabled...

Page 54: ...RRA m Rotate Data Memory right with result in ACC Description Data in the specified Data Memory and the carry flag are rotated right by 1 bit with bit 0 ro tated into bit 7 The rotated result is store...

Page 55: ...remented by 1 If the result is 0 the following instruction is skipped As this requires the insertion of a dummy instruction while the next instruction is fetched it is a two cycle instruction If the r...

Page 56: ...instruction is fetched it is a two cycle instruction If the result is 0 the program proceeds with the following instruction Operation Skip if m i 0 Affected flag s None SUB A m Subtract Data Memory f...

Page 57: ...the insertion of a dummy instruc tion while the next instruction is fetched it is a two cycle instruction If the result is not 0 the program proceeds with the following instruction Operation ACC m Sk...

Page 58: ...tion Data in the specified Data Memory and the Accumulator perform a bitwise logical XOR op eration The result is stored in the Data Memory Operation m ACC XOR m Affected flag s Z XOR A x Logical XOR...

Page 59: ...mil Outline Dimensions MS 012 Symbol Dimensions in mil Min Nom Max A 228 244 B 150 157 C 12 20 C 386 394 D 69 E 50 F 4 10 G 16 50 H 7 10 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 59 December 30...

Page 60: ...22 F 45 70 G 100 H 300 325 I 430 MS 001d see fig1 Symbol Dimensions in mil Min Nom Max A 845 880 B 240 280 C 115 195 D 115 150 E 14 22 F 45 70 G 100 H 300 325 I 430 HT46R46 C46 R47 C47 R48A C48A R49...

Page 61: ...MO 095a see fig2 Symbol Dimensions in mil Min Nom Max A 845 885 B 275 295 C 120 150 D 110 150 E 14 22 F 45 60 G 100 H 300 325 I 430 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 61 December 30 2008...

Page 62: ...Dimensions MS 013 Symbol Dimensions in mil Min Nom Max A 393 419 B 256 300 C 12 20 C 447 463 D 104 E 50 F 4 12 G 16 50 H 8 13 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 62 December 30 2008 1 8 1...

Page 63: ...2 F 45 70 G 100 H 300 325 I 430 MO 095a see fig2 Symbol Dimensions in mil Min Nom Max A 945 985 B 275 295 C 120 150 D 110 150 E 14 22 F 45 60 G 100 H 300 325 I 430 HT46R46 C46 R47 C47 R48A C48A R49 Re...

Page 64: ...imensions MS 013 Symbol Dimensions in mil Min Nom Max A 393 419 B 256 300 C 12 20 C 496 512 D 104 E 50 F 4 12 G 16 50 H 8 13 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 64 December 30 2008 2 0 1...

Page 65: ...e Dimensions Symbol Dimensions in mil Min Nom Max A 228 244 B 150 158 C 8 12 C 335 347 D 49 65 E 25 F 4 10 G 15 50 H 7 10 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 65 December 30 2008 2 0 1 1 1...

Page 66: ...22 F 45 70 G 100 H 300 325 I 430 MS 001d see fig2 Symbol Dimensions in mil Min Nom Max A 1160 1195 B 240 280 C 115 195 D 115 150 E 14 22 F 45 70 G 100 H 300 325 I 430 HT46R46 C46 R47 C47 R48A C48A R49...

Page 67: ...MO 095a see fig2 Symbol Dimensions in mil Min Nom Max A 1145 1185 B 275 295 C 120 150 D 110 150 E 14 22 F 45 60 G 100 H 300 325 I 430 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 67 December 30 2008...

Page 68: ...imensions MS 013 Symbol Dimensions in mil Min Nom Max A 393 419 B 256 300 C 12 20 C 598 613 D 104 E 50 F 4 12 G 16 50 H 8 13 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 68 December 30 2008 2 4 1...

Page 69: ...e Dimensions Symbol Dimensions in mil Min Nom Max A 228 244 B 150 157 C 8 12 C 335 346 D 54 60 E 25 F 4 10 G 22 28 H 7 10 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 69 December 30 2008 2 4 1 1 3...

Page 70: ...ne Dimensions Symbol Dimensions in mil Min Nom Max A 1375 1395 B 278 298 C 125 135 D 125 145 E 16 20 F 50 70 G 100 H 295 315 I 375 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 70 December 30 2008 2 8 1...

Page 71: ...imensions MS 013 Symbol Dimensions in mil Min Nom Max A 393 419 B 256 300 C 12 20 C 697 713 D 104 E 50 F 4 12 G 16 50 H 8 13 a 0 8 HT46R46 C46 R47 C47 R48A C48A R49 Rev 1 41 71 December 30 2008 2 8 1...

Page 72: ...2 D Key Slit Width 2 0 0 5 T1 Space Between Flange 16 8 0 3 0 2 T2 Reel Thickness 22 2 0 2 SOP 18W SOP 20W SOP 24W SOP 28W 300mil Symbol Description Dimensions in mm A Reel Outer Diameter 330 0 1 0 B...

Page 73: ...0 1 SOP 18W Symbol Description Dimensions in mm W Carrier Tape Width 24 0 0 3 0 1 P Cavity Pitch 16 0 0 1 E Perforation Position 1 75 0 1 F Cavity to Perforation Width Direction 11 5 0 1 D Perforatio...

Page 74: ...0 1 t Carrier Tape Thickness 0 30 0 05 C Cover Tape Width 21 3 0 1 SSOP 20S 150mil Symbol Description Dimensions in mm W Carrier Tape Width 16 0 0 3 0 1 P Cavity Pitch 8 0 0 1 E Perforation Position 1...

Page 75: ...1 t Carrier Tape Thickness 0 35 0 05 C Cover Tape Width 21 3 0 1 SSOP 24S 150mil Symbol Description Dimensions in mm W Carrier Tape Width 16 0 0 3 0 1 P Cavity Pitch 8 0 0 1 E Perforation Position 1...

Page 76: ...tion 11 5 0 1 D Perforation Diameter 1 5 0 1 0 0 D1 Cavity Hole Diameter 1 50 0 25 0 00 P0 Perforation Pitch 4 0 0 1 P1 Cavity to Perforation Length Direction 2 0 0 1 A0 Cavity Length 10 85 0 10 B0 Ca...

Page 77: ...ts in life support devices or systems Holtek reserves the right to alter its products without prior notification For the most up to date information please visit our web site at http www holtek com tw...

Reviews: