wireless charger tx flash mcu ht66fw2350...wireless charger tx flash mcu general description the...

194
Wireless Charger TX Flash MCU HT66FW2350 Revision: V1.10 Date: November 18, 2019

Upload: others

Post on 09-Jul-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Wireless Charger TX Flash MCU

HT66FW2350

Revision: V1.10 Date: November 18, 2019

Page 2: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 2 November 18, 2019 Rev. 1.10 3 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Table of ContentsFeatures ............................................................................................................ 7

CPU Features ......................................................................................................................... 7Peripheral Features ................................................................................................................. 7

General Description ......................................................................................... 8Block Diagram .................................................................................................. 8Pin Assignment ................................................................................................ 9Pin Description ................................................................................................ 9Absolute Maximum Ratings .......................................................................... 12D.C. Characteristics ....................................................................................... 12

Operating Voltage Characteristics ......................................................................................... 12Operating Current Characteristics ......................................................................................... 12Standby Current Characteristics ........................................................................................... 13

A.C. Characteristics ....................................................................................... 13High Speed Internal Oscillator Frequency Accuracy ............................................................. 13Low Speed Internal Oscillator Characteristics – LIRC .......................................................... 13Operating Frequency Characteristic Curves ......................................................................... 14System Start Up Time Characteristics .................................................................................. 14

Input/Output Characteristics ........................................................................ 15Memory Characteristics ................................................................................ 15A/D Converter Electrical Characteristics ..................................................... 16LVR/LVD Electrical Characteristics .............................................................. 17Internal Reference Voltage Electrical Characteristics ................................ 17OCP Electrical Characteristics ..................................................................... 18Demodulation Electrical Characteristics ..................................................... 19PWM Electrical Characteristics .................................................................... 20Power-on Reset Characteristics ................................................................... 20System Architecture ...................................................................................... 21

Clocking and Pipelining ......................................................................................................... 21Program Counter ................................................................................................................... 22Stack ..................................................................................................................................... 22Arithmetic and Logic Unit – ALU ........................................................................................... 23

Flash Program Memory ................................................................................. 23Structure ................................................................................................................................ 23Special Vectors ..................................................................................................................... 24Look-up Table ........................................................................................................................ 24Table Program Example ........................................................................................................ 25In Circuit Programming – ICP ............................................................................................... 26On-Chip Debug Support – OCDS ......................................................................................... 27

Page 3: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 2 November 18, 2019 Rev. 1.10 3 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Data Memory .................................................................................................. 27Structure ................................................................................................................................ 27Data Memory Addressing ...................................................................................................... 28General Purpose Data Memory ............................................................................................ 28Special Purpose Data Memory ............................................................................................. 28

Special Function Register Description ........................................................ 30Indirect Addressing Registers – IAR0, IAR1, IAR2 ............................................................... 30Memory Pointers – MP0, MP1L, MP1H, MP2L, MP2H ......................................................... 30Accumulator – ACC ............................................................................................................... 31Program Counter Low Register – PCL .................................................................................. 32Look-up Table Registers – TBLP, TBHP, TBLH ..................................................................... 32Status Register – STATUS .................................................................................................... 32

EEPROM Data Memory .................................................................................. 34EEPROM Data Memory Structure ........................................................................................ 34EEPROM Registers .............................................................................................................. 34Reading Data from the EEPROM ......................................................................................... 36Writing Data to the EEPROM ................................................................................................ 36Write Protection ..................................................................................................................... 36EEPROM Interrupt ................................................................................................................ 36Programming Considerations ................................................................................................ 37

Oscillators ...................................................................................................... 38Oscillator Overview ............................................................................................................... 38System Clock Configurations ................................................................................................ 38External Crystal/Ceramic Oscillator – HXT ........................................................................... 39Internal High Speed RC Oscillator – HIRC ........................................................................... 40Internal 32kHz Oscillator – LIRC ........................................................................................... 40

Operating Modes and System Clocks ......................................................... 40System Clocks ...................................................................................................................... 40System Operation Modes ...................................................................................................... 42Control Registers .................................................................................................................. 43Operating Mode Switching .................................................................................................... 45Standby Current Considerations ........................................................................................... 49Wake-up ................................................................................................................................ 49

Watchdog Timer ............................................................................................. 50Watchdog Timer Clock Source .............................................................................................. 50Watchdog Timer Control Register ......................................................................................... 50Watchdog Timer Operation ................................................................................................... 51

Reset and Initialisation .................................................................................. 52Reset Functions .................................................................................................................... 52Reset Initial Conditions ......................................................................................................... 54

Page 4: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 4 November 18, 2019 Rev. 1.10 5 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Input/Output Ports ......................................................................................... 58Pull-high Resistors ................................................................................................................ 58I/O Port Wake-up................................................................................................................... 59I/O Port Control Registers ..................................................................................................... 59Pin-shared Functions ............................................................................................................ 59I/O Pin Structures .................................................................................................................. 64Programming Considerations ................................................................................................ 64

Timer Modules – TM ...................................................................................... 65Introduction ........................................................................................................................... 65TM Operation ........................................................................................................................ 65TM Clock Source ................................................................................................................... 65TM Interrupts ......................................................................................................................... 66TM External Pins ................................................................................................................... 66Programming Considerations ................................................................................................ 67

Compact Type TM – CTM .............................................................................. 68Compact TM Operation ......................................................................................................... 68Compact Type TM Register Description................................................................................ 69Compact Type TM Operating Modes .................................................................................... 72

Standard Type TM – STM .............................................................................. 78Standard TM Operation ......................................................................................................... 78Standard Type TM Register Description ............................................................................... 78Standard Type TM Operation Modes .................................................................................... 82

Periodic Type TM – PTM ................................................................................ 92Periodic TM Operation .......................................................................................................... 92Periodic Type TM Register Description ................................................................................. 92Periodic Type TM Operating Modes ..................................................................................... 97

Analog to Digital Converter ........................................................................ 106A/D Converter Overview ..................................................................................................... 106A/D Converter Register Description .................................................................................... 107A/D Converter Operation .....................................................................................................110A/D Converter Reference Voltage ........................................................................................111A/D Converter Input Signals .................................................................................................112Conversion Rate and Timing Diagram .................................................................................113Summary of A/D Conversion Steps ......................................................................................113Programming Considerations ...............................................................................................114A/D Conversion Function .....................................................................................................114A/D Conversion Programming Examples .............................................................................115

I2C Interface ...................................................................................................117I2C Interface Operation .........................................................................................................117I2C Registers ........................................................................................................................118I2C Bus Communication ..................................................................................................... 121I2C Bus Start Signal ............................................................................................................ 122I2C Slave Address ............................................................................................................... 122

Page 5: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 4 November 18, 2019 Rev. 1.10 5 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

I2C Bus Read/Write Signal ................................................................................................. 123I2C Bus Slave Address Acknowledge Signal ....................................................................... 123I2C Bus Data and Acknowledge Signal .............................................................................. 123I2C Time-out Control ............................................................................................................ 125

16-bit Multiplication Division Unit – MDU .................................................. 126MDU Registers .................................................................................................................... 126MDU Operation ................................................................................................................... 127

High Resolution PWM Generator ............................................................... 129Functional Description ......................................................................................................... 129High Resolution PWM Registers ......................................................................................... 129PWM Duty/Phase Control for Half-Bridge or Full-Bridge Topology ..................................... 138Duty/Phase Control for WPC Specification ......................................................................... 140FSK Modulation for WPC Specification ............................................................................... 141FSK Package Format .......................................................................................................... 142

Demodulation Function ............................................................................... 142Demodulator Circuit Operation ............................................................................................ 142Input Voltage Range ............................................................................................................ 143Offset Calibration ................................................................................................................ 143Demodulator Register Description ...................................................................................... 144

Over Current Protection – OCP .................................................................. 147Over Current Protection Operation ..................................................................................... 147Input Voltage Range ............................................................................................................ 148Offset Calibration ................................................................................................................ 148

Interrupts ...................................................................................................... 151Interrupt Registers ............................................................................................................... 151Interrupt Operation .............................................................................................................. 159External Interrupts ............................................................................................................... 160Multi-function Interrupts ....................................................................................................... 161Over Current Protection Interrupt ........................................................................................ 161Demodulation Interrupts ...................................................................................................... 161FSKDASWn Interrupt .......................................................................................................... 162Whole FSK Packt Delivery Finish Interrupt ......................................................................... 162FSK Response Data Delivery Finish Interrupt .................................................................... 162I2C Interrupt ......................................................................................................................... 162A/D Converter Interrupt ....................................................................................................... 163Time Base Interrupts ........................................................................................................... 163EEPROM Interrupt .............................................................................................................. 165LVD Interrupt ....................................................................................................................... 165TM Interrupts ....................................................................................................................... 165Interrupt Wake-up Function ................................................................................................. 165Programming Considerations .............................................................................................. 166

Page 6: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 6 November 18, 2019 Rev. 1.10 7 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Low Voltage Detector – LVD ....................................................................... 166LVD Register ....................................................................................................................... 166LVD Operation ..................................................................................................................... 167

Application Descriptions ............................................................................ 168Instruction Set .............................................................................................. 170

Introduction ......................................................................................................................... 170Instruction Timing ................................................................................................................ 170Moving and Transferring Data ............................................................................................. 170Arithmetic Operations .......................................................................................................... 170Logical and Rotate Operation ............................................................................................. 171Branches and Control Transfer ........................................................................................... 171Bit Operations ..................................................................................................................... 171Table Read Operations ....................................................................................................... 171Other Operations ................................................................................................................. 171

Instruction Set Summary ............................................................................ 172Table Conventions ............................................................................................................... 172Extended Instruction Set ..................................................................................................... 174

Instruction Definition ................................................................................... 176Extended Instruction Definition ........................................................................................... 185

Package Information ................................................................................... 192SAW Type 32-pin (5mm×5mm) QFN Outline Dimensions .................................................. 193

Page 7: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 6 November 18, 2019 Rev. 1.10 7 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Features

CPU Features• Operating voltage

♦ fSYS=8MHz: 2.2V~5.5V ♦ fSYS=16MHz: 4.5V~5.5V

• Up to 0.25μs instruction cycle with 16MHz system clock at VDD=5V

• Power down and wake-up functions to reduce power consumption

• Oscillator types ♦ External High Speed Crystal – HXT ♦ Internal High Speed RC – HIRC ♦ Internal Low Speed 32kHz RC – LIRC

• Multi-mode operation: FAST, SLOW, SLEEP, IDLE

• Fully integrated internal oscillators require no external components

• All instructions executed in 1~3 instruction cycles

• Table read instructions

• 115 powerful instructions

• 8-level subroutine nesting

• Bit manipulation instruction

Peripheral Features• Flash Program Memory: 8K×16

• Data Memory: 256×8

• True EEPROM Memory: 64×8

• Watchdog Timer function

• 27 bidirectional I/O lines

• Dual pin-shared external interrupts

• Multiple Timer Modules for time measurement, input capture, compare match output or PWM output or single pulse output function

♦ Single Compact type 10-bit Timer Module – CTM ♦ Single Standard type 10-bit Timer Module – STM ♦ Single Periodic type 16-bit Timer Module – PTM

• I2C function

• Integrated 16-bit Multiplication Division Unit – MDU

• Over current protection (OCP) and demodulation functions

• High resolution PWM generator

• Dual Time-Base functions for generation of fixed time interrupt signals

• 6 external channels 12-bit resolution A/D converter

• Low voltage reset function

• Low voltage detect function

• Package type: 32-pin QFN

Page 8: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 8 November 18, 2019 Rev. 1.10 9 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

General DescriptionThe device is a Flash Memory A/D type 8-bit high performance architecture microcontroller and specially designed for wireless power transmission control. Offering users the convenience of Flash Memory multi-programming features, this device also includes a wide range of functions and features. Other memory includes an area of RAM Data Memory as well as an area of true EEPROM memory for storage of non-volatile data such as serial numbers, calibration data etc.

Analog features include a multi-channel 12-bit A/D converter. Multiple and extremely flexible Timer Modules provide timing, pulse generation and PWM generation functions. Communication with the outside world is catered for by including fully integrated I2C interface function, this popular interface which provides designers with a means of easy communication with external peripheral hardware. Protective features such as an internal Watchdog Timer, Low Voltage Reset, Over Current Protection and Low Voltage Detector coupled with excellent noise immunity and ESD protection ensure that reliable operation is maintained in hostile electrical environments.

A full choice of internal and external oscillator functions are provided a fully integrated system oscillator which requires no external components for its implementation. The ability to operate and switch dynamically between a range of operating modes using different clock sources gives users the ability to optimise microcontroller operation and minimise power consumption.

The inclusion of flexible I/O programming features, PLLn, Demodulators, PWM generator, Time-Base functions along with many other features ensure that the device will find specific excellent use in wireless power transmission applications.

Block Diagram

8-bitRISCMCUCore

I/O Timer Modules

Flash Program Memory

EEPROMData

Memory

Flash/EEPROM Programming Circuitry

RAMData

Memory

TimeBases

PWM

Low Voltage Detect / Reset

Watchdog Timer

Internal HIRC/LIRCOscillators

ResetCircuit

ExternalHXT

Oscillator

12-bit A/DConverter

Over Current Protection

Demodulations

InterruptController

1.2V Bandgap

PLLs + DLL I2C

Page 9: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 8 November 18, 2019 Rev. 1.10 9 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Pin Assignment

HT66FW2350HT66VW2350

32 QFN-A

9 10 11 12 13 14 15 16

252627282930313212345678

2423222120191817

PB3/DEMO0AXPB2/DEMO0ANPB1/DEMO0AP

PD2/PTCK/OSC1 PD1/PTP/OSC2 PD0/PTPB/PTPI/INT1/SCL/FSKDPC7/INT0/SDA/DEMO1

PA4/PWM

0

PA7/PWM

3PA6/PW

M2

PA5/PWM

1

VSSVD

D

PA1/AN1/C

TP/STPIPA3/AN

3/CTPB

PA2/CTCK/AN2/ICPCK/OCDSCK PA0/AN0/STPB/ICPDA/OCDSDA

PC2/DEMO1CPPC1/DEMO1AX

PC6/STP/AN4/VREFPC5/STCK/DEMO0/AN5/VREFI

PC4/DEMO1CXPC3/DEMO1CN

PC0/D

EMO

1AN

PB4/DEM

O0C

P

PB6/DEM

O0C

XPB5/D

EMO

0CN

PLLCO

M

AVSS

AVDD

PB7/DEM

O1AP

PB0/OCP

Note: 1. If the pin-shared pin functions have multiple outputs simultaneously, the desired pin-shared function is determined by the corresponding software control bits.

2. The OCDSDA and OCDSCK pins are supplied as OCDS dedicated pins and as such only available for the device HT66VW2350 which is the OCDS EV chip for the HT66FW2350 device.

Pin DescriptionWith the exception of power and PLL pins, all pins on the device can be referenced by its Port name, e.g. PA0, PA1 etc., which refer to the digital I/O function of the pins. However these Port pins are also shared with other functions such as the Analog to Digital Converter, etc. The function of each pin is listed in the following table, however the details behind how each pin is configured is contained in other sections of the datasheet.

Pin Name Function OPT I/T O/T Description

PA0/AN0/STPB/ICPDA/OCDSDA

PA0PAPUPAWUPAS0

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

AN0 PAS0 AN — A/D Converter external input 0STPB PAS0 — CMOS STM inverting outputICPDA — ST CMOS ICP address/data

OCDSDA — ST CMOS OCDS data/address pin, for EV chip only

PA1/AN1/CTP/STPI

PA1PAPUPAWUPAS0

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

AN1 PAS0 AN — A/D Converter external input 1CTP PAS0 — CMOS CTM outputSTPI PAS0 ST — STM capture input

PA2/CTCK/AN2/ICPCK/OCDSCK

PA2PAPUPAWUPAS0

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

CTCK PAS0 ST — CTM clock inputAN2 PAS0 AN — A/D Converter external input 2

ICPCK — ST — ICP clock inputOCDSCK — ST — OCDS clock pin, for EV chip only

Page 10: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 10 November 18, 2019 Rev. 1.10 11 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Pin Name Function OPT I/T O/T Description

PA3/AN3/CTPBPA3

PAPUPAWUPAS0

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

AN3 PAS0 AN — A/D Converter external input 3CTPB PAS0 — CMOS CTM inverting output

PA4/PWM0PA4

PAPUPAWUPAS1

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

PWM0 PAS1 — CMOS PWM0 output

PA5/PWM1PA5

PAPUPAWUPAS1

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

PWM1 PAS1 — CMOS PWM1 output

PA6/PWM2 PA6

PAPUPAWUPAS1

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

PWM2 PAS1 — CMOS PWM2 output

PA7/PWM3PA7

PAPUPAWUPAS1

ST CMOS General purpose I/O. Register enabled pull-up and wake-up

PWM3 PAS1 — CMOS PWM3 output

PB0/OCP PB0 PBPU

PBS0 ST CMOS General purpose I/O. Register enabled pull-up

OCP PBS0 AN — OCP input

PB1/DEMO0APPB1 PBPU

PBS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO0AP PBS0 AN — Demodulation 0 OPA positive input

PB2/DEMO0ANPB2 PBPU

PBS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO0AN PBS0 AN — Demodulation 0 OPA negative input

PB3/DEMO0AXPB3 PBPU

PBS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO0AX PBS0 — AN Demodulation 0 OPA output

PB4/DEMO0CPPB4 PBPU

PBS1 ST CMOS General purpose I/O. Register enabled pull-up

DEMO0CP PBS1 AN — Demodulation 0 CMP positive input

PB5/DEMO0CNPB5 PBPU

PBS1 ST CMOS General purpose I/O. Register enabled pull-up

DEMO0CN PBS1 AN — Demodulation 0 CMP negative input

PB6/DEMO0CXPB6 PBPU

PBS1 ST CMOS General purpose I/O. Register enabled pull-up

DEMO0CX PBS1 — AN Demodulation 0 CMP output

PB7/DEMO1APPB7 PBPU

PBS1 ST CMOS General purpose I/O. Register enabled pull-up

DEMO1AP PBS1 AN — Demodulation 1 OPA positive input

PC0/DEMO1ANPC0 PCPU

PCS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO1AN PCS0 AN — Demodulation 1 OPA negative input

PC1/DEMO1AXPC1 PCPU

PCS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO1AX PCS0 — CMOS Demodulation 1 OPA output

PC2/DEMO1CPPC2 PCPU

PCS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO1CP PCS0 AN — Demodulation 1 CMP positive input

Page 11: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 10 November 18, 2019 Rev. 1.10 11 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Pin Name Function OPT I/T O/T Description

PC3/DEMO1CNPC3 PCPU

PCS0 ST CMOS General purpose I/O. Register enabled pull-up

DEMO1CN PCS0 AN — Demodulation 1 CMP negative input

PC4/DEMO1CXPC4 PCPU

PCS1 ST CMOS General purpose I/O. Register enabled pull-up

DEMO1CX PCS1 — CMOS Demodulation 1 CMP output

PC5/STCK/DEMO0/AN5/VREFI

PC5 PCPUPCS1 ST CMOS General purpose I/O. Register enabled pull-up

STCK PCS1 ST — STM clock inputDEMO0 PCS1 — CMOS Demodulation 0 output

AN5 PCS1 AN — A/D Converter external input 5VREFI PCS1 AN — A/D Converter external reference input

PC6/STP/AN4/VREF

PC6 PCPUPCS1 ST CMOS General purpose I/O. Register enabled pull-up

STP PCS1 — CMOS STM outputAN4 PCS1 AN — A/D Converter external input 4

VREF PCS1 AN — A/D Converter reference voltage input

PC7/INT0/SDA/DEMO1

PC7 PCPUPCS1 ST CMOS General purpose I/O. Register enabled pull-up

INT0PCS1INTEGINTC3

ST — External Interrupt 0 input

SDA PCS1 ST NMOS I2C data lineDEMO1 PCS1 — CMOS Demodulation 1 output

PD0/PTPB/PTPI/INT1/SCL/FSKD

PD0 PDPUPDS0 ST CMOS General purpose I/O. Register enabled pull-up

PTPB PDS0 — CMOS PTM inverting outputPTPI PDS0 ST — PTM capture input

INT1PDS0INTEGINTC3

ST — External Interrupt 1 input

SCL PDS0 ST NMOS I2C clock lineFSKD PDS0 — CMOS FSK digital output

PD1/PTP/OSC2PD1 PDPU

PDS0 ST CMOS General purpose I/O. Register enabled pull-up

PTP PDS0 — CMOS PTM outputOSC2 PDS0 — HXT HXT oscillator output pin

PD2/PTCK/OSC1

PD2 PDPUPDS0 ST CMOS General purpose I/O. Register enabled pull-up

PTCK PDS0 ST — PTM clock inputOSC1 PDS0 HXT — HXT oscillator input pin

VDD VDD — PWR — Digital positive power supplyVSS VSS — PWR — Digital negative power supply, ground.AVDD AVDD — PWR — Analog positive power supplyAVSS AVSS — PWR — Analog negative power supply, ground.PLLCOM PLLCOM — AN — PLL compensation (filter)

Legend: I/T: Input type O/T: Output type OPT: Optional by register option PWR: Power ST: Schmitt Trigger input CMOS: CMOS output NMOS: NMOS output AN: Analog input pin HXT: High frequency crystal oscillator

Page 12: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 12 November 18, 2019 Rev. 1.10 13 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Absolute Maximum RatingsSupply Voltage ....................................................................................................... VSS−0.3V to 6.0VInput Voltage ..................................................................................................VSS−0.3V to VDD+0.3VStorage Temperature ....................................................................................................-50˚C to 125˚COperating Temperature ..................................................................................................-40˚C to 85˚CIOH Total ....................................................................................................................................-80mAIOL Total ..................................................................................................................................... 80mATotal Power Dissipation ......................................................................................................... 500mW

Note: These are stress ratings only. Stresses exceeding the range specified under "Absolute Maximum Ratings" may cause substantial damage to these devices. Functional operation of these devices at other conditions beyond those listed in the specification is not implied and prolonged exposure to extreme conditions may affect devices reliability.

D.C. CharacteristicsFor data in the following tables, note that factors such as oscillator type, operating voltage, operating frequency, pin load conditions, temperature and program instruction type, etc., can all exert an influence on the measured values.

Operating Voltage CharacteristicsTa=25°C

Symbol Parameter Test Conditions Min. Typ. Max. Unit

VDD

Operating Voltage (HIRC)fSYS=fHIRC=8MHz 2.2 — 5.5

VfSYS=fPLL/2=16MHz 4.5 — 5.5

Operating Voltage (HXT)fSYS=fHXT=8MHz 2.2 — 5.5

VfSYS=fPLL/2=16MHz 4.5 — 5.5

Operating Current CharacteristicsTa=25°C

Symbol Operating ModeTest Conditions

Min. Typ. Max. UnitVDD Conditions

IDD

SLOW Mode (LIRC)3V

fSYS=fLIIRC=32kHz— 10 20

μA5V — 30 50

FAST Mode (HIRC) 3V

fSYS=fHIRC=8MHz— 0.8 1.2

mA5V — 1.6 2.45V PLL2EN=1, fSYS=fPLL/2=16MHz — 6 9

FAST Mode (HXT)3V

fSYS=fHXT=8MHz— 1.0 1.5

mA5V — 2.0 3.05V PLL2EN=1, fSYS=fPLL/2=16MHz — 6 9

Notes: When using the characteristic table data, the following notes should be taken into consideration:1. Any digital inputs are setup in a non-floating condition.2. All measurements are taken under conditions of no load and with all peripherals in an off state.3. There are no DC current paths.4. All Operating Current values are measured using a continuous NOP instruction program loop.

Page 13: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 12 November 18, 2019 Rev. 1.10 13 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Standby Current CharacteristicsTa=25°C, unless otherwise specified

Symbol Standby ModeTest Conditions

Min. Typ. Max. Max.@85°C Unit

VDD Conditions

ISTB

SLEEP Mode3V

WDT on— 1.5 3.0 TBD

μA5V — 3.0 5.0 TBD

IDLE0 Mode (LIRC)3V

fSUB on— 3.0 5.0 TBD

μA5V — 5.0 10.0 TBD

IDLE1 Mode (HIRC) 3V

fSUB on, fSYS=fHIRC=8MHz— 500 600 TBD

μA5V — 800 960 TBD

Notes: When using the characteristic table data, the following notes should be taken into consideration:1. Any digital inputs are setup in a non-floating condition.2. All measurements are taken under conditions of no load and with all peripherals in an off state.3. There are no DC current paths.4. All Standby Current values are taken after a HALT instruction execution thus stopping all instruction

execution.

A.C. CharacteristicsFor data in the following tables, note that factors such as oscillator type, operating voltage, operating frequency and temperature etc., can all exert an influence on the measured values.

High Speed Internal Oscillator Frequency AccuracyDuring the program writing operation the writer will trim the HIRC oscillator at a user selected HIRC frequency and user selected voltage of either 3V or 5V.

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Temp.

fHIRC8MHz Writer Trimmed HIRC Frequency

3V/5V25°C -1% 8 +1%

MHz-40°C~85°C -2% 8 +2%

2.2V~ 5.5V

25°C -2.5% 8 +2.5%-40°C~85°C -3% 8 +3%

Notes: 1. The 3V/5V values for VDD are provided as these are the two selectable fixed voltages at which the HIRC frequency is trimmed by the writer.

2. The row below the 3V/5V trim voltage row is provided to show the values for the full VDD range operating voltage. It is recommended that the trim voltage is fixed at 3V for application voltage ranges from 2.2V to 3.6V and fixed at 5V for application voltage ranges from 3.3V to 5.5V.

Low Speed Internal Oscillator Characteristics – LIRC

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Temp.

fLIRC LIRC Frequency5V 25°C -10% 32 +10%

kHz5V±0.5V -40°C~85°C -40% 32 +40%2.2V~5.5V -40°C~85°C -50% 32 +60%

Page 14: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 14 November 18, 2019 Rev. 1.10 15 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Operating Frequency Characteristic Curves

System Operating Frequency

Operating Voltage

8MHz

16MHz

2.2V

~ ~

5.5V

~~

~ ~

4.5V

System Start Up Time CharacteristicsTa=-40°C~85°C

Symbol Parameter Test Conditions Min. Typ. Max. Unit

tSST

System Start-up Time (Wake-up from condition where fSYS is off)

fSYS=fH ~ fH/64, fH=fHXT — 128 — tHXT

fSYS=fH ~ fH/64, fH=fHIRC — 16 — tHIRC

fSYS=fSUB=fLIRC — 2 — tLIRC

System Start-up Time (Wake-up from condition where fSYS is on)

fSYS=fH ~ fH/64, fH=fHXT or fHIRC — 2 — tHfSYS=fSUB=fLIRC — 2 — tSUB

System Speed Switch Time (FAST to SLOW Mode or SLOW to FAST Mode)

fHXT switches from off → on — 1024 — tHXT

fHIRC switches from off → on — 16 — tHIRC

tRSTD

System Reset Delay Time (Reset source from Power-on reset or LVR hardware reset) RRPOR=5V/ms

25 50 100msSystem Reset Delay Time (LVRC/WDTC register

software reset) ─

System Reset Delay Time (WDT overflow reset) ─ 8.3 16.7 33.3tSRESET Minimum Software Reset Width to Reset ─ 45 90 120 μs

Notes: 1. For the System Start-up time values, whether fSYS is on or off depends upon the mode type and the chosen fSYS system oscillator. Details are provided in the System Operating Modes section.

2. The time units, shown by the symbols tHIRC etc. are the inverse of the corresponding frequency values as provided in the frequency tables. For example tHIRC=1/fHIRC, tSYS=1/fSYS etc.

3. The System Speed Switch Time is effectively the time taken for the newly activated oscillator to start up.

Page 15: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 14 November 18, 2019 Rev. 1.10 15 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Input/Output CharacteristicsTa=25°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

VIL Input Low Voltage for I/O Ports5V

—0 — 1.5

V— 0 — 0.2VDD

VIH Input High Voltage for I/O Ports 5V

—3.5 — 5.0

V— 0.8VDD — VDD

IOL

Sink Current for I/O Ports except PA4~PA73V

VOL=0.1VDD15.5 31.0 —

mA5V 31 62 —

Sink Current for PA4~PA7 3V

VOL=0.1VDD16 32 —

5V 40 80 —

IOH

Source Current for I/O Portsexcept PA4~PA7

3VVOH=0.9VDD

-3.5 -7.0 —

mA5V -7.2 14.5 —

Source Current for PA4~PA7 3V

VOH=0.9VDD-16 -32 —

5V -40 -80 —

RPH Pull-High Resistance for I/O Ports (Note)3V — 20 60 100

kΩ5V — 10 30 50

tTCK xTCK Input Pin Minimum Pulse Width — — 0.3 — — μstINT Interrupt Pin Minimum Pulse Width — — 10 — — μs

Note: The RPH internal pull high resistance value is calculated by connecting to ground and enabling the input pin with a pull-high resistor and then measuring the pin current at the specified supply voltage level. Dividing the voltage by this measured current provides the RPH value.

Memory CharacteristicsTa=-40°C~85°C, unless otherwise specified

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

VRW VDD for Read/Write — — VDDmin — VDDmax VProgram Flash/Data EEPROM Memory

tDEW

Erase / Write Cycle Time − Flash Program Memory — —

— 2 3 ms

Write Cycle Time − Data EEPROM Memory — 4 6 msIDDPGM Programming/Erase Current on VDD — — — — 5.0 mA

EPCell Endurance − Flash Program Memory — — 10K — — E/WCell Endurance − Data EEPROM Memory — — 100K — — E/W

tRETD ROM Data Retention Time — Ta=25°C — 40 — YearRAM Data MemoryVDR RAM Data Retention Voltage — Device in SLEEP Mode 1.0 — — V

Page 16: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 16 November 18, 2019 Rev. 1.10 17 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

A/D Converter Electrical CharacteristicsTa=-40°C~85°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

AVDD Operating Voltage — — 2.2 — 5.5 VVADI Input Voltage — — 0 — VREF VVREF Reference Voltage — — 2 — AVDD V

DNL Differential Non-linearity

3V SAINS[3:0]=0000B,SAVRS[1:0]=01B,VREF=VDD, tADCK=0.5μs

-3 — +3 LSB5V

3V SAINS[3:0]=0000B,SAVRS[1:0]=01B,VREF=VDD, tADCK=10μs5V

INL Integral Non-linearity

3V SAINS[3:0]=0000B,SAVRS[1:0]=01B,VREF=VDD, tADCK=0.5μs

-4 — +4 LSB5V

3V SAINS[3:0]=0000B,SAVRS[1:0]=01B,VREF=VDD, tADCK=10μs5V

IADCAdditional Current Consumption for A/D Converter Enable

3VNo load, tADCK=0.5μs

— 0.2 0.4 mA5V — 0.3 0.6 mA

tADCK Clock Period — — 0.5 — 10 μstON2ST A/D Converter On-to-Start Time — — 4 — — μstADS Sampling Time — — — 4 — tADCK

tADCConversion Time(Including A/D Sample and Hold Time) — — — 16 — tADCK

GERR A/D Conversion Gain Error3V SAINS[3:0]=0000B,

SAVRS[1:0]=01B,VREF=VDD

-4 — +4LSB

5V -4 — +4

OSRR A/D Conversion Offset Error3V SAINS[3:0]=0000B,

SAVRS[1:0]=01B,VREF=VDD

-4 — +4LSB

5V -4 — +4

IPGA Additional Current for PGA Enable3V

No load— 350 550

μA5V — 450 650

VOR PGA Maximum Output Voltage Range3V

—VSS+0.1 — VDD-0.1

V5V VSS+0.1 — VDD-0.1

VVR Fix Voltage Output of PGA

2.2V~ 5.5V VRI=VBGREF (PGAIS=1) -1% 2 +1%

V3.2V~ 5.5V VRI=VBGREF (PGAIS=1) -1% 3 +1%

4.2V~ 5.5V VRI=VBGREF (PGAIS=1) -1% 4 +1%

IVR VR Maximum Output Current 5V VVR=4V, ΔVVR=-1% 1.2 2.4 — mA

VRI PGA input voltage range3V Gain=1, PGAIS=0

Relative gainGain error <±5%

VSS+0.1 — VDD-1.4V

5V VSS+0.1 — VDD-1.4

Page 17: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 16 November 18, 2019 Rev. 1.10 17 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LVR/LVD Electrical CharacteristicsTa=25°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

VLVR Low Voltage Reset Voltage —

LVR enable, voltage select 2.1V -5% 2.1 +5%

VLVR enable, voltage select 2.55V -5% 2.55 +5%LVR enable, voltage select 3.15V -5% 3.15 +5%LVR enable, voltage select 3.8V -5% 3.8 +5%

VLVD Low Voltage Detection Voltage —

LVD enable, voltage select 2.0V -5% 2.0 +5%

V

LVD enable, voltage select 2.2V -5% 2.2 +5%LVD enable, voltage select 2.4V -5% 2.4 +5%LVD enable, voltage select 2.7V -5% 2.7 +5%LVD enable, voltage select 3.0V -5% 3.0 +5%LVD enable, voltage select 3.3V -5% 3.3 +5%LVD enable, voltage select 3.6V -5% 3.6 +5%LVD enable, voltage select 4.0V -5% 4.0 +5%

ILVRLVD Operating Current3V

LVD enable, LVR enable— — 18

μA5V — 20 25

tBGS VBG Turn on Stable Time — No load — — 150 μstLVDS LVDO Stable Time — For LVR enable, LVD off → on — — 15 μstLVR Minimum Low Voltage Width to Reset — — 120 240 480 μstLVD Minimum Low Voltage Width to Interrupt — — 60 120 240 μsILVR Additional Current for LVR Enable — LVD disable — — 24 μAILVD Additional Current for LVD Enable — LVD enable — — 24 μA

Internal Reference Voltage Electrical CharacteristicsTa=25°C, unless otherwise specified

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

VBGREF Bandgap Reference Voltage — Ta=-40°C~85°C -1% 1.2 +1% VIBGREF Operating Current 5.5V Ta=-40°C~85°C – 25 35 μAPSRR Power Supply Rejection Ratio — VRIPPLE=1VP-P, fRIPPLE=100Hz 75 — — dBEn Output Noise — No load current, f=0.1Hz~10Hz — 300 — μVRMS

IDRV Buffer Driving Capability — ∆VBGREF=-1% 1 — — mAISD Shutdown Current — VBGREN=0 — — 0.1 μAtSTART Startup Time 2.2V~5.5V — — — 400 μs

Notes: 1. All the above parameters are measured under conditions of no load condition unless otherwise described.2. A 0.1μF ceramic capacitor should be connected between VDD and GND.3. The VBGREF voltage is used as the A/D converter reference voltage input.

Page 18: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 18 November 18, 2019 Rev. 1.10 19 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

OCP Electrical CharacteristicsTa=25°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

IOCP Operating Current 5V OCPM[1:0]=01B,D/A converter VREF=2.5V — 480 710 μA

VOS_CMP Comparator Input Offset Voltage

3V Without calibration(OCPCOF[4:0]=10000B) -15 — 15 mV

5V Without calibration(OCPCOF[4:0]=10000B) -15 — 15 mV

3V With calibration -4 — 4 mV5V With calibration -4 — 4 mV

VHYS Hysteresis3V — 10 40 60 mV5V — 10 40 60 mV

VCM_CMPComparator Common Mode Voltage Range

3V — VSS — VDD-1.4 V5V — VSS — VDD-1.4 V

VOS_OPA OPA Input Offset Voltage

3V Without calibration(OCPAOF[5:0]=100000B) -15 — 15 mV

5V Without calibration(OCPAOF[5:0]=100000B) -15 — 15 mV

3V With calibration -4 — 4 mV5V With calibration -4 — 4 mV

VCM_OPA OPA Common Mode Voltage Range3V — VSS — VDD-1.4 V5V — VSS — VDD-1.4 V

VOR OPA Maximum Output Voltage Range3V — VSS+0.1 — VDD-0.1 V5V — VSS+0.1 — VDD-0.1 V

Ga PGA Gain Accuracy3V All gain -5 — 5 %5V All gain -5 — 5 %

VREF DAC Reference Voltage 3V/5V OCDAVR=0 2 — VDD V

DNL Differential Nonlinearity3V D/A converter VREF=VDD -1.5 — +1.5 LSB5V D/A converter VREF=VDD -1.0 — +1.0 LSB

INL Integral Nonlinearity3V D/A converter VREF=VDD -2.0 — +2.0 LSB5V D/A converter VREF=VDD -1.5 — +1.5 LSB

Notes: 1. If 0 > VIN > -0.2V and the PGA operates in the inverting mode, the output voltage of the PGA is VOPGA = -(R2/R1)×VIN.

2. If VIN is negative, it should not be lower than -0.2V to avoid leakage current.

Page 19: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 18 November 18, 2019 Rev. 1.10 19 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Demodulation Electrical CharacteristicsTa=25°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

IOCP Operating Current 5V DEMn[1:0]=01B, DAC VREF=2.5V — 480 710 μA

VOS_CMP Comparator Input Offset Voltage

3V Without calibration(DEMnCOF[4:0]=10000B) -15 — 15 mV

5V Without calibration(DEMnCOF[4:0]=10000B) -15 — 15 mV

3V With calibration -4 — 4 mV5V With calibration -4 — 4 mV

VHYS Hysteresis3V — 10 40 60 mV5V — 10 40 60 mV

VCM_CMPComparator Common Mode Voltage Range

3V — VSS — VDD-1.4 V5V — VSS — VDD-1.4 V

VOS_OPA OPA Input Offset Voltage

3V Without calibration(DEMnAOF[5:0]=100000B) -15 — 15 mV

5V Without calibration(DEMnAOF[5:0]=100000B) -15 — 15 mV

3V With calibration -4 — 4 mV5V With calibration -4 — 4 mV

VCM_OPAOPA Common Mode Voltage Range

3V — VSS — VDD-1.4 V

5V — VSS — VDD

-1.4 V

VOROPA Maximum Output Voltage Range

3V — VSS+0.1 — VDD-0.1 V5V — VSS+0.1 — VDD-0.1 V

Ga PGA Gain Accuracy3V All gain -5 — 5 %5V All gain -5 — 5 %

VREF DAC Reference Voltage 3V/5V DEMnDAVR=0 2 — VDD V

DNL Differential Nonlinearity3V DAC VREF=VDD -1.5 — +1.5 LSB5V DAC VREF=VDD -1.0 — +1.0 LSB

INL Integral Nonlinearity3V DAC VREF=VDD -2.0 — +2.0 LSB5V DAC VREF=VDD -1.5 — +1.5 LSB

Notes: 1. If 0 > VIN > -0.2V and the PGA operates in the inverting mode, the output voltage of the PGA is VOPGA = -(R2/R1)×VIN.

2. If VIN is negative, it should not be lower than -0.2V to avoid leakage current.

Page 20: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 20 November 18, 2019 Rev. 1.10 21 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

PWM Electrical CharacteristicsTa=25°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

PLL1 VDD Supply Voltage — — 4 — 5.5 VCKIN Input Frequency — — ─ 8 ─ MHzIPLL1 PLL1+DLL Power Consumption 5V No load, PLL1EN=1 — 3.2 4.3 mA

fMULFrequency Multiplication Factor(fMUL=PLL1OUT/CKIN) 5V

PLL1S=0 0.0125 — 0.0275 —PLL1S=1 0.025 — 0.055 —

PLL1OUT Output Frequency 5VCKIN=8MHz, When PLL1S=0 100 — 220 kHzCKIN=8MHz, When PLL1S=1 200 — 440 kHz

IOFF Standby Current 5V PLL1EN=0 — 1 2 μADLL DLL_LT DLL Lock Time — — ─ 20 30 μs

tPD Propagation Delay — Delay from Input Rising Edge to Clock output 1 2 3 ns

IOFF Standby Current — PLL1EN=0 — — 1 μAPLL2 fPLL2_in PLL2 Input Frequency 5V — — 8 — MHzfPLL2_out PLL2 Output Frequency 5V — — 32 — MHzIDD Supply Current — PLL2EN=1 — — 2 mAIOFF Standby Current — PLL2EN=0 — — 1 μA

Power-on Reset CharacteristicsTa=25°C

Symbol ParameterTest Conditions

Min. Typ. Max. UnitVDD Conditions

VPOR VDD Start Voltage to Ensure Power-on Reset — — – — 100 mVRRPOR VDD Rising Rate to Ensure Power-on Reset — — 0.035 — — V/ms

tPORMinimum Time for VDD Stays at VPOR to Ensure Power-on Reset — — 1 — — ms

VDD

tPOR RRPOR

VPOR

Time

Page 21: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 20 November 18, 2019 Rev. 1.10 21 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

System ArchitectureA key factor in the high-performance features of the Holtek range of microcontrollers is attributed to their internal system architecture. The range of the device take advantage of the usual features found within RISC microcontrollers providing increased speed of operation and enhanced performance. The pipelining scheme is implemented in such a way that instruction fetching and instruction execution are overlapped, hence instructions are effectively executed in one or two cycles for most of the standard or extended instructions respectively. The exceptions to this are branch or call instructions which need one more cycle. An 8-bit wide ALU is used in practically all instruction set operations, which carries out arithmetic operations, logic operations, rotation, increment, decrement, branch decisions, etc. The internal data path is simplified by moving data through the Accumulator and the ALU. Certain internal registers are implemented in the Data Memory and can be directly or indirectly addressed. The simple addressing methods of these registers along with additional architectural features ensure that a minimum of external components is required to provide a functional I/O and A/D control system with maximum reliability and flexibility. This makes the device suitable for low-cost, high-volume production for controller applications.

Clocking and PipeliningThe main system clock, derived from either a HXT, HIRC or LIRC oscillator is subdivided into four internally generated non-overlapping clocks, T1~T4. The Program Counter is incremented at the beginning of the T1 clock during which time a new instruction is fetched. The remaining T2~T4 clocks carry out the decoding and execution functions. In this way, one T1~T4 clock cycle forms one instruction cycle. Although the fetching and execution of instructions takes place in consecutive instruction cycles, the pipelining structure of the microcontroller ensures that instructions are effectively executed in one instruction cycle. The exception to this are instructions where the contents of the Program Counter are changed, such as subroutine calls or jumps, in which case the instruction will take one more instruction cycle to execute.

For instructions involving branches, such as jump or call instructions, two machine cycles are required to complete instruction execution. An extra cycle is required as the program takes one cycle to first obtain the actual jump or call address and then another cycle to actually execute the branch. The requirement for this extra cycle should be taken into account by programmers in timing sensitive applications.

Fetch Inst. (PC)

(System Clock)fSYS

Phase Clock T1

Phase Clock T2

Phase Clock T3

Phase Clock T4

Program Counter PC PC+1 PC+2

PipeliningExecute Inst. (PC-1) Fetch Inst. (PC+1)

Execute Inst. (PC) Fetch Inst. (PC+2)

Execute Inst. (PC+1)

System Clocking and Pipelining

Page 22: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 22 November 18, 2019 Rev. 1.10 23 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Fetch Inst. 11 MOV A,[12H]2 CALL DELAY3 CPL [12H]4 :5 :6 DELAY: NOP

Execute Inst. 1 Fetch Inst. 2 Execute Inst. 2

Fetch Inst. 3 Flush PipelineFetch Inst. 6 Execute Inst. 6

Fetch Inst. 7

Instruction Fetching

Program CounterDuring program execution, the Program Counter is used to keep track of the address of the next instruction to be executed. It is automatically incremented by one each time an instruction is executed except for instructions, such as “JMP” or “CALL” that demand a jump to a non-consecutive Program Memory address. Only the lower 8 bits, known as the Program Counter Low Register, are directly addressable by the application program.

When executing instructions requiring jumps to non-consecutive addresses such as a jump instruction, a subroutine call, interrupt or reset, etc., the microcontroller manages program control by loading the required address into the Program Counter. For conditional skip instructions, once the condition has been met, the next instruction, which has already been fetched during the present instruction execution, is discarded and a dummy cycle takes its place while the correct instruction is obtained.

Program CounterProgram Counter High byte PCL Register

PC12~PC8 PCL7~PCL0Program Counter

The lower byte of the Program Counter, known as the Program Counter Low register or PCL, is available for program control and is a readable and writeable register. By transferring data directly into this register, a short program jump can be executed directly; however, as only this low byte is available for manipulation, the jumps are limited to the present page of memory that is 256 locations. When such program jumps are executed it should also be noted that a dummy cycle will be inserted. Manipulating the PCL register may cause program branching, so an extra cycle is needed to pre-fetch.

StackThis is a special part of the memory which is used to save the contents of the Program Counter only. The stack is organized into 8 levels and neither part of the data nor part of the program space, and is neither readable nor writeable. The activated level is indexed by the Stack Pointer, and is neither readable nor writeable. At a subroutine call or interrupt acknowledge signal, the contents of the Program Counter are pushed onto the stack. At the end of a subroutine or an interrupt routine, signaled by a return instruction, RET or RETI, the Program Counter is restored to its previous value from the stack. After a device reset, the Stack Pointer will point to the top of the stack.

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

Page 23: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 22 November 18, 2019 Rev. 1.10 23 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

If the stack is overflow, the first Program Counter save in the stack will be lost.

StackPointer

Stack Level 2

Stack Level 1

Stack Level 3

:::

Stack Level 8

Program Memory

Program Counter

Bottom of Stack

Top of Stack

Arithmetic and Logic Unit – ALUThe arithmetic-logic unit or ALU is a critical area of the microcontroller that carries out arithmetic and logic operations of the instruction set. Connected to the main microcontroller data bus, the ALU receives related instruction codes and performs the required arithmetic or logical operations after which the result will be placed in the specified register. As these ALU calculation or operations may result in carry, borrow or other status changes, the status register will be correspondingly updated to reflect these changes. The ALU supports the following functions:

• Arithmetic operationsADD, ADDM, ADC, ADCM, SUB, SUBM, SBC, SBCM, DAA, LADD, LADDM, LADC, LADCM, LSUB, LSUBM, LSBC, LSBCM, LDAA

• Logic operationsAND, OR, XOR, ANDM, ORM, XORM, CPL, CPLA, LAND, LANDM, LOR, LORM, LXOR, LXORM, LCPL, LCPLA

• RotationRRA, RR, RRCA, RRC, RLA, RL, RLCA, RLC, LRRA, LRR, LRRCA, LRRC, LRLA, LRL, LRLCA, LRLC

• Increment and DecrementINCA, INC, DECA, DEC, LINCA, LINC, LDECA, LDEC

• Branch decisionJMP, SZ, SZA, SNZ, SIZ, SDZ, SIZA, SDZA, CALL, RET, RETI, LSNZ, LSZ, LSZA, LSIZ, LSIZA, LSDZ, LSDZA

Flash Program MemoryThe Program Memory is the location where the user code or program is stored. For the device the Program Memory is Flash type, which means it can be programmed and re-programmed a large number of times, allowing the user the convenience of code modification on the same device. By using the appropriate programming tools, the Flash device offers users the flexibility to conveniently debug and develop their applications while also offering a means of field programming and updating.

StructureThe Program Memory has a capacity of 8K×16 bits. The Program Memory is addressed by the Program Counter and also contains data, table information and interrupt entries. Table data, which can be setup in any location within the Program Memory, is addressed by a separate table pointer register.

Page 24: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 24 November 18, 2019 Rev. 1.10 25 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

000HInitialisation Vector

004H

1FFFH 16 bits

Interrupt Vectors

03CH

Look-up Tablen00H

nFFH

Program Memory Structure

Special VectorsWithin the Program Memory, certain locations are reserved for the reset and interrupts. The location 000H is reserved for use by the device reset for program initialisation. After a device reset is initiated, the program will jump to this location and begin execution.

Look-up TableAny location within the Program Memory can be defined as a look-up table where programmers can store fixed data. To use the look-up table, the table pointer must first be setup by placing the address of the look up data to be retrieved in the table pointer registers, TBLP and TBHP. These registers define the total address of the look-up table.

After setting up the table pointer, the table data can be retrieved from the Program Memory using the corresponding table read instruction such as “TABRD [m]” or “TABRDL [m]” respectively when the memory [m] is located in sector 0. If the memory [m] is located in other sectors, the data can be retrieved from the program memory using the corresponding extended table read instruction such as “LTABRD [m]” or “LTABRDL [m]” respectively. When the instruction is executed, the lower order table byte from the Program Memory will be transferred to the user defined Data Memory register [m] as specified in the instruction. The higher order table data byte from the Program Memory will be transferred to the TBLH special register.

The accompanying diagram illustrates the addressing data flow of the look-up table.

Last Page or TBHP Register

Address

TBLP Register

Data16 bits

Program Memory

Register TBLH User Selected Register

High Byte Low Byte

Page 25: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 24 November 18, 2019 Rev. 1.10 25 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Table Program ExampleThe following example shows how the table pointer and table data is defined and retrieved from the microcontroller. This example uses raw table data located in the Program Memory which is stored there using the ORG statement.

The value at this ORG statement is “1F00H” which refers to the start address of the last page within the 8K words Program Memory of the device. The table pointer low byte register is setup here to have an initial value of “06H”. This will ensure that the first data read from the data table will be at the Program Memory address “1F06H” or 6 locations after the start of the last page. Note that the value for the table pointer is referenced to the first address of the present page pointed by the TBHP register if the “TABRD [m]” or “LTABRD [m]” instruction is being used. The high byte of the table data which in this case is equal to zero will be transferred to the TBLH register automatically when the “TABRD [m]” or “LTABRD [m]” instruction is executed.

Because the TBLH register is a read/write register and can be restored, care should be taken to ensure its protection if both the main routine and Interrupt Service Routine use table read instructions. If using the table read instructions, the Interrupt Service Routines may change the value of the TBLH and subsequently cause errors if used again by the main routine. As a rule it is recommended that simultaneous use of the table read instructions should be avoided. However, in situations where simultaneous use cannot be avoided, the interrupts should be disabled prior to the execution of any main routine table-read instructions. Note that all table related instructions require two instruction cycles to complete their operation.

Table Read Program Exampletempreg1 db ? ; temporary register#1tempreg2 db ? ; temporary register#2 : :mov a,06h ; initialise table pointer - note that this address is referencedmov tblp,a ; to the last page or the page that tbhp pointedmov a,1Fh ; initialise high table pointermov tbhp,a : :tabrd tempreg1 ; transfers value in table referenced by table pointer ; data at program memory address "1F06H" transferred to ; tempreg1 and TBLHdec tblp ; reduce value of table pointer by onetabrd tempreg2 ; transfers value in table referenced by table pointer ; data at program memory address "1F05H" transferred to ; tempreg2 and TBLH ; in this example the data "1AH" is transferred to ; tempreg1 and data “0FH” to tempreg2 ; the value "00H" will be transferred to the high byte register TBLH : :org 1F00h ; sets initial address of last pagedc 00Ah,00Bh,00Ch,00Dh,00Eh,00Fh,01Ah,01Bh : :

Page 26: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 26 November 18, 2019 Rev. 1.10 27 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

In Circuit Programming – ICPThe provision of Flash type Program Memory provides the user with a means of convenient and easy upgrades and modifications to their programs on the same device.

As an additional convenience, Holtek has provided a means of programming the microcontroller in-circuit using a 4-pin interface. This provides manufacturers with the possibility of manufacturing their circuit boards complete with a programmed or un-programmed microcontroller, and then programming or upgrading the program at a later stage. This enables product manufacturers to easily keep their manufactured products supplied with the latest program releases without removal and re-insertion of the device.

The Holtek Flash MCU to Writer Programming Pin correspondence table is as follows:

Holtek Writer Pins MCU Programming Pins Pin DescriptionICPDA PA0 Programming Serial Data/AddressICPCK PA2 Programming ClockVDD VDD & AVDD Power SupplyVSS VSS & AVSS Ground

The Program Memory can be programmed serially in-circuit using this 4-wire interface. Data is downloaded and uploaded serially on a single pin with an additional line for the clock. Two additional lines are required for the power supply. The technical details regarding the in-circuit programming of the device is beyond the scope of this document and will be supplied in supplementary literature.

During the programming process, the user must take care of the ICPDA and ICPDK pins for data and clock programming purposes to ensure that no other outputs are connected to these two pins.

* *

Writer_VDD

ICPDA

ICPCK

Writer_VSS

To other Circuit

VDD

PA0

PA2

VSS

Writer Connector Signals

MCU ProgrammingPins

AVDD

AVSS

Note: * may be resistor or capacitor. The resistance of * must be greater than 1kΩ or the capacitance of * must be less than 1nF.

Page 27: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 26 November 18, 2019 Rev. 1.10 27 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

On-Chip Debug Support – OCDSThere is an EV chip named HT66VW2350 which is used to emulate the HT66FW2350 device. The EV chip device also provides an “On-Chip Debug” function to debug the real MCU device during the development process. The EV chip and the real MCU device are almost functionally compatible except for “On-Chip Debug” function. Users can use the EV chip device to emulate the real chip device behavior by connecting the OCDSDA and OCDSCK pins to the Holtek HT-IDE development tools. The OCDSDA pin is the OCDS Data/Address input/output pin while the OCDSCK pin is the OCDS clock input pin. When users use the EV chip for debugging, other functions which are shared with the OCDSDA and OCDSCK pins in the device will have no effect in the EV chip. However, the two OCDS pins which are pin-shared with the ICP programming pins are still used as the Flash Memory programming pins for ICP. For more detailed OCDS information, refer to the corresponding document named “Holtek e-Link for 8-bit MCU OCDS User’s Guide”.

Holtek e-Link Pins EV Chip Pins Pin DescriptionOCDSDA OCDSDA On-Chip Debug Support Data/Address input/outputOCDSCK OCDSCK On-Chip Debug Support Clock input

VDD VDD & AVDD Power SupplyVSS VSS & AVSS Ground

Data MemoryThe Data Memory is a volatile area of 8-bit wide RAM internal memory and is the location where temporary information is stored.

Categorized into two types, the first of these is an area of RAM, known as the Special Function Data Memory. These registers have fixed locations and are necessary for correct operation of the device. Many of these registers can be read from and written to directly under program control, however, some remain protected from user manipulation. The second area of Data Memory is known as the General Purpose Data Memory, which is reserved for general purpose use. All locations within this area are read and write accessible under program control.

StructureThe overall Data Memory is subdivided into several sectors, all of which are implemented in 8-bit wide RAM. The Special Purpose Data Memory registers are accessible in all sectors, with the exception of the EEC register at address 40H, which is only accessible in Sector 1. Switching between the different Data Memory sectors is achieved by setting the Memory Pointer to the correct value if using the indirect addressing method. The start address of the Data Memory for the device is the address 00H.

The address range of the Special Purpose Data Memory for the device is from 00H to 7FH while the address range of the General Purpose Data Memory is from 80H to FFH.

Special Purpose Data Memory General Purpose Data MemoryLocated Sectors Capacity Sector: Address

0~1 256×8 0: 80H~FFH1: 80H~FFH

Data Memory Summary

Page 28: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 28 November 18, 2019 Rev. 1.10 29 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

00H

7FH80H

FFH

Special Purpose Data Memory(Sector 0 ~ Sector 1)

General Purpose Data Memory(Sector 0 ~ Sector 1)

Sector 0Sector 1

40H:EEC(Sector 1)

Data Memory Structure

Data Memory AddressingFor Data Memory the desired Sector is pointed by the MP1H or MP2H register and the certain Data Memory address in the selected sector is specified by the MP1L or MP2L register when using indirect addressing access.

Direct Addressing can be used in all sectors using the corresponding instruction which can address all available data memory space. For the accessed data memory which is located in any data memory sectors except sector 0, the extended instructions can be used to access the data memory instead of using the indirect addressing access. The main difference between standard instructions and extended instructions is that the data memory address “m” in the extended instructions has 9 valid bits for this device, the high byte indicates a sector and the low byte indicates a specific address.

General Purpose Data MemoryAll microcontroller programs require an area of read/write memory where temporary data can be stored and retrieved for use later. It is this area of RAM memory that is known as General Purpose Data Memory. This area of Data Memory is fully accessible by the user program for both reading and writing operations. By using the bit operation instructions individual bits can be set or reset under program control giving the user a large range of flexibility for bit manipulation in the Data Memory.

Special Purpose Data MemoryThis area of Data Memory is where registers, necessary for the correct operation of the microcontroller, are stored. Most of the registers are both readable and writeable but some are protected and are readable only, the details of which are located under the relevant Special Function Register section. Note that for locations that are unused, any read instruction to these addresses will return the value “00H”.

Page 29: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 28 November 18, 2019 Rev. 1.10 29 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

: Unused, read as 00H

INTC3INTC2INTC1INTC0

PCCPC

HIRCCHXTCSCC

CTMAHCTMALCTMDHCTMDLCTMC1CTMC0SADOHSADOLSADC2SADC1SADC0VBGRCPSCRTBC1TBC0PDPUPDCPD

LVRCLVDCPAWUPAPUPACPA

WDTCPBPUPBCPB

RSTFCMP2HMP2LIAR2

STATUSTBHPTBLHTBLPPCLACC

MP1HMP1LIAR1MP0IAR0

PAS1PAS0

I2CTOC

IICC1IICC0PDS0INTEGMFI0

PWMC2PWMC1PWMC0CKGENPLLFHPLLFL

DEM1CCALDEM1ACALDEM1REFDEM1C1DEM1C0

OCPCCALOCPACALOCPREFOCPC1OCPC0

DEM0CCALDEM0ACALDEM0REFDEM0C1DEM0C0DCMISC

MDUWCTRLMDUWR5MDUWR4MDUWR3MDUWR2MDUWR1MDUWR0

PCS0PBS1PBS0MFI5MFI4MFI3MFI2MFI1

PTMRPHPTMRPLPTMAHPTMALPTMDHPTMDLPTMC1PTMC0STMAHSTMALSTMDHSTMDLSTMC1STMC0

EEDEEA

PHSCHPHSCL

DUTYCHDUTYCL

DTC

EEC

FSKDAC0

Sector 0,1 Sector 1Sector 0 00H01H02H03H04H05H06H07H08H09H0AH0BH0CH0DH0EH0FH10H11H12H

19H18H

1BH1AH

1DH1CH

1FH

13H14H15H16H17H

1EH

20H21H22H

29H28H

2BH2AH

2DH2CH

2FH2EH

23H24H25H26H27H

30H31H32H

38H

3CH

33H34H35H36H37H

3BH

39H3AH

3DH

3FH3EH

40H41H42H43H44H45H46H47H48H49H4AH4BH4CH4DH4EH4FH50H51H52H

59H58H

5BH5AH

5DH5CH

5FH

53H54H55H56H57H

5EH

60H61H62H

69H68H

6BH6AH

6DH6CH

6FH6EH

63H64H65H66H67H

70H71H72H

78H

7CH

73H74H75H76H77H

7BH

79H7AH

7DH

7FH7EH

PCPU

IICAIICD

FSKDASW0FSKDAC1

FSKDASW1PCS1

Special Purpose Data Memory

Page 30: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 30 November 18, 2019 Rev. 1.10 31 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Special Function Register DescriptionMost of the Special Function Register details will be described in the relevant functional section; however several registers require a separate description in this section.

Indirect Addressing Registers – IAR0, IAR1, IAR2The Indirect Addressing Registers, IAR0, IAR1 and IAR2, although having their locations in normal RAM register space, do not actually physically exist as normal registers. The method of indirect addressing for RAM data manipulation uses these Indirect Addressing Registers and Memory Pointers, in contrast to direct memory addressing, where the actual memory address is specified. Actions on the IAR0, IAR1 and IAR2 registers will result in no actual read or write operation to these registers but rather to the memory location specified by their corresponding Memory Pointers, MP0, MP1L/MP1H or MP2L/MP2H. Acting as a pair, IAR0 and MP0 can together access data only from Sector 0 while the IAR1 register together with the MP1L/MP1H register pair and IAR2 register together with the MP2L/MP2H register pair can access data from any Data Memory sector. As the Indirect Addressing Registers are not physically implemented, reading the Indirect Addressing Registers will return a result of “00H” and writing to the registers will result in no operation.

Memory Pointers – MP0, MP1L, MP1H, MP2L, MP2HFive Memory Pointers, known as MP0, MP1L, MP1H, MP2L, MP2H, are provided. These Memory Pointers are physically implemented in the Data Memory and can be manipulated in the same way as normal registers providing a convenient way with which to address and track data. When any operation to the relevant Indirect Addressing Registers is carried out, the actual address that the microcontroller is directed to is the address specified by the related Memory Pointer. MP0, together with Indirect Addressing Register, IAR0, are used to access data from Sectors 0, while MP1L/MP1H together with IAR1 and MP2L/MP2H together with IAR2 are used to access data from all sectors according to the corresponding MP1H or MP2H register. Direct Addressing can be used in all sectors using the corresponding instructions which can address all available data memory space.

The following example shows how to clear a section of four Data Memory locations already defined as locations adres1 to adres4.

Indirect Addressing Program Example 1data .section ´data´adres1 db ?adres2 db ?adres3 db ?adres4 db ?block db ?code .section at 0 code´org 00hstart: mov a, 04h ; setup size of block mov block, a mova,offsetadres1 ;AccumulatorloadedwithfirstRAMaddress movmp0,a ;setupmemorypointerwithfirstRAMaddressloop: clrIAR0 ;clearthedataataddressdefinedbyMP0 inc mp0 ; increase memory pointer sdz block ; check if last memory location has been cleared jmp loopcontinue:

Page 31: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 30 November 18, 2019 Rev. 1.10 31 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Indirect Addressing Program Example 2data .section ´data´adres1 db ?adres2 db ?adres3 db ?adres4 db ?block db ?code .section at 0 code´org 00hstart: mov a, 04h ; setup size of block mov block, a mov a, 01h ; setup the memory sector mov mp1h, a mova,offsetadres1 ;AccumulatorloadedwithfirstRAMaddress movmp1l,a ;setupmemorypointerwithfirstRAMaddressloop: clrIAR1 ;clearthedataataddressdefinedbyMP1L incmp1l ;increasememorypointerMP1L sdz block ; check if last memory location has been cleared jmp loopcontinue:

The important point to note here is that in the example shown above, no reference is made to specific Data Memory addresses.

Direct Addressing Program Example using extended instructionsdata .section ´data´temp db ?code .section at 0 code´org 00hstart: lmov a, [m] ; move [m] data to acc lsub a, [m+1] ; compare [m] and [m+1] data snz c ; [m]>[m+1]? jmp continue ; no lmov a, [m] ; yes, exchange [m] and [m+1] data mov temp, a lmov a, [m+1] lmov [m], a mov a, temp lmov [m+1], acontinue:

Note: Here “m” is a data memory address located in any data memory sectors. For example, m=1F0H, it indicates address 0F0H in Sector 1.

Accumulator – ACCThe Accumulator is central to the operation of any microcontroller and is closely related with operations carried out by the ALU. The Accumulator is the place where all intermediate results from the ALU are stored. Without the Accumulator it would be necessary to write the result of each calculation or logical operation such as addition, subtraction, shift, etc., to the Data Memory resulting in higher programming and timing overheads. Data transfer operations usually involve the temporary storage function of the Accumulator; for example, when transferring data between one user-defined register and another, it is necessary to do this by passing the data through the Accumulator as no direct transfer between two registers is permitted.

Page 32: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 32 November 18, 2019 Rev. 1.10 33 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Program Counter Low Register – PCLTo provide additional program control functions, the low byte of the Program Counter is made accessible to programmers by locating it within the Special Purpose area of the Data Memory. By manipulating this register, direct jumps to other program locations are easily implemented. Loading a value directly into this PCL register will cause a jump to the specified Program Memory location, however, as the register is only 8-bit wide, only jumps within the current Program Memory page are permitted. When such operations are used, note that a dummy cycle will be inserted.

Look-up Table Registers – TBLP, TBHP, TBLHThese three special function registers are used to control operation of the look-up table which is stored in the Program Memory. TBLP and TBHP are the table pointers and indicate the location where the table data is located. Their value must be setup before any table read commands are executed. Their value can be changed, for example using the “INC” or “DEC” instructions, allowing for easy table data pointing and reading. TBLH is the location where the high order byte of the table data is stored after a table read data instruction has been executed. Note that the lower order table data byte is transferred to a user defined location.

Status Register – STATUSThis 8-bit register contains the SC flag, CZ flag, zero flag (Z), carry flag (C), auxiliary carry flag (AC), overflow flag (OV), power down flag (PDF), and watchdog time-out flag (TO). These arithmetic/logical operation and system management flags are used to record the status and operation of the microcontroller.

With the exception of the TO and PDF flags, bits in the status register can be altered by instructions like most other registers. Any data written into the status register will not change the TO or PDF flag. In addition, operations related to the status register may give different results due to the different instruction operations. The TO flag can be affected only by a system power-up, a WDT time-out or by executing the “CLR WDT” or “HALT” instruction. The PDF flag is affected only by executing the “HALT” or “CLR WDT” instruction or during a system power-up.

The SC, CZ, Z, OV, AC and C flags generally reflect the status of the latest operations.

• C is set if an operation results in a carry during an addition operation or if a borrow does not take place during a subtraction operation; otherwise C is cleared. C is also affected by a rotate through carry instruction.

• AC is set if an operation results in a carry out of the low nibbles in addition, or no borrow from the high nibble into the low nibble in subtraction; otherwise AC is cleared.

• Z is set if the result of an arithmetic or logical operation is zero; otherwise Z is cleared.

• OV is set if an operation results in a carry into the highest-order bit but not a carry out of the highest-order bit, or vice versa; otherwise OV is cleared.

• PDF is cleared by a system power-up or executing the “CLR WDT” instruction. PDF is set by executing the “HALT” instruction.

• TO is cleared by a system power-up or executing the “CLR WDT” or “HALT” instruction. TO is set by a WDT time-out.

• SC is the result of the “XOR” operation which is performed by the OV flag and the MSB of the current instruction operation result.

• CZ is the operational result of different flags for different instructions. Refer to register definitions for more details.

Page 33: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 32 November 18, 2019 Rev. 1.10 33 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

In addition, on entering an interrupt sequence or executing a subroutine call, the status register will not be pushed onto the stack automatically. If the contents of the status registers are important and if the subroutine can corrupt the status register, precautions must be taken to correctly save it.

• STATUS Register

Bit 7 6 5 4 3 2 1 0Name SC CZ TO PDF OV Z AC CR/W R/W R/W R R R/W R/W R/W R/WPOR x x 0 0 x x x x

”x”: unknown

Bit 7 SC: The result of the “XOR” operation which is performed by the OV flag and the MSB of the instruction operation result.

Bit 6 CZ: The operational result of different flags for different instructions.For SUB/SUBM/LSUB/LSUBM instructions, the CZ flag is equal to the Z flag. For SBC/SBCM/LSBC/LSBCM instructions, the CZ flag is the “AND” operation result which is performed by the previous operation CZ flag and current operation zero flag. For other instructions, the CZ flag will not be affected.

Bit 5 TO: Watchdog Time-out flag0: After power up or executing the “CLR WDT” or “HALT” instruction1: A watchdog time-out occurred.

Bit 4 PDF: Power down flag0: After power up or executing the “CLR WDT” instruction1: By executing the “HALT” instruction

Bit 3 OV: Overflow flag0: No overflow1: An operation results in a carry into the highest-order bit but not a carry out of the

highest-order bit or vice versaBit 2 Z: Zero flag

0: The result of an arithmetic or logical operation is not zero1: The result of an arithmetic or logical operation is zero

Bit 1 AC: Auxiliary flag0: No auxiliary carry1: An operation results in a carry out of the low nibbles in addition, or no borrow

from the high nibble into the low nibble in subtractionBit 0 C: Carry flag

0: No carry-out1: An operation results in a carry during an addition operation or if a borrow does

not take place during a subtraction operationThe “C” flag is also affected by a rotate through carry instruction.

Page 34: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 34 November 18, 2019 Rev. 1.10 35 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

EEPROM Data MemoryThis device contains an area of internal EEPROM Data Memory. EEPROM, which is by its nature a non-volatile form of re-programmable memory, with data retention even when its power supply is removed. By incorporating this kind of data memory, a whole new host of application possibilities are made available to the designer. The availability of EEPROM storage allows information such as product identification numbers, calibration values, specific user data, system setup data or other product information to be stored directly within the product microcontroller. The process of reading and writing data to the EEPROM memory has been reduced to a very trivial affair.

EEPROM Data Memory StructureThe EEPROM Data Memory capacity is 64×8 bits for the device. Unlike the Program Memory and RAM Data Memory, the EEPROM Data Memory is not directly mapped into memory space and is therefore not directly addressable in the same way as the other types of memory. Read and Write operations to the EEPROM are carried out in single byte operations using an address and a data register in any sector and a single control register in Sector 1.

EEPROM RegistersThree registers control the overall operation of the internal EEPROM Data Memory. These are the address register, EEA, the data register, EED and a single control register, EEC. As both the EEA and EED registers are located in Sector 0, they can be directly accessed in the same way as many other Special Function Registers. The EEC register however, being located in Sector 1, can only be read from or written to directly using the MP1L/MP1H or MP2L/MP2H Memory Pointer and Indirect Addressing Register, IAR1/IAR2. If using indirect addressing to access the EEC control register, as it is located at address 40H in Sector 1, the MP1L or MP2L Memory Pointer must first be set to the value 40H and the MP1H or MP2H Memory Pointer high byte set to the value, 01H, before any operations on the EEC register are executed.

Register Name

Bit7 6 5 4 3 2 1 0

EEA — — EEA5 EEA4 EEA3 EEA2 EEA1 EEA0EED EED7 EED6 EED5 EED4 EED3 EED2 EED1 EED0EEC — — — — WREN WR RDEN RD

EEPROM Register List

• EEA Register

Bit 7 6 5 4 3 2 1 0Name — — EEA5 EEA4 EEA3 EEA2 EEA1 EEA0R/W — — R/W R/W R/W R/W R/W R/WPOR — — 0 0 0 0 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5~0 EEA5~EEA0: Data EEPROM address bit 5 ~ bit 0

Page 35: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 34 November 18, 2019 Rev. 1.10 35 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• EED Register

Bit 7 6 5 4 3 2 1 0Name EED7 EED6 EED5 EED4 EED3 EED2 EED1 EED0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 EED7~EED0: Data EEPROM data bit 7 ~ bit 0

• EEC Register

Bit 7 6 5 4 3 2 1 0Name — — — — WREN WR RDEN RDR/W — — — — R/W R/W R/W R/WPOR — — — — 0 0 0 0

Bit 7~4 Unimplemented, read as “0”Bit 3 WREN: Data EEPROM Write Enable

0: Disable1: Enable

This is the Data EEPROM Write Enable Bit which must be set high before Data EEPROM write operations are carried out. Clearing this bit to zero will inhibit Data EEPROM write operations.

Bit 2 WR: EEPROM Write Control0: Write cycle has finished1: Activate a write cycle

This is the Data EEPROM Write Control Bit and when set high by the application program will activate a write cycle. This bit will be automatically reset to zero by the hardware after the write cycle has finished. Setting this bit high will have no effect if the WREN has not first been set high.

Bit 1 RDEN: Data EEPROM Read Enable0: Disable1: Enable

This is the Data EEPROM Read Enable Bit which must be set high before Data EEPROM read operations are carried out. Clearing this bit to zero will inhibit Data EEPROM read operations.

Bit 0 RD: EEPROM Read Control0: Read cycle has finished1: Activate a read cycle

This is the Data EEPROM Read Control Bit and when set high by the application program will activate a read cycle. This bit will be automatically reset to zero by the hardware after the read cycle has finished. Setting this bit high will have no effect if the RDEN has not first been set high.

Note: 1. The WREN, WR, RDEN and RD cannot be set high at the same time in one instruction. The WR and RD cannot be set high at the same time.

2. Ensure that the fSUB clock is stable before executing the write operation.

3. Ensure that the write operation is totally complete before changing the EEC register content.

Page 36: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 36 November 18, 2019 Rev. 1.10 37 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Reading Data from the EEPROMTo read data from the EEPROM, the EEPROM address of the data to be read must first be placed in the EEA register. Then the read enable bit, RDEN, in the EEC register must be set high to enable the read function. If the RD bit in the EEC register is now set high, a read cycle will be initiated. Setting the RD bit high will not initiate a read operation if the RDEN bit has not been set. When the read cycle terminates, the RD bit will be automatically cleared to zero, after which the data can be read from the EED register. The data will remain in the EED register until another read or write operation is executed. The application program can poll the RD bit to determine when the data is valid for reading.

Writing Data to the EEPROMTo write data to the EEPROM, the EEPROM address of the data to be written must first be placed in the EEA register and the data placed in the EED register. To initiate a write cycle, the write enable bit, WREN, in the EEC register must first be set high to enable the write function. After this, the WR bit in the EEC register must be immediately set high to initiate a write cycle. These two instructions must be executed in two consecutive instruction cycles. The global interrupt bit EMI should also first be cleared before implementing any write operations, and then set again after the write cycle has started. Note that setting the WR bit high will not initiate a write cycle if the WREN bit has not been set. As the EEPROM write cycle is controlled using an internal timer whose operation is asynchronous to microcontroller system clock, a certain time will elapse before the data will have been written into the EEPROM. Detecting when the write cycle has finished can be implemented either by polling the WR bit in the EEC register or by using the EEPROM interrupt. When the write cycle terminates, the WR bit will be automatically cleared to zero by the microcontroller, informing the user that the data has been written to the EEPROM. The application program can therefore poll the WR bit to determine when the write cycle has ended.

Write ProtectionProtection against inadvertent write operation is provided in several ways. After the device is powered-on the Write Enable bit in the control register will be cleared preventing any write operations. Also at power-on the Memory Pointer high byte register, MP1H or MP2H, will be reset to zero, which means that Data Memory Sector 0 will be selected. As the EEPROM control register is located in Sector 1, this adds a further measure of protection against spurious write operations. During normal program operation, ensuring that the Write Enable bit in the control register is cleared will safeguard against incorrect write operations.

EEPROM InterruptThe EEPROM write interrupt is generated when an EEPROM write cycle has ended. The EEPROM interrupt must first be enabled by setting the DEE bit in the relevant interrupt register. However as the EEPROM is contained within a Multi-function Interrupt, the associated multi-function interrupt enable bit must also be set. When an EEPROM write cycle ends, the DEF request flag and its associated multi-function interrupt request flag will both be set. If the global, EEPROM and Multi-function interrupts are enabled and the stack is not full, a jump to the associated Multi-function Interrupt vector will take place. When the interrupt is serviced only the Multi-function interrupt flag will be automatically reset, the EEPROM interrupt flag must be manually reset by the application program. More details can be obtained in the Interrupt section.

Page 37: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 36 November 18, 2019 Rev. 1.10 37 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Programming ConsiderationsCare must be taken that data is not inadvertently written to the EEPROM. Protection can be enhanced by ensuring that the Write Enable bit is normally cleared to zero when not writing. Also the Memory Pointer high byte register, MP1H or MP2H, could be normally cleared to zero as this would inhibit access to Sector 1 where the EEPROM control register exists. Although certainly not necessary, consideration might be given in the application program to the checking of the validity of new write data by a simple read back process.

When writing data the WR bit must be set high immediately after the WREN bit has been set high, to ensure the write cycle executes correctly. The global interrupt bit EMI should also be cleared before a write cycle is executed and then re-enabled after the write cycle starts. Note that the device should not enter the IDLE or SLEEP mode until the EEPROM read or write operation is totally complete. Otherwise, the EEPROM read or write operation will fail.

Programming Examples

• Reading data from the EEPROM - polling methodMOV A,EEPROM_ADRES ;userdefinedaddressMOV EEA,AMOV A,040H ;setupmemorypointerMP1LMOV MP1L,A ;MP1LpointstoEECregisterMOV A,01H ;setupmemorypointerMP1HMOV MP1H,ASET IAR1.1 ;setRDENbit,enablereadoperationsSET IAR1.0 ;startReadCycle-setRDbitBACK:SZ IAR1.0 ;checkforreadcycleendJMP BACKCLR IAR1 ;disableEEPROMreadifnomorereadoperationsarerequiredCLR MP1HMOV A,EED ;movereaddatatoregisterMOV READ_DATA,A

Note: For each read operation, the address register should be re-specified followed by setting the RD bit high to activate a read cycle even if the target address is consecutive.

• Writing Data to the EEPROM - polling methodMOV A,EEPROM_ADRES ;userdefinedaddressMOV EEA,AMOV A,EEPROM_DATA ;userdefineddataMOV EED,AMOV A,040H ;setupmemorypointerMP1LMOV MP1L,A ;MP1LpointstoEECregisterMOV A,01H ;setupmemorypointerMP1HMOV MP1H,ACLR EMISET IAR1.3 ;setWRENbit,enablewriteoperationsSET IAR1.2 ;startWriteCycle-setWRbit–executedimmediately ;aftersetWRENbitSET EMIBACK:SZ IAR1.2 ;checkforwritecycleendJMP BACKCLR MP1H

Page 38: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 38 November 18, 2019 Rev. 1.10 39 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

OscillatorsVarious oscillator options offer the user a wide range of functions according to their various application requirements. The flexible features of the oscillator functions ensure that the best optimisation can be achieved in terms of speed and power saving. Oscillator selections and operation are selected through the relevant control registers.

Oscillator OverviewIn addition to being the source of the main system clock the oscillators also provide clock sources for the Watchdog Timer and Time Base Interrupts. External oscillators requiring some external components as well as fully integrated internal oscillators, requiring no external components, are provided to form a wide range of both fast and slow system oscillators. All oscillator options are selected through the relevant control registers. The higher frequency oscillators provide higher performance but carry with it the disadvantage of higher power requirements, while the opposite is of course true for the lower frequency oscillators. With the capability of dynamically switching between fast and slow system clock, the device has the flexibility to optimize the performance/power ratio, a feature especially important in power sensitive portable applications.

Type Name Frequency PinsExternal High Speed Crystal HXT 8MHz OSC1/OSC2Internal High Speed RC HIRC 8MHz —Internal Low Speed RC LIRC 32kHz —

Oscillator Types

System Clock ConfigurationsThere are several oscillator sources, two high speed oscillators and one low speed oscillator. The high speed system clocks are sourced from the external crystal/ceramic oscillator, HXT, and the internal 8MHz RC oscillator, HIRC. The low speed oscillator is the internal 32kHz RC oscillator, LIRC. Selecting whether the low or high speed oscillator is used as the system oscillator is implemented using the CKS2~CKS0 bits in the SCC register and as the system clock can be dynamically selected.

The actual source clock used for the high speed oscillator the source clock is selected by the FHS bit in the SCC register. The frequency of the slow speed or high speed system clock is also determined using the CKS2~CKS0 bits in the SCC register. Note that two oscillator selections must be made namely one high speed and one low speed system oscillators. It is not possible to choose a no-oscillator selection for either the high or low speed oscillator. In addition, the internal High Resolution PWM Generator, whose clock source is supplied by an external crystal oscillator, can be enabled by a software control bit to generate various frequencies for the system clock. The details of the fPLL is described in the High Resolution PWM Generator section.

Page 39: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 38 November 18, 2019 Rev. 1.10 39 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

High Speed Oscillators

FHS

PrescalerfH

fH/2

fH/4fH/8

fH/16

fH/32

fH/64

CKS2~CKS0

fSYS

Low Speed Oscillator

fSUB

fSUB

WDTfLIRC

IDLE2SLEEP

IDLE0SLEEP

HXT

HIRC

HXTEN

HIRCEN

LIRC

fPLL

PLLOS

fHOSC

HIRCFHXTF

HOSCF

System Clock Configurations

External Crystal/Ceramic Oscillator – HXTThe External Crystal/Ceramic System Oscillator is one of the high frequency oscillators. For most crystal oscillator configurations, the simple connection of a crystal across OSC1 and OSC2 will create the necessary phase shift and feedback for oscillation, without requiring external capacitors. However, for some crystal types and frequencies, to ensure oscillation, it may be necessary to add two small value capacitors, C1 and C2. Using a ceramic resonator will usually require two small value capacitors, C1 and C2, to be connected as shown for oscillation to occur. The values of C1 and C2 should be selected in consultation with the crystal or resonator manufacturer’s specification.

For oscillator stability and to minimise the effects of noise and crosstalk, it is important to ensure that the crystal and any associated resistors and capacitors along with interconnecting lines are all located as close to the MCU as possible.

Note: 1. RP is normally not required. C1 and C2 are required.2. Although not shown OSC1/OSC2 pins have a parasitic

capacitance of around 7pF.

To internal circuits

Internal Oscillator Circuit

C1

C2

OSC1

OSC2

RFRP

Crystal/Resonator Oscillator – HXT

Page 40: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 40 November 18, 2019 Rev. 1.10 41 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Crystal Oscillator C1 and C2 ValuesCrystal Frequency C1 C2

16MHz 0pF 0pF12MHz 0pF 0pF8MHz 0pF 0pF6MHz 0pF 0pF4MHz 0pF 0pF1MHz 100pF 100pF

Note: C1 and C2 values are for guidance only.

Crystal Recommended Capacitor Values

Internal High Speed RC Oscillator – HIRCThe internal RC oscillator is a fully integrated system oscillator requiring no external components. The internal RC oscillator has a fixed frequency of 8MHz. Device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the influence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised. Note that if this internal system clock option is selected, it requires no external pins for its operation.

Internal 32kHz Oscillator – LIRCThe Internal 32kHz System Oscillator is a low frequency oscillator. It is a fully integrated RC oscillator with a typical frequency of 32kHz at 5V, requiring no external components for its implementation. Device trimming during the manufacturing process and the inclusion of internal frequency compensation circuits are used to ensure that the influence of the power supply voltage, temperature and process variations on the oscillation frequency are minimised.

Operating Modes and System ClocksPresent day applications require that their microcontrollers have high performance but often still demand that they consume as little power as possible, conflicting requirements that are especially true in battery powered portable applications. The fast clocks required for high performance will by their nature increase current consumption and of course vice versa, lower speed clocks reduce current consumption. As Holtek has provided the device with both high and low speed clock sources and the means to switch between them dynamically, the user can optimise the operation of their microcontroller to achieve the best performance/power ratio.

System ClocksThe device has many different clock sources for both the CPU and peripheral function operation. By providing the user with a wide range of clock options using register programming, a clock system can be configured to obtain maximum application performance.

The main system clock, can come from a high frequency, fH, low frequency, fSUB, and is selected using the CKS2~CKS0 bits in the SCC register. The high speed system clock can be sourced from an HXT or HIRC oscillator, or fPLL output, selected via configuring the FHS and PLLOS bits in the SCC register. The low speed system clock source can be sourced from the LIRC oscillator. The fPLL output is drived from the high resolution PWM generator. The other choice, which is a divided version of the high speed system oscillator has a range of fH/2~fH/64.

Page 41: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 40 November 18, 2019 Rev. 1.10 41 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

High Speed Oscillators

FHS

PrescalerfH

fH/2

fH/4

fH/8

fH/16

fH/32

fH/64

CKS2~CKS0

fSYS

Low Speed Oscillator

fSUB

fSUB

fSUBfSYS/4

fSYS

CLKSEL0[1:0]

fTB0Prescaler 0 Time

Base 0

TB0[2:0]

WDTfLIRC

IDLE2SLEEP

IDLE0SLEEP

HXT

HIRC

HXTEN

HIRCEN

LIRC

PLLOS

fPLL

HIRCFHXTF

HOSCF

fHOSC

fSUB

fSYS/4

fSYS

CLKSEL1[1:0]

fTB1Prescaler 1 Time

Base 1

TB1[2:0]

Device Clock Configurations

Note: When the system clock source fSYS is switched to fSUB from fH, the high speed oscillator will stop to conserve the power or continue to oscillate to provide the clock source, fH ~ fH/64, for peripheral circuit to use, which is determined by configuring the corresponding high speed oscillator enable control bit.

Page 42: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 42 November 18, 2019 Rev. 1.10 43 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

System Operation ModesThere are six different modes of operation for the microcontroller, each one with its own special characteristics and which can be chosen according to the specific performance and power requirements of the application. There are two modes allowing normal operation of the microcontroller, the FAST Mode and SLOW Mode. The remaining four modes, the SLEEP, IDLE0, IDLE1 and IDLE2 Mode are used when the microcontroller CPU is switched off to conserve power.

Operation Mode CPU

Register SettingfSYS fH fSUB fLIRC

FHIDEN FSIDEN CKS2~CKS0FAST On x x 000~110 fH~fH/64 On On OnSLOW On x x 111 fSUB On/Off(1) On On

IDLE0 Off 0 1000~110 Off

Off On On111 On

IDLE1 Off 1 1 xxx On On On On

IDLE2 Off 1 0000~110 On

On Off On111 Off

SLEEP Off 0 0 xxx Off Off Off On (2)

“x”: Don’t careNote: 1. The fH clock will be switched on or off by configuring the corresponding oscillator enable

bit in the SLOW mode.

2. The fLIRC clock will be switched on since the WDT function is always enabled in the SLEEP mode.

FAST ModeThis is one of the main operating modes where the microcontroller has all of its functions operational and where the system clock is provided by one of the high speed oscillators. This mode operates allowing the microcontroller to operate normally with a clock source will come from one of the high speed oscillators, either the HXT or HIRC oscillators. The high speed oscillator will however first be divided by a ratio ranging from 1 to 64, the actual ratio being selected by the CKS2~CKS0 bits in the SCC register. Although a high speed oscillator is used, running the microcontroller at a divided clock ratio reduces the operating current.

SLOW ModeThis is also a mode where the microcontroller operates normally although now with a slower speed clock source. The clock source used will be from fSUB. The fSUB clock is derived from the LIRC oscillator.

SLEEP ModeThe SLEEP Mode is entered when an HALT instruction is executed and when the FHIDEN and FSIDEN bit are low. In the SLEEP mode the CPU will be stopped. The fSUB clock provided to the peripheral function will also be stopped, too. However the fLIRC clock can continues to operate since the WDT function is always enabled.

IDLE0 ModeThe IDLE0 Mode is entered when an HALT instruction is executed and when the FHIDEN bit in the SCC register is low and the FSIDEN bit in the SCC register is high. In the IDLE0 Mode the CPU will be switched off but the low speed oscillator will be turned on to drive some peripheral functions.

Page 43: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 42 November 18, 2019 Rev. 1.10 43 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

IDLE1 ModeThe IDLE1 Mode is entered when an HALT instruction is executed and when the FHIDEN bit in the SCC register is high and the FSIDEN bit in the SCC register is high. In the IDLE1 Mode the CPU will be switched off but both the high and low speed oscillators will be turned on to provide a clock source to keep some peripheral functions operational.

IDLE2 ModeThe IDLE2 Mode is entered when an HALT instruction is executed and when the FHIDEN bit in the SCC register is high and the FSIDEN bit in the SCC register is low. In the IDLE2 Mode the CPU will be switched off but the high speed oscillator will be turned on to provide a clock source to keep some peripheral functions operational.

Control RegistersThe registers, SCC, HIRCC and HXTC, are used to control the system clock and the corresponding oscillator configurations.

Register Name

Bit7 6 5 4 3 2 1 0

SCC CKS2 CKS1 CKS0 PLLOS FHS — FHIDEN FSIDENHIRCC — — — — — — HIRCF HIRCENHXTC — — — — — HXTM HXTF HXTEN

System Operating Mode Control Register List

• SCC Register

Bit 7 6 5 4 3 2 1 0Name CKS2 CKS1 CKS0 PLLOS FHS — FHIDEN FSIDENR/W R/W R/W R/W R/W R/W — R/W R/WPOR 0 0 0 0 0 — 0 0

Bit 7~5 CKS2~CKS0: System clock selection000: fH

001: fH/2010: fH/4011: fH/8100: fH/16101: fH/32110: fH/64111: fSUB

These three bits are used to select which clock is used as the system clock source. In addition to the system clock source directly derived from fH or fSUB, a divided version of the high speed system oscillator can also be chosen as the system clock source.

Bit 4 PLLOS: fH clock source selection0: HIRC or HXT1: fPLL output

When this bit is set to 1, the fPLL clock cannot directly be used as the system clock source. It means that the CKS bit field should not be set as “000”.

Bit 3 FHS: fHOSC clock source selection0: HIRC1: HXT

It is recommended that the FHS bit should not be modified if the PLLOS bit is set high.

Bit 2 Unimplemented, read as “0”

Page 44: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 44 November 18, 2019 Rev. 1.10 45 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 1 FHIDEN: High Frequency oscillator control when CPU is switched off0: Disable1: Enable

This bit is used to control whether the high speed oscillator is activated or stopped when the CPU is switched off by executing an “HALT” instruction.

Bit 0 FSIDEN: Low Frequency oscillator control when CPU is switched off0: Disable1: Enable

This bit is used to control whether the low speed oscillator is activated or stopped when the CPU is switched off by executing an “HALT” instruction.

• HIRCC Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — HIRCF HIRCENR/W — — — — — — R R/WPOR — — — — — — 0 1

Bit 7~2 Unimplemented, read as “0”Bit 1 HIRCF: HIRC oscillator stable flag

0: HIRC unstable1: HIRC stable

This bit is used to indicate whether the HIRC oscillator is stable or not. When the HIRCEN bit is set to 1 to enable the HIRC oscillator, the HIRCF bit will first be cleared to 0 and then set to 1 after the HIRC oscillator is stable.

Bit 0 HIRCEN: HIRC oscillator enable control0: Disable1: Enable

• HXTC Register

Bit 7 6 5 4 3 2 1 0Name — — — — — HXTM HXTF HXTENR/W — — — — — R/W R R/WPOR — — — — — 0 0 0

Bit 7~3 Unimplemented, read as “0”Bit 2 HXTM: HXT mode selection

0: HXT frequency ≤ 10MHz1: HXT frequency > 10MHz

This bit is used to select the HXT oscillator operating mode. Note that this bit must be properly configured before the HXT is enabled. When the OSC1 and OSC2 pins are enabled and the HXTEN bit is set to 1 to enable the HXT oscillator, it is invalid to change the value of this bit. Otherwise, this bit value can be changed with no operation on the HXT function.Note that when the HXTM bit is set high to select HXT > 10MHz, the low voltage characteristics may be declined; when the HXTM bit is cleared to zero to select HXT ≤ 10MHz, the oscillation frequency and current may be abnormal.

Bit 1 HXTF: HXT oscillator stable flag0: HXT unstable1: HXT stable

This bit is used to indicate whether the HXT oscillator is stable or not. When the HXTEN bit is set to 1 to enable the HXT oscillator, the HXTF bit will first be cleared to 0 and then set to 1 after the HXT oscillator is stable.

Bit 0 HXTEN: HXT oscillator enable control0: Disable1: Enable

Page 45: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 44 November 18, 2019 Rev. 1.10 45 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Operating Mode SwitchingThe device can switch between operating modes dynamically allowing the user to select the best performance/power ratio for the present task in hand. In this way microcontroller operations that do not require high performance can be executed using slower clocks thus requiring less operating current and prolonging battery life in portable applications.

In simple terms, Mode Switching between the FAST Mode and SLOW Mode is executed using the CKS2~CKS0 bits in the SCC register while Mode Switching from the FAST/SLOW Modes to the SLEEP/IDLE Modes is executed via the HALT instruction. When an HALT instruction is executed, whether the device enters the IDLE Mode or the SLEEP Mode is determined by the condition of the FHIDEN and FSIDEN bits in the SCC register.

FASTfSYS=fH~fH/64

fH onCPU runfSYS onfSUB on

SLOWfSYS=fSUBfSUB on

CPU runfSYS on

fH on/off

IDLE0HALT instruction executed

CPU stopFHIDEN=0FSIDEN=1

fH offfSUB on

IDLE1HALT instruction executed

CPU stopFHIDEN=1FSIDEN=1

fH onfSUB on

IDLE2HALT instruction executed

CPU stopFHIDEN=1FSIDEN=0

fH onfSUB off

SLEEPHALT instruction executed

CPU stopFHIDEN=0FSIDEN=0

fH offfSUB off

Page 46: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 46 November 18, 2019 Rev. 1.10 47 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

FAST Mode to SLOW Mode SwitchingWhen running in the FAST Mode, which uses the high speed system oscillator, and therefore consumes more power, the system clock can switch to run in the SLOW Mode by set the CKS2~CKS0 bits to “111” in the SCC register. This will then use the low speed system oscillator which will consume less power. Users may decide to do this for certain operations which do not require high performance and can subsequently reduce power consumption.

The SLOW Mode is sourced from the LIRC oscillator and therefore requires this oscillator to be stable before full mode switching occurs.

FAST Mode

SLOW Mode

CKS2~CKS0=111

SLEEP Mode

FHIDEN=0, FSIDEN=0HALT instruction is executed

IDLE0 Mode

FHIDEN=0, FSIDEN=1HALT instruction is executed

IDLE1 Mode

FHIDEN=1, FSIDEN=1HALT instruction is executed

IDLE2 Mode

FHIDEN=1, FSIDEN=0HALT instruction is executed

Page 47: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 46 November 18, 2019 Rev. 1.10 47 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

SLOW Mode to FAST Mode SwitchingIn SLOW mode the system clock is derived from fSUB. When system clock is switched back to the FAST mode from fSUB, the CKS2~CKS0 bits should be set to “000”~“110” and then the system clock will respectively be switched to fH~fH/64.

However, if fH is not used in SLOW mode and thus switched off, it will take some time to re-oscillate and stabilise when switching to the FAST mode from the SLOW Mode. This is monitored using the HXTF bit in the HXTC register or the HIRCF bit in the HIRCC register. The time duration required for the high speed system oscillator stabilization is specified in the System Start Up Time characteristics.

FAST Mode

SLOW Mode

CKS2~CKS0=000~110

SLEEP Mode

FHIDEN=0, FSIDEN=0HALT instruction is executed

IDLE0 Mode

FHIDEN=0, FSIDEN=1HALT instruction is executed

IDLE1 Mode

FHIDEN=1, FSIDEN=1HALT instruction is executed

IDLE2 Mode

FHIDEN=1, FSIDEN=0HALT instruction is executed

Page 48: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 48 November 18, 2019 Rev. 1.10 49 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Entering the SLEEP ModeThere is only one way for the device to enter the SLEEP Mode and that is to execute the “HALT” instruction in the application program with both the FHIDEN and FSIDEN bits in the SCC register equal to “0”. In this mode all the clocks and functions will be switched off except the WDT function. When this instruction is executed under the conditions described above, the following will occur:

• The system clock will be stopped and the application program will stop at the “HALT” instruction.

• The Data Memory contents and registers will maintain their present condition.

• The I/O ports will maintain their present conditions.

• In the status register, the Power Down flag, PDF, will be set and the Watchdog time-out flag, TO, will be cleared.

• The WDT will be cleared and resume counting as the WDT function is always enabled.

Entering the IDLE0 ModeThere is only one way for the device to enter the IDLE0 Mode and that is to execute the “HALT” instruction in the application program with the FHIDEN bit in the SCC register equal to “0” and the FSIDEN bit in the SCC register equal to “1”. When this instruction is executed under the conditions described above, the following will occur:

• The fH clock will be stopped and the application program will stop at the “HALT” instruction, but the fSUB clock will be on.

• The Data Memory contents and registers will maintain their present condition.

• The I/O ports will maintain their present conditions.

• In the status register, the Power Down flag, PDF, will be set and the Watchdog time-out flag, TO, will be cleared.

• The WDT will be cleared and resume counting as the WDT function is always enabled.

Entering the IDLE1 ModeThere is only one way for the device to enter the IDLE1 Mode and that is to execute the “HALT” instruction in the application program with both the FHIDEN and FSIDEN bits in the SCC register equal to “1”. When this instruction is executed under the conditions described above, the following will occur:

• The fH and fSUB clocks will be on but the application program will stop at the “HALT” instruction.

• The Data Memory contents and registers will maintain their present condition.

• The I/O ports will maintain their present conditions.

• In the status register, the Power Down flag, PDF, will be set and the Watchdog time-out flag, TO, will be cleared.

• The WDT will be cleared and resume counting as the WDT function is always enabled.

Page 49: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 48 November 18, 2019 Rev. 1.10 49 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Entering the IDLE2 ModeThere is only one way for the device to enter the IDLE2 Mode and that is to execute the “HALT” instruction in the application program with the FHIDEN bit in the SCC register equal to “1” and the FSIDEN bit in the SCC register equal to “0”. When this instruction is executed under the conditions described above, the following will occur:

• The fH clock will be on but the fSUB clock will be off and the application program will stop at the “HALT” instruction.

• The Data Memory contents and registers will maintain their present condition.

• The I/O ports will maintain their present conditions.

• In the status register, the Power Down flag, PDF, will be set and the Watchdog time-out flag, TO, will be cleared.

• The WDT will be cleared and resume counting as the WDT function is always enabled.

Standby Current ConsiderationsAs the main reason for entering the SLEEP or IDLE Mode is to keep the current consumption of the device to as low a value as possible, perhaps only in the order of several micro-amps except in the IDLE1 and IDLE2 Mode, there are other considerations which must also be taken into account by the circuit designer if the power consumption is to be minimised. Special attention must be made to the I/O pins on the device. All high-impedance input pins must be connected to either a fixed high or low level as any floating input pins could create internal oscillations and result in increased current consumption. This also applies to the device which has different package types, as there may be unbonded pins. These must either be setup as outputs or if setup as inputs must have pull-high resistors connected.

Care must also be taken with the loads, which are connected to I/O pins, which are setup as outputs. These should be placed in a condition in which minimum current is drawn or connected only to external circuits that do not draw current, such as other CMOS inputs. Also note that additional standby current will also be required if the LIRC oscillator has enabled.

In the IDLE1 and IDLE 2 Mode the high speed oscillator is on, if the peripheral function clock source is derived from the high speed oscillator, the additional standby current will also be perhaps in the order of several hundred micro-amps.

Wake-upTo minimise power consumption the device can enter the SLEEP or any IDLE Mode, where the CPU will be switched off. However, when the device is woken up again, it will take a considerable time for the original system oscillator to restart, stabilise and allow normal operation to resume.

After the system enters the SLEEP or IDLE Mode, it can be woken up from one of various sources listed as follows:

• An external falling edge on Port A

• A system interrupt

• A WDT overflow

When the device executes the “HALT” instruction, it will enter the SLEEP or IDLE mode and the PDF flag will be set high. The PDF flag will be cleared to 0 if the device experiences a system power-up or executes the clear Watchdog Timer instruction. If the system is woken up by a WDT overflow, a Watchdog Time-out hardware reset will be initiated and the TO flag will be set to 1. The TO flag is set if a WDT time-out occurs, and causes a wake-up that only resets the Program Counter and Stack Pointer, the other flags remain in their original status.

Page 50: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 50 November 18, 2019 Rev. 1.10 51 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Each pin on Port A can be setup using the PAWU register to permit a negative transition on the pin to wake-up the system. When a pin wake-up occurs, the program will resume execution at the instruction following the “HALT” instruction. If the system is woken up by an interrupt, then two possible situations may occur. The first is where the related interrupt is disabled or the interrupt is enabled but the stack is full, in which case the program will resume execution at the instruction following the “HALT” instruction. In this situation, the interrupt which woke-up these devices will not be immediately serviced, but will rather be serviced later when the related interrupt is finally enabled or when a stack level becomes free. The other situation is where the related interrupt is enabled and the stack is not full, in which case the regular interrupt response takes place. If an interrupt request flag is set high before entering the SLEEP or IDLE Mode, the wake-up function of the related interrupt will be disabled.

Watchdog TimerThe Watchdog Timer is provided to prevent program malfunctions or sequences from jumping to unknown locations, due to certain uncontrollable external events such as electrical noise.

Watchdog Timer Clock SourceThe Watchdog Timer clock source is provided by the internal clock, fLIRC which is sourced from the LIRC oscillator. The LIRC internal oscillator has an approximate frequency of 32kHz and this specified internal clock period can vary with VDD, temperature and process variations. The Watchdog Timer source clock is then subdivided by a ratio of 28 to 218 to give longer timeouts, the actual value being chosen using the WS2~WS0 bits in the WDTC register.

Watchdog Timer Control RegisterA single register, WDTC, controls the required timeout period as well as the enable and reset MCU operation.

• WDTC Register

Bit 7 6 5 4 3 2 1 0Name WE4 WE3 WE2 WE1 WE0 WS2 WS1 WS0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 1 0 1 0 0 1 1

Bit 7~3 WE4~WE0: WDT function software control01010/10101: EnableOthers: Reset MCU

When these bits are changed by the environmental noise or software setting to reset the microcontroller, the reset operation will be activated after tSRESET time and the WRF bit in the RSTFC register will be set high.

Bit 2~0 WS2~WS0: WDT time-out period selection000: 28/fLIRC

001: 210/fLIRC

010: 212/fLIRC

011: 214/fLIRC

100: 215/fLIRC

101: 216/fLIRC

110: 217/fLIRC

111: 218/fLIRC

These three bits determine the division ratio of the watchdog timer source clock, which in turn determines the time-out period.

Page 51: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 50 November 18, 2019 Rev. 1.10 51 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• RSTFC Register

Bit 7 6 5 4 3 2 1 0Name — — — — — LVRF LRF WRFR/W — — — — — R/W R/W R/WPOR — — — — — x 0 0

“x”: unknown

Bit 7~3 Unimplemented, read as “0”Bit 2 LVRF: LVR function reset flag

Described elsewhere.Bit 1 LRF: LVR control register software reset flag

Described elsewhere.Bit 0 WRF: WDT control register software reset flag

0: Not occurred1: Occurred

This bit is set to 1 by the WDT Control register software reset and cleared to zero by the application program. Note that this bit can only be cleared to 0 by the application program.

Watchdog Timer OperationThe Watchdog Timer operates by providing a device reset when its timer overflows. This means that in the application program and during normal operation the user has to strategically clear the Watchdog Timer before it overflows to prevent the Watchdog Timer from executing a reset. This is done using the clear watchdog instruction. If the program malfunctions for whatever reason, jumps to an unknown location, or enters an endless loop, the clear instruction will not be executed in the correct manner, in which case the Watchdog Timer will overflow and reset these devices. There are five bits, WE4~WE0, in the WDTC register to offer the enable control and reset control of the Watchdog Timer. The WDT function will be enabled if the WE4~WE0 bits are equal to 01010B or 10101B. If the WE4~WE0 bits are set to any other values, other than 01010B and 10101B, it will reset these devices after tSRESET time. After power on these bits will have a value of 01010B.

WE4~WE0 Bits WDT Function01010B or 10101B EnableAny other values Reset MCU

Watchdog Timer Enable/Reset Control

Under normal program operation, a Watchdog Timer time-out will initialise a device reset and set the status bit TO. However, if the system is in the SLEEP or IDLE Mode, when a Watchdog Timer time-out occurs, the TO bit in the status register will be set and only the Program Counter and Stack Pointer will be reset. Three methods can be adopted to clear the contents of the Watchdog Timer. The first is a WDT software reset, which means a certain value except 01010B and 10101B written into the WE4~WE0 bits, the second is using the Watchdog Timer software clear instruction and the third is via a HALT instruction.

There is only one method of using software instruction to clear the Watchdog Timer. That is to use the single “CLR WDT” instruction to clear the WDT.

The maximum time out period is when the 218 division ratio is selected. As an example, with a 32kHz LIRC oscillator as its source clock, this will give a maximum watchdog period of around 8 seconds for the 218 division ratio, and a minimum timeout of 8ms for the 28 division ration.

Page 52: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 52 November 18, 2019 Rev. 1.10 53 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

“CLR WDT” Instruction

WE4~WE0 bitsWDTC Register Reset MCU

fLIRC

CLR

“HALT” Instruction

LIRC 8-stage Divider WDT PrescalerfLIRC/28

8-to-1 MUXWS2~WS0 WDT Time-out(28/fLIRC ~ 218/fLIRC)

Watchdog Timer

Reset and InitialisationA reset function is a fundamental part of any microcontroller ensuring that the device can be set to some predetermined condition irrespective of outside parameters. The most important reset condition is after power is first applied to the microcontroller. In this case, internal circuitry will ensure that the microcontroller, after a short delay, will be in a well-defined state and ready to execute the first program instruction. After this power-on reset, certain important internal registers will be set to defined states before the program commences. One of these registers is the Program Counter, which will be reset to zero forcing the microcontroller to begin program execution from the lowest Program Memory address.

In addition to the power-on reset, another reset exists in the form of a Low Voltage Reset, LVR, where a full reset is implemented in situations where the power supply voltage falls below a certain threshold. Another type of reset is when the Watchdog Timer overflows and resets the microcontroller. All types of reset operations result in different register conditions being setup.

Reset FunctionsThere are several ways in which a microcontroller reset can occur, through events occurring internally:

Power-on ResetThe most fundamental and unavoidable reset is the one that occurs after power is first applied to the microcontroller. As well as ensuring that the Program Memory begins execution from the first memory address, a power-on reset also ensures that certain other registers are preset to known conditions. All the I/O port and port control registers will power up in a high condition ensuring that all pins will be first set to inputs.

VDD

Power-on Reset

SST Time-out

tRSTD

Power-on Reset Timing Chart

Low Voltage Reset – LVRThe microcontroller contains a low voltage reset circuit in order to monitor the supply voltage of the device and provides an MCU reset should the value fall below a certain predefined level.

Page 53: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 52 November 18, 2019 Rev. 1.10 53 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

The LVR function is always enabled in the Fast or Slow mode with a specific LVR voltage VLVR. If the supply voltage of the device drops to within a range of 0.9V~VLVR such as might occur when changing the battery in battery powered applications, the LVR will automatically reset the device internally and the LVRF bit in the RSTFC register will also be set to 1. For a valid LVR signal, a low supply voltage, i.e., a voltage in the range between 0.9V~VLVR must exist for a time greater than that specified by tLVR in the LVR/LVD characteristics. If the low supply voltage state does not exceed this value, the LVR will ignore the low supply voltage and will not perform a reset function. The actual VLVR value can be selected by the LVS bits in the LVRC register. If the LVS7~LVS0 bits are changed to some different values by environmental noise, the LVR will reset the device after a delay time, tSRESET. When this happens, the LRF bit in the RSTFC register will be set to 1. After power on the register will have the value of 01010101B. Note that the LVR function will be automatically disabled when the device enters the SLEEP/IDLE mode.

LVR

Internal Reset

tRSTD + tSST

Low Voltage Reset Timing Chart

• LVRC Register

Bit 7 6 5 4 3 2 1 0Name LVS7 LVS6 LVS5 LVS4 LVS3 LVS2 LVS1 LVS0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 1 0 1 0 1 0 1

Bit 7~0 LVS7~LVS0: LVR Voltage Select control01010101: 2.10V00110011: 2.55V10011001: 3.15V10101010: 3.80VAny other value: Generates MCU reset – register is reset to POR valueWhen an actual low voltage condition occurs, as specified by one of the four defined LVR voltage values above, an MCU reset will be generated. The reset operation will be activated the low voltage condition keeps more than a tLVR time. In this situation the register contents will remain the same after such a reset occurs.Any register value, other than the four defined LVR values above, will also result in the generation of an MCU reset. The reset operation will be activated after a delay time, tSRESET. However in this situation the register contents will be reset to the POR value.

• RSTFC Register

Bit 7 6 5 4 3 2 1 0Name — — — — — LVRF LRF WRFR/W — — — — — R/W R/W R/WPOR — — — — — x 0 0

“x”: unknown

Bit 7~3 Unimplemented, read as “0”Bit 2 LVRF: LVR function reset flag

0: Not occur1: Occurred

This bit is set to 1 when a specific Low Voltage Reset situation condition occurs. This bit can only be cleared to 0 by the application program.

Page 54: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 54 November 18, 2019 Rev. 1.10 55 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 1 LRF: LVR control register software reset flag0: Not occur1: Occurred

This bit is set to 1 if the LVRC register contains any non-defined LVR voltage register values. This in effect acts like a software-reset function. This bit can only be cleared to 0 by the application program.

Bit 0 WRF: WDT control register software reset flagDescribed elsewhere.

Watchdog Time-out Reset during Normal OperationThe Watchdog time-out Reset during normal operation, the Watchdog time-out flag TO will be set to “1”.

WDT Time-out

Internal Reset

tRSTD + tSST

WDT Time-out Reset during Normal Operation Timing Chart

Watchdog Time-out Reset during SLEEP or IDLE ModeThe Watchdog time-out Reset during SLEEP or IDLE Mode is a little different from other kinds of reset. Most of the conditions remain unchanged except that the Program Counter and the Stack Pointer will be cleared to “0” and the TO flag will be set to “1”. Refer to the System Start Up Time Characteristics for tSST details.

WDT Time-out

Internal ResettSST

WDT Time-out Reset during SLEEP or IDLE Timing Chart

Reset Initial ConditionsThe different types of reset described affect the reset flags in different ways. These flags, known as PDF and TO are located in the status register and are controlled by various microcontroller operations, such as the SLEEP or IDLE Mode function or Watchdog Timer. The reset flags are shown in the table:

TO PDF RESET Conditions0 0 Power-on resetu u LVR reset during FAST or SLOW Mode operation1 u WDT time-out reset during FAST or SLOW Mode operation1 1 WDT time-out reset during IDLE or SLEEP Mode operation

“u” stands for unchanged

The following table indicates the way in which the various components of the microcontroller are affected after a power-on reset occurs.

Item Condition after RESETProgram Counter Reset to zeroInterrupts All interrupts will be disabledWDT, Time Bases Clear after reset, WDT begins countingTimer Modules Timer Modules will be turned offInput/Output Ports I/O ports will be setup as inputsStack Pointer Stack Pointer will point to the top of the stack

Page 55: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 54 November 18, 2019 Rev. 1.10 55 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

The different kinds of resets all affect the internal registers of the microcontroller in different ways. To ensure reliable continuation of normal program execution after a reset occurs, it is important to know what condition the microcontroller is in after a particular reset occurs. The following table describes how each type of reset affects each of the microcontroller internal registers.

Register Power On Reset

LVR Reset (Normal Operation)

WDT Time-out (Normal Operation)

WDT Time-out (IDLE/SLEEP)

IAR0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMP0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uIAR1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMP1L 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMP1H 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uACC x x x x x x x x u u u u u u u u u u u u u u u u u u u u u u u uPCL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0TBLP x x x x x x x x u u u u u u u u u u u u u u u u u u u u u u u uTBLH x x x x x x x x u u u u u u u u u u u u u u u u u u u u u u u uTBHP - - - x x x x x - - - u u u u u - - - u u u u u - - - u u u u uSTATUS x x 0 0 x x x x x x u u u u u u x x 1 u u u u u u u 11 u u u uIAR2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMP2L 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMP2H 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uRSTFC - - - - - x 0 0 - - - - - 1 u u - - - - - u u u - - - - - u u uPB 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u uPBC 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u uPBPU 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uWDTC 0 1 0 1 0 0 11 0 1 0 1 0 0 11 0 1 0 1 0 0 11 u u u u u u u uPA 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u uPAC 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u uPAPU 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPAWU 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uLVDC - - 0 0 - 0 0 0 - - 0 0 - 0 0 0 - - 0 0 - 0 0 0 - - u u - u u uLVRC 0 1 0 1 0 1 0 1 u u u u u u u u 0 1 0 1 0 1 0 1 u u u u u u u uPD - - - - - 1 1 1 - - - - - 1 1 1 - - - - - 1 1 1 - - - - - u u uPDC - - - - - 1 1 1 - - - - - 1 1 1 - - - - - 1 1 1 - - - - - u u uPDPU - - - - - 0 0 0 - - - - - 0 0 0 - - - - - 0 0 0 - - - - - u u uTBC0 0 - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - 0 0 0 u - - - - u u uTBC1 0 - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - 0 0 0 u - - - - u u uPSCR - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - u u u uVBGRC - - - - - - - 0 - - - - - - - 0 - - - - - - - 0 - - - - - - - uSADC0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uSADC1 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 u u u u - u u uSADC2 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 u - - u u u u u

SADOL x x x x - - - - x x x x - - - - x x x x - - - -

u u u u - - - - (ADRFS=0)

u u u u u u u u(ADRFS=1)

SADOH x x x x x x x x x x x x x x x x x x x x x x x x

u u u u u u u u(ADRFS=0)

- - - - u u u u(ADRFS=1)

CTMC0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u u

Page 56: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 56 November 18, 2019 Rev. 1.10 57 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Register Power On Reset

LVR Reset (Normal Operation)

WDT Time-out (Normal Operation)

WDT Time-out (IDLE/SLEEP)

CTMC1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uCTMDL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uCTMDH - - - - - - 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - u uCTMAL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uCTMAH - - - - - - 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - u uSCC 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 u u u u u - u uHXTC - - - - - 0 0 0 - - - - - 0 0 0 - - - - - 0 0 0 - - - - - u u uHIRCC - - - - - - 0 1 - - - - - - 0 1 - - - - - - 0 1 - - - - - u u uPC 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u uPCC 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 u u u u u u u uPCPU 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uINTC0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - u u u u u u uINTC1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uINTC2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uINTC3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMFI0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - u u - - u uINTEG - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - u u u uPDS0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - u u u u u uIICC0 - - - - 0 0 0 - - - - - 0 0 0 - - - - - 0 0 0 - - - - - u u u -IICC1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 u u u u u u u uIICD x x x x x x x x x x x x x x x x x x x x x x x x u u u u u u u uIICA 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - u u u u u u u -I2CTOC 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPAS0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPAS1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uEEC - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - 0 0 0 0 - - - - u u u uEEA - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - u u u u u uEED 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uSTMC0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uSTMC1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uSTMDL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uSTMDH - - - - - - 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - u uSTMAL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uSTMAH - - - - - - 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - u uPTMC0 0 0 0 0 0 - - - 0 0 0 0 0 - - - 0 0 0 0 0 - - - u u u u u - - -PTMC1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPTMDL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPTMDH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPTMAL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPTMAH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPTMRPL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPTMRPH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMFI1 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - u u - - u uMFI2 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - u u - - u uMFI3 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - u u - - u uMFI4 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - u u - - u uMFI5 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - 0 0 - - u u - - u u

Page 57: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 56 November 18, 2019 Rev. 1.10 57 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Register Power On Reset

LVR Reset (Normal Operation)

WDT Time-out (Normal Operation)

WDT Time-out (IDLE/SLEEP)

PBS0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPBS1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPCS0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWR0 x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWR1 x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWR2 x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWR3 x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWR4 x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWR5 x x x x x x x x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uMDUWCTRL 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - u u - - - - - -DCMISC 0 0 x 0 x 0 0 - 0 0 x 0 x 0 0 - 0 0 x 0 x 0 0 - u u u u u u u -DEM0C0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - u u u uDEM0C1 x - 0 0 0 0 0 0 x - 0 0 0 0 0 0 x - 0 0 0 0 0 0 u - u u u u u uDEM0REF 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uDEM0ACAL 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 u u u u u u u uDEM0CCAL 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 u u u u u u u uOCPC0 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - -OCPC1 x - 0 0 0 0 0 0 x - 0 0 0 0 0 0 x - 0 0 0 0 0 0 u - u u u u u uOCPREF 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uOCPACAL 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 u u u u u u u uOCPCCAL 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 u u u u u u u uDEM1C0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - u u u uDEM1C1 x - 0 0 0 0 0 0 x - 0 0 0 0 0 0 x - 0 0 0 0 0 0 u - u u u u u uDEM1REF 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uDEM1ACAL 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 u u u u u u u uDEM1CCAL 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 u u u u u u u uPLLFL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPLLFH - - - - - 0 0 0 - - - - - 0 0 0 - - - - - 0 0 0 - - - - - u u uCKGEN 0 0 0 0 - - - 0 0 0 0 0 - - - 0 0 0 0 0 - - - 0 u u u u - - - uPWMC0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPWMC1 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 0 0 0 0 - - 0 0 u u u u - - u uPWMC2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uDTC - - - 0 0 0 0 0 - - - 0 0 0 0 0 - - - 0 0 0 0 0 - - - u u u u uDUTYCL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uDUTYCH - - - - - 0 0 0 - - - - - 0 0 0 - - - - - 0 0 0 - - - - - u u uPHSCL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPHSCH - - - - - - 0 0 - - - - - - 0 0 - - - - - - 0 0 - - - - - - u uFSKDAC0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 - 0 0 0 0 u u u - u u u uFSKDAC1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uFSKDASW0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uFSKDASW1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u uPCS1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u u u u u u u u

Note: “u” stands for unchanged“x” stands for unknown“-” stands for unimplemented

Page 58: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 58 November 18, 2019 Rev. 1.10 59 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Input/Output PortsHoltek microcontrollers offer considerable flexibility on their I/O ports. With the input or output designation of every pin fully under user program control, pull-high selections for all ports and wake-up selections on certain pins, the user is provided with an I/O structure to meet the needs of a wide range of application possibilities.

The device provides bidirectional input/output lines labeled with port names PA~PD. These I/O ports are mapped to the RAM Data Memory with specific addresses as shown in the Special Purpose Data Memory table. All of these I/O ports can be used for input and output operations. For input operation, these ports are non-latching, which means the inputs must be ready at the T2 rising edge of instruction “MOV A, [m]”, where m denotes the port address. For output operation, all the data is latched and remains unchanged until the output latch is rewritten.

Register Name

Bit7 6 5 4 3 2 1 0

PA PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0PAC PAC7 PAC6 PAC5 PAC4 PAC3 PAC2 PAC1 PAC0PAPU PAPU7 PAPU6 PAPU5 PAPU4 PAPU3 PAPU2 PAPU1 PAPU0PAWU PAWU7 PAWU6 PAWU5 PAWU4 PAWU3 PAWU2 PAWU1 PAWU0PB PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0PBC PBC7 PBC6 PBC5 PBC4 PBC3 PBC2 PBC1 PBC0PBPU PBPU7 PBPU6 PBPU5 PBPU4 PBPU3 PBPU2 PBPU1 PBPU0PC PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0PCC PCC7 PCC6 PCC5 PCC4 PCC3 PCC2 PCC1 PCC0PCPU PCPU7 PCPU6 PCPU5 PCPU4 PCPU3 PCPU2 PCPU1 PCPU0PD — — — — — PD2 PD1 PD0PDC — — — — — PDC2 PDC1 PDC0PDPU — — — — — PDPU2 PDPU1 PDPU0

“—”: Unimplemented, read as “0”.I/O Logic Function Register List

Pull-high ResistorsMany product applications require pull-high resistors for their switch inputs usually requiring the use of an external resistor. To eliminate the need for these external resistors, all I/O pins, when configured as a digital input have the capability of being connected to an internal pull-high resistor. These pull-high resistors are selected using registers, namely PAPU~PDPU, and are implemented using weak PMOS transistors. Note that the pull-high resistor can be controlled by the relevant pull-high control register only when the pin-shared functional pin is selected as a digital input or NMOS output. Otherwise, the pull-high resistors cannot be enabled.

• PxPU Register

Bit 7 6 5 4 3 2 1 0Name PxPU7 PxPU6 PxPU5 PxPU4 PxPU3 PxPU2 PxPU1 PxPU0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

PxPUn: I/O Port x Pin pull-high function control0: Disable1: Enable

The PxPUn bit is used to control the pin pull-high function. Here the “x” can be A, B, C and D. However, the actual available bits for each I/O Port may be different.

Page 59: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 58 November 18, 2019 Rev. 1.10 59 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

I/O Port Wake-upThe HALT instruction forces the microcontroller into the SLEEP or IDLE Mode which preserves power, a feature that is important for battery and other low-power applications. Various methods exist to wake-up the microcontroller, one of which is to change the logic condition on one of the Port A pins from high to low. This function is especially suitable for applications that can be woken up via external switches. Each pin on Port A can be selected individually to have this wake-up feature using the PAWU register.

Note that the wake-up function can be controlled by the wake-up control registers only when the pin is selected as a general purpose input and the MCU enters the Power down mode.

• PAWU Register

Bit 7 6 5 4 3 2 1 0Name PAWU7 PAWU6 PAWU5 PAWU4 PAWU3 PAWU2 PAWU1 PAWU0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 PAWU7~PAWU0: PA7~PA0 wake-up function control0: Disable1: Enable

I/O Port Control RegistersEach I/O port has its own control register known as PAC~PDC, to control the input/output configuration. With this control register, each CMOS output or input can be reconfigured dynamically under software control. Each pin of the I/O ports is directly mapped to a bit in its associated port control register. For the I/O pin to function as an input, the corresponding bit of the control register must be written as a “1”. This will then allow the logic state of the input pin to be directly read by instructions. When the corresponding bit of the control register is written as a “0”, the I/O pin will be setup as a CMOS output. If the pin is currently setup as an output, instructions can still be used to read the output register. However, it should be noted that the program will in fact only read the status of the output data latch and not the actual logic status of the output pin.

• PxC Register

Bit 7 6 5 4 3 2 1 0Name PxC7 PxC6 PxC5 PxC4 PxC3 PxC2 PxC1 PxC0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 1 1 1 1 1 1 1 1

PxCn: I/O Port x Pin type selection0: Output1: Input

The PxCn bit is used to control the pin type selection. Here the “x” can be A, B, C or D. However, the actual available bits for each I/O Port may be different.

Pin-shared FunctionsThe flexibility of the microcontroller range is greatly enhanced by the use of pins that have more than one function. Limited numbers of pins can force serious design constraints on designers but by supplying pins with multi-functions, many of these difficulties can be overcome. For these pins, the desired function of the multi-function I/O pins is selected by a series of registers via the application program control.

Page 60: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 60 November 18, 2019 Rev. 1.10 61 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Pin-shared Function Selection RegistersThe limited number of supplied pins in a package can impose restrictions on the amount of functions a certain device can contain. However by allowing the same pins to share several different functions and providing a means of function selection, a wide range of different functions can be incorporated into even relatively small package sizes. The device includes Port “x” Output Function Selection register “n”, labeled as PxSn, which can select the desired functions of the multi-function pin-shared pins.

The most important point to note is to make sure that the desired pin-shared function is properly selected and also deselected. For most pin-shared functions, to select the desired pin-shared function, the pin-shared function should first be correctly selected using the corresponding pin-shared control register. After that the corresponding peripheral functional setting should be configured and then the peripheral function can be enabled. However, a special point must be noted for some digital input pins, such as INTn, xTCK, xTPI, etc, which share the same pin-shared control configuration with their corresponding general purpose I/O functions when setting the relevant pin-shared control bit fields. To select these pin functions, in addition to the necessary pin-shared control and peripheral functional setup aforementioned, they must also be setup as an input by setting the corresponding bit in the I/O port control register. To correctly deselect the pin-shared function, the peripheral function should first be disabled and then the corresponding pin-shared function control register can be modified to select other pin-shared functions.

Register Name

Bit7 6 5 4 3 2 1 0

PAS0 PAS07 PAS06 PAS05 PAS04 PAS03 PAS02 PAS01 PAS00PAS1 PAS17 PAS16 PAS15 PAS14 PAS13 PAS12 PAS11 PAS10PBS0 PBS07 PBS06 PBS05 PBS04 PBS03 PBS02 PBS01 PBS00PBS1 PBS17 PBS16 PBS15 PBS14 PBS13 PBS12 PBS11 PBS10PCS0 PCS07 PCS06 PCS05 PCS04 PCS03 PCS02 PCS01 PCS00PCS1 PCS17 PCS16 PCS15 PCS14 PCS13 PCS12 PCS11 PCS10PDS0 — — PDS05 PDS04 PDS03 PDS02 PDS01 PDS00

Pin-shared Function Selection Register List

• PAS0 Register

Bit 7 6 5 4 3 2 1 0Name PAS07 PAS06 PAS05 PAS04 PAS03 PAS02 PAS01 PAS00R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PAS07~PAS06: PA3 Pin-Shared function selection00/01: PA310: CTPB11: AN3

Bit 5~4 PAS05~PAS04: PA2 Pin-Shared function selection00/01/10: PA2/CTCK11: AN2

Bit 3~2 PAS03~PAS02: PA1 Pin-Shared function selection00/01: PA1/STPI10: CTP11: AN1

Bit 1~0 PAS01~PAS00: PA0 Pin-Shared function selection00/01: PA010: STPB11: AN0

Page 61: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 60 November 18, 2019 Rev. 1.10 61 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PAS1 Register

Bit 7 6 5 4 3 2 1 0Name PAS17 PAS16 PAS15 PAS14 PAS13 PAS12 PAS11 PAS10R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PAS17~PAS16: PA7 Pin-Shared function selection00/10/11: PA701: PWM3

Bit 5~4 PAS15~PAS14: PA6 Pin-Shared function selection00/10/11: PA601: PWM2

Bit 3~2 PAS13~PAS12: PA5 Pin-Shared function selection00/10/11: PA510: PWM1

Bit 1~0 PAS11~PAS10: PA4 Pin-Shared function selection00/10/11: PA401: PWM0

• PBS0 Register

Bit 7 6 5 4 3 2 1 0Name PBS07 PBS06 PBS05 PBS04 PBS03 PBS02 PBS01 PBS00R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PBS07~PBS06: PB3 Pin-Shared function selection00/01/11: PB310: DEMO0AX

Bit 5~4 PBS05~PBS04: PB2 Pin-Shared function selection00/01/11: PB210: DEMO0AN

Bit 3~2 PBS03~PBS02: PB1 Pin-Shared function selection00/01/11: PB110: DEMO0AP

Bit 1~0 PBS01~PBS00: PB0 Pin-Shared function selection00/01/11: PB010: OCP

Page 62: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 62 November 18, 2019 Rev. 1.10 63 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PBS1 Register

Bit 7 6 5 4 3 2 1 0Name PBS17 PBS16 PBS15 PBS14 PBS13 PBS12 PBS11 PBS10R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PBS17~PBS16: PB7 Pin-Shared function selection00/01/11: PB710: DEMO1AP

Bit 5~4 PBS15~PBS14: PB6 Pin-Shared function selection00/01/11: PB610: DEMO0CX

Bit 3~2 PBS13~PBS12: PB5 Pin-Shared function selection00/01/11: PB510: DEMO0CN

Bit 1~0 PBS11~PBS10: PB4 Pin-Shared function selection00/01/11: PB410: DEMO0CP

• PCS0 Register

Bit 7 6 5 4 3 2 1 0Name PCS07 PCS06 PCS05 PCS04 PCS03 PCS02 PCS01 PCS00R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PCS07~PCS06: PC3 Pin-Shared function selection00/01/11: PC310: DEMO1CN

Bit 5~4 PCS05~PCS04: PC2 Pin-Shared function selection00/01/11: PC210: DEMO1CP

Bit 3~2 PCS03~PCS02: PC1 Pin-Shared function selection00/01/11: PC110: DEMO1AX

Bit 1~0 PCS01~PCS00: PC0 Pin-Shared function selection00/01/11: PC010: DEMO1AN

Page 63: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 62 November 18, 2019 Rev. 1.10 63 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PCS1 Register

Bit 7 6 5 4 3 2 1 0Name PCS17 PCS16 PCS15 PCS14 PCS13 PCS12 PCS11 PCS10R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PCS17~PCS16: PC7 Pin-Shared function selection00/11: PC7/INT001: SDA10: DEMO1

Bit 5~4 PCS15~PCS14: PC6 Pin-Shared function selection00: PC601: STP10: VREF11: AN4

Bit 3~2 PCS13~PCS12: PC5 Pin-Shared function selection00: PC5/STCK01: DEMO010: VREFI11: AN5

Bit 1~0 PCS11~PCS10: PC4 Pin-Shared function selection00/01/11: PC410: DEMO1CX

• PDS0 Register

Bit 7 6 5 4 3 2 1 0Name — — PDS05 PDS04 PDS03 PDS02 PDS01 PDS00R/W — — R/W R/W R/W R/W R/W R/WPOR — — 0 0 0 0 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5~4 PDS05~PDS04: PD2 Pin-Shared function selection

00/01/11: PD2/PTCK01: OSC1

Bit 3~2 PDS03~PDS02: PD1 Pin-Shared function selection00/11: PD101: OSC210: PTP

Bit 1~0 PDS01~PDS00: PD0 Pin-Shared function selection00: PD0/ INT1/PTPI01: PTPB10: SCL11: FSKD: FSK digital out(0=Fop, 1=Fmod)

Page 64: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 64 November 18, 2019 Rev. 1.10 65 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

I/O Pin StructuresThe accompanying diagram illustrates the internal structure of the I/O logic function. As the exact logical construction of the I/O pin will differ from this drawing, it is supplied as a guide only to assist with the functional understanding of the logic function I/O pins. The wide range of pin-shared structures does not permit all types to be shown.

MUX

VDD

Control Bit

Data Bit

Data Bus

Write Control Register

Chip Reset

Read Control Register

Read Data Register

Write Data Register

System Wake-up wake-up Select

I/O pin

Weak Pull-up

Pull-highRegister Select

Q

D

CK

Q

D

CK

Q

Q

S

S

PA only

Logic Function Input/Output Structure

Programming ConsiderationsWithin the user program, one of the first things to consider is port initialisation. After a reset, all of the I/O data and port control registers will be set high. This means that all I/O pins will default to an input state, the level of which depends on the other connected circuitry and whether pull-high selections have been chosen. If the port control registers are then programmed to setup some pins as outputs, these output pins will have an initial high output value unless the associated port data registers are first programmed. Selecting which pins are inputs and which are outputs can be achieved byte-wide by loading the correct values into the appropriate port control register or by programming individual bits in the port control register using the “SET [m].i” and “CLR [m].i” instructions. Note that when using these bit control instructions, a read-modify-write operation takes place. The microcontroller must first read in the data on the entire port, modify it to the required new bit values and then rewrite this data back to the output ports.

PA Port has the additional capability of providing wake-up function. When the device is in the SLEEP or IDLE Mode, various methods are available to wake the device up. One of these is a high to low transition of any of the Port A pins. Single or multiple pins on Ports can be setup to have this function.

Page 65: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 64 November 18, 2019 Rev. 1.10 65 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Timer Modules – TMOne of the most fundamental functions in any microcontroller device is the ability to control and measure time. To implement time related functions each device includes several Timer Modules, abbreviated to the name TM. The TMs are multi-purpose timing units and serve to provide operations such as Timer/Counter, Input Capture, Compare Match Output and Single Pulse Output as well as being the functional unit for the generation of PWM signals. Each of the TMs has two individual interrupts. The addition of input and output pins for each TM ensures that users are provided with timing units with a wide and flexible range of features.

The common features of the different TM types are described here with more detailed information provided in the individual Compact, Standard and Periodic TM sections.

IntroductionThe device contains Three TMs and each individual TM can be categorised as a certain type, namely Compact Type TM, Standard Type TM or Periodic Type TM. Although similar in nature, the different TM types vary in their feature complexity. The common features to all of the Compact, Standard and Periodic TMs will be described in this section. The detailed operation regarding each of the TM types will be described in separate sections. The main features and differences between the two types of TMs are summarised in the accompanying table.

Function CTM STM PTMTimer/Counter √ √ √Input Capture — √ √Compare Match Output √ √ √PWM Output √ √ √Single Pulse Output — √ √PWM Alignment Edge Edge EdgePWM Adjustment Period & Duty Duty or Period Duty or Period Duty or Period

TM Function Summary

CTM STM PTM10-bit CTM 10-bit STM 16-bit PTM

TM Type Reference

TM OperationThe different types of TM offer a diverse range of functions, from simple timing operations to PWM signal generation. The key to understanding how the TM operates is to see it in terms of a free running counter whose value is then compared with the value of pre-programmed internal comparators. When the free running counter has the same value as the pre-programmed comparator, known as a compare match situation, a TM interrupt signal will be generated which can clear the counter and perhaps also change the condition of the TM output pin. The internal TM counter is driven by a user selectable clock source, which can be an internal clock or an external pin.

TM Clock SourceThe clock source which drives the main counter in each TM can originate from various sources. The selection of the required clock source is implemented using the xTCK2~xTCK0 bits in the xTM control registers, where “x” stands for C, S or P type TM. The clock source can be a ratio of the system clock fSYS or the internal high clock fH, the fSUB clock source or the external xTCK pin. The xTCK pin clock source is used to allow an external signal to drive the TM as an external clock source or for event counting.

Page 66: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 66 November 18, 2019 Rev. 1.10 67 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

TM InterruptsThe Compact, Standard and Periodic type TMs each have two internal interrupts, one for each of the internal comparator A or comparator P, which generate a TM interrupt when a compare match condition occurs. When a TM interrupt is generated it can be used to clear the counter and also to change the state of the TM output pin.

TM External PinsEach of the TMs, irrespective of what type, has two TM input pins, with the label xTCK and xTPI respectively. The xTM input pin, xTCK, is essentially a clock source for the xTM and is selected using the xTCK2~xTCK0 bits in the xTMC0 register. This external TM input pin allows an external clock source to drive the internal TM. The xTCK input pin can be chosen to have either a rising or falling active edge. The STCK and PTCK pins are also used as the external trigger input pin in single pulse output mode.

For STM and PTM, the xTPI pin acts as an input whose active edge can be a rising edge, a falling edge or both rising and falling edges and the active edge transition type is selected using the xTIO1~xTIO0 bits in the xTMC1 register when the TM is setup to operate in the Capture Input Mode. There is another capture input, PTCK, for PTM capture input mode, which can be used as the external trigger input source except the PTPI pin.

The TMs each have two output pin with the label xTP and xTPB. The xTPnB pin outputs the inverted signal of the xTPn. When the TM is in the Compare Match Output Mode, these pins can be controlled by the TM to switch to a high or low level or to toggle when a compare match situation occurs. The external xTP and xTPB output pins are also the pin where the TM generates the PWM output waveform.

As the TM input and output pins are pin-shared with other functions, the TM input and output functions must first be setup using the relevant pin-shared function selection bits described in the Pin-shared Function section. The details of the pin-shared function selection are described in the pin-shared function section.

CTM STM PTMInput Output Input Output Input Output

CTCK CTP, CTPB

STCK, STPI

STP, STPB

PTPI, PTCK

PTP, PTPB

TM External Pins

CTM

CTCK

CTPCCR output

CTPB

Clock input

CTM Function Pin Block Diagram

Page 67: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 66 November 18, 2019 Rev. 1.10 67 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

STM

STCK

STP

STPICCR capture input

CCR output

STPB

Clock input

STM Function Pin Block Diagram

PTM

PTCK

PTP

PTPICCR capture input

CCR output

PTPB

Clock/capture input

PTM Function Pin Block Diagram

Programming ConsiderationsThe TM Counter Registers and the Capture/Compare CCRA and CCRP registers, all have a low and high byte structure. The high bytes can be directly accessed, but as the low bytes can only be accessed via an internal 8-bit buffer, reading or writing to these register pairs must be carried out in a specific way. The important point to note is that data transfer to and from the 8-bit buffer and its related low byte only takes place when a write or read operation to its corresponding high byte is executed.

As the CCRA and CCRP registers are implemented in the way shown in the following diagram and accessing these register pairs is carried out in a specific way as described above, it is recommended to use the “MOV” instruction to access the CCRA and CCRP low byte registers, named xTMAL and PTMRPL, using the following access procedures. Accessing the CCRA or CCRP low byte registers without following these access procedures will result in unpredictable values.

Data Bus

8-bit Buffer

xTMDHxTMDL

xTMAHxTMAL

xTM Counter Register (Read only)

xTM CCRA Register (Read/Write)

PTMRPHPTMRPL

PTM CCRP Register (Read/Write)

Page 68: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 68 November 18, 2019 Rev. 1.10 69 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

The following steps show the read and write procedures:

• Writing Data to CCRA or CCRP ♦ Step 1. Write data to Low Byte xTMAL or PTMRPL

Note that here data is only written to the 8-bit buffer. ♦ Step 2. Write data to High Byte xTMAH or PTMRPH

Here data is written directly to the high byte registers and simultaneously data is latched from the 8-bit buffer to the Low Byte registers.

• Reading Data from the Counter Registers, CCRA or CCRP ♦ Step 1. Read data from the High Byte xTMDH, xTMAH or PTMRPH

Here data is read directly from the High Byte registers and simultaneously data is latched from the Low Byte register into the 8-bit buffer.

♦ Step 2. Read data from the Low Byte xTMDL, xTMAL or PTMRPLThis step reads data from the 8-bit buffer.

Compact Type TM – CTMAlthough the simplest form of the three TM types, the Compact TM type still contains three operating modes, which are Compare Match Output, Timer/Event Counter and PWM Output modes. The Compact TM can also be controlled with an external input pin and can drive two external output pin.

fSYS

fSYS/4

fH/64fH/16

fSUB

CTCK

000001010011100101110111

CTCK2~CTCK0

10-bit Count-up Counter

3-bit Comparator P

CCRP

b7~b9

b0~b9

10-bit Comparator A

CTONCTPAU

Comparator A Match

Comparator P Match

Counter Clear 01

Output Control

Polarity Control

Pin Control

CTOC

CTM1, CTM0CTIO1, CTIO0

CTMAF Interrupt

CTMPF Interrupt

CTPOL

CCRA

CTCCLR

CTP

Pin Control

PxSn

PxSn

CTPBfSUB

Compact Type TM Block Diagram

Compact TM OperationAt its core is a 10-bit count-up counter which is driven by a user selectable internal or external clock source. There are also two internal comparators with the names, Comparator A and Comparator P. These comparators will compare the value in the counter with CCRP and CCRA registers. The CCRP is three bits wide whose value is compared with the highest three bits in the counter while the CCRA is the ten bits and therefore compares with all counter bits.

The only way of changing the value of the 10-bit counter using the application program, is to clear the counter by changing the CTON bit from low to high. The counter will also be cleared automatically by a counter overflow or a compare match with one of its associated comparators. When these conditions occur, a CTM interrupt signal will also usually be generated. The Compact Type TM can operate in a number of different operational modes, can be driven by different clock sources including an input pin and can also control two output pin. All operating setup conditions are selected using relevant internal registers.

Page 69: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 68 November 18, 2019 Rev. 1.10 69 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Compact Type TM Register DescriptionOverall operation of the Compact TM is controlled using several registers. A read only register pair exists to store the internal counter 10-bit value, while a read/write register pair exists to store the internal 10-bit CCRA value. The remaining two registers are control registers which setup the different operating and control modes as well as the three CCRP bits.

RegisterName

Bit7 6 5 4 3 2 1 0

CTMC0 CTPAU CTCK2 CTCK1 CTCK0 CTON CTRP2 CTRP1 CTRP0CTMC1 CTM1 CTM0 CTIO1 CTIO0 CTOC CTPOL CTDPX CTCCLRCTMDL D7 D6 D5 D4 D3 D2 D1 D0CTMDH — — — — — — D9 D8CTMAL D7 D6 D5 D4 D3 D2 D1 D0CTMAH — — — — — — D9 D8

10-bit Compact TM Register List

• CTMC0 Register

Bit 7 6 5 4 3 2 1 0Name CTPAU CTCK2 CTCK1 CTCK0 CTON CTRP2 CTRP1 CTRP0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 CTPAU: CTM Counter Pause Control0: Run1: Pause

The counter can be paused by setting this bit high. Clearing the bit to zero restores normal counter operation. When in a Pause condition the CTM will remain powered up and continue to consume power. The counter will retain its residual value when this bit changes from low to high and resume counting from this value when the bit changes to a low value again.

Bit 6~4 CTCK2~CTCK0: Select CTM Counter clock000: fSYS/4001: fSYS

010: fH/16011: fH/64100: fSUB

101: fSUB

110: CTCK rising edge clock111: CTCK falling edge clock

These three bits are used to select the clock source for the CTM. The external pin clock source can be chosen to be active on the rising or falling edge. The clock source fSYS is the system clock, while fH and fSUB are other internal clocks, the details of which can be found in the oscillator section.

Bit 3 CTON: CTM Counter On/Off Control0: Off1: On

This bit controls the overall on/off function of the CTM. Setting the bit high enables the counter to run, clearing the bit disables the CTM. Clearing this bit to zero will stop the counter from counting and turn off the CTM which will reduce its power consumption. When the bit changes state from low to high the internal counter value will be reset to zero, however when the bit changes from high to low, the internal counter will retain its residual value until the bit returns high again.

Page 70: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 70 November 18, 2019 Rev. 1.10 71 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

If the CTM is in the Compare Match Output Mode or the PWM Output Mode then the CTM output pin will be reset to its initial condition, as specified by the CTOC bit, when the CTON bit changes from low to high.

Bit 2~0 CTRP2~CTRP0: CTM CCRP 3-bit register, compared with the CTM Counter bit 9~bit 7 Comparator P Match Period =

000: 1024 CTM clocks001: 128 CTM clocks010: 256 CTM clocks011: 384 CTM clocks100: 512 CTM clocks101: 640 CTM clocks110: 768 CTM clocks111: 896 CTM clocks

These three bits are used to setup the value on the internal CCRP 3-bit register, which are then compared with the internal counter’s highest three bits. The result of this comparison can be selected to clear the internal counter if the CTCCLR bit is set to zero. Setting the CTCCLR bit to zero ensures that a compare match with the CCRP values will reset the internal counter. As the CCRP bits are only compared with the highest three counter bits, the compare values exist in 128 clock cycle multiples. Clearing all three bits to zero is in effect allowing the counter to overflow at its maximum value.

• CTMC1 Register

Bit 7 6 5 4 3 2 1 0Name CTM1 CTM0 CTIO1 CTIO0 CTOC CTPOL CTDPX CTCCLRR/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 CTM1~CTM0: Select CTM Operating Mode00: Compare Match Output Mode01: Undefined10: PWM Output Mode11: Timer/Counter Mode

These bits setup the required operating mode for the CTM. To ensure reliable operation the CTM should be switched off before any changes are made to the CTM1 and CTM0 bits. In the Timer/Counter Mode, the CTM output pin state is undefined and the CTM output pins can be used for other function by setting the pin-shared function selection regitster.

Bit 5~4 CTIO1~CTIO0: Select CTM external pin (CTP) function Compare Match Output Mode

00: No change01: Output low10: Output high11: Toggle output

PWM Output Mode00: PWM output inactive state01: PWM output active state10: PWM output11: Undefined

Timer/Counter Mode:Unused

These two bits are used to determine how the CTM output pin changes state when a certain condition is reached. The function that these bits select depends upon in which mode the CTM is running.

Page 71: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 70 November 18, 2019 Rev. 1.10 71 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

In the Compare Match Output Mode, the CTIO1~CTIO0 bits determine how the CTM output pin changes state when a compare match occurs from the Comparator A. The CTM output pin can be setup to switch high, switch low or to toggle its present state when a compare match occurs from the Comparator A. When the CTIO1~CTIO0 bits are both zero, then no change will take place on the output. The initial value of the CTM output pin should be setup using the CTOC bit. Note that the output level requested by the CTIO1~CTIO0 bits must be different from the initial value setup using the CTOC bit otherwise no change will occur on the CTM output pin when a compare match occurs. After the CTM output pin changes state it can be reset to its initial level by changing the level of the CTON bit from low to high.In the PWM Output Mode, the CTIO1 and CTIO0 bits determine how the CTM output pin changes state when a certain compare match condition occurs. The PWM output function is modified by changing these two bits. It is necessary to change the values of the CTIO1 and CTIO0 bits only after the CTM has been switched off. Unpredictable PWM outputs will occur if the CTIO1 and CTIO0 bits are changed when the CTM is running.

Bit 3 CTOC: CTM CTP Output control bitCompare Match Output Mode

0: Initial low1: Initial high

PWM Output Mode0: Active low1: Active high

This is the output control bit for the CTM output pin. Its operation depends upon whether CTM is being used in the Compare Match Output Mode or in the PWM Output Mode. It has no effect if the CTM is in the Timer/Counter Mode. In the Compare Match Output Mode it determines the logic level of the CTM output pin before a compare match occurs. In the PWM Output Mode it determines if the PWM signal is active high or active low.

Bit 2 CTPOL: CTM CTP Output polarity Control0: Non-invert1: Invert

This bit controls the polarity of the CTM output pins. When the bit is set high the CTM output pins will be inverted and not inverted when the bit is zero. It has no effect if the CTM is in the Timer/Counter Mode.

Bit 1 CTDPX: CTM PWM period/duty Control0: CCRP - period; CCRA - duty1: CCRP - duty; CCRA - period

This bit, determines which of the CCRA and CCRP registers are used for period and duty control of the PWM waveform.

Bit 0 CTCCLR: CTM Counter clear condition selection0: CTM Comparatror P match 1: CTM Comparatror A match

This bit is used to select the method which clears the counter. Remember that the Compact TM contains two comparators, Comparator A and Comparator P, either of which can be selected to clear the internal counter. With the CTCCLR bit set high, the counter will be cleared when a compare match occurs from the Comparator A. When the bit is low, the counter will be cleared when a compare match occurs from the Comparator P or with a counter overflow. A counter overflow clearing method can only be implemented if the CCRP bits are all cleared to zero. The CTCCLR bit is not used in the PWM Output Mode.

Page 72: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 72 November 18, 2019 Rev. 1.10 73 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• CTMDL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R R R R R R R RPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: CTM Counter Low Byte Register bit 7 ~ bit 0CTM 10-bit Counter bit 7 ~ bit 0

• CTMDH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — D9 D8R/W — — — — — — R RPOR — — — — — — 0 0

Bit 7~2 Unimplemented, read as “0”Bit 1~0 D9~D8: CTM Counter High Byte Register bit 1 ~ bit 0

CTM 10-bit Counter bit 9 ~ bit 8

• CTMAL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: CTM CCRA Low Byte Register bit 7 ~ bit 0CTM 10-bit CCRA bit 7 ~ bit 0

• CTMAH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — D9 D8R/W — — — — — — R/W R/WPOR — — — — — — 0 0

Bit 7~2 Unimplemented, read as “0”Bit 1~0 D9~D8: CTM CCRA High Byte Register bit 1 ~ bit 0

CTM 10-bit CCRA bit 9 ~ bit 8

Compact Type TM Operating ModesThe Compact Type TM can operate in one of three operating modes, Compare Match Output Mode, PWM Output Mode or Timer/Counter Mode. The operating mode is selected using the CTM1 and CTM0 bits in the CTMC1 register.

Compare Match Output ModeTo select this mode, bits CTM1 and CTM0 in the CTMC1 register, should be set to 00 respectively. In this mode once the counter is enabled and running it can be cleared by three methods. These are a counter overflow, a compare match from Comparator A and a compare match from Comparator P. When the CTCCLR bit is low, there are two ways in which the counter can be cleared. One is when a compare match from Comparator P, the other is when the CCRP bits are all zero which allows the counter to overflow. Here both CTMAF and CTMPF interrupt request flags for Comparator A and Comparator P respectively, will both be generated.

Page 73: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 72 November 18, 2019 Rev. 1.10 73 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

If the CTCCLR bit in the CTMC1 register is high then the counter will be cleared when a compare match occurs from Comparator A. However, here only the CTMAF interrupt request flag will be generated even if the value of the CCRP bits is less than that of the CCRA registers. Therefore when CTCCLR is high no CTMPF interrupt request flag will be generated.

If the CCRA bits are all zero, the counter will overflow when its reaches its maximum 10-bit, 3FF Hex, value, however here the CTMAF interrupt request flag will not be generated.

As the name of the mode suggests, after a comparison is made, the CTM output pin, will change state. The CTM output pin condition however only changes state when a CTMAF interrupt request flag is generated after a compare match occurs from Comparator A. The CTMPF interrupt request flag, generated from a compare match occurs from Comparator P, will have no effect on the CTM output pin. The way in which the CTM output pin changes state are determined by the condition of the CTIO1 and CTIO0 bits in the CTMC1 register. The CTM output pin can be selected using the CTIO1 and CTIO0 bits to go high, to go low or to toggle from its present condition when a compare match occurs from Comparator A. The initial condition of the CTM output pin, which is setup after the CTON bit changes from low to high, is setup using the CTOC bit. Note that if the CTIO1 and CTIO0 bits are zero then no pin change will take place.

Counter Value

0x3FF

CCRP

CCRA

CTON

CTPAU

CTPOL

CCRP Int. Flag CTMPF

CCRA Int. Flag CTMAF

CTM O/P Pin

Time

CCRP=0

CCRP > 0

Counter overflowCCRP > 0Counter cleared by CCRP value

Pause

Resume

Stop

Counter Restart

CTCCLR = 0; CTM [1:0] = 00

Output pin set to initial Level Low if CTOC=0

Output Toggle with CTMAF flag

Note CTIO [1:0] = 10 Active High Output selectHere CTIO [1:0] = 11

Toggle Output select

Output not affected by CTMAF flag. Remains High until reset by CTON bit

Output PinReset to Initial value

Output controlled by other pin-shared function

Output Invertswhen CTPOL is high

Compare Match Output Mode − CTCCLR=0

Note: 1. With CTCCLR=0, a Comparator P match will clear the counter2. The CTM output pin controlled only by the CTMAF flag3. The output pin reset to initial state by a CTON bit rising edge

Page 74: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 74 November 18, 2019 Rev. 1.10 75 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

0x3FF

CCRP

CCRA

CTON

CTPAU

CTPOL

CTM O/P Pin

Time

CCRA=0

CCRA = 0Counter overflowCCRA > 0 Counter cleared by CCRA value

Pause

Resume

Stop Counter Restart

Output pin set to initial Level Low if CTOC=0

Output Toggle with CTMAF flag

Note CTIO [1:0] = 10 Active High Output selectHere CTIO [1:0] = 11

Toggle Output select

Output not affected by CTMAF flag. Remains High until reset by CTON bit Output Pin

Reset to Initial valueOutput controlled by other pin-shared function

Output Invertswhen CTPOL is high

CTMPF not generated

No CTMAF flag generated on CCRA overflow

Output does not change

CTCCLR = 1; CTM [1:0] = 00

CCRA Int. Flag CTMAF

CCRP Int. Flag CTMPF

Compare Match Output Mode − CTCCLR=1

Note: 1. With CTCCLR=1, a Comparator A match will clear the counter2. The CTM output pin controlled only by the CTMAF flag3. The output pin reset to initial state by a CTON rising edge4. The CTMPF flags is not generated when CTCCLR=1

Page 75: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 74 November 18, 2019 Rev. 1.10 75 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Timer/Counter ModeTo select this mode, bits CTM1 and CTM0 in the CTMC1 register should be set to 11 respectively. The Timer/Counter Mode operates in an identical way to the Compare Match Output Mode generating the same interrupt flags. The exception is that in the Timer/Counter Mode the CTM output pin is not used. Therefore the above description and Timing Diagrams for the Compare Match Output Mode can be used to understand its function. As the CTM output pin is not used in this mode, the pin can be used as a normal I/O pin or other pin-shared function.

PWM Output ModeTo select this mode, bits CTM1 and CTM0 in the CTMC1 register should be set to 10 respectively. The PWM function within the CTM is useful for applications which require functions such as motor control, heating control, illumination control etc. By providing a signal of fixed frequency but of varying duty cycle on the CTM output pin, a square wave AC waveform can be generated with varying equivalent DC RMS values.

As both the period and duty cycle of the PWM waveform can be controlled, the choice of generated waveform is extremely flexible. In the PWM Output Mode, the CTCCLR bit has no effect as the PWM period. Both of the CCRA and CCRP registers are used to generate the PWM waveform, one register is used to clear the internal counter and thus control the PWM waveform frequency, while the other one is used to control the duty cycle. Which register is used to control either frequency or duty cycle is determined using the CTDPX bit in the CTMC1 register. The PWM waveform frequency and duty cycle can therefore be controlled by the values in the CCRA and CCRP registers.

An interrupt flag, one for each of the CCRA and CCRP, will be generated when a compare match occurs from either Comparator A or Comparator P. The CTOC bit in the CTMC1 register is used to select the required polarity of the PWM waveform while the two CTIO1 and CTIO0 bits are used to enable the PWM output or to force the CTM output pin to a fixed high or low level. The CTPOL bit is used to reverse the polarity of the PWM output waveform.

• 10-bit CTM, PWM Output Mode, Edge-aligned Mode, CTDPX=0

CCRP 001b 010b 011b 100b 101b 110b 111b 000bPeriod 128 256 384 512 640 768 896 1024Duty CCRA

If fSYS=8MHz, CTM clock source is fSYS/4, CCRP=100b, CCRA=128,

The CTM PWM output frequency=(fSYS/4)/512=fSYS/2048=3.9063kHz, duty=128/512=25%.

If the Duty value defined by the CCRA register is equal to or greater than the Period value, then the PWM output duty is 100%.

• 10-bit CTM, PWM Output Mode, Edge-aligned Mode, CTDPX=1

CCRP 001b 010b 011b 100b 101b 110b 111b 000bPeriod CCRADuty 128 256 384 512 640 768 896 1024

The PWM output period is determined by the CCRA register value together with the CTM clock while the PWM duty cycle is defined by the CCRP register value.

Page 76: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 76 November 18, 2019 Rev. 1.10 77 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

CTON

CTPAU

CTPOL

CTM O/P Pin (CTOC=1)

Time

Counter cleared by CCRP

Pause Resume Counter Stop if CTON bit low

Counter Reset when CTON returns high

PWM Duty Cycle set by CCRA

PWM resumes operationOutput controlled by

other pin-shared function Output Invertswhen CTPOL = 1PWM Period set by CCRP

CTM O/P Pin (CTOC=0)

CCRA Int. Flag CTMAF

CCRP Int. Flag CTMPF

CTDPX = 0; CTM [1:0] = 10

PWM Output Mode − CTDPX=0

Note: 1. Here CTDPX=0 – Counter cleared by CCRP2. A counter clear sets PWM Period3. The internal PWM function continues running even when CTIO[1:0]=00 or 014. The CTCCLR bit has no influence on PWM operation

Page 77: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 76 November 18, 2019 Rev. 1.10 77 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

CTON

CTPAU

CTPOL

CCRP Int. Flag CTMPF

CCRA Int. Flag CTMAF

CTM O/P Pin (CTOC=1)

Time

Counter cleared by CCRA

Pause Resume Counter Stop if CTON bit low

Counter Reset when CTON returns high

PWM Duty Cycle set by CCRP

PWM resumes operationOutput controlled by

other pin-shared function Output Invertswhen CTPOL = 1

PWM Period set by CCRA

CTM O/P Pin (CTOC=0)

CTDPX = 1; CTM [1:0] = 10

PWM Output Mode − CTDPX=1

Note: 1. Here CTDPX=1 – Counter cleared by CCRA2. A counter clear sets PWM Period3. The internal PWM function continues even when CTIO[1:0]=00 or 014. The CTCCLR bit has no influence on PWM operation

Page 78: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 78 November 18, 2019 Rev. 1.10 79 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Standard Type TM – STMThe Standard Type TM contains five operating modes, which are Compare Match Output, Timer/Event Counter, Capture Input, Single Pulse Output and PWM Output modes. The Standard TM can also be controlled with two external input pins and can drive two external output pins.

fSYS

fSYS/4

fH/64fH/16

fSUB

STCK

000001010011100101110111

STCK2~STCK0

10-bit Count-up Counter

3-bit Comparator P

CCRP

b7~b9

b0~b9

10-bit Comparator A

STONSTPAU

Comparator A Match

Comparator P Match

Counter Clear 01

Output Control

Polarity Control

STP

STOC

STM1, STM0STIO1, STIO0

STMAF Interrupt

STMPF Interrupt

STPOL

CCRA

STCCLR

Edge Detector

STPI

STIO1, STIO0

STPBfSUB

01 DEMO0 (from Demodulation 0 output)

STPIS

Standard Type TM Block Diagram

Standard TM OperationThe size of Standard TM is 10-bit wide and its core is a 10-bit count-up counter which is driven by a user selectable internal or external clock source. There are also two internal comparators with the names, Comparator A and Comparator P. These comparators will compare the value in the counter with CCRP and CCRA registers. The CCRP comparator is 3-bit wide whose value is compared with the highest 3 bits in the counter while the CCRA is 10 bits and therefore compares all counter bits.

The only way of changing the value of the 10-bit counter using the application program, is to clear the counter by changing the STON bit from low to high. The counter will also be cleared automatically by a counter overflow or a compare match with one of its associated comparators. When these conditions occur, a STM interrupt signal will also usually be generated. The Standard Type TM can operate in a number of different operational modes, can be driven by different clock sources including an input pin and can also control two output pins. All operating setup conditions are selected using relevant internal registers.

Standard Type TM Register DescriptionOverall operation of the Standard TM is controlled using a series of registers. A read only register pair exists to store the internal counter 10-bit value, while a read/write register pair exists to store the internal 10-bit CCRA value. The remaining two registers are control registers which setup the different operating and control modes as well as three CCRP bis.

RegisterName

Bit7 6 5 4 3 2 1 0

STMC0 STPAU STCK2 STCK1 STCK0 STON STRP2 STRP1 STRP0STMC1 STM1 STM0 STIO1 STIO0 STOC STPOL STDPX STCCLRSTMDL D7 D6 D5 D4 D3 D2 D1 D0STMDH — — — — — — D9 D8STMAL D7 D6 D5 D4 D3 D2 D1 D0STMAH — — — — — — D9 D8

10-bit Standard TM Register List

Page 79: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 78 November 18, 2019 Rev. 1.10 79 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• STMC0 Register

Bit 7 6 5 4 3 2 1 0Name STPAU STCK2 STCK1 STCK0 STON STRP2 STRP1 STRP0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 STPAU: STM Counter Pause Control0: Run1: Pause

The counter can be paused by setting this bit high. Clearing the bit to zero restores normal counter operation. When in a Pause condition the STM will remain powered up and continue to consume power. The counter will retain its residual value when this bit changes from low to high and resume counting from this value when the bit changes to a low value again.

Bit 6~4 STCK2~STCK0: Select STM Counter Clock000: fSYS/4001: fSYS

010: fH/16011: fH/64100: fSUB

101: fSUB

110: STCK rising edge clock111: STCK falling edge clock

These three bits are used to select the clock source for the STM. The external pin clock source can be chosen to be active on the rising or falling edge. The clock source fSYS is the system clock, while fH and fSUB are other internal clocks, the details of which can be found in the oscillator section.

Bit 3 STON: STM Counter On/Off Control0: Off1: On

This bit controls the overall on/off function of the STM. Setting the bit high enables the counter to run while clearing the bit disables the STM. Clearing this bit to zero will stop the counter from counting and turn off the STM which will reduce its power consumption. When the bit changes state from low to high the internal counter value will be reset to zero, however when the bit changes from high to low, the internal counter will retain its residual value until the bit returns high again. If the STM is in the Compare Match Output Mode then the STM output pin will be reset to its initial condition, as specified by the STOC bit, when the STON bit changes from low to high.

Bit 2~0 STRP2~STRP0: STM CCRP 3-bit register, compared with the STM counter bit 9~bit 7Comparator P Match Period =

000: 1024 STM clocks001: 128 STM clocks010: 256 STM clocks011: 384 STM clocks100: 512 STM clocks101: 640 STM clocks110: 768 STM clocks111: 896 STM clocks

These three bits are used to setup the value on the internal CCRP 3-bit register, which are then compared with the internal counter’s highest three bits. The result of this comparison can be selected to clear the internal counter if the STCCLR bit is set to zero. Setting the STCCLR bit to zero ensures that a compare match with the CCRP values will reset the internal counter. As the CCRP bits are only compared with the highest three counter bits, the compare values exist in 128 clock cycle multiples. Clearing all three bits to zero is in effect allowing the counter to overflow at its maximum value.

Page 80: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 80 November 18, 2019 Rev. 1.10 81 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• STMC1 Register

Bit 7 6 5 4 3 2 1 0Name STM1 STM0 STIO1 STIO0 STOC STPOL STDPX STCCLRR/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 STM1~STM0: Select STM Operating Mode00: Compare Match Output Mode01: Capture Input Mode10: PWM Output Mode or Single Pulse Output Mode11: Timer/Counter Mode

These bits setup the required operating mode for the STM. To ensure reliable operation the STM should be switched off before any changes are made to the STM1 and STM0 bits. In the Timer/Counter Mode, the STM output pin state is undefined and the STM output pins can be used for other function by setting the pin-shared function selection regitster.

Bit 5~4 STIO1~STIO0: Select STM External Pins FunctionCompare Match Output Mode

00: No change01: Output low10: Output high11: Toggle output

PWM Output Mode/Single Pulse Output Mode00: PWM output inactive state01: PWM output active state10: PWM output11: Single Pulse Output

Capture Input Mode00: Input capture at rising edge of STPI or DEMO001: Input capture at falling edge of STPI or DEMO010: Input capture at both rising and falling edges of STPI or DEMO011: Input capture disabled

The STM Capture Input can be sourced from STPI or DEMO0 which is selected by STPIS bit in the DEMISC register.Timer/Counter Mode

UnusedThese two bits are used to determine how the STM output pin changes state when a certain condition is reached. The function that these bits select depends upon in which mode the STM is running.In the Compare Match Output Mode, the STIO1 and STIO0 bits determine how the STM output pin changes state when a compare match occurs from the Comparator A. The TM output pin can be setup to switch high, switch low or to toggle its present state when a compare match occurs from the Comparator A. When the bits are both zero, then no change will take place on the output. The initial value of the STM output pin should be setup using the STOC bit in the STMC1 register. Note that the output level requested by the STIO1 and STIO0 bits must be different from the initial value setup using the STOC bit otherwise no change will occur on the STM output pin when a compare match occurs. After the STM output pin changes state, it can be reset to its initial level by changing the level of the STON bit from low to high.In the PWM Output Mode, the STIO1 and STIO0 bits determine how the STM output pin changes state when a certain compare match condition occurs. The PWM output function is modified by changing these two bits. It is necessary to only change the values of the STIO1 and STIO0 bits only after the STM has been switched off. Unpredictable PWM outputs will occur if the STIO1 and STIO0 bits are changed when the STM is running.

Page 81: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 80 November 18, 2019 Rev. 1.10 81 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 3 STOC: STP Output ControlCompare Match Output Mode

0: Initial low1: Initial high

PWM Output Mode/Single Pulse Output Mode0: Active low1: Active high

This is the output control bit for the STM output. Its operation depends upon whether STM is being used in the Compare Match Output Mode or in the PWM Output Mode/Single Pulse Output Mode. It has no effect if the STM is in the Timer/Counter Mode. In the Compare Match Output Mode it determines the logic level of the STM output pin before a compare match occurs. In the PWM Output Mode/Single Pulse Output Mode it determines if the PWM signal is active high or active low.

Bit 2 STPOL: STP Output Polarity Control0: Non-invert1: Invert

This bit controls the polarity of the STP output. When the bit is set high the STM output pin will be inverted and not inverted when the bit is zero. It has no effect if the STM is in the Timer/Counter Mode.

Bit 1 STDPX: STM PWM Duty/Period Control0: CCRP – period; CCRA – duty1: CCRP – duty; CCRA – period

This bit determines which of the CCRA and CCRP registers are used for period and duty control of the PWM waveform.

Bit 0 STCCLR: STM Counter Clear Condition Selection0: Comparator P match1: Comparator A match

This bit is used to select the method which clears the counter. Remember that the Standard TM contains two comparators, Comparator A and Comparator P, either of which can be selected to clear the internal counter. With the STCCLR bit set high, the counter will be cleared when a compare match occurs from the Comparator A. When the bit is low, the counter will be cleared when a compare match occurs from the Comparator P or with a counter overflow. A counter overflow clearing method can only be implemented if the CCRP bits are all cleared to zero. The STCCLR bit is not used in the PWM Output, Single Pulse Output or Capture Input Mode.

• STMDL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R R R R R R R RPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: STM Counter Low Byte Register bit 7 ~ bit 0STM 10-bit Counter bit 7 ~ bit 0

• STMDH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — D9 D8R/W — — — — — — R RPOR — — — — — — 0 0

Bit 7~2 Unimplemented, read as “0”Bit 1~0 D9~D8: STM Counter High Byte Register bit 1 ~ bit 0

STM 10-bit Counter bit 9 ~ bit 8

Page 82: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 82 November 18, 2019 Rev. 1.10 83 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• STMAL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: STM CCRA Low Byte Register bit 7 ~ bit 0STM 10-bit CCRA bit 7 ~ bit 0

• STMAH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — D9 D8R/W — — — — — — R/W R/WPOR — — — — — — 0 0

Bit 7~2 Unimplemented, read as “0”Bit 1~0 D9~D8: STM CCRA High Byte Register bit 1 ~ bit 0

STM 10-bit CCRA bit 9 ~ bit 8

Standard Type TM Operation ModesThe Standard Type TM can operate in one of five operating modes, Compare Match Output Mode, PWM Output Mode, Single Pulse Output Mode, Capture Input Mode or Timer/Counter Mode. The operating mode is selected using the STM1 and STM0 bits in the STMC1 register.

Compare Match Output ModeTo select this mode, bits STM1 and STM0 in the STMC1 register, should be set to 00 respectively. In this mode once the counter is enabled and running it can be cleared by three methods. These are a counter overflow, a compare match from Comparator A and a compare match from Comparator P. When the STCCLR bit is low, there are two ways in which the counter can be cleared. One is when a compare match from Comparator P, the other is when the CCRP bits are all zero which allows the counter to overflow. Here both STMAF and STMPF interrupt request flags for Comparator A and Comparator P respectively, will both be generated.

If the STCCLR bit in the STMC1 register is high then the counter will be cleared when a compare match occurs from Comparator A. However, here only the STMAF interrupt request flag will be generated even if the value of the CCRP bits is less than that of the CCRA registers. Therefore when STCCLR is high no STMPF interrupt request flag will be generated. In the Compare Match Output Mode, the CCRA can not be set to “0”.

If the CCRA bits are all zero, the counter will overflow when it reaches its maximum 10-bit, 3FF Hex, value, however here the STMAF interrupt request flag will not be generated.

As the name of the mode suggests, after a comparison is made, the STM output pin, will change state. The STM output pin condition however only changes state when a STMAF interrupt request flag is generated after a compare match occurs from Comparator A. The STMPF interrupt request flag, generated from a compare match occurs from Comparator P, will have no effect on the STM output pin. The way in which the STM output pin changes state are determined by the condition of the STIO1 and STIO0 bits in the STMC1 register. The STM output pin can be selected using the STIO1 and STIO0 bits to go high, to go low or to toggle from its present condition when a compare match occurs from Comparator A. The initial condition of the STM output pin, which is setup after the STON bit changes from low to high, is setup using the STOC bit. Note that if the STIO1 and STIO0 bits are zero then no pin change will take place.

Page 83: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 82 November 18, 2019 Rev. 1.10 83 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

0x3FF

CCRP

CCRA

STON

STPAU

STPOL

CCRP Int. flag STMPF

CCRA Int. flag STMAF

STMO/P Pin

Time

CCRP=0

CCRP > 0

Counter overflowCCRP > 0

Counter cleared by CCRP value

Pause

Resume

Stop

Counter Restart

STCCLR = 0; STM [1:0] = 00

Output pin set to initial Level Low if STOC=0

Output Toggle with STMAF flag

Note STIO [1:0] = 10 Active High Output selectHere STIO [1:0] = 11

Toggle Output select

Output not affected by STMAF flag. Remains High until reset by STON bit

Output PinReset to Initial value

Output controlled by other pin-shared function

Output Invertswhen STPOL is high

Compare Match Output Mode – STCCLR=0

Note: 1. With STCCLR=0 a Comparator P match will clear the counter2. The STM output pin is controlled only by the STMAF flag3. The output pin is reset to itsinitial state by a STON bit rising edge

Page 84: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 84 November 18, 2019 Rev. 1.10 85 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

0x3FF

CCRP

CCRA

STON

STPAU

STPOL

CCRP Int. flag STMPF

CCRA Int. flag STMAF

STMO/P Pin

Time

CCRA=0

CCRA = 0Counter overflowCCRA > 0 Counter cleared by CCRA value

Pause

Resume

Stop Counter Restart

STCCLR = 1; STM [1:0] = 00

Output pin set to initial Level Low if STOC=0

Output Toggle with STMAF flag

Note STIO [1:0] = 10 Active High Output selectHere STIO [1:0] = 11

Toggle Output select

Output not affected by STMAF flag. Remains High until reset by STON bit Output Pin

Reset to Initial valueOutput controlled by other pin-shared function

Output Invertswhen STPOL is high

STMPF not generated

No STMAF flag generated on CCRA overflow

Output does not change

Compare Match Output Mode – STCCLR=1

Note: 1. With STCCLR=1 a Comparator A match will clear the counter2. The STM output pin is controlled only by the STMAF flag3. The output pin is reset to its initial state by a STON bit rising edge4. A STMPF flag is not generated when STCCLR=1

Page 85: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 84 November 18, 2019 Rev. 1.10 85 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Timer/Counter ModeTo select this mode, bits STM1 and STM0 in the STMC1 register should be set to 11 respectively. The Timer/Counter Mode operates in an identical way to the Compare Match Output Mode generating the same interrupt flags. The exception is that in the Timer/Counter Mode the STM output pin is not used. Therefore the above description and Timing Diagrams for the Compare Match Output Mode can be used to understand its function. As the STM output pin is not used in this mode, the pin can be used as a normal I/O pin or other pin-shared function.

PWM Output ModeTo select this mode, bits STM1 and STM0 in the STMC1 register should be set to 10 respectively and also the STIO1 and STIO0 bits should be set to 10 respectively. The PWM function within the STM is useful for applications which require functions such as motor control, heating control, illumination control etc. By providing a signal of fixed frequency but of varying duty cycle on the STM output pin, a square wave AC waveform can be generated with varying equivalent DC RMS values.

As both the period and duty cycle of the PWM waveform can be controlled, the choice of generated waveform is extremely flexible. In the PWM Output mode, the STCCLR bit has no effect as the PWM period. Both of the CCRA and CCRP registers are used to generate the PWM waveform, one register is used to clear the internal counter and thus control the PWM waveform frequency, while the other one is used to control the duty cycle. Which register is used to control either frequency or duty cycle is determined using the STDPX bit in the STMC1 register. The PWM waveform frequency and duty cycle can therefore be controlled by the values in the CCRA and CCRP registers.

An interrupt flag, one for each of the CCRA and CCRP, will be generated when a compare match occurs from either Comparator A or Comparator P. The STOC bit in the STMC1 register is used to select the required polarity of the PWM waveform while the two STIO1 and STIO0 bits are used to enable the PWM output or to force the STM output pin to a fixed high or low level. The STPOL bit is used to reverse the polarity of the PWM output waveform.

• 10-bit STM, PWM Output Mode, Edge-aligned Mode, STDPX=0

CCRP 1~7 0Period CCRP×128 1024Duty CCRA

If fSYS=8MHz, TM clock source is fSYS/4, CCRP=4 and CCRA=128,

The STM PWM output frequency=(fSYS/4)/(4×128)=fSYS/2048=3.9063kHz, duty=128/(4×128)=25%.

If the Duty value defined by the CCRA register is equal to or greater than the Period value, then the PWM output duty is 100%.

• 10-bit STM, PWM Output Mode, Edge-aligned Mode, STDPX=1

CCRP 1~7 0Period CCRADuty CCRP×128 1024

The PWM output period is determined by the CCRA register value together with the STM clock while the PWM duty cycle is defined by the CCRP register value.

Page 86: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 86 November 18, 2019 Rev. 1.10 87 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

STON

STPAU

STPOL

CCRP Int. flag STMPF

CCRA Int. flag STMAF

STM O/P Pin(STOC=1)

Time

Counter cleared by CCRP

Pause Resume Counter Stop if STON bit low

Counter Reset when STON returns high

STDPX = 0; STM [1:0] = 10

PWM Duty Cycle set by CCRA

PWM resumes operation

Output controlled by other pin-shared function Output Inverts

when STPOL = 1PWM Period set by CCRP

STM O/P Pin(STOC=0)

PWM Output Mode – STDPX=0

Note: 1. Here STDPX=0 – Counter cleared by CCRP2. A counter clear sets the PWM Period3. The internal PWM function continues running even when STIO [1:0]=00 or 014. The STCCLR bit has no influence on PWM operation

Page 87: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 86 November 18, 2019 Rev. 1.10 87 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

STON

STPAU

STPOL

CCRP Int. flag STMPF

CCRA Int. flag STMAF

STM O/P Pin (STOC=1)

Time

Counter cleared by CCRA

Pause Resume Counter Stop if STON bit low

Counter Reset when STON returns high

STDPX = 1; STM [1:0] = 10

PWM Duty Cycle set by CCRP

PWM resumes operation

Output controlled by other pin-shared function Output Inverts

when STPOL = 1PWM Period set by CCRA

STM O/P Pin (STOC=0)

PWM Output Mode – STDPX=1

Note: 1. Here STDPX=1 – Counter cleared by CCRA2. A counter clear sets the PWM Period3. The internal PWM function continues even when STIO [1:0]=00 or 014. The STCCLR bit has no influence on PWM operation

Page 88: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 88 November 18, 2019 Rev. 1.10 89 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Single Pulse Output ModeTo select this mode, bits STM1 and STM0 in the STMC1 register should be set to 10 respectively and also the STIO1 and STIO0 bits should be set to 11 respectively. The Single Pulse Output Mode, as the name suggests, will generate a single shot pulse on the STM output pin.

The trigger for the pulse output leading edge is a low to high transition of the STON bit, which can be implemented using the application program. However in the Single Pulse Mode, the STON bit can also be made to automatically change from low to high using the external STCK pin, which will in turn initiate the Single Pulse output. When the STON bit transitions to a high level, the counter will start running and the pulse leading edge will be generated. The STON bit should remain high when the pulse is in its active state. The generated pulse trailing edge will be generated when the STON bit is cleared to zero, which can be implemented using the application program or when a compare match occurs from Comparator A.

However a compare match from Comparator A will also automatically clear the STON bit and thus generate the Single Pulse output trailing edge. In this way the CCRA value can be used to control the pulse width. A compare match from Comparator A will also generate a STM interrupt. The counter can only be reset back to zero when the STON bit changes from low to high when the counter restarts. In the Single Pulse Mode CCRP is not used. The STCCLR and STDPX bits are not used in this Mode.

STON bit0 → 1

S/W Command SET“STON”

orSTCK Pin Transition

STON bit1 → 0

CCRA Trailing Edge

S/W Command CLR“STON”

orCCRA Compare Match

STP Output Pin

Pulse Width = CCRA Value

CCRA Leading Edge

Single Pulse Generation

Page 89: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 88 November 18, 2019 Rev. 1.10 89 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

STON

STPAU

STPOL

CCRP Int. Flag STMPF

CCRA Int. Flag STMAF

STM O/P Pin(STOC=1)

Time

Counter stopped by CCRA

PauseResume Counter Stops

by software

Counter Reset when STON returns high

STM [1:0] = 10 ; STIO [1:0] = 11

Pulse Width set by CCRA

Output Invertswhen STPOL = 1

No CCRP Interrupts generated

STM O/P Pin(STOC=0)

STCK pin

Software Trigger

Cleared by CCRA match

STCK pin Trigger

Auto. set by STCK pin

Software Trigger

Software Clear

Software TriggerSoftware

Trigger

Single Pulse Mode

Note: 1. Counter stopped by CCRA2. CCRP is not used3. The pulse triggered by the STCK pin or by setting the STON bit high4. A STCK pin active edge will automatically set the STON bit high5. In the Single Pulse Mode, STIO [1:0] must be set to “11” and can not be changed

Page 90: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 90 November 18, 2019 Rev. 1.10 91 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Capture Input ModeTo select this mode bits STM1 and STM0 in the STMC1 register should be set to 01 respectively. This mode enables external signals to capture and store the present value of the internal counter and can therefore be used for applications such as pulse width measurements. The external signal is supplied on the STPI pin or DEMO0 which is selected using the STPIS bit in the DCMISC register. The input active edge can be a rising edge, a falling edge or both rising and falling edges; the active edge transition type is selected using the STIO1 and STIO0 bits in the STMC1 register. The counter is started when the STON bit changes from low to high which is initiated using the application program.

When the required edge transition appears on the STPI pin or DEMO0 the present value in the counter will be latched into the CCRA registers and a STM interrupt generated. Irrespective of what events occur on the STPI pin or DEMO0 the counter will continue to free run until the STON bit changes from high to low. When a CCRP compare match occurs the counter will reset back to zero; in this way the CCRP value can be used to control the maximum counter value. When a CCRP compare match occurs from Comparator P, a STM interrupt will also be generated. Counting the number of overflow interrupt signals from the CCRP can be a useful method in measuring long pulse widths. The STIO1 and STIO0 bits can select the active trigger edge on the STPI pin or DEMO0 to be a rising edge, falling edge or both edge types. If the STIO1 and STIO0 bits are both set high, then no capture operation will take place irrespective of what happens on the STPI pin or DEMO0, however it must be noted that the counter will continue to run. The STCCLR and STDPX bits are not used in this Mode.

Page 91: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 90 November 18, 2019 Rev. 1.10 91 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

YY

CCRP

STON

STPAU

CCRP Int. Flag STMPF

CCRA Int. Flag STMAF

CCRA Value

Time

Counter cleared by CCRP

PauseResume

Counter Reset

STM [1:0] = 01

STM Capture fromSTPI pin or DEMO0

XX

Counter Stop

STIO [1:0] Value

XX YY XX YY

Active edge Active

edgeActive edge

00 – Rising edge 01 – Falling edge 10 – Both edges 11 – Disable Capture

Capture Input Mode

Note: 1. STM [1:0]=01 and active edge set by the STIO [1:0] bits2. A STM Capture input pin active edge transfers the counter value to CCRA3. STCCLR bit not used4. No output function – STOC and STPOL bits are not used5. CCRP determines the counter value and the counter has a maximum count value when CCRP is equal to

zero.

Page 92: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 92 November 18, 2019 Rev. 1.10 93 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Periodic Type TM – PTMThe Periodic Type TM contains five operating modes, which are Compare Match Output, Timer/Event Counter, Capture Input, Single Pulse Output and PWM Output modes. The Periodic TM can be controlled with two external input pins and can drive two external output pins.

16-bit Count-up Counter

16-bit Comparator P

CCRP

16-bit Comparator A

Output Control

Polarity Control

Pin Control PTPB

CCRA Edge Detector

PTCCLR

fSYS

fSYS/4

fH/64fH/16

fSUB

PTCK2~PTCK0

PTONPTPAU

Comparator A Match

Comparator P Match

Counter Clear

PTOC

PTM1, PTM0PTIO1, PTIO0

PTMAF Interrupt

PTMPF Interrupt

PTPOL PxSn

PTIO1, PTIO0

fSUB

PTCAPTS

000001010011100101110111

b0~b15

b0~b15

01

10

PTCKPin

Control

PxSn

PTPI01 DEMO1

(from Demodulation 1 output)

PTPIS

PTP

Note: 1. PTPB is the inverse signal of PTP.2. In counter turned on or CCRA/CCRP changed period, Comparator A/P match output maybe delay one

counter clock.

Periodic Type TM Block Diagram

Periodic TM OperationThe Periodic Type TM core is a 16-bit count-up counter which is driven by a user selectable internal or external clock source. There are also two internal comparators with the names, Comparator A and Comparator P. These comparators will compare the value in the counter with CCRP and CCRA registers. The CCRP comparator is 16-bit wide.

The only way of changing the value of the 16-bit counter using the application program, is to clear the counter by changing the PTON bit from low to high. The counter will also be cleared automatically by a counter overflow or a compare match with one of its associated comparators. When these conditions occur, a PTM interrupt signal will also usually be generated. The Periodic Type TM can operate in a number of different operational modes, can be driven by different clock sources including an input pin and can also control two output pins. All operating setup conditions are selected using relevant internal registers.

Periodic Type TM Register DescriptionOverall operation of the Periodic Type TM is controlled using a series of registers. A read only register pair exists to store the internal counter 16-bit value, while two read/write register pairs exist to store the internal 16-bit CCRA value and CCRP value. The remaining two registers are control registers which setup the different operating and control modes.

Page 93: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 92 November 18, 2019 Rev. 1.10 93 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

RegisterName

Bit7 6 5 4 3 2 1 0

PTMC0 PTPAU PTCK2 PTCK1 PTCK0 PTON — — —PTMC1 PTM1 PTM0 PTIO1 PTIO0 PTOC PTPOL PTCAPTS PTCCLRPTMDL D7 D6 D5 D4 D3 D2 D1 D0PTMDH D15 D14 D13 D12 D11 D10 D9 D8PTMAL D7 D6 D5 D4 D3 D2 D1 D0PTMAH D15 D14 D13 D12 D11 D10 D9 D8PTMRPL D7 D6 D5 D4 D3 D2 D1 D0PTMRPH D15 D14 D13 D12 D11 D10 D9 D8

16-bit Periodic TM Register List

• PTMC0 Register

Bit 7 6 5 4 3 2 1 0Name PTPAU PTCK2 PTCK1 PTCK0 PTON — — —R/W R/W R/W R/W R/W R/W — — —POR 0 0 0 0 0 — — —

Bit 7 PTPAU: PTM Counter Pause Control0: Run1: Pause

The counter can be paused by setting this bit high. Clearing the bit to zero restores normal counter operation. When in a Pause condition the PTM will remain powered up and continue to consume power. The counter will retain its residual value when this bit changes from low to high and resume counting from this value when the bit changes to a low value again.

Bit 6~4 PTCK2~PTCK0: Select PTM Counter clock000: fSYS/4001: fSYS

010: fH/16011: fH/64100: fSUB

101: fSUB

110: PTCK rising edge clock111: PTCK falling edge clock

These three bits are used to select the clock source for the PTM. The external pin clock source can be chosen to be active on the rising or falling edge. The clock source fSYS is the system clock, while fH and fSUB are other internal clocks, the details of which can be found in the oscillator section.

Bit 3 PTON: PTM Counter On/Off Control0: Off1: On

This bit controls the overall on/off function of the PTM. Setting the bit high enables the counter to run, clearing the bit disables the PTM. Clearing this bit to zero will stop the counter from counting and turn off the PTM which will reduce its power consumption. When the bit changes state from low to high the internal counter value will be reset to zero, however when the bit changes from high to low, the internal counter will retain its residual value until the bit returns high again. If the PTM is in the Compare Match Output Mode, PWM Output Mode or Single Pulse Output Mode then the PTM output pin will be reset to its initial condition, as specified by the PTOC bit, when the PTON bit changes from low to high.

Bit 2~0 Unimplemented, read as “0”

Page 94: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 94 November 18, 2019 Rev. 1.10 95 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PTMC1 Register

Bit 7 6 5 4 3 2 1 0Name PTM1 PTM0 PTIO1 PTIO0 PTOC PTPOL PTCAPTS PTCCLRR/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~6 PTM1~PTM0: Select PTM Operating Mode00: Compare Match Output Mode01: Capture Input Mode10: PWM Output Mode or Single Pulse Output Mode11: Timer/Counter Mode

These bits setup the required operating mode for the PTM. To ensure reliable operation the PTM should be switched off before any changes are made to the PTM1 and PTM0 bits. In the Timer/Counter Mode, the PTM output state is undefined.

Bit 5~4 PTIO1~PTIO0: Select PTM external pin functionCompare Match Output Mode

00: No change01: Output low10: Output high11: Toggle output

PWM Output Mode/Single Pulse Output Mode00: PWM Output inactive state01: PWM Output active state10: PWM output11: Single pulse output

Capture Input Mode00: Input capture at rising edge of PTPI, DEMO1 or PTCK01: Input capture at falling edge of PTPI, DEMO1 or PTCK10: Input capture at falling/rising edge of PTPI, DEMO1 or PTCK11: Input capture disabled

When the PTCAPTS bit is cleared to 0, the PTM Capture Input can be sourced from PTPI or DEMO1 which is selected by PTPIS bit in the DEMISC register.Timer/Counter Mode

UnusedThese two bits are used to determine how the PTM output pin changes state when a certain condition is reached. The function that these bits select depends upon in which mode the PTM is running.In the Compare Match Output Mode, the PTIO1 and PTIO0 bits determine how the PTM output pin changes state when a compare match occurs from the Comparator A. The PTM output pin can be setup to switch high, switch low or to toggle its present state when a compare match occurs from the Comparator A. When the bits are both zero, then no change will take place on the output. The initial value of the PTM output pin should be setup using the PTOC bit in the PTMC1 register. Note that the output level requested by the PTIO1 and PTIO0 bits must be different from the initial value setup using the PTOC bit otherwise no change will occur on the PTM output pin when a compare match occurs. After the PTM output pin changes state, it can be reset to its initial level by changing the level of the PTON bit from low to high.In the PWM Output Mode, the PTIO1 and PTIO0 bits determine how the PTM output pin changes state when a certain compare match condition occurs. The PWM output function is modified by changing these two bits. It is necessary to only change the values of the PTIO1 and PTIO0 bits only after the PTM has been switched off. Unpredictable PWM outputs will occur if the PTIO1 and PTIO0 bits are changed when the PTM is running.

Page 95: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 94 November 18, 2019 Rev. 1.10 95 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 3 PTOC: PTM PTP Output control bitCompare Match Output Mode

0: Initial low1: Initial high

PWM Output Mode/Single Pulse Output Mode0: Active low1: Active high

This is the output control bit for the PTM output pin. Its operation depends upon whether PTM is being used in the Compare Match Output Mode or in the PWM Output Mode/Single Pulse Output Mode. It has no effect if the PTM is in the Timer/Counter Mode. In the Compare Match Output Mode it determines the logic level of the PTM output pin before a compare match occurs. In the PWM Output Mode it determines if the PWM signal is active high or active low. In the Single Pulse Output Mode it determines the logic level of the PTM output pin when the PTON bit changes from low to high.

Bit 2 PTPOL: PTM PTP Output polarity Control0: Non-invert1: Invert

This bit controls the polarity of the PTP output pin. When the bit is set high the PTM output pin will be inverted and not inverted when the bit is zero. It has no effect if the PTM is in the Timer/Counter Mode.

Bit 1 PTCAPTS: PTM Capture Trigger Source Selection0: From PTPI pin or DEMO11: From PTCK pin

When the PTCAPTS bit is cleared to 0, the PTM Capture Input can be sourced from PTPI or DEMO1 which is selected by PTPIS bit in the DEMISC register.

Bit 0 PTCCLR: Select PTM Counter clear condition0: PTM Comparator P match1: PTM Comparator A match

This bit is used to select the method which clears the counter. Remember that the Periodic TM contains two comparators, Comparator A and Comparator P, either of which can be selected to clear the internal counter. With the PTCCLR bit set high, the counter will be cleared when a compare match occurs from the Comparator A. When the bit is low, the counter will be cleared when a compare match occurs from the Comparator P or with a counter overflow. A counter overflow clearing method can only be implemented if the CCRP bits are all cleared to zero. The PTCCLR bit is not used in the PWM Output Mode, Single Pulse or Capture Input Mode.

• PTMDL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R R R R R R R RPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: PTM Counter Low Byte Register bit 7 ~ bit 0PTM 16-bit Counter bit 7 ~ bit 0

Page 96: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 96 November 18, 2019 Rev. 1.10 97 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PTMDH Register

Bit 7 6 5 4 3 2 1 0Name D15 D14 D13 D12 D11 D10 D9 D8R/W R R R R R R R RPOR 0 0 0 0 0 0 0 0

Bit 7~0 D15~D8: PTM Counter High Byte Register bit 7 ~ bit 0PTM 16-bit Counter bit 15 ~ bit 8

• PTMAL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: PTM CCRA Low Byte Register bit 7 ~ bit 0PTM 16-bit CCRA bit 7 ~ bit 0

• PTMAH Register

Bit 7 6 5 4 3 2 1 0Name D15 D14 D13 D12 D11 D10 D9 D8R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D15~D8: PTM CCRA High Byte Register bit 7 ~ bit 0PTM 16-bit CCRA bit 15 ~ bit 8

• PTMRPL Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: PTM CCRP Low Byte Register bit 7 ~ bit 0PTM 16-bit CCRP bit 7 ~ bit 0

• PTMRPH Register

Bit 7 6 5 4 3 2 1 0Name D15 D14 D13 D12 D11 D10 D9 D8R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D15~D8: PTM CCRP High Byte Register bit 7 ~ bit 0PTM 16-bit CCRP bit 15 ~ bit 8

Page 97: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 96 November 18, 2019 Rev. 1.10 97 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Periodic Type TM Operating Modes The Periodic Type TM can operate in one of five operating modes, Compare Match Output Mode, PWM Output Mode, Single Pulse Output Mode, Capture Input Mode or Timer/Counter Mode. The operating mode is selected using the PTM1 and PTM0 bits in the PTMC1 register.

Compare Match Output Mode To select this mode, bits PTM1 and PTM0 in the PTMC1 register, should be set to 00 respectively. In this mode once the counter is enabled and running it can be cleared by three methods. These are a counter overflow, a compare match from Comparator A and a compare match from Comparator P. When the PTCCLR bit is low, there are two ways in which the counter can be cleared. One is when a compare match from Comparator P, the other is when the CCRP bits are all zero which allows the counter to overflow. Here both PTMAF and PTMPF interrupt request flags for Comparator A and Comparator P respectively, will both be generated.

If the PTCCLR bit in the PTMC1 register is high then the counter will be cleared when a compare match occurs from Comparator A. However, here only the PTMAF interrupt request flag will be generated even if the value of the CCRP bits is less than that of the CCRA registers. Therefore when PTCCLR is high no PTMPF interrupt request flag will be generated. In the Compare Match Output Mode, the CCRA cannot be cleared to zero.

If the CCRA bits are all zero, the counter will overflow when it reaches its maximum 16-bit, FFFF Hex, value, however here the PTMAF interrupt request flag will not be generated.

As the name of the mode suggests, after a comparison is made, the PTM output pin, will change state. The PTM output pin condition however only changes state when a PTMAF interrupt request flag is generated after a compare match occurs from Comparator A. The PTMPF interrupt request flag, generated from a compare match occurs from Comparator P, will have no effect on the PTM output pin. The way in which the PTM output pin changes state are determined by the condition of the PTIO1 and PTIO0 bits in the PTMC1 register. The PTM output pin can be selected using the PTIO1 and PTIO0 bits to go high, to go low or to toggle from its present condition when a compare match occurs from Comparator A. The initial condition of the PTM output pin, which is setup after the PTON bit changes from low to high, is setup using the PTOC bit. Note that if the PTIO1 and PTIO0 bits are zero then no pin change will take place.

Page 98: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 98 November 18, 2019 Rev. 1.10 99 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

0xFFFF

CCRP

CCRA

PTON

PTPAU

PTPOL

CCRP Int. Flag PTMPF

CCRA Int. Flag PTMAF

PTM O/P Pin

Time

CCRP=0

CCRP > 0

Counter overflowCCRP > 0

Counter cleared by CCRP value

Pause

Resume

Stop

Counter Restart

PTCCLR = 0; PTM[1:0] = 00

Output pin set to initial Level Low if PTOC=0

Output Toggle with PTMAF flag

Note PTIO [1:0] = 10Active High Output selectHere PTIO [1:0] = 11

Toggle Output select

Output not affected by PTMAF flag. Remains High until reset by PTON bit

Output PinReset to Initial value

Output controlled by other pin-shared function

Output Invertswhen PTPOL is high

Compare Match Output Mode – PTCCLR=0

Note: 1. With PTCCLR=0 a Comparator P match will clear the counter2. The PTM output pin is controlled only by the PTMAF flag3. The output pin is reset to its initial state by a PTON bit rising edge

Page 99: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 98 November 18, 2019 Rev. 1.10 99 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

0xFFFF

CCRP

CCRA

PTON

PTPAU

PTPOL

CCRP Int. Flag PTMPF

CCRA Int. FlagPTMAF

PTM O/P Pin

Time

CCRA=0

CCRA = 0Counter overflowCCRA > 0 Counter cleared by CCRA value

Pause

Resume

Stop Counter Restart

PTCCLR = 1; PTM[1:0] = 00

Output pin set to initial Level Low if PTOC=0

Output Toggle with PTMAF flag

Note PTIO [1:0] = 10 Active High Output selectHere PTIO [1:0] = 11

Toggle Output select

Output not affected by PTMAF flag. Remains High until reset by PTON bit

Output PinReset to Initial value

Output controlled by other pin-shared function

Output Invertswhen PTPOL is high

PTMnPF not generated

No PTMAF flag generated on CCRA overflow

Output does not change

Compare Match Output Mode – PTCCLR=1

Note: 1. With PTCCLR=1 a Comparator A match will clear the counter2. The PTM output pin is controlled only by the PTMAF flag3. The output pin is reset to its initial state by a PTON bit rising edge4. A PTMPF flag is not generated when PTCCLR=1

Page 100: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 100 November 18, 2019 Rev. 1.10 101 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Timer/Counter ModeTo select this mode, bits PTM1 and PTM0 in the PTMC1 register should be set to 11 respectively. The Timer/Counter Mode operates in an identical way to the Compare Match Output Mode generating the same interrupt flags. The exception is that in the Timer/Counter Mode the PTM output pin is not used. Therefore the above description and Timing Diagrams for the Compare Match Output Mode can be used to understand its function. As the PTM output pin is not used in this mode, the pin can be used as a normal I/O pin or other pin-shared function.

PWM Output Mode To select this mode, bits PTM1 and PTM0 in the PTMC1 register should be set to 10 respectively and also the PTIO1 and PTIO0 bits should be set to 10 respectively. The PWM function within the PTM is useful for applications which require functions such as motor control, heating control, illumination control etc. By providing a signal of fixed frequency but of varying duty cycle on the PTM output pin, a square wave AC waveform can be generated with varying equivalent DC RMS values.

As both the period and duty cycle of the PWM waveform can be controlled, the choice of generated waveform is extremely flexible. In the PWM Output Mode, the PTCCLR bit has no effect on the PWM operation. Both of the CCRA and CCRP registers are used to generate the PWM waveform, one register is used to clear the internal counter and thus control the PWM waveform frequency, while the other one is used to control the duty cycle. The PWM waveform frequency and duty cycle can therefore be controlled by the values in the CCRA and CCRP registers.

An interrupt flag, one for each of the CCRA and CCRP, will be generated when a compare match occurs from either Comparator A or Comparator P. The PTOC bit in the PTMC1 register is used to select the required polarity of the PWM waveform while the two PTIO1 and PTIO0 bits are used to enable the PWM output or to force the PTM output pin to a fixed high or low level. The PTPOL bit is used to reverse the polarity of the PWM output waveform.

• 16-bit PTM, PWM Output Mode, Edge-aligned Mode

CCRP 1~65535 0Period 1~65535 65536 Duty CCRA

If fSYS=8MHz, PTM clock source select fSYS/4, CCRP=512 and CCRA=128,

The PTM PWM output frequency=(fSYS/4)/512=fSYS/2048=3.9063kHz, duty=128/512=25%.

If the Duty value defined by the CCRA register is equal to or greater than the Period value, then the PWM output duty is 100%.

Page 101: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 100 November 18, 2019 Rev. 1.10 101 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

PTON

PTPAU

PTPOL

CCRP Int. Flag PTMPF

CCRA Int. Flag PTMAF

PTM O/P Pin(PTOC=1)

Time

Counter cleared by CCRP

Pause Resume Counter Stop if PTON bit low

Counter Reset when PTON returns high

PTM[1:0] = 10

PWM Duty Cycle set by CCRA PWM resumes

operationOutput controlled by other pin-shared function Output Inverts

When PTPOL = 1PWM Period set by CCRP

PTM O/P Pin(PTOC=0)

PWM Output Mode

Note: 1. Counter cleared by CCRP2. A counter clear sets the PWM Period3. The internal PWM function continues running even when PTIO[1:0]=00 or 014. The PTCCLR bit has no influence on PWM operation

Page 102: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 102 November 18, 2019 Rev. 1.10 103 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Single Pulse Output ModeTo select this mode, bits PTM1 and PTM0 in the PTMC1 register should be set to 10 respectively and also the PTIO1 and PTIO0 bits should be set to 11 respectively. The Single Pulse Output Mode, as the name suggests, will generate a single shot pulse on the PTM output pin.

The trigger for the pulse output leading edge is a low to high transition of the PTON bit, which can be implemented using the application program. However in the Single Pulse Output Mode, the PTON bit can also be made to automatically change from low to high using the external PTCK pin, which will in turn initiate the Single Pulse output. When the PTON bit transitions to a high level, the counter will start running and the pulse leading edge will be generated. The PTON bit should remain high when the pulse is in its active state. The generated pulse trailing edge will be generated when the PTON bit is cleared to zero, which can be implemented using the application program or when a compare match occurs from Comparator A.

However a compare match from Comparator A will also automatically clear the PTON bit and thus generate the Single Pulse output trailing edge. In this way the CCRA value can be used to control the pulse width. A compare match from Comparator A will also generate a PTM interrupt. The counter can only be reset back to zero when the PTON bit changes from low to high when the counter restarts. In the Single Pulse Output Mode CCRP is not used. The PTCCLR bit is not used in this Mode.

STON bit0 → 1

S/W Command SET“STON”

orSTCK Pin Transition

STON bit1 → 0

CCRA Trailing Edge

S/W Command CLR“STON”

orCCRA Compare Match

STP Output Pin

Pulse Width = CCRA Value

CCRA Leading Edge

Single Pulse Generation

Page 103: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 102 November 18, 2019 Rev. 1.10 103 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

CCRP

CCRA

PTON

PTPAU

PTPOL

CCRP Int. Flag PTMPF

CCRA Int. Flag PTMAF

PTM O/P Pin(PTOC=1)

Time

Counter stopped by CCRA

PauseResume Counter Stops by

software

Counter Reset when PTON returns high

Pulse Width set by CCRA

Output Invertswhen PTPOL = 1

No CCRP Interrupts generated

PTM O/P Pin(PTOC=0)

PTCK pin

Software Trigger

Cleared by CCRA match

PTCK pin Trigger

Auto. set by PTCK pin

Software Trigger

Software Clear

Software TriggerSoftware

Trigger

PTM [1:0] = 10; PTIO [1:0] = 11

Single Pulse Output Mode

Note: 1. Counter stopped by CCRA2. CCRP is not used3. The pulse is triggered by the PTCK pin or by setting the PTON bit high4. A PTCK pin active edge will automatically set the PTON bit high 5. In the Single Pulse Output Mode, PTIO[1:0] must be set to “11” and cannot be changed

Page 104: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 104 November 18, 2019 Rev. 1.10 105 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Capture Input ModeTo select this mode bits PTM1 and PTM0 in the PTMC1 register should be set to 01 respectively. This mode enables external signals to capture and store the present value of the internal counter and can therefore be used for applications such as pulse width measurements. The external signal is supplied on the PTPI pin, DEMO1 or PTCK pin which is selected using the PTCAPTS bit in the PTMC1 register and PTPIS bit in the DCMISC register. The input pin active edge can be either a rising edge, a falling edge or both rising and falling edges; the active edge transition type is selected using the PTIO1 and PTIO0 bits in the PTMC1 register. The counter is started when the PTON bit changes from low to high which is initiated using the application program.

When the required edge transition appears on the PTPI pin, DEMO1 or PTCK pin the present value in the counter will be latched into the CCRA registers and a PTM interrupt generated. Irrespective of what events occur on the PTPI pin, DEMO1 or PTCK pin, the counter will continue to free run until the PTON bit changes from high to low. When a CCRP compare match occurs the counter will reset back to zero; in this way the CCRP value can be used to control the maximum counter value. When a CCRP compare match occurs from Comparator P, a PTM interrupt will also be generated. Counting the number of overflow interrupt signals from the CCRP can be a useful method in measuring long pulse widths. The PTIO1 and PTIO0 bits can select the active trigger edge on the PTPI pin, DEMO1 or PTCK pin to be a rising edge, falling edge or both edge types. If the PTIO1 and PTIO0 bits are both set high, then no capture operation will take place irrespective of what happens on the PTPI or PTCK pin, however it must be noted that the counter will continue to run.

As the PTPI or PTCK pin is pin shared with other functions, care must be taken if the PTM is in the Capture Input Mode. This is because if the pin is setup as an output, then any transitions on this pin may cause an input capture operation to be executed. The PTCCLR, PTOC and PTPOL bits are not used in this Mode.

Page 105: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 104 November 18, 2019 Rev. 1.10 105 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Counter Value

YY

CCRP

PTON

PTPAU

CCRP Int. Flag PTMPF

CCRA Int. Flag PTMAF

CCRA Value

Time

Counter cleared by CCRP

PauseResume

Counter Reset

PTM[1:0] = 01

PTM Capture from PTPI pin, DEMO1or PTCK pin

XX

Counter Stop

PTIO [1:0] Value

Active edge

Active edge Active edge

00 - Rising edge 01 - Falling edge 10 - Both edges 11 - Disable Capture

XX YY XX YY

Capture Input Mode

Note: 1. PTM[1:0]=01 and active edge set by the PTIO[1:0] bits2. A PTM Capture input pin active edge transfers the counter value to CCRA3. PTCCLR bit not used4. No output function – PTOC and PTPOL bits are not used 5. CCRP determines the counter value and the counter has a maximum count value when CCRP is equal to

zero.

Page 106: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 106 November 18, 2019 Rev. 1.10 107 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Analog to Digital ConverterThe need to interface to real world analog signals is a common requirement for many electronic systems. However, to properly process these signals by a microcontroller, they must first be converted into digital signals by A/D converters. By integrating the A/D conversion electronic circuitry into the microcontroller, the need for external components is reduced significantly with the corresponding follow-on benefits of lower costs and reduced component space requirements.

A/D Converter OverviewThis device contains a multi-channel analog to digital converter which can directly interface to external analog signals, such as that from sensors or other control signals and convert these signals directly into a 12-bit digital value. The external or internal analog signal to be converted is determined by the SAINS3~SAINS0 bits together with the SACS3~SACS0 bits. Note that when the internal analog signal is to be converted using the SAINS bit field, the external channel analog input will be automatically be switched off. More detailed information about the A/D input signal is described in the “A/D Converter Control Registers” and “A/D Converter Input Signals” sections respectively.

External Input Channels Internal Signal A/D Channel Select Bits

AN0~AN5 OCPAO, AVDD, AVDD/2, AVDD/4,VR, VR/2, VR/4

SAINS3~SAINS0,SACS3~SACS0

The accompanying block diagram shows the overall internal structure of the A/D converter, together with its associated registers.

Pin-shared Selection SACS3~SACS0

SAINS3~SAINS0

A/D Converter

START ADBZ ADCEN

AVSS

A/D Clock

÷ 2N

(N=0~7)

fSYS

SACKS2~SACKS0

AVDD

ADCEN

SADOL

SADOH

AN0AN1

AN5 A/D Reference Voltage

A/D DataRegisters

VDDVDD/2VDD/4

VR

VR/2VR/4

ADRFS

AVDD

SAVRS1~SAVRS0

VREF

Pin-shared Selection

PGAVRIVBGREF

PGAGS1~PGAGS0(Gain=1/1.667/2.5/3.333)

ADPGAEN

VRVREFI

PGAIS

Pin-shared Selection

OCPAO

A/D Converter Structure

Page 107: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 106 November 18, 2019 Rev. 1.10 107 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

A/D Converter Register DescriptionOverall operation of the A/D converter is controlled using five registers. A read only register pair exists to store the A/D converter data 12-bit value. The remaining three registers are control registers which setup the operating and control function of the A/D converter.

Register Name

Bit7 6 5 4 3 2 1 0

SADOL (ADRFS=0) D3 D2 D1 D0 — — — —

SADOL (ADRFS=1) D7 D6 D5 D4 D3 D2 D1 D0

SADOH (ADRFS=0) D11 D10 D9 D8 D7 D6 D5 D4

SADOH (ADRFS=1) — — — — D11 D10 D9 D8

SADC0 START ADBZ ADCEN ADRFS SACS3 SACS2 SACS1 SACS0SADC1 SAINS3 SAINS2 SAINS1 SAINS0 — SACKS2 SACKS1 SACKS0SADC2 ADPGAEN — — PGAIS SAVRS1 SAVRS0 PGAGS1 PGAGS0VBGRC — — — — — — — VBGREN

A/D Converter Register List

A/D Converter Data Registers – SADOL, SADOHAs this device contains an internal 12-bit A/D converter, it requires two data registers to store the converted value. These are a high byte register, known as SADOH, and a low byte register, known as SADOL. After the conversion process takes place, these registers can be directly read by the microcontroller to obtain the digitised conversion value. As only 12 bits of the 16-bit register space is utilised, the format in which the data is stored is controlled by the ADRFS bit in the SADC0 register as shown in the accompanying table. D0~D11 are the A/D conversion result data bits. Any unused bits will be read as zero. Note that A/D data registers contents will be unchanged if the A/D converter is disabled.

ADRFSSADOH SADOL

7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 00 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 01 0 0 0 0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0

A/D Converter Data Registers

A/D Converter Control Registers – SADC0, SADC1, SADC2, VBGRCTo control the function and operation of the A/D converter, three control registers known as SADC0~SADC2 are provided. These 8-bit registers define functions such as the selection of which analog channel is connected to the internal A/D converter, the digitised data format, the A/D clock source as well as controlling the start function and monitoring the A/D converter busy status. As the device contains only one actual analog to digital converter hardware circuit, each of the external or internal analog signal inputs must be routed to the converter. The SACS3~SACS0 bits in the SADC0 register are used to determine which external channel input is selected to be converted. The SAINS3~SAINS0 bits in the SADC1 register are used to determine that the analog signal to be converted comes from the internal analog signal or external analog channel input.

The relevant pin-shared function selection bits determine which pins on I/O Ports are used as analog inputs for the A/D converter input and which pins are not to be used as the A/D converter input. When the pin is selected to be an A/D input, its original function whether it is an I/O or other pin-shared function will be removed. In addition, any internal pull-high resistor connected to the pin will be automatically removed if the pin is selected to be an A/D converter input.

Page 108: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 108 November 18, 2019 Rev. 1.10 109 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• SADC0 Register

Bit 7 6 5 4 3 2 1 0Name START ADBZ ADCEN ADRFS SACS3 SACS2 SACS1 SACS0R/W R/W R R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 START: Start the A/D conversion0→1→0: Start

This bit is used to initiate an A/D conversion process. The bit is normally low but if set high and then cleared low again, the A/D converter will initiate a conversion process.

Bit 6 ADBZ: A/D converter busy flag0: No A/D conversion is in progress1: A/D conversion is in progress

This read only flag is used to indicate whether the A/D conversion is in progress or not. When the START bit is set from low to high and then to low again, the ADBZ flag will be set to 1 to indicate that the A/D conversion is initiated. The ADBZ flag will be cleared to 0 after the A/D conversion is complete.

Bit 5 ADCEN: A/D converter function enable control0: Disable1: Enable

This bit controls the A/D internal function. This bit should be set to one to enable the A/D converter. If the bit is set low, then the A/D converter will be switched off reducing the device power consumption. When the A/D converter function is disabled, the contents of the A/D data register pair known as SADOH and SADOL will be unchanged.

Bit 4 ADRFS: A/D converter data format select0: A/D converter data format → SADOH=D[11:4]; SADOL=D[3:0]1: A/D converter data format → SADOH=D[11:8]; SADOL=D[7:0]

This bit controls the format of the 12-bit converted A/D value in the two A/D data registers. Details are provided in the A/D data register section.

Bit 3~0 SACS3~SACS0: A/D converter external analog channel input select0000: AN00001: AN1 : :0100: AN40101: AN50110~1111: Non-existed channel, the input will be floating if selected

Page 109: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 108 November 18, 2019 Rev. 1.10 109 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• SADC1 Register

Bit 7 6 5 4 3 2 1 0Name SAINS3 SAINS2 SAINS1 SAINS0 — SACKS2 SACKS1 SACKS0R/W R/W R/W R/W R/W — R/W R/W R/WPOR 0 0 0 0 — 0 0 0

Bit 7~4 SAINS3~SAINS0: A/D converter input signal select0000: External input – External analog channel input0001: Internal input – Internal A/D converter power supply voltage AVDD

0010: Internal input – Internal A/D converter power supply voltage AVDD/20011: Internal input – Internal A/D converter power supply voltage AVDD/40100: External input – External analog channel input0101: Internal input – Internal A/D converter PGA output voltage VR

0110: Internal input – Internal A/D converter PGA output voltage VR/20111: Internal input – Internal A/D converter PGA output voltage VR/41000: Internal input – Internal A/D converter OCP circuit output OCPAO signal1001~1011: Reserved, connected to ground1100~1111: External input – External analog channel input

When the internal analog signal and the external signal are selected to be converted simultaneously, the external channel input signal will automatically be switched off regardless of the SACS3~SACS0 bit field value.

Bit 3 Unimplemented, read as “0”Bit 2~0 SACKS2~SACKS0: A/D conversion clock source select

000: fSYS

001: fSYS/2010: fSYS/4011: fSYS/8100: fSYS/16101: fSYS/32110: fSYS/64111: fSYS/128

These three bits are used to select the clock source for the A/D Converter.

Page 110: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 110 November 18, 2019 Rev. 1.10 111 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• SADC2 Register

Bit 7 6 5 4 3 2 1 0Name ADPGAEN — — PGAIS SAVRS1 SAVRS0 PGAGS1 PGAGS0R/W R/W — — R/W R/W R/W R/W R/WPOR 0 — — 0 0 0 0 0

Bit 7 ADPGAEN: PGA enable/disable control0: Disable1: Enable

When the PGA output VR is selected as A/D converter input or A/D converter reference voltage, the PGA needs to be enabled by setting this bit high. Otherwise the PGA needs to be disabled by clearing this bit to zero to conserve the power.

Bit 6~5 Unimplemented, read as “0”Bit 4 PGAIS: PGA input (VRI) select

0: External VREFI pin1: Internal independent reference voltage, VBGREF

When the external voltage on VREFI pin and the internal independent reference voltage VBGREF are selected as the PGA input simultaneously, the hardware will only choose the internal voltage VBGREF as the PGA input.

Bit 3~2 SAVRS1~SAVRS0: A/D converter reference voltage select00: Internal A/D converter power, AVDD

01: VREF pin1x: Internal PGA output voltage, VR

These bits are used to select the A/D converter reference voltage. When the internal A/D converter power or the internal PGA output voltage and the external input voltage on VREF pin are selected as the reference voltage simultaneously, the hardware will only choose the internal reference voltage as the A/D converter reference voltage.

Bit 1~0 PGAGS1~PGAGS0: PGA gain select00: Gain=101: Gain=1.667, VR=2V for VRI=VBGREF (PGAIS=1)10: Gain=2.5, VR=3V for VRI=VBGREF (PGAIS=1)11: Gain=3.333, VR=4V for VRI=VBGREF (PGAIS=1)

• VBGRC Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — — VBGRENR/W — — — — — — — R/WPOR — — — — — — — 0

Bit 7~1 Unimplemented, read as “0”Bit 0 VBGREN: Bandgap reference voltage control

0: Disable1: Enable

This bit is used to enable the internal Bandgap reference circuit. The internal Bandgap reference circuit should first be enabled before the VBGREF voltage is selected to be used. A specific start-up time is necessary for the Bandgap circuit to become stable and accurate.

A/D Converter Operation The START bit in the SADC0 register is used to start the AD conversion. When the microcontroller sets this bit from low to high and then low again, an analog to digital conversion cycle will be initiated.

The ADBZ bit in the SADC0 register is used to indicate whether the analog to digital conversion process is in progress or not. This bit will be automatically set to “1” by the microcontroller after an

Page 111: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 110 November 18, 2019 Rev. 1.10 111 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

A/D conversion is successfully initiated. When the A/D conversion is complete, the ADBZ will be cleared to “0”. In addition, the corresponding A/D interrupt request flag will be set in the interrupt control register, and if the interrupts are enabled, an appropriate internal interrupt signal will be generated. This A/D internal interrupt signal will direct the program flow to the associated A/D internal interrupt address for processing. If the A/D internal interrupt is disabled, the microcontroller can poll the ADBZ bit in the SADC0 register to check whether it has been cleared as an alternative method of detecting the end of an A/D conversion cycle.

The clock source for the A/D converter, which originates from the system clock fSYS, can be chosen to be either fSYS or a subdivided version of fSYS. The division ratio value is determined by the SACKS2~SACKS0 bits in the SADC1 register. Although the A/D clock source is determined by the system clock fSYS and by bits SACKS2~SACKS0, there are some limitations on the A/D clock source speed that can be selected. As the recommended range of permissible A/D clock period, tADCK, is from 0.5μs to 10μs, care must be taken for system clock frequencies. For example, as the system clock operates at a frequency of 8MHz, the SACKS2~SACKS0 bits should not be set to 000, 001 or 111. Doing so will give A/D clock periods that are less than the minimum A/D clock period which may result in inaccurate A/D conversion values. Refer to the following table for examples, where values marked with an asterisk * show special care must be taken, as the values may be exceeding the specified A/D Clock Period range.

fSYS

A/D Clock Period (tADCK)SACKS[2:0]

= 000(fSYS)

SACKS[2:0]= 001(fSYS/2)

SACKS[2:0]= 010(fSYS/4)

SACKS[2:0]= 011

(fSYS/8)

SACKS[2:0]= 100

(fSYS/16)

SACKS[2:0]= 101

(fSYS/32)

SACKS[2:0]= 110

(fSYS/64)

SACKS[2:0]= 111

(fSYS/128)1MHz 1μs 2μs 4μs 8μs 16μs * 32μs * 64μs * 128μs *2MHz 500ns 1μs 2μs 4μs 8μs 16μs * 32μs * 64μs *4MHz 250ns * 500ns 1μs 2μs 4μs 8μs 16μs * 32μs *8MHz 125ns * 250ns * 500ns 1μs 2μs 4μs 8μs 16μs *

12MHz 83ns * 167ns * 333ns * 667ns 1.33μs 2.67μs 5.33μs 10.67μs *16MHz 62.5ns * 125ns * 250ns * 500ns 1μs 2μs 4μs 8μs

A/D Clock Period Examples

Controlling the power on/off function of the A/D converter circuitry is implemented using the ADCEN bit in the SADC0 register. This bit must be set high to power on the A/D converter. When the ADCEN bit is set high to power on the A/D converter internal circuitry a certain delay, as indicated in the timing diagram, must be allowed before an A/D conversion is initiated. Even if no pins are selected for use as A/D inputs, if the ADCEN bit is high, then some power will still be consumed. In power conscious applications it is therefore recommended that the ADCEN is set low to reduce power consumption when the A/D converter function is not being used.

A/D Converter Reference VoltageThe reference voltage supply to the A/D converter can be supplied from the positive power supply pin, AVDD, or from an external reference source supplied on pin VREF, or from the internal PGA output voltage, VR. The desired selection is made using the SAVRS1 and SAVRS0 bits. When the SAVRS bit field is set to “00”, the A/D converter reference voltage will come from the AVDD. If the SAVRS bit field is set to “01”, the A/D converter reference voltage will come from the VREF pin. Otherwise, the A/D converter reference voltage will come from the PGA output, VR. As the VREF pin is pin-shared with other functions, when the VREF pin is selected as the reference voltage supply pin, the VREF pin-shared function control bits should be properly configured to disable other pin functions. In addition, if the program selects an external reference voltage on VREF pin and the internal reference voltage AVDD or VR as the A/D converter reference voltage, then the hardware will

Page 112: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 112 November 18, 2019 Rev. 1.10 113 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

only choose the internal reference voltage as the A/D converter reference voltage input. The analog input values must not be allowed to exceed the value of the selected reference voltage, VREF.

The A/D converter also has a VREFI pin which is one of PGA inputs for A/D converter reference. To select this PGA input signal, the PGAIS bit in the SADC2 register must be cleared to zero and the revelent pin-shared control bits should be properly configured. However, the PGA input can be aslo supplied from the internal independent reference voltage, VBG. If the application program selects the external voltage on the VREFI pin and an internal voltage VBG as PGA input simultaneously, then the hardware will only choose the internal voltage VBG as PGA input.

SAVRS[1:0] Reference Description00 AVDD Internal A/D converter power supply voltage01 VREF pin External A/D converter reference pin VREF

10 or 11 VR Internal A/D converter PGA output voltage

A/D Converter Reference Voltage Selection

A/D Converter Input SignalsAll the external A/D analog channel input pins are pin-shared with the I/O pins as well as other functions. The corresponding control bits for each A/D external input pin in the PxSn register determine whether the input pins are setup as A/D converter analog inputs or whether they have other functions. If the pin is setup to be as an A/D analog channel input, the original pin functions will be disabled. In this way, pins can be changed under program control to change their function between A/D inputs and other functions. All pull high resistors, which are setup through register programming, will be automatically disconnected if the pins are setup as A/D inputs. Note that it is not necessary to first setup the A/D pin as an input in the port control register to enable the A/D input as when the pin-shared function control bits enable an A/D input, the status of the port control register will be overridden.

If the SAINS3~SAINS0 bits are set to “0000”, “0100”, or “1100~1111”, the external analog channel input is selected to be converted and the SACS3~SACS0 bits can determine which actual external channel is selected to be converted. If the SAINS3~SAINS0 bits are set to “0001~0011”, the AVDD voltage with a specific ratio of 1, 1/2 or 1/4 is selected to be converted. If the SAINS3~SAINS0 bits are set to “0101~0111”, the PGA output voltage with a specific ratio of 1, 1/2 or 1/4 is selected to be converted. If the SAINS3~SAINS0 bits are set to “1000”, the OCP circuit output OCPAO signal is selected to be converted. Note that when the programs select external signal (AN0~AN5) and internal signal (AVDD, AVDD/2, AVDD/4, VR, VR/2, VR/4, OCPAO) as an A/D converter input signal simultaneously, then the hardware will only choose the internal signal as an A/D converter input, the external analog signal will be switched off automatically.

SAINS[3:0] SACS[3:0] Input Signals Description

0000, 0100, 1100~1111

0000~0101 AN0~AN5 External pin analog input0110~1111 — Non-existed channel, input is floating

0001 xxxx AVDD Internal A/D converter power supply voltage AVDD

0010 xxxx AVDD/2 Internal A/D converter power supply voltage AVDD/20011 xxxx AVDD/4 Internal A/D converter power supply voltage AVDD/40101 xxxx VR Internal A/D converter PGA output voltage VR

0110 xxxx VR/2 Internal A/D converter PGA output voltage VR/20111 xxxx AVR/4 Internal A/D converter PGA output voltage VR/4

1000 xxxx OCPAO Signal Internal A/D converter OCP circuit output OCPAO signal

1001~1011 xxxx — Reserved, connected to ground.

A/D Converter Input Signal Selection

Page 113: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 112 November 18, 2019 Rev. 1.10 113 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Conversion Rate and Timing DiagramA complete A/D conversion contains two parts, data sampling and data conversion. The data sampling which is defined as tADS takes 4 A/D clock cycles and the data conversion takes 12 A/D clock cycles. Therefore a total of 16 A/D clock cycles for an external input A/D conversion which is defined as tADC are necessary.

Maximum single A/D conversion rate = A/D clock period ÷ 16

The accompanying diagram shows graphically the various stages involved in an analog to digital conversion process and its associated timing. After an A/D conversion process has been initiated by the application program, the microcontroller internal hardware will begin to carry out the conversion, during which time the program can continue with other functions. The time taken for the A/D conversion is 16 tADCK clock cycles where tADCK is equal to the A/D clock period.

ADCEN

START

ADBZ

SACS[3:0]

off on off ontON2ST

tADS

A/D sampling timetADS

A/D sampling time

Start of A/D conversion Start of A/D conversion Start of A/D conversion

End of A/D conversion

End of A/D conversion

tADCA/D conversion time

tADCA/D conversion time

tADCA/D conversion time

0011B 0010B 0000B 0001B

A/D channel switch(SAINS[3:0]=0000B)

A/D Conversion Timing – External Channel Input

Summary of A/D Conversion StepsThe following summarises the individual steps that should be executed in order to implement an A/D conversion process.

• Step 1Select the required A/D conversion clock by correctly programming bits SACKS2~SACKS0 in the SADC1 register.

• Step 2Enable the A/D by setting the ADCEN bit in the SADC0 register to one.

• Step 3Select which signal is to be connected to the internal A/D converter by correctly configuring the SAINS3~SAINS0 bits in the SADC1 register and the SACS3~SACS0 bits in the SADC0 register.Select the external channel input to be converted, go to Step 4.Select the internal analog signal to be converted, go to Step 5.

• Step 4If the A/D input signal comes from the external channel input selected by configuring the SAINS bit field, the corresponding pins should be configured as A/D input function by configuring the relevant pin-shared function control bits. The desired analog channel then should be selected by configuring the SACS bit field. After this step, go to Step 6.

• Step 5If the A/D input signal comes from the internal analog signal, the SAINS bit field should be properly configured and then the external channel input will automatically be disconnected regardless of the SACS bit field value. After this step, go to Step 6.

Page 114: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 114 November 18, 2019 Rev. 1.10 115 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• Step 6Select the reference voltage source by configuring the SAVRS1~SAVRS0 bits in the SADC2 register. Enable the PGA, select the PGA input signal and the desired PGA gain if the PGA output voltage or its division is selected as the A/D converter reference voltage.

• Step 7Select A/D converter output data format by setting the ADRFS bit in the SADC0 register.

• Step 8If A/D conversion interrupt is used, the interrupt control registers must be correctly configured to ensure the A/D interrupt function is active. The master interrupt control bit, EMI, and relevant Multi-function Interrupt enable bit, MFnE, and the A/D conversion interrupt control bit, ADE, must both be set high in advance.

• Step 9The A/D conversion procedure can now be initialized by setting the START bit from low to high and then low again.

• Step 10If A/D conversion is in progress, the ADBZ flag will be set high. After the A/D conversion process is complete, the ADBZ flag will go low and then the output data can be read from SADOH and SADOL registers.

Note: When checking for the end of the conversion process, if the method of polling the ADBZ bit in the SADC0 register is used, the interrupt enable step above can be omitted.

Programming ConsiderationsDuring microcontroller operations where the A/D converter is not being used, the A/D internal circuitry can be switched off to reduce power consumption, by clearing bit ADCEN to 0 in the SADC0 register. When this happens, the internal A/D converter circuits will not consume power irrespective of what analog voltage is applied to their input lines. If the A/D converter input lines are used as normal I/Os, then care must be taken as if the input voltage is not at a valid logic level, then this may lead to some increase in power consumption.

A/D Conversion FunctionAs the device contains a 12-bit A/D converter, its full-scale converted digitised value is equal to 0FFFH. Since the full-scale analog input value is equal to the actual A/D converter reference voltage, VREF, this gives a single bit analog input value of VREF divided by 4096.

1 LSB=VREF ÷ 4096

The A/D Converter input voltage value can be calculated using the following equation:

A/D input voltage=A/D output digital value × (VREF ÷ 4096)

The diagram shows the ideal transfer function between the analog input value and the digitised output value for the A/D converter. Except for the digitised zero value, the subsequent digitised values will change at a point 0.5 LSB below where they would change without the offset, and the last full scale digitised value will change at a point 1.5 LSB below the VREF level. Note that here the VREF voltage is the actual A/D converter reference voltage determined by the SAVRS field.

Page 115: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 114 November 18, 2019 Rev. 1.10 115 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

FFFH

FFEH

FFDH

03H

02H

01H

0 1 2 3 4093 4094 4095 4096

VREF4096

Analog Input Voltage

A/D Conversion Result

1.5 LSB

0.5 LSB

Ideal A/D Transfer Function

A/D Conversion Programming ExamplesThe following two programming examples illustrate how to setup and implement an A/D conversion. In the first example, the method of polling the ADBZ bit in the SADC0 register is used to detect when the conversion cycle is complete, whereas in the second example, the A/D interrupt is used to determine when the conversion is complete.

Example: Using an ADBZ polling method to detect the end of conversionclr ADE ; disable ADC interruptmov a,03Hmov SADC1,a ;selectfSYS/8 as A/D clock set ADCENmov a,03h ;setupPAS0toconfigurepinAN0mov PAS0,amov a,20hmov SADC0,a ;enableandconnectAN0channeltoA/Dconverter : :start_conversion: clr START ;highpulseonstartbittoinitiateconversion set START ;resetA/D clr START ;startA/Dpolling_EOC: sz ADBZ ;polltheSADC0registerADBZbittodetectendofA/D ; conversion jmp polling_EOC ;continuepolling mov a,SADOL ;readlowbyteconversionresultvalue mov SADOL_buffer,a ;saveresulttouserdefinedregister mov a,SADOH ;readhighbyteconversionresultvalue mov SADOH_buffer,a ;saveresulttouserdefinedregister : : jmp start_conversion ;startnextA/D conversion

Page 116: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 116 November 18, 2019 Rev. 1.10 117 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Example: Using the interrupt method to detect the end of conversionclr ADE ; disable ADC interruptmov a,03Hmov SADC1,a ;selectfSYS/8 as A/D clock set ADCENmov a,03h ;setupPAS0toconfigurepinAN0mov PAS0,amov a,20hmov SADC0,a ;enableandconnectAN0channeltoA/Dconverter : :start_conversion: clr START ;highpulseonSTARTbittoinitiateconversion set START ;resetA/D clr START ;startA/D clr ADF ;clearADCinterruptrequestflag set ADE ; enable ADC interrupt set EMI ;enableglobalinterrupt : : ; ADC interrupt service routineADC_ISR: mov acc_stack,a ;saveACCtouserdefinedmemory mov a,STATUS mov status_stack,a ;saveSTATUStouserdefinedmemory : : mov a,SADOL ;readlowbyteconversionresultvalue mov SADOL_buffer,a ;saveresulttouserdefinedregister mov a,SADOH ;readhighbyteconversionresultvalue mov SADOH_buffer,a ;saveresulttouserdefinedregister : :EXIT_INT_ISR: mov a,status_stack mov STATUS,a ;restoreSTATUSfromuserdefinedmemory mov a,acc_stack ;restoreACCfromuserdefinedmemory reti

Page 117: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 116 November 18, 2019 Rev. 1.10 117 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

I2C InterfaceThe I2C interface is used to communicate with external peripheral devices such as sensors, EEPROM memory etc. Originally developed by Philips, it is a two line low speed serial interface for synchronous serial data transfer. The advantage of only two lines for communication, relatively simple communication protocol and the ability to accommodate multiple devices on the same bus has made it an extremely popular interface type for many applications.

Device Slave

Device Master

DeviceSlave

VDD

SDASCL

I2C Master/Slave Bus Connection

I2C Interface OperationThe I2C serial interface is a two line interface, a serial data line, SDA, and serial clock line, SCL. As many devices may be connected together on the same bus, their outputs are both open drain types. For this reason it is necessary that external pull-high resistors are connected to these outputs. Note that no chip select line exists, as each device on the I2C bus is identified by a unique address which will be transmitted and received on the I2C bus.

When two devices communicate with each other on the bidirectional I2C bus, one is known as the master device and one as the slave device. Both master and slave can transmit and receive data, however, it is the master device that has overall control of the bus. For this device, which only operates in slave mode, there are two methods of transferring data on the I2C bus, the slave transmit mode and the slave receive mode.

It is suggested that the user should not allow the device to enter IDLE or SLEEP mode by application program during processing I2C communication.

If the pin is configured to SDA or SCL function of I2C interface, the pin is configured to open-collect Input/Output port and its Pull-high function can be enabled by programming the related Generic Pull-high Control Register.

START signal from Master

Send slave addressand R/W bit from Master

Acknowledge from slave

Send data byte from Master

Acknowledge from slave

STOP signal from Master

I2C Interface Operation

Page 118: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 118 November 18, 2019 Rev. 1.10 119 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Shift Register

Transmit/ReceiveControl Unit

fSYS

fSUB

Data Bus

I2C Address Register(IICA)

I2C Data Register(IICD)

Address Comparator

Read/Write Slave IICSRW

Detect Start or Stop IICHBB

Time-outControl

I2CTOF

Address Match–IICHAASI2C Interrupt

Debounce Circuitry

SCL Pin

MUX IICTXAK

Data out MSB

I2CTOEN

Address Match

I2CDBNC[1:0]

SDA PinData in MSB

Direction ControlIICHTX

8-bit Data Transfer Complete–IICHCF

I2C Block Diagram

The I2CDBNC1 and I2CDBNC0 bits determine the debounce time of the I2C interface. This uses the system clock to in effect add a debounce time to the external clock to reduce the possibility of glitches on the clock line causing erroneous operation. The debounce time, if selected, can be chosen to be either 2 or 4 system clocks. To achieve the required I2C data transfer speed, there exists a relationship between the system clock, fSYS, and the I2C debounce time. For either the I2C Standard or Fast mode operation, users must take care of the selected system clock frequency and the configured debounce time to match the criterion shown in the following table.

I2C Debounce Time Selection

I2C Standard Mode (100kHz)

I2C Fast Mode (400kHz)

No Debounce fSYS > 2MHz fSYS > 5MHz2 system clock debounce fSYS > 4MHz fSYS > 10MHz4 system clock debounce fSYS > 8MHz fSYS > 20MHz

I2C Minimum fSYS Frequency Requirements

I2C RegistersThere are four control registers associated with the I2C bus, IICC0, IICC1, IICA and I2CTOC, and one data register, IICD. Further explanation on each of the bits is given below. The I2CTOC register is described in the I2C Time-out Control section.

Register Name

Bit7 6 5 4 3 2 1 0

IICC0 — — — — I2CDBNC1 I2CDBNC0 I2CEN —IICC1 IICHCF IICHAAS IICHBB IICHTX IICTXAK IICSRW IICRNIC IICRXAKIICD IICD7 IICD6 IICD5 IICD4 IICD3 IICD2 IICD1 IICD0IICA IICA6 IICA5 IICA4 IICA3 IICA2 IICA1 IICA0 —

I2CTOC I2CTOEN I2CTOF I2CTOS5 I2CTOS4 I2CTOS3 I2CTOS2 I2CTOS1 I2CTOS0

I2C Register List

The IICD register is used to store the data being transmitted and received on the I2C bus. Before the microcontroller writes data to the I2C bus, the actual data to be transmitted must be placed in the IICD register. After the data is received from the I2C bus, the microcontroller can read it from the IICD register. Any transmission or reception of data from the I2C bus must be made via the IICD register.

Page 119: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 118 November 18, 2019 Rev. 1.10 119 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• IICD Register

Bit 7 6 5 4 3 2 1 0Name IICD7 IICD6 IICD5 IICD4 IICD3 IICD2 IICD1 IICD0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR x x x x x x x x

“x”: unknown

Bit 7~0 IICD7~IICD0: I2C Data Buffer bit 7~bit 0The IICA register is the location where the 7-bit slave address of the slave device is stored. When a master device, which is connected to the I2C bus, sends out an address, which matches the slave address in the IICA register, the slave device will be selected.

• IICA Register

Bit 7 6 5 4 3 2 1 0Name IICA6 IICA5 IICA4 IICA3 IICA2 IICA1 IICA0 —R/W R/W R/W R/W R/W R/W R/W R/W —POR 0 0 0 0 0 0 0 —

Bit 7~1 IICA6~IICA0: I2C slave addressIICA6~IICA0 is the I2C slave address bit 6~bit 0. Bits 7~1 of the IICA register define the device slave address. Bit 0 is not defined.

Bit 0 Unimplemented, read as “0”There are two control registers for the I2C interface, IICC0 and IICC1. The register IICC0 is used for I2C communication settings. The IICC1 register contains the relevant flags which are used to indicate the I2C communication status.

• IICC0 Register

Bit 7 6 5 4 3 2 1 0Name — — — — I2CDBNC1 I2CDBNC0 I2CEN —R/W — — — — R/W R/W R/W —POR — — — — 0 0 0 —

Bit 7~4 Unimplemented, read as “0”Bit 3~2 I2CDBNC1~I2CDBNC0: I2C Debounce Time Selection

00: No debounce01: 2 system clock debounce10: 4 system clock debounce11: 4 system clock debounce

Bit 1 I2CEN: I2C enable0: Disable 1: Enable

The bit is the overall on/off control for the I2C interface. When the I2CEN bit is cleared to zero to disable the I2C interface, the SDA and SCL lines will lose their I2C function and the I2C operating current will be reduced to a minimum value. When the bit is high the I2C interface is enabled. If the I2CEN bit changes from low to high, the contents of the I2C control bits such as IICHTX and IICTXAK will remain at the previous settings and should therefore be first initialised by the application program while the relevant I2C flags such as IICHCF, HAAS, IICHBB, IICSRW and IICRXAK will be set to their default states.

Bit 0 Unimplemented, read as “0”

Page 120: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 120 November 18, 2019 Rev. 1.10 121 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• IICC1 Register

Bit 7 6 5 4 3 2 1 0Name IICHCF IICHAAS IICHBB IICHTX IICTXAK IICSRW IICRNIC IICRXAKR/W R R R R/W R/W R R/W RPOR 1 0 0 0 0 0 0 1

Bit 7 IICHCF: I2C Bus data transfer completion flag0: Data is being transferred1: Completion of an 8-bit data transfer

The IICHCF flag is the data transfer flag. This flag will be zero when data is being transferred. Upon completion of an 8-bit data transfer the flag will go high and an interrupt will be generated.Below is an example of the flow of a two-byte I2C data transfer.First, I2C slave device receive a start signal from I2C master and then IICHCF bit is automatically cleared to zero.Second, I2C slave device finish receiving the 1st data byte and then IICHCF bit is automatically set to one.Third, user read the 1st data byte from IICD register by the application program and then IICHCF bit is automatically cleared to zero.Fourth, I2C slave device finish receiving the 2nd data byte and then IICHCF bit is automatically set to one and so on.Finally, I2C slave device receive a stop signal from I2C master and then IICHCF bit is automatically set to one.

Bit 6 IICHAAS: I2C Bus address match flag0: Not address match1: Address match

The IICHAAS flag is the address match flag. This flag is used to determine if the slave device address is the same as the master transmit address. If the addresses match then this bit will be high, if there is no match then the flag will be low.

Bit 5 IICHBB: I2C Bus busy flag0: I2C Bus is not busy1: I2C Bus is busy

The IICHBB flag is the I2C busy flag. This flag will be “1” when the I2C bus is busy which will occur when a START signal is detected. The flag will be set to “0” when the bus is free which will occur when a STOP signal is detected.

Bit 4 IICHTX: Select I2C slave device is transmitter or receiver0: Slave device is the receiver1: Slave device is the transmitter

Bit 3 IICTXAK: I2C Bus transmit acknowledge flag0: Slave send acknowledge flag1: Slave do not send acknowledge flag

The IICTXAK bit is the transmit acknowledge flag. After the slave device receipt of 8-bits of data, this bit will be transmitted to the bus on the 9th clock from the slave device. The slave device must always set IICTXAK bit to “0” before further data is received.

Bit 2 IICSRW: I2C Slave Read/Write flag0: Slave device should be in receive mode1: Slave device should be in transmit mode

The IICSRW flag is the I2C Slave Read/Write flag. This flag determines whether the master device wishes to transmit or receive data from the I2C bus. When the transmitted address and slave address is match, that is when the IICHAAS flag is set high, the slave device will check the IICSRW flag to determine whether it should be in transmit mode or receive mode. If the IICSRW flag is high, the master is requesting to read data from the bus, so the slave device should be in transmit mode. When the

Page 121: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 120 November 18, 2019 Rev. 1.10 121 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

IICSRW flag is zero, the master will write data to the bus, therefore the slave device should be in receive mode to read this data.

Bit 1 IICRNIC: I2C running using Internal Clock Control0: I2C running using internal clock1: I2C running not using internal clock

The I2C module can run without using internal clock, and generate an interrupt if the I2C interrupt is enabled, which can be used in SLEEP or IDLE (SLOW) Mode.

Bit 0 IICRXAK: I2C Bus Receive acknowledge flag0: Slave receive acknowledge flag1: Slave do not receive acknowledge flag

The IICRXAK flag is the receiver acknowledge flag. When the IICRXAK flag is “0”, it means that a acknowledge signal has been received at the 9th clock, after 8 bits of data have been transmitted. When the slave device in the transmit mode, the slave device checks the IICRXAK flag to determine if the master receiver wishes to receive the next byte. The slave transmitter will therefore continue sending out data until the IICRXAK flag is “1”. When this occurs, the slave transmitter will release the SDA line to allow the master to send a STOP signal to release the I2C Bus.

I2C Bus Communication Communication on the I2C bus requires four separate steps, a START signal, a slave device address transmission, a data transmission and finally a STOP signal. When a START signal is placed on the I2C bus, all devices on the bus will receive this signal and be notified of the imminent arrival of data on the bus. The first seven bits of the data will be the slave address with the first bit being the MSB. If the address of the slave device matches that of the transmitted address, the IICHAAS bit in the IICC1 register will be set and an I2C interrupt will be generated. After entering the interrupt service routine, the slave device must first check the condition of the IICHAAS and I2CTOF bits to determine whether the interrupt source originates from an address match or from the completion of an 8-bit data transfer completion or the I2C bus time-out occurrence. During a data transfer, note that after the 7-bit slave address has been transmitted, the following bit, which is the 8th bit, is the read/write bit whose value will be placed in the IICSRW bit. This bit will be checked by the slave device to determine whether to go into transmit or receive mode. Before any transfer of data to or from the I2C bus, the microcontroller must initialise the bus, the following are steps to achieve this:

• Step 1Configure the pin-shared I/O ports to I2C function pins and set the I2CEN bit in the IICC0 register to “1” to enable the I2C bus.

• Step 2Write the slave address of the device to the I2C bus address register IICA.

• Step 3Set IICE and the corresponding interrupt enable bit of the interrupt control registers to enable the I2C interrupt and the Multi-function interrupt.

Page 122: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 122 November 18, 2019 Rev. 1.10 123 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Start

Write Slave Address to IICA

I2C Bus Interrupt=?

CLR IICEPoll IICF to decide

when to go to I2C Bus ISR

Go to Main Program Go to Main Program

YesNo

Configure the pin-shared I/O portsto I2C function

SET I2CEN

SET IICE Wait for Interrupt

I2C Bus Initialisation Flow Chart

I2C Bus Start Signal The START signal can only be generated by the master device connected to the I2C bus and not by the slave device. This START signal will be detected by all devices connected to the I2C bus. When detected, this indicates that the I2C bus is busy and therefore the IICHBB bit will be set. A START condition occurs when a high to low transition on the SDA line takes place when the SCL line remains high.

I2C Slave AddressThe transmission of a START signal by the master will be detected by all devices on the I2C bus. To determine which slave device the master wishes to communicate with, the address of the slave device will be sent out immediately following the START signal. All slave devices, after receiving this 7-bit address data, will compare it with their own 7-bit slave address. If the address sent out by the master matches the internal address of the microcontroller slave device, then an internal I2C bus interrupt signal will be generated. The next bit following the address, which is the 8th bit, defines the read/write status and will be saved to the IICSRW bit of the IICC1 register. The slave device will then transmit an acknowledge bit, which is a low level, as the 9th bit. The slave device will also set the status flag IICHAAS when the addresses match.

As an I2C bus interrupt can come from three sources, when the program enters the interrupt subroutine, the IICHAAS and I2CTOF bits should be examined to see whether the interrupt source has come from a matching slave address or from the completion of a data byte transfer or the I2C time-out occurrence. When a slave address is matched, the device must be placed in either the transmit mode and then write data to the IICD register, or in the receive mode where it must implement a dummy read from the IICD register to release the SCL line.

Page 123: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 122 November 18, 2019 Rev. 1.10 123 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

I2C Bus Read/Write Signal The IICSRW bit in the IICC1 register defines whether the master device wishes to read data from the I2C bus or write data to the I2C bus. The slave device should examine this bit to determine if it is to be a transmitter or a receiver. If the IICSRW flag is “1” then this indicates that the master device wishes to read data from the I2C bus, therefore the slave device must be setup to send data to the I2C bus as a transmitter. If the IICSRW flag is “0” then this indicates that the master wishes to send data to the I2C bus, therefore the slave device must be setup to read data from the I2C bus as a receiver.

I2C Bus Slave Address Acknowledge SignalAfter the master has transmitted a calling address, any slave device on the I2C bus, whose own internal address matches the calling address, must generate an acknowledge signal. The acknowledge signal will inform the master that a slave device has accepted its calling address. If no acknowledge signal is received by the master then a STOP signal must be transmitted by the master to end the communication. When the IICHAAS flag is high, the addresses have matched and the slave device must check the IICSRW flag to determine if it is to be a transmitter or a receiver. If the IICSRW flag is high, the slave device should be setup to be a transmitter so the IICHTX bit in the IICC1 register should be set to “1”. If the IICSRW flag is low, then the microcontroller slave device should be setup as a receiver and the IICHTX bit in the IICC1 register should be set to “0”.

I2C Bus Data and Acknowledge Signal The transmitted data is 8-bits wide and is transmitted after the slave device has acknowledged receipt of its slave address. The order of serial bit transmission is the MSB first and the LSB last. After receipt of 8-bits of data, the receiver must transmit an acknowledge signal, level “0”, before it can receive the next data byte. If the slave transmitter does not receive an acknowledge bit signal from the master receiver, then the slave transmitter will release the SDA line to allow the master to send a STOP signal to release the I2C Bus. The corresponding data will be stored in the IICD register. If setup as a transmitter, the slave device must first write the data to be transmitted into the IICD register. If setup as a receiver, the slave device must read the transmitted data from the IICD register.

When the slave receiver receives the data byte, it must generate an acknowledge bit, known as IICTXAK, on the 9th clock. The slave device, which is setup as a transmitter will check the IICRXAK bit in the IICC1 register to determine if it is to send another data byte, if not then it will release the SDA line and await the receipt of a STOP signal from the master.

Page 124: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 124 November 18, 2019 Rev. 1.10 125 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

StartSCL

SDA

SCL

SDA

1

S=Start (1 bit)SA=Slave Address (7 bits)SR=IICSRW bit (1 bit)M=Slave device send acknowledge bit (1 bit)D=Data (8 bits)A=IICACK (IICRXAK bit for transmitter, IICTXAK bit for receiver, 1 bit)P=Stop (1 bit)

0

IICACKSlave Address IICSRW

StopData IICACK

1 1 0 1 0 1 0

1 0 0 1 0 1 0 0

S SA SR M D A D A …… S SA SR M D A D A …… P

Note: * When a slave address is matched, the device must be placed in either the transmit mode and then write data to the IICD register, or in the receive mode where it must implement a dummy read from the IICD register to release the I2C SCL line.

I2C Communication Timing Diagram

Start

I2CTOF=1?

SET I2CTOENCLR I2CTOF

RETI

IICHAAS=1?

IICHTX=1? IICSRW=1?

Read from IICD to release SCL Line

RETI

IICRXAK=1?

Write data to IICD to release SCL Line

CLR IICHTXCLR IICTXAK

Dummy read from IICD to release SCL Line RETI

RETI

SET IICHTX

Write data to IICD to release SCL Line

RETI

CLR IICHTXCLR IICTXAK

Dummy read from IICD to release SCL Line

RETI

YesNo

No Yes

Yes NoYesNo

No

Yes

I2C Bus ISR Flow Chart

Page 125: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 124 November 18, 2019 Rev. 1.10 125 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

I2C Time-out ControlIn order to reduce the problem of I2C lockup due to reception of erroneous clock sources, a time-out function is provided. If the clock source to the I2C is not received for a while, then the I2C circuitry and registers will be reset after a certain time-out period.

The time-out counter starts counting on an I2C bus “START” & “address match” condition, and is cleared by an SCL falling edge. Before the next SCL falling edge arrives, if the time elapsed is greater than the time-out setup by the I2CTOC register, then a time-out condition will occur. The time-out function will stop when an I2C “STOP” condition occurs.

StartSCL

SDA

SCL

SDA

1 0

IICACKSlave Address IICSRW

Stop

1 1 0 1 0 1 0

1 0 0 1 0 1 0 0

I2C time-out counter start

I2C time-out counter reset on SCL negative transition

I2C Time-out

When an I2C time-out counter overflow occurs, the counter will stop and the I2CTOEN bit will be cleared to zero and the I2CTOF bit will be set high to indicate that a time-out condition has occurred. The time-out condition will also generate an interrupt which uses the I2C interrupt, which contained within the Multi-function Interrupt. When an I2C time-out occurs, the I2C internal circuitry will be reset and the registers will be reset into the following condition:

Registers After I2C Time-outIICD, IICA, IICC0 No change

IICC1 Reset to POR condition

The I2CTOF flag can be cleared to zero by the application program. There are 64 time-out periods which can be selected using bits in the I2CTOC register. The time-out time is given by the formula:

((1~64) × 32) / fSUB. This gives a range of about 1ms to 64ms.

• I2CTOC Register

Bit 7 6 5 4 3 2 1 0Name I2CTOEN I2CTOF I2CTOS5 I2CTOS4 I2CTOS3 I2CTOS2 I2CTOS1 I2CTOS0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 I2CTOEN: I2C Time-out Control0: Disable1: Enable

Bit 6 I2CTOF: Time-out flag0: No time-out1: Time-out occurred

Bit 5~0 I2CTOS5~I2CTOS0: Time-out DefinitionI2C time-out clock source is fSUB/32I2C time-out time is given by: (I2CTOS[5:0]+1) × (32/fSUB)

Page 126: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 126 November 18, 2019 Rev. 1.10 127 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

16-bit Multiplication Division Unit – MDUThe device has a 16-bit Multiplication Division Unit, MDU, which integrates a 16-bit unsigned multiplier and a 32-bit/16-bit divider. The MDU, in replacing the software multiplication and division operations, can therefore save large amounts of computing time as well as the Program and Data Memory space. It also reduces the overall microcontroller loading and results in the overall system performance improvements.

fSYS

MDUWR0MDUWR1MDUWR2MDUWR3

MDUWR4

MDUWR5

16/32-bit dividend/

16-bit multiplicand

16-bit divisor /

16-bit multiplier

shift control

MDWEFMDWOV

+/-

16-bit MDU Block Diagram

MDU RegistersThe multiplication and division operations are implemented in a specific way, a specific write access sequence of a series of MDU data registers. The status register, MDUWCTRL, provides the indications for the MDU operation. The data register each is used to store the data regarded as the different operand corresponding to different MDU operations.

Register Name

Bit7 6 5 4 3 2 1 0

MDUWR0 D7 D6 D5 D4 D3 D2 D1 D0MDUWR1 D7 D6 D5 D4 D3 D2 D1 D0MDUWR2 D7 D6 D5 D4 D3 D2 D1 D0MDUWR3 D7 D6 D5 D4 D3 D2 D1 D0MDUWR4 D7 D6 D5 D4 D3 D2 D1 D0MDUWR5 D7 D6 D5 D4 D3 D2 D1 D0

MDUWCTRL MDWEF MDWOV — — — — — —

MDU Register List

• MDUWRn Register (n=0~5)

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR x x x x x x x x

“x”: unknownBit 7~0 D7~D0: 16-bit MDU data register n

Using the register depends on the current MDU operation.

Page 127: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 126 November 18, 2019 Rev. 1.10 127 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• MDUWCTRL Register

Bit 7 6 5 4 3 2 1 0Name MDWEF MDWOV — — — — — —R/W R R — — — — — —POR 0 0 — — — — — —

Bit 7 MDWEF: 16-bit MDU error flag0: Normal1: Abnormal

This bit will be set to 1 if the data register MDUWRn is written or read as the MDU operation is executing. This bit should be cleared to 0 by reading the MDUWCTRL register if it is equal to 1 and the MDU operation is completed.

Bit 6 MDWOV: 16-bit MDU overflow flag0: No overflow occurs1: Multiplication product > FFFFH or Divisor=0

When an operation is completed, this bit will be updated by hardware to a new value corresponding to the current operation situation.

Bit 5~0 Unimplemented, read as “0”

MDU OperationFor this MDU the multiplication or division operation is carried out in a specific way and is determined by the write access sequence of the six MDU data registers, MDUWR0~MDUWR5. The low byte data, regardless of the dividend, multiplicand, divisor or multiplier, must first be written into the corresponding MDU data register followed by the high byte data. All MDU operations will be executed after the MDUWR5 register is write-accessed together with the correct specific write access sequence of the MDUWRn. Note that it is not necessary to consecutively write data into the MDU data registers but must be in a correct write access sequence. Therefore, a non-write MDUWRn instruction or an interrupt, etc., can be inserted into the correct write access sequence without destroying the write operation. The relationship between the write access sequence and the MDU operation is shown in the following.

• 32-bit/16-bit division operation: Write data sequentially into the six MDU data registers from MDUWR0 to MDUWR5.

• 16-bit/16-bit division operation: Write data sequentially into the specific four MDU data registers in a sequence of MDUWR0, MDUWR1, MDUWR4 and MDUWR5 with no write access to MDUWR2 and MDUWR3.

• 16-bit×16-bit multiplication operation: Write data sequentially into the specific four MDU data register in a sequence of MDUWR0, MDUWR4, MDUWR1 and MDUWR5 with no write access to MDUWR2 and MDUWR3.

Page 128: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 128 November 18, 2019 Rev. 1.10 129 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

After the specific write access sequence is determined, the MDU will start to perform the corresponding operation. The calculation time necessary for these MDU operations are different. During the calculation time any read/write access to the six MDU data registers is forbidden. After the completion of each operation, it is necessary to check the operation status in the MDUWCTRL register to make sure that whether the operation is correct or not. Then the operation result can be read out from the corresponding MDU data registers in a specific read access sequence if the operation is correctly finished. The necessary calculation time for different MDU operations is listed in the following.

• 32-bit/16-bit division operation: 17×tSYS

• 16-bit/16-bit division operation: 9×tSYS

• 16-bit×16-bit multiplication operation: 11×tSYS

The operation results will be stored in the corresponding MDU data registers and should be read out from the MDU data registers in a specific read access sequence after the operation is completed. Noe that it is not necessary to consecutively read data out from the MDU data registers but must be in a correct read access sequence. Therefore, a non-read MDUWRn instruction or an interrupt, etc., can be inserted into the correct read access sequence without destroying the read operation. The relationship between the operation result read access sequence and the MDU operation is shown in the following.

• 32-bit/16-bit division operation: Read the quotient from MDUWR0 to MDUWR3 and remainder from MDUWR4 and MDUWR5 sequentially.

• 16-bit/16-bit division operation: Read the quotient from MDUWR0 and MDUWR1 and remainder from MDUWR4 and MDUWR5 sequentially.

• 16-bit×16-bit multiplication operation: Read the product sequentially from MDUWR0 to MDUWR3.

The overall important points for the MDU read/write access sequence and calculation time are summarized in the following table. Note that the device should not enter the IDLE or SLEEP mode until the MDU operation is totally completed, otherwise the MDU operation will fail.

OperationsItems 32-bit/16-bit Division 16-bit/16-bit Division 16-bit×16-bit Multiplication

Write SequenceFirst write↓Last write

Dividend Byte 0 written to MDUWR0Dividend Byte 1 written to MDUWR1Dividend Byte 2 written to MDUWR2Dividend Byte 3 written to MDUWR3Divisor Byte 0 written to MDUWR4Divisor Byte 1 written to MDUWR5

Dividend Byte 0 written to MDUWR0Dividend Byte 1 written to MDUWR1Divisor Byte 0 written to MDUWR4Divisor Byte 1 written to MDUWR5

Multiplicand Byte 0 written to MDUWR0Multiplier Byte 0 written to MDUWR4Multiplicand Byte 1 written to MDUWR1Multiplier Byte 1 written to MDUWR5

Calculation Time 17×tSYS 9×tSYS 11×tSYS

Read SequenceFirst read↓Last read

Quotient Byte 0 read from MDUWR0Quotient Byte 1 read from MDUWR1Quotient Byte 2 read from MDUWR2Quotient Byte 3 read from MDUWR3Remainder Byte 0 read from MDUWR4Remainder Byte 1 read from MDUWR5

Quotient Byte 0 read from MDUWR0Quotient Byte 1 read from MDUWR1Remainder Byte 0 read from MDUWR4Remainder Byte 1 read from MDUWR5

Product Byte 0 written to MDUWR0Product Byte 1 written to MDUWR1Product Byte 2 written to MDUWR2Product Byte 3 written to MDUWR3

MDU Operations Summary

Page 129: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 128 November 18, 2019 Rev. 1.10 129 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

High Resolution PWM GeneratorThe device contains a fully integrated PWM Generator which has complimentary outputs for maximum application flexibility.

Functional DescriptionThe High Resolution 11-bit PWM circuit includes a PWM generator circuit, two Phase Locking Loop, a delay lock loop circuit and PWM complementary outputs with dead time insertion.

FSK

Duty Control

DUCEN

Phase Control

PHCEN

PLL2

PLL2EN

PLL1

PLL1ENPLL1S

Frequency Step Select

FSKEN

FRESEN

FDAEN

Select

Select

FOPOUT[3:0]

FSKOUT[3:0]

Dead Time Control

PWMF[3:0]

DTPR0ENDTPR1EN

PWMDT[3:0] Output Control

PWMnEN[3:0]

OCPO

PWM0

fHOSC

FOPS[1:0]

PLLFH[2:0]

PHSCL[7:0]

PHSCH[1:0]

PWMnP[3:0]

PWM2

PWM3

PWM1

fPLL

HTO

Note: HTO:0: fHOSC unstable1: fHOSC stable

DLL

DUTYCH[2:0]

FRESINT

FDSW1INTFDNINT

FDSW0INTFSKD

FSKDASW1

FSKDASW0

FSKDAC1

FSKDAC1

PLLFL[7:0]

DUTYCL[7:0] PWMnFS[3:0]PWMnFL[3:0]

CLK Source

PWM Generator Block Diagram

High Resolution PWM RegistersOverall operation of the High Resolution PWM is controlled using several registers. The CKGEN register control functions including PLLn clock stable indicate, PLLn clock generator and DLL generator enable control and PLL1 output frequency selection. PLLFH and PLLFL are the generator frequency selection registers, DTC is the dead time function control register, DUTYCL and DUTYCH are the duty control registers, PHSCL and PHSCH are PLL phase selection registers, FSKDAC0 and FSKDAC1 are FSK function control registers, FSKDASW0 and FSKDASW1 are FSK data buffer and the PWMCn are the PWMn output control registers.

Page 130: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 130 November 18, 2019 Rev. 1.10 131 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Register Name

Bit7 6 5 4 3 2 1 0

PLLFL PFQ7 PFQ6 PFQ5 PFQ4 PFQ3 PFQ2 PFQ1 PFQ0PLLFH — — — — — PFQ10 PFQ9 PFQ8CKGEN PLL1F PLL1EN PLL2F PLL2EN — — — PLL1SPWMC0 PWM3P PWM2P PWM1P PWM0P PWM3EN PWM2EN PWM1EN PWM0ENPWMC1 DTPR1EN DTPR0EN DUCEN PHCEN — — FOPS1 FOPS0PWMC2 PWM3FL PWM2FL PWM1FL PWM0FL PWM3FS PWM2FS PWM1FS PWM0FSDTC — — — DTC4 DTC3 DTC2 DTC1 DTC0DUTYCL DUD7 DUD6 DUD5 DUD4 DUD3 DUD2 DUD1 DUD0DUTYCH — — — — — DUD10 DUD9 DUD8PHSCL PHSD7 PHSD6 PHSD5 PHSD4 PHSD3 PHSD2 PHSD1 PHSD0PHSCH — — — — — — PHSD9 PHSD8FSKDAC0 FPOLARITY FDEPTH1 FDEPTH0 — FSKEN FDAEN FRESF FRESENFSKDAC1 FDNF FDSWF1 FDSWF0 FMECNT4 FMECNT3 FMECNT2 FMECNT1 FMECNT0FSKDASW0 FD0SW7 FD0SW6 FD0SW5 FD0SW4 FD0SW3 FD0SW2 FD0SW1 FD0SW0FSKDASW1 FD1SW7 FD1SW6 FD1SW5 FD1SW4 FD1SW3 FD1SW2 FD1SW1 FD1SW0

High Resolution PWM Generator Register List

• PLLFL Register

Bit 7 6 5 4 3 2 1 0Name PFQ7 PFQ6 PFQ5 PFQ4 PFQ3 PFQ2 PFQ1 PFQ0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 PFQ7~PFQ0: PWM Frequency control low bytePLL1S=0 (PLL1=100kHz~220kHz)

0: 100.0kHz1: 100.1kHz2: 100.2kHz3: 100.3kHz4: 100.4kHz: : 254: 125.4kHz255: 125.5kHz

PLL1S=1 (PLL1=200kHz~440kHz)0: 200.0kHz1: 200.2kHz2: 200.4kHz3: 200.6kHz4: 200.8kHz: : 254: 250.8kHz255: 251.0kHz

Note: Write data to PLLFL register firstly and then PLLFH register.

Page 131: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 130 November 18, 2019 Rev. 1.10 131 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PLLFH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — PFQ10 PFQ9 PFQ8R/W — — — — — R/W R/W R/WPOR — — — — — 0 0 0

Bit 7~3 Unimplemented, read as “0”Bit 2~1 PFQ10~PFQ8: PWM Frequency control high byte

PLL1S=0 (PLL1=100kHz~220kHz)256: 125.6kHz257: 125.7kHz : :1197: 219.7kHz1198: 219.8kHz1199: 219.9kHz1200: 220.0kHzOther values: 220.0kHz

PLL1S=1 (PLL1=200kHz~440kHz)256: 251.2kHz257: 251.4kHz : :1197: 439.4kHz1198: 439.6kHz1199: 439.8kHz1200: 440.0kHz

Other values: 440.0kHzNote: Write data to PLLFL register firstly and then PLLFH register.

• CKGEN Register

Bit 7 6 5 4 3 2 1 0Name PLL1F PLL1EN PLL2F PLL2EN — — — PLL1SR/W R R/W R R/W — — — R/WPOR 0 0 0 0 — — — 0

Bit 7 PLL1F: PLL1 clock stable flag0: Unstable1: Stable

Bit 6 PLL1EN: PLL1 clock generator and DLL generator enable control bit0: Disable1: Enable

Bit 5 PLL2F: PLL2 clock stable flag0: Unstable1: Stable

Bit 4 PLL2EN: PLL2 clock generator enable control bit (32MHz)0: Disable1: Enable

Bit 3~1 Unimplemented, read as “0”Bit 0 PLL1S: PLL1 output frequency selection

0: 100kHz~220kHz1: 200kHz~440kHz

Page 132: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 132 November 18, 2019 Rev. 1.10 133 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

This bit is used to select the PLL1 output frequency. It should be noted that when the PLL1S is set high, the Frequency/Duty/Phase functions can be selected to be Frequency control only, bits FOPS1~FOPS0 in the PWMC1 Register should be set to 00 or 11, the PHSCH/PHSCL and DUTYCL/DUTYCH registers and FSK function will not be available.

• PWMC0 Register

Bit 7 6 5 4 3 2 1 0Name PWM3P PWM2P PWM1P PWM0P PWM3EN PWM2EN PWM1EN PWM0ENR/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 PWM3P: PWM3 output phase selection 0: PWM3 outputs normal phase1: PWM3 outputs inverse phase

Bit 6 PWM2P: PWM2 output phase selection0: PWM2 outputs normal phase1: PWM2 outputs inverse phase

Bit 5 PWM1P: PWM1 output phase selection0: PWM1 outputs normal phase1: PWM1 outputs inverse phase

Bit 4 PWM0P: PWM0 output phase selection0: PWM0 outputs normal phase1: PWM0 outputs inverse phase

Bit 3 PWM3EN: PWM3 output function enable control 0: Disable1: Enable

Bit 2 PWM2EN: PWM2 output function enable control 0: Disable1: Enable

Bit 1 PWM1EN: PWM1 output function enable control 0: Disable1: Enable

Bit 0 PWM0EN: PWM0 output function enable control0: Disable1: Enable

Note: When both PWMnFS=1 and OCPO=1, PWMnEN bit will be reset to 0 automatically.

• PWMC1 Register

Bit 7 6 5 4 3 2 1 0Name DTPR1EN DTPR0EN DUCEN PHCEN — — FOPS1 FOPS0R/W R/W R/W R/W R/W — — R/W R/WPOR 0 0 0 0 — — 0 0

Bit 7 DTPR1EN: PWM2 and PWM3 in right half-bridge with Dead Time function enable control

0: Disable 1: Enable

Bit 6 DTPR0EN: PWM0 and PWM1 in left half-bridge with Dead Time function enable control

0: Disable1: Enable

Page 133: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 132 November 18, 2019 Rev. 1.10 133 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 5 DUCEN: PWM generator Duty function enable control 0: Disable1: Enable

Bit 4 PHCEN: PWM generator Phase function enable control 0: Disable1: Enable

Bit 3~2 Unimplemented, read as “0”Bit 1~0 FOPS1~FOPS0: Frequency/Duty/Phase functions selection

00/11: Frequency control only01: Duty and Frequency control with fixed Phase=0.00°10: Phase and Frequency control and fixed Duty=50%

• PWMC2 Register

Bit 7 6 5 4 3 2 1 0Name PWM3FL PWM2FL PWM1FL PWM0FL PWM3FS PWM2FS PWM1FS PWM0FSR/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 PWM3FL: PWM3 output forced level when PWM3EN=0 or both OCPO=1 and PWM3FS=1

0: Force PWM3 output low1: Force PWM3 output high

Bit 6 PWM2FL: PWM2 output forced level when PWM2EN=0 or both OCPO=1 and PWM2FS=1

0: Force PWM2 output low1: Force PWM2 output high

Bit 5 PWM1FL: PWM1 output forced level when PWM1EN=0 or both OCPO=1 and PWM1FS=1

0: Force PWM1 output low1: Force PWM1 output high

Bit 4 PWM0FL: PWM0 output forced level when PWM0EN=0 or both OCPO=1 and PWM0FS=1

0: Force PWM0 output to low1: Force PWM0 output to high

Bit 3 PWM3FS: PWM3 output status selection when OCPO=1 0: Keep PWM3 current output level1: Force PWM3 output level according to PWM3FL setting

Bit 2 PWM2FS: PWM2 output status selection when OCPO=10: Keep PWM2 current output level1: Force PWM2 output level according PWM2FL setting

Bit 1 PWM1FS: PWM1 output status selection when OCPO=1 0: Keep PWM1 current output level1: Force PWM1 output level according to PWM1FL setting

Bit 0 PWM0FS: PWM0 output status selection when OCPO=1 0: Keep PWM0 current output level1: Force PWM0 output level according to PWM0FL setting

Page 134: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 134 November 18, 2019 Rev. 1.10 135 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• DTC Register

Bit 7 6 5 4 3 2 1 0Name — — — DTC4 DTC3 DTC2 DTC1 DTC0R/W — — — R/W R/W R/W R/W R/WPOR — — — 0 0 0 0 0

Bit 7~5 Unimplemented, read as “0”Bit 4~0 DTC4~DTC0: PWM0+PWM1 and PWM2+PWM3 Dead Time selection

00000: 0×10ns=0ns 00001: 1×10ns=10ns 00010: 2×10ns=20ns00011: 3×10ns=30ns00100: 4×10ns=40ns00101: 5×10ns=50ns00110: 6×10ns=60ns00111: 7×10ns=70ns : :11111: 31×10ns=310ns

Note: There is non-guarantee precise 10ns in dead time control, but guarantee the dead time trend as dead time control between increase and decrease status.

• DUTYCL Register

Bit 7 6 5 4 3 2 1 0Name DUD7 DUD6 DUD5 DUD4 DUD3 DUD2 DUD1 DUD0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 DUD7~DUD0: Duty control low byte0: Duty=[50-(0/24)]%=50.000% 1: Duty=[50-(1/24)]%=[49+(23/24)]% 2: Duty=[50-(2/24)]%=[49+(22/24)]%3: Duty=[50-(3/24)]%=[49+(21/24)]% 4: Duty=[50-(4/24)]%=[49+(20/24)]% 5: Duty=[50-(5/24)]%=[49+(19/24)]% 6: Duty=[50-(6/24)]%=[49+(18/24)]% 7: Duty=[50-(7/24)]%+[49+(17/24)]% : :255: Duty=[50-(255/24)]%=[39+(15/24)]%These bits can be controlled only when the PLL1S bit be set low.

Note: Adjust Duty of 5%~50% when the FOPS1~FOPS0 bits are set to “01” and fixed Phase=0.00° only.

Page 135: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 134 November 18, 2019 Rev. 1.10 135 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• DUTYCH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — DUD10 DUD9 DUD8R/W — — — — — R/W R/W R/WPOR — — — — — 0 0 0

Bit 7~3 Unimplemented, read as “0”Bit 2~0 DUD10~DUD8: Duty control high byte

256: Duty=[50-(256/24)]%=[39+(14/24)]% 257: Duty=[50-(257/24)]%=[39+(13/24)]% : :1079: Duty=[50-(1079/24)]%=[5+(1/24)]% 1080: Duty=[50-(1080/24)]%=5%Other values:Duty=[50-(1080/24)]%=5%These bits can be controlled only when the PLL1S bit be set low.

Note: 1. Adjust Duty of 5%~50% when the FOPS1~FOPS0 bits are set to “01” and fixed Phase=0.00° only.

2. Write data to the DUTYCL register firstly and then DUTYCH register.

3. The DUTYCL and DUTYCH registers are allowed to be written at anytime whatever DUCEN=1 or 0.

• PHSCL Register

Bit 7 6 5 4 3 2 1 0Name PHSD7 PHSD6 PHSD5 PHSD4 PHSD3 PHSD2 PHSD1 PHSD0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 PHSD7~PHSD0: Phase control low byte0: Phase=0°+(0×0.15°)=0.00°1: Phase=0°+(1×0.15°)=0.15°2: Phase=0°+(2×0.15°)=0.30°3: Phase=0°+(3×0.15°)=0.45°4: Phase=0°+(4×0.15°)=0.60°5: Phase=0°+(5×0.15°)=0.75°6: Phase=0°+(6×0.15°)=0.90°7: Phase=0°+(7×0.15°)=1.05° : :255: Phase=0°+(255×0.15°)=38.25°These bits can be controlled only when the PLL1S bit be set low.

Page 136: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 136 November 18, 2019 Rev. 1.10 137 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PHSCH Register

Bit 7 6 5 4 3 2 1 0Name — — — — — — PHSD9 PHSD8R/W — — — — — — R/W R/WPOR — — — — — — 0 0

Bit 7~2 Unimplemented, read as “0”Bit 1~0 PHSD9~PHSD8: Phase control high byte

256: Phase=0°+(256×0.15°)=38.40°257: Phase=0°+(257×0.15°)=38.55° : :900: Phase=0°+(900×0.15°)=135.00°Other values: 135.00°These bits can be controlled only when the PLL1S bit be set low.

Note: 1. Adjust Phase of 0°~135° when the FOPS1~FOPS0 bits are set to “10” and fixed Duty=50% only.

2. Write data to the PHSCL register firstly then PHSCH register.

3. The PHSCL and PHSCH registers are allowed to be written at anytime whatever PHCEN=1 or 0.

• FSKDAC0 Register

Bit 7 6 5 4 3 2 1 0Name FPOLARITY FDEPTH1 FDEPTH0 — FSKEN FDAEN FRESF FRESENR/W R/W R/W R/W — R/W R/W R/W R/WPOR 0 0 0 — 0 0 0 0

Bit 7 FPOLARITY: FSK polarity selection0: Positive1: Negative

Bit 6~5 FDEPTH~FDEPTH0: FSK depth selection00: 001: 110: 211: 3

Bit 4 Unimplemented, read as “0”Bit 3 FSKEN: FSK function enable control

0: Disable1: Enable

Bit 2 FDAEN: FSK package data delivery function enable control0: Disable 1: Enable

The FDNF/FDSWF1/FDSWF0 bits will be reset to 0 automatically when FDAEN=0. When this bit is from high to low and then high again, the FSK package data delivery will be re-enabled.

Bit 1 FRESF: FSK response data delivery finish flag0: Standby1: Finish

This bit can be cleared to zero by the firmware, but cannot be set high by the firmware. If FSK response data delivery finish condition occurs, this bit will be set high, which means the FSK response data can not be delivered again.

Page 137: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 136 November 18, 2019 Rev. 1.10 137 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 0 FRESEN: FSK response data delivery function enable control0: Disable1: Enable

The FRESF bit will reset to 0 automatically when FRESEN=0. When this bit is from high to low and then high again, the FSK response data delivery will be re-enabled.

Note: If the FRESEN and FDAEN are simultaneously set to 1, only the FRESEN being set high will be executed.

• FSKDAC1 Register

Bit 7 6 5 4 3 2 1 0Name FDNF FDSWF1 FDSWF0 FMECNT4 FMECNT3 FMECNT2 FMECNT1 FMECNT0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 FDNF: The whole FSK packet delivery finish flag0: Standby1: Finish

This bit can be cleared to zero by the software, but cannot be set high by the software. If the whole FSK packet data delivery finish condition occurs, the bit is set high , which means the FSK packet data can not be delivered again unless FDNF is cleared to 0.

Bit 6 FDSWF1: FSKDASW1 delivery flag0: Standby or FSK data delivery1: Finish FSKDASW1 delivery

This bit can be reset to 0 but cannot be set to 1 by the firmware.Bit 5 FDSWF0: FSKDASW0 delivery flag

0: Standby or FSK data delivery1: Finish FSKDASW0 delivery

This bit can be cleard to zero by the firmware, but cannot be set high by the firmware.If FRESEN=1 with package message number=1, regularly use FSKDASW0 delivery. If delivery package message number>2, the package messages are written to FSKDASW1 and FSKDASW0 registers by firmwawe first. Write package message into the FSKDASW0 register first and then the FSKDASW1 register. Write the third package message into FSKDASW0 until FDSWF0=1. Write the fourth package message to FSKDASW1 until FDSWF1=1, and so on. Adding start, parity and stop bits to every package message by hardware automatically, however, response data combines only 8 bits which doesn’t include start, parity and stop bits.

Bit 4~0 FMECNT4~FMECNT0: FSK package message number00000: 100001: 200010: 300011: 400100: 500101: 600110: 7 : :11111: 32

Note: The above FSK package message numbers include the checksum bit. The checksum bit is calculated by firmware.

Page 138: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 138 November 18, 2019 Rev. 1.10 139 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• FSKDASW0 Register

Bit 7 6 5 4 3 2 1 0Name FD0SW7 FD0SW6 FD0SW5 FD0SW4 FD0SW3 FD0SW2 FD0SW1 FD0SW0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 FD0SW7~FD0SW0: FSK data buffer 0 for FSK package 11111111: Acknowledge ( ACK) to accept a request00000000: Negative Acknowledge (NAK) to reject a request01010101: None Define (ND) for unrecognized or invalid request

Response data contains 8 bits which doesn’t include start, parity and stop bits.

• FSKDASW1 Register

Bit 7 6 5 4 3 2 1 0Name FD1SW7 FD1SW6 FD1SW5 FD1SW4 FD1SW3 FD1SW2 FD1SW1 FD1SW0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 FD1SW7~FD1SW0: FSK data buffer 1 for FSK package 11111111: Acknowledge (ACK) to accept a request00000000: Negative Acknowledge (NAK) to reject a request01010101: None Define (ND) for unrecognized or invalid request

Response data contains 8 bits which doesn’t include start, parity and stop bits.

PWM Duty/Phase Control for Half-Bridge or Full-Bridge TopologyThe PWM signal generator is driven by the HIRC or HXT oscillator, selected via configuring the FHS bit in the SCC register and can generate PWM signal, with a variable duty by configuring the 10-bit DUTYCL and DUTYCH registers. The PWM signal phase is determined by the PHSCL and PHSCH registers content.

PWM Output Using Duty Control for Half-Bridge Topology

PWM0

PWM1

Half-Bridge Topology

Page 139: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 138 November 18, 2019 Rev. 1.10 139 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

CLK

PWM0

PWM1

Duty Control for Half-Bridge Topology

PWM Output Using Duty and Phase Control for Full-Bridge Topology

PWM0

PWM1

PWM2

PWM3

Full-Bridge Topology

CLK

PWM1

PWM0

PWM3

PWM2

Duty control for Full-Bridge Topology

Page 140: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 140 November 18, 2019 Rev. 1.10 141 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

CLK

PWM0

PWM2

PWM1

PWM3

Dead Time

T

t0

Phase control for Full-Bridge Topology

Note: 1. PLL1S=0: t0=(PHSD[0:9]×0.15°/360)×T. The PHSD[0:9] only accept 0~900 setting values, when the setting value is greater than 900, the result will be regarded as 900.

2. When the PLL1S is set high, the Frequency/Duty/Phase functions can be selected to be Frequency control only, bits FOPS1~FOPS0 in the PWMC1 Register should be set to 00 or 11, the PHSCH/PHSCL and DUTYCL/DUTYCH registers and FSK function will not be available.

3. If the DUTYCL/DUTYCH or PHSCH/PHSCL register value has changed, the PWM waveform will respond to the new setting after a synchronization time of 100μs.

Duty/Phase Control for WPC Specification

TX Type Frequency Duty ResolutionMP-A1 205kHz (4.88μs) 10% (488ns) ~ 50% (2440ns) < 0.1% ( < 4.8ns) [WPC Request]

MP-A2

145kHz (6.89μs) Minimum::

110kHz (9.09μs) Maximum

5% (344.8ns) ~ 50% (3448ns)::

5% (454.5ns) ~ 50% (4545.4ns)

< 0.1% ( < 6.89ns) [WPC Request]::

< 0.1% ( < 9.09ns) [WPC Request]

Duty Definition for WPC Specification

TX Type Frequency Phase ResolutionMP-A1 160kHz (6.25μs) Minimum 0˚ ~ 135˚ < 0.18˚ ( < 3.125ns) [WPC Request]

Phase Definition for WPC Specification

Page 141: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 140 November 18, 2019 Rev. 1.10 141 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

FSK Modulation for WPC Specification

Type Message Description FormatACK Acknowledge Accept a request 11111111NAK Negative Acknowledge Reject a request 00000000ND None Defined Unrecognized or invalid request 01010101

Responses Data Formate for WPC Specification

Polarity Depth1/Fmod – 1/Fop Design Request

Target (ns)Minimum (ns) Maximum (ns) Minimum (ns) Maximum (ns)

Positive 3 -282.00 -249.00 -281.25 (31.2×-9) -250 (31.25×-8) -265.63 (31.25×-8.5)Positive 2 -157.00 -124.00 -156.25 (31.25×-5) -125 (31.25×-4) -140.63 (31.25×-4.5)Positive 1 -94.50 -61.50 -93.75 (31.25×-3) -62.5 (31.25×-2) -78.13 (31.25×-2.5)Positive 0 -63.25 -30.25 -62.5 (31.25×-2) -31.25 (31.25×-1) -46.88 (31.25×-1.5)Negative 0 30.25 63.25 31.25 (31.25×1) 62.5 (31.25×2) 46.88 (31.25×1.5)Negative 1 61.50 94.50 62.5 (31.25×2) 93.75 (31.25×3) 78.13 (31.25×2.5)Negative 2 124.00 157.00 125 (31.25×4) 156.25 (31.25×5) 140.63 (31.25×4.5)Negative 3 249.00 282.00 250 (231.25×8) 281.25 (31.25×9) 265.63 (31.25×8.5)

FSK Tolerance Definition for WPC Specification

The FSK digital output pin, FSKD, can be selected using the corresponding pin-shared selection bits described in the Pin-shared Function section. The FSKD pin output has a different significance, if the FSKD output high which means that FSK output Fmod, if the FSKD output low which means that FSK output Fop. When the FSKD pin changes from high/low to low/high, the PWM0~PWM3 first periods are the low frequency period, these abnormal periods are acceptable. Take the following waveform as an example.

ACK

NAK

ND

ONE ONEONEONEONEONE ONEONE

ZERO ZEROZEROZEROZEROZERO ZEROZERO

ONE ZEROONEZEROONEZERO ZEROONE

B0 B5B4B3B2B1 B7B6

ZERO

Fmod

Fop

256 cycles 512 cycles

Responses Data Formate for WPC Specification

Notes: 1. PWM0~PWM3 will output 256 or 512 PWM cycles with PWM Frequency=Fmod and Duty=50%, when FSKD Pin=1 for ND type.

2. PWM0~PWM3 will output 256 or 512 PWM cycles with PWM Frequency=Fop and Duty=50%, when FSKD Pin=0 for ND type.

Page 142: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 142 November 18, 2019 Rev. 1.10 143 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

FSK Package FormatThe FSK package is composed of various factors such as a header, messages and checksum. The following shows FSK package format.

Header Messages (1~30) Checksum

FSK Packet Format

Start B0 B1 B2 B6 B7 Parity StopB3 B4 B5

Example of the FSK Packet Byte

Note: 1. If the summary number of “1” for B0~B7 bits is odd, the Parity bit will be equal to “1”. Else if the summary number is even, the Parity bit will be equal to “0”.

2. Start bit is fixed at 0 and Stop bit is fixed at 1.

3. Firmware only needs to write data to B0~B7 bits, the Start/Parity/Stop bits will be added by the hardware automatically.

Demodulation FunctionThe Demodulator demodulates the communication signal which is from the receiver end.

8-bit D/Aconverter

C

D[7:0]

Filter

Filter clock

R1 R2

A

G=1/5/10/15/20/30/40/50

G[2:0]

FLT[2:0]

fFLT=fH/4DEMn[1:0]

DMnS3

DMnS2

DMnS1

DMnS0

DEMOnAP

DEMOnAN DEMOnAX DEMOnCP DEMOnCN DEMOnCX

DEMOn

PxSn

Pin Control Pin

Control

Pin Control

Pin Control

Pin Control

Pin Control

Pin ControlPxSn PxSn PxSn PxSnPxSn

PTPI/STPI

DEMOn

DEMOnINT

Demodulator Block Diagram (n=0~1)Note: The DMnS3~DMnS0 bits are used for switch on/off control, but not for 8-bit D/A Converter

on/off control.

Demodulator Circuit OperationThe demodulator input is sourced from DEMOnAP, which can be selected using the corresponding pin-shared function selection bits described in the Pin-shared Function section. After this, four switches S0~S3, are used for mode selection. An OPAMP and two resistors are used to form a PGA function. The PGA gain can be positive or negative determined by the input voltage connected to the positive input or negative input of the PGA. DEMnREF register is used to generate reference voltage. The comparator compares this reference voltage with the amplified output voltage. Finally the comparator output is filtered to generate DEMOn, PTPI/STPI input source and DEMnINT. These are debounced versions of DEMnCX which are used to indicate whether the source current is outwith the specification or not. DEMOn is defined as the demodulator output, PTPI/STPI input source and DEMnINT is the demodulator interrupt trigger.

Note that the filter clock is driven by the HXT clock, fHXT. The D/A converter output voltage is controlled by the DEMnREF register and the D/A converter output is defined as

D/A converter VOUT=(D/A converter VREF/256) × DEMnREF[7:0] (1)

Page 143: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 142 November 18, 2019 Rev. 1.10 143 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Input Voltage RangeThe input voltage can be positive or negative, which together with the PGA operate mode, provides for a more flexible application.

(1) If VIN>0 and the PGA operates in the non-inverting mode, the output voltage of the PGA is

VOPGA=(1 + R2 / R1) × VIN (2)

(2) When the PGA operates in the non-inverting mode, it also provides a unity gain buffer function.

If DEMn[1:0]=01 and DEMnG[2:0]=000, the PGA gain will be 1 and is configured as unity gain buffer. Switches S2 and S3 will be off internally and the output voltage of the PGA is

VOPGA=VIN (3)

(3) If 0 > VIN > -0.2V and the PGA operates in the inverting mode, the output voltage of the PGA is

VOPGA=− (R2 / R1) × VIN (4)

Note: If VIN is negative, it should not be lower than -0.2V to avoid leakage current.

Offset CalibrationThe demodulation circuit has 4 operating modes controlled by DEMn1~DEMn0. One of these modes is the calibration mode (0V input mode). In the calibration mode, the OPA and comparator offset can be calibrated.

OPA CalibrationStep1: Set DEMn[1:0] =11, DEMnAOFM=1, the demodulator n is now in the OPA calibration

mode.

Step2: Set DEMnAOF[5:0]=000000 then read the DEMnAXCX bit status.

Step3: Let DEMnAOF[5:0]=DEMnAOF[5:0]+1 then read the DEMnAXCX bit status.

If DEMnAXCX is not changed, repeat Step3;

If DEMnAXCX is changed, record the DEMnAOF[5:0] data as VOOS1, and then go to Step 4.

Step4: Set DEMnAOF[5:0]=111111 then read the DEMnAXCX bit status.

Step5: Let DEMnAOF[5:0]=DEMnAOF[5:0]-1 then read the DEMnAXCX bit status.

If DEMnAXCX is not changed, repeat Step5;

If DEMnAXCX is changed, record the DEMnAOF[5:0] data as VOOS2, and then go to Step 6.

Step6: Restore VOS=(VOOS1+VOOS2)/2 to the DEMnAOF[5:0]. The calibration is now finished.

Comparator CalibrationStep1: Set DEMn[1:0]=11, DEMnCOFM=1, the demodulator n is now in the comparator calibration

status.

Step2: Set DEMnCOF[4:0]=00000 then read the DEMnAXCX bit status.

Step3: Let DEMnCOF[4:0]=DEMnCOF[4:0]+1 then read the DEMnAXCX bit status.

If DEMnAXCX is not changed, repeat Step3;

If DEMnAXCX is changed, record the DEMnCOF[4:0] data as VCOS1, and then go to Step 4.

Step4: Set DEMnCOF[4:0]=11111 then read the DEMnAXCX bit status.

Step5: Let DEMnCOF[4:0]=DEMnCOF[4:0]-1 then read the DEMnAXCX bit status.

If DEMnAXCX is not changed, repeat Step5;

If DEMnAXCX data is changed, record the DEMnCOF[4:0] data as VCOS2, and then go to Step 6.

Step6: Restore VCOS=(VCOS1+VCOS2)/2 to the DEMnCOF[4:0]. The calibration is now finished.

Page 144: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 144 November 18, 2019 Rev. 1.10 145 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Demodulator Register DescriptionThe DEMnC0 and DEMnC1 registers are demodulator control registers which are used to control the demodulator operation mode, PGA and filter functions. The DEMnREF register is used to provide the reference voltages for the demodulator. DEMnACAL and DEMnCCAL are used to cancel out the operational amplifier and comparator input offset voltage.

Register Name

Bit

7 6 5 4 3 2 1 0DEMnC0 DEMn1 DEMn0 — — DMnS3 DMnS2 DMnS1 DMnS0DEMnC1 DMn — DEMnG2 DEMnG1 DEMnG0 DEMnFLT2 DEMnFLT1 DEMnFLT0DEMnREF D7 D6 D5 D4 D3 D2 D1 D0DEMnACAL DEMnAOFM DEMnARS DEMnAOF5 DEMnAOF4 DEMnAOF3 DEMnAOF2 DEMnAOF1 DEMnAOF0DEMnCCAL DEMnAXCX DEMnCOFM DEMnCRS DEMnCOF4 DEMnCOF3 DEMnCOF2 DEMnCOF1 DEMnCOF0DCMISC DEM0DAVR OCDAVR DEMO0 DEM1DAVR DEMO1 STPIS PTPIS —

Demodulation Function Register List (n=0~1)

• DEMnC0 Register

Bit 7 6 5 4 3 2 1 0Name DEMn1 DEMn0 — — DMnS3 DMnS2 DMnS1 DMnS0R/W R/W R/W — — R/W R/W R/W R/WPOR 0 0 — — 0 0 0 0

Bit 7~6 DEMn1~DEMn0: Demodulator n mode selection00: Demodulator function disable (S1 and S3 on , S0 and S2 off)01: Demodulator function enable in non--inverting mode (S0 and S3 on, S1 and S2 off)10: Demodulator function enable in -inverting mode (S1 and S2 on, S0 and S3 off) 11: Demodulator function enable in 0V input mode (S1 and S3 on, S0 and S2 off)

Note: Demodulator function disabled means that the OPA, CMP, D/A converter, Filter all off & comparator are output Low.

Bit 5~4 Unimplemented, read as 0Bit 3 DMnS3: Demodulation n switch 3 control (DMnS3)

0: Off1: On

Bit 2 DMnS2: Demodulation n switch 2 control (DMnS2)0: Off1: On

Bit 1 DMnS1: Demodulation n switch 1 control (DMnS1)0: Off1: On

Bit 0 DMnS0: Demodulation n switch 0 control (DMnS0)0: Off1: On

• DEMnC1 Register

Bit 7 6 5 4 3 2 1 0Name DMn — DEMnG2 DEMnG1 DEMnG0 DEMnFLT2 DEMnFLT1 DEMnFLT0R/W R — R/W R/W R/W R/W R/W R/WPOR x — 0 0 0 0 0 0

“x”: unknownBit 7 DMn: DEMOn output (read only)Bit 6 Unimplemented, read as “0”

Page 145: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 144 November 18, 2019 Rev. 1.10 145 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 5~3 DEMnG2~DEMnG0: Demodulator n OPA GainInverting mode:

000: -1001: -5010: -10011: -15100: -20101: -30110: -40111: -50

Non-inverting mode:000: 1001: 6010: 11011: 16100: 21101: 31110: 41111: 51

Bit 2~0 DEMnFLT2~DEMnFLT0: Demodulator n filter selection000: 0tFLT ( without filter)001: (1~2)×tFLT

010: (3~4)×tFLT

011: (7~8)×tFLT

100: (15~16)×tFLT

101: (31~32)×tFLT

110: (63~64)×tFLT

111: (127~128)×tFLT

Note: fFLT=fH/4, fH=fHXT, tFLT=1/fFLT

• DEMnREF Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: Demodulator n reference voltage selectionReference Voltage=(D/A converter reference voltage/256)×N, (N=DEMnREF [7:0])

• DEMnACAL Register

Bit 7 6 5 4 3 2 1 0

Name DEMnAOFM DEMnARS DEMnAOF5 DEMnAOF4 DEMnAOF3 DEMnAOF2 DEMnAOF1 DEMnAOF0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 1 0 0 0 0 0

Bit 7 DEMnAOFM: Demodulator n OPA input offset voltage calibration mode or normal operating mode selection

0: Normal operating mode1: Input offset voltage calibration mode

Bit 6 DEMnARS: Demodulator n OPA input offset voltage calibration reference selection bit0: Select negative input as the reference input1: Select positive input as the reference input

Bit 5~0 DEMnAOF5~DEMnAOF0: Demodulator n OPA input offset voltage calibration control

Page 146: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 146 November 18, 2019 Rev. 1.10 147 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• DEMnCCAL Register

Bit 7 6 5 4 3 2 1 0

Name DEMnAXCX DEMnCOFM DEMnCRS DEMnCOF4 DEMnCOF3 DEMnCOF2 DEMnCOF1 DEMnCOF0R/W R R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 1 0 0 0 0

Bit 7 DEMnAXCX: Demodulator n OPA/Comparator output for calibration, positive logic (read only)If DEMnAOFM=1, this bit is the OPA output for calibration If DEMnCOFM=1, this bit is the comparator output for calibrationNote: DEMnAOFM and DEMnCOFM can’t be set to 1 simultaneously.

Bit 6 DEMnCOFM: Demodulator n comparator input offset voltage calibration mode or normal operating mode selection

0: Normal operate mode1: Input offset voltage calibration mode

Bit 5 DEMnCRS: Demodulator n comparator input offset voltage calibration reference selection bit

0: Select negative input as the reference input1: Select positive input as the reference input

Bit 4~0 DEMnCOF4~DEMnCOF0: Demodulator n comparator input offset voltage calibration control

• DCMISC Register

Bit 7 6 5 4 3 2 1 0Name DEM0DAVR OCDAVR DEMO0 DEM1DAVR DEMO1 STPIS PTPIS —R/W R/W R/W R R/W R R/W R/W —POR 0 0 x 0 x 0 0 —

"x": unknownBit 7 DEM0DAVR: Demodulator 0 D/A converter VREF source

0: AVDD 1: Internal VREF (source from the PGA output VR)

Bit 6 OCDAVR: OCP D/A converter VREF sourceDescribed elsewhere.

Bit 5 DEMO0: Demodulator 0 output (read only)Bit 4 DEM1DAVR: Demodulator 1 D/A converter VREF source

0: AVDD 1: Internal VREF (source from the PGA output VR)

Bit 3 DEMO1: Demodulator 1 output (read only)Bit 2 STPIS: STPI input source selection

0: STPI 1: DEMO0

Bit 1 PTPIS: PTPI input source selection0: PTPI1: DEMO1

Bit 0 Unimplemented, read as “0”

Page 147: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 146 November 18, 2019 Rev. 1.10 147 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Over Current Protection – OCPThe device includes an over current protection function. The OCP detects an input voltage which is proportional to the monitored source current. If the input voltage is larger than the reference voltage set by the D/A converter, the OCP will generate an output signal to indicate that an over current event has occurred, and trigger an interrupt to inform the MCU.

OCP

OCPAO(to A/D Converter)

OCPINT(to OCP interrupt)

-

+

OCPG2~OCPG0

R2

OPA+

-

8-bit D/A converter

OCPAXCXDebounce

OCPFLT2~OCPFLT0R1(R1 = 4kΩ)

OCPREF[7:0]

fFLT=fH/4

S0

S1

S2

S3

CMP

OCPO(to PWM input)Pin

Control

OCPM[1:0]

PxSn

OCPAX

G=1/5/10/15/20/30/40/50

Over Current Protection Circuit

Over Current Protection OperationThe OCP circuit input signal originates from OCP pin, four switches S0~S3 form a mode select function. An operational amplifier and two resistors form a PGA function. The PGA gain can be positive or negative determined by the input voltage connected to the positive or negative input of the PGA. The OCPREF bit field is used to generate a reference voltage. The 8-bit D/A converter is used to generate a reference voltage. The comparator compares the reference voltage and the amplified output voltage. Finally the comparator output is filtered to generate the OCPO output to disable the PWM output and an OCPINT signal, if an over current event occurs, the signal will trigger an interrupt to inform the MCU.

The OCPO signal is also the de-bounced version of OCPAXCX which are used to indicate whether the source current is outwith the specification or not.

Note that the filter clock, fHXT is the HXT clock. The amplified output voltage also can be read out by means of another A/D converter from OCPAO. The D/A converter output voltage is controlled by the OCPREF register and the D/A converter output is defined as

D/A converter VOUT=(D/A converter VREF/256) × OCPREF[7:0]

Page 148: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 148 November 18, 2019 Rev. 1.10 149 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Input Voltage RangeTogether with different PGA operating modes, the input voltage on the OCP pin can be positive or negative for flexible operation. For the positive or negative input voltage, it is necessary to calculate the PGA output voltage with the different formulas.

• For VIN > 0, the PGA operates in the non-inverting mode and the output voltage of the PGA is:VOPGA = (1 + R2/R1) × VIN

• When the PGA operates in the non-inverting mode, it also provides a unity gain buffer function.If OCPM1~OCPM0=01 and OCPG2~OCPG0=000, the PGA gain will be 1 and the PGA is configured as a unity gain buffer. The output voltage of the PGA is VIN.

VOPGA = VIN

• For 0 >VIN > -0.2V, the PGA operates in the inverting mode, the output voltage of the PGA is: VOPGA = −(R2/R1) × VIN

Note: If VIN is negative, it cannot be lower than -0.2V which will result in current leakage.

Offset CalibrationTo operate in the input offset calibration mode for the OCP circuit, the OCPM1 and OCPM0 bit should first be set to “11”. In addition to set the corresponding control bits, the Operational Amplifier input offset calibration steps is similar to Comparator.

Operational Amplifier CalibrationStep 1: Set OCPM[1:0]=11, OCPAOFM=1 and OCPCOFM=0, the OCP will operate in the operational

amplifier input offset calibration mode.

Step 2: Set OCPAOF[5:0]=000000 and then read the OCPAXCX bit.

Step 3: Let OCPAOF[5:0]=OCPAOF[5:0]+1 and then read the OCPAXCX bit. If the OCPAXCX bit has not changed, then repeat Step 3 until the OCPAXCX bit has changed. If the OCPAXCX bit has changed, record the OCPAOF[5:0] value as VOOS1 and then go to Step 4.

Step 4: Set OCPAOF[5:0]=111111 and read the OCPAXCX bit.

Step 5: Let OCPAOF[5:0]=OCPAOF[5:0]-1 and then read the OCPAXCX bit. If the OCPAXCX bit has not changed, then repeat Step 5 until the OCPAXCX bit has changed. If the OCPAXCX bit has changed, record the OCPAOF[5:0] value as VOOS2 and then go to Step 6.

Step 6: Restore OCPAOF[5:0]=VOOS=(VOOS1+VOOS2)/2, the offset Calibration procedure is now finished.

Comparator CalibrationStep 1: Set OCPM[1:0]=11, OCPCOFM=1 and OCPAOFM=0, the OCP will now operate in the

comparator input offset calibration mode.

Step 2: Set OCPCOF[4:0]=00000 and read the OCPAXCX bit.

Step 3: Let OCPCOF[4:0]=OCPCOF[4:0]+1 and then read the OCPAXCX bit. If the OCPAXCX bit has not changed, then repeat Step 3 until the OCPAXCX bit has changed. If the OCPAXCX bit has changed, record the OCPCOF[4:0] value as VCOS1 and then go to Step 4.

Step 4: Set OCPCOF[4:0]=11111 and then read the OCPAXCX bit.

Step 5: Let OCPCOF[4:0]=OCPCOF[4:0]-1 and then read the OCPAXCX bit. If the OCPAXCX bit has not changed, then repeat Step 5 until the OCPAXCX bit has changed. If the OCPAXCX bit has changed, record the OCPCOF[4:0] value as VCOS2 and then go to Step 6.

Step 6: Restore OCPCOF[4:0]=VCOS=(VCOS1+VCOS2)/2, the offset calibration procedure is now finished.

Page 149: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 148 November 18, 2019 Rev. 1.10 149 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Over Current Protection RegistersThe OCPC0 and OCPC1 registers are control registers which used to control the OCP operating modes, the OPA function and de-bounce time. The OCPREF register is used to control D/A converter reference voltage. The OCPACAL and OCPCCAL registers are used to cancel out the operational amplifier and comparator input offset.

Register Name

Bit7 6 5 4 3 2 1 0

OCPC0 OCPM1 OCPM0 — — — — — —OCPC1 OCPO — OCPG2 OCPG1 OCPG0 OCPFLT2 OCPFLT1 OCPFLT0OCPREF D7 D6 D5 D4 D3 D2 D1 D0OCPACAL OCPAOFM OCPARS OCPAOF5 OCPAOF4 OCPAOF3 OCPAOF2 OCPAOF1 OCPAOF0OCPCCAL OCPAXCX OCPCOFM OCPCRS OCPCOF4 OCPCOF3 OCPCOF2 OCPCOF1 OCPCOF0DCMISC DEM0DAVR OCDAVR DEMO0 DEM1DAVR DEMO1 STPIS PTPIS —

Over Current Protection Register List

• OCPC0 Register

Bit 7 6 5 4 3 2 1 0Name OCPM1 OCPM0 — — — — — —R/W R/W R/W — — — — — —POR 0 0 — — — — — —

Bit 7~6 OCPM1~OCPM0: Mode selection00: OCP is disable, S1, S3 on, S0, S2 off01: Non-inverting mode, S0, S3 on, S1, S2 off10: Inverting mode, S1, S2 on, S0, S3 off11: Calibration mode, S1, S3 on, S0, S2 off

Note: If the OCP function is disabled, the internal OPA, CMP and D/A converter in the OCP circuit and debounce function will be off, and the comparator output and OCPAO pin will be in a low state.

Bit 5~0 Unimplemented, read as “0”

• OCPC1 Register

Bit 7 6 5 4 3 2 1 0Name OCPO — OCPG2 OCPG1 OCPG0 OCPFLT2 OCPFLT1 OCPFLT0R/W R — R/W R/W R/W R/W R/W R/WPOR x — 0 0 0 0 0 0

“x”: unknownBit 7 OCPO: OCP digital output

0: The monitored source current is not over1: The monitored source current is over

Bit 6 Unimplemented, read as “0”Bit 5~3 OCPG2~OCPG0: R2/R1 ratio selection, it will define PGA gain in inverting or non-

inverting mode000: Unity gain buffer(non-inverting mode) or R2/R1=1(inverting mode)001: R2/R1=5010: R2/R1=10011: R2/R1=15100: R2/R1=20101: R2/R1=30110: R2/R1=40111: R2/R1=50

Page 150: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 150 November 18, 2019 Rev. 1.10 151 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 2~0 OCPFLT2~OCPFLT0: OCP debounce time selection000: Bypass, without debounce001: (1~2)×tFLT

010: (3~4)×tFLT

011: (7~8)×tFLT

100: (15~16)×tFLT

101: (31~32)×tFLT

110: (63~64)×tFLT

111: (127~128)×tFLT

Note: tFLT=1/fFLT, fFLT=fH/4, fH=fHXT

• OCPREF Register

Bit 7 6 5 4 3 2 1 0Name D7 D6 D5 D4 D3 D2 D1 D0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7~0 D7~D0: D/A converter output voltage control bitsD/A converter output voltage=(D/A converter reference voltage /256)×N, N=OCPREF[7:0]

• OCPACAL Register

Bit 7 6 5 4 3 2 1 0

Name OCPAOFM OCPARS OCPAOF5 OCPAOF4 OCPAOF3 OCPAOF2 OCPAOF1 OCPAOF0R/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 1 0 0 0 0 0

Bit 7 OCPAOFM: OCP OPA normal operation or input offset voltage calibration mode selection0: Normal operation1: Input offset calibration mode

Bit 6 OCPARS: OCP OPA input offset voltage calibration reference selection0: Select negative input as the reference input1: Select positive input as the reference input

Bit 5~0 OCPAOF5~OCPAOF0: OCP OPA input offset voltage calibration value

• OCPCCAL Register

Bit 7 6 5 4 3 2 1 0

Name OCPAXCX OCPCOFM OCPCRS OCPCOF4 OCPCOF3 OCPCOF2 OCPCOF1 OCPCOF0R/W R R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 1 0 0 0 0

Bit 7 OCPAXCX: OPA/comparator output bit; positive logic (read only)If OCPAOFM=1, this bit is the OPA output for calibration.If OCPCOFM=1, this bit is the comparator output for calibration.Note: OCPAOFM and OCPCOFM can not be 1 simultaneously.

Bit 6 OCPCOFM: OCP comparator normal operation or input offset voltage calibration mode selection

0: Normal operation1: Input offset calibration mode

Bit 5 OCPCRS: OCP comparator input offset voltage calibration reference selection0: Select negative input as the reference input1: Select positive input as the reference input

Bit 4~0 OCPCOF4~OCPCOF0: OCP comparator input offset voltage calibration value

Page 151: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 150 November 18, 2019 Rev. 1.10 151 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• DCMISC Register

Bit 7 6 5 4 3 2 1 0Name DEM0DAVR OCDAVR DEMO0 DEM1DAVR DEMO1 STPIS PTPIS —R/W R/W R/W R R/W R R/W R/W —POR 0 0 x 0 x 0 0 —

"x": unknownBit 7 DEM0DAVR: Demodulator 0 D/A converter VREF source

Described elsewhere.Bit 6 OCDAVR: OCP D/A converter VREF source

0: AVDD

1: Internal VREF (source from the PGA output VR)Bit 5 DEMO0: Demodulator 0 outputBit 4 DEM1DAVR: Demodulator 1 D/A converter VREF source

Described elsewhere.Bit 3 DEMO1: Demodulator 1 outputBit 2 STPIS: STPI input source selection

0: STPI 1: DEMO0

Bit 1 PTPIS: PTPI input source selection0: PTPI1: DEMO1

Bit 0 Unimplemented, read as “0”

InterruptsInterrupts are an important part of any microcontroller system. When an external event or an internal function such as a Timer Module or an A/D converter requires microcontroller attention, their corresponding interrupt will enforce a temporary suspension of the main program allowing the microcontroller to direct attention to their respective needs. The device contains several external interrupt and internal interrupts functions. The external interrupts are generated by the action of the external INT0~INT1 pins, while the internal interrupts are generated by various internal functions such as the TMs, Demodulation, OCP, Time Base, LVD and the A/D converter.

Interrupt RegistersOverall interrupt control, which basically means the setting of request flags when certain microcontroller conditions occur and the setting of interrupt enable bits by the application program, is controlled by a series of registers, located in the Special Purpose Data Memory, as shown in the accompanying table. The number of registers falls into three categories. The first is the INTC0~INTC3 registers which setup the primary interrupts, the second is the MFI0~MFI5 registers which setup the Multi-function interrupts. Finally there is an INTEG register to setup the external interrupt trigger edge type.

Each register contains a number of enable bits to enable or disable individual registers as well as interrupt flags to indicate the presence of an interrupt request. The naming convention of these follows a specific pattern. First is listed an abbreviated interrupt type, then the (optional) number of that interrupt followed by either an “E” for enable/disable bit or “F” for request flag.

Page 152: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 152 November 18, 2019 Rev. 1.10 153 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Function Enable Bit Request Flag NotesGlobal EMI — —INTn Pin INTnE INTnF n=0~1OCP OCPE OCPF ─Demodulation DEMnE DEMnF n=0~1

High Resolution PWM Generator

FDSWnE FDSWnF n=0~1FRESFE FRESFF —FDNFE FDNFF —

A/D Converter ADE ADF ─Time Base TBnE TBnF n=0~1Multi-function MFnE MFnF n=0~5I2C IICE IICF —LVD LVE LVF —EEPROM DEE DEF —

CTMCTMPE CTMPF

—CTMAE CTMAF

STMSTMPE STMPF

—STMAE STMAF

PTMPTMPE PTMPF

—PTMAE PTMAF

Interrupt Register Bit Naming Conventions

Register Name

Bit7 6 5 4 3 2 1 0

INTEG — — — — INT1S1 INT1S0 INT0S1 INT0S0INTC0 — DEM1F DEM0F OCPF DEM1E DEM0E OCPE EMIINTC1 MF1F MF0F FDSW1F FDSW0F MF1E MF0E FDSW1E FDSW0EINTC2 MF5F MF4F MF3F MF2F MF5E MF4E MF3E MF2EINTC3 INT1F INT0F TB1F TB0F INT1E INT0E TB1E TB0EMFI0 — — FRESFF FDNFF — — FRESFE FDNFEMFI1 — — CTMAF CTMPF — — CTMAE CTMPEMFI2 — — STMAF STMPF — — STMAE STMPEMFI3 — — PTMAF PTMPF — — PTMAE PTMPEMFI4 — — ADF IICF — — ADE IICEMFI5 — — DEF LVF — — DEE LVE

Interrupt Register List

Page 153: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 152 November 18, 2019 Rev. 1.10 153 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• INTEG Register

Bit 7 6 5 4 3 2 1 0Name — — — — INT1S1 INT1S0 INT0S1 INT0S0R/W — — — — R/W R/W R/W R/WPOR — — — — 0 0 0 0

Bit 7~4 Unimplemented, read as “0”Bit 3~2 INT1S1~INT1S0: Interrupt edge control for INT1 pin

00: Disable01: Rising edge10: Falling edge11: Rising and falling edges

Bit 1~0 INT0S1~INT0S0: Interrupt edge control for INT0 pin00: Disable01: Rising edge10: Falling edge11: Rising and falling edges

• INTC0 Register

Bit 7 6 5 4 3 2 1 0Name — DEM1F DEM0F OCPF DEM1E DEM0E OCPE EMIR/W — R/W R/W R/W R/W R/W R/W R/WPOR — 0 0 0 0 0 0 0

Bit 7 Unimplemented, read as “0”Bit 6 DEM1F: Demodulation 1 interrupt request flag

0: No request1: Interrupt request

Bit 5 DEM0F: Demodulation 0 interrupt request flag0: No request1: Interrupt request

Bit 4 OCPF: OCP interrupt request flag0: No request1: Interrupt request

Bit 3 DEM1E: Demodulation 1 interrupt control0: Disable1: Enable

Bit 2 DEM0E: Demodulation 0 interrupt control0: Disable1: Enable

Bit 1 OCPE: OCP interrupt control0: Disable1: Enable

Bit 0 EMI: Global interrupt control0: Disable1: Enable

Page 154: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 154 November 18, 2019 Rev. 1.10 155 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• INTC1 Register

Bit 7 6 5 4 3 2 1 0Name MF1F MF0F FDSW1F FDSW0F MF1E MF0E FDSW1E FDSW0ER/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 MF1F: Multi-function interrupt 1 request flag0: No request1: Interrupt request

Bit 6 MF0F: Multi-function interrupt 0 request flag0: No request1: Interrupt request

Bit 5 FDSW1F: FDSW1 interrupt request flag0: No request1: Interrupt request

Bit 4 FDSW0F: FDSW0 interrupt request flag0: No request1: Interrupt request

Bit 3 MF1E: Multi-function interrupt 1 control0: Disable1: Enable

Bit 2 MF0E: Multi-function interrupt 0 control0: Disable1: Enable

Bit 1 FDSW1E: FDSW1 interrupt control0: Disable1: Enable

Bit 0 FDSW0E: FDSW0 interrupt control0: Disable1: Enable

• INTC2 Register

Bit 7 6 5 4 3 2 1 0Name MF5F MF4F MF3F MF2F MF5E MF4E MF3E MF2ER/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 MF5F: Multi-function interrupt 5 request flag0: No request1: Interrupt request

Bit 6 MF4F: Multi-function interrupt 4 request flag0: No request1: Interrupt request

Bit 5 MF3F: Multi-function interrupt 3 request flag0: No request1: Interrupt request

Bit 4 MF2F: Multi-function interrupt 2 request flag0: No request1: Interrupt request

Bit 3 MF5E: Multi-function interrupt 5 control0: Disable1: Enable

Page 155: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 154 November 18, 2019 Rev. 1.10 155 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Bit 2 MF4E: Multi-function interrupt 4 control0: Disable1: Enable

Bit 1 MF3E: Multi-function interrupt 3 control0: Disable1: Enable

Bit 0 MF2E: Multi-function interrupt 2 control0: Disable1: Enable

• INTC3 Register

Bit 7 6 5 4 3 2 1 0Name INT1F INT0F TB1F TB0F INT1E INT0E TB1E TB0ER/W R/W R/W R/W R/W R/W R/W R/W R/WPOR 0 0 0 0 0 0 0 0

Bit 7 INT1F: External Interrupt 1 Request Flag0: No request1: Interrupt request

Bit 6 INT0F: External Interrupt 0 Request Flag0: No request1: Interrupt request

Bit 5 TB1F: Time Base 1 Interrupt Request Flag0: No request1: Interrupt request

Bit 4 TB0F: Time Base 0 Interrupt Request Flag0: No request1: Interrupt request

Bit 3 INT1E: External Interrupt 1 Control0: Disable1: Enable

Bit 2 INT0E: External Interrupt 0 Control0: Disable1: Enable

Bit 1 TB1E: Time Base 1 Interrupt Control0: Disable1: Enable

Bit 0 TB0E: Time Base 0 Interrupt Control0: Disable1: Enable

Page 156: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 156 November 18, 2019 Rev. 1.10 157 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• MFI0 Register

Bit 7 6 5 4 3 2 1 0Name — — FRESFF FDNFF — — FRESFE FDNFER/W — — R/W R/W — — R/W R/WPOR — — 0 0 — — 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 FRESFF: FSK response data delivery finish interrupt request flag

0: No request1: Interrupt request

Bit 4 FDNFF: Whole FSK packt delivery finish interrupt request flag0: No request1: Interrupt request

Bit 3~2 Unimplemented, read as “0”Bit 1 FRESFE: FSK response data delivery finish interrupt control

0: Disable1: Enable

Bit 0 FDNFE: Whole FSK packt delivery finish interrupt control0: Disable1: Enable

• MFI1 Register

Bit 7 6 5 4 3 2 1 0Name — — CTMAF CTMPF — — CTMAE CTMPER/W — — R/W R/W — — R/W R/WPOR — — 0 0 — — 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 CTMAF: CTM Comparator A match interrupt request flag

0: No request1: Interrupt request

Bit 4 CTMPF: CTM Comparator P match interrupt request flag0: No request1: Interrupt request

Bit 3~2 Unimplemented, read as “0”Bit 1 CTMAE: CTM Comparator A match interrupt control

0: Disable1: Enable

Bit 0 CTMPE: CTM Comparator P match interrupt control0: Disable1: Enable

Page 157: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 156 November 18, 2019 Rev. 1.10 157 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• MFI2 Register

Bit 7 6 5 4 3 2 1 0Name — — STMAF STMPF — — STMAE STMPER/W — — R/W R/W — — R/W R/WPOR — — 0 0 — — 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 STMAF: STM Comparator A match interrupt request flag

0: No request1: Interrupt request

Bit 4 STMPF: STM Comparator P match interrupt request flag0: No request1: Interrupt request

Bit 3~2 Unimplemented, read as “0”Bit 1 STMAE: STM Comparator A match interrupt control

0: Disable1: Enable

Bit 0 STMPE: STM Comparator P match interrupt control0: Disable1: Enable

• MFI3 Register

Bit 7 6 5 4 3 2 1 0Name — — PTMAF PTMPF — — PTMAE PTMPER/W — — R/W R/W — — R/W R/WPOR — — 0 0 — — 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 PTMAF: PTM Comparator A match interrupt request flag

0: No request1: Interrupt request

Bit 4 PTMPF: PTM Comparator P match interrupt request flag0: No request1: Interrupt request

Bit 3~2 Unimplemented, read as “0”Bit 1 PTMAE: PTM Comparator A match interrupt control

0: Disable1: Enable

Bit 0 PTMPE: PTM Comparator P match interrupt control0: Disable1: Enable

Page 158: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 158 November 18, 2019 Rev. 1.10 159 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• MFI4 Register

Bit 7 6 5 4 3 2 1 0Name — — ADF IICF — — ADE IICER/W — — R/W R/W — — R/W R/WPOR — — 0 0 — — 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 ADF: A/D Converter interrupt request flag

0: No request1: Interrupt request

Bit 4 IICF: I2C interrupt request flag0: No request1: Interrupt request

Bit 3~2 Unimplemented, read as “0”Bit 1 ADE: A/D Converter interrupt control

0: Disable1: Enable

Bit 0 IICE: I2C interrupt control0: Disable1: Enable

• MFI5 Register

Bit 7 6 5 4 3 2 1 0Name — — DEF LVF — — DEE LVER/W — — R/W R/W — — R/W R/WPOR — — 0 0 — — 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 DEF: EEPROM Interrupt interrupt request flag

0: No request1: Interrupt request

Bit 4 LVF: LVD interrupt request flag0: No request1: Interrupt request

Bit 3~2 Unimplemented, read as “0”Bit 1 DEE: Data EEPROM interrupt control

0: Disable1: Enable

Bit 0 LVE: LVD interrupt control0: Disable1: Enable

Page 159: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 158 November 18, 2019 Rev. 1.10 159 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Interrupt OperationWhen the conditions for an interrupt event occur, such as a TM Comparator P or Comparator A match or A/D conversion completion etc., the relevant interrupt request flag will be set. Whether the request flag actually generates a program jump to the relevant interrupt vector is determined by the condition of the interrupt enable bit. If the enable bit is set high then the program will jump to its relevant vector; if the enable bit is zero then although the interrupt request flag is set an actual interrupt will not be generated and the program will not jump to the relevant interrupt vector. The global interrupt enable bit, if cleared to zero, will disable all interrupts.

When an interrupt is generated, the Program Counter, which stores the address of the next instruction to be executed, will be transferred onto the stack. The Program Counter will then be loaded with a new address which will be the value of the corresponding interrupt vector. The microcontroller will then fetch its next instruction from this interrupt vector. The instruction at this vector will usually be a “JMP” which will jump to another section of program which is known as the interrupt service routine. Here is located the code to control the appropriate interrupt. The interrupt service routine must be terminated with a “RETI”, which retrieves the original Program Counter address from the stack and allows the microcontroller to continue with normal execution at the point where the interrupt occurred.

The various interrupt enable bits, together with their associated request flags, are shown in the accompanying diagrams with their order of priority. Some interrupt sources have their own individual vector while others share the same multi-function interrupt vector. Once an interrupt subroutine is serviced, all the other interrupts will be blocked, as the global interrupt enable bit, EMI bit will be cleared automatically. This will prevent any further interrupt nesting from occurring. However, if other interrupt requests occur during this interval, although the interrupt will not be immediately serviced, the request flag will still be recorded.

If an interrupt requires immediate servicing while the program is already in another interrupt service routine, the EMI bit should be set after entering the routine, to allow interrupt nesting. If the stack is full, the interrupt request will not be acknowledged, even if the related interrupt is enabled, until the Stack Pointer is decremented. If immediate service is desired, the stack must be prevented from becoming full. In case of simultaneous requests, the accompanying diagram shows the priority that is applied. All of the interrupt request flags when set will wake-up the device if it is in SLEEP or IDLE Mode, however to prevent a wake-up from occurring the corresponding flag should be set before the device is in SLEEP or IDLE Mode.

Page 160: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 160 November 18, 2019 Rev. 1.10 161 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Interrupt Name

Request Flags

Enable Bits

Master Enable Vector

EMI auto disabled in ISR

PriorityHigh

Low

10H

18H

04H

0CH

08H

OCP OCPF OCPE EMI

Demodulation 0 DEM0F DEM0E EMI

Legend

Demodulation 1 DEM1F DEM1E EMI

FDSW0INT FDSW0F FDSW0E EMI

Interrupts contained within Multi-Function Interrupts

1CH

20H

14H

Interrupt Name

Request Flags

Enable Bits

M. Funct. 0 MF0F MF0E EMI

24H

FDSW1INT FDSW1F FDSW1E EMI

M. Funct. 3 MF3F MF3E EMI

EMIM. Funct. 1 MF1F MF1E

CTM P CTMPF CTMPE

CTM A CTMAF CTMAE

EMIM. Funct. 2 MF2F MF2E

PTM P PTMPF PTMPE

PTM A PTMAF PTMAE

I2C IICF IICE

A/D Converter ADF ADE

FDNINT FDNFF FDNFE

FRESINT FRESFF FRESFE

LVD LVF LVE

EEPROM DEF DEE

xxE Enable Bits

xxF Request Flag, auto reset in ISR

xxF Request Flag, no auto reset in ISR

Time Base 0 TB0F TB0E

38H

3CH

INT0 Pin INT0F INT0E EMI

EMIINT1 Pin INT1F INT1E

M. Funct. 5 MF5F MF5E EMI

EMIM. Funct. 4 MF4F MF4E 28H

2CH

30H

34H

EMI

Time Base 1 TB1F TB1E EMI

STM P STMPF STMPE

STM A STMAF STMAE

Interrupt Structure

External InterruptsThe external interrupts are controlled by signal transitions on the pins INT0 and INT1. An external interrupt request will take place when the external interrupt request flags, INT0F~INT1F, are set, which will occur when a transition, whose type is chosen by the edge select bits, appears on the external interrupt pins. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI and respective external interrupt enable bit, INT0E~INT1E, must first be set. Additionally the correct interrupt edge type must be selected using the INTEG register to enable the external interrupt function and to choose the trigger edge type. As the external interrupt pins are pin-shared with I/O pins, they can only be configured as external interrupt pins if their external interrupt enable bit in the corresponding interrupt register has been set and the external interrupt pin is selected by the corresponding pin-shared function selection bits. The pin must also be setup as an input by setting the corresponding bit in the port control register. When the interrupt is enabled, the stack is not full and the correct transition type appears on the external interrupt pin, a subroutine call to the external interrupt vector, will take place. When the interrupt is serviced, the external interrupt request flags,

Page 161: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 160 November 18, 2019 Rev. 1.10 161 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

INT0F~INT1F, will be automatically reset and the EMI bit will be automatically cleared to disable other interrupts. Note that any pull-high resistor selections on the external interrupt pins will remain valid even if the pin is used as an external interrupt input.

The INTEG register is used to select the type of active edge that will trigger the external interrupt. A choice of either rising or falling or both edge types can be chosen to trigger an external interrupt. Note that the INTEG register can also be used to disable the external interrupt function.

Multi-function InterruptsWithin the device there are six Multi-function interrupts. Unlike the other independent interrupts, these interrupts have no independent source, but rather are formed from other existing interrupt sources, namely the FDNINT, FRESINT, TM Interrupts, I2C Interrupt, A/D Converter Interrupt, EEPROM Interrupt and LVD Interrupt.

A Multi-function interrupt request will take place when any of the Multi-function interrupt request flags, MFnF are set. The Multi-function interrupt flags will be set when any of their included functions generate an interrupt request flag. When the Multi-function interrupt is enabled and the stack is not full, and either one of the interrupts contained within each of Multi-function interrupt occurs, a subroutine call to one of the Multi-function interrupt vectors will take place. When the interrupt is serviced, the related Multi-Function request flag will be automatically reset and the EMI bit will be automatically cleared to disable other interrupts.

However, it must be noted that, although the Multi-function Interrupt flags will be automatically reset when the interrupt is serviced, the request flags from the original source of the Multi-function interrupts will not be automatically reset and must be manually reset by the application program.

Over Current Protection InterruptAn OCP Interrupt request will take place when the OCP Interrupt request flag, OCPF, is set, which occurs when a large current is detected. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and OCP Interrupt enable bit, OCPE, must first be set. When the interrupt is enabled, the stack is not full and an over current is detected, a subroutine call to the OCP Interrupt vector, will take place. When the interrupt is serviced, the OCP Interrupt flag, OCPF, will be automatically cleared. The EMI bit will also be automatically cleared to disable other interrupts.

Demodulation InterruptsThe Demodulation Interrupts are controlled by the demodulation process. A Demodulation Interrupt request will take place when the Demodulation Interrupt request flag, DEMnF, is set, which occurs when the Demodulation process finishes. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and Demodulation Interrupt enable bit, DEMnE, must first be set. When the interrupt is enabled, the stack is not full and Demodulation process has ended, a subroutine call to the Demodulation Interrupt vector, will take place. When the interrupt is serviced, the Demodulation Interrupt flag, DEMnF, will be automatically cleared. The EMI bit will also be automatically cleared to disable other interrupts.

Page 162: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 162 November 18, 2019 Rev. 1.10 163 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

FSKDASWn InterruptAn FSKDASWn Interrupt request will take place when the FSKDASWn Interrupt request flag, FDSWnF, is set, which occurs when the FSKDASWn delivery is finishing. To allow the program to branch to the respective interrupt vector addresses, the global interrupt enable bit, EMI, and FSKDASWn interrupt enable bit, FDSWnE, must first be set. When the interrupt is enabled, the stack is not full and FSKDASWn delivery is finished, a subroutine call to the FSKDASWn Interrupt vector, will take place. When the interrupt is serviced, the FSKDASWn Interrupt flag, FDSWnF, will be automatically cleared. The EMI bit will also be automatically cleared to disable other interrupts.

Whole FSK Packt Delivery Finish InterruptThe Whole FSK Packt Delivery Finish Interrupt, which is contained within the Multi-function Interrupt, is controlled by the delivery of the whole FSK Packt process. An the Whole FSK Packt Delivery Finish Interrupt request will take place when the whole FSK packt delivery finish Interrupt request flag, FDNFF, is set, which occurs when the whole FSK packt delivery finish. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and relevant Multi-function Interrupt enable bit, MFnE, and the whole FSK packt delivery finish interrupt enable bit, FDNFE, must first be set. When the interrupt is enabled, the stack is not full and the whole FSK packt delivery process has ended, a subroutine call to the relevant Multi-function Interrupt vector locations, will take place. When the interrupt is serviced, the EMI bit will also be automatically cleared to disable other interrupts, however only the related MFnF flag will be automatically cleared. As the FDNFF flag will not be automatically cleared, it has to be cleared by the application program.

FSK Response Data Delivery Finish InterruptThe FSK Response Data Delivery Interrupt, which is contained within the Multi-function Interrupt, is controlled by the delivery of the FSK response data delivery process. An the FSK Response Data Delivery Finish Interrupt request will take place when the FSK response data delivery finish Interrupt request flag, FRESFF, is set, which occurs when FSK the response data delivery finish. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and relevant Multi-function Interrupt enable bit, MFnE, and the FSK response data delivery finish interrupt enable bit, FRESFE, must first be set. When the interrupt is enabled, the stack is not full and the FSK response data delivery process has ended, a subroutine call to the relevant Multi-function Interrupt vector locations, will take place. When the interrupt is serviced, the EMI bit will also be automatically cleared to disable other interrupts, however only the related MFnF flag will be automatically cleared. As the FRESFF flag will not be automatically cleared, it has to be cleared by the application program.

I2C InterruptThe I2C Interrupt is contained within the Multi-function Interrupt. An I2C Interrupt request will take place when the I2C Interrupt request flag, IICF, is set, which occurs when a byte of data has been received or transmitted by the I2C interface, or I2C address match occurs, or I2C time-out occurs. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and relevant Multi-function Interrupt enable bit, MFnE, and the I2C Interrupt enable bit, IICE, must first be set. When the interrupt is enabled, the stack is not full and one of the above condition occurs, a subroutine call to the respective Interrupt vector, will take place. When the I2C Interface Interrupt is serviced, the EMI bit will be automatically cleared to disable other interrupts, however only the Multi-function interrupt request flag will be also automatically cleared. As the IICF flag will not be automatically cleared, it has to be cleared by the application program.

Page 163: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 162 November 18, 2019 Rev. 1.10 163 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

A/D Converter InterruptThe A/D Converter Interrupt is contained within the Multi-function Interrupt. The A/D Converter Interrupt is controlled by the termination of an A/D conversion process. An A/D Converter Interrupt request will take place when the A/D Converter Interrupt request flag, ADF, is set, which occurs when the A/D conversion process finishes. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and relevant Multi-function Interrupt enable bit, MFnE, and A/D Interrupt enable bit, ADE, must first be set. When the interrupt is enabled, the stack is not full and the A/D conversion process has ended, a subroutine call to the relevant Multi-function Interrupt vector locations, will take place. When the interrupt is serviced, the EMI bit will also be automatically cleared to disable other interrupts, however only the related MFnF flag will be automatically cleared. As the ADF flag will not be automatically cleared, it has to be cleared by the application program.

Time Base InterruptsThe function of the Time Base Interrupt is to provide regular time signal in the form of an internal interrupt. It is controlled by the overflow signal from its internal timer. When this happens its interrupt request flag, TBnF, will be set. To allow the program to branch to its respective interrupt vector addresses, the global interrupt enable bit, EMI and Time Base enable bit, TBnE, must first be set. When the interrupt is enabled, the stack is not full and the Time Base overflows, a subroutine call to its respective vector location will take place. When the interrupt is serviced, the interrupt request flag, TBnF, will be automatically reset and the EMI bit will be cleared to disable other interrupts.

The purpose of the Time Base Interrupt is to provide an interrupt signal at fixed time periods. Its clock source, fTB0 or fTB1, originates from the internal clock source fSYS, fSYS/4 or fSUB. And then passes through a prescaler, the division ratio of which is selected by programming the appropriate bits in the TBC0 or TBC1 register to obtain longer interrupt periods whose value ranges.

MUX

fSYS/4fSYS

fSUB

Prescaler 0

CLKSEL0[1:0]

fTB0 fTB0/28 ~ fTB0/215 MUX

MUX

TB0[2:0]

TB1[2:0]

Time Base 0 Interrupt

Time Base 1 Interrupt

TB0EN

TB1EN

MUX

fSYS/4fSYS

fSUB

Prescaler 1

CLKSEL1[1:0]

fTB1 fTB1/28 ~ fTB1/215

Time Base Interrupts (n=0~1)

Page 164: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 164 November 18, 2019 Rev. 1.10 165 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• PSCR RegisterBit 7 6 5 4 3 2 1 0

Name — — — — CLKSEL11 CLKSEL10 CLKSEL01 CLKSEL00R/W — — — — R/W R/W R/W R/WPOR — — — — 0 0 0 0

Bit 7~4 Unimplemented, read as “0”Bit 3~2 CLKSEL11~CLKSEL10: Prescaler 1 clock source selection

00: fSYS

01: fSYS/41x: fSUB

Bit 1~0 CLKSEL01~CLKSEL00: Prescaler 0 clock source selection00: fSYS

01: fSYS/41x: fSUB

• TBC0 RegisterBit 7 6 5 4 3 2 1 0

Name TB0EN — — — — TB02 TB01 TB00R/W R/W — — — — R/W R/W R/WPOR 0 — — — — 1 1 1

Bit 7 TB0EN: Time Base 0 Control bit0: Disable1: Enable

Bit 6~3 Unimplemented, read as “0”Bit 2~0 TB02~TB00: Select Time Base 0 Time-out Period

000: 28/fTB0

001: 29/fTB0

010: 210/fTB0

011: 211/fTB0

100: 212/fTB0

101: 213/fTB0

110: 214/fTB0

111: 215/fTB0

• TBC1 RegisterBit 7 6 5 4 3 2 1 0

Name TB1EN — — — — TB12 TB11 TB10R/W R/W — — — — R/W R/W R/WPOR 0 — — — — 1 1 1

Bit 7 TB1EN: Time Base 1 Control bit0: Disable1: Enable

Bit 6~3 Unimplemented, read as “0”Bit 2~0 TB12~TB10: Select Time Base 1 Time-out Period

000: 28/fTB1

001: 29/fTB1

010: 210/fTB1

011: 211/fTB1

100: 212/fTB1

101: 213/fTB1

110: 214/fTB1

111: 215/fTB1

Page 165: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 164 November 18, 2019 Rev. 1.10 165 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

EEPROM InterruptThe EEPROM interrupt is contained within the Multi-function Interrupt. An EEPROM Interrupt request will take place when the EEPROM Interrupt request flag, DEF, is set, which occurs when an EEPROM Write cycle ends. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, and EEPROM Interrupt enable bit, DEE, and associated Multi-function interrupt enable bit, must first be set. When the interrupt is enabled, the stack is not full and an EEPROM Write cycle ends, a subroutine call to the respective EEPROM Interrupt vector will take place. When the EEPROM Interrupt is serviced, the EMI bit will be automatically cleared to disable other interrupts, however only the Multi-function interrupt request flag will be also automatically cleared. As the DEF flag will not be automatically cleared, it has to be cleared by the application program.

LVD InterruptThe Low Voltage Detector Interrupt is contained within the Multi-function Interrupt. An LVD Interrupt request will take place when the LVD Interrupt request flag, LVF, is set, which occurs when the Low Voltage Detector function detects a low power supply voltage. To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, Low Voltage Interrupt enable bit, LVE, and associated Multi-function interrupt enable bit, must first be set. When the interrupt is enabled, the stack is not full and a low voltage condition occurs, a subroutine call to the Multi-function Interrupt vector, will take place. When the Low Voltage Interrupt is serviced, the EMI bit will be automatically cleared to disable other interrupts, however only the Multi-function interrupt request flag will be also automatically cleared. As the LVF flag will not be automatically cleared, it has to be cleared by the application program.

TM InterruptsThe Compact, Standard and Periodic Type TMs have two interrupts, one comes from the comparator A match situation and the other comes from the comparator P match situation. All of the TM interrupts are contained within the Multi-function Interrupts. For all of the TM types there are two interrupt request flags and two enable control bits. A TM interrupt request will take place when any of the TM request flags are set, a situation which occurs when a TM comparator P or A match situation happens.

To allow the program to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, respective TM Interrupt enable bit, and relevant Multi-function Interrupt enable bit, MFnE, must first be set. When the interrupt is enabled, the stack is not full and a TM comparator match situation occurs, a subroutine call to the relevant Multi-function Interrupt vector locations, will take place. When the TM interrupt is serviced, the EMI bit will be automatically cleared to disable other interrupts, however only the related MFnF flag will be automatically cleared. As the TM interrupt request flags will not be automatically cleared, they have to be cleared by the application program.

Interrupt Wake-up FunctionEach of the interrupt functions has the capability of waking up the microcontroller when in the SLEEP or IDLE Mode. A wake-up is generated when an interrupt request flag changes from low to high and is independent of whether the interrupt is enabled or not. Therefore, even though the device is in the SLEEP or IDLE Mode and its system oscillator stopped, situations such as external edge transitions on the external interrupt pins or a low power supply voltage may cause their respective interrupt flag to be set high and consequently generate an interrupt. Care must therefore be taken if spurious wake-up situations are to be avoided. If an interrupt wake-up function is to be disabled then the corresponding interrupt request flag should be set high before the device enters the SLEEP or IDLE Mode. The interrupt enable bits have no effect on the interrupt wake-up function.

Page 166: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 166 November 18, 2019 Rev. 1.10 167 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Programming ConsiderationsBy disabling the relevant interrupt enable bits, a requested interrupt can be prevented from being serviced, however, once an interrupt request flag is set, it will remain in this condition in the interrupt register until the corresponding interrupt is serviced or until the request flag is cleared by the application program.

Where a certain interrupt is contained within a Multi-function interrupt, then when the interrupt service routine is executed, as only the Multi-function interrupt request flags, MFnF, will be automatically cleared, the individual request flag for the function needs to be cleared by the application program.

It is recommended that programs do not use the “CALL” instruction within the interrupt service subroutine. Interrupts often occur in an unpredictable manner or need to be serviced immediately. If only one stack is left and the interrupt is not well controlled, the original control sequence will be damaged once a CALL subroutine is executed in the interrupt subroutine.

Every interrupt has the capability of waking up the microcontroller when it is in the SLEEP or IDLE Mode, the wake up being generated when the interrupt request flag changes from low to high. If it is required to prevent a certain interrupt from waking up the microcontroller then its respective request flag should be first set high before enter SLEEP or IDLE Mode.

As only the Program Counter is pushed onto the stack, then when the interrupt is serviced, if the contents of the accumulator, status register or other registers are altered by the interrupt service program, their contents should be saved to the memory at the beginning of the interrupt service routine.

To return from an interrupt subroutine, either a RET or RETI instruction may be executed. The RETI instruction in addition to executing a return to the main program also automatically sets the EMI bit high to allow further interrupts. The RET instruction however only executes a return to the main program leaving the EMI bit in its present zero state and therefore disabling the execution of further interrupts.

Low Voltage Detector – LVDThe device has a Low Voltage Detector function, also known as LVD. This enables the device to monitor the power supply voltage, VDD, and provide a warning signal should it fall below a certain level. This function may be especially useful in battery applications where the supply voltage will gradually reduce as the battery ages, as it allows an early warning battery low signal to be generated. The Low Voltage Detector also has the capability of generating an interrupt signal.

LVD RegisterThe Low Voltage Detector function is controlled using a single register with the name LVDC. Three bits in this register, VLVD2~VLVD0, are used to select one of eight fixed voltages below which a low voltage condition will be determined. A low voltage condition is indicated when the LVDO bit is set. If the LVDO bit is low, this indicates that the VDD voltage is above the preset low voltage value. The LVDEN bit is used to control the overall on/off function of the low voltage detector. Setting the bit high will enable the low voltage detector. Clearing the bit to zero will switch off the internal low voltage detector circuits. As the low voltage detector will consume a certain amount of power, it may be desirable to switch off the circuit when not in use, an important consideration in power sensitive battery powered applications.

Page 167: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 166 November 18, 2019 Rev. 1.10 167 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

• LVDC Register

Bit 7 6 5 4 3 2 1 0Name — — LVDO LVDEN — VLVD2 VLVD1 VLVD0R/W — — R R/W — R/W R/W R/WPOR — — 0 0 — 0 0 0

Bit 7~6 Unimplemented, read as “0”Bit 5 LVDO: LVD Output flag

0: No Low Voltage Detected1: Low Voltage Detected

Bit 4 LVDEN: Low Voltage Detector Enable control0: Disable1: Enable

Bit 3 Unimplemented, read as “0”Bit 2~0 VLVD2~VLVD0: LVD Voltage selection

000: 2.0V001: 2.2V010: 2.4V011: 2.7V100: 3.0V101: 3.3V110: 3.6V111: 4.0V

LVD OperationThe Low Voltage Detector function operates by comparing the power supply voltage, VDD, with a pre-specified voltage level stored in the LVDC register. This has a range of between 2.0V and 4.0V. When the power supply voltage, VDD, falls below this pre-determined value, the LVDO bit will be set high indicating a low power supply voltage condition. When the device is in the SLEEP mode, the low voltage detector will be disabled even if the LVDEN bit is high. After enabling the Low Voltage Detector, a time delay tLVDS should be allowed for the circuitry to stabilise before reading the LVDO bit. Note also that as the VDD voltage may rise and fall rather slowly, at the voltage nears that of VLVD, there may be multiple bit LVDO transitions.

VDD

LVDEN

LVDO

VLVD

tLVDS

LVD Operation

The Low Voltage Detector also has its own interrupt which is contained within one of the Multi-function interrupts, providing an alternative means of low voltage detection, in addition to polling the LVDO bit. The interrupt will only be generated after a delay of tLVD after the LVDO bit has been set high by a low voltage condition. In this case, the LVF interrupt request flag will be set, causing an interrupt to be generated if VDD falls below the preset LVD voltage. This will cause the device to wake-up from IDLE Mode, however if the Low Voltage Detector wake up function is not required then the LVF flag should be first set high before the device enters the IDLE Mode Mode.

Page 168: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 168 November 18, 2019 Rev. 1.10 169 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Application Descriptions

Page 169: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 168 November 18, 2019 Rev. 1.10 169 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Page 170: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 170 November 18, 2019 Rev. 1.10 171 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Instruction Set

IntroductionCentral to the successful operation of any microcontroller is its instruction set, which is a set of program instruction codes that directs the microcontroller to perform certain operations. In the case of Holtek microcontroller, a comprehensive and flexible set of over 60 instructions is provided to enable programmers to implement their application with the minimum of programming overheads.

For easier understanding of the various instruction codes, they have been subdivided into several functional groupings.

Instruction TimingMost instructions are implemented within one instruction cycle. The exceptions to this are branch, call, or table read instructions where two instruction cycles are required. One instruction cycle is equal to 4 system clock cycles, therefore in the case of an 8MHz system oscillator, most instructions would be implemented within 0.5μs and branch or call instructions would be implemented within 1μs. Although instructions which require one more cycle to implement are generally limited to the JMP, CALL, RET, RETI and table read instructions, it is important to realize that any other instructions which involve manipulation of the Program Counter Low register or PCL will also take one more cycle to implement. As instructions which change the contents of the PCL will imply a direct jump to that new address, one more cycle will be required. Examples of such instructions would be “CLR PCL” or “MOV PCL, A”. For the case of skip instructions, it must be noted that if the result of the comparison involves a skip operation then this will also take one more cycle, if no skip is involved then only one cycle is required.

Moving and Transferring DataThe transfer of data within the microcontroller program is one of the most frequently used operations. Making use of three kinds of MOV instructions, data can be transferred from registers to the Accumulator and vice-versa as well as being able to move specific immediate data directly into the Accumulator. One of the most important data transfer applications is to receive data from the input ports and transfer data to the output ports.

Arithmetic OperationsThe ability to perform certain arithmetic operations and data manipulation is a necessary feature of most microcontroller applications. Within the Holtek microcontroller instruction set are a range of add and subtract instruction mnemonics to enable the necessary arithmetic to be carried out. Care must be taken to ensure correct handling of carry and borrow data when results exceed 255 for addition and less than 0 for subtraction. The increment and decrement instructions INC, INCA, DEC and DECA provide a simple means of increasing or decreasing by a value of one of the values in the destination specified.

Page 171: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 170 November 18, 2019 Rev. 1.10 171 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Logical and Rotate OperationThe standard logical operations such as AND, OR, XOR and CPL all have their own instruction within the Holtek microcontroller instruction set. As with the case of most instructions involving data manipulation, data must pass through the Accumulator which may involve additional programming steps. In all logical data operations, the zero flag may be set if the result of the operation is zero. Another form of logical data manipulation comes from the rotate instructions such as RR, RL, RRC and RLC which provide a simple means of rotating one bit right or left. Different rotate instructions exist depending on program requirements. Rotate instructions are useful for serial port programming applications where data can be rotated from an internal register into the Carry bit from where it can be examined and the necessary serial bit set high or low. Another application which rotate data operations are used is to implement multiplication and division calculations.

Branches and Control TransferProgram branching takes the form of either jumps to specified locations using the JMP instruction or to a subroutine using the CALL instruction. They differ in the sense that in the case of a subroutine call, the program must return to the instruction immediately when the subroutine has been carried out. This is done by placing a return instruction “RET” in the subroutine which will cause the program to jump back to the address right after the CALL instruction. In the case of a JMP instruction, the program simply jumps to the desired location. There is no requirement to jump back to the original jumping off point as in the case of the CALL instruction. One special and extremely useful set of branch instructions are the conditional branches. Here a decision is first made regarding the condition of a certain data memory or individual bits. Depending upon the conditions, the program will continue with the next instruction or skip over it and jump to the following instruction. These instructions are the key to decision making and branching within the program perhaps determined by the condition of certain input switches or by the condition of internal data bits.

Bit OperationsThe ability to provide single bit operations on Data Memory is an extremely flexible feature of all Holtek microcontrollers. This feature is especially useful for output port bit programming where individual bits or port pins can be directly set high or low using either the “SET [m].i” or “CLR [m].i” instructions respectively. The feature removes the need for programmers to first read the 8-bit output port, manipulate the input data to ensure that other bits are not changed and then output the port with the correct new data. This read-modify-write process is taken care of automatically when these bit operation instructions are used.

Table Read OperationsData storage is normally implemented by using registers. However, when working with large amounts of fixed data, the volume involved often makes it inconvenient to store the fixed data in the Data Memory. To overcome this problem, Holtek microcontrollers allow an area of Program Memory to be set as a table where data can be directly stored. A set of easy to use instructions provides the means by which this fixed data can be referenced and retrieved from the Program Memory.

Other OperationsIn addition to the above functional instructions, a range of other instructions also exist such as the “HALT” instruction for Power-down operations and instructions to control the operation of the Watchdog Timer for reliable program operations under extreme electric or electromagnetic environments. For their relevant operations, refer to the functional related sections.

Page 172: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 172 November 18, 2019 Rev. 1.10 173 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Instruction Set SummaryThe instructions related to the data memory access in the following table can be used when the desired data memory is located in Data Memory sector 0.

Table Conventionsx: Bits immediate data m: Data Memory address A: Accumulator i: 0~7 number of bits addr: Program memory address

Mnemonic Description Cycles Flag AffectedArithmeticADD A,[m] Add Data Memory to ACC 1 Z, C, AC, OV, SCADDM A,[m] Add ACC to Data Memory 1Note Z, C, AC, OV, SCADD A,x Add immediate data to ACC 1 Z, C, AC, OV, SCADC A,[m] Add Data Memory to ACC with Carry 1 Z, C, AC, OV, SCADCM A,[m] Add ACC to Data memory with Carry 1Note Z, C, AC, OV, SCSUB A,x Subtract immediate data from the ACC 1 Z, C, AC, OV, SC, CZSUB A,[m] Subtract Data Memory from ACC 1 Z, C, AC, OV, SC, CZSUBM A,[m] Subtract Data Memory from ACC with result in Data Memory 1Note Z, C, AC, OV, SC, CZSBC A,x Subtract immediate data from ACC with Carry 1 Z, C, AC, OV, SC, CZSBC A,[m] Subtract Data Memory from ACC with Carry 1 Z, C, AC, OV, SC, CZSBCM A,[m] Subtract Data Memory from ACC with Carry, result in Data Memory 1Note Z, C, AC, OV, SC, CZDAA [m] Decimal adjust ACC for Addition with result in Data Memory 1Note CLogic OperationAND A,[m] Logical AND Data Memory to ACC 1 ZOR A,[m] Logical OR Data Memory to ACC 1 ZXOR A,[m] Logical XOR Data Memory to ACC 1 ZANDM A,[m] Logical AND ACC to Data Memory 1Note ZORM A,[m] Logical OR ACC to Data Memory 1Note ZXORM A,[m] Logical XOR ACC to Data Memory 1Note ZAND A,x Logical AND immediate Data to ACC 1 ZOR A,x Logical OR immediate Data to ACC 1 ZXOR A,x Logical XOR immediate Data to ACC 1 ZCPL [m] Complement Data Memory 1Note ZCPLA [m] Complement Data Memory with result in ACC 1 ZIncrement & DecrementINCA [m] Increment Data Memory with result in ACC 1 ZINC [m] Increment Data Memory 1Note ZDECA [m] Decrement Data Memory with result in ACC 1 ZDEC [m] Decrement Data Memory 1Note ZRotateRRA [m] Rotate Data Memory right with result in ACC 1 NoneRR [m] Rotate Data Memory right 1Note NoneRRCA [m] Rotate Data Memory right through Carry with result in ACC 1 CRRC [m] Rotate Data Memory right through Carry 1Note CRLA [m] Rotate Data Memory left with result in ACC 1 NoneRL [m] Rotate Data Memory left 1Note NoneRLCA [m] Rotate Data Memory left through Carry with result in ACC 1 CRLC [m] Rotate Data Memory left through Carry 1Note C

Page 173: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 172 November 18, 2019 Rev. 1.10 173 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Mnemonic Description Cycles Flag AffectedData MoveMOV A,[m] Move Data Memory to ACC 1 NoneMOV [m],A Move ACC to Data Memory 1Note NoneMOV A,x Move immediate data to ACC 1 NoneBit OperationCLR [m].i Clear bit of Data Memory 1Note NoneSET [m].i Set bit of Data Memory 1Note NoneBranch OperationJMP addr Jump unconditionally 2 NoneSZ [m] Skip if Data Memory is zero 1Note NoneSZA [m] Skip if Data Memory is zero with data movement to ACC 1Note NoneSZ [m].i Skip if bit i of Data Memory is zero 1Note NoneSNZ [m] Skip if Data Memory is not zero 1Note NoneSNZ [m].i Skip if bit i of Data Memory is not zero 1Note NoneSIZ [m] Skip if increment Data Memory is zero 1Note NoneSDZ [m] Skip if decrement Data Memory is zero 1Note NoneSIZA [m] Skip if increment Data Memory is zero with result in ACC 1Note NoneSDZA [m] Skip if decrement Data Memory is zero with result in ACC 1Note NoneCALL addr Subroutine call 2 NoneRET Return from subroutine 2 NoneRET A,x Return from subroutine and load immediate data to ACC 2 NoneRETI Return from interrupt 2 NoneTable Read OperationTABRD [m] Read table (specific page) to TBLH and Data Memory 2Note NoneTABRDL [m] Read table (last page) to TBLH and Data Memory 2Note NoneITABRD [m] Increment table pointer TBLP first and Read table to TBLH and Data Memory 2Note None

ITABRDL [m] Increment table pointer TBLP first and Read table (last page) to TBLH and Data Memory 2Note None

MiscellaneousNOP No operation 1 NoneCLR [m] Clear Data Memory 1Note NoneSET [m] Set Data Memory 1Note NoneCLR WDT Clear Watchdog Timer 1 TO, PDFSWAP [m] Swap nibbles of Data Memory 1Note NoneSWAPA [m] Swap nibbles of Data Memory with result in ACC 1 NoneHALT Enter power down mode 1 TO, PDF

Note: 1. For skip instructions, if the result of the comparison involves a skip then up to three cycles are required, if no skip takes place only one cycle is required.

2. Any instruction which changes the contents of the PCL will also require 2 cycles for execution.3. For the “CLR WDT” instruction the TO and PDF flags may be affected by the execution status. The TO

and PDF flags are cleared after the “CLR WDT” instructions is executed. Otherwise the TO and PDF flags remain unchanged.

Page 174: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 174 November 18, 2019 Rev. 1.10 175 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Extended Instruction SetThe extended instructions are used to support the full range address access for the data memory. When the accessed data memory is located in any data memory sector except sector 0, the extended instruction can be used to directly access the data memory instead of using the indirect addressing access. This can not only reduce the use of Flash memory space but also improve the CPU execution efficiency.

Mnemonic Description Cycles Flag AffectedArithmeticLADD A,[m] Add Data Memory to ACC 2 Z, C, AC, OV, SCLADDM A,[m] Add ACC to Data Memory 2Note Z, C, AC, OV, SCLADC A,[m] Add Data Memory to ACC with Carry 2 Z, C, AC, OV, SCLADCM A,[m] Add ACC to Data memory with Carry 2Note Z, C, AC, OV, SCLSUB A,[m] Subtract Data Memory from ACC 2 Z, C, AC, OV, SC, CZLSUBM A,[m] Subtract Data Memory from ACC with result in Data Memory 2Note Z, C, AC, OV, SC, CZLSBC A,[m] Subtract Data Memory from ACC with Carry 2 Z, C, AC, OV, SC, CZLSBCM A,[m] Subtract Data Memory from ACC with Carry, result in Data Memory 2Note Z, C, AC, OV, SC, CZLDAA [m] Decimal adjust ACC for Addition with result in Data Memory 2Note CLogic OperationLAND A,[m] Logical AND Data Memory to ACC 2 ZLOR A,[m] Logical OR Data Memory to ACC 2 ZLXOR A,[m] Logical XOR Data Memory to ACC 2 ZLANDM A,[m] Logical AND ACC to Data Memory 2Note ZLORM A,[m] Logical OR ACC to Data Memory 2Note ZLXORM A,[m] Logical XOR ACC to Data Memory 2Note ZLCPL [m] Complement Data Memory 2Note ZLCPLA [m] Complement Data Memory with result in ACC 2 ZIncrement & DecrementLINCA [m] Increment Data Memory with result in ACC 2 ZLINC [m] Increment Data Memory 2Note ZLDECA [m] Decrement Data Memory with result in ACC 2 ZLDEC [m] Decrement Data Memory 2Note ZRotateLRRA [m] Rotate Data Memory right with result in ACC 2 NoneLRR [m] Rotate Data Memory right 2Note NoneLRRCA [m] Rotate Data Memory right through Carry with result in ACC 2 CLRRC [m] Rotate Data Memory right through Carry 2Note CLRLA [m] Rotate Data Memory left with result in ACC 2 NoneLRL [m] Rotate Data Memory left 2Note NoneLRLCA [m] Rotate Data Memory left through Carry with result in ACC 2 CLRLC [m] Rotate Data Memory left through Carry 2Note CData MoveLMOV A,[m] Move Data Memory to ACC 2 NoneLMOV [m],A Move ACC to Data Memory 2Note NoneBit OperationLCLR [m].i Clear bit of Data Memory 2Note NoneLSET [m].i Set bit of Data Memory 2Note None

Page 175: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 174 November 18, 2019 Rev. 1.10 175 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Mnemonic Description Cycles Flag AffectedBranchLSZ [m] Skip if Data Memory is zero 2Note NoneLSZA [m] Skip if Data Memory is zero with data movement to ACC 2Note NoneLSNZ [m] Skip if Data Memory is not zero 2Note NoneLSZ [m].i Skip if bit i of Data Memory is zero 2Note NoneLSNZ [m].i Skip if bit i of Data Memory is not zero 2Note NoneLSIZ [m] Skip if increment Data Memory is zero 2Note NoneLSDZ [m] Skip if decrement Data Memory is zero 2Note NoneLSIZA [m] Skip if increment Data Memory is zero with result in ACC 2Note NoneLSDZA [m] Skip if decrement Data Memory is zero with result in ACC 2Note NoneTable ReadLTABRD [m] Read table to TBLH and Data Memory 3Note NoneLTABRDL [m] Read table (last page) to TBLH and Data Memory 3Note NoneLITABRD [m] Increment table pointer TBLP first and Read table to TBLH and Data Memory 3Note None

LITABRDL [m] Increment table pointer TBLP first and Read table (last page) to TBLH and Data Memory 3Note None

MiscellaneousLCLR [m] Clear Data Memory 2Note NoneLSET [m] Set Data Memory 2Note NoneLSWAP [m] Swap nibbles of Data Memory 2Note NoneLSWAPA [m] Swap nibbles of Data Memory with result in ACC 2 None

Note: 1. For these extended skip instructions, if the result of the comparison involves a skip then up to four cycles are required, if no skip takes place two cycles is required.

2. Any extended instruction which changes the contents of the PCL register will also require three cycles for execution.

Page 176: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 176 November 18, 2019 Rev. 1.10 177 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Instruction Definition

ADC A,[m] Add Data Memory to ACC with CarryDescription The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the Accumulator.Operation ACC ← ACC + [m] + CAffected flag(s) OV, Z, AC, C, SC

ADCM A,[m] Add ACC to Data Memory with CarryDescription The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the specified Data Memory.Operation [m] ← ACC + [m] + CAffected flag(s) OV, Z, AC, C, SC

ADD A,[m] Add Data Memory to ACCDescription The contents of the specified Data Memory and the Accumulator are added. The result is stored in the Accumulator.Operation ACC ← ACC + [m]Affected flag(s) OV, Z, AC, C, SC

ADD A,x Add immediate data to ACCDescription The contents of the Accumulator and the specified immediate data are added. The result is stored in the Accumulator.Operation ACC ← ACC + xAffected flag(s) OV, Z, AC, C, SC

ADDM A,[m] Add ACC to Data MemoryDescription The contents of the specified Data Memory and the Accumulator are added. The result is stored in the specified Data Memory.Operation [m] ← ACC + [m]Affected flag(s) OV, Z, AC, C, SC

AND A,[m] Logical AND Data Memory to ACCDescription Data in the Accumulator and the specified Data Memory perform a bitwise logical AND operation. The result is stored in the Accumulator.Operation ACC ← ACC ″AND″ [m]Affected flag(s) Z

AND A,x Logical AND immediate data to ACCDescription Data in the Accumulator and the specified immediate data perform a bit wise logical AND operation. The result is stored in the Accumulator.Operation ACC ← ACC ″AND″ xAffected flag(s) Z

ANDM A,[m] Logical AND ACC to Data MemoryDescription Data in the specified Data Memory and the Accumulator perform a bitwise logical AND operation. The result is stored in the Data Memory.Operation [m] ← ACC ″AND″ [m]Affected flag(s) Z

Page 177: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 176 November 18, 2019 Rev. 1.10 177 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

CALL addr Subroutine callDescription Unconditionally calls a subroutine at the specified address. The Program Counter then increments by 1 to obtain the address of the next instruction which is then pushed onto the stack. The specified address is then loaded and the program continues execution from this new address. As this instruction requires an additional operation, it is a two cycle instruction.Operation Stack ← Program Counter + 1 Program Counter ← addrAffected flag(s) None

CLR [m] Clear Data MemoryDescription Each bit of the specified Data Memory is cleared to 0.Operation [m] ← 00HAffected flag(s) None

CLR [m].i Clear bit of Data MemoryDescription Bit i of the specified Data Memory is cleared to 0.Operation [m].i ← 0Affected flag(s) None

CLR WDT Clear Watchdog TimerDescription The TO, PDF flags and the WDT are all cleared. Operation WDT cleared TO ← 0 PDF ← 0Affected flag(s) TO, PDF

CPL [m] Complement Data MemoryDescription Each bit of the specified Data Memory is logically complemented (1′s complement). Bits which previously contained a 1 are changed to 0 and vice versa.Operation [m] ← [m]Affected flag(s) Z

CPLA [m] Complement Data Memory with result in ACCDescription Each bit of the specified Data Memory is logically complemented (1′s complement). Bits which previously contained a 1 are changed to 0 and vice versa. The complemented result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC ← [m]Affected flag(s) Z

DAA [m] Decimal-Adjust ACC for addition with result in Data MemoryDescription Convert the contents of the Accumulator value to a BCD (Binary Coded Decimal) value resulting from the previous addition of two BCD variables. If the low nibble is greater than 9 or if AC flag is set, then a value of 6 will be added to the low nibble. Otherwise the low nibble remains unchanged. If the high nibble is greater than 9 or if the C flag is set, then a value of 6 will be added to the high nibble. Essentially, the decimal conversion is performed by adding 00H, 06H, 60H or 66H depending on the Accumulator and flag conditions. Only the C flag may be affected by this instruction which indicates that if the original BCD sum is greater than 100, it allows multiple precision decimal addition.Operation [m] ← ACC + 00H or [m] ← ACC + 06H or [m] ← ACC + 60H or [m] ← ACC + 66HAffected flag(s) C

Page 178: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 178 November 18, 2019 Rev. 1.10 179 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

DEC [m] Decrement Data MemoryDescription Data in the specified Data Memory is decremented by 1.Operation [m] ← [m] − 1Affected flag(s) Z

DECA [m] Decrement Data Memory with result in ACCDescription Data in the specified Data Memory is decremented by 1. The result is stored in the Accumulator. The contents of the Data Memory remain unchanged.Operation ACC ← [m] − 1Affected flag(s) Z

HALT Enter power down modeDescription This instruction stops the program execution and turns off the system clock. The contents of the Data Memory and registers are retained. The WDT and prescaler are cleared. The power down flag PDF is set and the WDT time-out flag TO is cleared.Operation TO ← 0 PDF ← 1Affected flag(s) TO, PDF

INC [m] Increment Data Memory Description Data in the specified Data Memory is incremented by 1.Operation [m] ← [m] + 1Affected flag(s) Z

INCA [m] Increment Data Memory with result in ACCDescription Data in the specified Data Memory is incremented by 1. The result is stored in the Accumulator. The contents of the Data Memory remain unchanged.Operation ACC ← [m] + 1Affected flag(s) Z

JMP addr Jump unconditionallyDescription The contents of the Program Counter are replaced with the specified address. Program execution then continues from this new address. As this requires the insertion of a dummy instruction while the new address is loaded, it is a two cycle instruction.Operation Program Counter ← addrAffected flag(s) None

MOV A,[m] Move Data Memory to ACCDescription The contents of the specified Data Memory are copied to the Accumulator.Operation ACC ← [m]Affected flag(s) None

MOV A,x Move immediate data to ACCDescription The immediate data specified is loaded into the Accumulator.Operation ACC ← xAffected flag(s) None

MOV [m],A Move ACC to Data Memory Description The contents of the Accumulator are copied to the specified Data Memory.Operation [m] ← ACCAffected flag(s) None

Page 179: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 178 November 18, 2019 Rev. 1.10 179 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

NOP No operationDescription No operation is performed. Execution continues with the next instruction.Operation No operationAffected flag(s) None

OR A,[m] Logical OR Data Memory to ACCDescription Data in the Accumulator and the specified Data Memory perform a bitwise logical OR operation. The result is stored in the Accumulator.Operation ACC ← ACC ″OR″ [m]Affected flag(s) Z

OR A,x Logical OR immediate data to ACCDescription Data in the Accumulator and the specified immediate data perform a bitwise logical OR operation. The result is stored in the Accumulator.Operation ACC ← ACC ″OR″ xAffected flag(s) Z

ORM A,[m] Logical OR ACC to Data MemoryDescription Data in the specified Data Memory and the Accumulator perform a bitwise logical OR operation. The result is stored in the Data Memory.Operation [m] ← ACC ″OR″ [m]Affected flag(s) Z

RET Return from subroutineDescription The Program Counter is restored from the stack. Program execution continues at the restored address.Operation Program Counter ← StackAffected flag(s) None

RET A,x Return from subroutine and load immediate data to ACCDescription The Program Counter is restored from the stack and the Accumulator loaded with the specified immediate data. Program execution continues at the restored address.Operation Program Counter ← Stack ACC ← xAffected flag(s) None

RETI Return from interruptDescription The Program Counter is restored from the stack and the interrupts are re-enabled by setting the EMI bit. EMI is the master interrupt global enable bit. If an interrupt was pending when the RETI instruction is executed, the pending Interrupt routine will be processed before returning to the main program.Operation Program Counter ← Stack EMI ← 1Affected flag(s) None

RL [m] Rotate Data Memory leftDescription The contents of the specified Data Memory are rotated left by 1 bit with bit 7 rotated into bit 0.Operation [m].(i+1) ← [m].i; (i=0~6) [m].0 ← [m].7Affected flag(s) None

Page 180: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 180 November 18, 2019 Rev. 1.10 181 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

RLA [m] Rotate Data Memory left with result in ACCDescription The contents of the specified Data Memory are rotated left by 1 bit with bit 7 rotated into bit 0. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.(i+1) ← [m].i; (i=0~6) ACC.0 ← [m].7Affected flag(s) None

RLC [m] Rotate Data Memory left through CarryDescription The contents of the specified Data Memory and the carry flag are rotated left by 1 bit. Bit 7 replaces the Carry bit and the original carry flag is rotated into bit 0.Operation [m].(i+1) ← [m].i; (i=0~6) [m].0 ← C C ← [m].7Affected flag(s) C

RLCA [m] Rotate Data Memory left through Carry with result in ACCDescription Data in the specified Data Memory and the carry flag are rotated left by 1 bit. Bit 7 replaces the Carry bit and the original carry flag is rotated into the bit 0. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.(i+1) ← [m].i; (i=0~6) ACC.0 ← C C ← [m].7Affected flag(s) C

RR [m] Rotate Data Memory rightDescription The contents of the specified Data Memory are rotated right by 1 bit with bit 0 rotated into bit 7.Operation [m].i ← [m].(i+1); (i=0~6) [m].7 ← [m].0Affected flag(s) None

RRA [m] Rotate Data Memory right with result in ACCDescription Data in the specified Data Memory is rotated right by 1 bit with bit 0 rotated into bit 7. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.i ← [m].(i+1); (i=0~6) ACC.7 ← [m].0Affected flag(s) None

RRC [m] Rotate Data Memory right through CarryDescription The contents of the specified Data Memory and the carry flag are rotated right by 1 bit. Bit 0 replaces the Carry bit and the original carry flag is rotated into bit 7.Operation [m].i ← [m].(i+1); (i=0~6) [m].7 ← C C ← [m].0Affected flag(s) C

Page 181: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 180 November 18, 2019 Rev. 1.10 181 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

RRCA [m] Rotate Data Memory right through Carry with result in ACCDescription Data in the specified Data Memory and the carry flag are rotated right by 1 bit. Bit 0 replaces the Carry bit and the original carry flag is rotated into bit 7. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.i ← [m].(i+1); (i=0~6) ACC.7 ← C C ← [m].0Affected flag(s) C

SBC A,[m] Subtract Data Memory from ACC with CarryDescription The contents of the specified Data Memory and the complement of the carry flag are subtracted from the Accumulator. The result is stored in the Accumulator. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation ACC ← ACC − [m] − CAffected flag(s) OV, Z, AC, C, SC, CZ

SBC A, x Subtract immediate data from ACC with CarryDescription The immediate data and the complement of the carry flag are subtracted from the Accumulator. The result is stored in the Accumulator. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation ACC ← ACC - [m] - CAffected flag(s) OV, Z, AC, C, SC, CZ

SBCM A,[m] Subtract Data Memory from ACC with Carry and result in Data MemoryDescription The contents of the specified Data Memory and the complement of the carry flag are subtracted from the Accumulator. The result is stored in the Data Memory. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation [m] ← ACC − [m] − CAffected flag(s) OV, Z, AC, C, SC, CZ

SDZ [m] Skip if decrement Data Memory is 0Description The contents of the specified Data Memory are first decremented by 1. If the result is 0 the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation [m] ← [m] − 1 Skip if [m]=0Affected flag(s) None

SDZA [m] Skip if decrement Data Memory is zero with result in ACCDescription The contents of the specified Data Memory are first decremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0, the program proceeds with the following instruction.Operation ACC ← [m] − 1 Skip if ACC=0Affected flag(s) None

Page 182: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 182 November 18, 2019 Rev. 1.10 183 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

SET [m] Set Data MemoryDescription Each bit of the specified Data Memory is set to 1.Operation [m] ← FFHAffected flag(s) None

SET [m].i Set bit of Data MemoryDescription Bit i of the specified Data Memory is set to 1.Operation [m].i ← 1Affected flag(s) None

SIZ [m] Skip if increment Data Memory is 0Description The contents of the specified Data Memory are first incremented by 1. If the result is 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation [m] ← [m] + 1 Skip if [m]=0 Affected flag(s) None

SIZA [m] Skip if increment Data Memory is zero with result in ACCDescription The contents of the specified Data Memory are first incremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation ACC ← [m] + 1 Skip if ACC=0Affected flag(s) None

SNZ [m].i Skip if Data Memory is not 0Description If the specified Data Memory is not 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is 0 the program proceeds with the following instruction.Operation Skip if [m].i ≠ 0Affected flag(s) None

SNZ [m] Skip if Data Memory is not 0Description If the specified Data Memory is not 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is 0 the program proceeds with the following instruction.Operation Skip if [m]≠ 0Affected flag(s) None

SUB A,[m] Subtract Data Memory from ACCDescription The specified Data Memory is subtracted from the contents of the Accumulator. The result is stored in the Accumulator. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation ACC ← ACC − [m]Affected flag(s) OV, Z, AC, C, SC, CZ

Page 183: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 182 November 18, 2019 Rev. 1.10 183 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

SUBM A,[m] Subtract Data Memory from ACC with result in Data MemoryDescription The specified Data Memory is subtracted from the contents of the Accumulator. The result is stored in the Data Memory. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation [m] ← ACC − [m]Affected flag(s) OV, Z, AC, C, SC, CZ

SUB A,x Subtract immediate data from ACCDescription The immediate data specified by the code is subtracted from the contents of the Accumulator. The result is stored in the Accumulator. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation ACC ← ACC − xAffected flag(s) OV, Z, AC, C, SC, CZ

SWAP [m] Swap nibbles of Data MemoryDescription The low-order and high-order nibbles of the specified Data Memory are interchanged.Operation [m].3~[m].0 ↔ [m].7~[m].4Affected flag(s) None

SWAPA [m] Swap nibbles of Data Memory with result in ACCDescription The low-order and high-order nibbles of the specified Data Memory are interchanged. The result is stored in the Accumulator. The contents of the Data Memory remain unchanged.Operation ACC.3~ACC.0 ← [m].7~[m].4 ACC.7~ACC.4 ← [m].3~[m].0Affected flag(s) None

SZ [m] Skip if Data Memory is 0Description If the contents of the specified Data Memory is 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation Skip if [m]=0Affected flag(s) None

SZA [m] Skip if Data Memory is 0 with data movement to ACCDescription The contents of the specified Data Memory are copied to the Accumulator. If the value is zero, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation ACC ← [m] Skip if [m]=0Affected flag(s) None

SZ [m].i Skip if bit i of Data Memory is 0Description If bit i of the specified Data Memory is 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0, the program proceeds with the following instruction.Operation Skip if [m].i=0Affected flag(s) None

Page 184: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 184 November 18, 2019 Rev. 1.10 185 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

TABRD [m] Read table (specific page) to TBLH and Data MemoryDescription The low byte of the program code (specific page) addressed by the table pointer pair (TBLP and TBHP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

TABRDL [m] Read table (last page) to TBLH and Data MemoryDescription The low byte of the program code (last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

ITABRD [m] Increment table pointer low byte first and read table to TBLH and Data MemoryDescription Increment table pointer low byte, TBLP, first and then the program code addressed by the table pointer (TBHP and TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

ITABRDL [m] Increment table pointer low byte first and read table (last page) to TBLH and Data MemoryDescription Increment table pointer low byte, TBLP, first and then the low byte of the program code (last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

XOR A,[m] Logical XOR Data Memory to ACCDescription Data in the Accumulator and the specified Data Memory perform a bitwise logical XOR operation. The result is stored in the Accumulator.Operation ACC ← ACC ″XOR″ [m]Affected flag(s) Z

XORM A,[m] Logical XOR ACC to Data MemoryDescription Data in the specified Data Memory and the Accumulator perform a bitwise logical XOR operation. The result is stored in the Data Memory.Operation [m] ← ACC ″XOR″ [m]Affected flag(s) Z

XOR A,x Logical XOR immediate data to ACCDescription Data in the Accumulator and the specified immediate data perform a bitwise logical XOR operation. The result is stored in the Accumulator.Operation ACC ← ACC ″XOR″ xAffected flag(s) Z

Page 185: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 184 November 18, 2019 Rev. 1.10 185 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Extended Instruction DefinitionThe extended instructions are used to directly access the data stored in any data memory sections.

LADC A,[m] Add Data Memory to ACC with CarryDescription The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the Accumulator.Operation ACC ← ACC + [m] + CAffected flag(s) OV, Z, AC, C, SC

LADCM A,[m] Add ACC to Data Memory with CarryDescription The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the specified Data Memory.Operation [m] ← ACC + [m] + CAffected flag(s) OV, Z, AC, C, SC

LADD A,[m] Add Data Memory to ACCDescription The contents of the specified Data Memory and the Accumulator are added. The result is stored in the Accumulator.Operation ACC ← ACC + [m]Affected flag(s) OV, Z, AC, C, SC

LADDM A,[m] Add ACC to Data MemoryDescription The contents of the specified Data Memory and the Accumulator are added. The result is stored in the specified Data Memory.Operation [m] ← ACC + [m]Affected flag(s) OV, Z, AC, C, SC

LAND A,[m] Logical AND Data Memory to ACCDescription Data in the Accumulator and the specified Data Memory perform a bitwise logical AND operation. The result is stored in the Accumulator.Operation ACC ← ACC ″AND″ [m]Affected flag(s) Z

LANDM A,[m] Logical AND ACC to Data MemoryDescription Data in the specified Data Memory and the Accumulator perform a bitwise logical AND operation. The result is stored in the Data Memory.Operation [m] ← ACC ″AND″ [m]Affected flag(s) Z

LCLR [m] Clear Data MemoryDescription Each bit of the specified Data Memory is cleared to 0.Operation [m] ← 00HAffected flag(s) None

LCLR [m].i Clear bit of Data MemoryDescription Bit i of the specified Data Memory is cleared to 0.Operation [m].i ← 0Affected flag(s) None

Page 186: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 186 November 18, 2019 Rev. 1.10 187 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LCPL [m] Complement Data MemoryDescription Each bit of the specified Data Memory is logically complemented (1′s complement). Bits which previously contained a 1 are changed to 0 and vice versa.Operation [m] ← [m]Affected flag(s) Z

LCPLA [m] Complement Data Memory with result in ACCDescription Each bit of the specified Data Memory is logically complemented (1′s complement). Bits which previously contained a 1 are changed to 0 and vice versa. The complemented result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC ← [m]Affected flag(s) Z

LDAA [m] Decimal-Adjust ACC for addition with result in Data MemoryDescription Convert the contents of the Accumulator value to a BCD (Binary Coded Decimal) value resulting from the previous addition of two BCD variables. If the low nibble is greater than 9 or if AC flag is set, then a value of 6 will be added to the low nibble. Otherwise the low nibble remains unchanged. If the high nibble is greater than 9 or if the C flag is set, then a value of 6 will be added to the high nibble. Essentially, the decimal conversion is performed by adding 00H, 06H, 60H or 66H depending on the Accumulator and flag conditions. Only the C flag may be affected by this instruction which indicates that if the original BCD sum is greater than 100, it allows multiple precision decimal addition.Operation [m] ← ACC + 00H or [m] ← ACC + 06H or [m] ← ACC + 60H or [m] ← ACC + 66HAffected flag(s) C

LDEC [m] Decrement Data MemoryDescription Data in the specified Data Memory is decremented by 1.Operation [m] ← [m] − 1Affected flag(s) Z

LDECA [m] Decrement Data Memory with result in ACCDescription Data in the specified Data Memory is decremented by 1. The result is stored in the Accumulator. The contents of the Data Memory remain unchanged.Operation ACC ← [m] − 1Affected flag(s) Z

LINC [m] Increment Data Memory Description Data in the specified Data Memory is incremented by 1.Operation [m] ← [m] + 1Affected flag(s) Z

LINCA [m] Increment Data Memory with result in ACCDescription Data in the specified Data Memory is incremented by 1. The result is stored in the Accumulator. The contents of the Data Memory remain unchanged.Operation ACC ← [m] + 1Affected flag(s) Z

Page 187: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 186 November 18, 2019 Rev. 1.10 187 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LMOV A,[m] Move Data Memory to ACCDescription The contents of the specified Data Memory are copied to the Accumulator.Operation ACC ← [m]Affected flag(s) None

LMOV [m],A Move ACC to Data Memory Description The contents of the Accumulator are copied to the specified Data Memory.Operation [m] ← ACCAffected flag(s) None

LOR A,[m] Logical OR Data Memory to ACCDescription Data in the Accumulator and the specified Data Memory perform a bitwise logical OR operation. The result is stored in the Accumulator.Operation ACC ← ACC ″OR″ [m]Affected flag(s) Z

LORM A,[m] Logical OR ACC to Data MemoryDescription Data in the specified Data Memory and the Accumulator perform a bitwise logical OR operation. The result is stored in the Data Memory.Operation [m] ← ACC ″OR″ [m]Affected flag(s) Z

LRL [m] Rotate Data Memory leftDescription The contents of the specified Data Memory are rotated left by 1 bit with bit 7 rotated into bit 0.Operation [m].(i+1) ← [m].i; (i=0~6) [m].0 ← [m].7Affected flag(s) None

LRLA [m] Rotate Data Memory left with result in ACCDescription The contents of the specified Data Memory are rotated left by 1 bit with bit 7 rotated into bit 0. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.(i+1) ← [m].i; (i=0~6) ACC.0 ← [m].7Affected flag(s) None

LRLC [m] Rotate Data Memory left through CarryDescription The contents of the specified Data Memory and the carry flag are rotated left by 1 bit. Bit 7 replaces the Carry bit and the original carry flag is rotated into bit 0.Operation [m].(i+1) ← [m].i; (i=0~6) [m].0 ← C C ← [m].7Affected flag(s) C

LRLCA [m] Rotate Data Memory left through Carry with result in ACCDescription Data in the specified Data Memory and the carry flag are rotated left by 1 bit. Bit 7 replaces the Carry bit and the original carry flag is rotated into the bit 0. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.(i+1) ← [m].i; (i=0~6) ACC.0 ← C C ← [m].7Affected flag(s) C

Page 188: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 188 November 18, 2019 Rev. 1.10 189 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LRR [m] Rotate Data Memory rightDescription The contents of the specified Data Memory are rotated right by 1 bit with bit 0 rotated into bit 7.Operation [m].i ← [m].(i+1); (i=0~6) [m].7 ← [m].0Affected flag(s) None

LRRA [m] Rotate Data Memory right with result in ACCDescription Data in the specified Data Memory is rotated right by 1 bit with bit 0 rotated into bit 7. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.i ← [m].(i+1); (i=0~6) ACC.7 ← [m].0Affected flag(s) None

LRRC [m] Rotate Data Memory right through CarryDescription The contents of the specified Data Memory and the carry flag are rotated right by 1 bit. Bit 0 replaces the Carry bit and the original carry flag is rotated into bit 7.Operation [m].i ← [m].(i+1); (i=0~6) [m].7 ← C C ← [m].0Affected flag(s) C

LRRCA [m] Rotate Data Memory right through Carry with result in ACCDescription Data in the specified Data Memory and the carry flag are rotated right by 1 bit. Bit 0 replaces the Carry bit and the original carry flag is rotated into bit 7. The rotated result is stored in the Accumulator and the contents of the Data Memory remain unchanged.Operation ACC.i ← [m].(i+1); (i=0~6) ACC.7 ← C C ← [m].0Affected flag(s) C

LSBC A,[m] Subtract Data Memory from ACC with CarryDescription The contents of the specified Data Memory and the complement of the carry flag are subtracted from the Accumulator. The result is stored in the Accumulator. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation ACC ← ACC − [m] − CAffected flag(s) OV, Z, AC, C, SC, CZ

LSBCM A,[m] Subtract Data Memory from ACC with Carry and result in Data MemoryDescription The contents of the specified Data Memory and the complement of the carry flag are subtracted from the Accumulator. The result is stored in the Data Memory. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation [m] ← ACC − [m] − CAffected flag(s) OV, Z, AC, C, SC, CZ

Page 189: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 188 November 18, 2019 Rev. 1.10 189 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LSDZ [m] Skip if decrement Data Memory is 0Description The contents of the specified Data Memory are first decremented by 1. If the result is 0 the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation [m] ← [m] − 1 Skip if [m]=0Affected flag(s) None

LSDZA [m] Skip if decrement Data Memory is zero with result in ACCDescription The contents of the specified Data Memory are first decremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0, the program proceeds with the following instruction.Operation ACC ← [m] − 1 Skip if ACC=0Affected flag(s) None

LSET [m] Set Data MemoryDescription Each bit of the specified Data Memory is set to 1.Operation [m] ← FFHAffected flag(s) None

LSET [m].i Set bit of Data MemoryDescription Bit i of the specified Data Memory is set to 1.Operation [m].i ← 1Affected flag(s) None

LSIZ [m] Skip if increment Data Memory is 0Description The contents of the specified Data Memory are first incremented by 1. If the result is 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation [m] ← [m] + 1 Skip if [m]=0 Affected flag(s) None

LSIZA [m] Skip if increment Data Memory is zero with result in ACCDescription The contents of the specified Data Memory are first incremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation ACC ← [m] + 1 Skip if ACC=0Affected flag(s) None

LSNZ [m].i Skip if Data Memory is not 0Description If the specified Data Memory is not 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is 0 the program proceeds with the following instruction.Operation Skip if [m].i ≠ 0Affected flag(s) None

Page 190: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 190 November 18, 2019 Rev. 1.10 191 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LSNZ [m] Skip if Data Memory is not 0Description If the content of the specified Data Memory is not 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is 0 the program proceeds with the following instruction.Operation Skip if [m] ≠ 0Affected flag(s) None

LSUB A,[m] Subtract Data Memory from ACCDescription The specified Data Memory is subtracted from the contents of the Accumulator. The result is stored in the Accumulator. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation ACC ← ACC − [m]Affected flag(s) OV, Z, AC, C, SC, CZ

LSUBM A,[m] Subtract Data Memory from ACC with result in Data MemoryDescription The specified Data Memory is subtracted from the contents of the Accumulator. The result is stored in the Data Memory. Note that if the result of subtraction is negative, the C flag will be cleared to 0, otherwise if the result is positive or zero, the C flag will be set to 1.Operation [m] ← ACC − [m]Affected flag(s) OV, Z, AC, C, SC, CZ

LSWAP [m] Swap nibbles of Data MemoryDescription The low-order and high-order nibbles of the specified Data Memory are interchanged.Operation [m].3~[m].0 ↔ [m].7~[m].4Affected flag(s) None

LSWAPA [m] Swap nibbles of Data Memory with result in ACCDescription The low-order and high-order nibbles of the specified Data Memory are interchanged. The result is stored in the Accumulator. The contents of the Data Memory remain unchanged.Operation ACC.3~ACC.0 ← [m].7~[m].4 ACC.7~ACC.4 ← [m].3~[m].0Affected flag(s) None

LSZ [m] Skip if Data Memory is 0Description If the contents of the specified Data Memory is 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation Skip if [m]=0Affected flag(s) None

LSZA [m] Skip if Data Memory is 0 with data movement to ACCDescription The contents of the specified Data Memory are copied to the Accumulator. If the value is zero, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0 the program proceeds with the following instruction.Operation ACC ← [m] Skip if [m]=0Affected flag(s) None

Page 191: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 190 November 18, 2019 Rev. 1.10 191 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

LSZ [m].i Skip if bit i of Data Memory is 0Description If bit i of the specified Data Memory is 0, the following instruction is skipped. As this requires the insertion of a dummy instruction while the next instruction is fetched, it is a two cycle instruction. If the result is not 0, the program proceeds with the following instruction.Operation Skip if [m].i=0Affected flag(s) None

LTABRD [m] Read table (current page) to TBLH and Data MemoryDescription The low byte of the program code (current page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

LTABRDL [m] Read table (last page) to TBLH and Data MemoryDescription The low byte of the program code (last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

LITABRD [m] Increment table pointer low byte first and read table to TBLH and Data MemoryDescription Increment table pointer low byte, TBLP, first and then the program code addressed by the table pointer (TBHP and TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)

Affected flag(s) None

LITABRDL [m] Increment table pointer low byte first and read table (last page) to TBLH and Data MemoryDescription Increment table pointer low byte, TBLP, first and then the low byte of the program code (last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and the high byte moved to TBLH.Operation [m] ← program code (low byte) TBLH ← program code (high byte)Affected flag(s) None

LXOR A,[m] Logical XOR Data Memory to ACCDescription Data in the Accumulator and the specified Data Memory perform a bitwise logical XOR operation. The result is stored in the Accumulator.Operation ACC ← ACC ″XOR″ [m]Affected flag(s) Z

LXORM A,[m] Logical XOR ACC to Data MemoryDescription Data in the specified Data Memory and the Accumulator perform a bitwise logical XOR operation. The result is stored in the Data Memory.Operation [m] ← ACC ″XOR″ [m]Affected flag(s) Z

Page 192: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 192 November 18, 2019 Rev. 1.10 193 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Package Information

Note that the package information provided here is for consultation purposes only. As this information may be updated at regular intervals users are reminded to consult the Holtek website for the latest version of the Package/Carton Information.

Additional supplementary information with regard to packaging is listed below. Click on the relevant section to be transferred to the relevant website page.

• Package Information (include Outline Dimensions, Product Tape and Reel Specifications)

• The Operation Instruction of Packing Materials

• Carton information

Page 193: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 192 November 18, 2019 Rev. 1.10 193 November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

SAW Type 32-pin (5mm×5mm) QFN Outline Dimensions

SymbolDimensions in inch

Min. Nom. Max.A 0.028 0.030 0.031

A1 0.000 0.001 0.002 A3 — 0.008 BSC —b 0.007 0.010 0.012D 0.193 0.197 0.201 E 0.193 0.197 0.201 e — 0.020 BSC —

D2 0.122 0.126 0.130 E2 0.122 0.126 0.130 L 0.014 0.016 0.018 K 0.008 — —

SymbolDimensions in mm

Min. Nom. Max.A 0.700 0.750 0.800

A1 0.000 0.020 0.050A3 — 0.203 BSC —b 0.180 0.250 0.300D 4.900 5.000 5.100E 4.900 5.000 5.100e — 0.50 BSC —

D2 3.10 3.20 3.30E2 3.10 3.20 3.30L 0.35 0.40 0.45K 0.20 — —

Page 194: Wireless Charger TX Flash MCU HT66FW2350...Wireless Charger TX Flash MCU General Description The device is a Flash Memory A/D type 8-bit high performance architecture microcontroller

Rev. 1.10 194 November 18, 2019 Rev. 1.10 PB November 18, 2019

HT66FW2350Wireless Charger TX Flash MCU

Copyright© 2019 by HOLTEK SEMICONDUCTOR INC.

The information appearing in this Data Sheet is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for the purpose of illustration and Holtek makes no warranty or representation that such applications will be suitable without further modification, nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise. Holtek's products are not authorized for use as critical components in life support devices or systems. Holtek reserves the right to alter its products without prior notification. For the most up-to-date information, please visit our web site at http://www.holtek.com.