Basic Information Functional Description Application Description Points to Note Others

Basic Information


Question 1

What is the overflow time of the Watchdog Timer?

Answer

The Watchdog Timer has two clock sources, its own internal Watchdog oscillator or the instruction clock, the choice of which is made via a configuration option. At a supply voltage of 5V and with a 4MHz system frequency, if the internal Watchdog oscillator is used, then an overflow time of (256/4) x 256 = 16384uS, about 17ms, will be obtained. If the WDT frequency division ratio is selected as 1:128 then an overall overflow time of 16384 x 128 = 2097152us, about 2.1s, will be obtainable. If the instruction clock is used as the Watchdog timer clock source, then an overflow time of (4/4) x 256 = 256uS will be obtained. Similarly if the WDT frequency division ratio is set to be 1:128, then an overall overflow time of 256 x 128 = 32768us will be obtained.


Question 2

What is the difference between an LVR reset and a RES pin pulled low reset?

Answer

When the power supply voltage is: LVR voltage>Vdd > smallest operating voltage, then the then if the LVR is enabled, the OSC will run: If the RES pin is pulled low then the OSC will stop running.


Question 3

What is the resolution for voltage measurement using the A/D in the HT45R38?

Answer

The A/D in the HT45R38 is a 12-bit type. Its maximum digitised value is 0FFFH, (16-bits) which corresponds to a decimal value of 4095. As the measured values also includes 0, the A/D can measure 4095+1=4096 values. With an operating voltage of 5V, the voltage measurement resolution is 5/4095 which is equal to 1.2mV. Similarly for other permitted operating voltages, the resolution is the operating voltage divided by 4095.


Question 4

The HT45R35 and HT45R34 devices both have 12-channel simulated switches, RC1-RC12. Are there differences between their on and off switch methods?

Answer

Yes there are differences. The HT45R34 uses the ASCR register for control whose function is shown below:

The HT45R35 uses two registers for control which are the ASCR0 and ASCR1 registers whose functions are described below:

Additionally, the HT45R35 has an additional setup feature over the HT45R34 as each channel can be selected to be connected to a pull-low which is controlled by the ASCR2 register. The HT45R34 has no pull-lows.


Functional Description


Question 1

How is switching implemented between the 16 capacitor/resistor input channels of the HT45R36?

Answer

The HT45R36 contains 16 capacitor/resistor input channels, known as RC1-RC16. Switching between the channels is implemented via the ASCR register. Writing a value between the range of 00000b~01111b to the ASCR register will establish which of the 16 input channels, from RC1-RC16 is opened. Only one channel can be opened at one time and the other channels will be closed. If the value 1xxxxb is written to the register, then all of the channels will be closed and the external RC oscillator will also be switched off.


Question 2

How is data read and written to the two banks, Bank 0 and Bank 1, in the HT45R36?

Answer

When reading or writing data to Bank 0 or Bank 1 in the Data Memory, it is first necessary to first setup the Bank Pointer to select the correct Data Memory area. To read/write data to Bank 0, the Bank Pointer should be cleared to 00H, and to read/write data to Bank 1, the Bank Pointer should be set to a value of 01H. When using Bank 1 it is necessary to use the Memory Pointer MP1 and the Indirect Addressing Register IAR1 to read and write data. The Data Memory Bank 0 area can be accessed directly or using MP0 and IAR0. The Special Function registers will not be affected by the Bank Pointer, and can be accessed whether the Bank Pointer has selected Bank 0 or Bank 1.


Question 3

The HT45R38 contains a PWM function with two mode choices known as the (6+2) Mode and the (7+1) Mode. What are the functions of these different modes?

Answer

Within the restrictions of the fixed system frequency, the (6+2) or (7+1) Mode can be selected to setup the PWM frequency. In the PWM (6+2) Mode, the PWM value is subdivided into 4 separate sections. Each of these sections, which is 64 clock cycles, will transmit an individual PWM value equal to the PWM programmed value divided by 4. This PWM frequency is therefore equal to Fsys/64. In the (7+1) Mode, the PWM value will be subdivided into 2 separate sections. Each of these sections, which is 128 clock cycles, will transmit an individual PWM value equal to the PWM programmed value divided by 2. This PWM frequency is therefore equal to Fsys/128.


Question 4

Are there any points to note when setting up the initial value in Timer A and Timer B in the HT45RXX?

Answer

After each R/C-F conversion, it is necessary to initialise Timer A and Timer B, otherwise the required conversion value will not be provided. This is because after each conversion takes place the timer values will generally change.


Question 5

For the HT45R3X series of MCUs, how is Timer B used?

Answer

Timer B is controlled using three registers, ASCR, RCOCCR and RCOCR. First setup the ASON bits (ASCR.0~4) to select a simulated channel and then define the external RC oscillator mode (RCOCR.1=1). OVB (RCOCR.0) is used to define a Timer A or Timer B overflow generated interrupt (OVB=0/1 corresponds to the Timer A/Timer B overflow). Once RCOCON set bit (RCOCCR.4=1), Timer B then starts to count until Timer A/Timer B overflows and the related interrupt request flag RCOCF(INTC1.4=1) is set. Now the RCOCON bit will be automatically cleared and Timer B will stop counting.


Question 6

How are the pull-lows in the RC channels controlled in the HT45R35?

Answer

The pull-low resistors in the RC channels of the HT45R35 are controlled by the ASCR0, ASCR1 and ASCR2 bits. The ASCR0, ASCR1 bits have a higher priority over the ASCR2 bit. When the corresponding RC channel for the ASCR0 and ASCR1 bits is ON, no matter whether the ASCR2 corresponding channel pull-lows are ON or OFF, they will all have no effect. When the channel pull-low is switched off, then only the ASCR0 and ASCR1 corresponding RC channels will be OFF. At this time the ASCR2 corresponding channel bits will decide the pull-low ON or OFF state. Therefore the pull-low can only be switched on when the RC channel is OFF. In this way the pull-low can be used to connect the RC channel to ground. Releasing the RC channel residual electrical charge, ensures that each time an RC channel is opened, the channel will be in a null condition. This eliminates any unwanted effects on the RC oscillator frequency that a residual charge might create and increases RC oscillator stability.


Question 7

After a power-on or LVR reset, how will the RAM be affected?

Answer

For most MCU devices, after a reset, the special function registers will be initialised to values which are provided in the datasheet. The general purpose registers will contain random data. After a reset the special function registers will be initialised and the general purpose register values will not change. An LVR or external reset signal, will have the same effects, but it should be noted that an LVR condition must exist for a time greater than tLVR to be effective. (consult the datasheet for the value of tLVR)


Application Description


Question 1

How can the C/R-F functional block in the HT45R36 be implemented as a capacitive touch switch function?

Answer

The HT45R36 contains a C/R-F functional block. At its centre is an RC oscillator. When this oscillator's external equivalent resistance or capacitance changes, then the oscillation frequency will consequently change.
It is possible to use body capacitance effects to change the C/R-F circuit capacitance value, which will in turn change the oscillation frequency. By detecting a certain value of frequency change, it is possible to detect whether the touch switch (capacitance type) has been touched. 
In practical applications it is not necessary to calculate actual frequency values, it is only necessary, within a time fixed by Timer A, to measure difference between the reference frequency (Touch Switch off) Timer B Count and the present Timer B Count. If the difference value meets a previously defined value of sensitivity, then this can be considered as a Touch Switch activation. 
The HT45R36 provides 16 C/R sensors with input channels, RC1~RC16, and a signal channel decoder, the program can use the ASCR values (00H~0FH) to select the control switches, TG1~TG16, and subsequently scan the connected touch switches connected to the RC1~RC16 pins.


Question 2

If there are any unused channels among RC1-RC16, the how should they be managed?

Answer

RC1-RC16 are the resistor/capacitor sensor input channels. Only one channel at a time can be connected to the internal RC oscillator. Any unused channels will have no influence on the other used input channels. In managing the hardware of any unused channels, they can simply be left open, in the software it is just necessary to ensure that the channels are not activated.


Question 3

When using the HT45R43/HT45R36 as a touch switch, are there any special considerations for the line from the RC pin to the touch switch?

Answer

To reduce the effects of noise interference, the line from the microcontroller RC pin to the touch switch should be kept as short as possible and should be kept away from other lines, also the optimum line width is from 7 to 10 mil.


Question 4

When using the following instruction to read the contents of the TMRAH and TMRAL registers, the read back data contains errors.
mov A,TMRAL
mov a_CapK04_H,A
mov A,TMRAH
mov a_CapK04_L,A

Note: a_CapK04_H和a_CapK04_L are user defined Data Memory registers

Answer

When reading the contents of TMRAH and TMRAL, it is necessary to first read the high byte and then the low byte, that is first read TMRAH and then read TMRAL. When writing to these registers the order is reversed, that is first write the low byte and then the high byte.
More details on this procedure can be found in the datasheet.


Question 5

How can the scanning speed be increased for touch keys in the HT45R36 C/R-F?

Answer

Within the fixed time unit for Timer A (ex: 5ms), Timer B will also count and by looking at changes determine whether a key has been touched or not. Improvements can be made by changing the number of times the Timer B count changes (ex: 60 times) within the Timer A time, to determine if the key has been pressed or not.


Question 6

How can the scanning speed be increased for touch keys in the HT45R34 C/R-F?

Answer

Within the fixed time unit for Timer A (ex: 5ms), Timer B will also count and by looking at changes determine whether a key has been touched or not. Improvements can be made by changing the number of times the Timer B count changes (ex: 60 times) within the Timer A time, to determine if the key has been pressed or not.


Question 7

How can the scanning speed be increased for touch keys in the HT45R38 C/R-F?

Answer

Within the fixed time unit for Timer A (ex: 5ms), Timer B will also count and by looking at changes determine whether a key has been touched or not. Improvements can be made by changing the number of times the Timer B count changes (ex: 60 times) within the Timer A time, to determine if the key has been pressed or not.


Question 8

In the PCB for the HT45R34/HT45R36 how can the switch stability and noise immunity be improved?

Answer

The CREF, RREF, IN and RCOUT lines should be kept short, and the RC module lines should be kept as close to the MCU as possible. The tracks can be between 10 and 30mil. The RC1-RCXX pin lines must be kept short and fine (7 to 8 mil approx, with a limit of 10 mil) and any vias or pads between them should be made as small as possible. The lines connecting the Key to the RC pin should be identical. The RC1 to RCXX pin lines should be kept away from other components and other lines, with special attention paid to isolation from signal lines. As for the grounding, the Touch Switches should be enclosed by the ground network. The RC1 to RCXX pins should also be separated by a VSS line.



Question 9

What is the most suitable choice for the RC oscillator frequency in the HT45R34/ HT45R36/HT45R38?

Answer

The RC oscillator frequency can be reduced to within 500kHz (connect a 10p capacitor to CREF, default frequency is 500kHz, try to not exceed this frequency), here the noise immunity will also be increased.

 


Question 10

What shapes or forms should touch switches have?

Answer

Touch switches can have circular, rectangular or triangular etc. solid shapes but can also be formed from conducting tracks to give hollow shapes. The former can be used for thicker type overlays while the latter can be used for thinner type of overlays.


Question 11

What kind of material can be used to construct touch switches?

Answer

Suitable material for the construction of touch switches include, PCBs, flexi-circuit boards, and plated membrane conductive glass. Using PCBs provide the most popular material and give the benefits of lower costs, flexi-circuit boards can be used for curved construction applications and can be used with background lighting, while plated membrane conductive glass can be used for screen displays, and combined with user interfaces, however the cost is rather high.


Question 12

What are the requirements for the touch switch covering board material?

Answer

The covering board material must be an insulator which is durable and easy to install with a permitivity value of between 3 and 10 such as standard glass, acrylic, micrite board etc. Covering materials with lower permitivity values will result in touch switches with correspondingly lower sense ranges. It is necessary for the insulating covering to be firmly affixed to the touch switches using a suitable adhesive to remove any air gaps between the switch and covering material.


Question 13

What are the covering material thickness requirements for touch switches?

Answer

The usual thickness of the covering material is from 1mm to 5mm. Thicker materials will result in less sensitive touch switches and lower signal to noise ratio. Switches with lower area will result in lower sense ranges requiring thinner covering material.


Question 14

What is the operating principle behind touch switches?

Answer

The operating principle is that as a finger from a grounded person approaches the touch switch location, the finger and the touch switch together create a capacitance of increasing value, of perhaps several pf in magnitude. This increasing capacitance, if placed within a C/R-F oscillator circuit, will change the value of RC constant and as a result change the frequency of the oscillator. By measuring changes in this frequency it can therefore be determined if a finger has touched or is in the proximity of the touch switch.


Question 15

What are the limitations on the area of the capacitor switch?

Answer

Using the diagram as an example, it is recommended that the switch diameter is not less than 5mm.


Question 16

Can multiple channels in the C/R type MCUs be active at the same time?

Answer

The C/R type MCU type series has four devices, namely the HT45R34/35/36/38. Among these the HT45R34/36/38 have multiple C/R to F converter inputs, which cannot be active at the same time, but can rather only be active one at a time. The conversion value of each channel can be read by polling or by using an interrupt. The multiple channels in the HT45R35 device can be active at the same time. The related touch switch for these active C/R to F conversion channels can only be managed individually.


Question 17

Can the HT45RXX be used to implement more touch switches than the maximum number of RC channels?

Answer

This is possible using an array type of touch switch. The method is as follows:
As shown in the diagram, the crossover point of RCa and RCb forms the touch switch. If at the time when Timer A overflows and generates an interrupt signal, if RCa is active, then after Timer A overflows, the change in the value of Timer B will be greater than the reference value. When RCb is switched on, after Timer A overflows, the change in the value of Timer B will be greater than the reference value, which indicates that the switch has been touched.
Similarly, when Timer B overflows and generates an interrupt, the value in Timer A will also experience a change in value. Using this method can allow higher numbers of touch switch functions, for example the HT4536 can implement 8 x 8 = 64 touch switch inputs.


Question 18

When using the C/R-F type MCU to implement slide type input PCB layouts are there any special points to note?

Answer

The PCB layout schematic drawing is shown in PIC1. (Note: this drawing is only a schematic drawing not a real PCB layout drawing)

PIC1
1. Use multi RC channels with each one related to a touch sense area.
2. Each touch sense area size should be the same to ensure that the basic touch time variance is the same.
3. Each sense area should be close together however between each sense area there should be a VSS line
4. The sense area shape can be decided according to conditions (it is recommend to use the serrated shape shown in the drawing) (Note that in the drawing RCa~RCf show the RC pins corresponding to individual serrated shapes, the green area depicts the VSS network)


Question 19

What type of software flow is used to implement a sliding type input for the C/R-F type MCU?

Answer

1. To scan all of the RC channels to establish the base unit: when the touch sense areas are first scanned and when they are touched, the corresponding code should be written into the buffer
2. The next time the touched sense area is scanned, if the value is not different from the previous one, then the buffer content should not be altered. If it is a neighbouring area to the previous touched area then the slide action can be implemented. Also the value for this touch sense area can be written into the buffer. If the touched area is not a neighbouring area but another area, then no action should be taken and the buffer cleared.
3. At the same time, within a specified time (for example 0.5sec or even less) if no touch action has been detected, then the buffer should be cleared.
4. Repeat the above steps.
See the drawing :


(Note: the get_key() function scans all of the RC channels, when no channels are touched then NULL will be returned, when an RC channel has been touched then the value will be stored in the corresponding ASCR register. The other conditions will return FALSE:
add(1)/sub(1) indicates that the related data should be added or subtracted by 1: tmr_count indicates a timing value, used as a fixed time to renew the base value)


Question 20

The HT45R3X series of touch switches operate without problem in the emulator, but after programming the device the touch switches are not detected?

Answer

This main reason for this problem is that the touch switch channel lines in the emulator and the IC are not the same. Therefore the sensed difference values generated on the emulator and on the IC are not the same. For this reason the adjusted channels on the emulator which can be touch sensed will not necessarily be sensed in the IC. The most effective way to confirm an effective sense difference value is as follows: if the user PCB has a number display function, then it is only necessary to edit a section of program to display the sensed value. Finally program this sensed difference value into the IC. If the user PCB does not have a number display function, then a display circuit can be constructed to display the sense difference value for each channel. Also the Touch Switch Demo Board (see Application HA0145) can be used to confirm the sensed values.


Question 21

After Timer A/Timer B overflows is it necessary to read their values immediately?

Answer

This is not necessary, as after Timer A/Timer B overflows they will stop running. The RCOCON bit will be automatically cleared to 0 and Timer A/Timer B will not be reset and their values will kept unchanged. Therefore the values of Timer A/Timer B can be read any time after they overflow.


Question 22

When using the C/R-F MCU to implement touch switches, what is the normal method of setting up the sensitivity?

Answer

Reading Timer A when Timer B overflows example:
1. Read the base value. For all untouched switch RC channels set the Timer A values A1~An for the corresponding channel.
2. Read the related RC channel touched switch. Set the related Timer A values as Bn. For example, for the channel RC3 the value read by Timer A will be B3.
3. Read the values of the other switches in the vicinity of the touched switches and store as Cn. For example, when RC4 is touched, then the related neighbouring switch C3 will have the Timer A value C3.
4. Determine if the related switch values, Dn_min and Dn_max meet the conditions Dn_max >(Bn- An) >Dn_min>(Cn- An). By adjusting the value of Dn_min, the sensitivity of the touch switch can be adjusted.


Because the emulator and actual device are not identical, and because of RC channel connection length and width as well as PCB differences, therefore the emulator can only adjust certain related functions. The obtained sensitivity etc. data and the actual conditions are not exactly the same. Finally the used optimum sensitivity value should be obtained using the actual device and the PCB. Obtaining the above data can be achieved using assistive tools and test program on the actual PCB.


Question 23

There are no PUSH and POP instructions, therefore when entering an interrupt subroutine how is the data backed up?

Answer

Although there are no PUSH and POP instructions, the programmer can still point to the Special Purpose Memory registers whose data could be damaged when an interrupt is generated. First back up the ACC, STATUS and any other registers which require protection. When it is required to return from the interrupt, then restore the previously backed up register data, STATUS and ACC and finally executing the RETI instruction.
MOV R_AccStack, A
MOV A, STATUS
MOV R_StatusStack, A
MOV A, MP0
MOV R_MP0Stack, A
MOV A, MP1 ; if MP1 exists or if there is other protected data
MOV R_MP1Stack, A

The following is for the POP operation:

MOV A, R_MP1Stack ;if MP1 exists or if there is other protected data
MOV MP1, A
MOV A, R_MP0Stack
MOV MP0, A
MOV A, R_StatusStack
MOV STATUS, A
MOV A, R_AccStack
RETI

(R_AccStack,R_StatusStack,R_MP0Stack,R_MP1Stack are programmer defined Special Purpose Memory RAM BYTE)


Question 24

In the HT45R3x series, how can it be verified if the key has been pressed and what is the actual flow?

Answer

The HT45R3x series, in order to determine if a switch has been effectively touched or not, uses the following process: the touch switch value is obtained from scanning all of the channels. In order to eliminate interference, it is recommended that the switches be scanned again several times to ensure that the switch has been effectively touched. This application scans the switches four times (actually scan can be adjusted according to actual conditions). The flow is shown below:




Points to Note


Question 1

In the HT45 series, when setting up the Timer A overflow to be the R-F converter end flag, it is discovered that before Timer A overflows, Timer B has already overflowed. As this leads to erroneous data being processed, how can this problem be avoided?

Answer

When using the Timer A overflow as the R-F converter end flag, it is important to ensure that before Timer A overflows, Timer B has not overflowed. Otherwise the data will be ineffective. The user can reduce the overflow value in Timer A or increase the value of CREF to ensure that Timer B does not overflow before Timer A does.


Question 2

When using the C language to setup the 16-bit counter TMRA, it is setup using:
_TMRAL=(65536-COUNT)%256;_TMRAH=(65536-COUNT)/256;
however why does the compiler generates a warning?

Answer

When using the C language to setup an initial value in the 16-bit timer, if the following method is used:
_TMRAL=(65536-COUNT)%256;_TMRAH=(65536-COUNT)/256;
then the compiler will have an overflow with constant '65536' warning.
This is because ‘65536’ has already exceeded the 16-bit range. It should be changed to:
_TMRAL=(65535-COUNT+1)%256;_TMRAH=(65535-COUNT+1)/256;
to eliminate the error message.


Question 3

How are the TMRAH/TMRBH and TMRAL/ TMRBL registers correctly written to?

Answer

When writing to TMRAH/ TMRBH and TMRAL/ TMRBL, the following setup procedure should be carried out:
1. Switch off the external RC oscillator counter (RCOCON = 0)
2. Switch on the RC oscillator (RCO = 1)
3. When writing, ensure that the low byte is written to before the high byte (first write to TMRAL/TMRBL after which TMRAH/TMRBH should be written)
If any of the above setup steps are incorrectly implemented than it will not be possible to correctly write values to TMRAH/ TMRBH and TMRAL/ TMRBL.


Question 4

When using the RC channel in the 20-pin HT45R35, what points should be noted?

Answer

Because pins RC3, RC4, RC9 and RC10 are shared with the PA and PA port pins, if these four RC channels are to be used, in addition to choosing the correct configuration options to select the RC inputs, it is also necessary to setup the pin as an input using the application program, otherwise Timer B will have no clock input.