Holtek BS83A04C Manual

4-key enhanced touch i/o flash mcu
Table of Contents

Advertisement

Quick Links

4-Key Enhanced Touch I/O Flash MCU
BS83A04C
Revision: V1.00
Date: March 24, 2020

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BS83A04C and is the answer not in the manual?

Questions and answers

Summary of Contents for Holtek BS83A04C

  • Page 1 4-Key Enhanced Touch I/O Flash MCU BS83A04C Revision: V1.00 Date: March 24, 2020...
  • Page 2: Table Of Contents

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Table of Contents Features ......................... 6 CPU Features ..........................6 Peripheral Features ........................6 General Description ....................7 Block Diagram ....................... 7 Pin Assignment ..................... 8 Pin Descriptions ....................8 Absolute Maximum Ratings ................10 D.C.
  • Page 3 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Memory Pointers – MP0, MP1 ....................22 Bank Pointer – BP ........................23 Accumulator – ACC ........................23 Program Counter Low Register – PCL ..................23 Look-up Table Registers – TBLP, TBHP, TBLH ................23 Status Register – STATUS ......................24 Emulated EEPROM Data Memory ..............
  • Page 4 BS83A04C 4-Key Enhanced Touch I/O Flash MCU TM External Pins .........................52 Programming Considerations ......................53 Compact Type TM – CTM ................... 54 Compact TM Operation .......................54 Compact Type TM Register Description..................54 Compact Type TM Operating Modes ..................58 Touch Key Function ................... 64 Touch Key Structure ........................64...
  • Page 5 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Instruction Definition ..................102 Package Information ..................111 8-pin SOP (150mil) Outline Dimensions ................... 112 10-pin DFN (3mm×3mm×0.75mm) Outline Dimensions ............113 10-pin MSOP (118mil) Outline Dimensions ................114 16-pin NSOP (150mil) Outline Dimensions ................115 Rev.
  • Page 6: Features

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Features CPU Features • Operating Voltage =8MHz: 1.8V~5.5V ♦ • Up to 0.5μs instruction cycle with 8MHz system clock at V • Power down and wake-up functions to reduce power consumption • Oscillator types Internal High Speed 8MHz RC –...
  • Page 7: General Description

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU General Description The device is a Flash Memory type 8-bit high performance RISC architecture microcontroller with fully integrated touch key functions. With all touch key functions provided internally, this device range has all the features to offer designers a reliable and easy means of implementing Touch Keyes within their products applications.
  • Page 8: Pin Assignment

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Pin Assignment PA5/KEY1 PA1/KEY2 PA3/KEY3 PA2/CTPB/SDA/ICPCK PA4/KEY4 PA0/CTCK/INT/SCL/ICPDA BS83A04C 8 SOP-A PA5/KEY1 PA2/CTPB/SDA/ICPCK PA1/KEY2 PA0/CTCK/INT/SCL/ICPDA PA3/KEY3 PA6/CTCK/INT PA4/KEY4 PA7/CTP BS83A04C 10 DFN-A/MSOP-A PA5/KEY1 PA2/CTPB/SDA/ICPCK PA1/KEY2 PA0/CTCK/INT/SCL/ICPDA PA3/KEY3 PA6/CTCK/INT PA4/KEY4 PA7/CTP OCDSCK OCDSDA BS83AV04C 16 NSOP-A Note: 1.
  • Page 9 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Pin Name Function Description PAPU General purpose I/O. Register enabled pull-up and PAWU CMOS wake-up PAS0 PAS0 CTCK — CTM clock input PA0/CTCK/INT/SCL/ PAS0 ICPDA — External Interrupt input INTEG INTC0 PAS0 NMOS I...
  • Page 10: Absolute Maximum Ratings

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Absolute Maximum Ratings Supply Voltage ......................V −0.3V to 6.0V Input Voltage ....................V −0.3V to V +0.3V Storage Temperature ..................... -50°C to 125°C Operating Temperature ....................-40°C to 85°C Total ............................-80mA Total ............................80mA Total Power Dissipation ......................
  • Page 11: Operating Current Characteristics

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Operating Current Characteristics Ta=-40°C~85°C Test Conditions Symbol Operating Mode Min. Typ. Max. Unit Conditions 1.8V — 15.0 SLOW Mode – LIRC =32kHz — μA — 1.8V — FAST Mode – HIRC =8MHz —...
  • Page 12: Operating Frequency Characteristic Curves

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Operating Frequency Characteristic Curves System Operating Frequency 8MHz 1.8V 5.5V Operating Voltage System Start Up Time Characteristics Ta=-40°C~85°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions — /64, f — — System Start-up Time...
  • Page 13: Input/Output Characteristics

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Input/Output Characteristics Ta=-40°C~85°C Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions — Input Low Voltage for I/O Port or Input Pins — — — 0.2V — Input High Voltage for I/O Port or Input Pins —...
  • Page 14: Lvr Electrical Characteristics

    Time System Architecture A key factor in the high-performance features of the Holtek range of microcontrollers is attributed to their internal system architecture. The device takes advantage of the usual features found within RISC microcontrollers providing increased speed of operation and Periodic performance. The...
  • Page 15: Program Counter

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 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.
  • Page 16: Stack

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 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.
  • Page 17: Flash Program Memory

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Flash Program Memory The 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.
  • Page 18: In Circuit Programming - Icp

    The 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.
  • Page 19: On-Chip Debug Support - Ocds

    * must be less than 1nF. On-Chip Debug Support – OCDS There is an EV chip named BS83AV04C which is used to emulate the BS83A04C device. The EV chip device also provides an “On-Chip Debug” function to debug the real MCU device during the development process.
  • Page 20: Data Memory

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Data Memory The Data Memory is a volatile area of 8-bit wide RAM internal memory and is the location where temporary information is stored. Structure Categorized into two types, the first of these is an area of RAM, known as the Special Function Data Memory.
  • Page 21: Special Purpose Data Memory

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Special Purpose Data Memory This 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.
  • Page 22: Special Function Register Description

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Special Function Register Description Most 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 The Indirect Addressing Registers, IAR0 and IAR1, although having their locations in normal RAM register space, do not actually physically exist as normal registers.
  • Page 23: Bank Pointer - Bp

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Bank Pointer – BP For this device, the Data Memory is divided into several banks. Selecting the required Data Memory area is achieved using the Bank Pointer. The Data Memory is initialised to Bank 0 after a reset, except for a WDT time-out reset in the SLEEP or IDLE Mode, in which case, the Data Memory bank remains unaffected.
  • Page 24: Status Register - Status

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Status Register – STATUS This 8-bit register contains the zero flag (Z), carry flag (C), auxiliary carry flag (AC), overflow flag (OV), power down flag (PDF) and watchdog time-out flag (TO). These arithmetic/logical operation and system management flags are used to record the status and operation of the microcontroller.
  • Page 25: Emulated Eeprom Data Memory

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Bit 1 AC: Auxiliary flag 0: No auxiliary carry 1: 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...
  • Page 26: Emulated Eeprom Registers

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Emulated EEPROM Registers A series of registers control the overall operation of the Emulated EEPROM Data Memory. These are the address register, EAR, the data registers, ED0L/ED0H~ED3L/ED3H, and a single control register, ECR.
  • Page 27 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • ED1H Register Name Bit 7~0 D15~D8: The second Emulated EEPROM data bit 15 ~ bit 8 • ED2L Register Name Bit 7~0 D7~D0: The third Emulated EEPROM data bit 7 ~ bit 0 •...
  • Page 28 BS83A04C 4-Key Enhanced Touch I/O Flash MCU This bit is used to enable the Emulated EEPROM erase function and must be set high before erase operations are carried out. This bit will be automatically reset to zero by the hardware after the erase cycle has finished. Clearing this bit to zero will inhibit the Emulated EEPROM erase operations.
  • Page 29: Erasing The Emulated Eeprom

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Erasing the Emulated EEPROM For Emulated EEPROM erase operation the desired erase page address should first be placed in the EAR register. The number of the page erase operation is 16 words per page, therefore, the available page erase address is only specified by the EAR4 bit in the EAR register and the content of EAR3~EAR0 in the EAR register is not used to specify the page address.
  • Page 30: Programming Considerations

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Programming Considerations Care must be taken that data is not inadvertently written to the Emulated EEPROM. Protection can be enhanced by ensuring that the Write Enable bit is normally cleared to zero when not writing.
  • Page 31: Oscillators

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Reading Data from the Emulated EEPROM – polling method MOV A, EEPROM_ADRES ; user defined address MOV EAR, A SET ERDEN ; set ERDEN bit, enable read operation SET ERD ; start Read Cycle – set ERD bit BACK: SZ ERD ; check for read cycle end JMP BACK CLR ECR ; disable Emulated EEPROM read if no more read operations are ; required MOV A, ED0L ; move read data to register...
  • Page 32: Internal High Speed Rc Oscillator - Hirc

    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.
  • Page 33: System Operation Modes

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU High Speed Oscillator HIRCEN HIRC IDLE0 Prescaler SLEEP Low Speed Oscillator CKS2~CKS0 LIRC IDLE2 SLEEP TBON LIRC Time Prescaler Base TB[2:0] CLKSEL[1:0] Device Clock Configurations Note: When the system clock source f is switched to f...
  • Page 34: Control Registers

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU FAST Mode This 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 HIRC oscillator.
  • Page 35 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • SCC Register Name CKS2 CKS1 CKS0 — — — FHIDEN FSIDEN — — — — — — Bit 7~5 CKS2~CKS0: System clock selection 000: f 001: f 010: f 011: f 100: f...
  • Page 36: Operating Mode Switching

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Operating Mode Switching The 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.
  • Page 37 BS83A04C 4-Key Enhanced Touch I/O Flash MCU FAST Mode CKS2~CKS0=111 SLOW Mode FHIDEN=0, FSIDEN=0 HALT instruction is executed SLEEP Mode FHIDEN=0, FSIDEN=1 HALT instruction is executed IDLE0 Mode FHIDEN=1, FSIDEN=1 HALT instruction is executed IDLE1 Mode FHIDEN=1, FSIDEN=0 HALT instruction is executed...
  • Page 38 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Entering the SLEEP Mode There 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”.
  • Page 39: Standby Current Considerations

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Standby Current Considerations As 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.
  • Page 40: Watchdog Timer

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Watchdog Timer The 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 Source The Watchdog Timer clock source is provided by the internal clock, f...
  • Page 41: Watchdog Timer Operation

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Bit 1 Unimplemented, read as “0” Bit 0 WRF: WDT control register software reset flag 0: Not occurred 1: Occurred This bit is set to 1 by the WDT Control register software reset and cleared by the application program.
  • Page 42: Reset And Initialisation

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Reset and Initialisation A 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.
  • Page 43 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • RSTC Register Name RSTC7 RSTC6 RSTC5 RSTC4 RSTC3 RSTC2 RSTC1 RSTC0 Bit 7~0 RSTC7~RSTC0: Reset function control 01010101: No operation 10101010: No operation Other values: Reset MCU If these bits are changed due to adverse environmental conditions, the microcontroller will be reset.
  • Page 44: Reset Initial Conditions

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU • RSTFC Register Name — — — — RSTF LVRF — — — — — — — — — — — “x”: unknown Bit 7~4 Unimplemented, read as “0” RSTF: Reset control register software reset flag Bit 3 Describe elsewhere.
  • Page 45 BS83A04C 4-Key Enhanced Touch I/O Flash MCU RESET Conditions Power-on reset LVR reset during FAST or SLOW Mode operation WDT time-out reset during FAST or SLOW Mode operation 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.
  • Page 46 BS83A04C 4-Key Enhanced Touch I/O Flash MCU LVR Reset WDT Time-out WDT Time-out Register Power On Reset (Normal Operation) (Normal Operation) (IDLE/SLEEP) WDTC 0 1 0 1 0 0 11 0 1 0 1 0 0 11 0 1 0 1 0 0 11...
  • Page 47: Input/Output Ports

    4-Key Enhanced Touch I/O Flash MCU Input/Output Ports Holtek 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.
  • Page 48: Port A Wake-Up

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU • LVPUC Register Name — — — — — — — LVPU — — — — — — — — — — — — — — Bit 7~1 Unimplemented, read as “0” Bit 0 LVPU: Pull-high resistor select when low voltage power supply 0: All pin pull high resistor is 60kΩ...
  • Page 49: Pin-Shared Functions

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU • PAC Register Name PAC7 PAC6 PAC5 PAC4 PAC3 PAC2 PAC1 PAC0 Bit 7~0 PAC7~PAC0: PA7~PA0 Pin type selection 0: Output 1: Input Pin-shared Functions The flexibility of the microcontroller range is greatly enhanced by the use of pins that have more than one function.
  • Page 50 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • PAS0 Register Name PAS07 PAS06 PAS05 PAS04 PAS03 PAS02 PAS01 PAS00 Bit 7~6 PAS07~PAS06: PA3 Pin-Shared function selection 00/01/10: PA3 11: KEY3 Bit 5~4 PAS05~PAS04: PA2 Pin-Shared function selection 00/01: PA2 10: CTPB...
  • Page 51: I/O Pin Structures

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU I/O Pin Structures The 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 I/O logic function.
  • Page 52: Timer Module - Tm

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Timer Module – TM One of the most fundamental functions in any microcontroller device is the ability to control and measure time. To implement time related functions the device includes a Timer Module, abbreviated to the name TM.
  • Page 53: Programming Considerations

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU The TM has two output pins with the label CTP and CTPB. 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.
  • Page 54: Compact Type Tm - Ctm

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU • Reading Data from the Counter Registers and CCRA Step 1. Read data from the High Byte CTMDH, CTMAH ♦ – 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.
  • Page 55 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Register Name CTMC0 CTPAU CTCK2 CTCK1 CTCK0 CTON CTRP2 CTRP1 CTRP0 CTMC1 CTM1 CTM0 CTIO1 CTIO0 CTOC CTPOL CTDPX CTCCLR CTMDL CTMDH — — — — — — CTMAL CTMAH — — —...
  • Page 56 BS83A04C 4-Key Enhanced Touch I/O Flash MCU 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 clocks 001: 128 CTM clocks 010: 256 CTM clocks...
  • Page 57 BS83A04C 4-Key Enhanced Touch I/O Flash MCU 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.
  • Page 58: Compact Type Tm Operating Modes

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU • CTMDH Register Name — — — — — — — — — — — — — — — — — — 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 •...
  • Page 59 BS83A04C 4-Key Enhanced Touch I/O Flash MCU 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.
  • Page 60 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Counter Value CTCCLR = 1; CTM [1:0] = 00 CCRA = 0 CCRA > 0 Counter cleared by CCRA value Counter overflow 0x3FF CCRA=0 Resume CCRA Pause Stop Counter Restart CCRP Time CTON...
  • Page 61 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Timer/Counter Mode To 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.
  • Page 62 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Counter Value CTDPX = 0; CTM [1:0] = 10 Counter cleared by CCRP Counter Reset when CTON returns high CCRP Counter Stop if Pause Resume CTON bit low CCRA Time CTON CTPAU CTPOL CCRA Int.
  • Page 63 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Counter Value CTDPX = 1; CTM [1:0] = 10 Counter cleared by CCRA Counter Reset when CTON returns high CCRA Counter Stop if Pause Resume CTON bit low CCRP Time CTON CTPAU CTPOL CCRP Int.
  • Page 64: Touch Key Function

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Touch Key Function The device provides multiple touch key functions. The touch key function is fully integrated and requires no external components, allowing touch key functions to be implemented by the simple manipulation of internal registers.
  • Page 65 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Register Name TKM0C0 — — M0DFEN — M0SOFC M0SOF2 M0SOF1 M0SOF0 TKM0C1 M0TSS — M0ROEN M0KOEN M0K4EN M0K3EN M0K2EN M0K1EN TKM0C2 M0SK31 M0SK30 M0SK21 M0SK20 M0SK11 M0SK10 M0SK01 M0SK00 TKM0TH16L TKM0TH16H TKM0THS M0K4THF...
  • Page 66 BS83A04C 4-Key Enhanced Touch I/O Flash MCU In the auto scan mode, if the time slot counter overflows but the touch key auto scan operation is not completed, the TKRCOV bit will not be set. At this time, the touch...
  • Page 67 BS83A04C 4-Key Enhanced Touch I/O Flash MCU In the periodic auto scan mode, the touch key scan operation will be implemented automatically on a periodic basis, which can be determined by the ASMP1~ASMP0 bits in the TKC2 register. Only at the end of the last scan operation in the WDT time- out cycle, the 16-bit C/F counter content for all scanned keys will be written into the corresponding touch key data memory.
  • Page 68 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Bit 1~0 ASMP1~ASMP0: Periodic auto scan mode period selection 00: 2 LIRC 01: 2 LIRC 10: 2 LIRC 11: 2 LIRC These bits are used to determine the touch key scan period and only available when the touch key fucntion is configured to operate in the periodic auto scan mode.
  • Page 69 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • TKM0ROH/TKM0ROL – Touch Key Module 0 Reference Oscillator Capacitor Selection Register Pair Register TKM0ROH TKM0ROL Name — — — — — — — — — — — — R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W —...
  • Page 70 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • TKM0C1 Register Name M0TSS — M0ROEN M0KOEN M0K4EN M0K3EN M0K2EN M0K1EN — — Bit 7 M0TSS: Touch key module 0 time slot counter clock source selection 0: Touch key module 0 reference oscillator...
  • Page 71 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • TKM0C2 Register This register is used to select the desired scan key in the time slots 0~3 of the touch key module 0. It should be noted that if any key is disabled, the touch key module 0 Reference and Key oscillators of the corresponding time slot will not oscillate.
  • Page 72 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • TKM0THS Register Name M0K4THF M0K3THF M0K2THF M0K1THF M0K4THS M0K3THS M0K2THS M0K1THS Bit 7 M0K4THF: Touch key module 0 KEY4 upper/lower threshold comparison flag 0: Not less than lower threshold or not larger than upper threshold...
  • Page 73: Touch Key Operation

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Touch Key Operation When a finger touches or is in proximity to a touch pad, the capacitance of the pad will increase. By using this capacitance variation to change slightly the frequency of the internal sense oscillator, touch actions can be sensed by measuring these frequency changes.
  • Page 74 BS83A04C 4-Key Enhanced Touch I/O Flash MCU The key oscillator and reference oscillator in the module 0 will be automatically stopped and the 16- bit C/F counter, 16-bit counter, 5-bit time slot unit period counter and 8-bit time slot timer counter will be automatically switched off when the time slot counter overflows.
  • Page 75 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Key Auto Scan Cycle TKST Time slot 0 Time slot 0 Module 0 TKBUSY Clear to zero by software TKRCOV Touch Key Data Memory Access : Set Touch Key interrupt request flag : Read 2N bytes from Touch Key Data Memory to TKM0ROH/TKM0ROL registers : Write 2N bytes from TKM016DH/TKM016DL registers to Touch Key Data Memory Touch Key Auto Scan Mode Timing Diagram –...
  • Page 76: Touch Key Data Memory

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU In the periodic auto scan mode the touch key scan operation will be implemented automatically on a periodic basis, which can be determined by the ASMP1~ASMP0 bits in the TKC2 register. The number of touch key scan times depends upon the WDT time-out period and the periodic auto scan mode period.
  • Page 77: Touch Key Scan Operation Flowchart

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Touch Key Scan Operation Flowchart Start Write Ref. OSC Capacitor value to TKM0ROH/TKM0ROL Touch Key Manual Scan Operation Start Set Start bit TKST 0  1  Busy flag TKBUSY=1 Initiate Time Slot &...
  • Page 78 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Start Write Ref. OSC internal Capacitor value to Data Memory (Bank 6 ) Touch Key Auto Scan Operation Start Set Start bit TKST 0  1  Busy flag TKBUSY=1 Load Ref. OSC internal...
  • Page 79: Touch Key Interrupts

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Touch Key Interrupts The touch key has two independent interrupts, known as touch key TKRCOV interrupt and touch key threshold TKTH interrupt. In the manual scan mode, when the touch key module 0 time slot counter overflows, an actual touch key TKRCOV interrupt will take place.
  • Page 80: I 2 C Interface

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU C Interface The I C 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.
  • Page 81: I 2 C Registers

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU START signal from Master Send slave address and R/W bit from Master Acknowledge from slave Send data byte from Master Acknowledge from slave STOP signal from Master C Interface Operation The IICDEB1 and IICDEB0 bits determine the debounce time of the I C interface.
  • Page 82 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • IICD Register Name “x”: Unknown D7~D0: I Bit 7~0 C data register bit 7 ~ bit 0 C Address Register The IICA register is the location where the 7-bit slave address of the slave device is stored. Bits 7~1 of the IICA register define the device slave address.
  • Page 83 BS83A04C 4-Key Enhanced Touch I/O Flash MCU the I C control bits such as HTX and TXAK will remain at the previous settings and should therefore be first initialised by the application program while the relevant I flags such as HCF, HAAS, HBB, SRW and RXAK will be set to their default states.
  • Page 84: I 2 C Bus Communication

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Bit 0 RXAK: I C Bus Receive acknowledge flag 0: Slave receive acknowledge flag 1: Slave does not receive acknowledge flag The RXAK flag is the receiver acknowledge flag. When the RXAK flag is “0”, it means that a acknowledge signal has been received at the 9th clock, after 8 bits of data have been transmitted.
  • Page 85 BS83A04C 4-Key Enhanced Touch I/O Flash MCU C Bus Start Signal The START signal can only be generated by the master device connected to the I C bus and not by the slave device. This START signal will be detected by all devices connected to the I C bus.
  • Page 86 BS83A04C 4-Key Enhanced Touch I/O Flash MCU C Bus Data and Acknowledge Signal The transmitted data is 8-bit 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...
  • Page 87: I 2 C Time-Out Control

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Start IICTOF=1? SET IICTOEN HAAS=1? CLR IICTOF HTX=1? SRW=1? RETI Read from IICD to CLR HTX SET HTX release SCL Line CLR TXAK RETI Write data to IICD to Dummy read from IICD...
  • Page 88 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Start Slave Address C time-out counter start Stop C time-out counter reset on SCL negative transition C Time-out When an I C time-out counter overflow occurs, the counter will stop and the IICTOEN bit will be cleared to zero and the IICTOF bit will be set high to indicate that a time-out condition has occurred.
  • Page 89: Interrupts

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Interrupts Interrupts are an important part of any microcontroller system. When an external event or an internal function such as a Touch action or Timer Module overflow 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.
  • Page 90 BS83A04C 4-Key Enhanced Touch I/O Flash MCU • INTEG Register Name — — — — — — INTS1 INTS0 — — — — — — — — — — — — Bit 7~4 Unimplemented, read as “0” Bit 1~0 INTS1~INTS0: Interrupt edge control for INT pin...
  • Page 91 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Bit 4 I2CF: I C interrupt request flag 0: No request 1: Interrupt request Bit 3~2 Unimplemented, read as “0” Bit 1 TBE: Time Base interrupt control 0: Disable 1: Enable Bit 0...
  • Page 92: Interrupt Operation

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Interrupt Operation When the conditions for an interrupt event occur, such as a TM Comparator P or Comparator A match 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.
  • Page 93: External Interrupt

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU External Interrupt The external interrupt is controlled by signal transitions on the INT pin. An external interrupt request will take place when the external interrupt request flag, INTF, is set, which will occur when a transition, whose type is chosen by the edge select bits, appears on the external interrupt pin.
  • Page 94: Multi-Function Interrupt

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU TB[2:0] TBON Time Base Interrupt Prescaler CLKSEL[1:0] Time Base Interrupt • PSCR Register Name — — — — — — CLKSEL1 CLKSEL0 — — — — — — — — — — —...
  • Page 95: Touch Key Tkrcov Interrupt

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 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.
  • Page 96: Interrupt Wake-Up Function

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Interrupt Wake-up Function Each 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.
  • Page 97: Application Circuits

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Application Circuits 0.1μF PA5/KEY1 PA1/KEY2 PA3/KEY3 PA2/CTPB/SDA/ICPCK PA0/CTCK/INT/SCL/ICPDA PA4/KEY4 PA6/CTCK/INT PA7/CTP Rev. 1.00 March 24, 2020...
  • Page 98: Instruction Set

    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.
  • Page 99: Logical And Rotate Operation

    The standard logical operations such as AND, OR, XOR and CPL all have their own instruction within the Holtek microcontroller instruction set. As with the case of most instructions involving data manipulation, data must pass through the Accumulator which may involve additional programming steps.
  • Page 100: Instruction Set Summary

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Instruction Set Summary The following table depicts a summary of the instruction set categorised according to function and can be consulted as a basic instruction reference using the following listed conventions. Table Conventions...
  • Page 101 BS83A04C 4-Key Enhanced Touch I/O Flash MCU Mnemonic Description Cycles Flag Affected Data Move MOV A,[m] Move Data Memory to ACC None MOV [m],A Move ACC to Data Memory Note None MOV A,x Move immediate data to ACC None Bit Operation CLR [m].i...
  • Page 102: Instruction Definition

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU Instruction Definition ADC A,[m] Add Data Memory to ACC with Carry Description The contents of the specified Data Memory, Accumulator and the carry flag are added. The result is stored in the Accumulator.
  • Page 103 BS83A04C 4-Key Enhanced Touch I/O Flash MCU CALL addr Subroutine call Description 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.
  • Page 104 BS83A04C 4-Key Enhanced Touch I/O Flash MCU CPLA [m] Complement Data Memory with result in ACC Description 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.
  • Page 105 BS83A04C 4-Key Enhanced Touch I/O Flash MCU JMP addr Jump unconditionally Description 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.
  • Page 106 BS83A04C 4-Key Enhanced Touch I/O Flash MCU RET A,x Return from subroutine and load immediate data to ACC Description The Program Counter is restored from the stack and the Accumulator loaded with the specified immediate data. Program execution continues at the restored address.
  • Page 107 BS83A04C 4-Key Enhanced Touch I/O Flash MCU RRA [m] Rotate Data Memory right with result in ACC Description 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.
  • Page 108 BS83A04C 4-Key Enhanced Touch I/O Flash MCU SDZA [m] Skip if decrement Data Memory is zero with result in ACC Description The contents of the specified Data Memory are first decremented by 1. If the result is 0, the following instruction is skipped. The result is stored in the Accumulator but the specified Data Memory contents remain unchanged.
  • Page 109 BS83A04C 4-Key Enhanced Touch I/O Flash MCU SUBM A,[m] Subtract Data Memory from ACC with result in Data Memory Description 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.
  • Page 110 BS83A04C 4-Key Enhanced Touch I/O Flash MCU TABRD [m] Read table (specific page or current page) to TBLH and Data Memory Description The low byte of the program code addressed by the table pointer (TBHP and TBLP or only TBLP if no TBHP) is moved to the specified Data Memory and the high byte moved to TBLH.
  • Page 111: Package Information

    BS83A04C 4-Key Enhanced Touch I/O 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 the latest version of the Package/Carton Information.
  • Page 112: 8-Pin Sop (150Mil) Outline Dimensions

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 8-pin SOP (150mil) Outline Dimensions & " Dimensions in inch Symbol Min. Nom. Max. — 0.236 BSC — — 0.154 BSC — 0.012 — 0.020 C′ — 0.193 BSC — — — 0.069 —...
  • Page 113: 10-Pin Dfn (3Mm×3Mm×0.75Mm) Outline Dimensions

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 10-pin DFN (3mm×3mm×0.75mm) Outline Dimensions Dimensions in inch Symbol Min. Nom. Max. 0.028 0.030 0.031 0.000 0.001 0.002 — 0.080 BSC — 0.007 0.010 0.012 — 0.118 BSC — — 0.118 BSC —...
  • Page 114: 10-Pin Msop (118Mil) Outline Dimensions

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 10-pin MSOP (118mil) Outline Dimensions R 0 . 1 0 ( 4 C O R N E R S ) Dimensions in inch Symbol Min. Nom. Max. — — 0.043 0.000 — 0.006 0.030...
  • Page 115: 16-Pin Nsop (150Mil) Outline Dimensions

    BS83A04C 4-Key Enhanced Touch I/O Flash MCU 16-pin NSOP (150mil) Outline Dimensions & Dimensions in inch Symbol Min. Nom. Max. — 0.236 BSC — — 0.154 BSC — 0.012 — 0.020 C’ — 0.390 BSC — — — 0.069 —...
  • Page 116 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.

Table of Contents