Receptor BC68F2130
Receptor BC68F2130
BC68F2130/BC68F2140
Table of Contents
Features................................................................................................................. 6
CPU Features...............................................................................................................................6
Peripheral Features.......................................................................................................................6
RF Transmitter Features...............................................................................................................7
General Description.............................................................................................. 7
Block Diagram....................................................................................................... 8
Selection Table...................................................................................................... 8
Pin Assignment..................................................................................................... 9
Pin Description..................................................................................................... 9
Absolute Maximum Ratings............................................................................... 12
D.C. Characteristics............................................................................................ 12
A.C. Characteristics............................................................................................ 13
LVD/LVR Electrical Characteristics................................................................... 14
RF Transmitter Electrical Characteristics........................................................ 14
Power-on Reset Characteristics........................................................................ 15
System Architecture........................................................................................... 16
Clocking and Pipelining...............................................................................................................16
Program Counter.........................................................................................................................17
Stack...........................................................................................................................................17
Arithmetic and Logic Unit – ALU.................................................................................................18
Data Memory....................................................................................................... 30
Structure......................................................................................................................................30
Data Memory Addressing............................................................................................................31
General Purpose Data Memory..................................................................................................31
Special Purpose Data Memory...................................................................................................31
Oscillators........................................................................................................... 37
Oscillator Overview.....................................................................................................................37
System Clock Configurations......................................................................................................37
External Crystal/Ceramic Oscillator – HXT.................................................................................38
Internal High Speed RC Oscillator – HIRC.................................................................................39
Internal 32kHz Oscillator – LIRC.................................................................................................39
Watchdog Timer.................................................................................................. 52
Watchdog Timer Clock Source....................................................................................................52
Watchdog Timer Control Register...............................................................................................52
Watchdog Timer Operation.........................................................................................................53
Input/Output Ports.............................................................................................. 61
Pull-high Resistors......................................................................................................................62
Port A Wake-up...........................................................................................................................62
I/O Port Control Registers...........................................................................................................63
Pin-shared Functions..................................................................................................................63
I/O Pin Structures........................................................................................................................65
Programming Considerations......................................................................................................66
RF Transmitter.................................................................................................... 94
RF Transmitter Abbreviation Notes.............................................................................................94
RF Transmitter Control Registers ...............................................................................................94
Modulation Modes and Operating Modes Selection.................................................................100
TX FIFO Mode in Burst Mode...................................................................................................102
RF Channel Setup.....................................................................................................................104
Software Programming Guide...................................................................................................106
Interrupts........................................................................................................... 109
Interrupt Registers.....................................................................................................................109
Interrupt Operation.................................................................................................................... 113
External Interrupts..................................................................................................................... 114
Time Base Interrupts................................................................................................................. 115
Multi-function Interrupts............................................................................................................. 117
RF TX FIFO Length Margin Detect Interrupt............................................................................. 117
RF Burst Mode Transmit Complete Interrupt............................................................................ 118
LVD Interrupt............................................................................................................................. 118
TM Interrupts............................................................................................................................. 118
Interrupt Wake-up Function....................................................................................................... 119
Programming Considerations.................................................................................................... 119
Features
CPU Features
• Operating voltage
♦♦ fSYS=16MHz: 2.0V~3.6V
• Up to 0.25μs instruction cycle with 16MHz system clock at VDD=5V
• Power saving and wake-up functions to reduce power consumption
• Oscillator types:
♦♦ RF External High Speed Crystal – HXT
♦♦ Internal High Speed RC – HIRC
♦♦ Internal Low Speed 32kHz RC – LIRC
• Multi-mode operation: NORMAL, SLOW, IDLE, SLEEP and DEEP SLEEP
• Fully integrated internal 16MHz oscillator requires no external components
• All instructions executed in 1~3 instruction cycles
• Table read instructions
• 115 powerful instructions
• 8-level subroutine nesting
• Bit manipulation instruction
Peripheral Features
• Flash Program Memory: 2K×16 ~ 4K×16
• RAM Data Memory: 256×8
• In Application Programming function – IAP
• Watchdog Timer function
• Up to 14 bidirectional I/O lines
• 2 pin-shared external interrupts
• Multiple Timer Modules for time measurement, input capture, compare match output or PWM
output or single pulse output function
♦♦ 1 Compact type 10-bit Timer Module – CTM
♦♦ 1 Periodic type 10-bit Timer Module – PTM
• Dual Time-Base functions for generation of fixed time interrupt signals
• Integrated 1.5V LDO
• Low voltage reset function
• Low voltage detect function
• Flash program memory can be re-programmed up to 100,000 times
• Flash program memory data retention > 10 years
• Package types: 16-pin NSOP-EP, 24-pin SSOP-EP
RF Transmitter Features
• Complete ultra high frequency OOK/FSK transmitter with low transmission phase noise
• Supports 315/433/868/915MHz frequency bands
• Programmable channel setting with < 2kHz resolution
• OOK data rates 0.5Kbps~25Kbps, FSK data rates 0.5Kbps~100Kbps
• Output power up to +13dBm (software controlled output power: 0, +10dBm, +13dBm)
• RF external crystal: 12MHz/12.8MHz/16MHz/19.2MHz
General Description
These Sub-1GHz RF Transmitter MCUs provide a combination of a fully featured MCU and an RF
transmitter function, providing them with superior flexibility for use in a wide range of wireless I/O
control applications such as industrial control, consumer products, subsystem controllers, etc.
Offering users the convenience of Flash Memory multi-programming features, the devices also
include a wide range of functions and features. Other memory includes an area of RAM Data
Memory for storage of non-volatile data such as serial numbers, calibration data etc. By using
Holtek’s In Application Programming technology, users have a convenient means to directly store
their measured data in the Flash Program Memory as well as having the ability to easily update their
application programs.
Multiple and extremely flexible Timer Modules provide timing, pulse generation and PWM
generation functions. Protective features such as an internal Watchdog Timer, Low Voltage Reset
and Low Voltage Detector coupled with excellent noise immunity and ESD protection ensure that
reliable operation is maintained in hostile electrical environments.
A full choice of external, internal high and low oscillators is provided including two fully integrated
system 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 the conflicting demands of microcontroller performance and
power consumption.
The integrated RF transmitter can operate at the 315MHz, 433MHz, 868MHz and 915MHz
frequency bands. The additional of a crystal and a limited number of external components is all that
is required to create a complete and versatile RF transmitter system. The devices include an internal
power amplifier and are capable of delivering +13dBm (Max.) into a 50W load. Such a power level
enables a small form factor transmitter to operate near the maximum transmission regulation limits.
The devices can operate with OOK – On-Off Keying and FSK – Frequency Shift Keying receiver
types. The FSK data rate is up to 100Kbps, allowing the devices to support more complicated
control protocols.
The inclusion of flexible I/O programming features, Time-Base functions along with many other
features ensure that the devices will be highly capable of providing cost effective MCU Sub-1GHz
RF transmitter solutions for remote wireless applications.
Block Diagram
Watchdog Internal RC
Timer Oscillators Interrupt
8-bit Controller
Flash Programming RISC
Circuitr� �CU
Low Voltage Low Voltage Core Reset
Detect Reset Circuit
Flash External
RA� Data Time HXT
Program IAP
�emor� Bases Oscillator
�emor�
RF
RF Power
S�nthesizer
Amplifier
Selection Table
Most features are common to these devices, the main features distinguishing them are Flash Memory
capacity, I/O count and the package type. The following table summarises the main features of each
device.
Part No. VDD ROM RAM I/O Ext. Int. LDO
BC68F2130 2.0V~3.6V 2K×16 256×8 8 2 √
BC68F2140 2.0V~3.6V 4K×16 256×8 14 2 √
Integrated RF
Part No. Timer Module Time Base Stack Package
Band Type
10-bit CTM×1
BC68F2130 315~915MHz OOK/FSK TX 2 8 16NSOP-EP
10-bit PTM×1
10-bit CTM×1
BC68F2140 315~915MHz OOK/FSK TX 2 8 24SSOP-EP
10-bit PTM×1
Pin Assignment
VSS 1 16 VDD
PA3/INT0 � 15 V15O
PA�/PTP/ICPCK/OCDSCK 3 14 PB4
PA1/PTCK 4 13 PB5
PA0/PTPI/PTPB/ICPDA/OCDSDA 5 1� PA4/INT1
OSC� 6 11 PA5/CTP
OSC1 � 10 VDDRF
VSSRF_PA 8 � RFOUT
BC68F2130
16 NSOP-EP-A
VSS 1 �4 VDD
PB3 � �3 V15O
PB� 3 �� PB4
PB1 4 �1 PB5
PB0 5 �0 PA4/INT1
PA3/INT0 6 1� PA5/CTP
PA�/PTP/ICPCK/OCDSCK � 18 PA6/CTPB
PA1/PTCK 8 1� PA�/CTCK
PA0/PTPI/PTPB/ICPDA/OCDSDA � 16 VSSRF
OSC� 10 15 VDDRF
OSC1 11 14 RFOUT
NC 1� 13 VSSRF_PA
BC68F2140
24 SSOP-EP-A
Note: 1. If the pin-shared pin functions have multiple outputs, the desired pin-shared function is
determined by corresponding software control bits.
2. The OCDSDA and OCDSCK pins are used as the OCDS dedicated pins.
Pin Description
The function of each pin is listed in the following table, however the details behind how each pin is
configured is contained in other sections of the datasheet.
BC68F2130
Pin Name Function OPT I/T O/T Description
PAPU
PA0 PAWU ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAS0
PA0/PTPI/PTPB/ PTPI PAS0 ST — PTM capture input
ICPDA/OCDSDA PTPB PAS0 — CMOS PTM inverted output
ICPDA — ST CMOS ICP Address/Data
OCDSDA — ST CMOS OCDS data/address
PAPU
PA1 PAWU ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA1/PTCK PAS0
PTCK PAS0 ST — PTM clock input
BC68F2140
Pin Name Function OPT I/T O/T Description
PAPU
PA0 PAWU ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PAS0
PA0/PTPI/PTPB/ PTPI PAS0 ST — PTM capture input
ICPDA/OCDSDA PTPB PAS0 — CMOS PTM inverted output
ICPDA — ST CMOS ICP Address/Data
OCDSDA — ST CMOS OCDS data/address
PAPU
PA1 PAWU ST CMOS General purpose I/O. Register enabled pull-up and wake-up
PA1/PTCK PAS0
PTCK PAS0 ST — PTM clock input
Note: These are stress ratings only. Stresses exceeding the range specified under “Absolute
Maximum Ratings” may cause substantial damage to the devices. Functional operation of
the devices at other conditions beyond those listed in the specification is not implied and
prolonged exposure to extreme conditions may affect device reliability.
The devices are ESD sensitive. HBM (Human Body Mode) is based on MIL-STD-883H
Method 3015.8. MM (Machine Mode) is based on JEDEC EIA/JESD22-A115.
D.C. Characteristics
Ta=25°C
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
MCU Operating Voltage – HXT fSYS = fHXT =
— 2.0 — 3.6 V
(RF External Crystal) 12/12.8/16/19.2MHz
VDD
MCU Operating Voltage – HIRC — fSYS = fHIRC = 16MHz 2.0 — 3.6 V
MCU Operating Voltage – LIRC — fSYS = fLIRC = 32kHz 2.0 — 3.6 V
V15O LDO Operating Voltage 2.0V~3.6V — -10% 1.5 +10% V
No load, all peripherals off,
Operating Current – LIRC
3V fSYS = fLIRC = 32kHz, — 30 50 μA
(LCMD=1)
RF TX power off
No load, all peripherals off,
Operating Current – LIRC
3V fSYS = fLIRC = 32kHz, — 42 70 μA
(LCMD=0)
RF TX power off
IDD
No load, all peripherals off,
Operating Current – HIRC 3V fSYS = fHIRC = 16MHz, — 0.76 1.5 mA
RF TX power off
No load, all peripherals off,
Operating Current – HXT 3V fSYS = fHXT = 16MHz, — 1.1 1.6 mA
RF TX power off
Standby Current No load, all peripherals off,
3V — 0.4 1.0 μA
(Deep Sleep Mode, LDO Off) WDT off
Standby Current No load, all peripherals off,
ISTB 3V — 1.2 3 μA
(DEEP SLEEP Mode, LDO Off) WDT on
Standby Current No load, all peripherals off,
3V — 600 900 μA
(IDLE1 Mode, LDO On) fSUB on, fSYS = fHXT = 16MHz
3V — 0 — 0.9
VIL Input Low Voltage for I/O Ports V
— — 0 — 0.3VDD
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
3V — 2.1 — 3.0
VIH Input High Voltage for I/O Ports V
— — 0.7VDD — VDD
IOL Sink Current for I/O Ports 3V VOL=0.1VDD 10 20 — mA
IOH Source Current for I/O Ports 3V VOL=0.9VDD -5 -10 — mA
VOL Output Low Voltage for I/O Ports 3V IOL=10mA — — 0.3 V
VOH Output High Voltage for I/O Ports 3V IOH=-5mA 2.7 — — V
RPH Pull-high Resistance for I/O Ports 3V — 20 30 60 kΩ
A.C. Characteristics
Ta=25°C
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
Sysetm Clock – HXT fSYS = fHXT =
2.0V~3.6V 12 16 19.2 MHz
(RF External Crystal) 12/12.8/16/19.2MHz
fSYS
MCU System Clock – HIRC 2.0V~3.6V fSYS = fHIRC = 16MHz — 16 — MHz
System Clock – LIRC 2.0V~3.6V fSYS = fLIRC = 32kHz — 32 — kHz
fHIRC High Speed Internal RC Oscillator 3V Ta = 25°C -2% 16 +2% MHz
fLIRC Low Speed Internal RC Oscillator 3V Ta = 25°C -10% 32 +10% kHz
External Interrupt Minimum Pulse
tINT — — 10 — — μs
Width
xTM xTCK Input Pin Minimum Pulse
tTCK — — 0.3 — — μs
Width
PTM PTPI Input Pin Minimum Pulse
tTPI — — 0.3 — — μs
Width
System Start-up Timer Period — fSYS = fHXT ~ fHXT / 64 128 — — tHXT
(Wake-up from halt condition where — fSYS = fHIRC ~ fHIRC / 64 16 — — tHIRC
fSYS is off) — fSYS = fLIRC 2 — — tSUB
System Start-up Timer Period fSYS = fH ~ fH / 64,
— 2 — — tH
(Wake-up from halt condition where fH = fHXT or fHIRC
tSST fSYS is on) — fSYS = fLIRC 2 — — tSUB
System Start-up Timer Period — fHXT off → on (HXTF = 1) 1024 — — tHXT
(Slow mode ↔ Normal mode or
fH = fHIRC ↔ fHXT) — fHIRC off → on (HIRCF = 1) 16 — — tHIRC
System Start-up Timer Period
— — 0 — — tH
(WDT Time-out Hardware Reset)
System Reset Delay Time (Power-on
Reset, LVR Hardware Reset, — — 25 50 100 ms
tRSTD LVRC/WDTC/RSTC Software Reset)
System Reset Delay Time
— — 8.3 16.7 33.3 ms
(WDT Hardware Reset)
Minimum Software Reset Width to
tSRESET — — 45 90 120 μs
Reset
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
PRF = 10dBm,
— — — -80 dBc/Hz
100kHz from Carrier
PNTX Transmitter Phase Noise
PRF = 10dBm,
— — — -100 dBc/Hz
1MHz from Carrier
— f < 1GHz — — -36 dBm
47MHz < f < 74MHz,
87.5MHz < f < 118MHz,
— — — -54 dBm
174MHz < f < 230MHz,
Transmitter Spurious
470MHz < f < 790MHz,
SETX Emission
(PRF = 10dBm, fOP = 433MHz) — 2nd Harmonic — — -30 dBm
— 3rd Harmonic — — -30 dBm
— 2 Harmonic (other frequency)
nd
— — -30 dBm
— 3rd Harmonic (other frequency) — — -30 dBm
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 the device take advantage of the usual features found
within RISC microcontrollers providing increased speed of operation and enhanced performance.
The pipelining scheme is implemented in such a way that instruction fetching and instruction
execution are overlapped, hence instructions are effectively executed in one or two cycles for
most of the standard or extended instructions respectively, with the exception of branch or call
instructions which need one more cycle. An 8-bit wide ALU is used in practically all instruction set
operations, which carries out arithmetic operations, logic operations, rotation, increment, decrement,
branch decisions, etc. The internal data path is simplified by moving data through the Accumulator
and the ALU. Certain internal registers are implemented in the Data Memory and can be directly
or indirectly addressed. The simple addressing methods of these registers along with additional
architectural features ensure that a minimum of external components is required to provide a
functional I/O control system with maximum reliability and flexibility. This makes the device
suitable for low-cost, high-volume production for controller applications.
fSYS
(S�stem Clock)
Phase Clock T1
Phase Clock T�
Phase Clock T3
Phase Clock T4
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 Counter High Byte PCL Register
BC68F2130 PC10~PC8 PCL7~PCL0
BC68F2140 PC11~PC8 PCL7~PCL0
Program Counter
The lower byte of the Program Counter, known as the Program Counter Low register or PCL, is
available for program control and is a readable and writeable register. By transferring data directly
into this register, a short program jump can be executed directly; however, as only this low byte
is available for manipulation, the jumps are limited to the present page of memory that is 256
locations. When such program jumps are executed it should also be noted that a dummy cycle
will be inserted. Manipulating the PCL register may cause program branching, so an extra cycle is
needed to pre-fetch.
Stack
This is a special part of the memory which is used to save the contents of the Program Counter
only. The stack has multiple levels and 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
Stack Level �
Stack
Stack Level 3
Pointer Program �emor�
:
:
:
Bottom of Stack Stack Level 8
Structure
The Program Memory has a capacity of 2K×16 to 4K×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.
Device Capacity
BC68F2130 2K×16
BC68F2140 4K×16
BC68F2130 BC68F2140
000H Reset Reset
004H
Interrupt Interrupt
Vectors Vectors
01CH
�FFH 16 bits
FFFH 16 bits
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.
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 registers, TBLP and TBHP. These registers
define the total address of the look-up table.
After setting up the table pointer, the table data can be retrieved from the Program Memory using the
corresponding table read instruction such as “TABRD [m]” or “TABRDL [m]” respectively when
the memory [m] is located in sector 0. If the memory [m] is located in other sectors, the data can be
retrieved from the program memory using the corresponding extended table read instruction such as
“LTABRD [m]” or “LTABRDL [m]” respectively. When the instruction is executed, the lower order
table byte from the Program Memory will be transferred to the user defined Data Memory register
[m] as specified in the instruction. The higher order table data byte from the Program Memory will
be transferred to the TBLH special register.
The accompanying diagram illustrates the addressing data flow of the look-up table.
Program �emor�
Last Page or
Address
TBHP Register
Data
16 bits
TBLP Register
The Program Memory can be programmed serially in-circuit using this 4-wire interface. Data
is downloaded and uploaded serially on a single pin with an additional line for the clock.
Two additional lines are required for the power supply. The technical details regarding the in-
circuit programming of the device is beyond the scope of this document and will be supplied in
supplementary literature.
During the programming process, the user must take care of the ICPDA and ICPCK pins for data
and clock programming purposes to ensure that no other outputs are connected to these two pins.
Writer_VDD VDD
VDDRF
ICPDA PA0
ICPCK PA�
Writer_VSS VSS
VSSRF
* *
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.
Bit
Register Name
7 6 5 4 3 2 1 0
FC0 CFWEN FMOD2 FMOD1 FMOD0 FWPEN FWT FRDEN FRD
FC1 D7 D6 D5 D4 D3 D2 D1 D0
FARL A7 A6 A5 A4 A3 A2 A1 A0
FARH (BC68F2130) — — — — — A10 A9 A8
FARH (BC68F2140) — — — — A11 A10 A9 A8
FD0L D7 D6 D5 D4 D3 D2 D1 D0
FD0H D15 D14 D13 D12 D11 D10 D9 D8
FD1L D7 D6 D5 D4 D3 D2 D1 D0
FD1H D15 D14 D13 D12 D11 D10 D9 D8
FD2L D7 D6 D5 D4 D3 D2 D1 D0
FD2H D15 D14 D13 D12 D11 D10 D9 D8
FD3L D7 D6 D5 D4 D3 D2 D1 D0
FD3H D15 D14 D13 D12 D11 D10 D9 D8
IAP Registers List
• FC0 Register
Bit 7 6 5 4 3 2 1 0
Name CFWEN FMOD2 FMOD1 FMOD0 FWPEN FWT FRDEN FRD
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
• FD0H Register
Bit 7 6 5 4 3 2 1 0
Name D15 D14 D13 D12 D11 D10 D9 D8
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
Is counter No
overflow ?
Success Failed
END
Read
Flash �emor�
Set FRD=1
No
FRD=0 ?
Yes
No
Read Finish ?
Yes
END
Write
Flash �emor�
Flash �emor�
Write Function
Enable Procedure
No
FWT=0 ?
Yes
Set FWT=1
No
FWT=0 ?
Yes
No
Write Finish ?
Yes
Clear CFWEN=0
END
Note: When the FWT or FRD bit is set to 1, the MCU is stopped.
Data Memory
The Data Memory is a volatile area of 8-bit wide RAM internal memory and is the location where
temporary information is stored.
Categorized into two types, the first of these is an area of RAM, known as the Special Function Data
Memory. These registers have fixed locations and are necessary for correct operation of the devices.
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.
Switching between the different Data Memory sectors is achieved by properly setting the Memory
Pointers to correct value when using the indirect addressing access.
Structure
The Data Memory is subdivided into several sectors, all of which are implemented in 8-bit wide
Memory. Each of the Data Memory Sectors is categorized into two types, the special Purpose Data
Memory and the General Purpose Data Memory.
The address range of the Special Purpose Data Memory for the device is from 00H to 7FH while the
General Purpose Data Memory address range is from 80H to FFH.
Special Purpose General Purpose
Device Data Memory Data Memory
Located Sectors Capacity Sector: Address
BC68F2130 0: 80H~FFH
0, 1 256×8
BC68F2140 1: 80H~FFH
Data Memory Summary
00H
Special Purpose
Data �emor� 45H
46H
�FH
80H
General Purpose
Data �emor�
FFH Sector 0
Sector 1
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.
In addition, on entering an interrupt sequence or executing a subroutine call, the status register will
not be pushed onto the stack automatically. If the contents of the status registers are important and if
the subroutine can corrupt the status register, precautions must be taken to correctly save it.
STATUS Register
Bit 7 6 5 4 3 2 1 0
Name SC CZ TO PDF OV Z AC C
R/W R R R R R/W R/W R/W R/W
POR x x 0 0 x x x x
”x” unknown
Bit 7 SC: The result of the “XOR” operation which is performed by the OV flag and the
MSB of the instruction operation result.
Bit 6 CZ: The operational result of different flags for different instructions.
For SUB/SUBM/LSUB/LSUBM instructions, the CZ flag is equal to the Z flag.
For SBC/SBCM/LSBC/LSBCM instructions, the CZ flag is the “AND” operation
result which is performed by the previous operation CZ flag and current operation zero
flag.
For other instructions, the CZ flag will not be affected.
Bit 5 TO: Watchdog Time-out 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
The “C” flag is also affected by a rotate through carry instruction.
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 selection and operation
are selected through the relevant control registers.
Oscillator Overview
In addition to being the source of the main system clock the oscillators also provide clock sources
for other functions such as the RF circuits, the Watchdog Timer and Time Base Interrupts.
An external oscillator requiring some external components as well as fully integrated internal
oscillators, requiring no external components, are provided to form a wide range of both fast and
slow system oscillators. All oscillator options are selected through the relevant control registers. The
higher frequency oscillators provide higher performance but carry with it the disadvantage of higher
power requirements, while the opposite is of course true for the lower frequency oscillators. With
the capability of dynamically switching between fast and slow system clock, the devices have the
flexibility to optimize the performance/power ratio, a feature especially important in power sensitive
portable applications.
Type Name Frequency Pins
External High Speed Crystal HXT 12/12.8/16/19.2MHz OSC1/OSC2
Internal High Speed RC HIRC 16MHz —
Internal Low Speed RC LIRC 32kHz —
Oscillator Types
fH
XODIV� XCLKD�
HXTEN
HXT fH/�
RF_PDB
÷� fH/4
÷�
fH/8
IDLE0
HIRC Prescaler fH/16 fSYS
HIRCEN SLEEP
DEEP SLEEP
fH/3�
High Speed
FHS fH/64
Oscillators
fSUB
Low Speed
Oscillator
CKS�~CKS0
LIRC
IDLE�
fSUB
SLEEP
DEEP SLEEP
fLIRC
C1 OSC1 Internal
Oscillator
Circuit
RP RF
To internal
OSC2 circuits
C2
Crystal/Resonator Oscillator
System Clocks
The devices have many different clock sources for both the CPU and peripheral function operation.
By providing the user with a wide range of clock options using register programming, a clock
system can be configured to obtain maximum application performance.
The main system clock, can come from a high frequency, fH, or low frequency, fSUB, source, and
is selected using the CKS2~CKS0 bits in the SCC register. The high speed system clock can be
sourced from an HXT or HIRC oscillator, selected via configuring the FHS bit in the SCC register.
The HXT oscillator is enabled using the HXTEN and RF_PDB bits. Its frequency can be divided
by two or four using the XODIV2 and XCLKD2 bits. These latter three bits are described in the RF
register section.
The low speed system clock source can be sourced from the internal clock fSUB. If fSUB is selected
then it is sourced from the LIRC oscillator. The other choice, which is a divided version of the high
speed system oscillator has a range of fH/2~fH/64.
fH
XODIV� XCLKD�
HXTEN
HXT fH/�
RF_PDB
÷� fH/4
÷�
fH/8
IDLE0
HIRC Prescaler fH/16 fSYS
HIRCEN SLEEP
DEEP SLEEP
High Speed fH/3�
Oscillators FHS fH/64
fSUB
Low Speed
Oscillator
CKS�~CKS0
LIRC
IDLE�
fSUB
SLEEP
DEEP SLEEP
fLIRC fSUB
WDT
fSYS/4 fPSC0 fPSC0_OUT
Prescaler 0 Prescaler Time Base 0
fLIRC fSYS
LVR
TB0[�:0] TB0_PRE[�:0]
CLKSEL0[1:0]
fSUB
fSYS/4 fPSC1
Prescaler 1 Time Base 1
fSYS
TB1[�:0]
CLKSEL1[1:0]
NORMAL Mode
As the name suggests this is one of the main operating modes where the microcontroller has all of its
functions operational, where the 1.5V LDO is turned on with the PWDN bit in the PWRC register
being low and the system clock is provided by one of the high speed oscillators. This mode operates
allowing the microcontroller to operate normally with a clock source sourced from one of the high
speed oscillators, either the HXT or HIRC oscillators. The high speed oscillator will however first
be divided by a ratio ranging from 1 to 64, the actual ratio being selected by the CKS2~CKS0 bits in
the SCC register. Although a high speed oscillator is used, running the microcontroller at a divided
clock ratio reduces the operating current.
SLOW Mode
This is also a mode where the microcontroller operates normally although now with a slower speed
clock source. The 1.5V LDO is turned on with the PWDN bit in the PWRC register being low. The
clock source used will be from fSUB. The fSUB clock is derived from the LIRC oscillator.
SLEEP Mode
The SLEEP Mode is entered when an HALT instruction is executed and when the FHIDEN and
FSIDEN bit are low, the PWDN bit in the PWRC register is low. In the SLEEP mode the CPU will
be stopped. The fSUB clock provided to the peripheral function will also be stopped, too. However the
fLIRC clock can continues to operate if the WDT function is enabled.
IDLE0 Mode
The IDLE0 Mode is entered when an HALT instruction is executed and when the FHIDEN bit in the
SCC register is low, the FSIDEN bit in the SCC register is high and the the PWDN bit in the PWRC
register is low. In the IDLE0 Mode the CPU will be switched off but the low speed oscillator will be
turned on to drive some peripheral functions.
IDLE1 Mode
The IDLE1 Mode is entered when an HALT instruction is executed and when the FHIDEN bit in the
SCC register is high, the FSIDEN bit in the SCC register is high and the the PWDN bit in the PWRC
register is low. In the IDLE1 Mode the CPU will be switched off but both the high and low speed
oscillators will be turned on to provide a clock source to keep some peripheral functions operational.
IDLE2 Mode
The IDLE2 Mode is entered when an HALT instruction is executed and when the FHIDEN bit in the
SCC register is high, the FSIDEN bit in the SCC register is low and the the PWDN bit in the PWRC
register is low. In the IDLE2 Mode the CPU will be switched off but the high speed oscillator will
be turned on to provide a clock source to keep some peripheral functions operational.
Control Registers
The registers, SCC, HIRCC, HXTC and PWRC, are used to control the system clock and the
corresponding oscillator configurations.
Register Bit
Name 7 6 5 4 3 2 1 0
SCC CKS2 CKS1 CKS0 — FHS — FHIDEN FSIDEN
HIRCC — — — — — — HIRCF HIRCEN
HXTC — — — — — — HXTF HXTEN
PWRC PA_WAKE — — TB0_WAKE POF33V LCMD IO_ISO_EN PWDN
System Operating Mode Control Registers List
SCC Register
Bit 7 6 5 4 3 2 1 0
Name CKS2 CKS1 CKS0 — FHS — FHIDEN FSIDEN
R/W R/W R/W R/W — R/W — R/W R/W
POR 0 0 0 — 0 — 0 0
Bit 0 FSIDEN: Low Frequency oscillator control when CPU is switched off
0: Disable
1: Enable
This bit is used to control whether the low speed oscillator is activated or stopped
when the CPU is switched off by executing an “HALT” instruction. The LIRC
oscillator is controlled by this bit together with the WDT function enable control when
the LIRC is selected to be the low speed oscillator clock source or the WDT function
is enabled respectively. If this bit is cleared to 0 but the WDT function is enabled, the
fLIRC clock will also be enabled.
HIRCC Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — HIRCF HIRCEN
R/W — — — — — — R R/W
POR — — — — — — 0 1
HXTC Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — HXTF HXTEN
R/W — — — — — — R R/W
POR — — — — — — 0 0
PWRC Register
Bit 7 6 5 4 3 2 1 0
Name PA_WAKE — — TB0_WAKE POF33V LCMD IO_ISO_EN PWDN
R/W R/W — — R/W R/W R/W R/W R/W
POR 0 — — 0 1 0 0 0
Bit 7 PA_WAKE: Port A wake-up MCU from DEEP SLEEP Mode flag
0: No Port A wake-up MCU from DEEP SLEEP Mode occured
1: Port A wake-up MCU from DEEP SLEEP Mode occured
This bit indicates whether the MCU has been woken up from the DEEP SLEEP Mode
by the port A wake-up function. The PAWU register should be properly configured
before the MCU enters the DEEP SLEEP Mode.
Bit 6~5 Unimplemented, read as “0”
Bit 4 TB0_WAKE: Time Base 0 wake-up MCU from DEEP SLEEP Mode flag
0: No Time Base 0 wake-up MCU from DEEP SLEEP Mode occured
1: Time Base 0 wake-up MCU from DEEP SLEEP Mode occured
This bit indicates whether the MCU has been woken up from the DEEP SLEEP Mode
by the Time Base 0 interrupt. The TB0C register and the TB0F interrupt flag should be
properly configured before the MCU enters the DEEP SLEEP Mode.
Bit 3 POF33V: 3V power domain power on reset flag
0: No 3V power domain power on reset occured
1: 3V power domain power on reset occured
This bit is set high by hardware when a 3V power domain power on reset occurs. It is
cleared by application program or when the “CLR WDT” instruction is executed.
Bit 2 LCMD: 1.5V LDO low current mode selection
0: 1.5V LDO normal mode
1: 1.5V LDO low current mode
Bit 1 IO_ISO_EN: I/O isolation mode selection
0: I/O in normal operation mode
1: I/O in isolation mode (I/O status remains unchanged)
Before entering the DEEP SLEEP Mode this bit must be set high to latch I/O ports,
so that I/O ports status will remain unchanged when in the DEEP SLEEP Mode. After
the MCU is woken up from the DEEP SLEEP Mode, this bit must be cleared using
application program to de-latch I/O ports.
Bit 0 PWDN: DEEP SLEEP Mode control
0: MCU under normal operation
1: MCU enters the DEEP SLEEP Mode after HALT (1.5V LDO off by hardware)
If this bit is set high, after executing the HALT instruction, the MCU will enter the
DEEP SLEEP Mode, in which case the 1.5V LDO will be turned off by hardware.
Before entering the DEEP SLEEP Mode, users should previously store the 1.5V
domain system settings to Data Memory and latch the I/O ports using the application
program.
NORMAL SLOW
PWDN=0 PWDN=0
LDO on LDO on
fSYS=fH~fH/64 fSYS=fSUB
fH on fSUB on
CPU run CPU run
fSYS on fSYS on
fSUB on fH on/off
SLEEP IDLE0
PWDN=0 DEEP SLEEP PWDN=0
LDO on PWDN=1 LDO on
HALT instruction executed LDO off HALT instruction executed
CPU stop HALT instruction executed CPU stop
FHIDEN=0 CPU stop FHIDEN=0
FSIDEN=0 fH off FSIDEN=1
fH off fSUB off fH off
fSUB off fSUB on
IDLE2 IDLE1
PWDN=0 PWDN=0
LDO on LDO on
HALT instruction executed HALT instruction executed
CPU stop CPU stop
FHIDEN=1 FHIDEN=1
FSIDEN=0 FSIDEN=1
fH on fH on
fSUB off fSUB on
NORMAL Mode
PWDN=0
CKS�~CKS0 = 111
SLOW Mode
SLEEP Mode
IDLE0 Mode
IDLE1 Mode
IDLE2 Mode
PWDN=1
HALT instruction is executed
SLOW Mode
PWDN=0
CKS�~CKS0 = 000~110
NORMAL Mode
SLEEP Mode
IDLE0 Mode
IDLE1 Mode
IDLE2 Mode
PWDN=1
HALT instruction is executed
IO_ISO_EN=1
(I/O will be latched and
remain unchanged)
PWDN=1
HALT
�CU enter
DEEP SLEEP �ode
Wake-up
To minimise power consumption the devices can enter the DEEP SLEEP, SLEEP or any IDLE
Modes, where the CPU will be switched off. However, when the device is woken up again, it will
take a considerable time for the original system oscillator to restart, stabilise and allow normal
operation to resume.
After the system enters the SLEEP or IDLE Mode, it can be woken up from one of various sources
listed as follows:
• An external falling edge on Port A
• A system interrupt
• A WDT overflow
After the system enters the DEEP SLEEP Mode, it can be woken up from one of two sources listed
as follows:
• An external falling edge on Port A
• A Time Base 0 interrupt
When the device executes the “HALT” instruction, the PDF flag will be set to 1. The PDF flag will
be cleared to 0 if the device experiences a system power-up or executes the clear Watchdog Timer
instruction. If the system is woken up by a WDT overflow, a Watchdog Timer reset will be initiated
and the TO flag will be set to 1. The TO flag is set if a WDT time-out occurs and causes a wake-up
that only resets the Program Counter and Stack Pointer, 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 pin wakes-up the system from the SLEEP or IDLE Mode, the
program will resume execution at the instruction following the “HALT” instruction. However, when
a pin wakes-up the system from the DEEP SLEEP Mode, the program will resume execution from
0000h.
If the system is woken up from the SLEEP or IDLE Mode 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 the system is woken up
from the DEEP SLEEP Mode by the Time Base 0 interrupt, the program will resume execution from
0000h.
If an interrupt request flag is set high before entering the DEEP SLEEP, SLEEP or IDLE Mode, the
wake-up function of the related interrupt will be disabled.
The accompany flowchart shows the program procedure for waking up from the DEEP SLEEP
Mode.
Wake-up b� PA or TB0
IO_ISO_EN=0
(I/O will be released)
Program Execution
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
RSTFC Register
Bit 7 6 5 4 3 2 1 0
Name — — — — RSTF LVRF LRF WRF
R/W — — — — R/W R/W R/W R/W
POR — — — — 0 x 0 0
“x”: unknown
Bit 7~4 Unimplemented, read as “0”
Bit 3 RSTF: Reset control register software reset flag
Refer to Internal Reset Control section.
Bit 2 LVRF: LVR function reset flag
Refer to in the Low Voltage Reset section.
Bit 1 LRF: LVR control register software reset flag
Refer to in the Low Voltage Reset section.
Bit 0 WRF: WDT control register software reset flag
0: Not occurred
1: Occurred
This bit is set to 1 by the WDT Control register software reset and cleared by the
application program. Note that this bit can only be cleared to 0 by the application
program.
Under normal program operation, a Watchdog Timer time-out will initialise a device reset and set
the status bit TO. However, if the system is in the DEEP SLEEP, SLEEP or IDLE Mode, when a
Watchdog Timer time-out occurs, the TO bit in the status register will be set and only the Program
Counter and Stack Pointer will be reset. Three methods can be adopted to clear the contents of the
Watchdog Timer. The first is a WDT reset, which means a certain value except 01010B and 10101B
written into the WE4~WE0 bits, the second is using the Watchdog Timer software clear instruction,
the third is via a HALT instruction. There is only one method of using software instruction to clear
the Watchdog Timer. That is to use the single “CLR WDT” instruction to clear the WDT.
The maximum time-out period is when the 218 division ratio is selected. As an example, with a
32kHz LIRC oscillator as its source clock, this will give a maximum watchdog period of around 8
second for the 218 division ratio, and a minimum timeout of 8ms for the 28 division ration.
“HALT”Instruction CLR
“CLR WDT”Instruction
fLIRC fLIRC/�8
LIRC 8-stage Divider WDT Prescaler
Reset Functions
There are several 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
VDD Power On
3/5V POR
1.5V POR
• RSTC Register
Bit 7 6 5 4 3 2 1 0
Name RSTC7 RSTC6 RSTC5 RSTC4 RSTC3 RSTC2 RSTC1 RSTC0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 1 0 1 0 1 0 1
• RSTFC Register
Bit 7 6 5 4 3 2 1 0
Name — — — — RSTF LVRF LRF WRF
R/W — — — — R/W R/W R/W R/W
POR — — — — 0 x 0 0
“x”: unknown
Bit 7~4 Unimplemented, read as “0”
Bit 3 RSTF: Reset control register software reset flag
0: Not occurred
1: Occurred
This bit is set to 1 by the RSTC control register software reset and cleared by the
application program. Note that this bit can only be cleared to 0 by the application
program.
Bit 2 LVRF: LVR function reset flag
Refer to the Low Voltage Reset section.
Bit 1 LRF: LVR control register software reset flag
Refer to the Low Voltage Reset section.
Bit 0 WRF: WDT control register software reset flag
Refer to the Watchdog Timer Control Register section.
LVR
tRSTD + tSST
Internal Reset
• LVRC Register
Bit 7 6 5 4 3 2 1 0
Name LVS7 LVS6 LVS5 LVS4 LVS3 LVS2 LVS1 LVS0
R/W R/W R/W R/W R/W R/W R/W R/W R/W
POR 0 1 0 1 0 1 0 1
IAP Reset
The IAP reset is caused by writing data 55H to the FC1 register.
WDT Time-out
tRSTD + tSST
Internal Reset
WDT Time-out
tSST
Internal Reset
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.
BC68F2130
BC68F2140
WDT Time-out WDT Time-out
Register Power On Reset
(Normal Operation) (HALT)
BC68F2130
BC68F2140
WDT Time-out WDT Time-out
Register Power On Reset
(Normal Operation) (HALT)
BC68F2130
BC68F2140
WDT Time-out WDT Time-out
Register Power On Reset
(Normal Operation) (HALT)
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~PB. 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
PA — — PA5 PA4 PA3 PA2 PA1 PA0
PAC — — PAC5 PAC4 PAC3 PAC2 PAC1 PAC0
PAPU — — PAPU5 PAPU4 PAPU3 PAPU2 PAPU1 PAPU0
PAWU — — PAWU5 PAWU4 PAWU3 PAWU2 PAWU1 PAWU0
PB — — PB5 PB4 — — — —
PBC — — PBC5 PBC4 — — — —
PBPU — — PBPU5 PBPU4 — — — —
“—”: Unimplemented, read as “0”
I/O Logic Function Registers List – BC68F2130
Register Bit
Name 7 6 5 4 3 2 1 0
PA PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0
PAC PAC7 PAC6 PAC5 PAC4 PAC3 PAC2 PAC1 PAC0
PAPU PAPU7 PAPU6 PAPU5 PAPU4 PAPU3 PAPU2 PAPU1 PAPU0
PAWU PAWU7 PAWU6 PAWU5 PAWU4 PAWU3 PAWU2 PAWU1 PAWU0
PB — — PB5 PB4 PB3 PB2 PB1 PB0
PBC — — PBC5 PBC4 PBC3 PBC2 PBC1 PBC0
PBPU — — PBPU5 PBPU4 PBPU3 PBPU2 PBPU1 PBPU0
“—”: Unimplemented, read as “0”
I/O Logic Function Registers List – BC68F2140
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, namely PAPU~PBPU, and are implemented using
weak PMOS transistors.
Note that the pull-high resistor can be controlled by the relevant pull-high control register only
when the pin-shared functional pin is selected as an input or NMOS output. Otherwise, the pull-high
resistors cannot be enabled.
PxPU Register
Bit 7 6 5 4 3 2 1 0
Name PxPU7 PxPU6 PxPU5 PxPU4 PxPU3 PxPU2 PxPU1 PxPU0
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 DEEP SLEEP, SLEEP or IDLE Mode
which preserves power, a feature that is important for battery and other low-power applications.
Various methods exist to wake-up the microcontroller, one of which is to change the logic condition
on one of the Port A pins from high to low. This function is especially suitable for applications that
can be woken up via external switches. Each pin on Port A can be selected individually to have this
wake-up feature using the PAWU register.
Note that the wake-up function can be controlled by the wake-up control registers only when the
pin-shared functional pin is selected as general purpose input/output and the MCU enters the DEEP
SLEEP, SLEEP or IDLE mode.
PAWU Register
Bit 7 6 5 4 3 2 1 0
Name PAWU7 PAWU6 PAWU5 PAWU4 PAWU3 PAWU2 PAWU1 PAWU0
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
PxC Register
Bit 7 6 5 4 3 2 1 0
Name PxC7 PxC6 PxC5 PxC4 PxC3 PxC2 PxC1 PxC0
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 these pins, the
desired function of the multi-function I/O pins is selected by a series of registers via the application
program control.
The most important point to note is to make sure that the desired pin-shared function is properly
selected and also deselected. For most pin-shared functions, to select the desired pin-shared function,
the pin-shared function should first be correctly selected using the corresponding pin-shared control
register. After that the corresponding peripheral functional setting should be configured and then
the peripheral function can be enabled. However, special point must be noted for some digital input
pins, such as INTn, xTCKn, xTPnI, etc, which share the same pin-shared control configuration with
their corresponding general purpose I/O functions when setting the revelant pin-shared control bit
fields. To select these pin functions, in addition to the necessary pin-shared control and peripheral
functional setup forementioned, they must also be setup as input by setting the corresponding bit in
the I/O port control register. To correctly deselect the pin-shared function, the peripheral function
should first be disabled and then the corresponding pin-shared function control register can be
modified to select other pin-shared functions.
Bit
Register Name
7 6 5 4 3 2 1 0
PAS0 PAS07 PAS06 PAS05 PAS04 PAS03 PAS02 PAS01 PAS00
PAS1 (BC68F2130) — — — — PAS13 PAS12 PAS11 PAS10
PAS1 (BC68F2140) — — PAS15 PAS14 PAS13 PAS12 PAS11 PAS10
Pin-shared Function Selection Registers List
VDD
Pull-high
Control Bit Register Weak
Select Pull-up
Data Bus D Q
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 are then programmed to setup some
pins as outputs, these output pins will have an initial high output value unless the associated port
data registers are first programmed. Selecting which pins are inputs and which are outputs can be
achieved byte-wide by loading the correct values into the appropriate port control register or by
programming individual bits in the port control register using the “SET [m].i” and “CLR [m].i”
instructions. Note that when using these bit control instructions, a read-modify-write operation takes
place. The microcontroller must first read in the data on the entire port, modify it to the required new
bit values and then rewrite this data back to the output ports.
Port A has the additional capability of providing wake-up function. When the device is in the DEEP
SLEEP, 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 Modules – TM
One of the most fundamental functions in any microcontroller device is the ability to control and
measure time. To implement time related functions each device includes several Timer Modules,
abbreviated to the name TM. The TMs are multi-purpose timing units and serve to provide
operations such as Timer/Counter, Input Capture, Compare Match Output and Single Pulse Output
as well as being the functional unit for the generation of PWM signals. Each of the TMs has two
individual interrupts. The addition of input and output pins for each TM ensures that users are
provided with timing units with a wide and flexible range of features.
The common features of the different TM types are described here with more detailed information
provided in the individual Compact and Periodic TM sections.
Introduction
Each of the devices contains two TMs and each individual TM can be categorised as a certain type,
namely Compact Type TM or Periodic Type TM. Although similar in nature, the different TM types
vary in their feature complexity. The common features to all of the Compact and Periodic TMs
will be described in this section. The detailed operation regarding each of the TM types will be
described in separate sections. The main features and differences between the two types of TMs are
summarised in the accompanying table.
Function CTM PTM
Timer/Counter √ √
Input Capture — √
Compare Match Output √ √
PWM Channels 1 1
Single Pulse Output — 1
PWM Alignment Edge Edge
PWM Adjustment Period & Duty Duty or Period Duty or Period
TM Function Summary
CTM PTM
10-bit CTM 10-bit PTM
TM Name/Type Reference
TM Operation
The different types of TM offer a diverse range of functions, from simple timing operations to
PWM signal generation. The key to understanding how the TM operates is to see it in terms of
a free running counter whose value is then compared with the value of pre-programmed internal
comparators. When the free running counter has the same value as the pre-programmed comparator,
known as a compare match situation, a TM interrupt signal will be generated which can clear the
counter and perhaps also change the condition of the TM output pin. The internal TM counter is
driven by a user selectable clock source, which can be an internal clock or an external pin.
TM Clock Source
The clock source which drives the main counter in each TM can originate from various sources. The
selection of the required clock source is implemented using the xTCK2~xTCK0 bits in the xTM
control registers, where “x” stands for C or P type TM. The clock source can be a ratio of the system
clock fSYS or the internal high clock fH, the fSUB clock source or the external xTCK pin. The xTCK
pin clock source is used to allow an external signal to drive the TM as an external clock source or
for event counting.
TM Interrupts
The Compact and Periodic type TMs each have two internal interrupts, one for each of the internal
comparator A or comparator P, which generate a TM interrupt when a compare match condition
occurs. When a TM interrupt is generated it can be used to clear the counter and also to change the
state of the TM output pin.
TM External Pins
Each of the TMs, irrespective of what type, has one TM input pin, with the label xTCK. The xTM
input pin, xTCK, is essentially a clock source for the xTM and is selected using the xTCK2~xTCK0
bits in the xTMC0 register. This external TM input pin allows an external clock source to drive the
internal TM. The xTCK input pin can be chosen to have either a rising or falling active edge. The
PTCK pin is also used as the external trigger input pin in single pulse output mode.
For the PTM, there is other input pin, PTPI. It is the capture input whose active edge can be a rising
edge, a falling edge or both rising and falling edges and the active edge transition type is selected
using the PTIO1~PTIO0 bits in the PTMC1 register. There is another capture input, PTCK, for PTM
capture input mode, which can be used as the external trigger input source except the PTPI pin.
The TMs each have two output pins with the label xTP and xTPB. When the TM is in the Compare
Match Output Mode, these pins can be controlled by the TM to switch to a high or low level or to
toggle when a compare match situation occurs. The external xTP and xTPB output pins are also the
pins where the TM generates the PWM output waveform. As the TM input and output pins are pin-
shared with other functions, the TM input and output functions must first be setup using the relevant
pin-shared function selection bits described in the Pin-shared Function section.
CTM PTM
Input Output Input Output
CTCK CTP, CTPB PTCK, PTPI PTP, PTPB
TM External Pins
CTCK
CTM
CCR output
CTP
CTPB
PTCK
CCR capture input
PTPI
PTM
CCR output
PTP
PTPB
Programming Considerations
The TM Counter Registers and the Capture/Compare CCRA and CCRP registers, all have a low
and high byte structure. The high bytes can be directly accessed, but as the low bytes can only be
accessed via an internal 8-bit buffer, reading or writing to these register pairs must be carried out in
a specific way. The important point to note is that data transfer to and from the 8-bit buffer and its
related low byte only takes place when a write or read operation to its corresponding high byte is
executed.
As the CCRA and CCRP registers are implemented in the way shown in the following diagram and
accessing these register pairs is carried out in a specific way as described above, it is recommended
to use the “MOV” instruction to access the CCRA and CCRP low byte registers, named xTMAL and
PTMRPL, using the following access procedures. Accessing the CCRA or CCRP low byte registers
without following these access procedures will result in unpredictable values.
xT�DL xT�DH
8-bit Buffer
xT�AL xT�AH
PT�RPL PT�RPH
Data Bus
––Here data is written directly to the high byte registers and simultaneously data is latched
from the 8-bit buffer to the Low Byte registers.
• Reading Data from the Counter Registers and or CCRA
♦♦ Step 1. Read data from the High Byte xTMDH, xTMAH or PTMRPH
––Here data is read directly from the High Byte registers and simultaneously data is latched
from the Low Byte register into the 8-bit buffer.
♦♦ Step 2. Read data from the Low Byte xTMDL, xTMAL or PTMRPL
CCRP
Comparator P �atch
3-bit Comparator P CT�PF Interrupt
fSYS/4 000
fSYS 001 CTOC
b�~b�
fH/16 010
fH/64 011 Counter Clear 0 Output Polarit� CTP
10-bit Count-up Counter Pin Control
fSUB 100 1 Control Control CTPB
fSUB 101
CTON CTCCLR
110 CTPAU b0~b�
CT�1� CT�0 CTPOL PASn
CTCK 111 CTIO1� CTIO0
Comparator A �atch
10-bit Comparator A CT�AF Interrupt
CTCK�~CTCK0
CCRA
Compact TM Operation
At its core is a 10-bit count-up counter which is driven by a user selectable internal or external clock
source. There are also two internal comparators with the names, Comparator A and Comparator
P. These comparators will compare the value in the counter with CCRP and CCRA registers. The
CCRP is three bits wide whose value is compared with the highest three bits in the counter while the
CCRA is the ten bits and therefore compares with all counter bits.
The only way of changing the value of the 10-bit counter using the application program, is to
clear the counter by changing the CTON bit from low to high. The counter will also be cleared
automatically by a counter overflow or a compare match with one of its associated comparators.
When these conditions occur, a CTM interrupt signal will also usually be generated. The Compact
Type TM can operate in a number of different operational modes, can be driven by different clock
sources including an input pin and can also control two output pins. All operating setup conditions
are selected using relevant internal registers.
Register Bit
Name 7 6 5 4 3 2 1 0
CTMC0 CTPAU CTCK2 CTCK1 CTCK0 CTON CTRP2 CTRP1 CTRP0
CTMC1 CTM1 CTM0 CTIO1 CTIO0 CTOC CTPOL CTDPX CTCCLR
CTMDL D7 D6 D5 D4 D3 D2 D1 D0
CTMDH — — — — — — D9 D8
CTMAL D7 D6 D5 D4 D3 D2 D1 D0
CTMAH — — — — — — D9 D8
10-bit Compact TM Register List
CTMC0 Register
Bit 7 6 5 4 3 2 1 0
Name CTPAU CTCK2 CTCK1 CTCK0 CTON CTRP2 CTRP1 CTRP0
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
CTMC1 Register
Bit 7 6 5 4 3 2 1 0
Name CTM1 CTM0 CTIO1 CTIO0 CTOC CTPOL CTDPX CTCCLR
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
This is the output control bit for the CTM output pin. Its operation depends upon
whether CTM is being used in the Compare Match Output Mode or in the PWM
Output Mode. It has no effect if the CTM is in the Timer/Counter Mode. In the
Compare Match Output Mode it determines the logic level of the CTM output pin
before a compare match occurs. In the PWM Output Mode it determines if the PWM
signal is active high or active low.
Bit 2 CTPOL: CTP Output polarity Control
0: Non-invert
1: Invert
This bit controls the polarity of the CTP output pin. When the bit is set high the CTM
output pin will be inverted and not inverted when the bit is zero. It has no effect if the
CTM is in the Timer/Counter Mode.
Bit 1 CTDPX: CTM PWM period/duty Control
0: CCRP - period; CCRA - duty
1: CCRP - duty; CCRA - period
This bit, determines which of the CCRA and CCRP registers are used for period and
duty control of the PWM waveform.
Bit 0 CTCCLR: Select CTM Counter clear condition
0: CTM Comparatror P match
1: CTM Comparatror A match
This bit is used to select the method which clears the counter. Remember that the
Compact TM contains two comparators, Comparator A and Comparator P, either of
which can be selected to clear the internal counter. With the CTCCLR bit set high,
the counter will be cleared when a compare match occurs from the Comparator A.
When the bit is low, the counter will be cleared when a compare match occurs from
the Comparator P or with a counter overflow. A counter overflow clearing method can
only be implemented if the CCRP bits are all cleared to zero. The CTCCLR bit is not
used in the PWM Output Mode.
CTMDL 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 D7~D0: CTM Counter Low Byte Register bit 7 ~ bit 0
CTM 10-bit Counter bit 7 ~ bit 0
CTMDH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R R
POR — — — — — — 0 0
CTMAL 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
Bit 7~0 D7~D0: CTM CCRA Low Byte Register bit 7 ~ bit 0
CTM 10-bit CCRA bit 7 ~ bit 0
CTMAH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
Time
CTON
CTPAU
CTPOL
CCRP Int.
flag CT�PF
CCRA Int.
flag CT�AF
CCRP
Time
CTON
CTPAU
CTPOL
No CT�AF flag
generated on
CCRA overflow
CCRA Int.
flag CT�AF
CCRP Int.
flag CT�PF
CT�PF not Output does
generated not change
CT� O/P Pin
Output not affected b�
CT�AF flag. Remains High Output Inverts
Output Toggle
Output pin set to until reset b� CTON bit when CTPOL is high
with CT�AF flag Output Pin
initial Level Low if Reset to Initial value
CTOC=0 Note CTIO [1:0] = 10
Here CTIO [1:0] = 11 Active High Output select Output controlled b� other
Toggle Output select pin-shared function
Timer/Counter Mode
To select this mode, bits CTM1 and CTM0 in the CTMC1 register should be set to 11 respectively.
The Timer/Counter Mode operates in an identical way to the Compare Match Output Mode
generating the same interrupt flags. The exception is that in the Timer/Counter Mode the CTM
output pin is not used. Therefore the above description and Timing Diagrams for the Compare
Match Output Mode can be used to understand its function. As the CTM output pin is not used in
this mode, the pin can be used as a normal I/O pin or other pin-shared function.
The PWM output period is determined by the CCRA register value together with the CTM clock
while the PWM duty cycle is defined by the CCRP register value.
Time
CTON
CTPAU
CTPOL
CCRA Int.
flag CT�AF
CCRP Int.
flag CT�PF
Counter Value
CTDPX = 1; CTM [1:0] = 10
Counter cleared b�
CCRA
Counter Reset when
CTON returns high
CCRA
Counter Stop if
Pause Resume
CTON bit low
CCRP
Time
CTON
CTPAU
CTPOL
CCRP Int.
flag CT�PF
CCRA Int.
flag CT�AF
CCRP
Comparator P �atch
10-bit Comparator P PT�PF Interrupt
fSYS/4 000
fSYS 001 PTOC
b0~b�
fH/16 010
fH/64 011 Counter Clear 0 Output Polarit� Pin PTP
10-bit Count-up Counter
fSUB 100 1 Control Control Control PTPB
fSUB 101 PTON PTCCLR
110 PTPAU b0~b� PT�1� PT�0 PTPOL PAS0
PTCK 111 PTIO1� PTIO0
Comparator A �atch
10-bit Comparator A PT�AF Interrupt
PTCK�~PTCK0
PTIO1� PTIO0 PAS0
PTCAPTS
Edge Pin
CCRA
0
Control PTPI
Detector 1
Periodic TM Operation
The Periodic Type TM core is a 10-bit count-up counter which is driven by a user selectable internal
or external clock source. There are also two internal comparators with the names, Comparator A
and Comparator P. These comparators will compare the value in the counter with CCRP and CCRA
registers. The CCRP and CCRA comparators are 10-bit wide whose value is respectively compared
with all counter bits.
The only way of changing the value of the 10-bit counter using the application program, is to
clear the counter by changing the PTON bit from low to high. The counter will also be cleared
automatically by a counter overflow or a compare match with one of its associated comparators.
When these conditions occur, a PTM interrupt signal will also usually be generated. The Periodic
Type TM can operate in a number of different operational modes, can be driven by different clock
sources including an input pin and can also control more than one output pins. All operating setup
conditions are selected using relevant internal registers.
Register Bit
Name 7 6 5 4 3 2 1 0
PTMC0 PTPAU PTCK2 PTCK1 PTCK0 PTON — — —
PTMC1 PTM1 PTM0 PTIO1 PTIO0 PTOC PTPOL PTCAPTS PTCCLR
PTMDL D7 D6 D5 D4 D3 D2 D1 D0
PTMDH — — — — — — D9 D8
PTMAL D7 D6 D5 D4 D3 D2 D1 D0
PTMAH — — — — — — D9 D8
PTMRPL PTRP7 PTRP6 PTRP5 PTRP4 PTRP3 PTRP2 PTRP1 PTRP0
PTMRPH — — — — — — PTRP9 PTRP8
10-bit Periodic TM Registers List
PTMC0 Register
Bit 7 6 5 4 3 2 1 0
Name PTPAU PTCK2 PTCK1 PTCK0 PTON — — —
R/W R/W R/W R/W R/W R/W — — —
POR 0 0 0 0 0 — — —
PTMC1 Register
Bit 7 6 5 4 3 2 1 0
Name PTM1 PTM0 PTIO1 PTIO0 PTOC PTPOL PTCAPTS PTCCLR
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
PTMDL 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 D7~D0: PTM Counter Low Byte Register bit 7 ~ bit 0
PTM 10-bit Counter bit 7 ~ bit 0
PTMDH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R R
POR — — — — — — 0 0
PTMAL 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
Bit 7~0 D7~D0: PTM CCRA Low Byte Register bit 7 ~ bit 0
PTM 10-bit CCRA bit 7 ~ bit 0
PTMAH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — D9 D8
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
PTMRPL Register
Bit 7 6 5 4 3 2 1 0
Name PTRP7 PTRP6 PTRP5 PTRP4 PTRP3 PTRP2 PTRP1 PTRP0
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
Bit 7~0 PTRP7~PTRP0: PTM CCRP Low Byte Register bit 7 ~ bit 0
PTM 10-bit CCRP bit 7 ~ bit 0
PTMRPH Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — PTRP9 PTRP8
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
Time
PTON
PTPAU
PTPOL
CCRP Int.
Flag PT�PF
CCRA Int.
Flag PT�AF
CCRP
Time
PTON
PTPAU
PTPOL
No PT�AF flag
generated on
CCRA overflow
CCRA Int.
Flag PT�AF
CCRP Int.
Flag PT�PF
Timer/Counter Mode
To select this mode, bits PTM1 and PTM0 in the PTMC1 register should be set to 11 respectively.
The Timer/Counter Mode operates in an identical way to the Compare Match Output Mode
generating the same interrupt flags. The exception is that in the Timer/Counter Mode the TM output
pin is not used. Therefore the above description and Timing Diagrams for the Compare Match
Output Mode can be used to understand its function. As the PTM output pins are not used in this
mode, the pins can be used as normal I/O pins or other pin-shared functions.
Time
PTON
PTPAU
PTPOL
CCRA Int.
Flag PT�AF
CCRP Int.
Flag PT�PF
CCRA CCRA
Leading Edge Trailing Edge
S/W Command S/W Command
SET“PTON” PTON bit PTON bit CLR“PTON”
or or
0 1 1 0
PTCK Pin CCRA Compare
Transition �atch
Time
PTON
Auto. set b�
Software Cleared b� PTCK pin Software
Trigger CCRA match Software Software Software Trigger
Trigger Trigger Clear
PTCK pin
PTCK pin
PTPAU Trigger
PTPOL
No CCRP
CCRP Int. Interrupts
Flag PT�PF generated
CCRA Int.
Flag PT�AF
YY Resume
Pause
XX
Time
PTON
PTPAU
Active Active Active
edge edge edge
CCRA Int.
Flag PT�AF
CCRP Int.
Flag PT�PF
CCRA XX YY XX YY
Value
PTIO [1:0] 00 – Rising edge 01 – Falling edge 10 – Both edges 11 – Disable Capture
Value
RF Transmitter
The RF transmitter is a fully integrated transmitter, which is capable of using both Frequency-
Shift Keying (FSK) and On-Off Keying (OOK) modulation modes for data streaming. It has
two main operating modes, Burst Mode and Direct Mode. The RF transmitter operates in the
315/433/868/915MHz frequency bands.
Register Bit
Name 7 6 5 4 3 2 1 0
RF_PWR — — — — — — — RF_PDB
RF_OPER — — FSK_EN DIR_EN — — — TX_STROBE
RF_CLK1 XCLK_EN XCLKINV — XCLKD2 — — — RST_RF
RF_CLK2 DTR7 DTR6 DTR5 DTR4 DTR3 DTR2 DTR1 DTR0
RF_FIFO_CTRL1 FFDATA7 FFDATA6 FFDATA5 FFDATA4 FFDATA3 FFDATA2 FFDATA1 FFDATA0
RF_FIFO_CTRL2 FFLEN7 FFLEN6 FFLEN5 FFLEN4 FFLEN3 FFLEN2 FFLEN1 FFLEN0
RF_FIFO_CTRL3 RST_TX_FF FFSA6 FFSA5 FFSA4 FFSA3 FFSA2 FFSA1 FFSA0
RF_FIFO_CTRL4 DTXD — — — TXFFLT FFMG_EN FFMG1 FFMG0
RF_MOD1 FDEV7 FDEV6 FDEV5 FDEV4 FDEV3 FDEV2 FDEV1 FDEV0
RF_MOD2 — — — — — FTEV10 FTEV9 FTEV8
RF_OPMOD — — — — — ACAL_EN TX_EN SX_EN
RF_SX1 — DN6 DN5 DN4 DN3 DN2 DN1 DN0
RF_SX2 DK7 DK6 DK5 DK4 DK3 DK2 DK1 DK0
RF_SX3 DK15 DK14 DK13 DK12 DK11 DK10 DK9 DK8
RF_SX4 — — — — DK19 DK18 DK17 DK16
RF_CP3 DLY_SYN2 DLY_SYN1 DLY_SYN0 D4 D3 D2 D1 D0
RF_OD1 D7 D6 D5 D4 D3 D2 D1 D0
RF_OD3 — — DLY_SXPD1 DLY_SXPD0 — D2 D1 D0
RF_VCO1 VCO_SWHB D6 D5 D4 D3 D2 D1 D0
Register Bit
Name 7 6 5 4 3 2 1 0
RF_VCO2 DFCSF — VCO_DFC4 VCO_DFC3 VCO_DFC2 VCO_DFC1 VCO_DFC0 DFC_OW
RF_TX2 CT_PAD3 CT_PAD2 CT_PAD1 CT_PAD0 — CT_TXLDO1 CT_TXLDO0 D0
RF_DFC_CAL CT_MMDLDO1 CT_MMDLDO0 — D4 D3 D2 D1 D0
RF_LDO D7 D6 D5 D4 D3 D2 D1 D0
RF_XO1 XSHIFT1 XSHIFT0 — XO_TRIM4 XO_TRIM3 XO_TRIM2 XO_TRIM1 XO_TRIM0
RF_XO2 — D6 D5 — XODIV2 XO_SEL2 XO_SEL1 XO_SEL0
Most of the RF transmitter control register details will be described in this section, however several
registers will be described in their respective other sections.
Bit 7 XCLK_EN: Clock auto gating for the RF internal digital circuit
0: Disable
1: Enable
Writing data to the FIFO requires enabling XCLK. The XCLK_EN bit should be
cleared before the RF circuit enters the power down mode with the RF_PDB bit
cleared, this will prevent XCLK clock glitch from occurring and guarantee that the
XCLK domain register will not affected by the clock lost.
Bit 6 XCLKINV: XCLK clock invert control
0: XCLK clock does not invert
1: XCLK clock inverts
Bit 5 Unimplemented, read as “0”
Bit 4 XCLKD2: XCLK clock divided by 2 control
0: XCLK clock is not divided by 2
1: XCLK clock is divided by 2
It is recommended to clear this bit to zero.
Bit 3~1 Unimplemented, read as “0”
Bit 0 RST_RF: Reset RF control register
0: Self-clear RF control register is complete
1: Reset RF control register
When this bit is set to 1, all RF associated registers except the RF_PWR register will
be reset. It needs one instruction cycle to complete the self-clear enable action. Do not
set the RST_RF bit high in two continuous instructions.
This register is used to control the multi-mode divider and output division in the RF circuitry. Note
that different setting values should be written into this register for different RF frequency band
applications. The recommended setting values are summarised in the following.
RF Frequency Band 315MHz 433MHz 868/915MHz
RF_OD1 Setting Values 08H 04H 00H
Note that different setting values should be written into this register for different RF frequency band
applications. The recommended setting values are summarized in the following.
RF Frequency Band 315MHz 433MHz 868/915MHz
RF_VCO1 Setting Values 90H 10H 10H
This bit is used to select the VCO DFC curve trim value source. When this bit is set
to 0, the VCO DFC curve trim value will be derived from the auto calibration result
regardless of the VCO_DFC bit field value. However, the VCO DFC curve trim value
will be determined by the VCO_DFC bit field value rather than the auto calibration
result when this bit is set to 1. When this bit is set to 0, the VCO_DFC bit field will
return the auto calibration result for the VCO DFC curve trim value if a VCO_DFC
field read operation is executed.
Two examples for implementing a DFC calibration are provided below.
• Implement DFC calibration after each power on condition
Step 1: System power on reset, DFC_OW=0 and RF_PDB=0 by default option
Step 2: Set ACAL_EN=1 to enable the auto DFC calibration, and wait until ACAL_EN is cleared to 0
Step 3: RF enters power down mode because RF_PDB=0
Step 4: RF is powered on by setting RF_PDB=1 and keep DFC_OW=0
Step 5: Set ACAL_EN=1 to enable the auto DFC calibration, and wait until ACAL_EN is cleared to 0
• Implement DFC calibration only after a system power on reset
Step 1: System power on reset, DFC_OW=0 and RF_PDB=0 by default option
Step 2: RF is powered on by setting RF_PDB=1
Step 3: Set ACAL_EN=1 to enable the auto DFC calibration, and wait until ACAL_EN is cleared to 0
Step 4: Backup VCO_DFC[4:0] to RAM
Step 5: RF enters power down mode by setting RF_PDB=0
Step 6: RF is powered on by setting RF_PDB=1 and keep DFC_OW=0
Step 7: Restore VCO_DFC[4:0] from RAM
Step 8: Set DFC_OW=1
This register is used to control the overall LDO functions for the RF synthesizer and VCO circuitry.
Note that different setting values should be written into this register for different RF frequency band
applications. The recommended setting values are summarised in the following.
RF Frequency Band 315MHz 433MHz 868/915MHz
RF_LDO Setting Values 18H 18H 14H
Bit 7 XSHIFT[1:0]: Internal capacitor load coarse shift for the crystal oscillator
Capacitor step = 4.5pF, XSHIFT field value = 0 ~ 3
Total Capacitor load≈7 + XSHIFT[1:0]×4.5 + XO_TRIM[4:0]×0.2, unit: pF
Bit 5 Unimplemented, read as “0”
Bit 4~0 XO_TRIM[5:0]: Internal capacitor load trim value for the crystal oscillator
Capacitor step = 0.2pF, XO_TRIM field value = 0 ~ 31
Total Capacitor load≈7 + XSHIFT[1:0]×4.5 + XO_TRIM[4:0]×0.2, unit: pF
RF_XO2 Register – RF XO Control Register 2
Bit 7 6 5 4 3 2 1 0
Name — D6 D5 — XODIV2 XO_SEL2 XO_SEL1 XO_SEL0
R/W — R/W R/W — R/W R/W R/W R/W
POR — 0 1 — 0 0 1 1
Bit 7~0 FFLEN7~FFLEN0: TX data length (used for Burst mode only)
The number of data bytes to be transmitted is FFLEN[7:0]+1. In the Simple FIFO
mode and Block FIFO mode, the FFLEN[7:0] is limited to 7Fh. Users should not set
this register to be greater than this value.
RF Channel Setup
The RF channel setup is implemented using four registers, the RF_SX1 ~ RF_SX4 registers.
Bit 7~0 DK7~DK0: Low byte of 20-bit fractional of dividend for MMD
Set an initial value to implement XO=16MHz and TX band=433.92MHz.
Bit 7~0 DK15~DK8: Middle byte of 20-bit fractional of dividend for MMD
Set an initial value to implement XO=16MHz and TX band=433.92MHz.
7. Set DIR_EN=0 to select the Burst Mode, set FSK_EN=0(OOK)/1(FSK), set TX_STROBE=1
to start the transmission. Then the data in FIFO will be automatically transfered to the RFOUT
pin with FSK or OOK modulation.
8. Poll the TX_STROBE bit until it is cleared to 0 by hardware. When the TX_STROBE bit
equals to 1, any write accesses to RF configuration registers are not allowed.
9. If users want to resend the previous data, just check the TX_STROBE bit, when it is in a low
state set it to 1 again to initial another transmission.
10. If TX_STROBE is in a high state and users want to forcely terminate this transmission, just
set the TX_STROBE to low then wait at least 1μs to let the state machine turn off the Power
Amplifier Driver. Then users can re-set TX_STROBE to start a new transmission.
11. Set XCLK_EN=0 then clear RF_PDB to low to turn off the RF circuit.
• Direct Mode:
1. Set the XO_SEL[2:0], XODIV2 and XCLKD2 bits properly according to the selected crystal
oscillator.
2. Set the RF_PDB bit to 1 and the RF circuit will start to operate with the XCLK clock since the
XCLK_EN bit has a default value of 1.
3. If HXT is selected as the system clock source, check the HXTF bit. When this bit is equal to
1 this indicates that the MCU clock is ready. The MCU can use the XCLK_MCU clock as its
main clock.
4. Set the RF related configuration registers.
5. If it is the first time to power up or the operation environment has large variations, set the
ACAL_EN bit in the RF_OPMOD register to start the auto calibration process and poll this
bit to wait for the end of the calibration process. Read the value of the VCO_DFC[4:0] bits in
the RF_VCO2 register and store it in backup RAM. This action is to save the calibration time
when the MCU or RF circuit enters the power down mode. This data will be restored to VCO_
DFC[4:0] by a write access to this bit field. Then set the DFC_OW bit in the same register to 1
to force the DFC to select this curve.
6. Write the DTXD bit with the first data bit to be transmitted. Set FDEV[10:0] for the frequency
deviation in the FSK mode.
7. Set DIR_EN=1 to select the Direct Mode, set FSK_EN=0(OOK)/1(FSK).
8. Set the SX_EN bit to enable all the synthesizer block functions and implement a delay time to
wait for the synthesizer to stabilise.
9. Set the TX_EN bit to enable the Power Amplifier block function and then start to transmit data
via the RFOUT pin.
10. Continue to update the DTXD bit with a desired data rate until all data transmissions are
completed.
11. Set TX_EN=0 and delay 1μs, then set SX_EN=0.
12. Set XCLK_EN=0 then clear RF_PDB to low to turn off the RF circuit.
Note: When in the Direct Mode and a data transfer has completed, to allow the RF circuit to enter
the power down mode to save power consumption, users must configure the related bits in the
correct order as described in step11 and step12, otherwise an undesirable standby current will
be generated.
RF_PDB=1
DIR_EN=1
SX_EN=1
RF Power On Sequence
Delay 10us
SX_EN=0
DIR_EN=0
RF_PDB=0
Registers Initial
N
RF Transmit ?
RF Transmit Process
RF Transmitter Process
Interrupts
Interrupts are an important part of any microcontroller system. When an external event or an
internal function such as a Timer Module requires microcontroller attention, their corresponding
interrupt will enforce a temporary suspension of the main program allowing the microcontroller to
direct attention to their respective needs. The device contains several external interrupt and internal
interrupt functions. The external interrupts are generated by the action of the external INT0~INT1
pins, while the internal interrupts are generated by various internal functions such as the TMs, LVD
and Timebase, 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 falls into three categories. The first is the
INTC0~INTC1 registers which setup the primary interrupts, the second is the MFI0~MFI2 registers
which setup the Multi-function interrupts. Finally there is an INTEG register to setup the external
interrupt trigger edge type.
Each register contains a number of enable bits to enable or disable individual registers as well as
interrupt flags to indicate the presence of an interrupt request. The naming convention of these
follows a specific pattern. First is listed an abbreviated interrupt type, then the (optional) number of
that interrupt followed by either an “E” for enable/disable bit or “F” for request flag.
Function Enable Bit Request Flag Notes
Global EMI — —
INTn Pin INTnE INTnF n=0 or 1
Time Base TBnE TBnF n=0 or 1
Multi-function MFInE MFInF n=0~2
LVD LVDE LVDF —
RF TX FIFO Length Margin Detect FFMGE FFMGF —
RF Burst Mode Transmit Complete BMTCE BMTCF —
CTMPE CTMPF
CTM —
CTMAE STMAF
PTMPE PTMPF
PTM —
PTMAE PTMAF
Interrupt Register Bit Naming Conventions
Register Bit
Name 7 6 5 4 3 2 1 0
INTEG — — — — INT1S1 INT1S0 INT0S1 INT0S0
INTC0 — TB0F INT1F INT0F TB0E INT1E INT0E EMI
INTC1 MFI2F MFI1F MFI0F TB1F MFI2E MFI1E MFI0E TB1E
MFI0 — — CTMAF CTMPF — — CTMAE CTMPE
MFI1 — — PTMAF PTMPF — — PTMAE PTMPE
MFI2 — LVDF FFMGF BMTCF — LVDE FFMGE BMTCE
Interrupt Registers List
INTEG Register
Bit 7 6 5 4 3 2 1 0
Name — — — — INT1S1 INT1S0 INT0S1 INT0S0
R/W — — — — R/W R/W R/W R/W
POR — — — — 0 0 0 0
INTC0 Register
Bit 7 6 5 4 3 2 1 0
Name — TB0F INT1F INT0F TB0E INT1E INT0E 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
INTC1 Register
Bit 7 6 5 4 3 2 1 0
Name MFI2F MFI1F MFI0F TB1F MFI2E MFI1E MFI0E TB1E
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
MFI0 Register
Bit 7 6 5 4 3 2 1 0
Name — — CTMAF CTMPF — — CTMAE CTMPE
R/W — — R/W R/W — — R/W R/W
POR — — 0 0 — — 0 0
MFI1 Register
Bit 7 6 5 4 3 2 1 0
Name — — PTMAF PTMPF — — PTMAE PTMPE
R/W — — R/W R/W — — R/W R/W
POR — — 0 0 — — 0 0
MFI2 Register
Bit 7 6 5 4 3 2 1 0
Name — LVDF FFMGF BMTCF — LVDE FFMGE BMTCE
R/W — R/W R/W R/W — R/W R/W R/W
POR — 0 0 0 — 0 0 0
Interrupt Operation
When the conditions for an interrupt event occur, such as a TM Comparator P or Comparator A
match etc., the relevant interrupt request flag will be set. Whether the request flag actually generates
a program jump to the relevant interrupt vector is determined by the condition of the interrupt enable
bit. 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.
Interrupt Structure
External Interrupts
The external interrupts are controlled by signal transitions on the pins INT0~INT1. An external
interrupt request will take place when the external interrupt request flags, INT0F~INT1F, are set,
which will occur when a transition, whose type is chosen by the edge select bits, appears on the
external interrupt pins. To allow the program to branch to its respective interrupt vector address,
the global interrupt enable bit, EMI, and respective external interrupt enable bit, INT0E~INT1E,
must first be set. Additionally the correct interrupt edge type must be selected using the INTEG
register to enable the external interrupt function and to choose the trigger edge type. As the external
interrupt pins are pin-shared with I/O pins, they can only be configured as external interrupt pins if
their external interrupt enable bit in the corresponding interrupt register has been set and the external
interrupt pin is selected by the corresponding pin-shared function selection bits. The pin must also
be setup as an input by setting the corresponding bit in the port control register. When the interrupt
is enabled, the stack is not full and the correct transition type appears on the external interrupt pin,
a subroutine call to the external interrupt vector, will take place. When the interrupt is serviced, the
external interrupt request flags, INT0F~INT1F, will be automatically reset and the EMI bit will be
automatically cleared to disable other interrupts. Note that any pull-high resistor selections on the
external interrupt pins will remain valid even if the pin is used as an external interrupt input.
The INTEG register is used to select the type of active edge that will trigger the external interrupt.
A choice of either rising or falling or both edge types can be chosen to trigger an external interrupt.
Note that the INTEG register can also be used to disable the external interrupt function.
TB0[�:0] TB0_PRE[�:0]
TB0ON
fSYS � � fPSC0_OUT �
fPSC0 fPSC0/�8 ~ fPSC0/�15 U U Time Base 0 Interrupt
fSYS/4 U Prescaler 0
X X X
fSUB
CLKSEL0[1:0]
fSYS �
fPSC1 fPSC1/�8 ~ fPSC1/�15 �
fSYS/4 U Prescaler 1
U Time Base 1 Interrupt
fSUB X
X
TB1ON
CLKSEL1[1:0]
TB1[�:0]
PSCR0 Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — CLKSEL01 CLKSEL00
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
PSCR1 Register
Bit 7 6 5 4 3 2 1 0
Name — — — — — — CLKSEL11 CLKSEL10
R/W — — — — — — R/W R/W
POR — — — — — — 0 0
TB0C Register
Bit 7 6 5 4 3 2 1 0
Name TB0ON TB0_PRE2 TB0_PRE1 TB0_PRE0 — TB02 TB01 TB00
R/W R/W R/W R/W R/W — R/W R/W R/W
POR 0 0 0 0 — 0 0 0
TB1C Register
Bit 7 6 5 4 3 2 1 0
Name TB1ON — — — — TB12 TB11 TB10
R/W R/W — — — — R/W R/W R/W
POR 0 — — — — 0 0 0
Multi-function Interrupts
Within the devices there are up to three Multi-function interrupts. Unlike the other independent
interrupts, these interrupts have no independent source, but rather are formed from other existing
interrupt sources, namely the TM Interrupts, LVD Interrupt, RF FFMG length margin Interrupt and
RF Burst Mode Transmit Complete Interrupt.
A Multi-function interrupt request will take place when any of the Multi-function interrupt request
flags, MFInF are set. The Multi-function interrupt flags will be set when any of their included
functions generate an interrupt request flag. To allow the program to branch to its respective
interrupt vector address, when the Multi-function interrupt is enabled and the stack is not full, and
either one of the interrupts contained within each of Multi-function interrupt occurs, a subroutine
call to one of the Multi-function interrupt vectors will take place. When the interrupt is serviced, the
related Multi-function request flag will be automatically reset and the EMI bit will be automatically
cleared to disable other interrupts.
However, it must be noted that, although the Multi-function Interrupt flags will be automatically
reset when the interrupt is serviced, the request flags from the original source of the Multi-function
interrupts will not be automatically reset and must be manually reset by the application program.
LVD Interrupt
The Low Voltage Detector Interrupt is contained within the Multi-function Interrupt. An LVD
Interrupt request will take place when the LVD Interrupt request flag, LVDF, is set, which occurs
when the Low Voltage Detector function detects a low power supply voltage. To allow the program
to branch to its respective interrupt vector address, the global interrupt enable bit, EMI, Low Voltage
Interrupt enable bit, LVDE, and associated Multi-function interrupt enable bit, must first be set.
When the interrupt is enabled, the stack is not full and a low voltage condition occurs, a subroutine
call to the Multi-function Interrupt vector, will take place. When the Low Voltage Interrupt is
serviced, the EMI bit will be automatically cleared to disable other interrupts, however only the
Multi-function interrupt request flag will be also automatically cleared. As the LVDF flag will not be
automatically cleared, it has to be cleared by the application program.
TM Interrupts
The Compact and Periodic Type TMs each have two interrupts, one comes from the comparator A
match situation and the other comes from the comparator P match situation. All of the TM interrupts
are contained within the Multi-function Interrupts. For all of the TM types there are two interrupt
request flags and two enable control bits. A TM interrupt request will take place when any of the
TM request flags are set, a situation which occurs when a TM comparator P or A match situation
happens.
To allow the program to branch to its respective interrupt vector address, the global interrupt enable
bit, EMI, respective TM Interrupt enable bit, and relevant Multi-function Interrupt enable bit,
MFInE, must first be set. When the interrupt is enabled, the stack is not full and a TM comparator
match situation occurs, a subroutine call to the relevant Multi-function Interrupt vector locations,
will take place. When the TM interrupt is serviced, the EMI bit will be automatically cleared to
disable other interrupts, however only the related MFInF flag will be automatically cleared. As
the TM interrupt request flags will not be automatically cleared, they have to be cleared by the
application program.
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.
Where a certain interrupt is contained within a Multi-function interrupt, then when the interrupt
service routine is executed, as only the Multi-function interrupt request flags, MFInF, will be
automatically cleared, the individual request flag for the function needs to be cleared by the
application program.
It is recommended that programs do not use the “CALL” instruction within the interrupt service
subroutine. Interrupts often occur in an unpredictable manner or need to be serviced immediately.
If only one stack is left and the interrupt is not well controlled, the original control sequence will be
damaged once a CALL subroutine is executed in the interrupt subroutine.
Every interrupt has the capability of waking up the microcontroller when it is in the SLEEP or IDLE
Mode and the Time Base 0 interrupt can wake-up the microcontroller when it is in the DEEP SLEEP
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 the SLEEP, IDLE or DEEP SLEEP 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.
LVD Register
The Low Voltage Detector function is controlled using a single register with the name LVDC. Three
bits in this register, VLVD2~VLVD0, are used to select one of eight fixed voltages below which
a low voltage condition will be determined. A low voltage condition is indicated when the LVDO
bit is set. If the LVDO bit is low, this indicates that the VDD voltage is above the preset low voltage
value. The ENLVD bit is used to control the overall on/off function of the low voltage detector.
Setting the bit high will enable the low voltage detector. Clearing the bit to zero will switch off the
internal low voltage detector circuits. As the low voltage detector will consume a certain amount of
power, it may be desirable to switch off the circuit when not in use, an important consideration in
power sensitive battery powered applications.
LVDC Register
Bit 7 6 5 4 3 2 1 0
Name — — LVDO ENLVD — VLVD2 VLVD1 VLVD0
R/W — — R R/W — R/W R/W R/W
POR — — 0 0 — 0 0 0
LVD Operation
The Low Voltage Detector function operates by comparing the power supply voltage, VDD, with a
pre-specified voltage level stored in the LVDC register. This has a range of between 1.9V and 3.6V.
When the power supply voltage, VDD, falls below this pre-determined value, the LVDO bit will
be set high indicating a low power supply voltage condition. The Low Voltage Detector function
is supplied by a reference voltage which will be automatically enabled. When the device is in the
DEEP SLEEP, SLEEP or IDLE mode, the low voltage detector will remain active if the ENLVD
bit is high. After enabling the Low Voltage Detector, a time delay tLVDS should be allowed for the
circuitry to stabilise before reading the LVDO bit. Note also that as the VDD voltage may rise and fall
rather slowly, at the voltage nears that of VLVD, there may be multiple bit LVDO transitions.
VDD
VLVD
LVDEN
LVDO
tLVDS
LVD Operation
The Low Voltage Detector also has its own interrupt which is contained within one of the Multi-
function interrupts, providing an alternative means of low voltage detection, in addition to polling
the LVDO bit. The interrupt will only be generated after a delay of tLVD after the LVDO bit has been
set high by a low voltage condition. In this case, the LVDF interrupt request flag will be set, causing
an interrupt to be generated if VDD falls below the preset LVD voltage. This will cause the device to
wake-up from the SLEEP or IDLE Mode, however if the Low Voltage Detector wake up function is
not required then the LVDF flag should be first set high before the device enters the SLEEP or IDLE
Mode. Note that an LVD interrupt request will not cause the device to be woken-up from the DEEP
SLEEP Mode, where the device must be woken-up using other methods which have been described
in the Wake-up section.
Configuration Options
Configuration options refer to certain options within the MCU that are programmed into the device
during the programming process. During the development process, these options are selected using
the HT-IDE software development tools. As these options are programmed into the device using
the hardware programming tools, once they are selected they cannot be changed later using the
application program. All options must be defined for proper system function, the details of which are
shown in the table.
No. Options
Watchdog Timer Option
Watchdog Timer Function:
1 1. Always enable
2. By WDTC control
LVR Option
LVR Function:
2 1. Disable
2. Enable
Application Circuits
0Ω
VDD
VSSRF_PA
VDD VSSRF
VDDRF EP
VSS VDD
RF Matching Circuit Antenna
Output LED
BC68F21x0
VDD PB0 RFOUT
PA0
PA1
Key Input PA2
PA3 OSC1
V15O OSC2
Instruction Set
Introduction
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 Holtek microcontroller, a comprehensive and flexible set of over 60 instructions is provided to
enable programmers to implement their application with the minimum of programming overheads.
For easier understanding of the various instruction codes, they have been subdivided into several
functional groupings.
Instruction 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
1μs. Although instructions which require one more cycle to implement are generally limited to
the JMP, CALL, RET, RETI and table read instructions, it is important to realize that any other
instructions which involve manipulation of the Program Counter Low register or PCL will also take
one more cycle to implement. As instructions which change the contents of the PCL will imply a
direct jump to that new address, one more cycle will be required. Examples of such instructions
would be “CLR PCL” or “MOV PCL, A”. For the case of skip instructions, it must be noted that if
the result of the comparison involves a skip operation then this will also take one more cycle, if no
skip is involved then only one cycle is required.
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 such as 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, SC
ADDM A,[m] Add ACC to Data Memory 1Note Z, C, AC, OV, SC
ADD A,x Add immediate data to ACC 1 Z, C, AC, OV, SC
ADC A,[m] Add Data Memory to ACC with Carry 1 Z, C, AC, OV, SC
ADCM A,[m] Add ACC to Data memory with Carry 1Note Z, C, AC, OV, SC
SUB A,x Subtract immediate data from the ACC 1 Z, C, AC, OV, SC, CZ
SUB A,[m] Subtract Data Memory from ACC 1 Z, C, AC, OV, SC, CZ
SUBM A,[m] Subtract Data Memory from ACC with result in Data Memory 1Note Z, C, AC, OV, SC, CZ
SBC A,x Subtract immediate data from ACC with Carry 1 Z, C, AC, OV, SC, CZ
SBC A,[m] Subtract Data Memory from ACC with Carry 1 Z, C, AC, OV, SC, CZ
SBCM A,[m] Subtract Data Memory from ACC with Carry, result in Data Memory 1Note Z, C, AC, OV, SC, CZ
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
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, SC, CZ
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, SC, CZ
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
(TBLP and TBHP) is moved to the specified Data Memory and the high byte moved to TBLH.
Operation [m] ← program code (low byte)
TBLH ← program code (high byte)
Affected flag(s) None
TABRDL [m] Read table (last page) to TBLH and Data 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
ITABRD [m] Increment table pointer low byte first and read table to TBLH and Data Memory
Description Increment table pointer low byte, TBLP, first and then the program code addressed by the
table pointer (TBHP and TBLP) is moved to the specified Data Memory and the high byte
moved to TBLH.
Operation [m] ← program code (low byte)
TBLH ← program code (high byte)
Affected flag(s) None
ITABRDL [m] Increment table pointer low byte first and read table (last page) to TBLH and Data Memory
Description Increment table pointer low byte, TBLP, first and then the low byte of the program code
(last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and
the high byte moved to TBLH.
Operation [m] ← program code (low byte)
TBLH ← program code (high byte)
Affected flag(s) None
LDAA [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
LRLCA [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
LRRCA [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
LSBCM 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, SC, CZ
LSDZA [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
LSIZA [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
LSUBM 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, SC, CZ
LTABRD [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
LTABRDL [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
LITABRD [m] Increment table pointer low byte first and read table to TBLH and Data Memory
Description Increment table pointer low byte, TBLP, first and then the program code addressed by the
table pointer (TBHP and TBLP) is moved to the specified Data Memory and the high byte
moved to TBLH.
Operation [m] ← program code (low byte)
TBLH ← program code (high byte)
LITABRDL [m] Increment table pointer low byte first and read table (last page) to TBLH and Data Memory
Description Increment table pointer low byte, TBLP, first and then the low byte of the program code
(last page) addressed by the table pointer (TBLP) is moved to the specified Data Memory and
the high byte moved to TBLH.
Operation [m] ← program code (low byte)
TBLH ← program code (high byte)
Affected flag(s) None
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.
• Further Package Information (include Outline Dimensions, Product Tape and Reel Specifications)
• Carton information
E2
16 9
THERMAL VARIATIONS ONLY
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
D1 0.059 — —
E — 0.050 BSC —
E2 0.039 — —
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
D1 1.50 — —
E — 1.27 BSC —
E2 1.00 — —
F 0.10 — 0.25
G 0.40 — 1.27
H 0.10 — 0.25
α 0° — 8°
D1
1 12
E2
24 13
THERMALLY ENHANCED VERIATIONS ONLY
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
D1 — 0.140 —
E — 0.025 BSC —
E2 — 0.096 —
F 0.004 — 0.010
G 0.016 — 0.050
H 0.004 — 0.010
α 0° — 8°
Dimensions mm
Symbol
Min. Nom. Max.
A — 6.00 BSC —
B — 3.90 BSC —
C 0.20 — 0.30
C’ — 8.66 BSC —
D — — 1.75
D1 — 3.56 —
E — 0.635 BSC —
E2 — 2.44 —
F 0.10 — 0.25
G 0.41 — 1.27
H 0.10 — 0.25
α 0° — 8°