Basic Information Functional Description Application Description Points to Note Others

Basic Information

 

Question 1

What are the contents of the HT46 Cost-Effective A/D type MCUs?

Answer

The HT46 series of Cost-Effective A/D type MCUs have a selection of 1K and 2K OTP and Mask Type memory capacities. Among the series, the HT46R46E/HT46C46E and HT46R47E/HT46C47E devices have a EEPROM. For more information please consult the relevant datasheet.


Question 2

What are the various packages available in the HT46 Cost-Effective A/D type MCUs?

Answer

Please see table below.

HT46X47 : 18DIP/SOP
HT46X46 : 18DIP/SOP

Question 3

What are the special features and characteristics of the HT46 Cost-Effective A/D type MCUs?

Answer

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


Question 4

What is the operating frequency of the HT46 Cost-Effective A/D 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 are the ESD and Latch up features of the HT46 Cost-Effective A/D type MCUs?

Answer

As the HT46 Cost-Effective A/D type series of MCUs possess exceptional ESD and Latch up protection they are suitable for industrial use. In the area of ESD protection the devices conform to the US military spec MIL-STD-883E 3015.7 and each I/O can withstand in excess of 5KV of body static. Regarding latch-up, the devices conform to the JEDEC-NO.17 specification, when tested in current mode, each I/O can withstand in excess of 100mA.


Question 6

How to calculate the A/D Conversion clock frequency?

Answer

Each A/D conversion needs 76 AD 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 7

What is the duration of the Power On Reset?

Answer

For the HT46 A/D Type MCUs at 3V operating voltage, the Power On Reset time range is 45ms~180ms;at 5V, the Power On Reset time range is 35ms~140ms.


Question 8

How is the ADCLK calculated and what are its restrictions?

Answer

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 9

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 10

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 11

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/RC); R=RA+RSS, C=CS/H

VA-VA/2048 < VA(1-EXP(-tAC/RC)
→ 1/1028 > EXP(-tAC/RC)
→ -7.625 > - tAC/RC
→ tAC > 7.625RC

Per different MCU family, values are listed below:

  HT46R47 HT46C47
CS/H 112.6pF 71.3pF
RA+RSS 2.5kΩ 2.5kΩ
tAC 2.1μs 1.4μs
A/D sampling time 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 12

Is the substrate on the HT46R47 device connected to VSS or VDD?

Answer

The Holtek MCUs use a Poly Gate process, therefore the substrate is connected to VSS.


Functional Description

 


Question 1

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 2

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 3

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 4

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 5

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 6

How is 8-bit Timer/Counter setup in the Timer Mode?

Answer

There are three modes available for the 8-bit 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. Set to Timer Mode by writing 10H to TM1, TM0

  2. According to the user timer period requirements set the Prescaler by writing the appropriate values to the bits PSC2~PSC0

  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 7

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 8

How is the 8-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. Set to Pulse Width Mode by writing 11H to TM1, TM0

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

  3. According to the Pulse Measurement width requirements set the Prescaler value ( PSC2~PSC0=n)

  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 and the count value multiplied by 2n is the measured pulse width.


Question 9

How is the HT46X47 8-bit PFD setup?

Answer

To utilize the PFD function of HT46X47, the following process should be followed:

  1. Choose PFD enabled in the configuration option

  2. Set the Prescaler (PSC2~PSC0=n) value and TMR initial value from the formula fPFD = (fSYS / (2nx(256-TMR)x2))

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

  4. Set PA bit 3 in Output Mode, i.e.PAC.3=0

After these steps are taken, set PA.3=1 to turn on the PFD and PA.3=1 to turn off the PFD.


Question 10

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 11

What is the constraints on VDD during Power On?

Answer

To ensure the Power On Reset operates successfully, the VDD rising voltage is recommended to be completed within 20ms. For battery applications, the internal resistance will increase due to the low battery condition and will slow the rising edge of the power supply increasing the possibility of Power On Reset failures.


Question 12

In the HALT mode, is there any power consumption associated with the Low Voltage Reset (LVR) circuitry?

Answer

In the HALT mode, the Low Voltage Reset function has no effect, therefore, there is no power consumption considerations when in the HALT mode.


Question 13

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 14

When using the HT46R22 with a 4MHz system clock, what is the frequency of the source clock for the internal timer?

Answer

The internal timer source clock frequency for this device is the same as the system clock, therefore in this case it is 4MHz.


Application Description

 


Question 1

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 2

In the HT46X47 series of devices when a "0" is written to bit 7 of the memory pointer MP, when it is read out, why does it give a value of "1"?

Answer

The HT47X47 Data RAM address is located at the address range 40H~7FH. Because the data RAM capacity does not exceed 80H, a 7-bit memory pointer (Bit0~Bit6) is adequate. Reading bit 7 of MP will always give a value of "1" irrespective of what value has been written into it. If the value "70H" is written to MP it will be read back as "F0H" but in fact the actual address pointed to is "70H" which is correct for the indirect addressing operations.


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

When in HALT mode why does the device continue to consume power?

Answer

When the MCU enters the HALT mode the oscillator is stopped. However if the WDT oscillator (if WDT is enabled in the options) or if the RTC oscillator is still running then some power will be consumed. In addition, the I/Os will maintain the condition they were in when the HALT instruction was executed. It is important to check if the I/Os inputs are floating or outputs remain loaded in the HALT mode that they might consume power.


Question 8

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 9

How is the HT46 Cost-Effective A/D type MCU PWM setup?

Answer

First choose PWM in the configuration option. Set PDC.0=0 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.


Question 10

How is the HT46 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 11

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

Answer

For the HT46 A/D Type MCUs, 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 12

Are the Reset circuits provided in the data sheets suitable for all applications?

Answer

Usually, the Reset circuits provided in the data sheets are applicable for most applications. Under some circumstances, a noisy environment for example, the Reset circuit might need to be modified for special user considerations.


Question 13

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 Type MCU, the A/D conversion time is 76tAD with 32tAD 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 14

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 15

When an RC type clock is chosen as the system clock, how can the actual frequency obtained from this RC clock be measured?

Answer

When the RC clock is chosen as the system oscillator, pin OSC2 will be configured as a frequency measurement output pin, which can be used to measure the actual frequency that is generated by the RC oscillator. This pin is designed to provide a signal that is equal to the system oscillator frequency divided by four. However it should be noted that because the OSC2 output is an open drain NMOS output structure, it is necessary to connect a resistor between this line and VDD.


Question 16

Can the I/O pins on the HT46 series of MCUs be used as LCD drive pins?

Answer

The pins on the HT46 series can be setup as either CMOS outputs or Schmitt trigger inputs, therefore they can be setup in three conditions which are, a high level output, a low level and as an input. By using an externally connected resistor divider on an I/O pin, when setup as an input, a voltage of VDD/2 can be generated. In this way a 3 common LCD configuration can be generated.


Question 17

How to use the timer auto-reload function of Holtek MCUs?

Answer

If you wish to assign the timer a start counting value that will be automatically reloaded after each timer overflow, the following steps may be taken;

  • Disable the TMRC.4 bit

  • Set the start counting value to TMR

  • Enable the TMRC.4 bit

If you wish to change the start counting value, you may simply save the new value to TMR, which will be loaded after the next timer overflow.


Question 18

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 19

What should I do to use an external crystal during my program development?

Answer

Firstly, in selecting the Options for SYSFREQ, keep the "Internal" not checked which will let you use external clock source. Secondly, insert the crystal into Y1 position on the Interface Card, meanwhile make sure that the jumper JP1 is set to crystal. Now you can use the external crystal during your program development.


Question 20

When in the low power mode, how should any unused inputs be managed? Also, what is meant by a no load condition?

Answer

Any unused I/O lines could be setup as inputs, but a pull-high resistor must be connected to these inputs, otherwise these floating inputs may consume power. Another method would be to setup any unused I/O lines as outputs and set these lines to a "0" level. A no load condition means that no connection is made to the I/Os. In this situation the only connections to the MCU are VDD, VS OSC1/OSC2 and RES.


Question 21

As the A/D converter has multiple inputs, is interference a problem.

Answer

Yes, interference may be a problem. When a conversion cycle has finished and before a different input is selected for A/D conversion, a small delay should be inserted. This will allow the input to settle down and allow a more accurate conversion. A general delay time for consideration would be a minimum of 10us.


Question 22

Is the value of conversion in the 8-bit A/D MCUs equal to N*Vref/255 or N*Vref/256?

Answer

Because the conversion value is of a discrete nature, it does not express an absolute value, it rather expresses a range instead. For example "0" can indicate a voltage between 0 Volts and Vref/256 while "1" can indicate a voltage between Vref/256 and 2Vref/256 etc. When using the N*Vref/256 formula, the largest error value will be Vref/256. When using the N*Vref/255 formula, the error lies between a value of -Vref/256 and Vref/256. In both cases the actual error range is the same. Therefore both the /255 or /256 value are acceptable.


Question 23

How do I determine which applications should use which PWM mode, either the (6+2) mode or the (7+1) mode?

Answer

The modulation frequencies of the two types of PWM modes are not the same, therefore this should be taken into account with respect to the application. For example, for D/A applications, it would be better to use the (6+2) mode where the modulation frequency is higher and the carrier frequency easier to filter out.


Question 24

If I want to use the timer to wake up the system when in the HALT mode, I encounter the following problem. The Holtek datasheet says that after the HALT instruction is executed the system clock will be stopped, if this happens how can the timer be used to wake up the system?

Answer

When in the HALT condition, the system clock is stopped, so if the timer source clock originates from the system clock, the timer will also cease its counting function when the system enters the HALT mode. However if the timer clock source originates from another clock source such as the RTC, the timer will continue to function even when in the HALT mode. In this case when a counter overflow occurs, the system will be woken up if it is in the HALT mode.


Question 25

In the program how is it possible to distinguish between a power on reset and a RES pin reset?

Answer

If certain subroutines have to manage differently the two different conditions of a Power-on or RES pin reset, then some method has to be found to distinguish between these two types of reset. The method of doing this is, after the relevant subroutine is executed, to write the data 55H and AAH to two registers. Then before this subroutine is executed, these two registers can be read. If the value is 55H and AAH, then it can be assumed that a RES pin reset has occurred, if any other data is read then a power-on reset can be assumed to have occurred. It is important that the program does not write any other data to these two registers.


Question 26

If multi A/D channels are used for sampling, then what points are there to note when using the A/D related registers?

Answer

If multi A/D channels are used to implement sampling, then the first thing to note is the A/D clock source, which is controlled by the ADCS1 and ADCS0 bits. Because the minimum clock period tAD is specified at 1us, for this reason a suitable system clock division ration should be chosen using ADSC1 and ADSC0 according to what system clock speed is used to prevent the A/D clock period from being less than 1us and generating an inaccurate A/D conversion value. If more than one channel is selected for sampling, then it must be noted that only one conversion can be implemented each time, and by using the ADCR register bits ACS2~ACS0, the A/D channel that is connected to the internal A/D converter can be chosen. Finally the ADCR bits, PCR2~PCR0 are used to define which pins on the PB port are used as A/D converter inputs, and which pins are used as normal I/O pins. One point to note is that if any pins above PB0 are setup as A/D inputs, then all pins between that pin and PB0 will also be setup as A/D inputs, and cannot be used as I/O pins. Also if bits PSCR2~PCR0 are modified, then the START bit in the ADCR register should be set high and then reset to zero within ten instruction cycles, to ensure that the EOCB bit is correctly set.


Question 27

How is the tWR delay time checked and controlled when writing to the EEPROM in the HT46R46E?

Answer

Before an EEPROM write operation instruction has ended and after the device has received a stop condition instruction the device will enter an automatically generated write cycle. During this time no other EEPROM instructions can be executed. Before any other instructions are executed a tWR delay time must be provided. The specification states that the maximum time for tWR is 5ms, which is the maximum write time and which is the most reliable time for the EEPROM operation. We can cyclically check if the write period has finished. One method is to send a start condition instruction and then a write address instruction to the EEPROM, after which the device can look for an acknowledge signal. If the EEPROM has finished its internal write cycle, then it will return an ACK signal, otherwise no ACK signal will be returned.


Question 28

When using the HT46 A/D type MCUs in smoke detector alarm applications, how is the alarm frequency changed when driving buzzers?

Answer

To change the frequency in alarm signals first determine the frequency range. For example if it is 2kHz to 4kHz, then the frequency high and low value will determine the tone high and low value. Then determine the sampling period. From an output frequency of 2kHz increasing to 4kHz, and then returning to 2kHz completes one alarm sound period. The sound wave period length determines the sound rapidity. In this period the output frequency change does not continuously change, but rather in stages. For example from 2kHZ~4kHz, within the 2kHz range, if 100 samples are chosen then 2kHz/100 = 20Hz, means that for each sample the frequency will change by 20Hz. Within one period, more samples will result in a more continuous and refined sound. For example if the sound period is 0.4s, then the sampling period is 0.4s/200 = 2ms which means that each frequency will be transmitted for 2ms before changing. When the principle of changing frequency is understood, then the I/O port or the PFD can be used to output a continuous square wave to drive a piezo buzzer.


Points to Note

 


Question 1

Are the HT46 Cost-Effective A/D type MCUs available in Dice form?

Answer

Holtek provides a service to supply customers with high volume requirements for Dice Form MCUs. Available for the full range of devices it is important that customers take note of the special requirements of dice form devices for bonding and OTP programming.


Question 2

What is the resulting increase in power consumption in the HT46R47 if the LVR is selected from the configuration options?

Answer

The normal operating current is in the order of several mA, selecting the LVR function form the configuration options, will result in a current increase of about 30uA. However, it should be noted that the LVR function is automatically disabled when the device enters the HALT mode, the increase in power consumption should therefore not be an issue for the HT46R47 and its applications.


Question 3

When using the HT-ICE to emulate the A/D conversion process, are there any special consideration that should be taken into account?

Answer

When the HT-ICE emulates the A/D process, the analog signal to be converted can be directly connected to the pins AN0-AN7 on the ICE. However the analog voltage must not exceed 5V otherwise the ICE may be damaged. When using the HT-ICE to emulate the A/D it is also important to ensure that jumper JP2 is in the correct position as shown below:

JP2 at position 1-2 will utilize the ICE internal 5V as the voltage reference
JP2 at position 2-3 will utilize an external reference voltage at JP3/JP4


Question 4

What could be the reasons for low yield programming of OTP DICE devices?

Answer

Firstly, you should exclude bonding failure possibilities, as these are the major reasons for poor programming yield. If you are not sure whether there is a bonding issue, you may get assistance from our technical support personnel by sending us the decapsulated samples.


Question 5

When I use the HT-Writer to program the OTP Dice, an "MCU: Cannot identify" message will pop up. Is this a bonding problem or an OTP defect?

Answer

For the package form of OTP devices, its product ID will be burnt into the device which can be used to display the device information in the message window, however, if the product ID code is missing, a warning message will pop up. This is usually the case for dice form OTP devices which have no product ID. To disable this warning function, deselect the Check ID option under the Options menu. If the HT-Writer is to be used in stand-alone mode, set the switch DIP1, which is located on the back of the HT-Writer to the OFF position.


Question 6

What precautions should I take in designing the MCU Reset and Oscillator circuit?

Answer

Please refer to the "HA0075E" in the Application Notes section of our company web site.


Question 7

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 8

When using the MACRO assembly directive can I save Program Memory space? Also does it affect the MCU execution speed?

Answer

After the assembly process, all of the instructions belonging to the MACRO will be written into Program Memory area, therefore there is no influence on either the Program Memory space or on the speed of execution. However as the code has been simplified program maintenance will be easier.


Question 9

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 10

In the datasheet of the HT46R47 it says that there are actually two physical registers mapped to the TMR register location and when writing to TMR, the preloaded value will only actually be placed into the TMR preload register. However during emulation the only register that is visible is the actual TMR register (ODH). Does this mean that there is the same address for both the preload register and the actual TMR register.

Answer

What is known as the TMR preload register is actually an internally used buffer which cannot be read or written to. The address of this preload register is not the address of the TMR register, in actual fact it has no address. When the timer wants to load this preloaded value, it will read the value from this buffer.


Question 11

For applications where the I/O pin connection to the application circuitry is rather long, what external protection measures should be taken?

Answer

The I/O pins have Schmitt trigger inputs, also the inputs have protection diodes between the pin and VDD and VSS. As a result the noise rejection capabilities of the devices is high, however to reduce the possibility of noise interference yet further, it is recommended that a resistor is placed in series with the I/O pin.


Question 12

After compiling, how can I determine the amount of program memory area used by my program?

Answer

The .map file can be opened to see the ROM conditions. The .map file and the .prj file are in the same folder. If the file cannot be found, then before program compilation, under the Option Menu Command, select Project and ensure that the "Generate Map File" option has been selected. When the next compilation is executed the .map file will be generated.


Question 13

When using the HT-ICE to emulate the HT46R47E/HT46R46E devices, why can I not find these devices in the HT-IDE software? How can I emulate the other EEPROM functions?

Answer

In the HT-IDE you must chose the HT46R47/HT46R46 devices to emulate the HT46R47E/HT46R46E devices. In addition you must also insert an HT2201 or HT24LC02 device into the target board, after which the EEPROM functions can be emulated.


Question 14

In the HT46 series, when the tools are in the software simulation mode and not the emulation mode, is it possible to still simulate the internal analog to digital converter?

Answer

It is not possible to simulate the action of the A/D converter if in the software simulation mode. The A/D converter can only be simulated by the ICE hardware and therefore the tools must be in the emulation mode.


Question 15

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 16

When using the HIRC, if the I/O pin which is shared with OSC1 is to be used as an AC zero crossing detector, will there be any influence on the HIRC oscillation frequency? If yes, which MCUs will be affected and how can this problem be resolved??

Answer

If the HIRC is used and if the I/O pin which is shared with OSC1 is used as an AC zero crossing detector pin, the HIRC oscillation frequency will be influenced.
The affected MCUs are:
All MCUs whose I/O pin is pin-shared with OSC1 (including the enhanced OTP type MCU and Flash type MCU etc.)
How to resolve this issue:
1. Avoid using the I/O pin that is shared with OSC1 as AC zero crossing detector pin.
2. If the problem can still not be resolved, add external circuitry to ensure that the voltage applied on the OSC1 pin remains withing the range of VDD and VSS.


Others

 


Question 1

What are the general uses for the PWM function?

Answer

The frequency of the PWM function in the HT46 series of MCU devices is determined by the system frequency, however the duty cycle is controlled by the value loaded into the PWM register. The PWM is normally used in applications such as, speaker or buzzer driving, controlling current or voltage levels (e.g. for controlling illumination levels), DC motor rotational speed control, digital to analog converters etc.