Basic Information Functional Description Application Description Points to Note Others

Basic Information

 

Question 1

What are the contents of the HT46 A/D with LCD type MCUs?

Answer

Together there are a total of 8 devices in the Holtek A/D with LCD MCU series. Made up from different memory sizes of 2K, 4K and 8K and supplied in both OTP and Mask versions. They are known by name as the HT46R62/HT46C62、HT46R63/HT46C63、HT46R64/HT46C64、HT46R65/HT46C65. The specifications and description of each device can be found in its relevant data sheet.


Question 2

What are the differences between the various devices in the HT46 A/D with LCD type MCUs?

Answer

Please check on the table below for the differences. For more detailed information consult the data sheet.

Part No. VDD System
Clock
Program
Memory
Data
Memory
I/O LCD Timer Interrupt A/D PWM PFD UART Stack Package
8-bit 16-bit RTC Ext. Int.
HT46R62
HT46C62*
2.2V~
5.5V
400kHz~
8MHz or
32768Hz
2Kx14 88x8 20 19x4
or
20x3
1 -- v 2 4 9-bitx6 8-bitx3 v -- 6 56SSOP
HT46R63
HT46C63
2.2V~
5.5V
400kHz~
8MHz
4Kx15 208x8 32 19x4
or
20x3
-- 1 v 2 4 8-bitx8 8-bitx4 -- -- 8 56SSOP,
100QFP
HT46R64
HT46C64*
2.2V~
5.5V
400kHz~
8MHz or
32768Hz
4Kx15 192x8 24 32x4
or
33x3
1 1 v 2 5 10-bitx8 8-bitx4 v -- 8 56SSOP,
100QFP
HT46R65
HT46C65*
2.2V~
5.5V
400kHz~
8MHz or
32768Hz
8Kx16 384x8 24 40x4
or
41x3
-- 2 v 2 5 10-bitx8 8-bitx4 v -- 16 56SSOP,
100QFP
HT46R66*
HT46C66*
2.2V~
5.5V
400kHz~
8MHz or
32768Hz
16Kx16 576x8 32 46x4
or
47x3
1 2 v 2 6 12-bitx8 8-bitx4 v v 16 56SSOP,
100QFP

Question 3

What are the various packages available in the HT46 A/D with LCD type MCUs?

Answer

HT46R62/HT46C62: 56SSOP
HT46R63/HT46C63: 100QFP
HT46R64/HT46C64: 56SSOP
: 100QFP
HT46R65/HT46C65: 56SSOP (compatible pin outs with HT46R64/HT46C64 for convenient MCU upgrade)
: 100QFP (compatible pin outs with HT46R64/HT46C64 for convenient MCU upgrade)

Question 4

What is the operating frequency of the HT46 A/D with LCD type MCUs?

Answer

For 5V/3.3V or 3-cell battery applications, the maximum operating frequency is 8MHz (3.3V). For 3V or 2-cell battery applications the maximum operating frequency is 4MHz (2.2V)


Question 5

What is the system frequency tolerance if an RC oscillator is used as the system clock?

Answer

If the RC oscillator is selected, due to tolerances in the device processing, a nominal ±20% frequency tolerance from lot to lot is expected. Assuming that the external resistor has a ±5% tolerance, then the overall frequency tolerance would be ±25%.

The above specified tolerance is provided as a reference only and is not guaranteed. For applications where a more precise frequency source is required it is recommended that either a resonator or crystal frequency source is used.


Functional Description

 


Question 1

What are the special features and characteristics of the HT46 A/D with LCD type MCUs?

Answer

Operating Voltage range of 2.2V ~ 5.5V
Industrial standard temperature range of -40°C ~ +85°C
Low Voltage Reset function
Fully compatible OTP and Mask Types
For further details consult the relevant Holtek data sheet


Question 2

How to use the indirect memory addressing mode?

Answer

First the address to be read or written must be placed in the relevant memory pointer, known as MP. After this any instruction that refers to the Indirect Register, known as IAR, (e.g. MOV a, IAR) will result in action taking place on data pointed to by the memory pointer (MP). Indirect memory addressing is particularly useful for operations on data arrays by first placing the first array address in the memory pointer. Data can then be read or written from different places in the array by manipulating the data pointer.


Question 3

How are the table read instructions used and are there any special points to note?

Answer

There are two kinds of table read instructions, the first is the TABRDC instruction which is used to read data from the present program memory page. The second is the TABRDL statement which can read data from the last page of program memory. When reading data from tables it is first necessary to place the low byte of the program memory address where the data is stored, into the table pointer register TBLP. The table read instruction can then be executed which will place the low byte of the table data into the register indicated by the table read instruction. The high byte of the table data will be placed into the TBLH register. Note that the highest unimplemented bits in the data high byte will read as "0".


Question 4

What are the clock sources of RTC,WDT and Time Base available for the HT46 A/D with LCD type MCUs?

Answer

For the HT46 A/D with LCD type MCU, the RTC, WDT and Time Base use the same clock source. The clock source is chosen in the configuration options. 

If RTC OSC is chosen as the system clock, the RTC, WDT and Time Base use the RTC OSC as clock source; (Since RTC OSC is the clock source not affected by the HALT function, the WDT OSC is no longer needed as the clock source, therefore under the power saving consideration, the clock source of WDT and Time base is fixed to RTC OSC.)

If RTC OSC is not chosen as the system clock, the RTC, WDT and Time Base, there are three clock resources available, namely:

  1. fSYS/4

  2. RTC OSC

  3. WDT OSC


Question 5

If the WDT oscillator clock is selected how is the WDT timing calculated?

Answer

The WDT oscillator at an operating voltage of 5V has a typical period of 65µs (range of 32µs~130µs). The watchdog time will range from 65µs x 215=2.13 Sec. to 65µs x 216=4.26 Sec. which is selected in the configuration option.


Question 6

What is the difference between choosing the WDT oscillator or the fSYS/4 clock as the WDT clock source?

Answer

If the WDT oscillator clock is chosen as the clock source then if the system enters a HALT condition the WDT timer will continue to function. When the WDT time-outs the system will be woken up from its HALT state. If the fSYS/4 clock is chosen as the WDT clock source then the WDT will cease to function and system will not be woken up when a HALT state is entered. The cost in choosing the WDT oscillator is that some power will be consumed by its clock. For systems that operate with HALT feature and need not to be woken up from HALT by WDT overflow, in this case the fSYS/4 clock source should be selected.


Question 7

How is the 8-bit timer setup?

Answer

The 8-bit timer/counter is a count up timer which upon reaching a count of 255 (0FFH) will reset itself to 00H and generate an internal interrupt signal. To obtain different timer counts, say N, of less than 256, the timer should be first preset with a fixed value of 256-N. After setting up this preset value the timer should be activated which will enable it to count from this preset value to 255. The value that the timer is to count N, is therefore given by the formula 256-(256-N)=N.


Question 8

How is the 16-bit timer setup?

Answer

The 16-bit timer/counter is a count up counter, which upon reaching a value of 65535 (0FFFFH) will reset itself to 0000H and generate an internal interrupt signal. To obtain different timer counts, say N, of less than 65536, the timer should be first preset with a fixed value of 65536-N. After setting up this preset value the timer should be activated which will enable it to count from this preset value to 65535. The value that the timer is to count N, is therefore given by the formula 65536-(65536-N)=N.


Question 9

What is the access sequence of the 16-bit Timer/Counter?

Answer

For the HT46 A/D type MCU, the internal data bus is 8-bit wide, therefore for the 16-bit Timer/Counter, the user has to write the Low Byte data first and then write the high byte data. To read the Timer/Counter contents, the user has to first read the High Byte data first and then the Low Byte data.


Question 10

How is Timer/Counter setup in the Timer Mode?

Answer

There are three modes available for the Timer/Counter, i.e. Timer Mode, Event Counter Mode and Pulse Width Mode. To setup in the Timer Mode, the following process should be followed:

  1. Choose clock source

  2. Set to Timer Mode by writing 10H to TM1, TM0

  3. Set the initial timer TMR value

  4. Enable the corresponding interrupt by setting the ETI and EMI bit

  5. Start the Timer by setting the TON bit of the TMRC

Once the Timer is enabled, it will count up and will be stopped when the TON bit in the TMRC register is cleared. If the Timer is enabled once again, the counter will start counting from the value where it was stopped. If the Timer overflows, an internal interrupt request will be issued and the TMR will be reloaded with the initial value.


Question 11

How is the Timer/Counter setup in the Event Counter Mode?

Answer

There are three modes available for the Timer/Counter, i.e. Timer Mode, Event Counter Mode and Pulse Width Mode. To set in the Event Counter Mode, the following process should be followed:

  1. Set to Event Counter Mode by writing 01H to TM1, TM0

  2. Select TE=1 to count on the falling edge and TE=0 to count on the rising edge

  3. Set the Timer initial value into TMR

  4. Enable the corresponding interrupt by setting the ETI and EMI bits

  5. Start the Timer by setting the TON bit in the TMRC register


Question 12

How is the 16-bit Timer/Counter setup in the Pulse Width Mode?

Answer

There are three modes available for the Timer/Counter, i.e. Timer Mode, Event Counter Mode and Pulse Width Mode. To set in the Pulse Width Mode, the following process should be followed:

  1. Choose clock source in configuration option

  2. Set to Pulse Width Mode by writing 11H to TM1, TM0

  3. Select TE=1 to measure a High Pulse Width and TE=0 to measure a Low Pulse Width

  4. Set the Timer initial value, TMR, usually set to 0H for Pulse Width Measurements

  5. Enable the corresponding interrupt by setting the ETI and EMI bits

  6. Start the Timer by setting the TON bit in the TMRC

After the Timer/Counter is enabled, the user can poll the TON bit, if one pulse measurement is complete, the TON bit will be cleared to 0.


Question 13

How is the Timer/Counter 0 clock source setup?

Answer

For HT46R63/HT46C63, there is only one 16-bit Timer and the clock source is fSYS/4.

For HT46R62/HT46C62 8-bit Timer , HT46R64/HT46C64 and HT46R65/HT46C65 Timer 0, the clock source ranges from fSYS ~ fSYS /128 by selecting the PSC2~PSC0 value.


Question 14

How is the HT46R64/HT46C64 and HT46R65/HT46C65 Timer/Counter 1 clock source setup?

Answer

For the HT46R64/HT46C64 and HT46R65/HT46C65, Timer/Counter 1 clock source is fSYS/4 or 32768Hz selected by TS bit。


Question 15

What is the PWM frequency under (6+2) mode and (7+1) mode?

Answer

For PWM (6+2) mode, the PWM cycle is divided into 4 modulation cycles. Each modulation cycle has 64 PWM input clock periods, and the PWM frequency will be fSYS/26. For PWM (7+1) mode, the PWM cycle is divided into 2 modulation cycles. Each modulation cycle has 128 PWM input clock periods, and the PWM frequency will be fSYS/27. In comparison with the 8-bit mode, the (6+2) Mode PWM frequency is 4 times higher and (7+1) mode is 2 times higher than that of the 8-bit mode.


Question 16

How to calculate the A/D Conversion clock frequency?

Answer

Each A/D conversion needs 76 TAD clocks which is selected by ADCS1and ADCS0. Please refer to the table:

ADCS1 ADCS0 TAD Frequency
0 0 fSYS/2
0 1 fSYS/8
1 0 fSYS/32
1 1 Undefined

Question 17

How is the HT46 A/D with LCD type MCU LCD frequency setup?

Answer

To set the LCD frequency, the following process should be followed:

  1. Select clock source (same as RTC, WDT and Time Base) in the configuration options

  2. Select the division ratio in the configuration options to set the LCD frequency to be around 4kHz from the formula fLCD=fS/22~28 (fS is the clock source mentioned above)


Question 18

What is the difference in selecting R or C type as LCD Bias?

Answer

If the C type bias is selected, an external capacitor is needed, yet it is much power saving. If the R type bias is selected, no external capacitor is needed, but more power consuming. If power consumption is not a key issue, user may choose the R type bias which can save 3 capacitors. Please note when choosing C type and 1/3 bias, the LCD voltage is 3/2 VLCD.


Question 19

What are the system clock sources available for the HT46 A/D with LCD type MCUs?

Answer

For the HT46 A/D with LCD type MCU, there are three system clock resources available, namely:

  1. External RC Oscillator

  2. External Crystal Oscillator

  3. External RTC Oscillator


Question 20

How is the ADCLK calculated and what are its restrictions?

Answer

For the HT46 A/D with LCD Type MCUs, the minimum A/D Clock Period (tAD) is 1us. Therefore, the A/D Clock Period chosen by programming bits ADCS1 and ADCS0 must be carefully chosen to ensure that the selected A/D clock period is not less than 1us. The values are shown in the table below:

fSYS

A/D Clock Period (tAD)

ADCS1,ADCS0 = 00
(fSYS/2)
ADCS1,ADCS0 = 01
(fSYS/8)
ADCS1,ADCS0 = 10
(fSYS/32)
ADCS1, ADCS0 =11
1 MHz 2 us 8 us 32 us Undefine
2 MHz 1 us 4 us 16 us
4 MHz *500 ns 2 us 8 us
8 MHz *250 ns 1 us 4 us

* indicates the ADCS1 and ADCS0 bit settings that are not permitted as they will give a tAD value that is less than 1us .


Question 21

How long is the A/D sampling time?

Answer

The A/D Sampling Time requires 32tAD. For example, if the A/D Clock Period is 4us, then the A/D Sampling Time will be 128us.


Question 22

What is the equivalent circuit of the A/D type MCU to its external analog signal source?

Answer

The equivalent circuit of the A/D type MCU to its external analog signal source is drawn as below:

Notations:
VA : external analog signal source
RA : external analog signal output impedance
AN0~AN7 : analog signal input pins
CPIN : analog signal input pin input capacitance CPIN = 5pF
D1, D2 : protection diodes on pad, VT=0.6V
II  : leakage current on pad, II  = ±1μA (max.)
SS : analog signal sampling switch
RSS : analog signal sampling switch equivalent impedance; ca.100/200Ω at 5V/3V
CS/H : sampling and hold capacitance shown as below;

  HT46R23, HT46R24, HT46R64, HT46R65  HT46C23, HT46C24, HT46C64, HT46C65 HT46R47, HT46R22, HT46R62 HT46C47, HT46C22, HT46C62 HT46R63 HT46C63
CS/H 225.3pF 94.2pF 112.6pF 71.3pF 56.32pF 35.6pF
A/D resolution 10-bit 10-bit 9-bit 9-bit 8-bit 8-bit
A/D conversion time 76tAD 76tAD 76tAD 76tAD 64tAD 64tAD
A/D sampling time 32tAD 32tAD 32tAD 32tAD 32tAD 32tAD

Note: tAD is the A/D clock period detailed in the datasheet.


Question 23

What is the function of the WDT?

Answer

The WDT is designed to monitor the MCU software and hardware operations. Users should employ the CLEAR WDT (CLR WDT or CLR WDT1 and CLR WDT2 ) instructions should any abnormal operation or malfunction happens when a WDT overflow would occur which will then reset the MCU to resume normal operation. The WDT monitoring effects mainly depend on the software program design.


Question 24

In the HT46RU66/HT46CU66, there is a multi-function interrupt, MFI. How is the interrupt request flag, MFF, for this interrupt, set?

Answer

The multi-function interrupt, MFI, indicates that it represents several different interrupt functions. A multi-function interrupt can be generated by a time-base overflow (TBF), an RTC overflow (RTF) or the Timer/Event Counter 2 overflow. When the time-base overflows (TBF=1) and its interrupt is enabled (ETBI=1) or the RTC overflows (RTF=1) and its corresponding interrupt is enabled (ERTI=1) or the Timer/Event Counter 2 overflows (T2F=1) and its corresponding interrupt is enabled (ET2I=1), then when any one of these three conditions occurs a multi-function interrupt will be generated. If the master interrupt enable bit is enabled (EMI=1), the related interrupt bit is enabled (EMFI=1), then if the stack is not full, then when the MFF bit is set a call to vector 018H will be generated. After entering the interrupt, both MFF and EMI will be cleared to prevent further interrupts influencing the present interrupt’s operation. If the TBF, RTF or T2F bits are set this indicates that a time-base, RTC or Timer/Event Counter 2 overflow has occurred. As the interrupt flags TBF, RTF and T2F will not be automatically cleared, the user program has to ensure that this is done. The interrupt process is illustrated in the attached file (FAQ-10.bmp).


Application Description

 


Question 1

How to access the LCD display memory?

Answer

The LCD display memroy loactes from 40H thtough 60H of the RAM bank 1. To access the LCD display memory, use has to set the BP (Bank Pointer) to 1 and then use the indirect addressing mode to be read or write the display contents. Please note that user cannot use the direct addressing mode which returns the contents of the Bank 0 data memory.


Question 2

The HT46 A/D with LCD MCUs have two memory pointers, what is the difference between them?

Answer

MP0/IAR0 and MP1/IAR1 are pairs of registers that need to be used together. MP0/IAR0 can only be used by RAM BANK 0 while MP1/IAR1 can be used by any RAM BANK.


Question 3

As there are no Push and POP instructions, when an interrupt occurs how is the data backed-up?

Answer

Although there are no PUSH or POP instructions, the programmer can still assign memory space. (Example db: ACCStack for ACC Storage) to store the interrupt backup data. To do this first store the ACC data in an area of memory, after which the status register and other data to be stored can be stored in similar dedicated memory locations. Before returning to the main program the data should be retrieved similarly but in a reverse order i.e. ACC is the last to be retrieved. When this is completed a RETI instruction should be executed to return to the main program.


Question 4

Can the Call instruction be used within an interrupt routine?

Answer

Because of the limitations in size of the MCU Stack, programmers must be exceptionally careful if using a call instruction inside an interrupt routine. If the program is in an interrupt routine and the stack is full, then executing a call instruction will result in a stack-over situation preventing the program from returning properly from the interrupt routine. Therefore if it is necessary to execute call instruction from within interrupt routines it is imperative that the worst case condition regarding stack requirements are considered. Before entering interrupt routines it is essential to verify that enough stack levels are available.


Question 5

When an interrupt is being serviced will other occurring identical interrupts be effective?

Answer

In normal operation when the MCU enters an interrupt routine the EMI flag will be cleared (EMI=0), which will prevent any corresponding interrupts from being serviced. However if the program is used to actively set the EMI flag (EMI=1) when an interrupt is being serviced then if the stack is not full, all other interrupts (including identical interrupts) will be effective. If multiple interrupts are necessary the programmer must take great care to ensure that the backed up data from the present interrupt is not corrupted by any following interrupts. Unless in cases of absolute necessity it is strongly recommended that multiple interrupts are not permitted.


Question 6

How should unused I/O pins be managed?

Answer

Any unused I/O pins should be managed properly so as to prevent from power consuming. The best method to prevent this is to set any unused pins as outputs however if set as inputs they should be selected to have a pull up option. If a pull-high option is not used then the pin should be tied to ground.


Question 7

Why, when PA is low the device cannot wake up?

Answer

The PA port pins can all be configured to wake up the device but are activated only on a low going edge. If the corresponding PA pin was low when the HALT instruction was executed then the low logic state of this pin will have no wake up effect as no low going transition exists.


Question 8

Why, when a low going edge is presented on the external interrupt pin the MCU does not wake-up?

Answer

Although the MCU can be woken up by an external interrupt, the actual wake process takes place only when the Interrupt Request Flag EIF changes from "0" to "1". If when the MCU enters a HALT condition the EIF flag is already set to "1", then a further interrupt will have no effect on the status of the EIF flag, which will remain in its present "1" condition. As a transition a wake-up will not occur.


Question 9

Is it possible to disable the wake-up function of the external interrupt?

Answer

If before entering a HALT condition the EMI is first cleared and then if the EIF bit is set to "1" the external interrupt will have no wake-up function.


Question 10

What is the purpose of 2 CLR WDT instructions?

Answer

Two CLR WDT instructions feature increases the system reliability. If the program contains two loops in the main program a CLR WDT1 instruction can be placed in one loop and a CLR WDT2 instruction in the other loop. If a malfunction occurs, perhaps due to noise, and the program enters an infinite loop none of the CLR instructions in the other loop will be executed, therefore the WDT will overflow and generate a reset signal to reset the MCU.


Question 11

How is the HT46 A/D with LCD Type MCU PWM setup?

Answer

First choose PWM in the configuration option. Set PDC.0=1 to enable PWM function and write the PWM output value to the PWM Register. Set PD.0=0, PWM outputs 0; set PD.0=1, PWM outputs PWM. If a secondary PWM is used, it is controlled by PDC.1 and PD.1.


Question 12

How is the HT46 A/D with LCD Type MCU A/D Converter setup?

Answer

To utilize the HT46 MCU A/D Converter, the following process should be followed: 

  1. Configure Port B A/D Converter channels by setting PCR2, PCR1 and PCR0

  2. Select the channel for A/D conversion by setting ACS2, ACS1 and ACS0. Note the channel selected should be configured in the previous step.

  3. Set ADCR.7=0 -->1-->0 to start the A/D conversion, EOCB=1 indicating A/D conversion is in process.

  4. Wait 76 TAD periods to complete the A/D conversion, EOCB=0 indicating the end of A/D conversion and interrupt request flag ADF=1

  5. Read the conversion results in the ADRL and ADRH Registers.


Question 13

How is the HT46 A/D with LCD Type MCU RTC setup?

Answer

RTC setup is quite similar to Time Base setup, the key difference is that frequency can be selected in software. To utilize the RTC, the following process should be followed:

  1. Select clock source (same as RTC, WDT and Time Base) in the configuration options

  2. Select RTC frequency from the formula fRTC=fS/28~215 (fS is the clock source mentioned above) by writing to the control register bits.

  3. Enable the corresponding interrupt by setting the ERTI bit

After these steps are taken, if the RTC overflows, an internal interrupt request will be issued by setting RTF.


Question 14

How is the HT46 A/D with LCD Type MCU Buzzer setup?

Answer

To utilize the Buzzer Mode, the following process should be followed:

  1. Choose PA0 and PA1 as CMOS output in the configuration options

  2. Select Buzzer Mode in the configuration options

  3. Select clock source (same as RTC, WDT and Time Base) in the configuration options

  4. Select Buzzer frequency from the formula fBUZZER=fS/22~29 (fS is the clock source mentioned above)

After these steps are taken, set PA0 and PA1 to control the Buzzer output. When PA0=0 and PA1=0, both BZ and BZ pins output; When PA0=0 and PA1=1, BZ pin outputs only; When PA0=1, both BZ and BZ pins no buzzer output.


Question 15

How is the HT46 A/D with LCD Type MCU PFD setup?

Answer

To utilize the PFD Mode, the following process should be followed:

  1. Select PFD Mode in the configuration options

  2. Select PFD output from which timer/counter

  3. Select PFD frequency from the formula 
    8 Bit: FPFD=fINT/(2 x (256-N))
    16 Bit: FPFD=fINT/(2 x (65536-N))
    (fINT is the timer clock source)

  4. Start the Timer by setting the TON bit in the TMRC

After these steps are taken, set PA3=0 to enable PFD output.


Question 16

How is the HT46 A/D with LCD Type MCU Time Base setup?

Answer

To utilize the Time Base Mode, the following process should be followed:

  1. Select clock source (same as RTC, WDT and Time Base) in the configuration options

  2. Select Time Base frequency from the formula
    fTIME BASE=fS/212~215 (fS is the clock source mentioned above)

  3. Enable the corresponding interrupt by setting the ETBI bit

If the Time Base overflows, an internal interrupt request will be issued.


Question 17

Under what situations the users should turn the Quick Start-up Oscillating (QOSC) off?

Answer

During power on, the Quick Start-up Oscillating is activated to shorten the start-up time. However, if power consumption is a key issue, 2 seconds later after power on, users may turn the Quick Start-up Oscillating scheme off by setting QOSC =1. Usually, this will save power consumption around 1~2µA in 3V applications and 3~4µA in 5V applications.


Question 18

For 2-cell battery applications (2.2V~3.8V), is the Low Voltage Reset (LVR) still available?

Answer

For the HT48 I/O type MCU, the Low Voltage Reset (LVR) function operates in the range of 2.7V ~3.3V, therefore the LVR feature is not applicable. If a 2.2V voltage detection function needed in applications, an external Voltage Detector (HT70XX) is recommended.


Question 19

The system frequency is 4MHz and the ADCLK is fSYS/32 , why is the A/D conversion to a 250 us square wave sometimes incorrect?

Answer

For the HT46 A/D with LCD Type MCU, the A/D conversion time is 76 tAD with 32 tAD S&H in advance. For details see the Timing diagram below. If the system frequency is 4MHz and the ADCLK is fSYS/32, the Sampling Time will be 32tAD = 256us. Since the ADCLK scaler is a free-running counter, the A/D Sampling Time ranges from 31~32 ADCLK, i.e., 248us<A/D S&H time<256us, which will sometimes result in an incorrect A/D conversion value. The user can correct this problem by selecting the ADCLK to be fSYS/8, which will shorten the A/D Sampling Time to a value of 64us .


Question 20

For Holtek's MCUs, is there any way to reset the stack pointer other than by a chip RESET?

Answer

The stack pointer is affected by the execution of interrupts as well as by any subroutine calls which occur in the application program. In addition, any return instructions will also affect the stack pointer. However, it is not possible for the user to directly reset the stack pointer by any means other than the chip RESET.


Question 21

If the RC oscillator is selected as the system clock, what are the purposes of the external resistor and capacitor? Can the capacitor be omitted?

Answer

The external resistor on the OSC1 pin is used to generate bias to control the internal RC charge and discharge. The frequency of the RC oscillator is determined by the value of this external resistor. The recommended 470pF external capacitor, which is connected to the OSC1 pin, is added to avoid cross-talk to the OSC2 line. The OSC2 pin is provided to supply an output frequency of 1/4 system frequency. However, if this 1/4 system frequency output, OSC2, is not utilized, the external capacitor on OSC1 pin can be omitted.


Question 22

How to decide the RA value?

Answer

Take 5V, 10-bit A/D for example, the signal decay of VA to AN0~AN7 pin should not be exceeding 1/4 LSB to maintain the ADC precision, and it's about 5V/4096 = 1.2mV.

1uA×RA < 1.2 mV → RA < 1.2kΩ , where 1uA is II value.
Therefore, RA is recommended to be lesser than 1.2kΩ to maintain the 10-bit ADC precision. In the similar way, for 9-bit and 8-bit ADC, RA not exceeding 2.4kΩ and 4.8kΩ respectively to maintain the conversion precision.


Question 23

What is the A/D input impedance?

Answer

When A/D is not activated, the SS (sampling switch) is open. When A/D is activated the SS is closed. The A/D conversion time can be further divided into two phases; the first is sampling time which needs 32 tAD,; the second is conversion time which needs 44 tAD. A total of 76tAD is needed. The tAD A/D clock period will be detailed in the datasheet.

Therefore we can discuss the A/D input impedance in two ways.
(1). When the sampling switch SS is open, only the current leakage effect remains, the input impedance equivalent circuit is illustrated as below;

The input impedance is about RVDD || RVSS, where RVDD and RVSS are the leakage current on the PIN. RVDD = RVSS = 5V/1uA = 5MΩ
RVDD || RVSS = 2.5MΩ

(2). When the sampling switch SS is closed, the A/D input equivalent circuit is illustrated as below; (PIN capacitance CPIN is omitted.)



The DC input impedance:
The DC input impedance is about RVDD || RVSS, where RVDD and RVSS are the leakage current on the PIN. RVDD = RVSS = 5V/1uA = 5MΩ
RVDD || RVSS = 2.5MΩ

The AC input impedance:
The time constant = (RA+RSS)×C, is shown as below;

 

HT46R23, HT46R24, HT46R64, HT46R65 

HT46C23, HT46C24, HT46C64, HT46C65

HT46R47, HT46R22, HT46R62

HT46C47, HT46C22, HT46C62

HT46R63

HT46C63

CS/H

225.3pF

94.2pF

112.6pF

71.3pF

56.32pF

35.6pF

RA+RSS

1.3kΩ

1.3kΩ

2.5kΩ

2.5kΩ

4.9kΩ

4.9kΩ

Time constant

0.29μs

0.12μs

0.28μs

0.18μs

0.28μs

0.17μs


Question 24

How can I find the minimum value of A/D Acquisition Time (tAC)?

Answer

To maintain the 10-bit accuracy, the voltage deviation between analog VA to sample and hold CS/H should be less than VA/2048. Therefore when SS is closed (sampling switch), the CS/H voltage must be greater than VA-VA/2048 and we can have the tAC value through the following calculations.

VA-VA/2048 < VA(1-EXP(-tAC/R×C); R=RA+RSS, C=CS/H

VA-VA/2048 < VA(1-EXP(-tAC/R×C)
→ 1/1028 > EXP(-tAC/R×C)
→ -7.625 > - tAC/R×C
→ tAC > 7.625×R×C

Per different MCU family, values are listed below:

 

HT46R23, HT46R24, HT46R64, HT46R65 

HT46C23, HT46C24, HT46C64, HT46C65

HT46R47, HT46R22, HT46R62

HT46C47, HT46C22, HT46C62

HT46R63

HT46C63

CS/H

225.3pF

94.2pF

112.6pF

71.3pF

56.32pF

35.6pF

RA+RSS

1.3kΩ

1.3kΩ

2.5kΩ

2.5kΩ

4.9kΩ

4.9kΩ

tAC

2.2μs

0.93μs

2.1μs

1.4μs

2.1μs

1.3μs

A/D sampling time

32tAD
32μs(min.)

32tAD
32μs(min.)

32tAD
32μs(min.)

32tAD
32μs(min.)

32tAD
32μs(min.)

32tAD
32μs(min.)

Per the table, the A/D sampling time is 32tAD, and the minimum value of tAD is 1μs, i.e. the minimum sampling time is 32μs, and it should be greater than tAC.


Question 25

What is the input voltage range of the A/D input pins?

Answer

There are protection diodes on the AN0~AN7 input pins. The input voltage is therefore should be within the range of VDD + 0.3 and VSS-0.3. Any input volt exceeds this range may result in unpredictable power consumption and/or malfunction.


Question 26

For HT46 series MCUs, how to adjust the PWM frequency on port D?

Answer

For HT46 series MCUs, the PWM frequency is derived by calculating fsys/256, in other words, once the system clock is selected, the PWM frequency is therefore fixed. Users can only adjust the PWM duty through the PWM register.


Question 27

What steps should be taken to reduce power consumption before entering the HALT mode if A/D Converter is used?

Answer

Because the A/D Converter will not turn off automatically in the HALT mode, if the power consumption is an issue, users should turn the A/D Converter off by clearing the PCR0, PCR1 and PCR2 bits in the ADCR Register before entering the HALT mode and turn the A/D Converter on by setting the PCR0, PCR1 and PCR2 bits to 1 after waking up from HALT.


Question 28

When using a 3-pin resonator/crystal in my MCU application can the capacitor be connected to VDD instead of VSS?

Answer

When using 3-pin resonator/crystals, for reasons of layout convenience, the capacitor can be connected to VDD instead of VSS.


Question 29

When writing my program, if I want to create a Table in Program Memory, how do I start my table at a specific address? If the ORG statement is not suitable are their other methods of implementation?

Answer

When using the ORG expression, this can only be used to indicate the offset from the start address of the present section. To overcome this problem the SECTION directive can be used to establish a table at any specific address, for example:

table .section at 300 'code'

This statement can be used to indicate the specific address where the table should begin.


Question 30

How can I use C language to read the serial number written into an OTP by the OTP writer?

Answer

When using the C language you must use inline assembly to read the IC serial number, which is written by the OTP writer. An example program is shown below:

First declare a variable to indicate a ram address.
unsigned long serial_num @0x80;
Then read out the serial number to this variable.

#asm

tblp equ [07h]

; define table address

mov a,20h

mov tblp,a 

; set table pointer to 20h (series number at 20h of last page)

tabrdl [80h] 

; load first byte of series number to series_num (0x80h);

inc tblp

tabrdl [81h] 

; second byte of series number

inc tblp

tabrdl [82h] 

; third byte of series number

inc tblp

tabrdl [83h] 

; fourth byte of series number

#endasm


Question 31

When using the BZ/BZB function in the HT46/HT47/HT48/HT49 series devices, the sound emitted is not loud enough, what can I do about this?

Answer

The frequency generated on the BZ/BZB outputs should match the center frequency of the piezo-buzzer connected to these pins. Each different type of piezo-buzzer has its own center frequency. The MCU generated frequency must be as close to this as possible to achieve maximum volume from the buzzer.


Question 32

Why, when I write to TMRL and TMRH the contents do not change? The code I use is as follows:
mov a,131
mov tmrl,a 
mov a,0ffh 
mov tmrh,a 
When the above code is executed, the TMRL and TMRH registers retain their original value and do not change.

Answer

Before writing to TMRL and TMRH the timer interrupt must be disabled.


Question 33

When using a Holtek MCU in a voice application, within the software I wish to use look up table data as follows:
TABLE1: DC 0FFE1H,0FE32H,0FA34H,0FC78H
DC 0FECDH,0FEDCH,0FE57H,0FD87H ; 16bit table values

Is it possible for Look up table data definitions of 16-bits to accept the format of data given in TABLE1?

Answer

The Holtek MCU range each contain different Program Memory widths, ranging from 14 bits to 16 bits. MCUs that contain 16 bit Program Memory widths can accept data as shown in TABLE1 above, however other MCUs can only define data tables that are either 14 or 15-bits wide.


Question 34

If the SEG pins on the HT46R62 device is chosen via configuration options to be used as a logic output, how can it be controlled?

Answer

For the HT46R62, the SEG0~SEG15 pins can be selected to be logic outputs via configuration options. Once this is done, the Bit 0 area of the LCD memory is used to directly control these SEG output lines. For SEG0~SEG7 this is a byte option and for SEG8~SEG15 these are bit options.


Question 35

When using the tools to change the value of bits in the PA port register from "0" to "1", why when after checking the content of the register, I cannot see that the PA pin has changed its value.

Answer

When changing a specific bit value on the PA data register, only bits that are setup as outputs will be changed. Bits to be changed must first be setup as outputs by writing a zero to the corresponding bit of the PAC register.


Question 36

If the PFD function has been chosen to be used, can pin PA.3 still be used as a normal I/O pin?

Answer

The pin can still be used as a logic input pin. If the Port Control Register bit PAC.3 is set to "1", then even if the configuration options have chosen the pin to have a PFD function, the pin will now function as a normal logic input pin, and not as a PFD output pin.


Question 37

When in the Power Down mode, is the LVR function still effective?

Answer

If the LVR configuration option is selected, in the Power Down mode the LVR will have no effect.


Question 38

If a pin-shared A/D pin is setup as an A/D input, can it still retain a normal I/O function?

Answer

If an I/O pin is setup as an A/D input, because of power saving factors, it does not support I/O functions. Additionally the pull-high resistor will be automatically disconnected.


Question 39

When emulating the HT46R72D-1 why is there no waveform for the LCD?

Answer

Examining the HT46R72D-1 datasheet, we can see that the clock for the LCD comes from the IRC. Also the IRC and the WDTC register are related. If the WDTC disables the WDT Oscillator, then the IRC will be turned off. If this happens then the LCD will not have a waveform.
The configuration options for the WDT will also have an effect on the WDTC initial value. Therefore different WDT options will create different initial values for the WDTC, which will affect the LCD output. If using the LCD, users should ensure that bits 2 and 3 of the WDTC register should be set to the value 10 to enable the WDT oscillator.


Question 40

For variables defined in different RAM Banks, can their variable names be used for read and write operations?

Answer

For MCU devices with more than one RAM Bank, for variables defined in Bank0, their variable names can be used for direct read and write operations. For variables defined in other Banks this cannot be done. No matter which Bank the variable definition is located, the variable name is simply an address marker. When the variable name is used to directly implement read and write operations, then it will implement operations on that address. For Holtek MCUs, direct addressing can only be carried out in Bank 0, therefore for variables defined in Banks other than Bank 0, direct addressing operations using variable names c