BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Table of Contents Features – BS83A02L ................... 6 CPU Features ..........................6 Peripheral Features ........................6 Features – BS83B04L ................... 6 CPU Features ..........................6 Peripheral Features ........................7 General Description ....................7 Selection Table ...................... 8 Block Diagram .......................
Page 3
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU General Purpose Data Memory ....................25 Special Purpose Data Memory ....................25 Special Function Register Description ............. 28 Indirect Addressing Registers – IAR0, IAR1 ................28 Memory Pointers – MP0, MP1 ....................28 Bank Pointer – BP ........................29 Accumulator –...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Features – BS83A02L 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 •...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Selection Table Most features are common to all devices and the main features distinguishing them are Oscillator Types, Memory capacity, I/O count, Touch key count, Time Base, Timers, Interface, Stack and Package types. The following table summarises the main features of each device.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Pin Descriptions With the exception of the power pins, all pins on the devices can be referenced by their 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 function such as the Touch Key function etc.
Page 11
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU BS83B04L Pin Name Function Description PAPU General purpose I/O. Register enabled pull-up PAWU CMOS and wake-up PAS0 PAS0 CTCK — CTM clock input PA0/CTCK/INT/SCL/ PAS0 ICPDA — External Interrupt input INTEG INTC0 PAS0...
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 ......................
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Standby Current Characteristics BS83A02L Ta=25°C Test Conditions Symbol Standby Mode Min. Typ. Max. Unit Conditions 1.8V — SLEEP Mode WDT on — — SLEEP Mode – 1 Key Wake-up WDT on, f —...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU A.C. Characteristics For 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 – HIRC – Frequency Accuracy During 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 3. The minimum and maximum tolerance values provided in the table are only for the frequency at which the writer trims the HIRC oscillator. After trimming at this chosen specific frequency any change in HIRC oscillator frequency using the oscillator register control bits by the application program will give a frequency tolerance to within +-20%.
4. The System Speed Switch Time is effectively the time taken for the newly activated oscillator to start up. 5. The LVRC software reset is used for the BS83A02L only while the RSTC software reset is used for the BS83B04L only.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Memory Characteristics Ta=-40°C~85°C, unless otherwise specify Test Conditions Symbol Parameter Min. Typ. Max. Unit Conditions for Read / Write — — — DDmin DDmax Flash Program / EEPROM Memory (EEPROM is used for BS83B04L only) Erase / Write Cycle Time –...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU System Architecture A key factor in the high-performance features of the range of microcontrollers is attributed to their internal system architecture. These devices take advantage of the usual features found within RISC microcontrollers providing increased speed of operation and enhanced performance. The pipelining...
Pointer Stack Level N Bottom of Stack Note: N=2 for BS83A02L while N=4 for BS83B04L. Arithmetic and Logic Unit – ALU The 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.
“0”. The accompanying diagram illustrates the addressing data flow of the look-up table. Last Page or Program Counter Program Memory High Byte for BS83A02L while Last Page or TBHP Register for BS83B04L Data...
ORG statement. The value at this ORG statement is “300H” which refers to the start address of the last page within the 1K Program Memory of the BS83A02L device. The table pointer 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 “306H”...
There are EV chips named BS83AV02L and BS83BV04L which are used to emulate the real MCU devices named BS83A02L and BS83B04L respectively. The EV chip devices also provide an “On- Chip Debug” function to debug the real MCU devices during the development process. The EV chips and the real MCU devices are almost functionally compatible except for “On-Chip Debug”...
Bank 0: 80H~FFH 24×8 Bank 6: 00H~07H Bank 1: 40H (EEC only) Bank 7: 00H~07H Data Memory Summary Special Purpose Data Memory (Bank 0) General Purpose Data Memory (Bank 0) Bank 0 Data Memory Structure – BS83A02L Rev. 1.10 March 02, 2020...
General Purpose Data Memory (Bank 0) Bank 0 Data Memory Structure – BS83B04L • TDn Register – BS83A02L (n=0~5) Name Bit 7~0 D7~D0: Temporary Data register When the data memory capacity is not enough for applications, it can be temporarily used for data storage.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Bank Pointer – BP For the BS83B04L, 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 32
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • EEA Register Name — — — EEA4 EEA3 EEA2 EEA1 EEA0 — — — — — — Bit 7~5 Unimplemented, read as “0” Bit 4~0 EEA4~EEA0: Data EEPROM address bit 4 ~ bit 0 •...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 3. Ensure that the write operation is totally complete before changing the EEC register content. Reading Data from the EEPROM To read data from the EEPROM, the EEPROM address of the data to be read must first be placed in the EEA register.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Programming Considerations Care 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 Bank Pointer could be normally cleared to zero as this would inhibit access to Bank 1 where the EEPROM control register exist.
There are two methods of generating the system clock, one high speed oscillator and one low speed oscillator. For the BS83A02L, the high speed oscillator is the internal 8MHz RC oscillator, HIRC. For the BS83B04L, the high speed oscillator is the internal 2/4/8MHz RC oscillator. The low speed oscillator is the internal 2kHz RC oscillator, LIRC.
The internal RC oscillator is a fully integrated system oscillator requiring no external components. For the BS83A02L, the internal RC oscillator has a fixed frequency of 8MHz. For the BS83B04L, the internal RC oscillator has three fixed frequencies of 2MHz, 4MHz and 8MHz, which is selected using a configuration option.
As Holtek has provided these devices 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU System Operation Modes There 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU IDLE1 Mode The IDLE1 Mode is entered when a 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • HIRCC Register – BS83A02L Name — — — — — — HIRCF HIRCEN — — — — — — — — — — — — Bit 7~2 Unimplemented, read as “0” Bit 1...
Page 41
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU FAST SLOW CPU run CPU run on/off SLEEP IDLE0 HALT instruction executed HALT instruction executed CPU stop CPU stop FHIDEN=0 FHIDEN=0 FSIDEN=0 FSIDEN=1 IDLE2 IDLE1 HALT instruction executed HALT instruction executed CPU stop...
Page 42
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU SLOW Mode to FAST Mode Switching In SLOW mode the system clock is derived from f . When system clock is switched back to the FAST mode from f , the CKS2~CKS0 bits should be set to “000”~“110” and then the system clock will respectively be switched to f /64.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU the f 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU In the IDLE1 and IDLE2 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.
These three bits determine the division ratio of the Watchdog Timer source clock, which in turn determines the timeout period. The internal clock, f is supplied by the LIRC oscillator with the output frequency of f LIRC • RSTFC Register – BS83A02L Name — — —...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Bit 0 WRF: WDT control register software reset flag 0: Not occurred 1: Occurred This bit is set high by the WDT Control register software reset and cleared to zero by the application program. Note that this bit can only be cleared to zero by the application program.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 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 contents. The maximum time out period is when the 2 division ratio is selected.
Page 48
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Power-on Reset RSTD SST Time-out Power-On Reset Timing Chart Internal Reset Control – BS83B04L There is an internal reset control register, RSTC, which is used to provide a reset when the device operates abnormally due to the environmental noise interference. If the content of the RSTC register is set to any value other than 01010101B or 10101010B, it will reset the device after a delay time, .
Page 49
LVR will ignore the low supply voltage and will not perform a reset function. For the BS83A02L, the LVR function can be controlled by the LVRC register. If the LVS7~LVS0 bits are set to 01011010B, the LVR function is enabled with a fixed LVR voltage of 1.7V. If the LVS7~LVS0 bits are set to 10100101B, the LVR function is disabled.
Page 50
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • RSTFC Register – BS83A02L Name — — — — — LVRF — — — — — — — — — — “x”: Unknown Bit 7~3 Unimplemented, read as “0” LVRF: LVR function reset flag...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Watchdog Time-out Reset during SLEEP or IDLE Mode The 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”...
Page 52
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU LVR Reset WDT Time-out WDT Time-out Register Power On Reset (Normal Operation) (Normal Operation) (IDLE/SLEEP) ● ● x x x x x x x x u u u u u u u u...
“-” stands for unimplemented 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.
Note that the LVPU bit in the LVPUC register is only available when the corresponding pin pull- high function is enabled by setting the relevant pull-high control bit high. This bit will have no effect when the pull-high function is disabled. • PAPU Register – BS83A02L Name —...
Note that the wake-up function can be controlled by the wake-up control registers only when the pin-shared functional pin is selected as general purpose input and the MCU enters the IDLE or SLEEP mode. • PAWU Register – BS83A02L Name —...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • PAC Register – BS83B04L 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 58
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • PAS0 Register – BS83A02L Name PAS07 PAS06 — — PAS03 PAS02 — — — — — — — — — — Bit 7~6 PAS07~PAS06: PA3 Pin-Shared function selection 00/01/10: PA3 11: KEY2 Bit 5~4 Unimplemented, read as “0”...
The provision of the Timer/Event Counter forms an important part of any microcontroller, giving the designer a means of carrying out time related functions. The BS83A02L contains an 8-bit Timer/ Event Counter, which contains an 8-bit programmable count-up counter and the clock may come from an external or internal clock source.
Page 61
D7~D0: Timer preload register data byte Timer Control Register – TMRC The flexible features of the Holtek microcontroller Timer/Event Counter are implemented by operating in three different modes, the options of which are determined by the contents of control register bits.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Bit 5 Unimplemented, read as “0” Bit 4 TON: Timer/Event Counter counting enable control 0: Disable 1: Enable Bit 3 TEG: Timer/Event Counter active edge selection Event Counter Mode 0: Count on rising edge...
Page 63
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU source. After the other bits in the Timer Control Register have been properly configured, the enable bit TON, can be set high to enable the Timer/Event Counter. If the Active Edge Selection bit, TEG, is low, the Timer/Event Counter will increase each time the TC pin receives a low to high transition.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU activated and the required logical transitions occur on the external TC pin. As a result, when the timer overflows it will generate a timer interrupt and corresponding wake-up source. External TC Pin Input TON –...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Timer Module (TM) – BS83B04L One of the most fundamental functions in any microcontroller device is the ability to control and measure time. To implement time related functions the BS83B04L includes a Timer Module, abbreviated to the name TM.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU CTCK input pin can be chosen to have either a rising or falling active edge. 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Step 2. Write data to High Byte CTMAH ♦ – 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Compact Type TM Register Description Overall operation of each 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.
Page 69
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
Page 70
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 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...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • CTMDL Register Name Bit 7~0 D7~D0: CTM Counter Low Byte Register bit 7 ~ bit 0 CTM 10-bit Counter bit 7 ~ bit 0 • CTMDH Register Name — — — —...
Page 72
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 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.
Page 73
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 74
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 75
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 76
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Touch Key Function – BS83A02L The device provides two 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 79
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • TKC0 Register Name — TKRCOV TKST TKCFOV TK16OV TKMOD1 TKMOD0 TKBUSY — — Bit 7 Unimplemented, read as “0” Bit 6 TKRCOV: Touch key time slot counter overflow flag 0: No overflow occurs 1: Overflow occurs This bit can be accessed by application program.
Page 80
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU by application program. Bit 2~1 TKMOD1~TKMOD0: Touch key scan mode selection 00: Auto scan mode 01: Manual scan mode 10/11: Periodic auto scan mode In the manual scan mode, the reference oscillator capacitor value should be properly configured before the scan operation begins and the touch key module 0 16-bit C/F counter value should be read after the scan operation finishes by application program.
Page 81
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • TKC2 Register Name — — — — — ASMP1 ASMP0 — — — — — — — — — — Bit 7~3 Unimplemented, read as “0” TSC: Time slot control Bit 2...
Page 82
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU slot 0 but kept unchanged at the end of the time slot 1 when the auto scan mode or the periodic auto scan mode is selected. This register pair will be cleared to zero when the TKST bit is cleared to zero.
Page 84
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Bit 1 Unimplemented, read as “0” Bit 0 M0SK00: Touch key module 0 time slot 0 key scan selection 0: KEY1 1: KEY2 These bits are used to select the desired scan key in time slot 0 in the auto scan mode or the periodic auto scan mode or used as the multiplexer for scan key select in the manual mode.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • TKM0THS Register Name — — M0K2THF M0K1THF — — M0K2THS M0K1THS — — — — — — — — Bit 7~6 Unimplemented, read as “0” Bit 5 M0K2THF: Touch key module 0 KEY2 upper/lower threshold comparison flag...
Page 86
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU The touch key module 0 contains two touch key inputs, namely KEY1~KEY2, which are shared with logical I/O pins, and the desired function is selected using register bits. The touch key has its own independent sense oscillator.
Page 87
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU In the auto scan mode, the key oscillator and reference oscillator will automatically be enabled when the TKST bit is set from low to high and disabled automatically when the TKBUSY bit changes from high to low.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Touch Key Function – BS83B04L The BS83B04L 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 93
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU TKRCOV interrupt request flag will not be affected. Therefore, this bit can not be set by application program but must be cleared to 0 by application program. 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.
Page 94
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU register. The scan operation will not be stopped until all arranged keys are scanned. 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.
Page 95
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU power consumption and implement the 1-key wake-up function from IDLE or SLEEP mode. The desired wake-up key in time slot 0 is selected by the M0SK01~M0SK00 bits in the TKM0C2 register. Bit 1~0...
Page 98
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 100
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU TKST M0KOEN M0ROEN Cleared by hardware KEY OSC CLK Reference OSC CLK Enable CFTMCK 8-bit time slot counter overflow time (M0DFEN=0) CFTMCK (M0DFEN=1) CFTMCK TKBUSY TKRCOV Set Touch Key TKRCOV interrupt request flag...
Page 101
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU Auto Scan Mode There are three scan modes contained for the touch key function. The auto scan mode, the periodic auto scan mode and the manual scan mode are selected using the TKMOD1~TKMOD0 bits in the TKC0 register.
Page 102
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 –...
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU cleared. When any key C/F counter value is less than the lower threshold if M0KnTHS=0, or larger than the upper threshold if M0KnTHS=1, a touch key threshold interrupt will take place. More details regarding the touch key interrupt is located in the interrupt section of the datasheet.
Page 107
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU that no chip select line exists, as each device on the I C bus is identified by a unique address which will be transmitted and received on the I C bus. When two devices communicate with each other on the bidirectional I C bus, one is known as the master device and one as the slave device.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU chosen to be either 2 or 4 system clocks. To achieve the required I C data transfer speed, there exists a relationship between the system clock, f , and the I C debounce time. For either the I 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.
Page 109
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • IICA Register Name IICA6 IICA5 IICA4 IICA3 IICA2 IICA1 IICA0 — — — Bit 7~1 IICA6~IICA0: I C slave address IICA6~IICA0 is the I C slave address bit 6~bit 0. Bit 0 Unimplemented, read as “0”...
Page 110
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • IICC1 Register Name HAAS TXAK IAMWU RXAK Bit 7 HCF: I C Bus data transfer completion flag 0: Data is being transferred 1: Completion of an 8-bit data transfer The HCF flag is the data transfer flag. This flag will be zero when data is being transferred.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU The RXAK flag is the receiver acknowledge flag. When the RXAK flag is “0”, it means that an 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 RXAK flag to determine if the master receiver wishes to receive the next byte.
Page 112
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 113
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU a STOP signal to release the I C 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 115
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
Time Base — Touch key TKRCOV TKRCOVE TKRCOVF — Touch key threshold TKTH TKTHE TKTHF — Timer/Event Counter For BS83A02L only I2CE I2CF For BS83B04L only EEPROM Write Operation For BS83B04L only Multi-function MFnE MFnF For BS83B04L only, n=0~1 CTMPE...
Page 117
Bit 7~2 Unimplemented, read as “0” Bit 1~0 INTS1~INTS0: Interrupt edge control for INT pin 00: Disable 01: Rising edge 10: Falling edge 11: Rising and falling edges • INTC0 Register – BS83A02L Name — TKTHF TKRCOVF INTF TKTHE TKRCOVE INTE —...
Page 118
MF0E: Multi-function interrupt 0 control 0: Disable 1: Enable Bit 1 INTE: INT interrupt control 0: Disable 1: Enable Bit 0 EMI: Global interrupt control 0: Disable 1: Enable • INTC1 Register – BS83A02L Name — — — — — — — — —...
Page 119
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU • INTC1 Register – BS83B04L Name — I2CF — I2CE — — — — Bit 7 Unimplemented, read as “0” Bit 6 DEF: Data EEPROM interrupt request flag 0: No request 1: Interrupt request...
TKRCOVF TKRCOVE TKRCOV Touch Key TKTHF TKTHE Threshold TKTH Timer Time Base Interrupt Structure – BS83A02L Legend Request Flag, no auto reset in ISR Request Flag, auto reset in ISR EMI auto disabled in ISR Enable Bits Interrupt Request Enable...
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 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 pin is pin-shared with I/O pin, it can only be configured as external interrupt pin if its 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.
Page 123
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU happens, its respective interrupt request flag, TBF 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, TBE, 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.
Touch Key TKRCOV Interrupt For the BS83A02L, the Touch Key TKRCOV Interrupt is an individual interrupt source with its own interrupt vector. A Touch Key TKRCOV Interrupt request will take place when the Touch Key TKRCOV Interrupt request flag, TKRCOVF, is set, which occurs when the touch key time slot counter overflow flag is set high.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU described threshold comparison conditions occurs, a subroutine call to its interrupt vector, will take place. When the interrupt is serviced, the Touch Key Threshold TKTH Interrupt request flag, TKTHF, will be automatically cleared. The EMI bit will also be automatically cleared to disable other interrupts.
BS83A02L/BS83B04L Ultra-Low Power Touch Key Flash MCU 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.
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.
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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 131
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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...
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 133
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 134
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 135
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 136
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 137
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 138
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 139
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 140
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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.
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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...
BS83A02L/BS83B04L Ultra-Low Power Touch Key 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 149
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.
Need help?
Do you have a question about the BS83A02L and is the answer not in the manual?
Questions and answers