Page 1
Handbook October 2004 Copyright Ó 2004 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form by any means, electronic, mechanical photo-...
Page 8
By compiling all relevant data together in one handbook, we hope users of the Holtek range of A/D with LCD Type microcontroller devices will have at their fingertips a useful, complete and simple means to efficiently implement their microcontroller applications.
LCD driver circuits and, in addition to the usual Holtek advantages of low power consumption, high performance, I/O flexibility, as well as low cost, these devices have the versatility to suit a wide range of application possibilities in areas such as sensor signal processing and displaying, electronic metering, motor driving etc., for both industrial...
A/D with LCD Type MCU Block Diagram The following block diagram illustrates the main functional blocks of the A/D with LCD Type microcontroller series of devices. S y s t e m R C / P r o g r a m X ' t a l O s c i l l a t o r C o u n t e r T i m i n g...
Chapter 1 Hardware Structure Pin Assignment H T 4 6 R 6 2 / H T 4 6 C 6 2 H T 4 6 R 6 3 / H T 4 6 C 6 3 H T 4 6 R 6 4 / H T 4 6 C 6 4 5 6 S S O P - A 5 6 S S O P - A 5 6 S S O P - A...
Page 17
A/D with LCD Type MCU H T 4 6 R 6 5 / H T 4 6 C 6 5 1 0 0 Q F P - A H T 4 6 R 6 5 / H T 4 6 C 6 5 5 6 S S O P - A Note The pin compatibility features of the microcontroller packages allow for straightforward upgrading...
Chapter 1 Hardware Structure Pin Description HT46R62/HT46C62 Configuration Pin Name Description Option Bidirectional 8-bit input/output port. Each individual bit on this port can be configured as a wake-up input by a PA0/BZ Pull-high configuration option. Software instructions determine if PA1/BZ Wake-up the pin is a CMOS output or Schmitt Trigger input.
Page 19
A/D with LCD Type MCU Configuration Pin Name Description Option ¾ ¾ VMAX IC maximum voltage, connect to V or V1 ¾ V1, V2, C1, C2 LCD voltage pump LCD driver outputs for LCD panel segments. A configu- SEG0~SEG7 SEG0~SEG7 ration option can select all pins to be used as segment CMOS Output drivers or all pins to be used as CMOS outputs.
Page 20
Chapter 1 Hardware Structure HT46R63/HT46C63 Configuration Pin Name Description Option Bidirectional 8-bit input/output port. Each individual bit on this port can be configured as a wake-up input by a configuration option. Software instructions determine if Pull-high the pin is a CMOS output or Schmitt Trigger input. Con- PA0~PA7 figuration options determine whether the four pins Wake-up...
Page 21
A/D with LCD Type MCU Configuration Pin Name Description Option ¾ CMPN Negative input for comparator ¾ CMPP Positive input for comparator ¾ CMPO Comparator output ¾ CHGO Comparator output with 32768Hz carrier A/D converter reference voltage input. It should be ex- ¾...
Page 22
Chapter 1 Hardware Structure HT46R64/HT46C64 Configuration Pin Name Description Option Bidirectional 8-bit input/output port. Each individual bit on this port can be configured as a wake-up input by a PA0/BZ Pull-high configuration option. Software instructions determine PA1/BZ Wake-up if the pin is a CMOS output or Schmitt Trigger input. Buzzer Configuration options determine which pins on the port PA3/PFD...
Page 23
A/D with LCD Type MCU Configuration Pin Name Description Option ¾ V1, V2, C1, C2 LCD voltage pump LCD driver outputs for LCD panel segments. A config- SEG0~SEG7 SEG0~SEG7 uration option can select all pins to be used as seg- CMOS Output ment drivers or all pins to be used as CMOS outputs.
Page 24
Chapter 1 Hardware Structure HT46R65/HT46C65 Configuration Pin Name Description Option Bidirectional 8-bit input/output port. Each individual bit on this port can be configured as a wake-up input by a PA0/BZ Pull-high configuration option. Software instructions determine PA1/BZ Wake-up if the pin is a CMOS output or Schmitt Trigger input. Buzzer Configuration options determine which pins on the PA3/PFD...
Page 25
A/D with LCD Type MCU Configuration Pin Name Description Option ¾ V1, V2, C1, C2 LCD voltage pump LCD driver outputs for LCD panel segments. A config- SEG0~SEG7 SEG0~SEG7 uration option can select all pins to be used as seg- CMOS output ment drivers or all pins to be used as CMOS outputs.
Chapter 1 Hardware Structure Absolute Maximum Ratings -0.3V to V Supply Voltage.....................V +6.0V -0.3V to V Input Voltage ....................V +0.3V Storage Temperature.....................-50°C to 125°C Operating Temperature....................-40°C to 85°C These are stress ratings only. Stresses exceeding the range specified under Absolute Maximum Ratings may cause substantial damage to the device.
Page 27
A/D with LCD Type MCU Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions Standby Current (WDT OSC Off, 3V System HALT RTC On, LCD On with High Current STB6 Internal R Type Bias Option) ¾ ¾ ¾ 0.3V Input Low Voltage for I/O Ports ¾...
Page 28
Chapter 1 Hardware Structure For HT46R62/HT46C62, HT46R64/HT46C64, HT46R65/HT46C65 Ta=25°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions ¾ ¾ =4MHz Operating Voltage ¾ ¾ =8MHz ¾ Operating Current No load, f =4MHz (Crystal OSC) ADC Off ¾ ¾ Operating Current...
Page 29
A/D with LCD Type MCU Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions Input Low Voltage for ¾ ¾ ¾ 0.3V I/O Ports, TMR, TMR0 TMR1, INT0 , INT1 Input High Voltage for ¾ ¾ ¾ 0.7V I/O Ports, TMR, TMR0 TMR1, INT0, INT1 Input Low Voltage ¾...
Chapter 1 Hardware Structure A.C. Characteristics For HT46R63/HT46C63 Ta=25°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions ¾ ¾ 2.2V~5.5V 4000 System Clock ¾ ¾ 3.3V~5.5V 8000 RTC Frequency ¾ ¾ ¾ ¾ 32768 RTCOSC (32768Hz Crystal OSC) ¾ ¾...
Page 31
A/D with LCD Type MCU For HT46R62/HT46C62, HT46R64/HT46C64, HT46R65/HT46C65 Ta=25°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions ¾ ¾ 2.2V~5.5V 4000 System Clock SYS1 ¾ ¾ 3.3V~5.5V 8000 System Clock ¾ ¾ ¾ ¾ 32768 SYS2 (32768Hz Crystal OSC) ¾...
Chapter 1 Hardware Structure System Architecture A key factor in the high performance features of the Holtek range of A/D with LCD Type microcontrollers is attributed to the internal system architecture. The range of devices take advan- tage of the usual features found within RISC microcontrollers providing increased speed of opera- tion and enhanced performance.
A/D with LCD Type MCU For instructions involving branches, such as jump or call instructions, two machine cycles are re- quired to complete instruction execution. An extra cycle is required as the program takes one cy- cle to first obtain the actual jump or call address and then another cycle to actually execute the branch.
6. For the HT46R63/HT46C63 and HT46R64/HT46C64, since their Program Counter is 12 bits wide, the b12 column in the table is not applicable. 7. For the HT46R62/HT46C62, since its Program Counter is 11 bits wide, the b11 and b12 co- lumns in the table are not applicable.
Note 1. For the HT46R62/HT46C62, N=6, i.e. 6 levels of stack available. 2. For the HT46R63/HT46C63 and HT46R64/HT46C64, N=8, i.e. 8 levels of stack available. 3. For the HT46R65/HT46C65, N=16, i.e. 16 levels of stack available.
Chapter 1 Hardware Structure 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 users can program their application code into the de- vice.
TMR1 counter overflow occurs, the program will jump to this location and begin execution if the internal interrupt is enabled and the stack is not full. Note that the HT46R62/HT46C62 devices have only one timer, this interrupt vector is therefore not used.
Chapter 1 Hardware Structure Look-up Table Any location within the Program Memory can be defined as a look-up table where programmers can store fixed data. To use the look-up table, the table pointer must first be setup by placing the lower-order address of the look-up data to be retrieved in the Table Pointer Register TBLP.
Page 39
3. For the HT46R65/HT46C65, the Table address location is 13 bits, i.e. from b12~b0. 4. For the HT46R63/HT46C63 and HT46R64/HT46C64, the Table address location is 12 bits, i.e. from b11~b0. 5. For the HT46R62/HT46C62, the Table address location is 11 bits, i.e. from b10~b0.
Chapter 1 Hardware Structure 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. Divided into three sections, the first of these is an area of RAM where special function registers are located.
Data Memory. As the General Purpose Data Memory exists in Bank 0 for the HT46R62/HT46C62, HT46R63/HT46C63 and HT46R64/HT46C64 devices and in Bank 0 and Bank 2 for the HT46R65/HT46C65 devices, it is necessary to first ensure that the Bank Pointer is properly set to the correct value before accessing the General Purpose Data Memory.
Chapter 1 Hardware Structure The following diagram shows a detailed Special Purpose Data Memory Organization Map of the A/D with LCD Type microcontrollers: H T 4 6 R 6 2 H T 4 6 R 6 3 H T 4 6 R 6 4 H T 4 6 R 6 5 H T 4 6 C 6 2 H T 4 6 C 6 3...
Memory Pointers. Note For the HT46R62/HT46C62, bit 7 of the memory pointers are not implemented. However, it must be noted that when the memory pointers in these devices are read, a value of ²1² will be read. The following example shows how to clear a section of four RAM locations already defined as loca- tions adres1 to adres4.
Chapter 1 Hardware Structure Bank Pointer - BP In the Data Memory area it should be noted that both the General Purpose Data Memory and the LCD Memory have the same Data Memory addresses. Therefore when using instructions to ac- cess the LCD Memory or the General Purpose Data Memory, it is necessary to ensure that the cor- rect area is selected.
A/D with LCD Type MCU Real Time Clock Register - RTCC The RTCC register controls several internal functions one of which is the Real Time Clock (RTC) Interrupt, whose function is to provide an internal interrupt signal at regular fixed intervals. The driv- ing clock for the RTC interrupt comes from the internal clock source, known as f , which is then fur- ther divided to give longer time values, which in turn generates the interrupt signal.
Chapter 1 Hardware Structure Status Register - STATUS This 8-bit register (0AH) contains the zero flag (Z), carry flag (C), auxiliary carry flag (AC), overflow flag (OV), power down flag (PDF), and watchdog time-out flag (TO). It also records the status infor- mation and controls the operation sequence.
Depending upon which device is selected, all devices contain one or two integrated Timer/Event Counters of either 8-bit or 16-bit size. For the HT46R62/HT46C62 devices, which have a single 8-bit Timer/Event Counter, an associated register known as TMR is the location where the timer¢s 8-bit value is located.
ADSR. Input/Output Ports Holtek microcontrollers offer considerable flexibility on their I/O ports. With the input or output des- ignation of every pin fully under user program control, pull-high options for all pins and wake up op- tions on certain pins, the user is provided with an I/O structure to meet the needs of a wide range of application possibilities.
Each device in the A/D with LCD Type MCU series contains either one or two timers depending upon which one is chosen. The HT46R62/HT46C62 and HT46R63/HT46C63 devices each con- tain a single timer which has an external input pin, known as TMR, which is pin-shared with I/O pin...
Page 50
Chapter 1 Hardware Structure depending upon which package type is chosen, have either one or two external timer pins. For the 56-pin SSOP packages, although it contains two timers, only one external timer pin, TMR0, which is pin-shared with PD6, is available. For the 100-pin QFP packages there are two external timer pins, TMR0 and TMR1, which are pin-shared with I/O pins PD6 and PD7 respectively.
Page 51
A/D with LCD Type MCU Non-pin-shared Function Input/Output Ports Non-pin-shared Function Input/Output Ports - Except HT46R63/HT46C63...
Chapter 1 Hardware Structure Non-pin-shared Function Input/Output Ports - Except HT46R63/HT46C63 Programming Considerations Within the user program, one of the first things to consider is port initialization. After a reset, all of the I/O data and port control registers will be set high. This means that all I/O pins will default to an input state, the level of which depends on the other connected circuitry and whether pull-high op- tions have been selected.
LCD operation to occur. The Holtek A/D with LCD series of microcontrollers, with their internal LCD signal generating circuitry and various configuration options, will automatically generate these time and amplitude varying signals to pro- vide a means of direct driving and easy interfacing to a range of custom LCDs.
Page 54
LCD Memory end address of either 60H or 5FH. The HT46R63/HT46C63 de- vices can have either a 20´3 or 19´4 and HT46R62/HT46C62 can have either a 20´2, 20´3 or 19´4 format pixel drive capability, with an LCD Memory end address of either 53H or 52H. For all...
A/D with LCD Type microcontroller series. Part No. Duty Driver Number Bias Bias Type 20´2 HT46R62 20´3 1/2 or 1/3 C or R type HT46C62 19´4 20´3 HT46R63...
Page 56
N o r m a l O p e r a t i o n M o d e LCD Driver Output (1/2 Duty, 1/2 Bias) HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 Note 1. For 1/2 Bias, VA=VLCD, VB=VLCD´1/2 for both R and C type.
Page 57
N o r m a l O p e r a t i o n M o d e LCD Driver Output (1/3 Duty, 1/2 Bias) HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 Note 1. For 1/2 Bias, VA=VLCD, VB=VLCD´1/2 for both R and C type.
Page 58
N o r m a l O p e r a t i o n M o d e LCD Driver Output (1/4 Duty, 1/3 Bias) HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 Note 1. For 1/3 R type bias, the VA=VLCD, VB=VLCD´2/3 and VC=VLCD´1/3.
Page 59
N o r m a l O p e r a t i o n M o d e LCD Driver Output (1/3 Duty, 1/3 Bias) HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 Note 1. For 1/3 R type bias, the VA=VLCD, VB=VLCD´2/3 and VC=VLCD´1/3.
Page 60
Chapter 1 Hardware Structure D u r i n g R e s e t o r i n H A L T M o d e N o r m a l O p e r a t i o n M o d e LCD Driver Output (1/4 Duty, 1/3 Bias) - HT46R63/HT46C63 Note 1.
Page 61
A/D with LCD Type MCU D u r i n g R e s e t o r i n H A L T M o d e N o r m a l O p e r a t i o n M o d e LCD Driver Output (1/3 Duty, 1/3 Bias) - HT46R63/HT46C63 Note 1.
Chapter 1 Hardware Structure LCD Voltage Source and Biasing The time and amplitude varying signals generated by the Holtek A/D with LCD Type microcontrollers require the generation of several voltage levels for their operation. The biasing type and number of voltage levels used by the signal depends upon the device chosen and the bias configuration options chosen.
Page 63
® LCD Biasing - HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 The HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 devices differ from the HT46R63/HT46C63 devices in that they can have either R type or C type biasing with a value of ei- ther 1/2 or 1/3.
Chapter 1 Hardware Structure For C type biasing an external LCD voltage source must also be supplied on pin VLCD to generate the internal biasing voltages. The C type biasing scheme uses an internal charge pump circuit, which in the case of the 1/3 bias option can generate voltages higher than what is supplied on VLCD.
Page 65
A/D with LCD Type MCU Consideration must also be given to the capacitive load of the actual LCD used in the application. As the load presented to the microcontroller by LCD pixels can be generally modeled as mainly ca- pacitive in nature, it is important that this is not excessive, a point that is particularly true in the case of the COM lines which may be connected to many LCD pixels.
7-stage prescaler to TMR0 in the HT46R64/HT46C64 and HT46R65/HT46C65 and TMR in the HT46R62/HT46C62 clock circuitry gives added range to these timers. There are two types of registers related to the Timer/Event Counters. The first is the register that contains the actual value of the timer and into which an initial value can be preloaded.
For the 8-bit timer, this register is known as TMR for the HT46R62/HT46C62 devices and TMR0 for the HT46R64/HT46C64 devices. In the case of the 16-bit timer, a pair of 8-bit registers is required to store the16-bit timer value. For the HT46R63/HT46C63 which has a single 16-bit timer, this pair of registers is known as TMRL and TMRH.
Timer Control Registers - TMRC, TMR0C, TMR1C The flexible features of the Holtek microcontroller Timer/Event Counters enable them to operate in three different modes, the options of which are determined by the contents of their respective con- trol register. For devices with only one timer, the single timer control register is known as TMRC while for devices with two timers, there are two timer control registers known as TMR0C and TMR1C.
Page 70
Chapter 1 Hardware Structure measurement mode, the active transition edge level type is selected by the logic level of bit 3 of the Timer Control Register which is known as TE, T0E or T1E, depending upon which timer is used. In the case of the HT46R64/HT46C64 and HT46R65/HT46C65 devices, which have two timers, bit 5 of the TMR1C Timer Control Register, which is known as T1S, determines if the TMR1 clock source is f...
In this mode the internal clock is used as the timer clock. Note that for TMR in the HT46R62/HT46C62 devices and for TMR0 in the HT46R64/HT46C64 and HT46R65/HT46C65 devices, the timer input clock frequency is further divided by a prescaler, the value of which is de- termined by the bits PSC2~PSC0 or T0PSC2~T0PSC0 in the Timer Control Register.
Chapter 1 Hardware Structure Configuring the Event Counter Mode In this mode, a number of externally changing logic events, occurring on the external timer pin, can be recorded by the internal timer. For the timer to operate in the event counting mode, the bit pair, TM1/TM0, T0M1/T0M0 or T1M1/T1M0, depending upon which timer is used, must be set to 0 and 1 respectively.
A/D with LCD Type MCU preload register. If the external timer pin is pin-shared with other I/O pins, to ensure that the pin is configured to operate as a pulse width measuring input pin, two things have to happen. The first is to ensure that the TM1/TM0, T0M1/T0M0 or T1M1/T1M0 bits place the Timer/Event Counter in the pulse width measuring mode, the second is to ensure that the port control register configures the pin as an input.
Prescaler The single timer, TMR, in the HT46R62/HT46C62 device and TMR0 in the HT46R64/HT46C64 and HT46R65/HT46C65 devices all possess a prescaler. Bits 0~2 of their associated timer control register, namely bits PSC0~PSC2 or T0PSC0~T0PSC2, define the pre-scaling stages of the inter- nal clock source of the Timer/Event Counter.
For all devices, the PWM clock source is the system clock f Device Channels PWM Mode Output Pin PWM Register Name PWM0/PWM1/ HT46R62/HT46C62 6+2 or 7+1 PD0/PD1/PD2 PWM2 PWM0/PWM1/ HT46R63/HT46C63 PD0/PD1/PD2/PD3 PWM2/PWM3...
Chapter 1 Hardware Structure 6+2 PWM Mode Each full PWM cycle, as it is controlled by an 8-bit PWM register, has 256 clock periods. However, in the 6+2 PWM mode, each PWM cycle is subdivided into four individual sub-cycles known as modulation cycle 0 ~ modulation cycle 3, denoted as ²i²...
A/D with LCD Type MCU 7+1 PWM Mode Each full PWM cycle, as it is controlled by an 8-bit PWM register has 256 clock periods. However, in the 7+1 PWM mode, each PWM cycle is subdivided into two individual sub-cycles, known as modulation cycle 0 and modulation cycle 1, denoted as ²i²...
Chapter 1 Hardware Structure PWM Output Control On all devices, the PWM outputs are pin-shared with the Port D I/O pins. To operate as PWM out- puts and not as I/O pins, the correct PWM configuration options must be selected. A ²0² must also be written to the corresponding bits in the I/O port control register PDC to ensure that the required PWM output pins are setup as outputs.
Each of the devices in the Holtek A/D with LCD series of microcontrollers contains either a 6-channel or 8-channel analog to digital converter which can directly interface to external analog signals such as that from sensors or other control signals and convert these signals directly into either an 8-bit, 9-bit or 10-bit digital value.
PCR2~PCR0 has a value of ²100² or higher, then pins AN0~AN3 will all be set as analog inputs. For the HT46R62/HT46C62 and the 56-pin SSOP package version of the HT46R64/HT46C64 and HT46R65/HT46C65 devices which have only six analog inputs, note that if PCR2~PCR0 has a value of ²110²...
Page 81
A/D with LCD Type MCU A D C R R e g i s t e r H T 4 6 R 6 2 / H T 4 6 C 6 2 ® ® ® A D C R R e g i s t e r H T 4 6 R 6 3 / H T 4 6 C 6 3 H T 4 6 R 6 4 / H T 4 6 C 6 4 H T 4 6 R 6 5 / H T 4 6 C 6 5...
Chapter 1 Hardware Structure A/D Converter Clock Source Register - ACSR The clock source for the A/D converter originates from the system clock f , however the clock is first divided by a division ratio, the value of which is determined by the ADCS1 and ADCS0 bits in the ACSR register.
A/D with LCD Type MCU A/D Input Pins All of the A/D analog input pins are pin-shared with the I/O pins on Port B. The PCR2~PCR0 bits in the ADCR register, not configuration options, determine whether the input pins are setup as nor- mal Port B input/output pins or as analog inputs.
Page 84
A/D internal interrupt to occur. The following two short program ex- amples illustrate both of these methods. The example programs apply only to the HT46R62/ HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 devices which have two A/D data regis- ters.
Page 85
A/D with LCD Type MCU Start_conversion: clr ADCR.7 set ADCR.7 ; reset A/D clr ADCR.7 ; start A/D Polling_EOCB: sz ADCR.6 ; poll the ADCR register EOCB bit to detect end ; of A/D conversion polling_EOCB ; continue polling mov a,ADRH ;...
FF. Since the full-scale analog input value is equal to the VDD voltage, this gives a single bit analog input value of V /256. In the case of the HT46R62/HT46C62 devices which each contains a 9-bit A/D converter, their full-scale converted digitized value is equal to 1FF giving a single bit analog input value of V /512.
For the HT46R63/HT46C63 devices, its 8-bit resolu- tion A/D converter is achieved with 7-bit accuracy, the 9-bit A/D resolution of the HT46R62/ HT46C62 devices is achieved with 8-bit accuracy, while the 10-bit A/D resolution of the HT46R64/ HT46C64 and HT46R65/HT46C65 devices is achieved with 9-bit accuracy.
Page 88
Chapter 1 Hardware Structure All interrupts have the capability of waking up the processor when in the HALT mode. As an inter- rupt is serviced, a control transfer occurs by pushing the Program Counter onto the stack, followed by a branch to a subroutine at a specified location in the Program Memory. Only the Program Counter is pushed onto the stack.
Page 89
A/D with LCD Type MCU I N T C 0 R e g i s t e r H T 4 6 R 6 3 / H T 4 6 C 6 3 I N T C 1 R e g i s t e r H T 4 6 R 6 3 / H T 4 6 C 6 3...
Page 90
Chapter 1 Hardware Structure I N T C 0 R e g i s t e r H T 4 6 R 6 4 / H T 4 6 C 6 4 H T 4 6 R 6 5 / H T 4 6 C 6 5 I N T C 1 R e g i s t e r H T 4 6 R 6 4 / H T 4 6 C 6 4 H T 4 6 R 6 5 / H T 4 6 C 6 5...
Page 91
A/D with LCD Type MCU The various interrupt enable bits, together with their associated request flags, are shown in the fol- lowing diagram with their order of priority. Interrupt Priority - HT46R62/HT46C62 Interrupt Priority - HT46R63/HT46C63...
Chapter 1 Hardware Structure Interrupt Priority - HT46R64/HT46C64 and HT46R65/HT46C65 Note The A/D converter interrupt for the HT46R63/HT46C63 devices is a fully maskable interrupt and as such has an associated request flag ADF. However the A/D interrupts for the other devices are non-maskable and therefore do not have an associated request flag.
Time Base. For the HT46R63/HT46C63 devices, this will create a subroutine call to location 010H, while for the HT46R62/HT46C62, HT46R64/ HT46C64 and HT46R65/HT46C65 devices, a subroutine call to location 14H will be created.
HT46R63/HT46C63 devices is similar to the other interrupts in that it is a maskable type interrupt and has both an enable bit and a request flag. The A/D interrupt for the HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 devices is different in that it is a non-maskable type...
1. The Timer/Event Counter 1 is available only for the HT46R64/HT46C64 and HT46R65/ HT46C65 devices as there are two Timer/Event Counters in these devices. For the HT46R62/ HT46C62 and HT46R63/HT46C63 devices, there is only one timer, known as TMR. The HT46R64/HT46C64 and HT46R65/HT46C65 devices have two internal timers, known as TMR0 and TMR1.
Chapter 1 Hardware Structure The non-maskable A/D interrupt in the HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/ HT46C65 devices will always have priority over the other interrupts. However, with the exception of this non-maskable A/D interrupt, in cases where both external and internal interrupts are en- abled and where an external and internal interrupt occur simultaneously, the external interrupt will always have priority and will therefore be serviced first.
A/D with LCD Type MCU Reset There are five ways in which a microcontroller reset can occur, through events occurring both inter- nally and externally: ® Power-on Reset The most fundamental and unavoidable reset is the one that occurs after power is first applied to the microcontroller.
Page 98
Chapter 1 Hardware Structure ® Low Voltage Reset - LVR With the exception of the HT46R63/HT46C63 devices, the microcontroller contains a low voltage reset circuit in order to monitor the supply voltage of the device. If the supply voltage of the device drops to within a range of 0.9V~V such as might occur when changing the battery, the LVR will automatically reset the device internally.
Page 99
A/D with LCD Type MCU The different types of reset described affect the reset flags in different ways. These flags known as and TO are located in the status register and are controlled by various microcontroller operations such as the HALT function or Watchdog Timer. The reset flags are shown in the table: RESET Conditions RES reset during power on RES or LVR reset during normal operation...
Page 100
Chapter 1 Hardware Structure HT46R62/HT46C62 Reset RES or LVR WDT Time-out WDT Time-out Register (Power On) Reset (Normal Operation) (HALT) 1 x x x x x x x 1 u u u u u u u 1 u u u u u u u...
Page 101
A/D with LCD Type MCU HT46R63/HT46C63 Reset WDT Time-out WDT Time-out Register RES Reset (Power On) (Normal Operation) (HALT) x x x x x x x x u u u u u u u u u u u u u u u u u u u u u u u u x x x x x x x x u u u u u u u u...
Page 102
Chapter 1 Hardware Structure HT46R64/HT46C64 Reset RES or LVR WDT Time-out WDT Time-out Register (Power On) Reset (Normal Operation) (HALT) x x x x x x x x u u u u u u u u u u u u u u u u u u u u u u u u x x x x x x x x u u u u u u u u...
Page 103
A/D with LCD Type MCU HT46R65/HT46C65 Reset RES or LVR WDT Time-out WDT Time-out Register (Power On) Reset (Normal Operation) (HALT) x x x x x x x x u u u u u u u u u u u u u u u u u u u u u u u u x x x x x x x x u u u u u u u u...
Chapter 1 Hardware Structure Oscillator Various oscillator options offer the user a wide range of functions according to their various applica- tion requirements. The A/D with LCD Type MCU series, in addition to the system oscillator, also contains a Watchdog Oscillator. Two types of system clock can be selected for the HT46R63/ HT46C63 devices while three types of system clock can be selected for the other devices.
OSC1 and VDD is required for oscillation to take place. The value of this resistor ranges from 24kW to 1MW. For the HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/ HT46C65 devices, an external resistor connected between OSC1 and ground is required for oscil- lation to take place.
Chapter 1 Hardware Structure Although RC oscillators are cost effective oscillator configurations, the oscillation frequency can vary with VDD, temperature and process variations on the chip itself and is therefore not suitable for applications where timing is critical or where accurate oscillator frequencies are required. For the value of the external resistor ROSC, refer to the Appendix section for typical RC Oscillator vs.
A/D with LCD Type MCU For all devices, the RTC oscillator selection is controlled via configuration options. However, with the exception of the HT46R63/HT46C63 devices, an additional bit in the RTCC registers, known as the QOSC bit, also provides control over a quick start-up function for the RTC oscillator. If the RTC oscillator is not to be used as the system oscillator, which is a necessary condition for the HT46R63/HT46C63 devices and an optional condition for the other devices, a separate RC or crystal system oscillator must also be connected in the usual way to pins OSC1 and OSC2.
Internal Clock Source configuration option. For the HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 devices, it is important to note that if the RTC oscillator is selected as the system clock, f , then f will also be sourced from the RTC oscillator.
A/D with LCD Type MCU HALT and Wake-up in Power Down Mode The HALT mode is initialized by the ²HALT² instruction and results in the following: · The system oscillator will be turned off · The contents of the on chip RAM and registers remain unchanged ·...
Chapter 1 Hardware Structure After power on, or after a reset, the LVD will be switched off by clearing the LVDC bit in the RTCC register to ²0². Note that if the LVD is enabled there will be some power consumption associated with its internal circuitry, however, by clearing the LVDC bit to ²0²...
Page 111
Watchdog Timer - HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 Note For the HT46R62/HT46C62, HT46R64/HT46C64 and HT46R65/HT46C65 devices, since only the last stage of the counter chain is cleared by instructions, the WDT time-out period varies. As an example, the selected value of 2...
Chapter 1 Hardware Structure Under normal program operation, the WDT time-out will initialize a ²chip reset² and set the status bit ²TO². However, if the system is in the power-down mode, only a WDT time-out reset from ²HALT² will be initialized which will only reset the Program Counter and Stack Pointer. Three meth- ods can be adopted to clear the contents of the WDT.
Page 113
A/D with LCD Type MCU PA0/PA1 Pin Function Control PAC Register PAC Register PA Data Register PA Data Register Output Function PAC0 PAC1 PA0=BZ ´ PA1=BZ PA0=²0² ´ PA1=²0² PA0=BZ ´ PA1=input line PA0=²0² ´ PA1=input line PA0=input line ´ PA1=D PA0=input line ´...
Chapter 1 Hardware Structure Configuration Options The various microcontroller configuration options selected using the HT-IDE are stored in the op- tion memory. All bits must be defined for proper system function, the details of which are shown in the table. After the configuration options have been programmed into the microcontroller by the user, it is important to note that they cannot be altered later by the application program.
Page 115
PD0~PD3: PWM0~PWM3 function selection mode: 6+2 or 7+1 mode selection PFD Options PA3: normal I/O or PFD output PFD clock selection: TMR0 or TMR1 (except HT46R62/HT46C62) Buzzer Options PA0/PA1: normal I/O or BZ/BZ or PA0=BZ and PA1 as normal I/O Buzzer frequency: f...
1. In this application, the HT46R65/HT46C65 is taken as an example, however, this application can also be applied to the HT46R62/HT46C62 and HT46R64/HT46C64 devices. 2. As the VMAX pin connection depends on a number of factors such as LCD bias type and bias...
Page 117
1. In this application, the HT46R65/HT46C65 is taken as an example, however, this application can also be applied to the HT46R62/HT46C62 and HT46R64/HT46C64 devices. As the HT46R63/HT46C63 devices are not able to use a 32768Hz RTC crystal as their system clock, this drawing is not applicable for these devices.
Page 118
Chapter 1 Hardware Structure RC or Crystal System Oscillator with RTC Oscillator (For HT46R63/HT46C63 only) S e e b e l o w H T 4 6 R 6 3 / H T 4 6 C 6 3 R C S y s t e m O s c i l l a t o r C r y s t a l S y s t e m O s c i l l a t o r...
In the case of Holtek microcontrollers, a comprehensive and flexible set of over 60 instructions is provided to en- able programmers to implement their application with the minimum of programming overheads.
The standard logical operations such as AND, OR, XOR and CPL all have their own instruction within the Holtek microcontroller instruction set. As with the case of most instructions involving data manipulation, data must pass through the Accumulator which may involve additional pro- gramming steps.
To overcome this problem, Holtek microcontrollers allow an area of Program Memory to be setup as a table where data can be directly stored. A set of easy to use instructions provides the means by which this fixed data can be referenced and retrieved from the Program Memory.
Page 125
A/D with LCD Type MCU Mnemonic Description Cycles Flag Affected Logic Operation AND A,[m] Logical AND Data Memory to ACC OR A,[m] Logical OR Data Memory to ACC XOR A,[m] Logical XOR Data Memory to ACC Note ANDM A,[m] Logical AND ACC to Data Memory Note ORM A,[m] Logical OR ACC to Data Memory...
Page 126
Chapter 2 Instruction Set Introduction Mnemonic Description Cycles Flag Affected Branch JMP addr Jump unconditionally None Note SZ [m] Skip if Data Memory is zero None Note SZA [m] Skip if Data Memory is zero with data movement to ACC None Note SZ [m].i...
Chapter 3 Instruction Definition C h a p t e r 3 Instruction Definition ADC A,[m] Add Data Memory to ACC with Carry Description The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the Accumulator. ACC ¬...
Page 129
A/D with LCD Type MCU AND A,[m] Logical AND Data Memory to ACC Description Data in the Accumulator and the specified Data Memory perform a bitwise logical AND op- eration. The result is stored in the Accumulator. ACC ¬ ACC ²AND² [m] Operation Affected flag(s) AND A,x...
Page 130
Chapter 3 Instruction Definition CLR WDT 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 and the WDT are all cleared. Note that this instruction works in conjunc- tion with CLR WDT2 and must be executed alternately with CLR WDT2 to have effect.
Page 131
A/D with LCD Type MCU DAA [m] Decimal-Adjust ACC for addition with result in Data Memory Description Convert the contents of the Accumulator value to a BCD ( Binary Coded Decimal) value re- sulting from the previous addition of two BCD variables. If the low nibble is greater than 9 or if AC flag is set, then a value of 6 will be added to the low nibble.
Page 132
Chapter 3 Instruction Definition INCA [m] Increment Data Memory with result in ACC Description Data in the specified Data Memory is incremented by 1. The result is stored in the Accumu- lator. The contents of the Data Memory remain unchanged. ACC ¬...
Page 133
A/D with LCD Type MCU OR A,x Logical OR immediate data to ACC Description Data in the Accumulator and the specified immediate data perform a bitwise logical OR op- eration. The result is stored in the Accumulator. ACC ¬ ACC ²OR² x Operation Affected flag(s) ORM A,[m]...
Page 134
Chapter 3 Instruction Definition RLA [m] Rotate Data Memory left with result in ACC Description The contents of the specified Data Memory are rotated left by 1 bit with bit 7 rotated into bit 0. The rotated result is stored in the Accumulator and the contents of the Data Memory re- main unchanged.
Page 135
A/D with LCD Type MCU RRC [m] Rotate Data Memory right through Carry Description The contents of the specified Data Memory and the carry flag are rotated right by 1 bit. Bit 0 replaces the Carry bit and the original carry flag is rotated into bit 7. [m].i ¬...
Page 136
Chapter 3 Instruction Definition SDZA [m] Skip if decrement Data Memory is zero with result in ACC Description The contents of the specified Data Memory are first decremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged.
Page 137
A/D with LCD Type MCU SNZ [m].i Skip if bit i of Data Memory is not 0 Description If bit i of the specified Data Memory is not 0, the following instruction is skipped. As this re- quires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction.
Page 138
Chapter 3 Instruction Definition SZ [m] Skip if Data Memory is 0 Description If the contents of the specified Data Memory 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.
Page 139
A/D with LCD Type MCU XOR A,[m] Logical XOR Data Memory to ACC Description Data in the Accumulator and the specified Data Memory perform a bitwise logical XOR op- eration. The result is stored in the Accumulator. ACC ¬ ACC ²XOR² [m] Operation Affected flag(s) XORM A,[m]...
Cross Assembler Assembly-Language programs are written as source files. They can be assembled into object files by the Holtek Cross Assembler. Object files are combined by the Cross Linker to generate a task file. A source program is made up of statements and look up tables, giving directions to the Cross As- sembler at assembly time or to the processor at run time.
A/D with LCD Type MCU Example of Convention Description of Convention Three dots following an item signify that more items with the same form may be entered. For example, the directive PUB- LIC has the following form: Repeating elements... PUBLIC name1 [,name2 [,...]] In the above form, the three dots following name2 indicate that many names can be entered as long as each is pre- ceded by a comma.
Chapter 4 Assembly Language and Cross Assembler Comment Comments are the descriptions of codes. They are used for documentation only and are ignored by the Cross Assembler. Any text following a semicolon is considered a comment. Assembly Directives Directives give direction to the Cross Assembler, specifying the manner in which the Cross Assem- bler generates object code at assembly time.
A/D with LCD Type MCU File Control Directives ® Syntax INCLUDE file-name INCLUDE ²file-name² · Description This directive inserts source codes from the source file given by file-name into the current source file during assembly. Cross Assembler supports at most 7 nesting levels. ·...
Chapter 4 Assembly Language and Cross Assembler ® Syntax .LISTINCLUDE .NOLISTINCLUDE · Description The directive .LISTINCLUDE inserts the contents of all included files into the program listing. The directive .NOLISTINCLUDE suppresses the addition of included files. The default is .NOLISTINCLUDE. ®...
Page 145
A/D with LCD Type MCU For DATA sections, the byte address is in one byte units (8 bits/byte). BYTE aligns the section at any byte address, WORD aligns the section at any even address, PARA aligns the section at any address which is a multiple of 16, and PAGE aligns the section at any address which is a multiple of 256.
Page 146
Chapter 4 Assembly Language and Cross Assembler ® Syntax ORG expression · Description This directive sets the location counter to expression. The subsequent code and data offsets begin at the new offset specified by expression. The code or data offset is relative to the be- ginning of the section where the directive ORG is defined.
A/D with LCD Type MCU ® Syntax PROC name ENDP name · Description The PROC and ENDP directives mark a block of code which can be called or jumped to from other modules. The PROC creates a label name which stands for the address of the first instruction of a procedure.
Page 148
Chapter 4 Assembly Language and Cross Assembler ® Syntax [name] DB value1 [,value2 [, ...]] [name] DW value1 [,value2 [, ...]] [name] DBIT [name] DB repeated-count DUP(?) [name] DW repeated-count DUP(?) · Description These directives reserve the number of bytes/words specified by the repeated-count or reserve bytes/words only.
A/D with LCD Type MCU Macro Directives Macro directives enable a block of source statements to be named, and then that name to be re-used in the source file to represent the statements. During assembly, the Cross Assembler auto- matically replaces each occurrence of the macro name with the statements in the macro definition. A macro can be defined at any place in the source file as long as the definition precedes the first source line that calls this macro.
Page 150
Chapter 4 Assembly Language and Cross Assembler The following source program refers to the macro Delay ... T . A S M S a m p l e p r o g r a m f o r M A C R O . .
A/D with LCD Type MCU Assembly Instructions The syntax of an instruction has the following form: [name:] mnemonic [operand1[,operand2]] [;comment] where ® label name name: ® instruction name (keywords) mnemonic ® registers operand1 memory address ® registers operand2 memory address immediate value Name A name is made up of letters, digits, and special characters, and is used as a label.
Page 152
Chapter 4 Assembly Language and Cross Assembler The values of these shift bit operators are all constant values. The expression is shifted right SHR or left SHL by the number of bits specified by count. If bits are shifted out of position, the corresponding bits that are shifted in are zero-filled.
Chapter 4 Assembly Language and Cross Assembler Reserved Assembly Language Words The following tables list all reserved words used by the assembly language. · Reserved Names (directives, operators) INCLUDE LABEL OFFSET ELSE .LIST .LISTINCLUDE ENDIF .LISTMACRO PAGE ENDM LOCAL PARA ENDP PROC MACRO...
A/D with LCD Type MCU Cross Assembler Options The Cross Assembler options can be set via the Options menu Project command in HT-IDE3000. The Cross Assembler Options is located on the center part of the Project Option dialog box. The symbols could be defined in the Define Symbol edit box. ®...
Chapter 4 Assembly Language and Cross Assembler · Summary l l l l ® line number (4 digits, right alignment) oooo ® offset of code (4 digits) hhhh ® two 4-digits for opcode E ® external reference C ® statement from included file R ®...
Page 157
A/D with LCD Type MCU ® Example of assembly listing file F i l e : S A M P L E . A S M H o l t e k C r o s s - A s s e m b l e r V e r s i o n 2 .
To ease the process of application development, the importance and availability of supporting tools for microcontrollers cannot be underestimated. To support its range of MCUs, Holtek is fully committed to the development and release of easy to use and fully functional tools for its full range of devices.
Central to the system is the in-circuit hardware emulator, capable of emulating all of Holtek¢s 8-bit devices in real-time, while also providing a range of powerful debugging and trace fa- cilities. Regarding software functions, the system incorporates a user-friendly Windows based workbench which integrates together functions such as program editor, Cross Assembler, Cross Linker and library manager.
The Holtek OTP programmers are supplied with a standard Textool chip socket. The OTP Adapter Card is used to connect the Holtek OTP programmers to the various sizes of available OTP chip packages that are unable to use this supplied socket.
AVDD voltages, short positions 2 and 3, then provide the voltage from JP3 and JP4. DIP switch SW1 should be set according to which device is selected and in accordance with the fol- lowing table: Part No. HT46R62 HT46R63 HT46R64 HT46R65 JP5 consists of the LCD common and segment outputs and JP6 consists of the I/O ports and other pins.
Exercise care when using the power adapter. Do not use a power adapter whose output voltage is not 16V, otherwise the HT-ICE may be damaged. It is strongly recommended that only the power adapter supplied by Holtek be used. First plug the power adapter to the power connector of the HT-ICE.
Page 165
A/D with LCD Type MCU Click <HT-IDE3000> button and the following dialog will be shown. Click <HT-IDE3000> or <Service Pack> as you want. Here¢s an Example of installing HT-IDE3000 Click <HT-IDE3000> button. · Step 2 Press the <Next> button to continue setup or press <Cancel> button to abort.
Page 166
Chapter 5 MCU Programming Tools · Step 3 The following dialog will be shown to ask the user to enter a directory name. · Step 4 Specify the path you want to install the HT-IDE3000 and click <Next> button. · Step 5 Setup will copy all files to the specified directory.
Page 167
(EXE), dynamic link libraries (DLL) and configuration files (CFG, FMT) for all supported MCU. The INCLUDE subdirectory contains all the include files (.H, .INC) provided by Holtek. The LIB subdirectory contains the library files (.LIB) provided by Holtek. The SAMPLE subdirectory con- tains some sample programs.
Chapter 6 Quick Start C h a p t e r 6 Quick Start This chapter gives a brief description of using HT-IDE3000 to develop an application project. Step 1 - Create a New Project · Click on Project menu and select New command ·...
Step 5 - Transmit Code to Holtek · Click on Project menu and select Print Option Table command · Send the .COD file and the Option Approval Sheet to Holtek The Programming and data flow is illustrated by the following diagram: .
LCD Simulator Introduction The Holtek LCD simulator, known as the HT-LCDS, provides a mechanism allowing users to simu- late the output of LCD drivers. According to the user designed patterns and the control programs, the HT-LCDS displays the patterns on the screen in real time. It facilitates the development pro- cess even if the actual LCD hardware panel is unavailable.
A/D with LCD Type MCU Relationship Between the Panel File and the Current Project By default, the panel configuration file has the same file name as the current project name except for the extension name, which is .lcd. The HT-LCDS assumes this file to be the corresponding panel configuration file of the current project.
Chapter 7 LCD Simulator New: create a new panel configuration file Open: open an existing panel configuration file Save: save the panel configuration file Cut: delete a pattern Copy: copy a pattern to the clipboard Paste: add the copied pattern to the panel I: panel information dialog S: enter the LCD simulation mode LCD Panel Picture File...
A/D with LCD Type MCU The panel configurations include: · COM and SEG. To set the LCD driver total COMMON number and SEGMENT number. The de- fault number of the LCD driver for this microcontroller is displayed when the Panel Configuration dialog box is displayed.
Chapter 7 LCD Simulator · Select a pattern, a bitmap file, from the Pattern List box, or click the Browse button to change to another directory and select a pattern from that directory. The HT-LCDS uses 2-color bitmap files as the image source of patterns. The Preview-window zooms into the selected pattern. ·...
A/D with LCD Type MCU How to Add a User-defined Matrix The HT-LCDS supports a mapping strategy (File menu, Import user matrix command) which can help define a new matrix if the COM/SEG number is not equal to the ROW/COL number of the LCD panel.
Chapter 7 LCD Simulator The following steps select the pattern positions for all the patterns in the LCD panel · Invoke the Panel Editor by selecting the Edit command, Panel Editor command after having set the panel configuration · Select the File menu, Open command in the Panel Editor to open the panel picture file (.bmp) Note Supports 2-color .BMP only ·...
Appendix A Device Characteristic Graphics A p p e n d i x A Device Characteristic Graphics The following characteristic graphics depicts typical device behavior. The data presented here is a statistical summary of data gathered on units from different lots over a period of time. This is for in- formation only and the figures were not tested during manufacturing.
Page 181
A/D with LCD Type MCU Typical RC OSC vs. Temperature (For HT46R63/HT46C63) ° Typical RC OSC vs. Temperature (Except HT46R63/HT46C63) °...
Page 182
Appendix A Device Characteristic Graphics Typical RC Oscillator Frequency vs. V (For HT46R63/HT46C63) Typical RC Oscillator Frequency vs. V (Except HT46R63/HT46C63)
Page 183
A/D with LCD Type MCU vs. V ° ° ° ° vs. V ° ° ° °...
Page 184
Appendix A Device Characteristic Graphics vs. V ° ° ° ° vs. V ° ° ° °...
Page 185
A/D with LCD Type MCU Typical R vs. V ° ° ° ° Typical V vs. V in -40°C to +85°C...
Page 186
Appendix A Device Characteristic Graphics Typical I vs. V Watchdog Enable ° ° ° ° Typical t vs. V WDTOSC ° ° ° °...
Page 187
A/D with LCD Type MCU Typical I vs. Frequency (External Clock, Ta=-40°C) Typical I vs. Frequency (External Clock, Ta=0°C)
Page 188
Appendix A Device Characteristic Graphics Typical I vs. Frequency (External Clock, Ta=+25°C) Typical I vs. Frequency (External Clock, Ta=+85°C)
Page 189
A/D with LCD Type MCU Typical V vs. Temperature °...
Page 194
Copyright Ó 2004 by HOLTEK SEMICONDUCTOR INC. The information appearing in this handbook is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for...
Need help?
Do you have a question about the HT46R62 and is the answer not in the manual?
Questions and answers