– Asynchronous Serial Communications Interface (on K4 and K2 versions only)
– I²C Multi Master Interface up to 400 kHz
(on K4 versions only)
■ 1 Analog Peripheral
– 8-bit A/D Converter (ADC) with 8 channels
■ Instruction Set
– 63 basic instructions
– 17 main addressing modes
– 8 x 8 unsigned multiply instruction
– True bit manipulation
■ Development Tools
– Versatile Development Tools (under Win-
dows) including assembler, li nker, C-compiler, archiver, source level debugger, software
library, hardware emulator, programming
boards and gang programmers
PSDIP32
SO34 (Shrink)
& I²C
Table 1. Device Summary
Features
Program Memory -bytesRAM (stack) - bytes512 (128)384 (128)
Peripherals
Operating Supply4.0 V to 5.5 V
CPU frequency 8 MHz (with 24 MHz oscillator) or 4 MHz (with 12 MHz oscillator)
Operating temperature0 °C to +70 °C
PackagesSO34/SDIP32
To obtain the most recent version of this datasheet,
please check at www.st.com>products>technical literature>datasheet
Please also pay special attention to the Section “IMPORTANT NOTES” on page 130.
3/132
ST7263B
1 INTRODUCTION
The ST7263B Microcontrollers form a sub-family
of the ST7 MCUs dedicated to USB applications.
The devices are based on an industry-standard 8bit core and feature an enhanced instruction set.
They operate at a 24 MHz or 12 MHz oscillator frequency. Under software control, the ST7263B
MCUs may be placed in either Wait or Halt modes,
thus reducing power consumption. Th e enhance d
instruction set and ad dressing modes afford real
programming potential. In additio n to standard 8bit data management, the ST7263B MCUs feature
true bit manipulation, 8x8 unsigned multiplication
and indirect addressing modes. The devices include an ST7 Core, up to 16 K bytes of program
memory, up to 512 bytes of RAM, 19 I/O lines and
the following on-chip peripherals:
– USB low speed interface with 3 endpoints with
programmable in/out configuration using the
DMA architecture with embedded 3.3V voltage
regulator and transceivers (no external components are needed).
– 8-bit Analog-to-Digital converter (ADC) with 8
multiplexed analog inputs
Figure 1. General Block Diagram
INTERNAL
CLOCK
OSCIN
OSCOUT
V
V
RESET
DD
SS
OSCILLATOR
POWER
SUPPLY
WATCHDOG
CONTROL
8-BIT CO RE
ALU
LVD
USB DMA
OSC/3
OSC/4 or OSC/2
(for USB)
– Industry standard asynchronous SCI serial inter-
Generator capabilit ies
– Fast I²C Multi Master interface (not on all prod-
ucts - see device summary)
– Low voltage reset (LVD) ensuring proper power-
on or power-off of the device
The ST7263B devices are ROM versions.
The ST72P63B devices are Factory Advanced
Service Technique ROM (FASTROM) versions:
they are fact ory-prog ra mmed and are not reprogrammable.
The ST72F63B d evices are Flash versions. They
support programming in IAP mode (In-application
programming) via the on-chip USB interface.
I²C*
PORT A
16-BI TTIMER
ADDRESS AND DATA BUS
PORT B
ADC
PORT C
SCI*
(UART)
PA[7:0]
(8 bits)
PB[7:0]
(8 bits)
PC[2:0]
(3 bits)
VPP/TEST
V
DDA
V
SSA
* Not on all products (refer to Tabl e 1: Device S um mary)
PROGRAM
MEMORY
(4K/8K/16K Byte s)
RAM
(384/512 Bytes)
4/132
USB SIE
USBDP
USBDM
USBVCC
2 PIN DESCRI PTION
Figure 2. 34-Pin SO Package Pinout
OSCOUT
OSCIN
PC2/USBOE
PC1/TDO
PC0/RDI
RESET
AIN7/IT8PB7
AIN6/PB6/I T7
AIN5/IT6/PB5
AIN4/IT5/PB4
AIN3/PB3
AIN2/PB2
AIN1/PB1
* VPP on Flash versions only
(10mA)
(10mA)
VPP/TEST
(10mA)
(10mA)
(10mA)
(10mA)
(10mA)
ST7263B
V
DDA
V
DD
1
2
3
V
SS
NC
4
5
6
7
8
9
10
11
12
13
14
15
16
17
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
USBVCC
USBDP
V
USBDM
SSA
PA0/MCO
PA1
(25mA)
/SDA/ICCDATA
NC
NC
NC
PA2
(25mA)
/SCL/ICCCLK
PA3/EXTCLK
PA4/ICAP1/IT1
PA5/ICAP2/IT2
PA6/OCMP1/IT3
PA7/OCMP2/IT4
PB0
(10mA)
/AIN0
Figure 3. 32-Pin SDIP Package Pinout
V
DD
OSCOUT
OSCIN
V
SS
PC2/USBOE
PC1/TDO
PC0/RDI
RESET
AIN7/IT8/PB7
AIN6/IT7/PB6
AIN5/IT6/PB5
AIN4/IT5/PB4
AIN3/PB3
AIN2/PB2
AIN1/PB1/
* VPP on Flash versions only
(10mA)
(10mA)
VPP/TEST*
(10mA)
(10mA)
(10mA)
(10mA)
(10mA)
10
11
12
13
14
15
16
V
1
2
3
4
5
6
7
8
9
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
DDA
USBVCC
USBDM
USBDP
V
SSA
PA0/MCO
PA1
(25mA)
/SDA/ICCDATA
NC
NC
PA2
(25mA)
/SCL/ICCCLK
PA3/EXTCLK
PA4/ICAP1/IT1
PA5/ICAP2/IT2
PA6/COMP1/IT3
PA7/COMP2/IT4
PB0
(10mA)
/AIN0
5/132
ST7263B
PIN DESCRIPTION (Cont’d)
RESET
signal forces the initialization of the MCU. This
event is the top priority non maskable interrupt.
This pin is switched low when the Watchdog is triggered or the V
ternal peripherals.
OSCIN/OSCOUT: Input/Output Oscillator pin.
These pins connect a pa rallel-resonant crystal, or
an external source, to the on-chip oscillator.
V
Ground voltages.
V
Ground voltages for analog peripherals.
Table 2. Device Pin Description
(see Note 1): Bidirectional. This active low
is low. It can be used to reset ex-
DD
DD/VSS
DDA/VSSA
(see Note 2): Main Power Supply and
(see Note 2): Power Supply and
Alter na te Fu nct i ons : Several pins of the I/O ports
assume software programmable alternate functions as shown in the pin description.
Note 1: Adding two 100 nF decou pling capacitors
on the Reset pin (respectively connected to
V
DD
and VSS) will significantly improve product el ectromagnetic susceptibility performance.
Note 2: To enhance the reliability of operation, it is
recommended that
V
DDA
and V
be connected to-
DD
gether on the application bo ard. This also applies
-- 25 NC--Not connected
24 26 NC--Not connected
25 27 NC--Not connected
26 28 PA1/SDA/ICCDATAI/O C
27 29 PA0/MCOI/OC
28 30 V
29 31 USBDPI/OUSB bidirectional data (data +)
30 32 USBDMI/OUSB bidirectional data (data -)
31 33 USBVCCOUSB power supply
32 34 V
SSA
DDA
LevelPort / Control
InputOutput
Type
Input
Output
float
T
25mA XTPort A2I²C serial clock*, ICC Clock
T
25mA XTPort A1I²C serial data*, ICC Data
T
T
SAnalog ground
SAnalog supply voltage
int
wpu
XX Port A3Timer External Clock
XXPort A0Main Clock Output
OD
ana
Main
Function
(after reset)
PP
Alternate Function
Note (*): if the peripheral is present on the device (see Table 1, "Device Summary")
Legend / Abbreviations for Figure 2 and Table 2:
Type: I = input, O = output, S = supply
In/Output lev e l: C
= CMOS 0.3VDD/0.7VDD with input trigger
T
Output level: 10mA = 10mA high sink (on N-buffer only)
25mA = 25mA very high sink (on N-buffer only)
Port and control configuration:
– Input:float = floating, wpu = weak pull-up, int = interrupt, ana = analog
– Output : OD = open drain, PP = push-pull, T = True open drain
Refer to “I/O PORTS” on page 25 for more details on the software configuration of the I/O ports.
The RESET con fi g u r a ti o n o f e ac h pin is shown in bold. This configuration is kept as long as the device is
under reset state.
7/132
ST7263B
3 REGISTER & MEMORY MAP
As sho wn in Figure 4, the MCU is capable of ad-
dressing 64 Kbytes of memories and I/O registers.
The available memory locations consist of up to
512 bytes of RAM including 64 bytes of register locations, and up to 16K bytes of user program
memory in which the upper 32 by tes are res erved
for interrupt vectors. The RAM space includes up
to 128 bytes for the stack from 0100h to 017Fh.
Figure 4. Me m ory Map
0000h
003Fh
0040h
01BF/023Fh
01C0/0240h
BFFFh
C000h
FFDFh
FFE0h
FFFFh
HW Registers
(See Table 4)
RAM
(384/512 Bytes)
Reserved
Program Memory*
(4/8/16 KBytes)
Interrupt & Reset Vectors
(See Table 3)
The highest address by tes contain the user re set
and interrupt vectors.
IMPORTANT: Memory locations noted “Reserved” must neve r be ac cess ed. A cce ssing a reserved area can have unpredictable effects on the
device.
0040h
00FFh
0100h
017Fh
0180h
01BF/023Fh
Short Addressing
RAM (192 bytes)
Stack
(128 Bytes)
16-bit Addressing
RAM
C000h
E000h
16 KBytes
8 KBytes
F000h
FFDFh
4 KBytes
* Program memory and RAM sizes are product dependent (see Tabl e 1, "Device Summar y")
Table 3. Interrupt Vector Map
Vector AddressDescriptionMasked byRemarksExit from Halt Mode
FFE0h-FFEDh
FFEEh-FFEFh
FFF0h-FFF1h
FFF2h-FFF3h
FFF4h-FFF5h
FFF6h-FFF7h
FFF8h-FFF9h
FFFAh-FFFBh
FFFCh-FFFDh
FFFEh-FFFFh
USB End Suspend Mode Interrupt Vector
Flash Start Programming Interrupt Vector
USB PID Register
USB DMA address Register
USB Interrupt/DMA Register
USB Interrupt Status Register
USB Interrupt Mask Register
USB Control Register
USB Device Address Register
USB Endpoint 0 Register A
USB Endpoint 0 Register B
USB Endpoint 1 Register A
USB Endpoint 1 Register B
USB Endpoint 2 Register A
USB Endpoint 2 Register B
Reserved (5 bytes)
Reserved (5 Bytes)
I²C Data Register
Reserved
I²C (7 Bits) Slave Address Register
I²C Clock Control Register
I²C 2nd Status Register
I²C 1st Status Register
I²C Control Register
Note 1. If the peripheral is present on the device (see Table 1, "Device Summary")
10/132
4 FLASH PROGRAM MEMORY
ST7263B
4.1 In troduction
The ST7 dual voltage High Density Flash
(HDFlash) is a non-volatile memory that can be
electrically erased as a single block or by individual sectors and programmed on a Byte-by-Byte basis using an external V
supply.
PP
The HDFlash devices can be programmed and
erased off-board (plugge d in a programming tool)
or on-board using ICP (In-Circuit Programming) or
IAP (In-Application Programming).
The array matrix organ isation allows each sector
to be erased and reprogrammed wi thout affecting
other sectors.
4.2 Main Features
■ Three Flash programming modes:
– Insertion in a programming tool. In this mode,
all sectors including option bytes can be programmed or erased.
– ICP (In-Circuit Programming). In this mode, all
sectors including option bytes can be programmed or erased without removing the device from the application board.
– IAP (In-Application Programming) In this
mode, all sectors except Sector 0, can be programmed or erased without removing the device from the appli cation board a nd while the
application is running.
■ ICT (In-Circuit Testing) for downloading and
executing user application test patterns in RAM
■ Read-out protection against piracy
■ Register Access Security System (RASS) to
prevent accidental programming or erasing
4.3 S tructure
Depending on the overall Flash memory size in the
microcontroller device, there are up to three user
sectors (see Tab le 5). Each of these sectors can
be erased independently to avoid unnecessary
erasing of the whole Flash m emory when only a
partial erasing is required.
The first two sectors have a fixed size of 4 K bytes
(see Figure 5). They are mapped in the upper part
of the ST7 addressing space so the res et and interrupt vectors are located in Sector 0 (F000hFFFFh).
Table 5. Sectors available in Flash devices
Flash Size (bytes)Available Sectors
4KSector 0
8KSectors 0,1
> 8KSectors 0,1, 2
4.3.1 Read-out Protection
Read-out protection, when sele cted, makes it impossible to extract the m emory content from the
microcontroller, thus preventing piracy. Even ST
cannot access the user code.
In flash devices, this prot ection is removed by reprogramming the option. In this case, the entire
program memory is first automatically erased.
Read-out protection selection depends on the device type:
– In Flash devices it is enabled and removed
through the FMP_R bit in the option byte.
– In ROM devices it is enabled by mask option
specified in the Option List.
The Flash memory is organised in sectors and can
be used for both code and data storage.
Figure 5. Me m ory Map and Sec t or A dd re ss
4K10K24K48K
1000h
3FFFh
7FFFh
9FFFh
BFFFh
D7FFh
DFFFh
EFFFh
FFFFh
8K16K32K60K
2Kbytes
8Kbytes40 Kbytes
16 Kbytes
4 Kbytes
4 Kbytes
24 Kbytes
FLASH
MEMORY SIZE
SECTOR 2
52 Kby t es
SECTOR 1
SECTOR 0
11/132
ST7263B
FLASH PROGRAM MEMORY (Cont’d)
4.4 ICC Interface
ICC needs a m ini mum of 4 and up t o 6 pins to b e
connected to the programming tool (see Figure 6).
These pins are:
– RESET
–V
: device reset
: device power supply ground
SS
Figure 6. Typical ICC Interface
PROGRAMMING TOOL
APPLICATION
POWER SUPPLY
OPTIONAL
(See Note 3)
C
L2
DD
V
OSC2
OPTIONAL
(See Note 4)
C
L1
OSC1
ST7
Notes:
1. If the ICCCLK or ICCDATA pins are only use d
as outputs in the application, no sign al iso lation is
necessary. As soon as the Programming Tool is
plugged to the board, even if an ICC session is not
in progress, the ICCCLK and ICCDATA pins are
not available for the application. If they are used as
inputs by the application, isolation such as a serial
resistor has to implemented i n case another device forces the signal. Refer to the Programming
Tool documentation for recommended resistor values.
2. During the ICC session, the programming tool
must control the RESET
flicts between the programming tool and the application reset circuit if it drives more than 5mA at
high level (push pull output or pull-up resistor<1K).
A schottky diode can be used to isolate th e application RESET circuit in th is case. When using a
classical RC network with R>1K or a reset management IC with open drain output and pul l-up resistor>1K, no additional com ponents are needed.
pin. This can lead to con-
– ICCCLK: ICC output serial clock pin
– ICCDATA: ICC input/output serial data pin
– ICCSEL/V
: programming voltage
PP
– OSC1(or OSCIN): main clock in put for exter-
nal source (optional)
: application board power supply (opt ion-
–V
DD
al, see Figure 6, Note 3)
ICC CONNECTOR
975 3
10k
Ω
SS
V
ICCSEL/VPP
ICC Cabl e
RESET
ICCCLK
HE10 CONNECTOR TYPE
1
246810
ICCDATA
APPLICATION BOARD
ICC C ONNECTOR
APPLICATION
RESET SOURCE
See Note 2
See Notes 1 and 5
See Note 1
APPLICATION
I/O
In all cases the user must ensure that no external
reset is generated by the application during the
ICC session.
3. The use of Pin 7 of the ICC connec tor depends
on the Programming Tool architecture. This pin
must be connected when using most ST Programming Tools (it is used to monitor the application
power supply). Please refer to the Programming
Tool manual.
4. Pin 9 has to be connec ted to the OSC1 or OS CIN pin of the ST7 when the clock is not available
in the application or if the sel ected clock opt ion is
not programmed in t he option byte. ST7 devices
with multi-oscillator capability need to hav e OS C2
grounded in this case.
5. During normal operation, the ICCCLK pin m ust
be pulled-up, internally or externally, to avoid entering ICC mode unexpectedly during a reset.
12/132
FLASH PROGRAM MEMORY (Cont’d)
ST7263B
4.5 ICP (In-Circuit Programming)
To perform ICP the microcontroller must be
switched to ICC (In-Circuit Communication) mode
by an external controller or programming tool.
Depending on the ICP code downloade d in RAM,
Flash memory programming can be fully customized (number of bytes to prog ram, program locations, or selection serial communication interface
for downloading).
When using an STMicroelectronics or third-party
programming tool that supp orts ICP and the specific microcontroller device, the user needs only to
implement the ICP hardware interface on the application board (see Figure 6). For more details on
the pin locations, refer to the device pinout description.
4.6 IAP (In-Application Programming)
This mode uses a BootLoader program previously
stored in Sector 0 by the user (in IC P mode or by
plugging the device in a programming tool).
This mode is fully controlled by user software. This
allows it to be adapted to the user application, (user-defined strategy for entering programming
mode, choice of c om mun ications protoc ol used t o
fetch the data to be stored, etc.). For example, it is
possible to download code from the SPI, SCI, USB
or CAN interface and program it in the F lash. IAP
mode can be used to program any of the Flash
sectors except Sector 0, whi ch is write/erase protected to allow recovery in case erro rs occur during the programming operation.
This register is reserved for use by Programming
Tool software. It controls the Flash programming
and erasing operations. For details on customizing
Flash programming method s and In-Circuit Testing, refer to the ST7 Flash Programming Reference Manual.
13/132
ST7263B
5 CENTRAL PROCE SSI NG UNIT
5.1 INTRODUCTION
This CPU has a full 8-bit architecture and contains
six internal registers allowing efficient 8-bit data
manipulation.
5.2 MAIN FEATURES
■ 63 basic instructions
■ Fast 8-bit by 8-bit multiply
■ 17 main addressing modes
■ Two 8-bit index registers
■ 16-bit stack pointer
■ Low power modes
■ Maskable hardware interrupts
■ Non-maskable software interrupt
5.3 CPU REGISTERS
The 6 CPU registers shown in Figure 7 are not
present in the memory mapping and are accessed
by specific instructions.
Figure 7. CPU Registers
70
RESET VALUE = XXh
70
RESET VALUE = XXh
70
RESET VALUE = XXh
Accumulator (A)
The Accumulator is an 8-bit general purpose register used to hold operan ds and the results of the
arithmetic and logic calculations and to manipulate
data.
Index Registers (X and Y)
In indexed addressing modes, these 8-bit registers
are used to create either effective addresses or
temporary storage areas for data manipulation.
(The Cross-Assembler generates a precede instruction (PRE) to indicate that the following instruction refers to the Y register.)
The Y register is not affected by the interrupt automatic procedures (not pushed to and popped from
the stack).
Program Cou nt er (P C )
The program counter is a 16-bit register containing
the address of the next instruction to be executed
by the CPU. It is made of two 8-bit registers PCL
(Program Counter Low which is the LSB) and PCH
(Program Counter High which is the MSB).
ACCUMULATOR
X INDEX REGISTER
Y INDEX REGISTER
158
RESET VALUE = RESET VECTOR @ FFFEh-FFFFh
15
RESET VALUE = STACK HIGHER ADDRESS
14/132
PCH
RESET VALUE =
7
70
1C11HI NZ
1X11X1XX
70
8
PCL
0
PROGRAM COUNTER
CONDITION CODE REGISTER
STACK POINTER
X = Undefined Value
CPU REGISTERS (Cont’d)
CONDITION CODE REGISTER (CC)
Read/Write
Reset Value: 111x1xxx
70
111HINZC
The 8-bit Condition Code register c ontains the interrupt mask and four flags represent ative of the
result of the instruction just executed. This register
can also be handled by the PUSH and POP instructions.
These bits can be individually tested and/or controlled by specific instructions.
because the I bi t is set by hardware at the start of
the routine and reset by the IRET instruction at the
end of the routine. If the I bit is cleared by software
in the interrupt routine, pending interrupts are
serviced regardless of the priority level of the current interrupt routine.
Bit 2 = N
Negative
.
This bit is set and cleared by hardware. It is representative of the result sign of the last arithmeti c,
logical or data manipulation. It is a copy of the 7
bit of the result.
0: The result of the last operation is positive or null.
1: The result of the last operation is negative
(i.e. the most significant bit is a logic 1).
This bit is accessed by the JRMI and JRPL instruc-
Bit 4 = H
Half carry
.
tions.
This bit is set by hardware when a carry occurs between bits 3 and 4 of t he ALU during an ADD or
ADC instruction. It is reset by hardware during the
same instructi ons.
0: No half carry has occurred.
1: A half carry has occurred.
This bit is tested using the JRH or JRNH instruction. The H bit is us eful in BCD arithmetic subroutines .
Bit 1 = Z
This bit is set and cleared by hardware. This bit in-
dicates that the result of the last arithmetic, logical
or data manipulation is zero.
0: The result of the last operation is different from
zero.
1: The result of the last operation is zero.
Zero
.
This bit is accessed by the JREQ and JRNE test
instructions.
Bit 3 = I
Interrupt mask
This bit is set by hardware when entering in interrupt or by software to disable all interrup ts except
the TRAP software interrupt. This bit is cleared by
software.
0: Interrupts are enabled.
1: Interrupts are disabled.
This bit is controlled by the RIM, SIM and IRET instructions and is tested by the JRM and JRNM instructions.
Note: Interrupts requested while I is set are
latched and can be processed whe n I is cleared.
.
Bit 0 = C
Carry/borrow.
This bit is set and cleared b y hardware and software. It indicates an overflow or an underflow has
occurred during the last arithmetic operation.
0: No overflow or underflow has occurred.
1: An overflow or underflow has occurred.
This bit is driven by the SCF and RCF instructions
and tested by the JRC and JRNC instructions. It is
also affected by the “bit test and branch”, shift and
rotate instructions.
By default an interrupt routine is not in terruptable
ST7263B
th
15/132
ST7263B
CPU REGISTERS (Cont’d)
STACK POINTER (SP)
Read/Write
Reset Value: 017Fh
158
00000001
70
0SP6SP5SP4SP3SP2SP1SP0
The Stack Pointer is a 16-bit register which is always pointing to the next free location in the stack.
It is then decremented after data has been pushed
onto the stack and incremented before data is
popped from the stack (see Figure 8).
Since the stack is 128 bytes deep, the 9 most significant bits are forced by hardw are. Following a n
MCU Reset, or after a Reset Stack Pointe r instruction (RSP), the Stack Pointer contains its reset value (the SP6 to SP0 bits are set) which is the stack
higher address.
The least significant byte of the Stack Pointer
(called S) can be directly accessed by a LD instruction.
Note: When the lower limit is exceeded, the Stack
Pointer wraps around to the stack upper limit, wi thout indicating the s tack overflow. The previously
stored information is then o ve rwritten and therefore lost. The stack also wraps in case of an underflow.
The stack is used to save the retu rn address during a subroutine call and the CPU context during
an interrupt. The user may also directly manipulate
the stack by means of the PUSH and POP instructions. In the case of an interrupt, the PCL is stored
at the first location point ed to by the SP. Then the
other registers are stored in the next locations as
shown in Figure 8.
– When an interrupt is received, the SP is decre-
mented and the context is pushed on the stack.
– On return from interrupt, the SP is incremented
and the context is popped from the stack.
A subroutine call occupies two locations and an interrupt five locat ions i n the sta ck ar ea.
The Reset procedure is used to provide an orderly
software start-up or to exit low power modes.
Three reset modes are provided: a low voltage
(LVD) reset, a watchdog reset and an external reset at the RESET
pin.
A reset causes the reset vector to be fetched from
addresses FFFEh and FFFFh in order to be loaded
into the PC and with program execution startin g
from this point.
6.1.3 External Reset
The external reset is an active low input signal applied to the RESET pin of the MCU.
As shown in Figure 12, the RESET
stay low for a minimum of one and a half CPU
clock cycles.
An internal Schmitt trigger at the RESET
vided to improve noise immunity.
Figure 9. Low Voltage Detector functional Diagram
An internal circuitry provides a 4096 CPU clock cycle delay from the time that the oscillator becomes
active.
LOW VOLTAGE
DETECTOR
6.1.1 Low Voltage Detector (LVD)
V
DD
Low voltage reset circuitry generates a reset when
V
is:
DD
■ below V
■ below V
During low voltage reset, the RESET
when VDD is rising,
IT+
when VDD is falling.
IT-
pin is held low,
thus permitting the MCU to reset other devices.
The Low Voltage Detector can be disabled by set-
Figure 10. Low Voltage Reset Signal Output
WATCHDOG
V
IT+
ting bit 3 of the option byte.
V
DD
6.1.2 Watchdog Reset
When a watchdog res et oc curs, the RESET
pulled low permitting the MCU to reset other devic-
pin is
RESET
es in the same way as t he low voltage reset ( Fi g-
ure 9).
Note: Hysteresis (V
Figure 11. Temporization timing diagram after an internal Reset
FROM
RESET
IT+-VIT-
) = V
signal must
hys
pin is pro-
RESET
INTERNAL
RESET
V
IT-
V
DD
Addresses
V
IT+
Temporiz ation (40 96 CPU clock cycles)
$FFFE
17/132
ST7263B
RESET (Cont’d)
Figure 12. Reset Timing Diagram
t
DDR
V
DD
OSCIN
t
OXOV
f
CPU
PC
RESET
WATCHDOG RESET
Note: Refer to Electrical Characteristics for values of t
4096 CPU
CYCLES
, t
DDR
CLOCK
DELAY
OXOV
FFFE
, V
IT+
, V
IT-
FFFF
and V
hys
18/132
6.2 CLOCK SYSTEM
ST7263B
6.2.1 General Description
The MCU accepts either a Crystal or Ceramic resonator, or an external clock signal to drive the internal oscillator. The internal clock (f
rived from the external oscillator frequency (f
CPU
) is de-
OSC
which is divided by 3 (and by 2 or 4 for USB, depending on the externa l clock used). The internal
clock is further divided by 2 by setting the SMS bit
in the Miscellaneous Register.
Using the OSC24/12 bit in the option byte, a 12
MHz or a 24 MHz external clock can b e used to
provide an internal frequency of either 2, 4 or 8
MHz while maintaining a 6 MHz for the USB (re f er
to Figure 15).
The internal clock signal (f
) is also routed to
CPU
the on-chip peripherals. The CPU clock signal
consists of a square wave with a duty cycle of
50%.
The internal oscillat or is designed to operate with
an AT-cut parallel resonant quartz or ceramic resonator in the frequency range specified for f
osc
The circuit shown in Figure 14 is recommended
when using a crystal, and Tab le 6, "Recomme nd-
ed Values for 24 MHz Crystal Resonator" list s the
recommended capacitance. The crystal and associated components should be mounted as close as
possible to the input pins in order to minimize output distortion and start-up stabilisation time.
source should be used instead of t
OXOV
tion 6.5 CONTROL TIMING).
Figure 13. External Clock Source Connections
),
OSCIN
EXTERNAL
CLOCK
OSCOUT
NC
Figure 14. Crystal/Ceramic Resonator
.
OSCINOSCOUT
R
P
C
OSCIN
C
OSCOUT
(see Sec-
Table 6. Recommended Values for 24 MHz
Crystal Resonator
R
SMAX
C
OSCIN
C
OSCOUT
R
P
Note: R
crystal (see crystal specification).
SMAX
20
Ω
56pF47pF22pF
56pF47pF22pF
1-10 M
Ω
25
1-10 M
Ω
Ω
70
1-10 M
Ω
Ω
is the equivalent serial resistor of the
6.2.2 External Clock
An external clock may be applied to the OSCIN input with the OSCOUT pin not connected, as
shown on F igure 13. The t
specifications do
OXOV
not apply when using an external clock input. The
equivalent specification of the external clock
Figure 15. Clock Block Diagram
%2
1
0
OSC24/12
%2
%2
24 or
12 MHz
Crystal
%3
%2
8, 4 or 2 MHz
0
CPU and
peripherals)
1
SMS
6 MHz (USB)
19/132
ST7263B
7 INTERRUPTS
The ST7 core may be interrupted by one of two different methods: maskable hardware interrupts as
listed in Table 7, "Interrupt Mapping" and a non-
maskable software interrupt (TRAP). The Interrupt
processing flowchart is shown in Figure 16.
The maskable interrupts must be enabled clearing
the I bit in order to be serviced. However, disabled
interrupts may be latched and processed when
they are enabled (see external interrupts subsec tion) .
When an interrupt has to be serviced:
– Normal processing is suspended at the end of
the current instruction execution.
– The PC, X, A and CC registers are saved onto
the stack.
– The I bit of the CC register is set to prevent addi-
tional interrupts.
– The PC is then loaded with the interrupt vector of
the interrupt to service and the first instruction of
the interrupt service routine is fetched (refer to
Table 7, "Interrupt Mapping" for vector address-
es).
The interrupt service routine should finish with the
IRET instruction which c auses the con tents o f the
saved registers to be recovered from the stack.
Note: As a consequence of the IRET instruction,
the I bit will be cleared a nd the main pro gram will
resume.
Priority Management
By default, a servicing interrupt cannot be interrupted because the I bit is set by hardware entering in interrupt routine.
In the case several interrupts are simultaneously
pending, a hardware priority defines which one will
be serviced first (see Table 7, "Interrupt Map-
ping").
Non-maskable Software Interrupts
This interrupt is entered when the TRAP instruction is executed regardless of the state of the I bit.
It will be serviced according to the flowchart on
Figure 16.
Interrupts a n d Low Power Mod e
All interrupts allow the processor to leave the Wait
low power mode. Only external and specific mentioned interrupts allow the processor to leave the
Halt low power mode (refer to t he “Exit f rom HALT“
column in Table 7, "Interrupt Mapping").
External Interrupts
The pins ITi/PAk and ITj/P Bk (i=1,2; j= 5,6; k=4,5)
can generate an i nterrupt when a rising edge occurs on this pin. Conversely, the ITl/PAn and ITm/
PBn pins (l=3,4; m= 7,8; n=6,7) can generate an
interrupt when a falling edge occurs on this pin.
Interrupt generation will occur if it is enabl ed with
the ITiE bit (i=1 to 8) in the ITRFRE register and if
the I bit of the CCR is reset.
Peripheral Interrupts
Different peripheral interrupt flags in the status
register are able to cause an interrupt when they
are active if both:
– The I bit of the CC register is cleared.
– The corresponding enable bit is set in the control
register.
If any of these two conditions is false, the interrupt
is latched and thus remains pending.
Clearing an interrupt request is done by one of the
two following operations:
– Writing “0” to the corresponding bit in the status
register.
– Accessing the status register while the flag is set
followed by a read or write of an associated register.
Notes:
1. The clearing sequence resets the internal latch.
A pending interrupt (i.e. waiting to be enabled) will
therefore be lost if the clear sequence is executed.
2. All interrupts allow the processor to leave the
Wait low power mode.
3. Exit from Halt mode may only be triggered by an
External Interrupt on one of the ITi ports (PA4-PA7
and PB4-PB7), an end suspend mode Interrupt
coming from USB peripheral, or a reset.
20/132
INTERRUPTS (Cont’d)
Figure 16. I nt errupt Proces s in g Flowchart
If an ITiE bit is se t, the corresponding interrupt is
generated when
– a rising edge occurs on the pin PA4/IT1 or PA5/
IT2 or PB4/IT5 or PB5/IT6
or
– a falling edge occurs on the pin PA6/IT3 or PA7/
IT4 or PB6/IT7 or PB7/IT8
No interrupt is generated elsewhere.
Note: Analog input must be disabled for interrupts
coming from port B.
22/132
8 POWER SAVIN G MO DES
8.1 In troduction
ST7263B
To give a large measure of flexibility to the application in terms of power consumption, two main power saving modes are implemented in the ST7.
After a RESET, the normal operating mode is selected by default (RUN mode). This mode drives
the device (CPU and embedded peripherals) by
means of a master clock which is based on the
main oscillator frequency divided by 3 (f
CPU
).
From Run mode, the different power saving
modes may be selected by setting the relevant
register bits or by calling the specific ST7 software
instruction whose action depends on the oscillator
status.
8.2 HALT Mode
The MCU consumes the least amount of power i n
HALT mode. The HALT mode is entered by executing the HALT instruction. The internal oscillator
is then turned off, causing all internal processing to
be stopped, including the operation of the on-chip
peripherals.
When entering HALT mode, the I bit in th e Condition Code Register is cleared. Thus, all external interrupts (ITi or USB end suspend mode) are allowed and if an interrupt occurs, the CPU clock becomes active.
The MCU can exit HALT m ode on reception of either an external interrupt on ITi, an end suspend
mode interrupt coming from USB peripheral, or a
reset. The oscillat or is t hen t urned on and a stabilization time is provided before rele asing CPU operation. The stabilization time is 4096 CPU clock
cycles.
After the start up delay, the CPU continues operation by servicing the interrupt which wakes it up or
by fetching the reset vector if a reset wakes it up.
Figure 17. HAL T Mode Flow C hart
HALT INSTRUCTION
OSCILLATOR
PERIPH. CLOCK
CPU CLOCK
I-BIT
N
RESET
N
EXTERNAL
INTERRUPT*
Y
OSCILLATOR
PERIPH. CLOCK
CPU CLOCK
I-BIT
4096 CPU CLOCK
CYCLES DELAY
FETCH RESET VECTOR
OR SERVICE INTERRUPT
OFF
OFF
OFF
CLEARED
Y
ON
ON
ON
SET
Note: Before servicing an interrupt, the CC register is
pushed on the stac k. T he I -Bit i s se t du ring the interrupt routine and cleared when the CC register is
popped.
23/132
ST7263B
POWER SAVING MODES (Cont’d)
8.3 SLOW Mode
In Slow mode, the oscillator frequency can be d ivided by 2 as selected by the SMS bit in the Miscellaneous Register. The CPU and peripherals are
clocked at this lower frequency. Slow mode is
used to reduce power consump tion, and enables
the user to adapt the clock frequency to the available supply voltage.
8.4 WAIT Mode
WAIT mode places the MCU in a low power consumption mode by stopping the CPU.
This pow er s av in g mode is s elected b y calling th e
“WFI” ST7 software instruction.
All peripherals remain active. During WAIT mode,
the I bit of the CC register is f orced t o 0 to enable
all interrupts. All other registers and mem ory remain unchanged. The MCU remains in WAIT
mode until an interrupt or Reset occu rs, where upon the Program Counter branc hes to the starting
address of the interrupt or Reset service routine.
The MCU will r e main in W AIT mod e unt il a Rese t
or an Interrupt occurs, causing it to wake up.
Refer to Figure 18.
Figure 18. WAIT Mode Flow Chart
WFI INSTRUCTION
OSCILLATOR
PERIPH. CLOCK
CPU CLOCK
I-BIT
N
INTERRUPT
Y
N
OSCILLATOR
PERIPH. CLOCK
CPU CLOCK
I-BIT
RESET
ON
ON
OFF
CLEARED
Y
ON
ON
ON
SET
24/132
IF RESET
4096 CPU CLOCK
CYCLES DELAY
FETCH RESET VECTOR
OR SERVICE INTERRUPT
Note: Before servicing an interrupt, the CC register is
pushed on the sta ck. The I-Bit is s et d uring the inte rrupt routine and cleared when the CC register is
popped.
9 I/O PORTS
9.1 In troduction
ST7263B
The I/O ports offer different functional modes:
– Transfer of data through digital inputs and out-
puts and for specific pins
– Analog signal input (ADC)
– Alternate signal input/output for the on-chip pe-
ripherals
– External interrupt generation
An I/O port consists o f up to 8 p ins. Each pin can
be programmed independently as a digital input
(with or without interrupt generation) or a digital
output.
9.2 Functional description
Each port is associated to 2 main registers:
– Data Register (DR)
– Data Direction Register (DDR)
Each I/O pin may be programmed using the corre-
sponding register bits in DDR register: bit X corresponding to pin X of the port. The same correspondence is used for the DR register.
Table 8. I/O Pin Functi ons
DDRMODE
0Input
1Output
Inpu t Mode s
The input configuration is sele cted by clearing the
corresponding DDR register bit.
In this case, reading the DR register returns the
digital value applied to the external I/O pin.
Note 1: All the inputs are triggered by a Schmitt
trigg er.
Note 2: When switching from input mode to output
mode, the DR register should be written first to
output the correct value as soon as the port is configured as an output.
Interrupt function
When an I/O is configured as an Input with Interrupt, an event on this I/O can generate an external
Interrupt request to the CPU. The interrupt sensi-
tivity is given independent ly according to the description mentioned in the ITRFRE interrupt register.
Each pin can independently generate an Interrupt
request.
Each external interrupt vector is linked t o a dedicated group of I/O port pins (see Interrupts section). If more than one input pin is selected simultaneously as an interrupt source, this is logically
ORed. For this reason if one of the interrupt pins is
tied low, the other ones are masked.
Output Mode
The pin is configured in output mode by setting the
corresponding DDR register bit (see Table 7).
In this mode, writing “0” or “1” to the DR register
applies this digital value to the I/O pin through the
latch. Therefore, t he prev i ously saved value is restored when the DR register is read.
Note: The interrupt function is disabled in this
mode.
Digital Alternate Func ti on
When an on-chip peripheral is configured to use a
pin, the alternate function is au tomatically selected. This alternate function takes priority over
standard I/O programming. When the signal is
coming from an on-chip peripheral, the I/O pin is
automatically configured in output mode (push-pull
or open drain according to the peripheral).
When the signal is goi ng to an on-chip peripheral,
the I/O pin ha s to be configured in i nput mode. In
this case, the pin’s state is a lso digitally readable
by addressing the DR register.
Notes:
1. Input pull-up configuration can cause an unex pected value at the input of the alternate peripheral input.
2. When the on-chip peripheral uses a pin as input
and output, this pin must be configured as an input
(DDR = 0).
Warning
: The alternate func tion m us t not be a cti-
vated as long as the p in is config ured as an input
with interrupt in order to avoid generating spurious
interrupts.
25/132
ST7263B
I/O PORTS (Cont ’d)
Analog Alternate Function
When the pin is used as an ADC input the I/O must
be configured as a floating input. The analog mu ltiplexer (controlled by the ADC registers) switches
the analog voltage present o n the selected pin to
the common ana log rail which i s c onnect ed to the
ADC input.
It is recommended not to change the voltage level
or loading on any port pin while conversion is in
progress. Furthermore it i s recommended not to
have clocking pins locat ed close t o a selected analog pin.
Warning
within the limits stat ed in the A bsolute Max imum
Ratings.
9.3 I/O Port Implementation
The hardware implementation on each I/O port depends on the settings in the DDR register and specific feature of the I/O port such as ADC Input or
true open drain.
: The analog input voltage level must be
26/132
I/O PORTS (Cont ’d)
9.3.1 Port A
Table 9. Port A0, A3, A4, A5, A6, A7 Description
PA1without pull-upVery High Current open drain SDA (I²C data)I²C enable
PA2without pull-upVery High Current open drain SCL (I²C clock)I²C enable
*Reset State