background image

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

Rev. 1.41

10

December 30, 2008

Stack

This is a special part of the memory which is used to
save the contents of the Program Counter only. The
stack can have either 4 or 6 levels depending upon
which device is selected and is neither part of the data
nor part of the program space, and is neither readable
nor writable. The activated level is indexed by the Stack
Pointer, SP, and is neither readable nor writable. At a
subroutine call or interrupt acknowledge signal, the con-
tents of the Program Counter are pushed onto the stack.
At the end of a subroutine or an interrupt routine, sig-
naled by a return instruction, RET or RETI, the Program
Counter is restored to its previous value from the stack.
After a device reset, the Stack Pointer will point to the
top of the stack.

If the stack is full and an enabled interrupt takes place,
the interrupt request flag will be recorded but the ac-
knowledge signal will be inhibited. When the Stack
Pointer is decremented, by RET or RETI, the interrupt
will be serviced. This feature prevents stack overflow al-
lowing the programmer to use the structure more easily.
However, when the stack is full, a CALL subroutine in-
struction can still be executed which will result in a stack
overflow. Precautions should be taken to avoid such
cases which might cause unpredictable program
branching.

Note:

For the HT46R46, 4 levels of stack are available
a n d f o r t h e H T 4 6 R 4 7 , H T 4 6 R 4 8 A a n d
HT46R49, 6 levels of stack are available.

Arithmetic and Logic Unit

-

ALU

The arithmetic-logic unit or ALU is a critical area of the
microcontroller that carries out arithmetic and logic op-
erations of the instruction set. Connected to the main
microcontroller data bus, the ALU receives related in-
struction codes and performs the required arithmetic or
logical operations after which the result will be placed in
the specified register. As these ALU calculation or oper-
ations may result in carry, borrow or other status
changes, the status register will be correspondingly up-
dated to reflect 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

Program Memory

The Program Memory is the location where the user code
or program is stored. For microcontrollers, two types of
Program Memory are usually supplied. The first type is
the One-Time Programmable, OTP, memory where us-
ers can program their application code into the device.

Devices with OTP memory are denoted by having an

²

R

²

within their device name. By using the appropriate pro-
gramming tools, OTP devices offer users the flexibility to
freely develop their applications which may be useful
during debug or for products requiring frequent upgrades
or program changes. OTP devices are also applicable for
use in applications that require low or medium volume
production runs. The other type of memory is the mask

ROM memory, denoted by having a

²

C

²

within the device

name. These devices offer the most cost effective solu-
tions for high volume products.

Structure

The Program Memory has a capacity of 1K by 14, 2K by
14 or 4K by 15 bits depending upon which device is se-
lected. The Program Memory is addressed by the Pro-
gram 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.

Special Vectors

Within the Program Memory, certain locations are re-
served for special usage such as reset and interrupts.

·

Location 000H
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.

·

Location 004H
This vector is used by the external interrupt. If the ex-
ternal interrupt pin on the device goes low, the pro-
gram will jump to this location and begin execution if
the external interrupt is enabled and the stack is not
full.

·

Location 008H
This internal vector is used by the Timer/Event Coun-
ter. If a counter overflow occurs, the program will jump
to this location and begin execution if the timer/event
counter interrupt is enabled and the stack is not full.

·

Location 00CH
This internal vector is used by the A/D converter.
When an A/D conversion cycle is complete, the pro-
gram will jump to this location and begin execution if
the A/D interrupt is enabled and the stack is not full.

P r o g r a m   C o u n t e r

S t a c k   L e v e l   1

S t a c k   L e v e l   2

S t a c k   L e v e l   3

S t a c k   L e v e l   N

P r o g r a m

M e m o r y

T o p   o f   S t a c k

S t a c k

P o i n t e r

B o t t o m   o f   S t a c k

Содержание HT46R47

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: