Bs83b12a 3
Bs83b12a 3
BS83B04A-4
BS83B08A-3/BS83B08A-4
BS83B12A-3/BS83B12A-4
BS83B16A-3/BS83B16A-4
Table of Contents
Features............................................................................................................. 5
CPU Features.......................................................................................................................... 5
Peripheral Features.................................................................................................................. 5
Write Protection...................................................................................................................... 34
EEPROM Interrupt................................................................................................................. 34
Programming Considerations................................................................................................. 35
Oscillators....................................................................................................... 36
Oscillator Overview................................................................................................................ 36
System Clock Configurations................................................................................................. 36
Internal RC Oscillator – HIRC................................................................................................ 37
Internal 32kHz Oscillator – LIRC............................................................................................ 37
Watchdog Timer.............................................................................................. 48
Watchdog Timer Clock Source............................................................................................... 48
Watchdog Timer Control Register.......................................................................................... 48
Watchdog Timer Operation.................................................................................................... 50
Input/Output Ports.......................................................................................... 61
Pull-high Resistors................................................................................................................. 62
Port A Wake-up...................................................................................................................... 63
I/O Port Control Registers...................................................................................................... 64
Pin-shared Functions............................................................................................................. 65
I/O Pin Structures................................................................................................................... 66
Programming Considerations................................................................................................. 66
Timer/Event Counter...................................................................................... 67
Configuring the Timer/Event Counter Input Clock Source..................................................... 67
Timer Register – TMR............................................................................................................ 67
Timer Control Register – TMRC............................................................................................. 68
Timer Operation..................................................................................................................... 68
Prescaler................................................................................................................................ 69
Programming Considerations................................................................................................. 69
Interrupts......................................................................................................... 97
Interrupt Registers.................................................................................................................. 97
Interrupt Operation............................................................................................................... 100
External Interrupt.................................................................................................................. 102
Time Base Interrupt.............................................................................................................. 102
Timer/Event Counter Interrupt.............................................................................................. 103
EEPROM Interrupt............................................................................................................... 103
Touch Key Interrupt.............................................................................................................. 103
SIM Interrupt (except BS83B04A-4)..................................................................................... 103
I2C Interrupt (BS83B04A-4).................................................................................................. 104
Interrupt Wake-up Function.................................................................................................. 104
Programming Considerations............................................................................................... 104
Instruction Definition.....................................................................................110
Package Information.....................................................................................119
8-pin SOP (150mil) Outline Dimensions.............................................................................. 120
10-pin MSOP Outline Dimensions....................................................................................... 121
16-pin NSOP (150mil) Outline Dimensions.......................................................................... 122
16-pin SSOP (150mil) Outline Dimensions.......................................................................... 123
20-pin SOP (300mil) Outline Dimensions............................................................................ 124
20-pin SSOP (150mil) Outline Dimensions.......................................................................... 125
24-pin SOP (300mil) Outline Dimensions............................................................................ 126
24-pin SSOP (150mil) Outline Dimensions.......................................................................... 127
Features
CPU Features
• Operating Voltage
♦♦ For BS83B04A-4
––fSYS=8MHz: 2.2V~5.5V
♦♦ For BS83B08A-3/BS83B12A-3/BS83B16A-3
––fSYS=8MHz: 2.7V~5.5V
––fSYS=12MHz: 2.7V~5.5V
––fSYS=16MHz: 4.5V~5.5V
♦♦ For BS83B08A-4/BS83B12A-4/BS83B16A-4
––fSYS=8MHz: 2.2V~5.5V
––fSYS=12MHz: 2.7V~5.5V
––fSYS=16MHz: 4.5V~5.5V
• Up to 0.25μs instruction cycle with 16MHz system clock at VDD=5V
• Fully integrated 4/8/12/16 touch key functions -- require no external components
• Power down and wake-up functions to reduce power consumption
• Fully integrated low and high speed internal oscillators
• Low Speed -- 32kHz
• High speed -- 8MHz, 12MHz, 16MHz
• Multi-mode operation: NORMAL, SLOW, IDLE and SLEEP
• All instructions executed in one or two instruction cycles
• Table read instructions
• 63 powerful instructions
• Up to 4-level subroutine nesting
• Bit manipulation instruction
Peripheral Features
• Flash Program Memory: 2K×16
• RAM Data Memory: 128×8~288×8
• True EEPROM Memory: 32×8~64×8
• Watchdog Timer function
• Up to 22 bidirectional I/O lines
• External interrupt line shared with I/O pin
• Single 8-bit Timer/Event Counter
• Single Time-Base function for generation of fixed time interrupt signals
• I2C for all devices and SPI interface for the devices except BS83B04A-4
• Low voltage reset function
• 4/8/12/16 touch key functions
• High current LED driver
General Description
These devices are a series of Flash Memory type 8-bit high performance RISC architecture
microcontrollers with fully integrated touch key functions. With all touch key functions provided
internally and with the convenience of Flash Memory multi-programming features, this device range
has all the features to offer designers a reliable and easy means of implementing Touch Keys within
their products applications.
The touch key functions are fully integrated completely eliminating the need for external
components. In addition to the flash program memory, 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. Protective features such as an internal Watchdog Timer and
Low Voltage Reset functions coupled with excellent noise immunity and ESD protection ensure that
reliable operation is maintained in hostile electrical environments.
All devices include fully integrated low and high speed oscillators which require no external
components for their 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. Easy communication with the outside world is provided
using the internal I2C and SPI interfaces, while the inclusion of flexible I/O programming features,
Timer/Event Counters and many other features further enhance device functionality and flexibility.
These touch key devices will find excellent use in a huge range of modern Touch Key product
applications such as instrumentation, household appliances, electronically controlled tools to name
but a few.
Selection Table
Most features are common to all devices, the main distinguishing feature is the number of I/Os and
Touch Keys. The following table summarises the main features of each device.
High
Internal System Program Data Data Current 8-bit Time Touch SPI/
Part No. VDD I/O LVR Stack Package Marking
Clock Clock Memory Memory EEPROM LED Timer Base Key I2C
Output
BS83B04A-4
2.2V~ 8SOP
BS83B04A-4 8MHz 8MHz 2K×16 128×8 32×8 8 ― 1 1 4 1 2.10V 4 BS83B04A-4 (for 8SOP)
5.5V 10MSOP
83B04A4 (for 10MSOP)
8MHz
2.7V~ 8MHz~ 16NSOP
BS83B08A-3 12MHz 2K×16 160×8 64×8 14 ― 1 1 8 1 2.55V 4 ―
5.5V 16MHz 16SSOP
16MHz
8MHz
2.2V~ 8MHz~ 16NSOP
BS83B08A-4 12MHz 2K×16 160×8 64×8 14 ― 1 1 8 1 2.10V 4 ―
5.5V 16MHz 16SSOP
16MHz
8MHz
2.7V~ 8MHz~ 20SOP
BS83B12A-3 12MHz 2K×16 288×8 64×8 18 18 1 1 12 1 2.55V 4 ―
5.5V 16MHz 20SSOP
16MHz
8MHz
2.2V~ 8MHz~ 20SOP
BS83B12A-4 12MHz 2K×16 288×8 64×8 18 18 1 1 12 1 2.10V 4 ―
5.5V 16MHz 20SSOP
16MHz
8MHz
2.7V~ 8MHz~ 24SOP
BS83B16A-3 12MHz 2K×16 288×8 64×8 22 22 1 1 16 1 2.55V 4 ―
5.5V 16MHz 24SSOP
16MHz
8MHz
2.2V~ 8MHz~ 24SOP
BS83B16A-4 12MHz 2K×16 288×8 64×8 22 22 1 1 16 1 2.10V 4 ―
5.5V 16MHz 24SSOP
16MHz
Block Diagram
Low
Voltage
Flash Reset
Programming
Circuitry Watchdog
Timer
Stack
8-bit
Flash Flash RAM RISC Interrupt
Time
Program Program Data MCU Controller
Base
Memory Memory Memory Core
LIRC
Oscillator
HIRC
Touch 8-bit Oscillator
I/O SIM
Keys Timer
Pin Assignment
VDD 1 10 VSS
PA5/Key1 1 8 VDD PA5/Key1 2 9 PA2/SDA/ICPCK
PA1/Key2 2 7 VSS PA1/Key2 3 8 PA0/INT/SCL/ICPDA
PA3/Key3 3 6 PA2/SDA/ICPCK PA3/Key3 4 7 PA6/[INT]
PA4/Key4 4 5 PA0/INT/SCL/ICPDA PA4/Key4 5 6 PA7
BS83B04A-4 BS83B04A-4
8 SOP-A 10 MSOP-A
NC 1 16 NC PB0/KEY1 1 16 PA1/SDO
VDD 2 15 VSS PB1/KEY2 2 15 PA4/INT
PA5/Key1 3 14 PA2/SDA/ICPCK/OCDSCK PB2/KEY3 3 14 PA3/SCS
PA1/Key2 4 13 PA0/INT/SCL/ICPDA/OCDSDA PB3/KEY4 4 13 PA0/SDI/SDA/ICPDA/OCDSDA
PA3/Key3 5 12 PA6/[INT] PB4/KEY5 5 12 PA2/SCK/SCL/ICPCK/OCDSCK
PA4/Key4 6 11 PA7 PB5/KEY6 6 11 PA7
NC 7 10 NC PB6/KEY7 7 10 VDD/AVDD
OCDSCK 8 9 OCDSDA PB7/KEY8 8 9 AVSS/VSS
BS83BV04A BS83B08A-3/BS83B08A-4/83V08AV15
16 NSOP-A 16 NSOP-A/SSOP-A
PB0/KEY1 1 24 PA1/SDO
PB1/KEY2 2 23 PA4/INT
PB0/KEY1 1 20 PA1/SDO PB2/KEY3 3 22 PA3/SCS
PB1/KEY2 2 19 PA4/INT PB3/KEY4 4 21 PA0/SDI/SDA/ICPDA/OCDSDA
PB2/KEY3 3 18 PA3/SCS PB4/KEY5 5 20 PA2/SCK/SCL/ICPCK/OCDSCK
PB3/KEY4 4 17 PA0/SDI/SDA/ICPDA/OCDSDA PB5/KEY6 6 19 PA7
PB4/KEY5 5 16 PA2/SCK/SCL/ICPCK/OCDSCK PB6/KEY7 7 18 VDD/AVDD
PB5/KEY6 6 15 PA7 PB7/KEY8 8 17 AVSS/VSS
PB6/KEY7 7 14 VDD/AVDD PC0/KEY9 9 16 PC7/KEY16
PB7/KEY8 8 13 AVSS/VSS PC1/KEY10 10 15 PC6/KEY15
PC0/KEY9 9 12 PC3/KEY12 PC2/KEY11 11 14 PC5/KEY14
PC1/KEY10 10 11 PC2/KEY11 PC3/KEY12 12 13 PC4/KEY13
BS83B12A-3/BS83B12A-4/BS83V12A BS83B16A-3/BS83B16A-4/BS83V16A
20 SOP-A/SSOP-A 24 SOP-A/SSOP-A
Note: The OCDSDA and OCDSCK pins are used for OCDS function while the ICPDA and ICPCK
pins are used for ICP function.
Pin Descriptions
The function of each pin is listed in the following tables, however the details behind how each pin is
configured is contained in other sections of the datasheet.
BS83B04A-4
Pin Name Function OPT I/T O/T Description
PAWU
PA0 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA0/INT/SCL/ INT SFS ST — External interrupt
ICPDA/OCDSDA SCL IICC0 ST NMOS I2C clock
ICPDA — ST CMOS In-circuit programming address/data pin
OCDSDA — ST CMOS On-chip debug support data/address pin, for EV chip only.
PAWU
PA1 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA1/KEY2 PAPU
KEY2 TKM0C1 NSI — Touch key inputs
PAWU
PA2 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA2/SDA/ SDA — ST NMOS I2C data
ICPCK/OCDSCK
ICPCK — ST — In-circuit programming clock pin
OCDSCK — ST — On-chip debug support clock pin, for EV chip only.
PAWU
PA3 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA3/KEY3 PAPU
KEY3 TKM0C1 NSI — Touch key inputs
PAWU
PA4 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA4/KEY4 PAPU
KEY4 TKM0C1 NSI — Touch key inputs
PAWU
PA5 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA5/KEY1 PAPU
KEY1 TKM0C1 NSI — Touch key inputs
PAWU
PA6 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA6/[INT] PAPU
INT SFS ST — External interrupt
PAWU
PA7 PA7 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
VDD VDD — PWR — Power supply *
VSS VSS — PWR — Ground **
BS83B08A-3/BS83B08A-4
Pin Name Function OPT I/T O/T Description
PAWU
PA0 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA0/SDI/ SDI — ST — SPI data input
SDA/ICPDA/
SDA — ST NMOS I2C data
OCDSDA
ICPDA — ST CMOS In-circuit programming address/data pin
OCDSDA — ST CMOS On-chip debug support data/address pin, for EV chip only.
PAWU
PA1 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA1/SDO PAPU
SDO SIMC0 — CMOS SPI data output
PAWU
PA2 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA2/SCK/ SCK SIMC0 ST CMOS SPI serial clock
SCL/ICPCK/
SCL SIMC0 ST NMOS I2C clock
OCDSCK
ICPCK — ST — In-circuit programming clock pin
OCDSCK — ST — On-chip debug support clock pin, for EV chip only.
PAWU
PA3 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA3/SCS PAPU
SCS SIMC0 ST CMOS SPI slave select
PAWU
PA4 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA4/INT PAPU
INT INTEG ST — External interrupt
PAWU
PA7 PA7 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PB0/KEY1~ PB0~PB3 PBPU ST CMOS General purpose I/O. Register enabled pull-up
PB3/KEY4 KEY1~KEY4 TKM0C1 NSI — Touch key inputs
PB4~PB7 PBPU ST CMOS General purpose I/O. Register enabled pull-up
PB4/KEY5~
PB7/KEY8 KEY5~
TKM1C1 NSI — Touch key inputs
KEY8
VDD VDD — PWR — Power supply *
Touch Key Circuit PWR and it should be double bonded to
AVDD AVDD — PWR —
VDD*
VSS VSS — PWR — Ground **
Touch Key Circuit PWR and it should be double bonded to
AVSS AVSS — PWR —
VSS**
BS83B12A-3/BS83B12A-4
Pin Name Function OPT I/T O/T Description
PAWU
PA0 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA0/SDI/ SDI — ST — SPI data input
SDA/ICPDA/
SDA — ST NMOS I2C data
OCDSDA
ICPDA — ST CMOS In-circuit programming address/data pin
OCDSDA — ST CMOS On-chip debug support data/address pin, for EV chip only.
PAWU
PA1 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA1/SDO PAPU
SDO SIMC0 — CMOS SPI data output
PAWU
PA2 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA2/SCK/ SCK SIMC0 ST CMOS SPI serial clock
SCL/ICPCK/
SCL SIMC0 ST NMOS I2C clock
OCDSCK
ICPCK — ST — In-circuit programming clock pin
OCDSCK — ST — On-chip debug support clock pin, for EV chip only.
PAWU
PA3 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA3/SCS PAPU
SCS SIMC0 ST CMOS SPI slave select
PAWU
PA4 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA4/INT PAPU
INT INTEG ST — External interrupt
PAWU
PA7 PA7 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PB0/KEY1~ PB0~PB3 PBPU ST CMOS General purpose I/O. Register enabled pull-up
PB3/KEY4 KEY1~KEY4 TKM0C1 NSI — Touch key inputs
PB4/KEY5~ PB4~PB7 PBPU ST CMOS General purpose I/O. Register enabled pull-up
PB7/KEY8 KEY5~KEY8 TKM1C1 NSI — Touch key inputs
PC0~PC3 PCPU ST CMOS General purpose I/O. Register enabled pull-up
PC0/KEY9~
PC3/KEY12 KEY9~
TKM2C1 NSI — Touch key inputs
KEY12
VDD VDD — PWR — Power supply *
Touch Key Circuit PWR and it should be double bonded to
AVDD AVDD — PWR —
VDD*
VSS VSS — PWR — Ground **
Touch Key Circuit PWR and it should be double bonded to
AVSS AVSS — PWR —
VSS**
BS83B16A-3/BS83B16A-4
Pin Name Function OPT I/T O/T Description
PAWU
PA0 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA0/SDI/ SDI — ST — SPI data input
SDA/ICPDA/
SDA — ST NMOS I2C data
OCDSDA
ICPDA — ST CMOS In-circuit programming address/data pin
OCDSDA — ST CMOS On-chip debug support data/address pin, for EV chip only.
PAWU
PA1 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA1/SDO PAPU
SDO SIMC0 — CMOS SPI data output
PAWU
PA2 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PA2/SCK/ SCK SIMC0 ST CMOS SPI serial clock
SCL/ICPCK/
SCL SIMC0 ST NMOS I2C clock
OCDSCK
ICPCK — ST — In-circuit programming clock pin
OCDSCK — ST — On-chip debug support clock pin, for EV chip only.
PAWU
PA3 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA3/SCS PAPU
SCS SIMC0 ST CMOS SPI slave select
PAWU
PA4 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA4/INT PAPU
INT INTEG ST — External interrupt
PAWU
PA7 PA7 ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAPU
PB0/KEY1~ PB0~PB3 PBPU ST CMOS General purpose I/O. Register enabled pull-up
PB3/KEY4 KEY1~KEY4 TKM0C1 NSI — Touch key inputs
PB4/KEY5~ PB4~PB7 PBPU ST CMOS General purpose I/O. Register enabled pull-up
PB7/KEY8 KEY5~KEY8 TKM1C1 NSI — Touch key inputs
PC0~PC3 PCPU ST CMOS General purpose I/O. Register enabled pull-up
PC0/KEY9~
PC3/KEY12 KEY9~
TKM2C1 NSI — Touch key inputs
KEY12
PC4~PC7 PCPU ST CMOS General purpose I/O. Register enabled pull-up
PC4/KEY13~
PC7/KEY16 KEY13~
TKM3C1 NSI — Touch key inputs
KEY16
VDD VDD — PWR — Power supply *
Touch Key Circuit PWR and it should be double bonded to
AVDD AVDD — PWR —
VDD*
VSS VSS — PWR — Ground **
Touch Key Circuit PWR and it should be double bonded to
AVSS AVSS — PWR —
VSS**
Note: These are stress ratings only. Stresses exceeding the range specified under "Absolute Maximum
Ratings" may cause substantial damage to the device. Functional operation of this device at other
conditions beyond those listed in the specification is not implied and prolonged exposure to extreme
conditions may affect device reliability.
D.C. Characteristics
Ta=25°C
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
Operating Current
(LIRC, fSYS=fL=fLIRC, fS=fSUB=fLIRC) 3V — 50 100 μA
(BS83B08A-3/BS83B12A-3/ No load, WDT enable, LVR enable
BS83B16A-3/BS83B08A-4/ 5V — 70 150 μA
IDD3 BS83B12A-4/BS83B16A-4)
Operating Current 3V — 10 20 μA
(LIRC, fSYS=fL=fLIRC, fS=fSUB=fLIRC) No load, WDT enable, LVR enable
(BS83B04A-4) 5V — 30 50 μA
IDLE Mode Standby Current 3V No load, system HALT, WDT enable, — 0.9 1.4 mA
ISTB1
(HIRC, fSYS=fH, fS=fSUB=fLIRC) 5V fSYS=12MHz — 1.4 2.1 mA
IDLE Mode Standby Current 3V No load, system HALT, WDT enable, — 40 80 μA
ISTB2
(HIRC, fSYS=off, fS=fSUB=fLIRC) 5V fSYS=12MHz, LVR enable — 50 100 μA
IDLE Mode Standby Current 3V No load, system HALT, WDT enable, — 0.7 1.1 mA
ISTB3
(HIRC, fSYS=fL, fS=fSUB=fLIRC) 5V fSYS=12MHz/64 — 1.4 2.1 mA
IDLE Mode Standby Current 3V No load, system HALT, WDT enable, — 40 80 μA
ISTB4
(HIRC, fSYS=off, fS=fSUB=fLIRC) 5V fSYS=12MHz/64, LVR enable — 50 100 μA
IDLE Mode Standby Current 3V No load, system HALT, WDT enable, — 1.9 4.0 μA
ISTB5
(LIRC, fSYS=fL=fLIRC, fS=fSUB=fLIRC) 5V fSYS=32kHz — 3.3 7.0 μA
IDLE Mode Standby Current 3V No load, system HALT, WDT enable, — 40 80 μA
ISTB6
(LIRC, fSYS=off, fS=fSUB=fLIRC) 5V fSYS=32kHz, LVR enable — 50 100 μA
SLEEP Mode Standby Current 3V No load, system HALT, WDT enable, — 1.3 3.0 μA
ISTB7
(LIRC, fSYS=off, fS=fSUB=fLIRC) 5V fSYS=32kHz — 2.4 5.0 μA
SLEEP Mode Standby Current 3V — 1.5 3.0 μA
ISTB8 No load, WDT enable
(BS83B04A-4 only) 5V — 3.0 5.0 μA
IDLE0 Mode Standby Current 3V — 3.0 5.0 μA
ISTB9 No load, fSUB on
(BS83B04A-4 only) 5V — 5.0 10.0 μA
IDLE1 Mode Standby Current 3V — 360 500 μA
ISTB10 No load, fSUB on, fSYS=fHIRC=8MHz
(BS83B04A-4 only) 5V — 600 800 μA
Input Low Voltage for I/O Ports 5V 0 — 1.5 V
VIL —
or Input Pins — 0 — 0.2VDD V
Input High Voltage for I/O Ports 5V 3.5 — 5.0 V
VIH —
or Input Pins — 0.8VDD — VDD V
Low Voltage Reset Voltage
(BS83B08A-3/BS83B12A-3/ — LVR enable, 2.55V -5% 2.55 +5% V
BS83B16A-3)
VLVR
Low Voltage Reset Voltage
(BS83B04A-4/BS83B08A-4/ — LVR enable, 2.10V -5% 2.10 +5% V
BS83B12A-4/BS83B16A-4)
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
ILVR Low Voltage Reset Current — LVR enable — 62 90 μA
Sink Current for I/O Port 3V 4 8 — mA
VOL=0.1VDD
(BS83B08A-3/BS83B08A-4) 5V 10 20 — mA
A.C. Characteristics
Ta=25°C
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
-2% 8 +2% MHz
3V/5V Ta=25°C
fSYS System Clock (HIRC) -2% 12 +2% MHz
5V Ta=25°C -2% 16 +2% MHz
2.7V~5.5V — — 8 MHz
fTIMER Timer Input Pin Frequency 2.7V~5.5V — — — 12 MHz
4.5V~5.5V — — 16 MHz
fLIRC System Clock (32kHz) 5V Ta=25°C -10% 32 +10% kHz
tINT Interrupt Pulse Width — — 1 — — μs
tLVR Low Voltage Width to Reset — — 60 120 240 μs
tEERD EEPROM Read Time — — 1 2 4 tSYS
tEEWR EEPROM Write Time — — 1 2 4 ms
System reset delay time
(POR reset, LVR hardware reset,
— — 25 50 100 ms
LVR software reset, WDT software reset,
tRSTD reset control register software reset)
System reset delay time
— — 8.3 16.7 33.3 ms
(WDT time-out hardware cold reset)
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
Note: 1. tSYS=1/fSYS
2. To maintain the accuracy of the internal HIRC oscillator frequency, a 0.1μF decoupling capacitor
should be connected between VDD and VSS and located as close to the device as possible.
3. 16MHz can not be used when the supply voltage is below 3.3V.
VDD
tPOR RRPOR
VPOR
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 range of devices take advantage of the usual features found
within RISC microcontrollers providing increased speed of operation and Periodic 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 cycle, with the exception of branch
or call instructions. 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
control system with maximum reliability and flexibility. This makes these devices suitable for low-
cost, high-volume production for controller applications.
fSYS
(System Clock)
Phase Clock T1
Phase Clock T2
Phase Clock T3
Phase Clock T4
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.
Instruction Fetching
Program Counter
During 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 Counter
Device
Program CounterHigh Byte PCL Register
BS83B04A-4 PC10~PC8
BS83B08A-3/BS83B08A-4 PC10~PC8
PCL7~PCL0
BS83B12A-3/BS83B12A-4 PC10~PC8
BS83B16A-3/BS83B16A-4 PC10~PC8
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.
Stack
This is a special part of the memory which is used to save the contents of the Program Counter
only. The stack is 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. If the stack is overflow, the first Program
Counter save in the stack will be lost.
Program Counter
Structure
The Program Memory has a capacity of 2K×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.
Special Vectors
Within 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.
Program Memory Structure
Look-up Table
Any 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 register, 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 “TABRDC [m]” or “TABRDL [m]” instructions, 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. Any unused bits in this
transferred higher order byte will be read as “0”.
The accompanying diagram illustrates the addressing data flow of the look-up table.
Program Memory
Last Page or
Address
TBHP Register
Data
16 bits
TBLP Register
In Circuit Programming
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. 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 Write Pins MCU Programming Pins Function
ICPDA PA0 Serial Address and data -- read/write
ICPCK PA2 Programming Serial Clock
VDD VDD Power Supply (5.0V)
VSS VSS Ground
During the programming process, the user must there take care to ensure that no other outputs are
connected to these two pins.
The Program Memory and EEPROM data memory can both 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 are beyond the scope of this document and will
be supplied in supplementary literature.
During the programming process the PA0 and PA2 I/O pins for data and clock programming
purposes. The user must there take care to ensure that no other outputs are connected to these two
pins.
Writer_VDD VDD
ICPDA PA0
ICPCK PA2
Writer_VSS VSS
* *
To other Circuit
Note: * may be resistor or capacitor. The resistance of * must be greater than 1k or the capacitance
of * must be less than 1nF.
Structure
Divided into two sections, the first of these is an area of RAM, known as the Special Function Data
Memory. Here are located registers which 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.
The overall Data Memory is subdivided into two banks for the devices. The Special Purpose Data
Memory registers are accessible in all banks, with the exception of the EEC register at address 40H,
which is only accessible in Bank 1. Switching between the different Data Memory banks is achieved
by setting the Bank Pointer to the correct value. The start address of the Data Memory for all devices
is the address 00H.
Device Capacity Bank 0 Bank 1
BS83B04A-4 128×8 60H~FFH E0H~FFH
BS83B08A-3/BS83B08A-4 160×8 60H~FFH —
BS83B12A-3/BS83B12A-4 288×8 60H~FFH 80H~FFH
BS83B16A-3/BS83B16A-4 288×8 60H~FFH 80H~FFH
General Purpose Data Memory
General Purpose Data Memory
Bank Pointer – BP
For this device, the Data Memory is divided into two banks, Bank0 and Bank1. Selecting the
required Data Memory area is achieved using the Bank Pointer. Bit 0 of the Bank Pointer is used to
select Data Memory Banks 0~1.
The Data Memory is initialised to Bank 0 after a reset, except for a WDT time-out reset in the Power
Down Mode, in which case, the Data Memory bank remains unaffected. It should be noted that the
Special Function Data Memory is not affected by the bank selection, which means that the Special
Function Registers can be accessed from within any bank. Directly addressing the Data Memory
will always result in Bank 0 being accessed irrespective of the value of the Bank Pointer. Accessing
data from Bank1 must be implemented using Indirect Addressing.
BP Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — — DMBP0
R/W — — — — — — — R/W
POR — — — — — — — 0
Accumulator – ACC
The 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.
STATUS Register
Bit 7 6 5 4 3 2 1 0
Name — — TO PDF OV Z AC C
R/W — — R R R/W R/W R/W R/W
POR — — 0 0 × × × ×
"x" unknown
Bit 7~6 Unimplemented, read as "0"
Bit 5 TO: Watchdog Time-Out flag
0: After power up or executing the "CLR WDT" or "HALT" instruction
1: A watchdog time-out occurred.
Bit 4 PDF: Power down flag
0: After power up or executing the "CLR WDT" instruction
1: By executing the "HALT" instruction
Bit 3 OV: Overflow flag
0: No overflow
1: An operation results in a carry into the highest-order bit but not a carry out of the
highest-order bit or vice versa.
Bit 2 Z: Zero flag
0: The result of an arithmetic or logical operation is not zero
1: The result of an arithmetic or logical operation is zero
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
Bit 0 C: Carry flag
0: No carry-out
1: An operation results in a carry during an addition operation or if a borrow does
not take place during a subtraction operation
C is also affected by a rotate through carry instruction.
EEPROM Registers
Three 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 Bank 0, they can be directly accessed in the same way as any other
Special Function Register. The EEC register however, being located in Bank1, cannot be directly
addressed directly and can only be read from or written to indirectly using the MP1 Memory Pointer
and Indirect Addressing Register, IAR1. Because the EEC control register is located at address 40H
in Bank 1, the MP1 Memory Pointer must first be set to the value 40H and the Bank Pointer register,
BP, set to the value, 01H, before any operations on the EEC register are executed.
Register Bit
Device
Name 7 6 5 4 3 2 1 0
BS83B04A-4 EEA — — — D4 D3 D2 D1 D0
Others EEA — — D5 D4 D3 D2 D1 D0
EED D7 D6 D5 D4 D3 D2 D1 D0
All devices
EEC — — — — WREN WR RDEN RD
EEPROM Control Registers List
EED Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0 0
EEC Register
Bit 7 6 5 4 3 2 1 0
Name — — — — WREN WR RDEN RD
R/W — — — — R/W R/W R/W R/W
POR — — — — 0 0 0 0
Note: The WREN, WR, RDEN and RD can not be set to “1” at the same time in one instruction.
The WR and RD can not be set to “1” at the same time.
Write Protection
Protection 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 Bank Pointer, BP, will be reset to zero, which means that Data
Memory Bank 0 will be selected. As the EEPROM control register is located in Bank 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 Interrupt
The 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. When an
EEPROM write cycle ends, the DEF request flag will be set. If the global, EEPROM is enabled and
the stack is not full, a jump to the associated Interrupt vector will take place. When the interrupt is
serviced, the EEPROM interrupt flag will automatically reset. More details can be obtained in the
Interrupt section.
Programming Considerations
Care must be taken that data is not inadvertently written to the EEPROM. Protection can be Periodic
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. 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.
Programming Examples
Oscillators
Various 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 registers.
Oscillator Overview
In addition to being the source of the main system clock the oscillators also provide clock sources
for the Watchdog Timer and Time Base Interrupts. Fully integrated internal oscillators, requiring no
external components, are provided to form a wide range of both fast and slow system oscillators.
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.
Device Type Name Freq.
BS83B04A-4 Internal High Speed RC HIRC 8MHz
Others Internal High Speed RC HIRC 8/12/16MHz
All devices Internal Low Speed RC LIRC 32kHz
Oscillator Types
System Clock Configurations
System Clocks
The main system clock, can come from either a high frequency, fH, or low frequency, fSUB, source,
and is selected using the HLCLK bit and CKS2~CKS0 bits in the SMOD register. Both the high and
low speed system clocks are sourced from internal RC oscillators.
Note: When the system clock source fSYS is switched to fSUB from fH, the high speed oscillation will
stop to conserve the power. Thus there is no fH~fH/64 for peripheral circuit to use.
Operating Description
Mode CPU fSYS fSUB fS
NORMAL mode On fH~fH/64 On On
SLOW mode On fSUB On On
ILDE0 mode Off Off On On
IDLE1 mode Off On On On
SLEEP mode Off Off On On
NORMAL Mode
As the name suggests 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 the high speed oscillator. This
mode operates allowing the microcontroller to operate normally with a clock source will come from
the high speed oscillator, HIRC. 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 and HLCLK bits in the
SMOD register. Although a high speed oscillator is used, running the microcontroller at a divided
clock ratio reduces the operating current.
SLOW Mode
This 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. Running the microcontroller in this mode
allows it to run with much lower operating currents. In the SLOW Mode, the fH is off.
SLEEP Mode
The SLEEP Mode is entered when an HALT instruction is executed and when the IDLEN bit in the
SMOD register is low. In the SLEEP mode the CPU will be stopped. However the fSUB clocks will
continue to run the Watchdog Timer will continue to operate.
IDLE0 Mode
The IDLE0 Mode is entered when a HALT instruction is executed and when the IDLEN bit in the
SMOD register is high and the FSYSON bit in the CTRL register is low. In the IDLE0 Mode the
system oscillator will be stop and will therefore be inhibited from driving the CPU.
IDLE1 Mode
The IDLE1 Mode is entered when a HALT instruction is executed and when the IDLEN bit in
the SMOD register is high and the FSYSON bit in the CTRL register is high. In the IDLE1 Mode
the system oscillator will be inhibited from driving the CPU but may continue to provide a clock
source to keep some peripheral functions operational. In the IDLE1 Mode, the system oscillator will
continue to run, and this system oscillator may be the high speed or low speed system oscillator.
Control Register
The SMOD register is used to control the internal clocks within the device.
SMOD Register
Bit 7 6 5 4 3 2 1 0
Name CKS2 CKS1 CKS0 — LTO HTO IDLEN HLCLK
R/W R/W R/W R/W — R R R/W R/W
POR 0 0 0 — 0 0 1 1
Bit 7~5 CKS2~CKS0: The system clock selection when HLCLK is “0”
000: fSUB (fLIRC)
001: fSUB (fLIRC)
010: fH/64
011: fH/32
100: fH/16
101: fH/8
110: fH/4
111: fH/2
These three bits are used to select which clock is used as the system clock source. In
addition to the system clock source, which can be LIRC, a divided version of the high
speed system oscillator can also be chosen as the system clock source.
Bit 4 Unimplemented, read as “0”
Bit 3 LTO: LIRC System OSC SST ready flag
0: Not ready
1: Ready
This is the low speed system oscillator SST ready flag which indicates when the low
speed system oscillator is stable after power on reset or a wake-up has occurred. The
flag will change to a high level after 1~2 cycles.
Bit 2 HTO: HIRC System OSC SST ready flag
0: Not ready
1: Ready
This is the high speed system oscillator SST ready flag which indicates when the high
speed system oscillator is stable after a wake-up has occurred. This flag is cleared to
“0” by hardware when the device is powered on and then changes to a high level after
the high speed system oscillator is stable. Therefore this flag will always be read as “1”
by the application program after device power-on. The flag will be low when in the
SLEEP or IDLE0 Mode but after power on reset or a wake-up has occurred, the flag
will change to a high level after 15~16 clock cycles if the HIRC oscillator is used.
Bit 1 IDLEN: IDLE Mode Control
0: Disable
1: Enable
This is the IDLE Mode Control bit and determines what happens when the HALT
instruction is executed. If this bit is high, when a HALT instruction is executed the
device will enter the IDLE Mode. In the IDLE1 Mode the CPU will stop running
but the system clock will continue to keep the peripheral functions operational, if
FSYSON bit is high. If FSYSON bit is low, the CPU and the system clock will all stop
in IDLE0 mode. If the bit is low the device will enter the SLEEP Mode when a HALT
instruction is executed.
Bit 0 HLCLK: System Clock Selection
0: fH/2~fH/64 or fSUB
1: fH
This bit is used to select if the fH clock or the fH/2~fH/64 or fSUB clock is used as
the system clock. When the bit is high the fH clock will be selected and if low the
fH/2~fH/64 or fSUB clock will be selected. When system clock switches from the fH clock
to the fSUB clock and the fH clock will be automatically switched off to conserve power.
NORMAL
fSYS=fH~fH/64
fH on
CPU run
fSYS on
fSUB on
WDT on
SLOW
SLEEP fSYS=fL
HALT instruction executed
fL on
fSYS off
CPU run
CPU stop
fSYS on
IDLEN=0
fSUB on
fSUB on
fH off
fS on
fS on
WDT on
WDT on
IDLE1 IDLE0
HALT instruction executed HALT instruction executed
CPU stop CPU stop
IDLEN=1 IDLEN=1
FSYSON=1 FSYSON=0
fSYS on fSYS off
fSUB on fSUB on
fS on fS on
WDT on WDT on
Wake-up
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
If the device is woken up by a WDT overflow, a Watchdog Timer reset will be initiated. Although
both of these wake-up methods will initiate a reset operation, the actual source of the wake-up can
be determined by examining the TO and PDF flags. The PDF flag is cleared by a system power-up or
executing the clear Watchdog Timer instructions and is set when executing the “HALT” instruction.
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.
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 Port 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 the device 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.
Wake-up Time Wake-up Time Wake-up Time
System Oscillator
(SLEEP Mode) (IDLE0 Mode) (IDLE1 Mode)
HIRC 15~16 HIRC cycles 1~2 HIRC cycles
LIRC 1~2 LIRC cycles 1~2 LIRC cycles
Wake-Up Time
Programming Considerations
The high speed and low speed oscillators both use the same SST counter. For example, if the system
is woken up from the SLEEP Mode the HIRC oscillator needs to start-up from an off state.
If the device is woken up from the SLEEP Mode to the NORMAL Mode, the high speed system
oscillator needs an SST period. The device will execute the first instruction after HTO is high.
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.
WDTC Register
Bit 7 6 5 4 3 2 1 0
Name WE4 WE3 WE2 WE1 WE0 WS2 WS1 WS0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 1 0 1 0 0 1 1
Watchdog Timer
Reset Functions
There are five ways in which a microcontroller reset can occur, through events occurring internally.
Power-on Reset
The 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
tRSTD
SST Time-out
Low Voltage Reset Timing Chart
WDT Time-out
tRSTD + tSST
Internal Reset
WDT Time-out
tSST
Internal Reset
Note: The tSST is 15~16 clock cycles if the system clock source is provided by the HIRC.
The tSST is 1~2 clock for the LIRC.
WDT Time-out Reset during SLEEP or IDLE Timing Chart
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.
BS83B04A-4 Register
WDT Overflow WDT Overflow
Register LVR&power on
(Normal Mode) (HALT Mode)
IAR0 ---- ---- ---- ---- ---- ----
MP0 xxxx xxxx xxxx xxxx uuuu uuuu
IAR1 ---- ---- ---- ---- ---- ----
MP1 xxxx xxxx xxxx xxxx uuuu uuuu
BP ---- ---0 ---- ---0 ---- ---u
ACC xxxx xxxx uuuu uuuu uuuu uuuu
PCL 0000 0000 0000 0000 0000 0000
BS83B08A-3/BS83B08A-4 Register
WDT Overflow WDT Overflow
Register LVR&power on
(Normal Mode) (HALT Mode)
IAR0 ---- ---- ---- ---- ---- ----
MP0 xxxx xxxx xxxx xxxx uuuu uuuu
IAR1 ---- ---- ---- ---- ---- ----
MP1 xxxx xxxx xxxx xxxx uuuu uuuu
BP ---- ---0 ---- ---0 ---- ---u
ACC xxxx xxxx uuuu uuuu uuuu uuuu
PCL 0000 0000 0000 0000 0000 0000
TBLP xxxx xxxx uuuu uuuu uuuu uuuu
TBLH xxxx xxxx uuuu uuuu uuuu uuuu
TBHP ---- xxxx ---- uuuu ---- uuuu
STATUS --00 xxxx --1u uuuu - - 11 u u u u
SMOD 0 0 0 0 0 0 11 0 0 0 0 0 0 11 uuuu uuuu
CTRL 0-00 -x00 0-00 -x00 u-uu -uuu
INTEG ---- --00 ---- --00 ---- --uu
INTC0 -000 0000 -000 0000 -uuu uuuu
INTC1 -000 -000 -000 -000 -uuu -uuu
LVRC 0101 0101 0101 0101 uuuu uuuu
PA 1 - - 1 1111 1 - - 1 1111 u--u uuuu
PAC 1 - - 1 1111 1 - - 1 1111 u--u uuuu
PAPU 0--0 0000 0--0 0000 u--u uuuu
PAWU 0--0 0000 0--0 0000 u--u uuuu
WDTC 0 1 0 1 0 0 11 0 1 0 1 0 0 11 uuuu uuuu
TBC --00 ---- --00 ---- --uu ----
TMR 0000 0000 0000 0000 uuuu uuuu
TMRC --00 -000 --00 -000 --uu -uuu
EEA - - 11 1111 - - 11 1111 --uu uuuu
EED 0000 0000 0000 0000 uuuu uuuu
PB 1111 1111 1111 1111 uuuu uuuu
PBC 1111 1111 1111 1111 uuuu uuuu
PBPU 0000 0000 0000 0000 uuuu uuuu
I2CTOC 0000 0000 0000 0000 uuuu uuuu
SIMC0 0000 -00- 0000 -00- uuuu -uu-
SIMC1 0000 -000 0000 -000 uuuu -uuu
SIMD 0000 0000 0000 0000 uuuu uuuu
SIMC2 - - 11 1111 - - 11 1111 --uu uuuu
SIMA 0000 0000 0000 0000 uuuu uuuu
TKTMR 0000 0000 0000 0000 uuuu uuuu
TKC0 -000 0000 -000 0000 -uuu uuuu
TK16DL 0000 0000 0000 0000 uuuu uuuu
TK16DH 0000 0000 0000 0000 uuuu uuuu
TKC1 ---- --11 ---- --11 ---- --uu
TKM016DL 0000 0000 0000 0000 uuuu uuuu
TKM016DH 0000 0000 0000 0000 uuuu uuuu
TKM0ROL 0000 0000 0000 0000 uuuu uuuu
TKM0ROH ---- --00 ---- --00 ---- --uu
TKM0C0 0000 0000 0000 0000 uuuu uuuu
BS83B12A-3/BS83B12A-4 Register
WDT Overflow WDT Overflow
Register LVR&power on
(Normal Mode) (HALT Mode)
IAR0 ---- ---- ---- ---- ---- ----
MP0 xxxx xxxx xxxx xxxx uuuu uuuu
IAR1 ---- ---- ---- ---- ---- ----
MP1 xxxx xxxx xxxx xxxx uuuu uuuu
BP ---- ---0 ---- ---0 ---- ---u
ACC xxxx xxxx uuuu uuuu uuuu uuuu
PCL 0000 0000 0000 0000 0000 0000
TBLP xxxx xxxx uuuu uuuu uuuu uuuu
TBLH xxxx xxxx uuuu uuuu uuuu uuuu
TBHP ---- xxxx ---- uuuu ---- uuuu
STATUS --00 xxxx --1u uuuu - - 11 u u u u
SMOD 0 0 0 0 0 0 11 0 0 0 0 0 0 11 uuuu uuuu
CTRL 0-00 -x00 0-00 -x00 u-uu -uuu
INTEG ---- --00 ---- --00 ---- --uu
INTC0 -000 0000 -000 0000 -uuu uuuu
INTC1 -000 -000 -000 -000 -uuu -uuu
LVRC 0101 0101 0101 0101 uuuu uuuu
PA 1 - - 1 1111 1 - - 1 1111 u--u uuuu
PAC 1 - - 1 1111 1 - - 1 1111 u--u uuuu
PAPU 0--0 0000 0--0 0000 u--u uuuu
PAWU 0--0 0000 0--0 0000 u--u uuuu
WDTC 0 1 0 1 0 0 11 0 1 0 1 0 0 11 uuuu uuuu
TBC --00 ---- --00 ---- --uu ----
TMR 0000 0000 0000 0000 uuuu uuuu
TMRC --00 -000 --00 -000 --uu -uuu
EEA - - 11 1111 - - 11 1111 --uu uuuu
EED 0000 0000 0000 0000 uuuu uuuu
PB 1111 1111 1111 1111 uuuu uuuu
PBC 1111 1111 1111 1111 uuuu uuuu
PBPU 0000 0000 0000 0000 uuuu uuuu
I2CTOC 0000 0000 0000 0000 uuuu uuuu
SIMC0 0000 -00- 0000 -00- uuuu -uu-
BS83B16A-3/BS83B16A-4 Register
WDT Overflow WDT Overflow
Register LVR&power on
(Normal Mode) (HALT Mode)
IAR0 ---- ---- ---- ---- ---- ----
MP0 xxxx xxxx xxxx xxxx uuuu uuuu
IAR1 ---- ---- ---- ---- ---- ----
MP1 xxxx xxxx xxxx xxxx uuuu uuuu
BP ---- ---0 ---- ---0 ---- ---u
ACC xxxx xxxx uuuu uuuu uuuu uuuu
PCL 0000 0000 0000 0000 0000 0000
TBLP xxxx xxxx uuuu uuuu uuuu uuuu
TBLH xxxx xxxx uuuu uuuu uuuu uuuu
TBHP ---- xxxx ---- uuuu ---- uuuu
STATUS --00 xxxx --1u uuuu - - 11 u u u u
SMOD 0 0 0 0 0 0 11 0 0 0 0 0 0 11 uuuu uuuu
CTRL 0-00 -x00 0-00 -x00 u-uu -uuu
INTEG ---- --00 ---- --00 ---- --uu
INTC0 -000 0000 -000 0000 -uuu uuuu
INTC1 -000 -000 -000 -000 -uuu -uuu
LVRC 0101 0101 0101 0101 uuuu uuuu
PA 1 - - 1 1111 1 - - 1 1111 u--u uuuu
PAC 1 - - 1 1111 1 - - 1 1111 u--u uuuu
PAPU 0--0 0000 0--0 0000 u--u uuuu
PAWU 0--0 0000 0--0 0000 u--u uuuu
WDTC 0 1 0 1 0 0 11 0 1 0 1 0 0 11 uuuu uuuu
TBC --00 ---- --00 ---- --uu ----
TMR 0000 0000 0000 0000 uuuu uuuu
TMRC --00 -000 --00 -000 --uu -uuu
EEA - - 11 1111 - - 11 1111 --uu uuuu
EED 0000 0000 0000 0000 uuuu uuuu
PB 1111 1111 1111 1111 uuuu uuuu
PBC 1111 1111 1111 1111 uuuu uuuu
PBPU 0000 0000 0000 0000 uuuu uuuu
I2CTOC 0000 0000 0000 0000 uuuu uuuu
SIMC0 0000 -00- 0000 -00- uuuu -uu-
SIMC1 0000 -000 0000 -000 uuuu -uuu
SIMD 0000 0000 0000 0000 uuuu uuuu
SIMC2 - - 11 1111 - - 11 1111 --uu uuuu
SIMA 0000 0000 0000 0000 uuuu uuuu
PC 1111 1111 1111 1111 uuuu uuuu
PCC 1111 1111 1111 1111 uuuu uuuu
PCPU 0000 0000 0000 0000 uuuu uuuu
TKTMR 0000 0000 0000 0000 uuuu uuuu
TKC0 -000 0000 -000 0000 -uuu uuuu
TK16DL 0000 0000 0000 0000 uuuu uuuu
TK16DH 0000 0000 0000 0000 uuuu uuuu
TKC1 ---- --11 ---- --11 ---- --uu
TKM016DL 0000 0000 0000 0000 uuuu uuuu
TKM016DH 0000 0000 0000 0000 uuuu uuuu
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.
The device provides bidirectional input/output lines labeled with port names PA~PC. 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 Bit
Name 7 6 5 4 3 2 1 0
PAWU D7 D6 D5 D4 D3 D2 D1 D0
PAPU D7 D6 D5 D4 D3 D2 D1 D0
PA D7 D6 D5 D4 D3 D2 D1 D0
PAC D7 D6 D5 D4 D3 D2 D1 D0
• BS83B08A-3/BS83B08A-4
Register Bit
Name 7 6 5 4 3 2 1 0
PAWU D7 — — D4 D3 D2 D1 D0
PAPU D7 — — D4 D3 D2 D1 D0
PA D7 — — D4 D3 D2 D1 D0
PAC D7 — — D4 D3 D2 D1 D0
PBPU D7 D6 D5 D4 D3 D2 D1 D0
PB D7 D6 D5 D4 D3 D2 D1 D0
PBC D7 D6 D5 D4 D3 D2 D1 D0
• BS83B12A-3/BS83B12A-4
Register Bit
Name 7 6 5 4 3 2 1 0
PAWU D7 — — D4 D3 D2 D1 D0
PAPU D7 — — D4 D3 D2 D1 D0
PA D7 — — D4 D3 D2 D1 D0
PAC D7 — — D4 D3 D2 D1 D0
PBPU D7 D6 D5 D4 D3 D2 D1 D0
PB D7 D6 D5 D4 D3 D2 D1 D0
PBC D7 D6 D5 D4 D3 D2 D1 D0
PCPU — — — — D3 D2 D1 D0
PC — — — — D3 D2 D1 D0
PCC — — — — D3 D2 D1 D0
• BS83B16A-3/BS83B16A-4
Register Bit
Name 7 6 5 4 3 2 1 0
PAWU D7 — — D4 D3 D2 D1 D0
PAPU D7 — — D4 D3 D2 D1 D0
PA D7 — — D4 D3 D2 D1 D0
PAC D7 — — D4 D3 D2 D1 D0
PBPU D7 D6 D5 D4 D3 D2 D1 D0
PB D7 D6 D5 D4 D3 D2 D1 D0
PBC D7 D6 D5 D4 D3 D2 D1 D0
PCPU D7 D6 D5 D4 D3 D2 D1 D0
PC D7 D6 D5 D4 D3 D2 D1 D0
PCC D7 D6 D5 D4 D3 D2 D1 D0
Pull-high Resistors
Many 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 an input have the capability of being connected to an internal pull-high resistor. These
pull-high resistors are selected using registers PAPU~PCPU, and are implemented using weak
PMOS transistors.
PBPU Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0 0
Port A Wake-up
The 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.
PBC Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 1 1 1 1 1 1 1 1
Pin-shared Functions
The 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 some pins, the
chosen function of the multi-function I/O pins is set by application program control.
Programming Considerations
Within 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, PAC~PCC, 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, PA~PC, 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.
Port A has the additional capability of providing wake-up functions. 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 Port A can be setup to have this
function.
Timer/Event Counter
The provision of timers form an important part of any microcontroller, giving the designer a means
of carrying out time related functions. The devices contain one 8-bit. The provision of an internal
prescaler to the clock circuitry on gives added range to the timer.
There are two types of registers related to the Timer/Event Counters. The first is the register that
contains the actual value of the timer and into which an initial value can be preloaded. Reading from
this register retrieves the contents of the Timer/Event Counter. The second type of associated register
is the Timer Control Register which defines the timer options.
Timer/Event Counter
TMRC Register
Bit 7 6 5 4 3 2 1 0
Name — — TS TON — TPSC2 TPSC1 TPSC0
R/W — — R/W R/W — R/W R/W R/W
POR — — 0 0 — 0 0 0
Timer Operation
The Timer/Event Counter is utilised to measure fixed time intervals, providing an internal interrupt
signal each time the Timer/Event Counter overflows. The timer input clock source is either fSYS
or fSUB, however, this timer clock source is further divided by a prescaler, the value of which is
determined by the bits TPSC2~TPSC0 in the Timer Control Register. The timer-on bit, TON must
be set high to enable the timer to run. Each time an internal clock transition occurs, the timer
increments by one; when the timer is full and overflows, an interrupt signal is generated and the
timer will reload the value already loaded into the preload register and continue counting. A timer
overflow condition and corresponding internal interrupt is one of the wake-up sources, however, the
internal interrupts can be disabled by ensuring that the timer enable bit in the interrupt register is
reset to zero.
Prescaler
Bits TPSC0~TPSC2 of the TMRC register can be used to define a division ratio for the internal
clock source of the Timer/Event Counter enabling longer time out periods to be setup.
Programming Considerations
When the Timer/Event Counter is read, or if data is written to the preload register, the clock is
inhibited to avoid errors, however as this may result in a counting error, this should be taken into
account by the programmer. Care must be taken to ensure that the timer is properly initialised before
using it for the first time. The associated timer enable bits in the interrupt control register must be
properly set otherwise the internal interrupt associated with the timer will remain inactive. It is also
important to ensure that an initial value is first loaded into the timer registers before the timer is
switched on; this is because after power-on the initial values of the timer registers are unknown.
After the timer has been initialized the timer can be turned on and off by controlling the enable bit
in the timer control register. When the Timer/Event Counter overflows, its corresponding interrupt
request flag in the interrupt control register will be set. If the Timer/Event Counter interrupt is
enabled this will in turn generate an interrupt signal. However irrespective of whether the interrupts
are enabled or not, a Timer/Event Counter overflow will also generate a wake-up signal if the device
is in a Power-down condition. To prevent such a wake-up from occurring, the timer interrupt request
flag should first be set high before issuing the HALT instruction to enter the Idle/Sleep Mode.
Register Bit
Device
Name 7 6 5 4 3 2 1 0
TKC0 — TKRCOV TKST TKCFOV TK16OV — TK16S1 TK16S0
BS83B04A-4
TKM0C1 M0TSS — M0ROEN M0KOEN M0K4IO M0K3IO M0K2IO M0K1IO
TKC0 — TKRCOV TKST TKCFOV TK16OV TSCS TK16S1 TK16S0
Others
TKMnC1 MnTSS — MnROEN MnKOEN MnK4IO MnK3IO MnK2IO MnK1IO
TKTMR D7 D6 D5 D4 D3 D2 D1 D0
TK16DL D7 D6 D5 D4 D3 D2 D1 D0
TK16DH D15 D14 D13 D12 D11 D10 D9 D8
TKC1 — — — — — — TKFS1 TKFS0
All devices TKMn16DL D7 D6 D5 D4 D3 D2 D1 D0
TKMn16DH D15 D14 D13 D12 D11 D10 D9 D8
TKMnROL D7 D6 D5 D4 D3 D2 D1 D0
TKMnROH — — — — — — D9 D8
TKMnC0 MnMXS1 MnMXS0 MnDFEN MnFILEN MnSOFC MnSOF2 MnSOF1 MnSOF0
Touch Key Module (n=0~3)
TKTMR Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0 0
TKC1 Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — TKFS1 TKFS0
R/W — — — — — — R/W R/W
POR — — — — — — 1 1
TK16DL Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R R R R R R R R
POR 0 0 0 0 0 0 0 0
Bit 7~0 Touch key module 16-bit counter low byte contents
TK16DH Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R R R R R R R R
POR 0 0 0 0 0 0 0 0
Bit 7~0 Touch key module 16-bit counter high byte contents
TKMn16DL Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R R R R R R R R
POR 0 0 0 0 0 0 0 0
TKMn16DH Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R R R R R R R R
POR 0 0 0 0 0 0 0 0
TKMnROL Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0 0
TKMnROH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
TKMnC0 Register
Bit 7 6 5 4 3 2 1 0
Name MnMXS1 MnMXS0 MnDFEN MnFILEN MnSOFC MnSOF2 MnSOF1 MnSOF0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 0 0 0 0 0 0 0
M0
M0K3IO
PA3/Key3
0 I/O
1 Touch key
M0
M0K2IO
PA1/Key2
0 I/O
1 Touch key
M0
M0K1IO
PA5/Key1
0 I/O
1 Touch key
M0 M1 M2 M3
MnK3IO
PB2/Key3 PB6/Key7 PC2/Key11 PC6/Key15
0 I/O
1 Touch key
M0 M1 M2 M3
MnK2IO
PB1/Key2 PB5/Key6 PC1/Key10 PC5/Key14
0 I/O
1 Touch key
M0 M1 M2 M3
MnK1IO
PB0/Key1 PB4/Key5 PC0/Key9 PC4/Key13
0 I/O
1 Touch key
KEY
KEY 1
OSC
KEY
KEY 2
OSC
16-bit C/F
MUX. Filter Multi-frequency Overflow
counter
KEY
KEY 3
OSC
KEY
KEY 4
OSC
TK16S1~TK16S0
MnTSS
Ref OSC
8-bit time slot 5-bit time slot
MUX. Overflow
timer counter counter
fSYS/4
Note: Each touch key module contains the content in the dash line.
Touch Switch Module Block Diagram
The touch key sense oscilltor and reference oscillator timing diagram is shown in the following
figure:
TKST
KEY OSC EN
REF OSC EN
....... Hardware set to “0”
KEY OSC CLK
.......
fREF
TSTMR overflow * 32
ENCK
fTMCK (DFEN=0) .......
Touch Key or I/O Function Select
Programming Considerations
After the relevant registers are setup, the touch key detection process is initiated the changing the
TKST bit from low to high. This will enable and synchronise all relevant oscillators. The TKRCOV
flag, which is the time slot counter flag will go high and remain high until the counter overflows.
When this happens an interrupt signal will be generated.
When the external touch key size and layout are defined, their related capacitances will then
determine the sensor oscillator frequency.
SPI Interface
The SPI interface is often used to communicate with external peripheral devices such as sensors,
Flash or EEPROM memory devices etc. Originally developed by Motorola, the four line SPI
interface is a synchronous serial data interface that has a relatively simple communication protocol
simplifying the programming requirements when communicating with external hardware devices.
The communication is full duplex and operates as a slave/master type, where the device can be
either master or slave. Although the SPI interface specification can control multiple slave devices
from a single master, but this device provided only one SCS pin. If the master needs to control
multiple slave devices from a single master, the master can use I/O pin to select the slave devices.
SPI Block Diagram
SPI Registers
There are three internal registers which control the overall operation of the SPI interface. These are
the SIMD data register and two registers SIMC0 and SIMC2. Note that the SIMC1 register is only
used by the I2C interface.
Register Bit
Name 7 6 5 4 3 2 1 0
SIMC0 SIM2 SIM1 SIM0 — — — SIMEN —
SIMD D7 D6 D5 D4 D3 D2 D1 D0
SIMC2 — — CKPOLB CKEG MLS CSEN WCOL TRF
SIM Registers List
The SIMD register is used to store the data being transmitted and received. The same register is used
by both the SPI and I2C functions. Before the device writes data to the SPI bus, the actual data to
be transmitted must be placed in the SIMD register. After the data is received from the SPI bus, the
device can read it from the SIMD register. Any transmission or reception of data from the SPI bus
must be made via the SIMD register.
• SIMD Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR x x x x x x x x
“x” unknown
There are also two control registers for the SPI interface, SIMC0 and SIMC2. Note that the SIMC2
register also has the name SIMA which is used by the I2C function. The SIMC1 register is not used
by the SPI function, only by the I2C function. Register SIMC0 is used to control the enable/disable
function and to set the data transmission clock frequency. Although not connected with the SPI
function, the SIMC0 register is also used to control the Peripheral Clock Prescaler. Register SIMC2
is used for other control functions such as LSB/MSB selection, write collision flag etc.
• SIMC0 Register
Bit 7 6 5 4 3 2 1 0
Name SIM2 SIM1 SIM0 — — — SIMEN —
R/W R/W R/W R/W — — — R/W —
POR 1 1 1 — — — 0 —
• SIMC2 Register
Bit 7 6 5 4 3 2 1 0
Name — — CKPOLB CKEG MLS CSEN WCOL TRF
R/W — — R/W R/W R/W R/W R/W R/W
POR — — 0 0 0 0 0 0
SPI Communication
After the SPI interface is enabled by setting the SIMEN bit high, then in the Master Mode, when
data is written to the SIMD register, transmission/reception will begin simultaneously. When the
data transfer is complete, the TRF flag will be set automatically, but must be cleared using the
application program. In the Slave Mode, when the clock signal from the master has been received,
any data in the SIMD register will be transmitted and any data on the SDI pin will be shifted into
the SIMD register. The master should output an SCS signal to enable the slave device before a
clock signal is provided. The slave data to be transferred should be well prepared at the appropriate
moment relative to the SCS signal depending upon the configurations of the CKPOLB bit and CKEG
bit. The accompanying timing diagram shows the relationship between the slave data and SCS signal
for various configurations of the CKPOLB and CKEG bits.
The SPI will continue to function even in the IDLE Mode.
SPI Master Mode Timing
SPI Slave Mode Timing – CKEG=0
SPI Slave Mode Timing – CKEG=1
I2C Interface
The I 2C 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.
S T A R T s ig n a l
fro m M a s te r
S e n d s la v e a d d r e s s
a n d R /W b it fr o m M a s te r
A c k n o w le d g e
fr o m s la v e
S e n d d a ta b y te
fro m M a s te r
A c k n o w le d g e
fr o m s la v e
S T O P s ig n a l
fro m M a s te r
Register Bit
Name 7 6 5 4 3 2 1 0
SIMC0 SIM2 SIM1 SIM0 — — — SIMEN —
SIMC1 HCF HAAS HBB HTX TXAK SRW RNIC RXAK
SIMD D7 D6 D5 D4 D3 D2 D1 D0
SIMA A6 A5 A4 A3 A2 A1 A0 —
I2CTOC I2CTOEN I2CTOF I2CTOS5 I2CTOS4 I2CTOS3 I2CTOS2 I2CTOS1 I2CTOS0
I2C Registers List
• SIMC0 Register
Bit 7 6 5 4 3 2 1 0
Name SIM2 SIM1 SIM0 — — — SIMEN —
R/W R/W R/W R/W — — — R/W —
POR 1 1 1 — — — 0 —
• SIMC1 Register
Bit 7 6 5 4 3 2 1 0
Name HCF HAAS HBB HTX TXAK SRW RNIC RXAK
R/W R R R R/W R/W R R/W R
POR 1 0 0 0 0 0 0 1
0: Disable
1: Enable
Bit 6 HAAS: Time-out flag
0: No time-out
1: Time-out occurred
Bit 5~0 I2CTOS5~I2CTOS0: Time-out Definition
I2C time-out clock source is fSUB/32
I2C time-out time is given by: ([I2CTOS5 : I2CTOS0]+1) × (32/fSUB)
• SIMA Register
Bit 7 6 5 4 3 2 1 0
Name A6 A5 A4 A3 A2 A1 A0 —
R/W R/W R/W R/W R/W R/W R/W R/W —
POR x x x x x x x —
“x” unknown
Bit 7~1 A6~A0: I2C slave address
A6~A0 is the I2C slave address bit 6~bit 0.
The SIMA register is also used by the SPI interface but has the name SIMC2. The
SIMA register is the location where the 7-bit slave address of the slave device is
stored. Bits 7~1 of the SIMA register define the device slave address. Bit 0 is not
defined.
When a master device, which is connected to the I2C bus, sends out an address, which
matches the slave address in the SIMA register, the slave device will be selected. Note
that the SIMA register is the same register address as SIMC2 which is used by the SPI
interface.
Bit 0 Unimplemented, read as "0"
Register Bit
Name 7 6 5 4 3 2 1 0
IICC0 — — — — IICDEB1 IICDEB0 IICEN —
IICC1 HCF HAAS HBB HTX TXAK SRW IAMWU RXAK
IICD D7 D6 D5 D4 D3 D2 D1 D0
IICA A6 A5 A4 A3 A2 A1 A0 —
I2CTOC I2CTOEN I2CTOF I2CTOS5 I2CTOS4 I2CTOS3 I2CTOS2 I2CTOS1 I2CTOS0
I2C Registers List
• IICC0 Register
Bit 7 6 5 4 3 2 1 0
Name — — — — IICDEB1 IICDEB0 IICEN —
R/W — — — — R/W R/W R/W —
FOR — — — — 0 0 0 —
• IICC1 Register
Bit 7 6 5 4 3 2 1 0
Name HCF HAAS HBB HTX TXAK SRW IAMWU RXAK
R/W R R R R/W R/W R R/W R
FOR 1 0 0 0 0 0 0 1
Bit 7~2 The same as the bit 7~bit 2 of the SIMC1 register.
Bit 1 IAMWU: I2C Address Match Wake-up Control
0: Disable
1: Enable – must be cleared by the application program after wake-up.
This bit should be set to “1” to enable the I2C address match wake up from the SLEEP
or IDLE Mode. If the IAMWU bit has been set before entering either the SLEEP or
IDLE mode to enable the I2C address match wake up, then this bit must be cleared by
application program after wake-up to ensure correction device operation.
Bit 0 The same as the bit 0 of the SIMC1 register.
• IICD Register
Bit 7 6 5 4 3 2 1 0
Name D7 D6 D5 D4 D3 D2 D1 D0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
FOR x x x x x x x x
“x” unknown
Bit 7~0 The same as the bit 7~bit 0 of the SIMD register.
• IICA Register
Bit 7 6 5 4 3 2 1 0
Name A6 A5 A4 A3 A2 A1 A0 —
R/W R/W R/W R/W R/W R/W R/W R/W —
FOR 0 0 0 0 0 0 0 —
Bit 7~0 The same as the bit 7~bit 0 of the SIMA register.
I C Block Diagram
2
Start
Set SIM[2:0]=110
Set SIMEN or IICEN
Slave Address
The 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 SRW bit of the SIMC1 or 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 HAAS when the addresses match.
As an I 2C bus interrupt can come from two sources, when the program enters the interrupt
subroutine, the HAAS bit 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. When a slave address is
matched, the device must be placed in either the transmit mode and then write data to the SIMD or
IICD register, or in the receive mode where it must implement a dummy read from the SIMD or
IICC1 register to release the SCL line.
Note: *When a slave address is matched, the device must be placed in either the transmit mode and
then write data to the SIMD or IICD register, or in the receive mode where it must implement
a dummy read from the SIMD or IICD register to release the SCL line.
The I2CTOF flag can be cleared 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. Note also that the LIRC oscillator is continuously enabled.
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/Event Counter 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. The devices contain several
external interrupt and internal interrupts functions. The external interrupt is generated by the action
of the external INT pin, while the internal interrupts are generated by various internal functions such
as the Touch Keys, Timer/Event Counter, Time Base, SIM etc.
Interrupt Registers
Overall 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 depends upon the device chosen but fall into three
categories. The first is the INTC0~INTC1 registers which setup the primary interrupts, the second is
the INTEG registers 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.
Function Enable Bit Request Flag Notes
Global EMI — —
INT Pin INTE INTF —
Touch Key Module TKME TKMF —
SIM (except BS83B04A-4) SIME SIMF —
I2C (BS33B04A-4) I2CE I2CF —
EEPROM DEE DEF —
Time Base TBE TBF —
Timer/Event Counter TE TF —
Interrupt Register Bit Naming Conventions
Register Bit
Device
Name 7 6 5 4 3 2 1 0
BS83B04A-4 INTC1 — DEF TBF I2CF — DEE TBE I2CE
Others INTC1 — DEF TBF SIMF — DEE TBE SIME
INTEG — — — — — — INTS1 INTS0
All devices
INTC0 — TF TKMF INTF TE TKME INTE EMI
INTEG Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — INTS1 INTS0
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
INTC0 Register
Bit 7 6 5 4 3 2 1 0
Name — TF TKMF INTF TE TKME INTE EMI
R/W — R/W R/W R/W R/W R/W R/W R/W
POR — 0 0 0 0 0 0 0
Interrupt Operation
When the conditions for an interrupt event occur, such as a Touch Key Counter overflow,
Timer/Event Counter overflow, 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.
Low
Interrupt Structure(BS83B04A-4)
Low
Interrupt Structure(except BS83B04A-4)
External Interrupt
The external interrupt is controlled by signal transitions on the pin INT. 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. To allow the program to branch to its respective interrupt vector address, the global interrupt
enable bit, EMI, and respective external interrupt enable bit, INTE, 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 pin is pin-shared
with I/O pin, its can only be configured as external interrupt pin if its external interrupt enable bit in
the corresponding interrupt register has been set. 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 flag,
INTF, 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 pin 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.
TBC Register
Bit 7 6 5 4 3 2 1 0
Name — — TB1 TB0 — — — —
R/W — — R/W R/W — — — —
POR — — 0 0 — — — —
Time Base Structure
EEPROM 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, 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 DEF flag will be automatically cleared and the EMI bit will be
automatically cleared to disable other interrupts.
Programming Considerations
By 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.
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 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.
Application Circuits
VDD
VDD
0.1uF
PAD Key1 VSS
PAD Key2
PAD Key3
I/O Control Device
PAD Key4
I2C I2C Device
BS83B04A-4
VDD
VDD
0.1uF
PAD Key1 VSS
PAD Key2
PAD Keyn
BS83B08A-3/BS83B08A-4
BS83B12A-3/BS83B12A-4
BS83B16A-3/BS83B16A-4
Note: “*” It is recommended that this component is added for added ESD protection.
“**” It is recommended that this component is added in environments where power line noise
is significant.
Instruction Set
Instruction
Central 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 Holtekmicrocontrollers, 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 Timing
Most 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
1us. 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.
Arithmetic Operations
The 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.
Bit Operations
The 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.
Other Operations
In 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.
Table Conventions
x: Bits immediate data
m: Data Memory address
A: Accumulator
i: 0~7 number of bits
addr: Program memory address
Mnemonic Description Cycles Flag Affected
Arithmetic
ADD A,[m] Add Data Memory to ACC 1 Z, C, AC, OV
ADDM A,[m] Add ACC to Data Memory 1Note Z, C, AC, OV
ADD A,x Add immediate data to ACC 1 Z, C, AC, OV
ADC A,[m] Add Data Memory to ACC with Carry 1 Z, C, AC, OV
ADCM A,[m] Add ACC to Data memory with Carry 1Note Z, C, AC, OV
SUB A,x Subtract immediate data from the ACC 1 Z, C, AC, OV
SUB A,[m] Subtract Data Memory from ACC 1 Z, C, AC, OV
SUBM A,[m] Subtract Data Memory from ACC with result in Data Memory 1Note Z, C, AC, OV
SBC A,[m] Subtract Data Memory from ACC with Carry 1 Z, C, AC, OV
SBCM A,[m] Subtract Data Memory from ACC with Carry, result in Data Memory 1Note Z, C, AC, OV
DAA [m] Decimal adjust ACC for Addition with result in Data Memory 1Note C
Logic Operation
AND A,[m] Logical AND Data Memory to ACC 1 Z
OR A,[m] Logical OR Data Memory to ACC 1 Z
XOR A,[m] Logical XOR Data Memory to ACC 1 Z
ANDM A,[m] Logical AND ACC to Data Memory 1Note Z
ORM A,[m] Logical OR ACC to Data Memory 1Note Z
XORM A,[m] Logical XOR ACC to Data Memory 1Note Z
AND A,x Logical AND immediate Data to ACC 1 Z
OR A,x Logical OR immediate Data to ACC 1 Z
XOR A,x Logical XOR immediate Data to ACC 1 Z
CPL [m] Complement Data Memory 1Note Z
CPLA [m] Complement Data Memory with result in ACC 1 Z
Increment & Decrement
INCA [m] Increment Data Memory with result in ACC 1 Z
INC [m] Increment Data Memory 1Note Z
DECA [m] Decrement Data Memory with result in ACC 1 Z
DEC [m] Decrement Data Memory 1Note Z
Rotate
RRA [m] Rotate Data Memory right with result in ACC 1 None
RR [m] Rotate Data Memory right 1Note None
RRCA [m] Rotate Data Memory right through Carry with result in ACC 1 C
RRC [m] Rotate Data Memory right through Carry 1Note C
RLA [m] Rotate Data Memory left with result in ACC 1 None
RL [m] Rotate Data Memory left 1Note None
RLCA [m] Rotate Data Memory left through Carry with result in ACC 1 C
RLC [m] Rotate Data Memory left through Carry 1Note C
Note: 1. For skip instructions, if the result of the comparison involves a skip then two 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 WDT1” and “CLR WDT2” instructions the TO and PDF flags may be affected by the
execution status. The TO and PDF flags are cleared after both “CLR WDT1” and “CLR WDT2”
instructions are consecutively executed. Otherwise the TO and PDF flags remain unchanged.
Instruction Definition
DAA [m] Decimal-Adjust ACC for addition with result in Data Memory
Description 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 + 66H
Affected flag(s) C
NOP No operation
Description No operation is performed. Execution continues with the next instruction.
Operation No operation
Affected flag(s) None
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.
Operation Program Counter ← Stack
ACC ← x
Affected flag(s) None
RLCA [m] Rotate Data Memory left through Carry with result in ACC
Description 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].7
Affected flag(s) C
RRCA [m] Rotate Data Memory right through Carry with result in ACC
Description 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].0
Affected flag(s) C
SBCM A,[m] Subtract Data Memory from ACC with Carry and result in Data Memory
Description 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] − C
Affected flag(s) OV, Z, AC, C
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. 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=0
Affected flag(s) None
SIZA [m] Skip if increment Data Memory is zero with result in ACC
Description 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=0
Affected flag(s) None
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.
Operation [m] ← ACC − [m]
Affected flag(s) OV, Z, AC, C
TABRD [m] Read table (specific page) to TBLH and Data Memory
Description The low byte of the program code (specific page) addressed by the table pointer pair
(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
TABRDC [m] Read table (current page) to TBLH and Data Memory
Description 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
TABRDL [m] Read table (last page) to TBLH and Data Memory
Description 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
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)
• Carton information
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.236 BSC —
B — 0.154 BSC —
C 0.012 — 0.020
C′ — 0.193 BSC —
D — — 0.069
E — 0.050 BSC —
F 0.004 — 0.010
G 0.016 — 0.050
H 0.004 — 0.010
α 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 6.00 BSC —
B — 3.90 BSC —
C 0.31 — 0.51
C′ — 4.90 BSC —
D — — 1.75
E — 1.27 BSC —
F 0.10 — 0.25
G 0.40 — 1.27
H 0.10 — 0.25
α 0° — 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — — 0.043
A1 0.000 — 0.006
A2 0.030 0.033 0.037
B 0.007 — 0.013
C 0.003 — 0.009
D — 0.118 BSC —
E — 0.193 BSC —
E1 — 0.118 BSC —
e — 0.020 BSC —
L 0.016 0.024 0.031
L1 — 0.037 BSC —
y — 0.004 —
θ 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — — 1.10
A1 0.00 — 0.15
A2 0.75 0.85 0.95
B 0.17 — 0.33
C 0.08 — 0.23
D — 3.00 BSC —
E — 4.90 BSC —
E1 — 3.00 BSC —
e — 0.50 BSC —
L 0.40 0.60 0.80
L1 — 0.95 BSC —
y — 0.10 —
θ 0° — 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.236 BSC —
B — 0.154 BSC —
C 0.012 — 0.020
C' — 0.390 BSC —
D — — 0.069
E — 0.050 BSC —
F 0.004 — 0.010
G 0.016 — 0.050
H 0.004 — 0.010
α 0° ― 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 6.00 BSC —
B — 3.90 BSC —
C 0.31 — 0.51
C' — 9.90 BSC —
D — — 1.75
E — 1.27 BSC —
F 0.10 — 0.25
G 0.40 — 1.27
H 0.10 — 0.25
α 0° ― 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.236 BSC —
B — 0.154 BSC —
C 0.008 — 0.012
C’ — 0.193 BSC —
D — — 0.069
E — 0.025 BSC —
F 0.004 — 0.010
G 0.016 — 0.050
H 0.004 — 0.010
α 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 6.000 BSC —
B — 3.900 BSC —
C 0.20 — 0.30
C’ — 4.900 BSC —
D — — 1.75
E — 0.635 BSC —
F 0.10 — 0.25
G 0.41 — 1.27
H 0.10 — 0.25
α 0° — 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.406 BSC —
B — 0.295 BSC —
C 0.012 — 0.020
C’ — 0.504 BSC —
D — — 0.104
E — 0.050 BSC —
F 0.004 — 0.012
G 0.016 — 0.050
H 0.008 — 0.013
α 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 10.30 BSC —
B — 7.50 BSC —
C 0.31 — 0.51
C’ — 12.80 BSC —
D — — 2.65
E — 1.27 BSC —
F 0.10 — 0.30
G 0.40 — 1.27
H 0.20 — 0.33
α 0° — 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.236 BSC —
B — 0.155 BSC —
C 0.008 — 0.012
C’ — 0.341 BSC —
D — — 0.069
E — 0.025 BSC —
F 0.004 — 0.0098
G 0.016 — 0.05
H 0.004 — 0.01
α 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 6.000 BSC —
B — 3.900 BSC —
C 0.20 — 0.30
C’ — 8.660 BSC —
D — — 1.75
E — 0.635 BSC —
F 0.10 — 0.25
G 0.41 — 1.27
H 0.10 — 0.25
α 0° — 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.406 BSC —
B — 0.295 BSC —
C 0.012 — 0.020
C’ — 0.606 BSC —
D — — 0.104
E — 0.050 BSC —
F 0.004 — 0.012
G 0.016 — 0.050
H 0.008 — 0.013
α 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 10.30 BSC —
B — 7.50 BSC —
C 0.31 — 0.51
C’ — 15.40 BSC —
D — — 2.65
E — 1.27 BSC —
F 0.10 — 0.30
G 0.40 — 1.27
H 0.20 — 0.33
α 0° ― 8°
Dimensions in inch
Symbol
Min. Nom. Max.
A — 0.236 BSC —
B — 0.154 BSC —
C 0.008 — 0.012
C’ — 0.341 BSC —
D — — 0.069
E — 0.025 BSC —
F 0.004 — 0.010
G 0.016 — 0.050
H 0.004 — 0.010
α 0° — 8°
Dimensions in mm
Symbol
Min. Nom. Max.
A — 6.000 BSC —
B — 3.900 BSC —
C 0.20 — 0.30
C’ — 8.660 BSC —
D — — 1.75
E — 0.635 BSC —
F 0.10 — 0.25
G 0.41 — 1.27
H 0.10 — 0.25
α 0° — 8°