Professional Documents
Culture Documents
ST62E32B
8-BIT OTP/EPROM MCUs WITH A/D CONVERTER,
16-BIT AUTO-RELOAD TIMER, EEPROM, SPI AND UART
■
Run, Wait and Stop Modes
5 Interrupt Vectors
( s )
■ Look-up Table capability in Program Memory
c t
■ Data Storage in Program Memory:
User selectable size
d u
■ Data RAM: 192 bytes
r o s)
■ Data EEPROM: 128 bytes
P c t( PSDIP42
■ User Programmable Options
e t e u
■ 30 I/O pins, fully programmable as:
– Input with pull-up resistor
o l rod
– Input without pull-up resistor
– Input with interrupt generation
b s P
– Open-drain or push-pull output
– Analog Input
- O ete
■
) o l
9 I/O lines can sink up to 20mA to drive LEDs or
s
■
TRIACs directly
c t ( b s
8-bit Timer/Counter with 7-bit programmable
PQFP52
prescaler
16-bit
d
Auto-reload u -OTimer with 7-bit
■
r o s)
programmable prescaler (AR Timer)
■ Digital Watchdog
P
e uc t (
■
■
e t
8-bit A/D Converter with 21 analog inputs
l od
8-bit Synchronous Peripheral Interface (SPI)
■
(UART) o
8-bit Asynchronous Peripheral Interface
s Pr
■
b
On-chip Clock oscillator can be driven by Quartz
O ete
Crystal or Ceramic resonator CDIP42W
■
o l
Oscillator Safe Guard
One external Non-Maskable Interrupt
(See end of Datasheet for Ordering Information)
bs
■
Rev. 2.8
( s )
1.3.4 Stack Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.5 Data Window Register (DWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
c t
1.3.6 Data RAM/EEPROM Bank Register (DRBR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
d u
1.3.7 EEPROM Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4 PROGRAMMING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
r o s)
1.4.1 Option Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
P t(
1.4.2 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
c
15
t e u
1.4.3 EEPROM Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
e
15
o l rod
1.4.4 EPROM Erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 CENTRAL PROCESSING UNIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
16
b s P
2.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
- O ete
2.2 CPU REGISTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 CLOCKS, RESET, INTERRUPTS AND POWER SAVING MODES . . . . . . . . . . . . . . . . . . . . . 18
) o l
3.1 CLOCK SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
s
c t ( b s
3.1.1 Main Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.2 Low Frequency Auxiliary Oscillator (LFAO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
19
d u -O
3.1.3 Oscillator Safe Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
r o s)
3.2 RESETS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
P
e uc t (
3.2.1 RESET Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.2 Power-on Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
22
e t
3.2.3 Watchdog Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
l od
3.2.4 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
23
o
s Pr
3.2.5 MCU Initialization Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
b
3.3 DIGITAL WATCHDOG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
o l
3.4 INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
bs
3.4.1 Interrupt request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4.2 Interrupt Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
O 3.4.3 Interrupt Option Register (IOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.4 IInterrupt sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
31
3.5 POWER SAVING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.5.1 WAIT Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.5.2 STOP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.5.3 Exit from WAIT and STOP Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 .... 35
4 ON-CHIP PERIPHERALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.1 I/O PORTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2/83
Table of Contents Document
Page
4.1.1 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.1.2 Safe I/O State Switching Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.1.3 ARTimer alternate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1.4 SPI alternate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1.5 UART alternate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1.6 I/O Port Option Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.1.7 I/O Port Data Direction Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.1.8 I/O Port Data Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.2 TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2.1 Timer Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2.2 Timer Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
s )
4.2.3 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
(
45
c t
4.2.4 Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 ARTIMER 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
46
d u
4.3.1 CENTRAL COUNTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
r o s)
4.3.2 SIGNAL GENERATION MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
P c t(
4.3.3 TIMINGS MEASUREMENT MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
e t e u
4.3.4 INTERRUPT CAPABILITIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.5 CONTROL REGISTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
53
o l rod
4.3.6 16-BIT REGISTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
b s P
4.4 A/D CONVERTER (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.1 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
57
O ete
4.5 U. A. R. T. (UNIVERSAL ASYNCHRONOUS RECEIVER/TRANSMITTER) . . . . . . . . . . . 59
-
s ) o l
4.5.1 PORTS INTERFACING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5.2 CLOCK GENERATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
60
c t ( b s
4.5.3 DATA TRANSMISSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
d u -O
4.5.4 DATA RECEPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5.5 INTERRUPT CAPABILITIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
61
r o s)
4.5.6 REGISTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
P
e uc t (
4.6 SERIAL PERIPHERAL INTERFACE (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5 SOFTWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
63
e t
5.1 ST6 ARCHITECTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
l od
o
5.2 ADDRESSING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
s Pr
5.3 INSTRUCTION SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
b
O ete
6 ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.1 ABSOLUTE MAXIMUM RATINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
o l
6.2 RECOMMENDED OPERATING CONDITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
bs
6.3 DC ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3/83
Table of Contents Document
Page
7.2 ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.3 IMPORTANT NOTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8
ST6232B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1 GENERAL DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.2 ROM READOUT PROTECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.3 ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
1.3.1 Transfer of Customer Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
( s )
1.3.2 Listing Generation and Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
t
8 SUMMARY OF CHANGES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
c
d u
r o s)
P c t(
e t e u
o l rod
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
O bs
83
4/83
ST62T32B ST62E32B
1 GENERAL DESCRIPTION
1.1 INTRODUCTION
The ST62T32B and ST62E32B devices are low mon core is surrounded by a number of on-chip
cost members of the ST62xx 8-bit HCMOS family peripherals.
of microcontrollers, which is targeted at low to me-
dium complexity applications. All ST62xx devices The ST62E32B is the erasable EPROM version of
are based on a building block approach: a com- the ST62T32B device, which may be used to em-
ulate the ST62T32B device, as well as the respec-
tive ST6232B ROM devices.
Figure 1. Block Diagram
( s ) PA0..PA1 / 20 mA Sink
8-BIT
c t
PORT A
PA2/OVF/ 20 mA Sink
PA3/PWM/20 mA Sink
TEST/V PP TEST
A/D CONVERTER
d u PA4/Ain/CP1
PA5/Ain/CP2
PA6...PA7/Ain
r o s) PORT B PB0/Ain
PB3..PB7/Ain
NMI INTERRUPT
P c t(
DATA ROM
USER
SELECTABLE
e t e u PORT C PC5..PC7/Ain
PROGRAM
o l rod PD0,PD6,PD7/Ain
Memory
7948 bytes
b s P
DATA RAM
192 Bytes
PORT D
PD1/Ain/Scl
PD2/Ain/Sin
- O ete PD3/Ain/Sout
PD4/Ain/RXD1
l
UART PD5/Ain/TXD1
( s )DATA EEPROM
o
128 Bytes
s
t
PORT E PE0...PE4
c
u -O b AUTORELOAD
d
PC
o s)
TIMER
P r
STACK LEVEL 1
(
STACK LEVEL 2
TIMER TIMER
t e uc t
STACK LEVEL 3
STACK LEVEL 4
8 BIT CORE SPI (SERIAL
PERIPHERAL
o e
l od STACK LEVEL 5
STACK LEVEL 6
INTERFACE)
s Pr
DIGITAL
WATCHDOG
b
O ete
POWER
SUPPLY OSCILLATOR RESET
bs
VR01823E
(VPP on EPROM/OTP versions only)
5/83
ST62T32B ST62E32B
INTRODUCTION (Cont’d)
OTP and EPROM devices are functionally identi- These compact low-cost devices feature a Timer
cal. The ROM based versions offer the same func- comprising an 8-bit counter and a 7-bit program-
tionality selecting as ROM options the options de- mable prescaler, an 16-bit Auto-Reload Timer,
fined in the programmable option byte of the with 2 input capture channels, EEPROM data ca-
OTP/EPROM versions.OTP devices offer all the pability, a serial synchronous port communication
advantages of user programmability at low cost, interface (SPI), a serial asynchronous port inter-
which make them the ideal choice in a wide range face (UART), an 8-bit A/D Converter with 21 ana-
of applications where frequent code changes, mul- log inputs and a Digital Watchdog timer, making
tiple code versions or last minute programmability them well suited for a wide range of automotive,
are required. appliance and industrial applications.
Figure 2. ST62T32B/E32B Pin Configuration
( s )
Figure 3. ST62T32B Pin Configuration
PE4 1 42 PA0
c t
u
PE3 2 41 PA1
PA3/PWM
PE2 3
d
PA2/OVF
40 PA2/OVF
PE1 4 39 PA3/PWM
r o s)
PE0
PE1
PE2
PE3
PE4
PA0
PA1
NC
NC
NC
NC
PE0 5
(
38 PA4/Ain/CP1
OSCin 6 37
P
PA5/Ain/CP2
e u c t 52515049484746454443424140
OSCout
Ain/CP7
7
8
36
35 t
PA6/Ain
e
l rod
PA7/Ain
NC 1
OSCin 2
OSCout 3
39
38
37
PA4/Ain/CP1
PA5/Ain/CP2
PA6/Ain
Ain/PC6
Ain/PC5
9
10
34
33 o
TIMER
s P
NMI
Ain/PC7 4
Ain/PC6 5
36
35
PA7/Ain
TIMER
b
Ain/PC5 6 34 NMI
VSSp 11 32 AVSS NC 7 33 AVSS
VDDp
VSS
12
13
- O ete
31
30
AVDD VSSP 8
VDDP 9
32
31
AVDD
PD0/Ain
l
PD0/Ain VSS 10 30 PD1/Ain/SCL
VDD
TEST/VPP (1)
14
15
( s ) s o
29 PD1/Ain/SCL VDD 11
(1)
TEST/VPP 12
29
28
PD2/Ain/Sin
PD3/Ain/Sout
t
28 PD2/Ain/Sin RESET 13 27 NC
RESET
Ain/PB7 c
16
u -O b 27 PD3/Ain/Sout 14151617181920212223242526
Ain/PD4/RXD1
Ain/PD5/TXD1
Ain/PD7
Ain/PD6
Ain/PB7
Ain/PB6
Ain/PB5
Ain/PB4
Ain/PB3
Ain/PB0
17 26 PD4/Ain/RXD1
NC
NC
NC
Ain/PB6
d
o s)
18 25 PD5/Ain/TXD1
Ain/PB5
Ain/PB4
P r (
19
20
24
23
PD6/Ain
PD7/Ain
Ain/PB3
t e uc t 21 22 PB0/Ain
1. V
o e
l od
PP
on EPROM/OTP only
VR01375G 1. V
PP
on EPROM/OTP only
b s Pr VR02008A
O ete
o l
Obs
6/83
ST62T32B ST62E32B
VDD and VSS. Power is supplied to the MCU via In addition, PA4-PA5 can also be used as analog
these two pins. VDD is the power connection and inputs for the A/D converter while PA0-PA3 can
VSS is the ground connection. sink 20mA for direct LED or TRIAC drive.
VDDp and VSSp. Power is supplied to the MCU I/Os PB0,PB3-PB7 These 6 lines are organised as one
independently from the rest of the chip using these I/O port (B). Each line may be configured under
two pins. These pins have to be connected to the software control as inputs with or without internal
VDD and VSS pins. It is not allowed to leave any of pull-up resistors, interrupt generating inputs with
these pins unconnected or to apply different po- pull-up resistors, open-drain or push-pull outputs,
tentials respectively to VDD/V DDp and V SS/V SSp. analog inputs for the A/D converter.
AVDD and AV SS. Power is supplied to the PC5-PC7. These 3 lines are organised as one I/O
MCUA/D converter independently from the rest of
the chip using these two pins.
( s )
port (C). Each line may be configured under soft-
ware control as input with or without internal pull-
OSCin and OSCout. These pins are internally
c t
up resistor, interrupt generating input with pull-up
resistor, analog input for the A/D converter, open-
connected to the on-chip oscillator circuit. A quartz
crystal, a ceramic resonator or an external clock u
drain or push-pull output.
d
signal can be connected between these two pins.
The OSCin pin is the input pin, the OSCout pin is r o s)
PD0-PD7. These 8 lines are organised as one I/O
the output pin.
P t(
port (portD). Each line may be configured under
software control as input with or without internal
c
RESET. The active-low RESET pin is used to re-
e t e u pull-up resistor, interrupt generating input with
pull-up resistor, analog input open-drain or push-
start the microcontroller.
s ) o l
NMI. The NMI pin provides the capability for asyn-
chronous interruption, by applying an external non PE0-PE4. These 5 lines are organised as one I/O
t ( s
maskable interrupt to the MCU. The NMI input is
c b
falling edge sensitive with Schmitt trigger charac-
port (PE). Each line may be configured under soft-
ware control as input with or without internal pull-
d u -O
teristics. The user can select as option the availa-
bility of an on-chip pull-up at this pin.
up resistor, interrupt generation input with pull-up
resistor, open-drain or push-pull output. In output
r o s)
PA0-PA7. These 8 lines are organised as one I/O
mode, these lines can also sink 20mA for direct
LED and TRIAC driving.
P t (
port (A). Each line may be configured under soft-
e uc
ware control as inputs with or without internal pull- TIMER. This is the TIMER 1 I/O pin. In input mode,
e t
up resistors, interrupt generating inputs with pull-
l od
up resistors, open-drain or push-pull outputs.
it is connected to the prescaler and acts as ex-
ternal timer clock or as control gate for the internal
o
PA2/OVF, PA3/PWM, PA4/CP1 and PA5/CP2 can
s Pr
be used respectively as overflow output pin, output
timer clock. In output mode, the TIMER pin outputs
the data bit when a time-out occurs.The user can
b
compare pin, and as two input capture pins for the
O ete
embedded 16-bit Auto-Reload Timer.
select as option the availability of an on-chip pull-
up at this pin.
o l
Obs
7/83
ST62T32B ST62E32B
(PC register).
P 000h
c t( Page 1
b
Program ROM Page Register (PRPR register). As P
Counter and by writing the appropriate code in the FFFh Page
b s DATA SPACE
0000h
d u -O
r o s) 000h
P
e uc t ( RAM / EEPROM
BANKING AREA
e t
l od 0-63
o
s Pr
03Fh
040h
b
O ete PROGRAM
MEMORY 07Fh
DATA READ-ONLY
MEMORY WINDOW
o l 080h X REGISTER
bs
081h Y REGISTER
082h V REGISTER
O 083h
084h
W REGISTER
RAM
8/83
ST62T32B ST62E32B
Page 3
0000h-000Fh Reserved c
These two bits select the corresponding page to
u
be addressed in the lower part of the 4K program
0010h-07FFh User ROM
d
address space as specified in Table 2.
o s)
Note: OTP/EPROM devices can be programmed
P r This register is undefined on Reset. Neither read
(
with the development tools available from STMicro-
e u c t
nor single bit instructions may be used to address
this register.
electronics (ST62E3X-EPB or ST623X-KIT).
e t
l rod Table 2. 8Kbytes Program ROM Page Register
1.3.2.1 Program ROM Page Register (PRPR) o
s P
Coding
b
The PRPR register can be addressed like a RAM
O ete
location in the Data Space at the address CAh ;
PRPR1
X
PRPR0
X
PC bit 11
1
Memory Page
Static Page (Page 1)
-
nevertheless it is a write only register that cannot
) l
0 0 0 Page 0
( s o
be accessed with single-bit operations. This regis-
s
ter is used to select the 2-Kbyte ROM bank of the
t
0
1
1
0
0
0
Page 1 (Static Page
Page 2
c
u -O b
Program Space that will be addressed. The
number of the page has to be loaded in the PRPR
register. Refer to the Program Space description
1 1 0 Page 3
d
o s)
for additional information concerning the use of 1.3.2.2 Program Memory Protection
P r
this register. The PRPR register is not modified
(
when an interrupt or a subroutine occurs.
The Program Memory in OTP or EPROM devices
t e uc t
Care is required when handling the PRPR register
can be protected against external readout of mem-
ory by selecting the READOUT PROTECTION op-
tion in the option byte.
e
as it is write only. For this reason, it is not allowed
l od
to change the PRPR contents while executing in-
o In the EPROM parts, READOUT PROTECTION
b s Pr
terrupt service routine, as the service routine
cannot save and then restore its previous content.
This operation may be necessary if common rou-
option can be disactivated only by U.V. erasure
that also results into the whole EPROM context
O ete
tines and interrupt service routines take more than
2K bytes ; in this case it could be necessary to di-
erasure.
l
vide the interrupt service routine into a (minor) part
o
Note: Once the Readout Protection is activated, it
is no longer possible, even for STMicroelectronics,
bs
in the static page (start and end) and to a second to gain access to the Program memory contents.
(major) part in one of the dynamic pages. If it is im- Returned parts with a protection set can therefore
possible to avoid the writing of this register in inter- not be accepted.
O
rupt service routines, an image of this register
must be saved in a RAM location, and each time
the program writes to the PRPR it must write also
to the image register. The image register must be
written before PRPR, so if an interrpt occurs be-
9/83
ST62T32B ST62E32B
b s P
space includes 60 bytes of RAM, the accumulator
(A), the indirect registers (X), (Y), the short direct
PORT C OPTION REGISTER
PORT D OPTION REGISTER
0CEh
0CFh
- O ete
registers (V), (W), the I/O port registers, the pe-
ripheral data and control registers, the interrupt
A/D DATA REGISTER
A/D CONTROL REGISTER
0D0h
0D1h
s ) o l
option register and the Data ROM Window register
TIMER 1 PRESCALER REGISTER
TIMER 1 COUNTER REGISTER
0D2h
0D3h
(DRW register).
c t ( b s
Additional RAM and EEPROM pages can also be
TIMER 1 STATUS/CONTROL REGISTER
RESERVED
0D4h
0D5h
d u -O
addressed using banks of 64 bytes located be-
tween addresses 00h and 3Fh.
UART DATA SHIFT REGISTER
UART STATUS CONTROL REGISTER
0D6h
0D7h
r o s) WATCHDOG REGISTER
RESERVED
0D8h
0D9h
1.3.4 Stack Space
P
e uc t ( I/O INTERRUPT POLARITY REGISTER
OSCILLATOR CONTROL REGISTER
0DAh
0DBh
e t
Stack space consists of six 12-bit registers which
are used to stack subroutine and interrupt return
l od
addresses, as well as the current program counter
SPI INTERRUPT DISABLE REGISTER
SPI DATA REGISTER
0DCh*
0DDh
o
s Pr
contents.
RESERVED
EEPROM CONTROL REGISTER
0DEh
0DFh
b
Table 3. Additional RAM/EEPROM Banks.
l
ARTIM16 4TH STATUS CONTROL REGISTER SCR4 0E3h
ST62T32B/E32B 2 x 64 bytes 2 x 64 bytes
o
ARTIM16 1ST STATUS CONTROL REGISTER SCR1 0E8h
bs
ARTIM16 RELOAD CAPTURE REG. HIGH BYTE RLCP 0E9h
ARTIM16 RELOAD CAPTURE REG. LOW BYTE RLCP 0EAh
ARTIM16 CAPTURE REGISTER HIGH BYTE CP 0EBh
10/83
ST62T32B ST62E32B
o l rod
bits of the register address given in the instruction
(as least significant bits) and the content of the
routine cannot save and then restore the register’s
b s P
DWR register (as most significant bits), as illustrat-
ed in Figure 6 below. For instance, when address-
previous contents. If it is impossible to avoid writ-
ing to the DWR during the interrupt service routine,
an image of the register must be saved in a RAM
- O ete
ing location 0040h of the Data Space, with 0 load-
ed in the DWR register, the physical location ad-
location, and each time the program writes to the
DWR, it must also write to the image register. The
s ) o l
dressed in program memory is 00h. The DWR reg-
ister is not cleared on reset, therefore it must be
image register must be written first so that, if an in-
t ( s
written to prior to the first access to the Data read-
only memory window area.
c b
terrupt occurs between the two instructions, the
DWR is not affected.
d u -O
Figure 6. Data read-only memory Window Memory Addressing
r o s)
DATA ROM
P
e uc
WINDOW REGISTER 7 t (
13 12 11 10 9 8 7 6 5 4 3 2 1 0 PROGRAM SPACE ADDRESS
READ
t
6 5 4 3 2 1 0
o e
CONTENTS
l od
(DWR)
5 4 3 2 1 0 DATA SPACE ADDRESS
s Pr
0 1 40h-7Fh
b
O ete Example:
IN INSTRUCTION
o l DWR=28h 0 1 0 1 0 0 0
DATA SPACE ADDRESS
bs
0 1 0 1 1 0 0 1 59h
O ROM
0 1 0 1 0 0 0 0 1 1 0 0 1
ADDRESS:A19h
VR0A1573
11/83
ST62T32B ST62E32B
r o s)
interrupt service routine, an image of this register
must be saved in a RAM location, and each time
Bit 1 - DRBR1. This bit, when set, selects
EEPROM Page 1.
P t(
the program writes to DRBR it must write also to
c
the image register. The image register must be
Bit 0 - DRBR0. This bit, when set, selects
e t e u written first, so if an interrupt occurs between the
EEPROM Page 0.
o l rod two instructions the DRBR is not affected.
b s P
The selection of the bank is made by programming
the Data RAM Bank Switch register (DRBR regis-
In DRBR Register, only 1 bit must be set. Other-
wise two or more pages are enabled in parallel,
producing errors.
- O ete
ter) located at address CBh of the Data Space ac-
cording to Table 1. No more than one bank should
Table 5. Data RAM Bank Register Set-up
be set at a time.
s ) o l
(
DRBR ST62T32B/E32B
t b s
The DRBR register can be addressed like a RAM
Data Space at the address CBh; nevertheless it is
c
a write only register that cannot be accessed with
00 None
d u -O
single-bit operations. This register is used to select
01
02
EEPROM Page 0
EEPROM Page 1
o s)
the desired 64-byte RAM/EEPROM bank of the
r
Data Space. The number of banks has to be load- 08 RAM Page 1
P
e uc t (
ed in the DRBR register and the instruction has to
10h RAM Page 2
e t
l od
other Reserved
o
s Pr
b
O ete
o l
Obs
12/83
ST62T32B ST62E32B
o l rod
The E2BUSY bit of the EECTL register is set when
ecuting an interrupt service routine.
b
Any access to the EEPROM when E2BUSY is set s P
the EEPROM is performing a programming cycle. If it is impossible to avoid writing to this register
within an interrupt service routine, an image of the
is meaningless.
s ) o l
Provided E2OFF and E2BUSY are reset, an EEP-
ROM location is read just like any other data loca-
also write to the image register. The image register
t (
tion, also in terms of access time.
d u -O
Writing to the EEPROM may be carried out in two
modes: Byte Mode (BMODE) and Parallel Mode
r o s)
P (
Table 6. Row Arrangement for Parallel Writing of EEPROM Locations
e uc t
e t
l od
Dataspace
addresses.
Byteo
s Pr 0 1 2 3 4 5 6 7
Banks 0 and 1.
b
ROW7
O ete
ROW6
38h-3Fh
30h-37h
o l
ROW5
ROW4
28h-2Fh
20h-27h
Obs ROW3
ROW2
ROW1
18h-1Fh
10h-17h
08h-0Fh
ROW0 00h-07h
13/83
ST62T32B ST62E32B
- O ete
Note that E2PAR2 is internally reset at the end of
the Additional Notes on Parallel Mode overleaf.
s ) o l
the programming cycle. This implies that the user
must set the E2PAR2 bit between two parallel pro-
Bit 2 = E2PAR2: Parallel Mode En. Bit. WRITE
ONLY. This bit must be set by the user program in
c t ( b s
gramming cycles. Note that if the user tries to set
E2PAR1 while E2PAR2 is not set, there will be no
order to perform parallel programming. If E2PAR2
is set and the parallel start bit (E2PAR1) is reset,
d u -O
programming cycle and the E2PAR1 bit will be un-
affected. Consequently, the E2PAR1 bit cannot be
up to 8 adjacent bytes can be written simultane-
ously. These 8 adjacent bytes are considered as a
r o s)
set if E2ENA is low. The E2PAR1 bit can be set by
the user, only if the E2ENA and E2PAR2 bits are
row, whose address lines A7, A6, A5, A4, A3 are
fixed while A2, A1 and A0 are the changing bits, as
also set.
P
e uc t ( illustrated in Table 6. E2PAR2 is automatically re-
set at the end of any parallel programming proce-
e t
l od
dure. It can be reset by the user software before
starting the programming procedure, thus leaving
o
s Pr
the EEPROM registers unchanged.
b
O ete
Bit 1 = E2BUSY: EEPROM Busy Bit. READ ON-
LY. This bit is automatically set by the EEPROM
control logic when the EEPROM is in program-
bs
to access the EEPROM while the busy bit is set
will be aborted and the writing procedure in
14/83
ST62T32B ST62E32B
c t
The MCUs can be programmed with the
EPROM Code Option Byte
u
ST62E3xB EPROM programming tools available
d
from STMicroelectronics.
7 0
r o s)
1.4.3 EEPROM Data Memory
P (
PORT NMI TIM
t
- EXTCNTL PROTECT WDACT OSGEN
PULL PULL PULL
t e u c
EEPROM data pages are supplied in the virgin
state FFh. Partial or total programming of EEP-
Bit 7. Reserved.
o e
l rod ROM data memory can be performed either
through the application software, or through an ex-
b s P
Bit 6 = PORT PULL. This bit must be set high to
have pull-up input state at reset on the I/O port.
When this bit is low, I/O ports are in input without
ternal programmer. Any STMicroelectronics tool
used for the program memory (OTP/EPROM) can
O ete
pull-up (high impedance) state at reset
-
also be used to program the EEPROM data mem-
ory.
) l
Bit 5 = EXTCNTL. This bit selects the External
s o
1.4.4 EPROM Erasing
c t (
STOP Mode capability. When EXTCNTL is high,
b s
pin NMI controls if the STOP mode can be ac-
cessed when the watchdog is active. When EXTC-
The EPROM of the windowed package of the
MCUs may be erased by exposure to Ultra Violet
d u -O
NTL is low, the STOP instruction is processed as a
WAIT as soon as the watchdog is active.
light. The erasure characteristic of the MCUs is
such that erasure begins when the memory is ex-
r o s)
Bit 4 = PROTECT. This bit allows the protection of
posed to light with a wave lengths shorter than ap-
proximately 4000Å. It should be noted that sun-
P t (
the software contents against piracy. When the bit
e uc
PROTECT is set high, readout of the OTP con-
lights and some types of fluorescent lamps have
wavelengths in the range 3000-4000Å.
t
tents is prevented by hardware. No programming
e
l od
equipment is able to gain access to the user pro- It is thus recommended that the window of the
o
s Pr
gram. When this bit is low, the user program can
be read.
MCUs packages be covered by an opaque label to
prevent unintentional erasure problems when test-
b
O ete
Bit 3 = NMI PULL. This bit must be set high to con-
figure the NMI pin with a pull up resistor when it is
ing the application in such an environment.
The recommended erasure procedure of the
l
low, no pull up is provided.
o
MCUs EPROM is the exposure to short wave ul-
traviolet light which have a wave-length 2537A.
bs
Bit 2 = TIM PULL. This bit must be set high to con- The integrated dose (i.e. U.V. intensity x exposure
figure the TIMER pin with a pull up resistor. When time) for erasure should be a minimum of 15W-
sec/cm2. The erasure time with this dosage is ap-
O
it is low, no pull up is provided.
Bit 1 = WDACT. This bit controls the watchdog ac-
tivation. When it is high, hardware activation is se-
proximately 15 to 20 minutes using an ultraviolet
lamp with 12000µW/cm2 power rating. The
ST62E32B should be placed within 2.5cm (1Inch)
lected. The software activation is selected when of the lamp tubes during erasure.
WDACT is low.
15/83
ST62T32B ST62E32B
(
interrupt purposes, through the control registers.
t
Short Direct Registers (V, W). These two regis-
c
ters are used to save a byte in short direct ad-
2.2 CPU REGISTERS
d u
dressing mode. They can be addressed in Data
space as RAM locations at addresses 82h (V) and
The ST6 Family CPU core features six registers and
three pairs of flags available to the programmer.
r o s)
83h (W). They can also be accessed using the di-
These are described in the following paragraphs.
P c t(
rect and bit direct addressing modes. Thus, the
ST6 instruction set can use the short direct regis-
Accumulator (A). The accumulator is an 8-bit
o l rod
general purpose register used in all arithmetic cal-
culations, logical operations, and data manipula- Program Counter (PC). The program counter is a
12-bit register which contains the address of the
b s P
tions. The accumulator can be addressed in Data
space as a RAM location at address FFh. Thus the
next ROM location to be processed by the core.
This ROM location may be an opcode, an oper-
other register in Data space.
- O ete
ST6 can manipulate the accumulator just like any
and, or the address of an operand. The 12-bit
t (
Figure 7. ST6 Core Block Diagram
c b s
d u -O
RESET
0,01 TO 8MHz
OSCin OSCout
r o s)
P
e uc t ( CONTROLLER
INTERRUPTS
e t
l od
DATA SPACE
o
s Pr CONTROL
b
O ete
OPCODE
FLAG
VALUES
2
SIGNALS
ADDRESS/READ LINE
DATA
RAM/EEPROM
o l
bs
PROGRAM
DATA
ROM/EPROM ADDRESS 256
ROM/EPROM
O A-DATA B-DATA
DECODER
DEDICATIONS
ACCUMULATOR
Program Counter
12 and FLAGS
6 LAYER STACK ALU
RESULTS TO DATA SPACE (WRITE LINE)
VR01811
16/83
ST62T32B ST62E32B
o l rod
flags (Carry and Zero), each pair being associated
with one of the three normal modes of operation:
be lost. It will also remain in its highest position if
the stack is empty and a RET or RETI is executed.
Normal mode, Interrupt mode and Non Maskable
b s P
Interrupt mode. Each pair consists of a CARRY
In this case the next instruction will be executed.
O ete
flag and a ZERO flag. One pair (CN, ZN) is used
-
lFigure 8. ST6 CPU Programming Mode
o l
during Normal operation, another pair is used dur-
)
ing Interrupt mode (CI, ZI), and a third pair is used
s
MI).
c ( b s
in the Non Maskable Interrupt mode (CNMI, ZN-
t
INDEX
REGISTER
b7
b7
X REG. POINTER
Y REG. POINTER
b0
b0
SHORT
DIRECT
u -O
The ST6 CPU uses the pair of flags associated
d
with the current mode: as soon as an interrupt (or
b7 V REGISTER b0
ADDRESSING
MODE
r o s)
a Non Maskable Interrupt) is generated, the ST6 b7 W REGISTER b0
P (
CPU uses the Interrupt flags (resp. the NMI flags)
t
instead of the Normal flags. When the RETI in-
e uc
b7 ACCUM ULATOR b0
e t
struction is executed, the previously used set of
l od
flags is restored. It should be noted that each flag b11 PROGRAM COUNTER b0
o
set can only be addressed in its own context (Non
s Pr
Maskable Interrupt, Normal Interrupt or Main rou-
b
tine). The flags are not cleared during context
O ete
switching and thus retain their status. SIX LEVELS
STACK REGISTER
The Carry flag is set when a carry or a borrow oc-
l
curs during arithmetic operations; otherwise it is
o
bs
cleared. The Carry flag is also set to the value of
the bit tested in a bit test instruction; it also partici-
NORMAL FLAGS C Z
pates in the rotate left instruction.
O
The Zero flag is set if the result of the last arithme-
tic or logical operation was equal to zero; other-
INTERRUPT FLAGS C Z
17/83
ST62T32B ST62E32B
t e u
Figure 9 illustrates various possible oscillator con-
e
figurations using an external crystal or ceramic res-
l rod
onator, an external clock input or the lowest cost so-
o
EXTERNAL CLOCK
b s P
lution using only the LFAO. C L1 an CL2 should have
a capacitance in the range 12 to 22 pF for an oscillator ST6xxx
frequency in the 4-8 MHz range.
- O ete
The internal MCU clock frequency (fINT) is divided
s ) l
by 12 to drive the Timer and the Watchdog timer,
o
OSCin OSCout
c t (
and by 13 to drive the CPU core, while the A/D
d u -O
With an 8 MHz oscillator frequency, the fastest ma-
r o s)
chine cycle is therefore 1.625µs.
INTEGRATED CLOCK
P t (
A machine cycle is the smallest unit of time needed
to execute any operation (for instance, to increment
e uc
OSG ENABLED option
t
the Program Counter). An instruction may require
e
l od
two, four, or five machine cycles for execution. ST6xxx
o
s Pr
3.1.1 Main Oscillator
b
The main oscillator can be turned off (when the
OSG ENABLED option is selected) by setting the
O ete
OSCOFF bit of the OSCR Control Register. The
OSCin OSCout
NC
o l
Low Frequency Auxiliary Oscillator is automatical-
ly started.
Obs
18/83
ST62T32B ST62E32B
c
ed, main oscillator switched off...).
e t e u
(main oscillator defective, no clock circuitry provid- increased internal clock frequency. In the absence
of an OSG circuit, this may lead to an over fre-
User code, normal interrupts, WAIT and STOP in-
o l rod quency for a given power supply voltage. The
OSG filters out such spikes (as illustrated in Fig-
b s P
structions, are processed as normal, at the re-
duced fLFAO frequency. The A/D converter accura-
cy is decreased, since the internal frequency is be-
ure 10). In all cases, when the OSG is active, the
maximum internal clock frequency, fINT, is limited
low 1MHz.
- O ete to fOSG, which is supply voltage dependent. This
relationship is illustrated in Figure 13.
s ) o l
At power on, the Low Frequency Auxiliary Oscilla-
tor starts faster than the Main Oscillator. It there- When the OSG is enabled, the Low Frequency
t ( s
fore feeds the on-chip counter generating the POR
c b
delay until the Main Oscillator runs.
Auxiliary Oscillator may be accessed. This oscilla-
tor starts operating after the first missing edge of
d u -O
The Low Frequency Auxiliary Oscillator is auto-
the main oscillator (see Figure 11).
Over-frequency, at a given power supply level, is
tor starts.
r o s)
matically switched off as soon as the main oscilla-
seen by the OSG as spikes; it therefore filters out
OSCR P
e uc t ( some cycles in order that the internal clock fre-
quency of the device is kept within the range the
e t
Address: 0DBh — Read/Write
l od
particular device can stand (depending on VDD),
and below fOSG: the maximum authorised frequen-
7
o
s Pr
0 cy with OSG enabled.
l
cleared after reset.
o
tion and reduce the maximum operating frequency
to fOSG.
bs
Bit 0 = OSCOFF. Main oscillator turn-off. When
low, this bit enables main oscillator to run. The
O
main oscillator is switched off when OSCOFF is
high.
19/83
ST62T32B ST62E32B
(1)
)
(2)
t ( s
u c
(3) d
o s)
P r (
e u c t
(4) e t
l rod
o
s P
b
O ete
) - l
(1) Maximum Frequency for the device to work correctly
t ( s s o
(2) Actual Quartz Crystal Frequency at OSCin pin
(3) Noise from OSCin
c b
(4) Resulting Internal Frequency
u -O
VR001932
d
o s)
P r
Figure 11. OSG Emergency Oscillator Principle
(
t e uc t
o e
l od
Main
b s Pr
Oscillator
O ete
l
Emergency
o
bs
Oscillator
O Internal
Frequency
VR001933
20/83
ST62T32B ST62E32B
POR
: 13 Core
OSG
TIMER 1
( s ) U
X
: 12
M
c t :6
U
X
ADC
LFAO
d u
r o s) :1 ARTIMER 16
P c t(
e t e u Main Oscillator off
o l rod
Figure 13. Maximum Operating Frequency (fMAX) versus Supply Voltage (V DD)
b s P
O ete
Maximum FREQUENCY (MHz)
-
8
s ) o l
7
c t ( b s
FUNCTIONALITY IS NOT
3
6
d u -O 4
fOSG
GUARANTEED
IN THIS AREA
5
r o s)
4
P
e uc t ( 2 fOSG Min
e t
l od
3
o
s Pr 2
b
O ete
1
2.5 3 3.5 4 4.5
1
5 5.5 6
bs
VR01807
Notes:
O
1. In this area, operation is guaranteed at the quartz crystal frequency.
2. When the OSG is disabled, operation in this area is guaranteed at the crystal frequency. When the OSG
is enabled, operation in this area is guaranteed at a frequency of at least fOSG Min.
3. When the OSG is disabled, operation in this area is guaranteed at the quartz crystal frequency. When
the OSG is enabled, access to this area is prevented. The internal frequency is kept a fOSG.
4. When the OSG is disabled, operation in this area is not guaranteed
When the OSG is enabled, access to this area is prevented. The internal frequency is kept at fOSG.
21/83
ST62T32B ST62E32B
3.2 RESETS
The MCU can be reset in three ways: The internal delay is generated by an on-chip coun-
– by the external Reset input being pulled low; ter. The internal reset line is released 2048 internal
clock cycles after release of the external reset.
– by Power-on Reset;
Notes:
– by the digital Watchdog peripheral timing out.
To ensure correct start-up, the user should take
3.2.1 RESET Input care that the reset signal is not released before the
The RESET pin may be connected to a device of VDD level is sufficient to allow MCU operation at
the application board in order to reset the MCU if the chosen frequency (see Recommended Oper-
required. The RESET pin may be pulled low in ating Conditions).
RUN, WAIT or STOP mode. This input can be A proper reset signal for a slow rising VDD supply
used to reset the MCU internal state and ensure a
correct start-up procedure. The pin is active low
( s )
can generally be provided by an external RC net-
work connected to the RESET pin.
and features a Schmitt trigger input. The internal
Reset signal is generated by adding a delay to the
c t
Figure 14. Reset and Interrupt Processing
external signal. Therefore even short pulses on
the RESET pin are acceptable, provided VDD has
d u
completed its rising phase and that the oscillator is
r o s) RESET
l rod
INT LATCH CLEARED
If RESET activation occurs in the RUN or WAIT ( IF PRESENT )
o
modes, processing of the user program is stopped
s P
(RUN mode only), the Inputs and Outputs are con-
b
figured as inputs with pull-up resistors and the
O ete
main Oscillator is restarted. When the level on the
SELECT
NMI MODE FLAGS
- l
RESET pin then goes high, the initialization se-
)
delay period.
t ( s o
quence is executed following expiry of the internal
s
c b
If RESET pin activation occurs in the STOP mode,
u -O
the oscillator starts up and all Inputs and Outputs
PUT FFEH
ON ADDRESS BUS
d
are configured as inputs with pull-up resistors.
o s)
P r
When the level of the RESET pin then goes high,
(
the initialization sequence is executed following
t
3.2.2 Power-on Reset
t
expiry of the internal delay period.
e uc
YES
IS RESET STILL
PRESENT?
e
l od
The function of the POR circuit consists in waking
o NO
s Pr
up the MCU at an appropriate stage during the
b
power-on sequence. At the beginning of this se-
quence, the MCU is configured in the Reset state:
LOAD PC
O ete
FROM RESET LOCATIONS
FFE/FFF
all I/O ports are configured as inputs with pull-up
o l
resistors and no instruction is executed. When the
power supply voltage rises to a sufficient level, the
bs
oscillator starts to operate, whereupon an internal
FETCH INSTRUCTION
delay is initiated, in order to allow the oscillator to
O
fully stabilize before executing the first instruction.
The initialization sequence is executed immediate-
ly following the internal delay.
VA000427
22/83
ST62T32B ST62E32B
RESETS (Cont’d)
3.2.3 Watchdog Reset initialisation routine from being interrupted. The in-
The MCU provides a Watchdog timer function in itialisation routine should therefore be terminated
order to ensure graceful recovery from software by a RETI instruction, in order to revert to normal
upsets. If the Watchdog register is not refreshed mode and enable interrupts. If no pending interrupt
before an end-of-count condition is reached, the is present at the end of the initialisation routine, the
internal reset will be activated. This, amongst oth- MCU will continue by processing the instruction
er things, resets the watchdog counter. immediately following the RETI instruction. If, how-
ever, a pending interrupt is present, it will be serv-
The MCU restarts just as though the Reset had iced.
been generated by the RESET pin, including the
built-in stabilisation delay period. Figure 15. Reset and Interrupt Processing
3.2.4 Application Notes
( s ) RESET
No external resistor is required between VDD and
the Reset pin, thanks to the built-in pull-up device.
c t
The POR circuit operates dynamically, in that it
d u
o s)
JP JP:2 BYTES/4 CYCLES
triggers MCU initialization on detecting the rising
edge of VDD. The typical threshold is in the region
P r RESET
(
VECTOR
of 2 volts, but the actual value of the detected
threshold depends on the way in which VDD rises.
e u c t
The POR circuit is NOT designed to supervise
e t
l rod
static, or slowly rising or falling VDD.
3.2.5 MCU Initialization Sequence o
s P INITIALIZATION
b
When a reset occurs the stack is reset, the PC is
O ete
loaded with the address of the Reset Vector (locat-
ROUTINE
RETI
RETI: 1 BYTE/2 CYCLES
- l
ed in program ROM starting at address 0FFEh). A
) VA00181
( s o
jump to the beginning of the user program must be
s
coded at this address. Following a Reset, the In-
t
c b
terrupt flag is automatically set, so that the CPU is
u -O
in Non Maskable Interrupt mode; this prevents the
d
o s)
P r
Figure 16. Reset Block Diagram
(
t e uc t
o e
l od VDD
s Pr
ST6
fOSC CK INTERNAL
b
O ete 300kΩ COUNTER
RESET
o l
bs
RESET RESET RESET
2.8kΩ
O POWER ON RESET
WATCHDOG RESET
VA0200B
23/83
ST62T32B ST62E32B
RESETS (Cont’d)
Table 7. Register Reset Status
Register Address(es) Status Comment
Oscillator Control Register 0DBh Main oscillator on
EEPROM Control Register 0DFh EEPROM enabled
Port Data Registers 0C0h to 0C2h
Port Direction Register 0C4h to 0C6h I/O are Input with or without pull-up
Port Option Register 0CCh to 0CEh depending on PORT PULL option
Interrupt Option Register 0C8h
TIMER Status/Control 0D4h Interrupt disabled
00h
)
TIMER disabled
( s
AR
AR
TIMER Status/Control 1 Register
TIMER Status/Control 2 Register
0E8h
0E1h
c t
AR TIMER Status/Control 3 Register 0E2h
d u AR TIMER stopped
AR TIMER Status/Control 4 Register OE3h
r o s)
SPI Registers 0DCh to 0DDh
P c t( SPI disabled
X, Y, V, W, Register
t
080H TO 083H
e e u
Accumulator
Data RAM
0FFh
o l rod
084h to 0BFh
Data RAM Page REgister
Data ROM Window Register b
0CBh
0C9h
s P
EEPROM
- O ete
00h to 03Fh Undefined As written if programmed
A/D Result Register
s ) l
0D0h
o
AR TIMER Capture Register
t (
AR TIMER Reload/Capture Register
c b s0DBh
0D9h
ARTIMER Mask Registers
d u -O
ARTIMER Compare Registers
OE0h-OEFh
OEDh-OEEh
r o s)
TIMER Counter Register 0D3h FFh
P
e uc t
TIMER Prescaler Register
(
Watchdog Counter Register
0D2h
0D8h
7Fh
FEh
Max count loaded
e t
A/D Control Register
l od
0D1h 40h A/D in Standby
o
UART Control
s Pr
UART Data Register
OD7h
OD6h
UART disabled
b
O ete
o l
Obs
24/83
ST62T32B ST62E32B
s
Execution of the STOP instruction is then gov-
loaded periodically. Consequently the timer will
decrement down to 00h and reset the MCU. In or- t
erned by a secondary function associated with the
c
der to maximise the effectiveness of the Watchdog
function, user software must be written with this
d u
NMI pin. If a STOP instruction is encountered
when the NMI pin is low, it is interpreted as WAIT,
concept in mind.
r o s)
as described above. If, however, the STOP in-
struction is encountered when the NMI pin is high,
Watchdog behaviour is governed by two options,
known as “WATCHDOG ACTIVATION” (i.e. P c t(
the Watchdog counter is frozen and the CPU en-
HARDWARE or SOFTWARE) and “EXTERNAL
e t e u ters STOP mode.
STOP MODE CONTROL” (see Table 8).
In the SOFTWARE option, the Watchdog is disa-
o l rod When the MCU exits STOP mode (i.e. when an in-
terrupt is generated), the Watchdog resumes its
b s P
bled until bit C of the DWDR register has been set.
activity.
- O ete
)
Table 8. Recommended Option Choices
s o l
c t (
Functions Required
Stop Mode & Watchdog
b s Recommended Options
“EXTERNAL STOP MODE” & “HARDWARE WATCHDOG”
d u -O
Stop Mode
Watchdog
“SOFTWARE WATCHDOG”
“HARDWARE WATCHDOG”
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
25/83
ST62T32B ST62E32B
WATCHDOG COUNTER
RESET
bit must be set to “1”, since it is this bit which gen-
erates the Reset signal when it changes to “0”;
( s ) D2 T5
clearing this bit would generate an immediate Re-
set.
c t D3 T4
It should be noted that the order of the bits in the
d u
DWDR register is inverted with respect to the as-
sociated bits in the down counter: bit 7 of the
r o s) D4 T3
DWDR register corresponds, in fact, to T0 and bit
P c t(
2 to T5. The user should bear in mind the fact that
t
these bits are inverted and shifted with respect to
e e u D5 T2
o
ter. The relationship between the DWDR registerl rod
the physical counter bits when writing to this regis-
b s P
bits and the physical implementation of the Watch-
dog timer downcounter is illustrated in Figure 17.
D6 T1
- O ete
Only the 6 most significant bits may be used to de- D7 T0
s ) o l
fine the time period, since it is bit 6 which triggers
the Reset when it changes to “0”. This offers the
c t ( b s
user a choice of 64 timed periods ranging from
3,072 to 196,608 clock cycles (with an oscillator ÷28 OSC ÷12
d u -O
frequency of 8MHz, this is equivalent to timer peri-
ods ranging from 384 µs to 24.576ms). VR02068A
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
26/83
ST62T32B ST62E32B
c ( b s
It should be noted that the register bits are re-
t
versed and shifted with respect to the physical
bits are in reverse order).
d u -O
counter: bit-7 (T0) is the LSB of the Watchdog
downcounter and bit-2 (T5) is the MSB.
The software activation option should be chosen
only when the Watchdog counter is to be used as
r o s)
These bits are set to “1” on Reset.
a timer. To ensure the Watchdog has not been un-
expectedly activated, the following instructions
P
e uc t ( should be executed within the first 27 instructions:
e t
l od
jrr 0, WD, #+3
ldi WD, 0FDH
o
s Pr
b
O ete
o l
Obs
27/83
ST62T32B ST62E32B
P
e uc t (
e t
l od
OSCILLATOR
CLOCK
o
8
s Pr
DB0
b
O ete WRITE
o l RESET
bs
DATA BUS
VA00010
O
I
28/83
ST62T32B ST62E32B
3.4 INTERRUPTS
The CPU can manage four Maskable Interrupt ically reset by the core at the beginning of the non-
sources, in addition to a Non Maskable Interrupt maskable interrupt service routine.
source (top priority interrupt). Each source is asso- Interrupt request from source #1 can be config-
ciated with a specific Interrupt Vector which con- ured either as edge or level sensitive by setting ac-
tains a Jump instruction to the associated interrupt cordingly the LES bit of the Interrupt Option Regis-
service routine. These vectors are located in Pro- ter (IOR).
gram space (see Table 9).
Interrupt request from source #2 are always edge
When an interrupt source generates an interrupt sensitive. The edge polarity can be configured by
request, and interrupt processing is enabled, the setting accordingly the ESB bit of the Interrupt Op-
PC register is loaded with the address of the inter- tion Register (IOR).
rupt vector (i.e. of the Jump instruction), which
then causes a Jump to the relevant interrupt serv-
sensitive.
( )
Interrupt request from sources #3 & #4 are level
s
ice routine, thus servicing the interrupt.
Interrupt sources are linked to events either on ex-
c t
In edge sensitive mode, a latch is set when a edge
ternal pins, or on chip peripherals. Several events
can be ORed on the same interrupt source, and
d u
occurs on the interrupt source line and is cleared
when the associated interrupt routine is started.
relevant flags are available to determine which
r o s)
So, the occurrence of an interrupt can be stored,
event triggered the interrupt.
P t(
until completion of the running interrupt routine be-
fore being processed. If several interrupt requests
c
The Non Maskable Interrupt request has the high-
t
est priority and can interrupt any interrupt routine
e e u occurs before completion of the running interrupt
o l rod
at any time; the other four interrupts cannot inter-
rupt each other. If more than one interrupt request
routine, only the first request is stored.
Storage of interrupt requests is not available in lev-
b s P
is pending, these are processed by the processor
core according to their priority level: source #1 has
el sensitive mode. To be taken into account, the
low level must be present on the interrupt pin when
O ete
the higher priority while source #4 the lower. The
-
the MCU samples the line after instruction execu-
tion.
s o l
priority of each interrupt source is fixed.
) At the end of every instruction, the MCU tests the
Table 9. Interrupt Vector Map
Interrupt Source
c t (
Priority
b s
Vector Address
interrupt lines: if there is an interrupt request the
next instruction is not executed and the appropri-
Interrupt source #0
d u -O
1 (FFCh-FFDh)
ate interrupt service routine is executed instead.
Interrupt source #1
r
Interrupt source #2 o s) 2
3
(FF6h-FF7h)
(FF4h-FF5h)
Table 10. Interrupt Option Register Description
P
Interrupt source #3
e uc t ( 4 (FF2h-FF3h) GEN
SET
CLEARED
Enable all interrupts
Disable all interrupts
e t
Interrupt source #4
l od
5 (FF0h-FF1h)
SET
Rising edge mode on inter-
rupt source #2
o
s Pr
3.4.1 Interrupt request ESB
CLEARED
Falling edge mode on inter-
b
All interrupt sources but the Non Maskable Inter-
O ete
rupt source can be disabled by setting accordingly
the GEN bit of the Interrupt Option Register (IOR).
SET
rupt source #2
Level-sensitive mode on in-
terrupt source #1
l
This GEN bit also defines if an interrupt source, in- LES
Falling edge mode on inter-
o
cluding the Non Maskable Interrupt source, can re- CLEARED
rupt source #1
bs
start the MCU from STOP/WAIT modes. OTHERS NOT USED
Interrupt request from the Non Maskable Interrupt
O
source #0 is latched by a flip flop which is automat-
29/83
ST62T32B ST62E32B
INTERRUPTS (Cont’d)
3.4.2 Interrupt Procedure MCU
The interrupt procedure is very similar to a call pro- – Automatically the MCU switches back to the nor-
cedure, indeed the user can consider the interrupt mal flag set (or the interrupt flag set) and pops
as an asynchronous call procedure. As this is an the previous PC value from the stack.
asynchronous event, the user cannot know the The interrupt routine usually begins by the identify-
context and the time at which it occurred. As a re- ing the device which generated the interrupt re-
sult, the user should save all Data space registers quest (by polling). The user should save the regis-
which may be used within the interrupt routines. ters which are used within the interrupt routine in a
There are separate sets of processor flags for nor- software stack. After the RETI instruction is exe-
mal, interrupt and non-maskable interrupt modes, cuted, the MCU returns to the main routine.
which are automatically switched and so do not
need to be saved.
)
Figure 20. Interrupt Processing Flow Chart
( s
The following list summarizes the interrupt proce-
dure:
c t INSTRUCTION
MCU
d u
o s)
FETCH
– The interrupt is detected.
r
INSTRUCTION
e t e u EXECUTE
INSTRUCTION
the stack.
o l rod
– The normal interrupt lines are inhibited (NMI still
active).
– The first internal latch is cleared. b s P WAS
THE INSTRUCTION
NO
LOAD PC FROM
INTERRUPT VECTOR
(FFC/FFD)
O ete
A RETI ?
) -
WARNING: In some circumstances, when a
l
YES
IS THE CORE SET
o
YES
s
ALREADY IN INTERRUPT MASK
?
maskable interrupt occurs while the ST6 core is in
(
NORMAL MODE?
c t b s
NORMAL mode and especially during the execu-
tion of an "ldi IOR, 00h" instruction (disabling all
NO
d u -O
maskable interrupts): if the interrupt arrives during
the first 3 cycles of the "ldi" instruction (which is a
CLEAR
INTERRUPT MASK
PUSH THE
PC INTO THE STACK
r o s)
4-cycle instruction) the core will switch to interrupt
P
e uc (
mode BUT the flags CN and ZN will NOT switch to
t
the interrupt pair CI and ZI.
SELECT
PROGRAM FLAGS
SELECT
t
INTERNAL MODE FLAG
User
e
l od
– User selected registers are saved within the in-
o
"POP"
s Pr
THE STACKED PC
terrupt service routine (normally on a software
b
stack).
O ete
– The source of the interrupt is found by polling the
interrupt flags (if more than one source is associ-
NO
?
CHECK IF THERE IS
AN INTERRUPT REQUEST
AND INTERRUPT MASK
o l
ated with the same vector). YES
VA000014
bs
– The interrupt is serviced.
– Return from interrupt (RETI)
30/83
ST62T32B ST62E32B
INTERRUPTS (Cont’d)
3.4.3 Interrupt Option Register (IOR) Bit 5 = ESB: Edge Selection bit.
The Interrupt Option Register (IOR) is used to en- The bit ESB selects the polarity of the interrupt
able/disable the individual interrupt sources and to source #2.
select the operating mode of the external interrupt Bit 4 = GEN: Global Enable Interrupt . When this bit
inputs. This register is write-only and cannot be is set to one, all interrupts are enabled. When this
accessed by single-bit operations. bit is cleared to zero all the interrupts (excluding
Address: 0C8h — Write Only NMI) are disabled.
Reset status: 00h When the GEN bit is low, the NMI interrupt is ac-
tive but cannot cause a wake up from STOP/WAIT
7 0 modes.
- LES ESB GEN - - - -
( )
This register is cleared on reset.
s
c t
Bit 7, Bits 3-0 = Unused .
Bit 6 = LES: Level/Edge Selection bit.
d u 3.4.4 IInterrupt sources
e t e u
Table 11. Interrupt Requests and Mask Bits
o
Addressl rod Interrupt
Peripheral Register
b s P
Register
Mask bit Masked Interrupt Source
source
GENERAL
TIMER
IOR
TSCR1
- O ete
C8h
D4h
GEN
ETI
All Interrupts, excluding NM I
TMZ: TIMER Overflow
All
source 4
A/D CONVERTER ADCR
s ) D1h
o l EAI EOC: End of Conversion source 4
UART
t
UARTCR
c ( b s
D7h
RXIEN
TXIEN
RXRDY : Byte received
TXMT : Byte sent
source 4
d u -O
SCR1 E8h OVFIEN OVFFLG: ARTIMER Overflow
ARTIMER
r o s)
SCR2
SCR3
E1h
E2h
CP1IEN
CP2IEN
CP1FLG
CP2FLG source 3
P
e uc t (
SCR3 E2h ZEROIEN ZEROFLG: Compare to zero flag
SPI
e t
l od
SCR3
SPI
E2h
DCh
CMPIEN
ALL
CMPFLG: Compare flag
End of Transmission source 1
Port PAn
o
s Pr
ORPA-DRPA C0h-C4h ORPAn-DRPAn PAn pin source 1
b
Port PBn
O ete
Port PCn
ORPB-DRPB
ORPC-DRPC
C1h-C5h
C2h-C6h
ORPBn-DRPBn
ORPCn-DRPCn
PBn pin
PCn pin
source 2
source 0
Port PDn ORPD-DRPD C3h-C7h ORPDn-DRPDn PDn pin source 2
o l
Port PEn ORPE-DRPE FCh-FDh ORPEn-DRPEn PEn pin source 1
Obs
31/83
ST62T32B ST62E32B
IINTERRUPTS (Cont’d)
Interrupt Polarity Register (IPR) set, IPR is cleared and all port interrupts are not in-
verted (e.g. Port C generates interrupts on falling
Address: DAh — Read/Write edges).
7 0 Bit 7 - Bits 5 = Unused.
- - - PortE PortD PortC PortA PortB Bit 4 = Port E Interrupt Polarity.
Bit 3 = Port D Interrupt Polarity .
In conjunction with IOR register ESB bit, the polar- Bit 2 = Port C Interrupt Polarity .
ity of I/O pins triggered interrupts can be selected
by setting accordingly the Interrupt Polarity Regis- Bit 1= Port A Interrupt Polarity.
ter (IPR). If a bit in IPR is set to one the corre-
sponding port interrupt is inverted (e.g. IPR bit 2 =
( s )Bit 0 = Port B Interrupt Polarity.
1 ; port C generates interrupt on rising edge. At re-
c t
Table 12.
u
I/O Interrupts selections according to IPR, IOR programming
d
GEN IPR3 IPR0 IOR5
r o s) Port B occurence Port D occurence
Interrupt
source
1 0 0 0 P c t( falling edge falling edge
1 0 0
e t1
e u rising edge rising edge
1
1
0
0
1
1
o l rod
0
1
rising edge
falling edge
falling edge
rising edge
1 1 0
b s P 0 falling edge rising edge 2
O ete
1 1 0 1 rising edge falling edge
1
1
1
1
) -
1
1
l
0
1
rising edge
falling edge
rising edge
falling edge
0 X
t ( s X
s o X Disabled Disabled
c
u -O b Interrupt
GEN
d
IPR4
o s)
IPR1 IOR6 Port A occurence Port E occurence
source
1
P r 0
(
0 0 falling edge falling edge
1
1
t e uc t
0
0
0
1
1
0
low level
rising edge
low level
falling edge
1
1
o e
l od
0
1
1
0
1
0
high level
falling edge
low level
rising edge 1
b s Pr
1
1
1
1
0
1
1
0
low level
rising edge
high level
rising edge
o l 0 X X X Disabled Disabled
Obs IPR2
0
1
Port C occurence
falling edge
rising edge
Interrupt source
32/83
ST62T32B ST62E32B
INTERRUPTS (Cont’d)
Figure 21. Interrupt Block Diagram
PBE
IPR Bit 2
VDD
PORT C
( s
CLK
)FF
Q
INT #0 NMI (FFC,D))
t
Bits CLR
NMI
u c I0 Start
IPR Bit 0
d
o s)
PORT A PBE
P r ( CLK
FF
Q 0
Bits
e u c t CLR
MUX INT #1 (FF6,7)
IPR Bit 4
e t
l rod
I1 Start
PORT E o
s P
1
b
PBE
Bits
O ete
SPI
-
IOR bit 6 (LES)
RESTART
s )
IPR Bit 1
o l FROM
STOP/WAIT
PORT B PBE
c t ( b s CLK
FF
Q INT #2 (FF4,5)
Bits
d u -O CLR
P
e uc t ( IPR Bit 3
PORT D
Bits
e t
l od
PBE
o
s Pr
CP1FLG
CP1IEN
CP2FLG
b
O ete
CP2IEN
OVFLG
OVFIEN
CMPFLG
INT #3 (FF2,3)
l
CMPIEN
ZEROFLG
o ZEROIEN
Obs TMZ
ETI
33/83
ST62T32B ST62E32B
The WAIT and STOP modes have been imple- of the processor core prior to the WAIT instruction,
mented in the ST62xx family of MCUs in order to but also on the kind of interrupt request which is
reduce the product’s electrical consumption during generated. This is described in the following para-
idle periods. These two power saving modes are graphs. The processor core does not generate a
described in the following paragraphs. delay following the occurrence of the interrupt, be-
3.5.1 WAIT Mode cause the oscillator clock is still available and no
stabilisation period is necessary.
The MCU goes into WAIT mode as soon as the 3.5.2 STOP Mode
WAIT instruction is executed. The microcontroller
can be considered as being in a “software frozen” If the Watchdog is disabled, STOP mode is availa-
state where the core stops processing the pro- ble. When in STOP mode, the MCU is placed in
gram instructions, the RAM contents and peripher-
al registers are preserved as long as the power
( s )
the lowest power consumption mode. In this oper-
ating mode, the microcontroller can be considered
supply voltage is higher than the RAM retention
voltage. In this mode the peripherals are still ac-
c t
as being “frozen”, no instruction is executed, the
oscillator is stopped, the RAM contents and pe-
tive.
d u
ripheral registers are preserved as long as the
power supply voltage is higher than the RAM re-
WAIT mode can be used when the user wants to
reduce the MCU power consumption during idle
r o s)
tention voltage, and the ST62xx core waits for the
occurrence of an external interrupt request or a
periods, while not losing track of time or the capa-
P t(
Reset to exit the STOP state.
c
bility of monitoring external events. The active os-
t
cillator is not stopped in order to provide a clock
e e uIf the STOP state is exited due to a Reset (by acti-
o l rod
signal to the peripherals. Timer counting may be
enabled as well as the Timer interrupt, before en-
vating the external pin) the MCU will enter a nor-
mal reset procedure. Behaviour in response to in-
b s P
tering the WAIT mode: this allows the WAIT mode
to be exited when a Timer interrupt occurs. The
terrupts depends on the state of the processor
core prior to issuing the STOP instruction, and
clock signal.
- O ete
same applies to other peripherals which use the also on the kind of interrupt request that is gener-
ated.
s ) o l
If the WAIT mode is exited due to a Reset (either This case will be described in the following para-
t ( s
by activating the external pin or generated by the
c b
Watchdog), the MCU enters a normal reset proce-
graphs. The processor core generates a delay af-
ter occurrence of the interrupt request, in order to
d u -O
dure. If an interrupt is generated during WAIT
mode, the MCU’s behaviour depends on the state
wait for complete stabilisation of the oscillator, be-
fore executing the first instruction.
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
34/83
ST62T32B ST62E32B
l rod
ed during execution of the non-maskable interrupt
o
logic levels);
– placing all peripherals in their power down
b s P
routine, the MCU exits from the Stop or Wait mode
as soon as an interrupt occurs: the instruction
which follows the STOP or WAIT instruction is ex-
modes before entering STOP mode;
- O ete
ecuted, and the MCU remains in non-maskable in-
terrupt mode, even if another interrupt has been
When the hardware activated Watchdog is select-
ed, or when the software Watchdog is enabled, the
generated.
s ) o l STOP instruction is disabled and a WAIT instruc-
tion will be executed in its place.
t
3.5.3.3 Normal Interrupt Mode
d u -O
If the MCU was in interrupt mode before the STOP
or WAIT instruction was executed, it exits from
MCU can only be restarted by a Reset. Although
setting GEN low does not mask the NMI as an in-
r o s)
STOP or WAIT mode as soon as an interrupt oc-
curs. Nevertheless, two cases must be consid-
terrupt, it will stop it generating a wake-up signal.
ered:
P
e uc t (
– If the interrupt is a normal one, the interrupt rou-
The WAIT and STOP instructions are not execut-
ed if an enabled interrupt request is pending.
e t
tine in which the WAIT or STOP mode was en-
l od
o
s Pr
b
O ete
o l
Obs
35/83
ST62T32B ST62E32B
4 ON-CHIP PERIPHERALS
(
– Open drain output
set.
c t
data direction (input or output) of each pin to be
c t(
All I/O registers can be read or written to just as
ed with the PA0 line of Port A).
o l rod
voltage level values of the lines which have been
manipulation. During MCU initialization, all I/O reg-
isters are cleared and the input mode with pull-ups
b s P
configured as inputs, or to write the logic value of
the signal to be output on the lines configured as
and no interrupt generation is selected for all the
pins, thus avoiding pin conflicts.
- O ete
outputs. The port data registers can be read to get
the effective logic levels of the pins, but they can
s ) o l
c t (
Figure 22. I/O Port Block Diagram
b s
u -O
RESET VDD
SIN CONTROLS
d
o s)
P r ( DATA VDD
t e uc t DIRECTION
REGISTER
o e
l od INPUT/OUTPUT
b s Pr DATA
REGISTER
O ete
SHIFT
REGISTER
o l OPTION
bs
REGISTER
O
SOUT
TO INTERRUPT
TO ADC
VA00413
36/83
ST62T32B ST62E32B
e t e u Option
0
0
0
0
0
1
Input
Input
o l rod
With pull-up, no interrupt
No pull-up, no interrupt
0 1 0
b
Input s P
With pull-up and with interrupt
0
1
1
0 X
1
- O ete
Input
Output
Analog input (when available)
Open-drain output (20mA sink when available)
1 1 X
s ) o
Outputl Push-pull output (20mA sink when available)
37/83
ST62T32B ST62E32B
t
pin (interrupt, pull-up, analog input), these may be
o l rod
state of the input pins. As a general rule, it is better The user must take care not to switch outputs with
b s P
to limit the use of single bit instructions on data
registers to when the whole (8-bit) port is in output
heavy loads during the conversion of one of the
analog inputs in order to avoid any disturbance to
O ete
mode. In the case of inputs or of mixed inputs and
-
the conversion.
s ) o l
Figure 23. Diagram showing Safe I/O State Transitions
c t
pull-up
(
Interrupt
b s 010* 011
Input
Analog
d u -O
r o s)
Input
pull-up (Reset 000 001 Input
P
e uc t (
state)
e t
l od
Output
Open Drain
100 101
Output
Open Drain
o
s Pr
b
O ete
Output
Push-pull
110 111
Output
Push-pull
l
Note *. xxx = DDR, OR, DR Bits respectively
o
Obs
38/83
ST62T32B ST62E32B
PA0-PA7
Input PB0, PB3-PB7
(Reset state if PORT PC5-PC7
PULL option disabled) PD0-PD7 Data in
PE0-PE4
( s ) Interrupt
Input
PA0-PA7
c t
with pull up
PB0, PB3-PB7
PC5-PC7
d u
(Reset state if PORT
PULL option enabled)
PD0-PD7
r o s) Data in
PE0-PE4
P c t( Interrupt
e t e u
Input
PA0-PA7
PB0, PB3-PB7
o l rod
with pull up PC5-PC7
b s P Data in
O ete
with interrupt PD0-PD7
PE0-PE4
) - l
Interrupt
t ( s s o
c
u -O
PA4-PA7
b
Analog Input
d
o s)
PB0, PB3-PB7
PC5-PC7 ADC
P r (
PD0-PD7
t e uc t
o
5mAe
l od
Open drain output PA4-PA7
PB0, PB3-PB7
b s Pr PC5-PC7
PD0-PD7
O ete Data out
o l
Open drain output
20mA
PA0-PA3
PE0-PE4
O bs Push-pull output
5mA
PA4-PA7
PB0, PB3-PB7
PC5-PC7
PD0-PD7 Data out
39/83
ST62T32B ST62E32B
o
PD2/Sin and PD1/Scl pins must be configured as l rod
input through the DDR and OR registers to be
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
40/83
ST62T32B ST62E32B
VDD
PID
RXD
PD4/RXD1 DR
UART
IARTOE
PID
( s )
t
0 DR
PD5/TXD1 MUX
1
u c
TXD
PID PP/OD d
o s)
P r OPR
(
PD3/Sout MUX
1
e u
DR
c t
t
0 OUT
o e
l rod PID
b s P IN
PD2/Sin
- O ete DR
SYNCHRONOUS
SERIAL I/O
s ) o l PID
c t ( b s CLOCK
PD1/Scl
d u -O DR
r o s) PWMEN
P
e uc t ( PID
e t
PA3/PWM
l od
MUX
1
0 DR
PWM
o
s Pr
b
O ete
PID
CP1
o l PA4/CP1 DR
ARTIMER 16
Obs PID
CP2
PA5/CP2 DR
OVFEN
PID
1 OVF
PA2/OVF MUX
0 DR
VR01661D
41/83
ST62T32B ST62E32B
Px7 Px6 Px5 Px4 Px3 Px2 Px1 Px0 Px7 Px6 Px5 Px4 Px3 Px2 Px1 Px0
Bit 7-0 = Px7 - Px0: Port A, B, C, D and E Option Bit 7-0 = Px7 - Px0: Port A, B, C, D and E Data
Register bits. Registers bits.
4.1.7 I/O Port Data Direction Registers
( s )
DDRA/B/C/D/E (C4h PA, C5h PB, C6h PC, C7h
PD, FDh PE)
c t
Read/Write
d u
7 0
r o s)
Px7 Px6 Px5 Px4 Px3 Px2 Px1 Px0
P c t(
e t e u
rection Registers bits.
o l rod
Bit 7-0 = Px7 - Px0: Port A, B, C, D and E Data Di-
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
42/83
ST62T32B ST62E32B
4.2 TIMER
The MCU features an on-chip Timer peripheral, The prescaler input can be the internal frequency
consisting of an 8-bit counter with a 7-bit program- fINT divided by 12 or an external clock applied to
mable prescaler, giving a maximum count of 2 15. the TIMER pin. The prescaler decrements on the
The peripheral may be configured in three different rising edge. Depending on the division factor pro-
operating modes. grammed by PS2, PS1 and PS0 bits in the TSCR.
Figure 25 shows the Timer Block Diagram. The The clock input of the timer/counter register is mul-
external TIMER pin is available to the user. The tiplexed to different sources. For division factor 1,
content of the 8-bit counter can be read/written in the clock input of the prescaler is also that of tim-
the Timer/Counter register, TCR, while the state of er/counter; for factor 2, bit 0 of the prescaler regis-
the 7-bit prescaler can be read in the PSC register. ter is connected to the clock input of TCR. This bit
The control logic device is managed in the TSCR changes its state at half the frequency of the pres-
register as described in the following paragraphs.
( )
caler input clock. For factor 4, bit 1 of the PSC is
s
connected to the clock input of TCR, and so forth.
The 8-bit counter is decremented by the output
(rising edge) coming from the 7-bit prescaler and
c t
The prescaler initialize bit, PSI, in the TSCR regis-
ter must be set to “1” to allow the prescaler (and
can be loaded and read under program control.
When it decrements to zero then the TMZ (Timer
d u
hence the counter) to start. If it is cleared to “0”, all
Zero) bit in the TSCR is set to “1”. If the ETI (Ena-
r o s)
the prescaler bits are set to “1” and the counter is
inhibited from counting. The prescaler can be
ble Timer Interrupt) bit in the TSCR is also set to
“1”, an interrupt request is generated as described P c t(
loaded with any value between 0 and 7Fh, if bit
in the Interrupt Chapter. The Timer interrupt can
e t e u PSI is set to “1”. The prescaler tap is selected by
means of the PS2/PS1/PS0 bits in the control reg-
be used to exit the MCU from WAIT mode.
o l rod ister.
Figure 25. Timer Block Diagram b s P Figure 26 illustrates the Timer’s working principle.
- O ete
s ) o l DATABUS 8
c t
8
( b s 8 8
d u -O6
5 8-BIT
COUNTER
b7 b6 b5 b4
STATUS/CONTROL
b3 b2 b1 b0
o s)
4 SELECT REGISTER
r
PSC 3 1 OF 7 TMZ ETI TOUT DOUT PSI PS2 PS1 PS0
2
P
e uc t ( 1
0
e t
l od
3
o
s Pr
b
TIMER
O ete INTERRUPT
LINE
o l SYNCHRONIZATION LATCH
bs
LOGIC
O fOSC :12
VA00009
43/83
ST62T32B ST62E32B
TIMER (Cont’d)
4.2.1 Timer Operating Modes The user can select the desired prescaler division
There are three operating modes, which are se- ratio through the PS2, PS1, PS0 bits. When the
lected by the TOUT and DOUT bits (see TSCR TCR count reaches 0, it sets the TMZ bit in the
register). These three modes correspond to the TSCR. The TMZ bit can be tested under program
two clocks which can be connected to the 7-bit control to perform a timer function whenever it
prescaler (fINT ÷ 12 or TIMER pin signal), and to goes high. The low-to-high TMZ bit transition is
the output mode. used to latch the DOUT bit of the TSCR and trans-
fer it to the TIMER pin. This operating mode allows
4.2.1.1 Gated Mode external signal generation on the TIMER pin.
(TOUT = “0”, DOUT = “1”)
Table 15. Timer Operating Modes
In this mode the prescaler is decremented by the
Timer clock input (f INT ÷ 12), but ONLY when the
signal on the TIMER pin is held high (allowing
TOUT
- O ete
The TIMER pin is connected to the DOUT latch,
one.
c t (
Figure 26. Timer Working Principle
b s
d u -O
r o s) 7-BIT PRESCALER
CLOCK
PBIT0
e t
l od
0 1 2 3 4 5 6 7 PS0
o
s Pr 8-1 MULTIPLEXER PS1
b
O ete
PS2
bs
8-BIT COUNTER
VA00186
44/83
ST62T32B ST62E32B
TIMER (Cont’d)
4.2.3 Application Notes Data sent to the timer output when TMZ is set high
TMZ is set when the counter reaches zero; howev- (output mode only). Input mode selection (input
mode only).
er, it may also be set by writing 00h in the TCR
register or by setting bit 7 of the TSCR register. Bit 3 = PSI: Prescaler Initialize Bit
The TMZ bit must be cleared by user software
when servicing the timer interrupt to avoid unde- Used to initialize the prescaler and inhibit its count-
sired interrupts when leaving the interrupt service ing. When PSI=“0” the prescaler is set to 7Fh and
routine. After reset, the 8-bit counter register is the counter is inhibited. When PSI=“1” the prescal-
loaded with 0FFh, while the 7-bit prescaler is load- er is enabled to count downwards. As long as
ed with 07Fh, and the TSCR register is cleared. PSI=“0” both counter and prescaler are not run-
ning.
This means that the Timer is stopped (PSI=“0”)
and the timer interrupt is disabled.
( s )
Bit 2, 1, 0 = PS2, PS1, PS0: Prescaler Mux. Se-
lect. These bits select the division ratio of the pres-
If the Timer is programmed in output mode, the
DOUT bit is transferred to the TIMER pin when
c t
caler register.
TMZ is set to one (by software or due to counter
decrement). When TMZ is high, the latch is trans- u
Table 16. Prescaler Division Factors
d
parent and DOUT is copied to the timer pin. When
r o s) PS2 PS1 PS0 Divided by
TMZ goes low, DOUT is latched.
P c t( 0 0 0 1
A write to the TCR register will predominate over
e t e u
the 8-bit counter decrement to 00h function, i.e. if a
0
0
0
1
1
0
2
4
write and a TCR register decrement to 00h occur
o
simultaneously, the write will take precedence,l rod 0 1 1 8
b s P
and the TMZ bit is not set until the 8-bit counter
reaches 00h again. The values of the TCR and the
1
1
0
0
0
1
16
32
O ete
PSC registers can be read accurately at any time.
-
1
1
1
1
0
1
64
128
4.2.4 Timer Registers
s ) o l
Address: 0D4h —
c (
Timer Status Control Register (TSCR)
t
Read/Write b s
7
d u -O 0
Timer Counter Register TCR
Address: 0D3h — Read/Write
r o s)
P (
TMZ ETI TOUT DOUT PSI PS2 PS1 PS0 7 0
t e uc t
Bit 7 = TMZ: Timer Zero bit
D7 D6 D5 D4 D3 D2 D1 D0
o e
l od
A low-to-high transition indicates that the timer
s Pr
Bit 7-0 = D7-D0: Counter Bits.
count register has decrement to zero. This bit must
b
be cleared by user software before starting a new
O ete
count.
Prescaler Register PSC
Bit 6 = ETI: Enable Timer Interrupt
o l
When set, enables the timer interrupt request. If
Address: 0D2h — Read/Write
bs
ETI=0 the timer interrupt is disabled. If ETI=1 and
TMZ=1 an interrupt request is generated.
O
Bit 5 = TOUT: Timers Output Control
7
D7 D6 D5 D4 D3 D2 D1
0
D0
When low, this bit selects the input mode for the Bit 7 = D7: Always read as "0".
TIMER pin. When high the output mode is select-
ed. Bit 6-0 = D6-D0: Prescaler Bits.
Bit 4 = DOUT: Data Output
45/83
ST62T32B ST62E32B
4.3 ARTIMER 16
The ARTIMER16 is a timer module based on a 16 time as the write to the low byte. This high byte will
bit downcounter with Reload, Capture and Com- remain constant if further writes are made to the
pare features to manage timing requirements. Two low bytes, until the high byte is changed. Full
outputs provide PWM and Overflow (OVF) output Read/Write access is available to all registers ex-
signals each with programmable polarity, and two cept where mentioned.
inputs CP1 and CP2 control start-up, capture The ARTIMER16 may be placed into the reset
and/or reload operations on the central counter. mode by resetting RUNRES to 0 in order to
The ARTIMER16 includes four 16-bit registers achieve lower consumption. The contents of
CMP,RLCP,MASK and CP for the Reload, Cap- RLCP, CP, MASK and CMP are not affected, nor
ture and compare functions, four 8-bit status/con- is the previous run mode of the timer changed. If
trol registers and the associated control logic.The RUNRES is subsequently set to 1, the timer re-
16-bit registers are accessed from the 8-bit inter-
( s ) starts in the same RUN mode as previously set if
nal bus. The full 16-bit word is written in two bytes,
the high byte first and then the low byte. The high
c t no changes are made to the timer status registers.
Finally, interrupt capabilities are associated to the
byte is stored in an intermediate register and is
written to the target 16-bit register at the same
d u Reload, Capture and Compare features.
SCR2
b
O ete
8
Compare PWM
) - l
t ( s SCR3
s o 8 16
MASK
16-Bit
8-Bit MCU DATA BUS
b
16-Bit DATA BUS
c
u -O 4
d
o s)
SCR4 Compare-to-0 OVF
P r ( 16 16-Bit
t e uc t RLCP
BUS INTERFACE
o e
l od 8 16
COUNTER
b s Pr 16
16-Bit
O ete CP
o l
Obs CP1
INT CONTROL LOGIC
CP2
VR02014
46/83
ST62T32B ST62E32B
The maximum time for downcounting is therefore the Compare Register CMP. The comparison
216 x Psc x Tclk where Psc is the prescaler ratio, range to 0000h and CMP is defined by using the
and Tclk the period of the main oscillator. MASK register to select which bits are used, there-
This down counter is stopped and its content kept fore the comparisons performed are:
cleared as long as RUNRES bit is cleared. – MASK&CT = ? MASK&CMP.
4.3.1.1 Reload functions – MASK&CT = ? 0000h.
The 16-bit down counter can be reloaded 3 differ- When a matched comparison to 0000h or
ent ways: MASK&CMP occurs, the flags ZEROFLG and
At a zero overflow occurrence with the bit RELOAD COMPFLG are respectively set.
cleared: The counter is reloaded to FFFFh. By using MASK values reported in Table 17, the
At a zero overflow occurrence with the bit MASK register works as counter frequency multi-
RELOAD set: The counter is reloaded with the val-
ue programmed in the RLCP register. For each
( s )
plier for the compare functions. In that case posi-
tive masked comparison occur with a period of
overflow, the transition between 0000h and the re-
c t
2(n+1) x Psc x Tclk where n is the position of the
most significant bit of MASK value.
load value (RLCP or FFFFh) is flagged through the
OVFFLG bit.
d u
Table 17. Recommended Mask Values
At an external event on pin CP1 or CP2 with the bit
r o s)
Hexadecimal Binary
MSbit at 1
(
position,n
RELOAD set: The counter is reloaded with the val-
ue programmed in the RLCP register. P
e u c t
FFFFh 1111 1111 1111 1111 15
As a consequence, the time between a timer re-
load and a zero overflow occurrence depends on
e t
l rod
7FFFh
3FFFh
0111 1111 1111
0011 1111 1111
1111
1111
14
13
t ( s s o
The value in the counter CT is continuously com- Note: Writing 0000h in MASK gives a period equal
to two times the prescaled period Psc x Tclk.
c
u -O b
pared to 0000h and to the value programmed into
Figure 28. Flags Setting in Compare and Reload Functions
d
o s)
P r ( FFFFh
t e uc t
Counter
Value CT
CMP 0 or
RLCP
o e
l od
b s Pr ZEROFLG
Software Reset
O ete
o l
bs
OVFFLG
Software Reset
O
COMPFLG
Software Reset
47/83
ST62T32B ST62E32B
)
Any positive comparison to 0000h or
s o l CMP value. The frequency is half the frequency in
Set/Reset mode and the duty-cycle is always 50%.
c ( b s
MASK&CMP, and any overflow occurence can be
t
used to control the OVF or PWM output pins in Note : In PWM mode, the value of CMP register
r
PWM pin output modes
o s) OVF pin activation is directed by the timer overflow
MASK & CNT
= 0000h
xP
e uc
x
t ( no yes no yes X
occurence and therefore its frequency depends
only of the downcounting time from the reload val-
MASK&CT=
MASK&CMP e t
l od x x yes no yes no yes
ue to 0000h. This means its period is equal to T=
(RLCP+1) x Psc x Tclk in Set/Reset mode and 2 x
PWMEN o
s Pr 0 0 1 1 1 1 1
(RLCP+1) x Psc x Tclk in Toggle mode.
PWMMD
b
O ete
PWMPOL
X
0
X
1
0
0
0
0
0
1
0
1
1
X
Duty cycle is controlled in Set/Reset mode
(OVFMD cleared) by software, since OVF pin can
be reset only by clearing the OVFFLG bit. In toggle
PWM pin 0 1 Reset Set Set Reset Toggle
bs
Table 18. Achievable periods on PWM pin
O
Mask value FFFFh xxxxh
(n+1)
Period in Set/Reset mode (PWMMD=0) (RLCP+1) x Psc x Tclk 2 x Psc x Tclk
Period in Toggle mode (PWMMD=1) 2 x (RLCP+1) x Psc x Tclk 2 x 2 (n+1) x Psc x Tclk
Note: n is the position of the most significant bit of MASK value.
48/83
ST62T32B ST62E32B
Figure 29. Mask Impact on the Compare Functions in PWM mode (PWMD=0, PWMPOL=1)
Counter F E D C B A 9 8 7 6 5 4 3 2 1 0 F
Bit 0...3
MASK 24/fCLK
most
000Fh significant
“1” is bit 3
( s ) 23/fCLK
0007h
c t most
significant
0003&000C = 0000h
d u
0003&0007 = 0003&000F
“1” is bit 2
r o s) 22/f CLK
P c t( most
0003h
e t e u significant
b s P 21/fCLK
most
0001h
- O ete significant
“1” is bit 0
CMP = 000Fh
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
49/83
ST62T32B ST62E32B
4.3.3 TIMINGS MEASUREMENT MODES – CP1 triggered restart mode with CP2 event de-
These modes are based on the capture of the tection.
down counter content into either CP or RLCP reg- – CP2 triggered restart mode with second CP2
isters. Some are used in conjunction with a syn- event detection.
chronisation of the down counter by reload func- – Software triggered restart mode with CP2 event
tions on external event on CPi pins or software detection.
RUNRES setting, while other modes do not affect CP1 triggered restart mode with CP2 event de-
the downcounting. As long as RELOAD bit is tection.
cleared, the down counter remains in free running
mode. This mode is enabled for RLDSEL2=0 and
RLDSEL1=1.
RELOAD
External events on CPi pins are enabled as soon as
1 Reload on CP1,CP2, RUNRES / Capture CP2
0 Capture CP1 / Capture CP2 )
RUNRES bit is set, which lets the prescaler and the
s
down counter running. The next active edge on CP1
(
4.3.3.1 Timing measurement with startup
c t
causes the counter to be loaded from RLCP, the
CP1FLG to be set and the downcounting starts from
control
u
RLCP value. Each following active edge on CP1 will
d
Three startup conditions, selected by RLDSELi bit
can reload the counter from RLCP and initiate the
r o s)
cause a reload of the counter. If CP1FLG is not reset
before the next reload, the CP1ERR flag is set at the
down counting when RELOAD bit is set. The first
P c t(
same time as the counter is reloaded. Both flags
mode is software controlled through the RUNRES
e t e u
bit, while the two others are based on external event
should then be cleared by software.
While the counter is counting, any active edge on
o l rod
on pins CP1 and CP2 with configurable polarities. CP2 will capture the value of the counter at that in-
b s P
External event on CP2 pin (with configurable po-
larities) is used as strobe to launch the capture of
stant into the CP Register and set the CP2FLG bit.
If CP2FLG is not cleared before the following CP2
event, the CP2ERR flag bit is set, and no new cap-
O ete
the CT counter into CP. When RELOAD bit is set,
RLCP cannot be used for capture, since it contains
-
ture can be performed
the reload value..
r o s)
Figure 30. CP1 Triggered Restart Mode with CP2 Event Detection
P
e uc t (
t
COUNTER 0000h 0000h
e
CT
o l od
b s Pr
RUNRES
O ete
o l Enable the Inputs Software Reset
bs
CP1
CP2
50/83
ST62T32B ST62E32B
e
No action
o l rod
CP2
b s P
First Capture CT into CP
Then Reload CT from RLCP
- O ete Reload CT from RLCP
Set CP2ERR
Reload CT from RLCP
Set CP2FLG
s ) o l VR02007C
c t ( b s
d u -O
Figure 32. Software Triggered Restart Mode with CP2 Event Detection
r o s)
COUNTER
P
e uc t
0000h ( 0000h
CT
e t
l od
o
s Pr
RUNRES
b
O ete Load Counter from RLCP and Startup Software Reset
o l
CP1
CP2
51/83
ST62T32B ST62E32B
l rod
CP2ERR are cleared, the first active edge on CP2
o
write operation, the interrupt output will go high,
signalling the interrupt to the Core.
b s P
will trigger a capture into CP, triggering CP2FLG.
As long as CP2FLG has not been cleared, a sec-
O ete
Figure 33. Positive CP1 - to negative CP2-Edge Measurement (CP1POL = 1, CP2POL = 0)
-
s ) o l
COUNTER
c t ( b s
d u -O
CP1
r o s)
P
e uc t (
e t
Capture into RLCP
l od Set CP1FLG
Set CP1ERR
o
s Pr
b
O ete
CP2
bs
Set CP2FLG
VR02006F
O
Application Note: CP1=CP2 CP1POL=CP2POL Measurement
Depending on polarity setting for CP1/CP2, and of Yes Yes Period
CP1/CP2 connections, phase, period and pulse Yes No Pulse width
width measurements can be achieved. The total No X Phase
independence between CP1 and CP2 captures al-
lows phase detection by measuring which of
CP1FLG or CP2FLG is set at first following a reset
52/83
ST62T32B ST62E32B
4.3.5 CONTROL REGISTERS Bit 0 = This bit is reserved and must be set to 0.
Status Control Register 1 (SCR1) Status Control Register 2 (SCR2)
Address: E8h - Read/Write/Clear only Address: E1h - Read/Write/Clear only
7 0 7 0
Bits 7 & 6 = PSC2..PSC1. Clock Prescaler. These Bit 7 = Reserved. Must be kept cleared.
bits define the prescaler options for the prescaler Bit 6 = CP1ERR. CP1 Error Flag. This bit is set to
to the Counter Register according to the following 1 if a new CP1 event has taken place since
table. CP1FLG was set to signal an error condition, it is 0
PSC2 PSC1 Function
Clock Disabled (prescaler and counter
( s )
if there has been no event.
It is recommended to clear CP1ERR at any time
0 0
stopped
c t
that CP1FLG is cleared, as further CP1 events
0
1
1
0
Prescale by 1
Prescale by 4
d u
cannot be recognised if CP1ERR is set. This bit
cannot bet set by write, only cleared.
1 1 Prescale by 16
r o s) Bit 5 = CP2ERR. CP1 Error Flag. This bit is set to
The Prescaler must be disabled (PSC2 = 0, PSC1 P c t(1 if a new CP2 event has taken place since
CP2FLG was set to signal an error condition, it is 0
= 0) before a new prescaler factor is set if the
b s P
To avoid inconsistencies in timing, the prescaler
factor should be set first, and then the counter
cannot be recognised if CP2ERR is set. This bit
cannot bet set by write, only cleared.
started.
- O ete
Bit 5 = RELOAD. Reload enabled. When set this
Bit 4 = CP1IEN. CP1 Interrupt Enable. CP1 The
Capture 1 Interrupt is masked when this bit is 0.
s ) o l
bit enables reload from RLCP register into CT reg- Setting the bit to 1 enables the CP1 event flag
t ( b s
ister. On the contrary, if RELOAD is cleared,
RLCP is used as target for capture from the coun-
c
CP1FLG to set the ARTIMER interrupt.
Bit 3 = CP1FLG. CP1 Interrupt Flag. When this bit
ter CT register.
d u -O
Bit 4 = RUNRES. Run/Reset. This bit enables the
is 0, no CP1 event has occurred since the last
clear of this bit. If the bit is at 1, a CP1 event has
r o s)
RUN or RESET operation of the ARTIMER.
If 0, the counter CT is cleared to zero, and is
occurred.
P
e uc t (
stopped. Setting this bit to 1 permits the startup of
This bit cannot be set by program, only cleared.
Bit 2 = CP1POL. CP1 Edge Polarity Select.
e t
the counter, and enables the synchronisation cir-
cuits for the timer inputs CP1 and CP2.
l od
CP1POL defines the polarity for triggering the CP1
event.
o
Bit 3 = OVFIEN. Overflow Int. Enable. The Over-
s Pr
flow Interrupt is masked when this bit is 0.
A 0 defines the action on a falling edge on the CP1
input, a 1 on a rising edge.
b
Setting the bit to 1 enables the overflow flag to set
O ete
the ARTIMER interrupt.
Bit 1 & 0 = RLDSEL2..RLDSEL1. Reload Source
Select. These bits define the source for the reload
o l
Bit 2 = OVFFLG. When this bit is 0, no overflow
has occurred since the last clear of this bit. If the
events; they do not affect the operation of the cap-
ture modes.
bs
bit is at 1, an overflow has occurred.
This bit cannot be set by program, only cleared. RLDSEL2 RLDSEL1 Function
O
Bit 1 = OVFMD. The Overflow Output mode is set
by this bit; when 0, the overflow output is run in set
0 0
Reload and startup triggered by
RUNRES
mode (OVF will be set on the first overflow event, Reload triggered by every CP1
and will be reset when OVFFLG is cleared). When 0 1
event
1 the overflow output is in toggle mode; OVF tog- Reload triggered by every CP2
gles its state on every overflow event (independ- 1 0
event
ent to the state of OVFFLG).
1 1 Reload disabled
53/83
ST62T32B ST62E32B
o l rod
This bit cannot be set by program, only cleared.
A Masked-Compare is the logical AND of the Mask
b
pare Interrupt is masked when this bit is 0.s P
Bit 4 = CMPIEN. Compare Int. Enable. The Com-
s ) o l
Bit 3 = CMPFLG. Compare Flag. When this bit is
0, no Masked-Compare True event has occurred
Mask Register MASK with the Counter Register
c t ( s
since the last clear of this flag. If the bit is at 1, a
b
CT, compared with zero: [(MASK & CT) = 0000h]
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
54/83
ST62T32B ST62E32B
c
Overflow output is disabled: if OVFPOL = 0, the
state of OVF is 0, if OVFPOL = 1, the state of
e t e u
Example:
OVF = 1.The Overflow Output is enabled when
o l rod
this bit = 1, it must be set to use the OVF output.
The following sequence is NOT GOOD:
b s P
Bit 1 = PWMPOL. PWM Output Polarity. This bit
ldi t16cmph, 055h
ldi t16cmpl, 000h
- O ete
defines the polarity for the PWM Output PWM.
When 0, PWM is set on every Masked-Counter
; t16cmp (16-bit register)=5500h
s ) o
enabled in Set/Reset mode (PWMEN = 1, PWM-l
Zero event and is reset on a Masked-Compare if ldi t16cmph, 0AAh
; t16cmp (16-bit register)=5500h
MD = 0).
c t ( b s
The reset state of PWM pin is 0 When 1, OVF is
inc t16cmph
d u -O
set on every Masked-Compare event and is reset
on a Masked-Counter Zero event if enabled in
; t16cmp (16-bit register)=5500h
ldi t16cmpl, 000h
r o s)
Set/Reset mode (PWMEN = 1, PWMMD = 0). ; t16cmp (16-bit register)=5600h
P
e uc t (
The reset state of PWM is 1.
Bit 0 = PWMEN. PWM Output Enable. This bit en-
; and NOT AB00h
t
ables the PWM output PWM. When 0 the PWM
e
l od
output is disabled: if PWMPOL = 0, the state of The CORRECT sequence is:
o
s Pr
PWM is 0, if PWMPOL = 1, the state of PWM = 1. ldi t16cmph, 055h
b
The PWM Output is enabled when this bit = 1, it
must be set to use the PWM output.
O ete
Notes:
ldi t16cmpl, 000h
; t16cmp (16-bit register)=5500h
ldi t16cmph, 0AAh
o l
A Masked-Compare is the logical AND of the Mask
Register MASK with the Counter Register CT, ; t16cmp (16-bit register)=5500h
bs
compared with the logical AND of the compare ldi t16cmpl, 000h
Register CMP: [(MASK & CT) = (MASK&CMP)].
O
; t16cmp (16-bit register)=AA00h
A Masked-Counter Zero is the logical AND of the
inc t16cmph
Mask Register MASK with the Counter Register
CT, compared with zero: [(MASK & CT) = 0000h]. ; t16cmp (16-bit register)=AA00h
ldi t16cmpl, 000h
;t16cmp (16-bit register)=AB00h
55/83
ST62T32B ST62E32B
Reload/Capture Register High Byte (RLCP) Compare Register High Byte (CMP)
Address: E9h - Read/ (Write if RELOAD bit set) Address: EDh - Read/Write
D7-D0. These bits are the High byte (D15-D8) of D7-D0. These bits are the High byte (D15-D8) of
the 16-bit Reload/Capture Register. the 16-bit Compare Register.
Reload/Capture Register Low Byte (RLCP) Compare Register Low Byte (CMP)
Address: EAh - Read/ (Write if RELOAD bit set) Address: EEh - Read/Write
D7-D0. These bits are the Low byte (D7-D0) of the D7-D0. These bits are the Low byte (D7-D0) of the
16-bit Reload/Capture Register. 16-bit Compare Register.
d
Capture Register Low Byte (CP)
r o s)
Mask Register Low Byte (MASK)
Address: ECh - Read Only
P t(
Address: E0h - Read/Write
c
D7-D0. These bits are the Low byte (D7-D0) of the
16-bit Capture Register.
e t e u
D7-D0. These bits are the Low byte (D7-D0) of the
16-bit Mask Register.
o l rod
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
56/83
ST62T32B ST62E32B
o 8 8
b s P
The ADC uses two registers in the data space: the
ADC data conversion register, ADR, which stores
CORE CORE
O ete
the conversion result, and the ADC control regis-
-
CONTROL SIGNALS VA00418
s o l
ter, ADCR, used to program the ADC functions.
)
A conversion is started by writing a “1” to the Start
t ( s
bit (STA) in the ADC control register. This auto-
c b
matically clears (resets to “0”) the End Of Conver-
4.4.1 Application Notes
The A/D converter does not feature a sample and
d u -O
sion Bit (EOC). When a conversion is complete,
the EOC bit is automatically set to “1”, in order to
hold circuit. The analog voltage to be measured
r o s)
flag that conversion is complete and that the data
should therefore be stable during the entire con-
version cycle. Voltage variation should not exceed
P (
in the ADC data conversion register is valid. Each
t
conversion has to be separately initiated by writing
e uc
±1/2 LSB for the optimum conversion accuracy. A
low pass filter may be used at the analog input
e t
to the STA bit.
l od
The STA bit is continuously scanned so that, if the
pins to reduce input voltage variation during con-
version.
o
s Pr
user sets it to “1” while a previous conversion is in
progress, a new conversion is started before com-
When selected as an analog channel, the input pin
b
pleting the previous one. The start bit (STA) is a
O ete
write only bit, any attempt to read it will show a log-
is internally connected to a capacitor Cad of typi-
cally 12pF. For maximum accuracy, this capacitor
must be fully charged at the beginning of conver-
ical “0”.
o l
The A/D converter features a maskable interrupt
sion. In the worst case, conversion starts one in-
struction (6.5 µs) after the channel has been se-
bs
associated with the end of conversion. The inter- lected. In worst case conditions, the impedance,
rupt request occurs when the EOC bit is set (i.e. ASI, of the analog voltage source is calculated us-
O
when a conversion is completed). The interrupt is
masked using the EAI (interrupt mask) bit in the
control register.
ing the following formula:
6.5µs = 9 x Cad x ASI
(capacitor charged to over 99.9%), i.e. 30 kΩ in-
The power consumption of the device can be re- cluding a 50% guardband. ASI can be higher if Cad
duced by turning off the ADC peripheral. This is has been charged for a longer period by adding in-
done by setting the PDS bit in the ADC control reg- structions before the start of conversion (adding
ister to “0”. If PDS=“1”, the A/D is powered and en- more than 26 CPU cycles is pointless).
abled for conversion. This bit must be set at least
57/83
ST62T32B ST62E32B
d u
the interrupt option then this bit can be used as an
interrupt pending bit. Data in the data conversion
V DD – V SS
----------------------------
r o s)
register are valid only when this bit is set to “1”.
256
P t(
Bit 5 = STA : Start of Conversion. Write Only. Writ-
c
e t e u ing a “1” to this bit will start a conversion on the se-
lected channel and automatically reset to “0” the
o
must be constant for 1µs before conversion and l rod
The Input voltage (Ain) which is to be converted
EOC bit. If the bit is set again when a conversion is
in progress, the present conversion is stopped and
remain constant during conversion.
b s P
Conversion resolution can be improved if the pow-
a new one will take place. This bit is write only, any
attempt to read it will show a logical zero.
lowered.
- O ete
er supply voltage (VDD) to the microcontroller is Bit 4 = PDS: Power Down Selection. This bit acti-
s ) o l
In order to optimise conversion resolution, the user
vates the A/D converter if set to “1”. Writing a “0” to
this bit will put the ADC in power down mode (idle
c t ( b s
can configure the microcontroller in WAIT mode,
because this mode minimises noise disturbances
mode).
Bit 3 = Reserved. Must be kept cleared
d u -O
and power supply variations due to output switch-
ing. Nevertheless, the WAIT instruction should be Bit 2= CLSEL: Clock Selection. When set, the
r o s)
executed as soon as possible after the beginning
of the conversion, because execution of the WAIT
ADC is driven by the MCU internal clock divided by
6, and typical conversion time at 8MHz is 35µs.
P t (
instruction may cause a small variation of the VDD
e uc
When cleared (Reset state), MCU clock divided by
12 is used with a typical 70µs conversion time at
t
voltage. The negative effect of this variation is min-
e
imized at the beginning of the conversion when the
l od
converter is less sensitive, rather than at the end
8MHz.
o
s Pr
of conversion, when the less significant bits are
Bit 1-0: Reserved. Must be kept cleared.
b
determined.
O ete
The best configuration, from an accuracy stand-
point, is WAIT mode with the Timer stopped. In-
A/D Converter Data Register (ADR)
Address: 0D0h — Read only
l
deed, only the ADC peripheral and the oscillator
o
are then still working. The MCU must be woken up 7 0
bs
from WAIT mode by the ADC interrupt at the end
of the conversion. It should be noted that waking
O
up the microcontroller could also be done using
D7 D6 D5 D4 D3 D2 D1 D0
the Timer interrupt, but in this case the Timer will Bit 7-0 = D7-D0 : 8 Bit A/D Conversion Result.
be working and the resulting noise could affect
conversion accuracy.
58/83
ST62T32B ST62E32B
The UART provides the basic hardware for asyn- 4.5.1 PORTS INTERFACING
chronous serial communication which, combined RXD reception line and TXD emission line are
with an appropriate software routine, gives a serial sharing the same external pins as two I/O lines.
interface providing communication with common Therefore, UART configuration requires to set
baud rates (up to 38,400 Baud with an 8MHz ex- these two I/O lines through the relevant ports reg-
ternal oscillator) and flexible character formats. isters. The I/O line common with RXD line must be
Operating in Half-Duplex mode only, the UART defined as input mode (with or without pull-up)
uses 11-bit characters comprising 1 start bit, 9 data while the I/O line common with TXD line must be
bits and 1 Stop bit. Parity is supported by software defined as output mode (Push-pull or open drain).
only for transmit and for checking the received par- The transmitted data is inverted and can therefore
ity bit (bit 9). Transmitted data is sent directly, while
received data is buffered allowing further data
( s )
use a single transistor buffering stage. Defined as
input, the RXD line can be read at any time as an
characters to be received while the data is being
read out of the receive buffer register. Data trans-
c t I/O line during the UART operation. The TXD pin
follows I/O port registers value when UARTOE bit
mit has priority over data being received.
d u is cleared, which means when no serial transmis-
sion is in progress. As a consequence, a perma-
The UART is supplied with an MCU internal clock
that is also available in WAIT mode of the processor.
r o s) nent high level has to be written onto the I/O port in
e t e u
Figure 35. UART Block Diagram
o l rod
b s P
O ete
START RXD1
DETECTOR
) - l
t ( s s o UARTOE
c
u -O b DIN DATA SHIFT DOUT
TXD
1
d
o s)
REGISTER
DR
MUX TXD1
P r ( WRITE
D8 D7 D6 D5 D4 D3 D2 D1 D0 0
e uc t
CONTROL LOGIC
e t READ
TO CORE
o l od
s Pr
RECEIVE BUFFER
REGISTER
b
O ete
o l
bs
D9
CONTROL REGISTER
BAUD RATE
O RX and TX
INTERRUPTS
fINT PROGRAMMABLE
DIVIDER
BAUD RATE x 8
VR02009
59/83
ST62T32B ST62E32B
4.5.2 CLOCK GENERATION The character options are summarised in the fol-
The UART contains a built-in divider of the MCU lowing table.
internal clock for most common Baud Rates as
Table 19. Character Options
shown in Table 20. Other baud rate values can be
calculated from the chosen oscillator frequency di- Start Bit 8 Data 1 Software Parity 1 Stop
vided by the Divisor value shown. Start Bit 9 Data No Parity 1 Stop
The divided clock provides a frequency that is 8 Start Bit 8 Data No Parity 2 Stop
times the desired baud rate. This allows the Data Start Bit 7 Data 1 Software Parity 2 Stop
reception mechanism to provide a 2 to 1 majority Bit 9 remains in the state programmed for consec-
voting system to determine the logic state of the utive transmissions until changed by the user or
asynchronous incoming serial logic bit by taking 3 until a character is received when the state of this
timed samples within the 8 time states. bit is changed to that of the incoming bit 9. The
The bits not sampled provide a buffer to compen-
s )
recommended procedure is thus to set the value of
(
sate for frequency offsets between sender and re-
ceiver.
c t
this bit before transmission is started.
Transmission is started by writing to the Data Reg-
4.5.3 DATA TRANSMISSION
d u
ister (the Baud Rate and Bit 9 should be set before
this action). The UARTOE signal switches the out-
Transmission is fixed to a format of one start bit,
nine data bits and one stop bit. The start and stop
r o s)
put multiplexer to the UART output and a start bit
bits are automatically generated by the UART. The
P c t(
is sent (a 0 for one bit time) followed by the 8 data
values (lsb first) and the value of the Bit9 bit. The
nine databits are under control of the user and are
e t e u
flexible in use. Bits 0..7 are typically used as data output is then set to 1 for a period of one bit time to
l rod
bits while bit 9 is typically used as parity, but can
o
generate a Stop bit, and then the UARTOE signal
returns the TXD1 line to its alternate I/O function.
b s P
also be a 9th data bit or an additional Stop bit. As
parity is not generated by the UART, it should be
calculated by program and inserted in the appro-
The end of transmission is flagged by setting
TXMT to 1 and an interrupt is generated if ena-
O ete
priate position of the data (i.e as bit 7 for 7-bit data,
-
bled. The TXMT flag is reset by writing a 0 to the
bit position, it is also cleared automatically when a
as the independent bit 9).
s o l
with Bit 9 set to 1 giving two effective stop bits or
) new character is written to the Data Register.
d u -O
r o s)
Figure 36. Data Sampling Points Figure 37. Character Format
P
e uc t (
e t
l od
1 BIT START
BIT
STOP
BIT
o
s Pr D0 D1 D7 D8
b
O ete BIT
POSITION
1 2 8 9 10
POSSIBLE
o l 0 1 2 3 4 5 6 7 8
START OF DATA
NEXT
CHARACTER
bs
SAMPLES START
VR02010
VR02012
60/83
ST62T32B ST62E32B
UARTOE
b s P share the same address
- O ete
TXD
1
s ) o l
PORT DATA
c t
MUX
( b s TXD1
OUTPUT
d u -O
0
r o s) VR02011
P
e uc t (
Table 20. Baud Rate Selection
BR2 e t
l od BR2 BR0 fINT Division
Baud Rate
0 o
s Pr 0 0 6.656
fINT = 8MHz
1200
fINT = 4MHz
600
b0
O ete
0
0
1
1
0
3.328
1.664
2400
4800
1200
2400
o l
0
1
1
0
1
0
832
416
9600
19200
4800
9600
Obs 1
1
1
0
1
1
1
0
1
256
208
31200
38400
Reserved
15600
19200
61/83
ST62T32B ST62E32B
REGISTERS (Cont’d)
UART Control Register (UARTCR) Writing to RXIEN does not affect the status of the
Address: D7h, Read/Write interrupt flag RXRDY.
7 0 Bit 4 = TXIEN. Transmit Interrupt Enable. When
this bit is set to 1, the transmit interrupt is enabled.
RXRDY TXMT RXIEN TXIEN BR2 BR1 BR0 DAT9 Writing to TXIEN does not affect the status of the
interrupt flag TXRDY.
Bit 7 = RXRDY. Receiver Ready . This flag be- Bit 3-1= BR2..BR0. Baudrate select. These bits
comes active as soon as a complete byte has select the operating baud rate of the UART, de-
been received and copied into the receive buffer. It pending on the frequency of fOSC. Care should be
may be cleared by writing a zero to it. Writing a taken not to change these bits during communica-
one is possible. If the interrupt enable bit RXIEN is tion as writing to these bits has an immediate ef-
set to one, a software interrupt will be generated. fect.
( s )
Bit 6 = TXMT. Transmitter Empty . This flag be-
comes active as soon as a complete byte has
c t
Bit 0 = DAT9. Parity/Data Bit 9. This bit represents
the 9th bit of the data character that is received or
been sent. It may be cleared by writing a zero to it.
It is automatically cleared by the action of writing a u
transmitted. A write to this bit sets the level for the
d
data value into the UART data register.
r o s)
bit 9 to be transmitted, so it must always be set to
the correct level before transmission. If used as
Bit 5 = RXIEN. Receive Interrupt Enable. When
P t(
parity, the value has first to be calculated by soft-
c
e t e u
this bit is set to 1, the receive interrupt is enabled. ware. Reading this bit will return the 9th bit of the
received character.
o l rod
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
62/83
ST62T32B ST62E32B
s
register and the counter. To allow SPI operation in
(
pin is the serial shift input and Sout is the serial
shift output. These two lines can be tied together
c t
slave mode, the SCL pin must be programmed as
input and an external clock must be supplied to
to implement two wires protocols (I²C-bus, etc).
When data is serialized, the MSB is the first bit. Sin
d u
this pin to drive the SPI peripheral.
has to be programmed as input. For serial output
r o s)In master mode, SCL is programmed as output, a
clock signal must be generated by software to set
P c t(
and reset the port line.
Figure 39. SPI Block Diagram
e t e u
o l rod
b s P SPI Interrupt Disable Register
Write
s ) o l CLK
c t ( b s RESET
SCL
u -O
I/O Port
d
r o s) Data Reg
Direction
P (
Set Res
t e uc t DIN
RESET Q4
o e
l od CP 4-Bit Counter
Q4
s Pr
(Q4=High after Clock8)
bSin
O ete
I/O Port
Data Reg
Direction Interrupt
o l
bs
Reset
8-Bit Data Load
CP Shift Register
O
DIN DOUT
Output
OPR Reg. 8-Bit Tristate Data I/O Enable
Sout I/O Port 0
MUX
DOUT D0............................D7
1 Data Reg
Direction to Processor Data Bus
VR01504
63/83
ST62T32B ST62E32B
t e u
After power on reset, or after writing the data/shift
e
It is recommended, in order to avoid spurious in-
o l rod
register, the counter is reset to zero and the clock
is enabled. In this condition the data shift register
terrupts from the SPI, to disable the SPI interrupt
(the default state after reset) i.e. no write must be
b s P
is ready for reception. No start condition has to be
detected. Through the user software the Core may
made to the 8-bit shift register. An explicit interrupt
disable may be made in software by a dummy
O ete
pull down the Sin line (Acknowledge) and slow
-
down the SCL, as long as it is needed to carry out
write to the SPI interrupt disable register.
c t ( b s
I²C-bus Master-Slave, Receiver-Transmitter
When pins Sin and Sout are externally connected
Address: DDh - Read/Write (SDSR)
7 0
d u -O
together it is possible to use the SPI as a receiver
as well as a transmitter. Through software routine
o s)
D7 D6 D5 D4 D3 D2 D1 D0
P r
(by using bit-set and bit-reset on I/O line) a clock
(
can be generated allowing I²C-bus to work in mas-
ter mode.
t e uc t
When implementing an I²C-bus protocol, the start
A write into this register enables SPI Interrupt after
8 clock pulses.
e
l od
condition can be detected by setting the processor
o
s Pr
into a wait for start condition by enabling the inter-
SPI Interrupt Disable Register
b
rupt of the I/O port used for the Sin line. This frees
the processor from polling the Sin and SCL lines.
O ete
After the transmission/reception the processor has
Address: DCh - Read/Write (SIDR)
l
to poll for the STOP condition. 7 0
o
In slave mode the user software can slow down
bs
D7 D6 D5 D4 D3 D2 D1 D0
the SCL clock frequency by simply putting the SCL
I/O line in output open-drain mode and writing a
O
zero into the corresponding data register bit. A dummy write to this register disables SPI Inter-
rupt.
64/83
ST62T32B ST62E32B
5 SOFTWARE
The ST6 software has been designed to fully use bits of the opcode with the byte following the op-
the hardware in the most efficient way possible code. The instructions (JP, CALL) which use the
while keeping byte usage to a minimum; in short, extended addressing mode are able to branch to
to provide byte efficient programming capability. any address of the 4K bytes Program space.
The ST6 core has the ability to set or clear any
register or RAM location bit of the Data space with An extended addressing mode instruction is two-
a single instruction. Furthermore, the program byte long.
may branch to a selected address depending on
Program Counter Relative. The relative address-
the status of any bit of the Data space. The carry
bit is stored with the value of the bit when the SET
or RES instruction is processed.
( s )
ing mode is only used in conditional branch in-
structions. The instruction is used to perform a test
c t
and, if the condition is true, a branch with a span of
-15 to +16 locations around the address of the rel-
5.2 ADDRESSING MODES
d u
ative instruction. If the condition is not true, the in-
struction which follows the relative instruction is
The ST6 core offers nine addressing modes,
r o s)
executed. The relative addressing mode instruc-
which are described in the following paragraphs.
Three different address spaces are available: Pro- P c t(
tion is one-byte long. The opcode is obtained in
adding the three most significant bits which char-
gram space, Data space, and Stack space. Pro-
e
gram space contains the instructions which are to t e u acterize the kind of the test, one bit which deter-
mines whether the branch is a forward (when it is
o l rod
be executed, plus the data for immediate mode in-
structions. Data space contains the Accumulator,
0) or backward (when it is 1) branch and the four
less significant bits which give the span of the
b s P
the X,Y,V and W registers, peripheral and In-
put/Output registers, the RAM locations and Data
branch (0h to Fh) which must be added or sub-
tracted to the address of the relative instruction to
O ete
ROM locations (for storage of tables and con-
-
stants). Stack space contains six 12-bit RAM cells
obtain the address of the branch.
) l
used to stack the return addresses for subroutines
s o
Bit Direct. In the bit direct addressing mode, the
bit to be set or cleared is part of the opcode, and
and interrupts.
c t ( b s
Immediate. In the immediate addressing mode,
the byte following the opcode points to the ad-
dress of the byte in which the specified bit must be
d u -O
the operand of the instruction follows the opcode
location. As the operand is a ROM byte, the imme-
set or cleared. Thus, any bit in the 256 locations of
Data space memory can be set or cleared.
r o s)
diate addressing mode is used to access con-
stants which do not change during program execu- Bit Test & Branch. The bit test and branch ad-
P t (
tion (e.g., a constant used to initialize a loop coun-
ter).
e uc
dressing mode is a combination of direct address-
ing and relative addressing. The bit test and
e t
l od
Direct. In the direct addressing mode, the address
branch instruction is three-byte long. The bit iden-
tification and the tested condition are included in
o
of the byte which is processed by the instruction is
s Pr
stored in the location which follows the opcode. Di-
the opcode byte. The address of the byte to be
tested follows immediately the opcode in the Pro-
b
rect addressing allows the user to directly address
O ete
the 256 bytes in Data Space memory with a single
two-byte instruction.
gram space. The third byte is the jump displace-
ment, which is in the range of -127 to +128. This
displacement can be determined using a label,
o l
Short Direct. The core can address the four RAM
which is converted by the assembler.
bs
registers X,Y,V,W (locations 80h, 81h, 82h, 83h) in Indirect. In the indirect addressing mode, the byte
the short-direct addressing mode. In this case, the processed by the register-indirect instruction is at
O
instruction is only one byte and the selection of the
location to be processed is contained in the op-
code. Short direct addressing is a subset of the di-
the address pointed by the content of one of the in-
direct registers, X or Y (80h,81h). The indirect reg-
ister is selected by the bit 4 of the opcode. A regis-
rect addressing mode. (Note that 80h and 81h are ter indirect instruction is one byte long.
also indirect registers).
Inherent. In the inherent addressing mode, all the
Extended. In the extended addressing mode, the information necessary to execute the instruction is
12-bit address needed to define the instruction is contained in the opcode. These instructions are
obtained by concatenating the four less significant one byte long.
65/83
ST62T32B ST62E32B
The ST6 core offers a set of 40 basic instructions Load & Store. These instructions use one, two or
which, when combined with nine addressing three bytes in relation with the addressing mode.
modes, yield 244 usable opcodes. They can be di- One operand is the Accumulator for LOAD and the
vided into six different types: load/store, arithme- other operand is obtained from data memory using
tic/logic, conditional branch, control instructions, one of the addressing modes.
jump/call, and bit manipulation. The following par-
agraphs describe the different types. For Load Immediate one operand can be any of
the 256 data space bytes while the other is always
All the instructions belonging to a given type are immediate data.
presented in individual tables.
Table 21. Load & Store Instructions
( s ) Flags
Instruction Addressing Mode
c t
Bytes Cycles
Z
∆
C
LD A, X
LD A, Y
Short Direct
Short Direct
d u 1
1
4
4 ∆
*
*
LD A, V Short Direct
r o s) 1 4 ∆ *
LD A, W Short Direct
P c t( 1 4 ∆
∆
*
LD X, A
LD Y, A
Short Direct
Short Direct
e t e u 1
1
4
4 ∆
*
*
LD V, A Short Direct
o l rod 1 4 ∆ *
LD W, A
LD A, rr Direct
b s P
Short Direct 1
2
4
4
∆
∆
*
*
LD rr, A
LD A, (X)
- O ete
Direct
Indirect
2
1
4
4
∆
∆
*
*
LD A, (Y)
s ) o
Indirect l 1 4 ∆ *
LD (X), A
LD (Y), A
c t ( b s
Indirect
Indirect
1
1
4
4
∆
∆
*
*
LDI A, #N
d u -O Immediate 2 4 ∆ *
LDI rr, #N
r o s) Immediate 3 4 * *
Notes:
P
e uc t (
X,Y. Indirect Register Pointers, V & W Short Direct Registers
t
# . Immediate data (stored in ROM memory)
e
l od
rr. Data space register
∆. Affected
o
s Pr
* . Not Affected
b
O ete
o l
O bs
66/83
ST62T32B ST62E32B
- O ete 2 4 ∆
∆
∆
∆
CPI A, #N
DEC X
Immediate
s )
Short Direct
o l 2
1
4
4 ∆ *
DEC Y
DEC V
c t ( b s
Short Direct
Short Direct
1
1
4
4
∆
∆
*
*
DEC W
d u -OShort Direct 1 4 ∆ *
DEC A
DEC rr
r o s) Direct
Direct
2
2
4
4
∆
∆
*
*
DEC (X)
P
e uc t ( Indirect 1 4 ∆ *
DEC (Y)
INC X
e t
l od
Indirect
Short Direct
1
1
4
4
∆
∆
*
*
INC Y
o
s Pr
Short Direct 1 4 ∆
∆
*
INC V
INC Wb
O ete
INC A
Short Direct
Short Direct
Direct
1
1
2
4
4
4
∆
∆
*
*
*
INC rr
o l Direct 2 4 ∆
∆
*
bs
INC (X) Indirect 1 4 *
INC (Y) Indirect 1 4 ∆ *
ORLC A
SLA A
SUB A, (X)
Inherent
Inherent
Indirect
1
2
1
4
4
4
∆
∆
∆
∆
∆
∆
SUB A, (Y) Indirect 1 4 ∆ ∆
SUB A, rr Direct 2 4 ∆ ∆
SUBI A, #N Immediate 2 4 ∆ ∆
Notes:
X,Y.Indirect Register Pointers, V & W Short Direct RegistersD. Affected
# . Immediate data (stored in ROM memory)* . Not Affected
rr. Data space register
67/83
ST62T32B ST62E32B
( s ) Cycles
Z C
JRC e
JRNC e
C=1
C=0
1
1
c t 2
2
*
*
*
*
JRZ e Z=1 1
d u 2 * *
JRNZ e
JRR b, rr, ee
Z=0
Bit = 0
r o s)
1
3
2
5
*
*
*
∆
JRS b, rr, ee Bit = 1
P c
3
t( 5 * ∆
Notes:
e t e u
l rod
b. 3-bit address rr. Data space register
e. 5 bit signed displacement in the range -15 to +16<F128M> ∆ . Affected. The tested bit is shifted into carry.
o
ee. 8 bit signed displacement in the range -126 to +129
s P
* . Not Affected
) -
Addressing Mode
l
Bytes Cycles
Z C
SET b,rr
RES b,rr
t ( s
Bit Direct
Bit Direct
s o 2
2
4
4
*
*
*
*
Notes:
b. 3-bit address; c
u -O b * . Not<M> Affected
d
rr. Data space register;
o s)
P r
Table 25. Control Instructions
(
Instruction
bs
∆ . Affected
*. Not Affected
O
Table 26. Jump & Call Instructions
Instruction
Addressing Mode Bytes Cycles
Flags
Z C
CALL abc Extended 2 4 * *
JP abc Extended 2 4 * *
Notes:
abc. 12-bit address;
* . Not Affected
68/83
ST62T32B ST62E32B
Opcode Map Summary. The following table contains an opcode map for the instructions used by the ST6
LOW LOW
0 1 2 3 4 5 6 7
0000 0001 0010 0011 0100 0101 0110 0111
HI HI
2 JRNZ 4 CALL 2 JRNC 5 JRR 2 JRZ 2 JRC 4 LD
0 e abc e b0,rr,ee e # e a,(x) 0
0000 0000
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind
2 JRNZ 4 CALL 2 JRNC 5 JRS 2 JRZ 4 INC 2 JRC 4 LDI
1 e abc e b0,rr,ee e x e a,nn 1
0001 0001
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc 2 imm
2 JRNZ 4 CALL 2 JRNC 5 JRR 2 JRZ 2 JRC 4 CP
2 e abc e b4,rr,ee e # e a,(x) 2
0010 0010
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind
3
0011
2
e
JRNZ 4 CALL
abc
2
e
JRNC 5 JRS
b4,rr,ee
( s ) 2
e
JRZ 4
a,x
LD 2
e
JRC 4
a,nn
CPI
3
0011
1
2
pcr
JRNZ
2
4
ext
CALL
1
2
pcr
JRNC
3
5
c t bt
JRR
1
2
pcr 1
JRZ
sd 1
2
prc 2
JRC 4
imm
ADD
4
0100
1
e
pcr 2
abc
ext 1
e
pcr 3
d u
b2,rr,ee
bt 1
e
pcr
#
1
e
prc 1
a,(x)
ind
4
0100
5
2 JRNZ 4 CALL 2 JRNC
r o s)
5 JRS 2 JRZ 4 INC 2 JRC 4 ADDI
5
(
e abc e b2,rr,ee e y e a,nn
0101
1 pcr 2 ext 1
P
pcr
e u
3
t
2 JRNZ 4 CALL 2 JRNC 5 JRR 2 JRZ 2 JRC 4 INC
6 6
e
e abc e b6,rr,ee e # e (x)
l rod
0110 0110
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind
7
2
e
JRNZ 4 CALL
abc
2
o
s P e
JRNC 5 JRS
b6,rr,ee
2
e
JRZ 4
a,y
LD 2
e
JRC
# 7
0111
1
2
pcr
JRNZ
2
4
ext
CALL b1
O ete
2
pcr
JRNC
3
5
bt
JRR
1
2
pcr 1
JRZ
sd 1
2
prc
JRC 4 LD
0111
8
1000
1
e
pcr 2
abc
) -
ext
l
1
e
pcr 3
b1,rr,ee
bt 1
e
pcr
#
1
e
prc 1
(x),a
ind
8
1000
9
2 RNZ 4
t ( s CALL
b
e abc e b1,rr,ee e v e #
c
1001 1001
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 sd 1 prc
A
2
e
JRNZ
d u -O4 CALL
abc
2
e
JRNC 5 JRR
b5,rr,ee
2
e
JRZ
#
2
e
JRC 4
a,(x)
AND
A
1010
1
r o s)
pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind
1010
B
1011
2
P e
e uc
JRNZ
t ( 4 CALL
abc
2
e
JRNC 5 JRS
b5,rr,ee
2
e
JRZ 4
a,v
LD 2
e
JRC 4
a,nn
ANDI
B
1011
C
e t
1
2
l od e
pcr
JRNZ
2
4
abc
ext
CALL
1
2
e
pcr
JRNC
3
5
bt
JRR
b3,rr,ee
1
2
e
pcr 1
JRZ
#
sd 1
2
e
prc 2
JRC 4
a,(x)
imm
SUB
C
1100
o
s Pr
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind
1100
bD
O ete
1101
2
1
e
JRNZ
pcr
4
2
CALL
abc
ext
2
1
e
JRNC
pcr
5
3
JRS
b3,rr,ee
bt
2
1
e
JRZ 4
pcr 1
w
INC 2
sd 1
e
JRC 4
prc 2
a,nn
SUBI
imm
D
1101
o lE
1110
e abc e b7,rr,ee e # e (x) E
1110
bs
1 pcr 2 ext 1 pcr 3 bt 1 pcr 1 prc 1 ind
2 JRNZ 4 CALL 2 JRNC 5 JRS 2 JRZ 4 LD 2 JRC
F e abc e b7,rr,ee e a,w e # F
O 1111
1 pcr 2
Legend:
pcr 3 bt 1 pcr 1 sd 1 prc
1111
69/83
ST62T32B ST62E32B
3
0011
2
e
JRNZ 4
abc
JP 2
e
JRNC 4
b4,rr
SET
( s )2
e
JRZ 4
x,a
LD 2
e
JRC 4
a,rr
CP
3
0011
1
2
pcr
JRNZ
2
4
ext 1
JP 2
pcr
JRNC
2
4
c tb.d
RES
1
2
pcr 1
JRZ 2
sd 1
RETI 2
prc 2
JRC 4 ADD
dir
4
0100
1
e
pcr 2
abc
ext 1
e
pcr 2
d u
b2,rr
b.d 1
e
pcr 1 inh 1
e
prc 1
a,(y)
ind
4
0100
5
2 JRNZ 4 JP 2 JRNC
r o s)
4 SET 2 JRZ 4 DEC 2 JRC 4 ADD
5
(
e abc e b2,rr e y e a,rr
0101
1 pcr 2 ext 1
P
pcr
e u
2
t
2 JRNZ 4 JP 2 JRNC 4 RES 2 JRZ 2 STOP 2 JRC 4 INC
6 6
e
e abc e b6,rr e e (y)
l rod
0110 0110
1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind
7
2
e
JRNZ 4
abc
JP 2
o
s P e
JRNC 4
b6,rr
SET 2
e
JRZ 4
y,a
LD 2
e
JRC 4
rr
INC
7
0111
1
2
pcr
JRNZ
2
4 b
ext 1
O ete
JP 2
pcr
JRNC
2
4
b.d
RES
1
2
pcr 1
JRZ
sd 1
2
prc 2
JRC 4
dir
LD
0111
8
1000
1
e
pcr 2
abc
) - l
ext 1
e
pcr 2
b1,rr
b.d 1
e
pcr
#
1
e
prc 1
(y),a
ind
8
1000
9
2 RNZ 4
t ( s s o
JP 2 JRNC 4 SET 2 JRZ 4 DEC 2 JRC 4 LD
9
b
e abc e b1,rr e v e rr,a
c
1001 1001
1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir
A
2
e
JRNZ
d u -O4
abc
JP 2
e
JRNC 4 RES
b5,rr
2
e
JRZ 4
a
RCL 2
e
JRC 4
a,(y)
AND
A
1010
1
r o s)
pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind
1010
B
1011
2
P e
e uc
JRNZ
t ( 4
abc
JP 2
e
JRNC 4
b5,rr
SET 2
e
JRZ 4
v,a
LD 2
e
JRC 4
a,rr
AND
B
1011
C
e t
1
2
l od e
pcr
JRNZ
2
4
abc
ext 1
JP 2
e
pcr
JRNC
2
4
b.d
RES
b3,rr
1
2
e
pcr 1
JRZ 2
sd 1
RET 2
e
prc 2
JRC 4
a,(y)
SUB
dir
C
1100
o
s Pr
1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind
1100
bD
O ete
1101
2
1
e
JRNZ
pcr
4
2
abc
JP 2
ext 1
e
JRNC
pcr
4
2
b3,rr
SET
b.d
2
1
e
JRZ 4
pcr 1
w
DEC 2
sd 1
e
JRC 4
prc 2
a,rr
SUB
dir
D
1101
o lE
1110
e abc e b7,rr e e (y) E
1110
bs
1 pcr 2 ext 1 pcr 2 b.d 1 pcr 1 inh 1 prc 1 ind
2 JRNZ 4 JP 2 JRNC 4 SET 2 JRZ 4 LD 2 JRC 4 DEC
F e abc e b7,rr e w,a e rr F
O 1111
1 pcr 2
Legend:
pcr 2 b.d 1 pcr 1 sd 1 prc 2 dir
1111
70/83
ST62T32B ST62E32B
6 ELECTRICAL CHARACTERISTICS
This product contains devices to protect the inputs Power Considerations.The average chip-junc-
against damage due to high static voltages, how- tion temperature, Tj, in Celsius can be obtained
ever it is advisable to take normal precaution to from:
avoid application of any voltage higher than the Tj=TA + PD x RthJA
specified maximum rated voltages.
Where:TA = Ambient Temperature.
For proper operation it is recommended that VI
and VO be higher than V SS and lower than V DD. RthJA =Package thermal resistance (junc-
Reliability is enhanced if unused inputs are con- tion-to ambient).
nected to an appropriate logic voltage level (VDD
or V SS).
( s ) PD = Pint + Pport.
d u by the user).
Symbol
r
Parameter
o s) Value Unit
VDD Supply Voltage
P c t( -0.3 to 7.0 V
VI Input Voltage
o l rod
Current Drain per Pin Excluding VDD, VSS
VSS - 0.3 to VDD + 0.3(1)
±10
V
mA
IVDD
b s P
Total Current into VDD (source) 50 mA
IVSS
Tj
- O ete
Total Current out of VSS (sink)
Junction Temperature
50
150
mA
°C
TSTG
s ) o
Storage Temperaturel -60 to 150 °C
Notes:
c t ( b s
u -O
- Stresses above those listed as “absolute maximum ratings” may cause permanent damage to the device. This is a stress rating only and
functional operation of the device at these conditions is not implied. Exposure to maximum rating conditions for extended periods may
d
affect device reliability.
r o s)
- (1) Within these limits, clamping diodes are guarantee to be not conductive. Voltages outside these limits are authorised as long as injection
current is kept within the specification.
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
O bs
71/83
ST62T32B ST62E32B
fOSG
Internal Frequency with OSG
enable2)
VDD = 3V
(
VDD = 4.5V
s ) 2
4
fOSC
fOSC
MHz
d u
Pin Injection Current (negative) VDD = 4.5 to 5.5V -5 mA
Notes:
r o s)
1. Care must be taken in case of negative current injection, where adapted impedance must be respected on analog sources to not affect the
P t(
A/D conversion. For a -1mA injection, a maximum 10 KΩ is recommended.
c
e u
2. An oscillator frequency above 1MHz is recommended for reliable A/D results.
e t
l rod
Figure 40. Maximum Operating Frequency (fMAX) versus Supply Voltage (V DD)
o
s P
b
O ete
Maximum FREQUENCY (MHz)
) - l
7
c b
FUNCTIONALITY IS NOT
6
u -O fOSG
GUARANTEED
d
IN THIS AREA
r o s)
5
3 Suffix Version
P
e uc
4
t (
e t
l od
3
fOSG Min
o
s Pr
2
b
O ete
1
2.5 3 3.5 4 4.5 5 5.5 6
bs
The shaded area is outside the recommended operating range; device functionality is not guaranteed under these conditions.
72/83
ST62T32B ST62E32B
Value
Symbol Parameter Test Conditions Unit
Min. Typ. Max.
VIL Input Low Level Voltage
VDD x 0.3 V
All Input pins
VIH Input High Level Voltage
VDD x 0.7 V
All Input pins
( s ) 0.1
VOL
All Output pins VDD= 5.0V; IOL = + 3mA
VDD= 5.0V; IOL = +10µA
c t 0.8
0.1 V
Low Level Output Voltage
20 mA Sink I/O pins
VDD= 5.0V; IOL = +7mA
d
VDD= 5.0V; IOL = +15mA u 0.8
1.3
VOH
r o s)
High Level Output Voltage VDD= 5.0V; IOL = -10µA 4.9
V
All Output pins
P (
VDD= 5.0V; IOL = -3.0mA
c t
3.5
e u
All Input pins 40 100 200
ΚΩ
RPU Pull-up Resistance
IIL
IIH o
All Input pins but RESET VIN = VDD
s P
0.1 1.0
µA
Input Leakage Current
RESET pin b
VIN = VSS
VIN = VDD
O ete
Supply Current in RESET VRESET=VSS
-8 -16 -30
10
Mode
) - l
fOSC=8MHz
7 mA
Supply Current in
RUN Mode (2)
t ( s s o
VDD=5.0V fINT=8MHz, TA < 85°C 7 mA
IDD
Mode (3) c
Supply Current in WAIT
d
Supply Current in STOP
o s)
ILOAD= 0mA
20 µA
P r
Mode (3)
(
VDD= 5.0V
Notes:
t e uc t
(1) Hysteresis voltage between switching levels
e
l od
(2) All peripherals running
o
(3) All peripherals in stand-by
b s Pr
(TA = -40 to +85°C unless otherwise specified)
O ete Value
o l
Symbol Parameter Test Conditions
Min. Typ. Max.
Unit
bs
Low Level Output Voltage VDD= 5.0V; IOL = +10µA 0.1
All Output pins VDD= 5.0V; IOL = + 5mA 0.8
O
VOL VDD= 5.0V; IOL = +10µA 0.1 V
Low Level Output Voltage
VDD= 5.0V; IOL = +10mA 0.8
20 mA Sink I/O pins
VDD= 5.0V; IOL = +20mA 1.3
VOH High Level Output Voltage VDD= 5.0V; IOL = -10µA 4.9
V
All Output pins VDD= 5.0V; IOL = -5.0mA 3.5
Supply Current in STOP ILOAD= 0mA
IDD 10 µA
Mode VDD= 5.0V
73/83
ST62T32B ST62E32B
Symbol Value
Parameter Test Conditions Unit
Min. Typ. Max.
tREC Supply Recovery Time (1) 100 ms
Minimum Pulse Width (VDD = 5V)
TWR RESET pin 100 ns
NMI pin 100
TA = 25°C 5 10
TWEE EEPROM Write Time TA = 85°C 10 20 ms
( s )
QA LOT Acceptance
20
300,000 1 million
30
cycles
Retention EEPROM Data Retention
c t
TA = 55°C 10 years
CIN Input Capacitance
u
All Inputs Pins
d
10 pF
COUT Output Capacitance
r o s)
All Outputs Pins 10 pF
Note:
P t(
1. Period for which VDD has to be connected at 0V to allow internal Reset function at next power-up.
c
e t e u
6.5 A/D CONVERTER CHARACTERISTICS
o l rod
b s P
(TA = -40 to +125°C unless otherwise specified)
Value
Symbol Parameter
Res Resolution
s ) o l 8
±2
Bit
c t ( b s
(1) (2) fOSC > 1.2MHz
fOSC > 32kHz
fOSC = 8MHz, TA < 85°C 70
±4
LSB
tC
u -O
Conversion Time
d
fOSC = 4MHz 140
µs
ZIR
r o s)
Zero Input Reading
Conversion result when
VIN = VSS
00 Hex
FSR P t (
Full Scale Reading
e uc
Conversion result when
VIN = VDD
FF Hex
ADI
e t
Analog Input Current During
l od
Conversion
VDD= 4.5V 1.0 µA
ACIN
o
s Pr Analog Input Capacitance 2 5 pF
Notes:b
O ete
1. Noise at AVDD, AV SS <10mV
2. With oscillator frequencies less than 1MHz, the A/D Converter accuracy is decreased.
o l
O bs
74/83
ST62T32B ST62E32B
( s )
(TA = -40 to +125°C unless otherwise specified)
c t
Symbol Parameter
d u
Test Conditions
Min.
Value
Typ. Max.
Unit
c
50 ns
th Hold Time
Symbol
- O ete
Parameter Test Conditions
Value
Unit
fIN
t ( s
Input Frequency on CP1, CP2 Pins
c b
TBD MHz
tW
d u -O
Pulse Width at CP1, CP2 Pins
VDD = 3.0V
VDD > 4.5V
1
125
µs
ns
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
75/83
ST62T32B ST62E32B
7 GENERAL INFORMATION
Figure 41. 42-Pin Plastic Dual In-Line Package, Shrink 600-mil Width
mm inches
Dim.
E Min Typ Max Min Typ Max
A 5.08 0.200
A2 A A1 0.51 0.020
A1 L c E1
( s ) A2
b
3.05
0.38
3.81 4.57 0.120 0.150 0.180
0.46 0.56 0.015 0.018 0.022
t
b2 b e eA
b2 0.89 1.02 1.14 0.035 0.040 0.045
D
eB
E
d
o s) 0.015
D 36.58 36.83 37.08 1.440 1.450 1.460
P r (
GAGE PLANE
E
E1
15.24 16.00 0.600
12.70 13.72 14.48 0.500 0.540 0.570
0.630
e u c t e 1.78 0.070
e t
l rod eC
eA
eB
15.24
18.54
0.600
0.730
o
s P
eB
eC 1.52 0.000 0.060
b
O ete
L 2.54 3.30 3.56 0.100 0.130 0.140
Number of Pins
) - l
N 42
t ( s s o
c b
Figure 42. 52-Pin Plastic Quad Flat Package
u -O
d
o s)
P r (
t
D
e uc
D1
D2
t A1
A
A2
Dim.
Min
mm
Typ Max Min
inches
Typ Max
o e
l od A 4.19 5.08 0.165 0.200
b s Pr b
A1
D
2.29
17.40
3.30 0.090
17.65 0.685
0.130
0.695
O ete D1
D2
19.05
17.53
19.20 0.750
18.54 0.690
0.756
0.730
o l e D3 15.24 0.600
bs
E2 E1 E
E 17.40 17.65 0.685 0.695
E1 19.05 19.20 0.750 0.756
O E2
E3
17.53
15.24
18.54 0.690
0.600
0.730
Number of Pins
1.60 mm
L
c
N 52
0×- 7×
76/83
ST62T32B ST62E32B
( s ) 35.56 1.400
t
E1 14.48 14.99 15.49 0.570 0.590 0.610
u c e
G
1.78 0.070
14.12 14.38 14.63 0.556 0.566 0.576
d
o s)
G1 18.69 18.95 19.20 0.736 0.746 0.756
P r (
G2 1.14 0.045
e t
l rod
CDIP42SW
G4
L
15.11 15.37 15.62 0.595 0.605 0.615
2.92 5.08 0.115 0.200
o
s P
S 0.89
Number of Pins
0.035
b
O ete
N 42
) - l
THERMAL CHARACTERISTIC
t ( s s o
Symbol
c
u -O
Parameter b
Test Conditions
Min.
Value
Typ. Max.
Unit
d
o s) SDIP42 70
RthJA
P r
Thermal Resistance
(
QFP52 70
°C/W
t e uc t
o e
l od
b s Pr
O ete
o l
Obs
77/83
ST62T32B ST62E32B
d u
r o s)
P c t(
e t e u
o l rod
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
o l
Obs
78/83
ST6232B
8-BIT MCUs WITH A/D CONVERTER,
16 bit AUTO-RELOAD TIMER, EEPROM, SPI AND UART
■
Run, Wait and Stop Modes
5 Interrupt Vectors
( s )
■ Look-up Table capability in Program Memory
c t
■ Data Storage in Program Memory:
User selectable size
d u
■ Data RAM: 192 bytes
r o s)
■ Data EEPROM: 128 bytes
P c t(
■ 30 I/O pins, fully programmable as:
– Input with pull-up resistor
e t e u PSDIP42
- O ete
9 I/O lines can sink up to 20mA to drive LEDs or
TRIACs directly
s ) o l
■
prescaler
c ( b s
8-bit Timer/Counter with 7-bit programmable
t
■ 16-bit Auto-reload
d u -OTimer
programmable prescaler (AR Timer)
with 7-bit
■ Digital Watchdog
r o s) PQFP52
■
P t (
8-bit A/D Converter with 21 analog inputs
e uc
■
■
e t
8-bit Synchronous Peripheral Interface (SPI)
l od
8-bit Asynchronous Peripheral Interface
■
(UART)
o
s Pr
On-chip Clock oscillator can be driven by Quartz
(See end of Datasheet for Ordering Information)
■
b
Crystal or Ceramic resonator
O ete
Oscillator Safe Guard
■
o l
One external Non-Maskable Interrupt
ST623x-EMU2 Emulation and Development
bs
■
System (connects to an MS-DOS PC via a
parallel port).
O
DEVICE SUMMARY
ROM
DEVICE I/O Pins
(Bytes)
ST6232B 7948 30
Rev. 2.8
( s )
c t
TEST
0.5s min
d u 5V 47mF
r o s)
15
P c t( 100nF
14V typ
10
e t e u
5
o l rod VSS
b s P VDD
- O ete
TEST
150 µs typ
s ) o l PROTECT
c t ( b s TEST
100nF
14V
100mA
max
d u -O ZPD15
15V
r o s) VR02003
P
e uc t (
t
4mA typ
e
t
o l od VR02001
s Pr
Note: ZPD15 is used for overvoltage protection
b
O ete
o l
Obs
80/83
ST6232B
1.3 ORDERING INFORMATION part of the contractual agreement for the creation
of the specific customer mask.
The following section deals with the procedure for
transfer of customer codes to STMicroelectronics. The STMicroelectronics Sales Organization will be
pleased to provide detailed information on con-
1.3.1 Transfer of Customer Code tractual points.
Customer code is made up of the ROM contents
and the list of the selected mask options. The
ROM contents are to be sent on diskette, or by Table 1. ROM Memory Map for ST6232B
electronic means, with the hexadecimal file gener-
ated by the development tool. All unused bytes ROM Page Device Address Description
must be set to FFh.
0000h-007Fh Reserved
Page 0
0080h-07FFh User ROM
The selected mask options are communicated to
STMicroelectronics using the correctly filled OP-
( s )
0800h-0F9Fh User ROM
TION LIST appended. See page 82.
1.3.2 Listing Generation and Verification Page 1
c t 0FA0h-0FEFh
0FF0h-0FF7h
Reserved
Interrupt Vectors
c
0000h-000Fh Reserved
e u
0010h-07FFh User ROM
listing is then returned to the customer who must
thoroughly check, complete, sign and return it to
STMicroelectronics. The signed listing forms a e t
l rod Page 3
0000h-000Fh
0010h-07FFh
Reserved
User ROM
) - l
0 to +70°C
ST6232BB6/XXX
ST6232BB3/XXX
t ( s s o -40 to 85°C
-40 to 125°C
SDIP42
ST6232BQ1/XXX
ST6232BQ6/XXX c
u -O b
7948 30
0 to +70°C
-40 to 85°C PQFP52
ST6232BQ3/XXX d
o s) -40 to 125°C
P r (
t e uc t
o e
l od
b s Pr
O ete
o l
Obs
81/83
ST6232B
Customer: . . . . ....... ...... ...... ....... ...... ....... ...... ....... ...... ...
Address: .... ....... ...... ...... ....... ...... ....... ...... ....... ...... ...
.... ....... ...... ...... ....... ...... ....... ...... ....... ...... ...
Contact: .... ....... ...... ...... ....... ...... ....... ...... ....... ...... ...
Phone: .... ....... ...... ...... ....... ...... ....... ...... ....... ...... ...
Reference: . . . . ....... ...... ...... ....... ...... ....... ...... ....... ...... ...
STMicroelectronics references:
( s )
c t
Device:
Package:
d u
[ ] ST6232B (8 KB)
[ ] Dual in Line Shrink Plastic Package
r o s)
[ ] Plastic Quad Flat Package (Tape & Reel)
Temperature Range:
P c t(
[ ] 0°C to + 70°C [ ] - 40°C to + 85°C
e t e u
Marking:
l rod
[ ] Standard marking
o
[ ] Special marking:
O ete
Authorized characters are letters, digits, '.', '-', '/' and spaces only.
-
Oscillator Safeguard:
s ) o l [ ] Enabled [ ] Disabled
Watchdog Selection:
NMI pull-up:
c t ( b s [ ] Software Activation
[ ] Enabled
[ ] Hardware Activation
[ ] Disabled
Timer pull-up:
d u -O [ ] Enabled [ ] Disabled
r o s)
P
e uc t (
Readout Protection: [ ] Enabled:
[ ] Fuse is blown by STMicroelectronics
e t
l od
[ ] Fuse can be blown by the customer
[ ] Disabled
o
s Pr
b
O ete
External STOP Mode Control:
Port pull-up:
[ ] Enabled
[ ] Enabled
[ ] Disabled
[ ] Disabled
o l
bs
Comments:
Oscillator Frequency in the application: .......................................
82/83
ST6232B
8 SUMMARY OF CHANGES
Rev. Main Changes Date
Changed section 1.4.1 on page 15: TIM PULL on bit 2 and NMI PULL on bit 3 October
2.8
Added Section 7.3 IMPORTANT NOTE on page 78 2003
( s )
c t
d u
r o s)
P c t(
e t e u
o l rod
b s P
- O ete
s ) o l
c t ( b s
d u -O
r o s)
P
e uc t (
e t
l od
o
s Pr
b
O ete
Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences
of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted
o l
by implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are subject
to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not
bs
authorized for use as critical components in life support devices or systems without express written approval of STMicroelectronics.
The ST logo is a registered trademark of STMicroelectronics.
83/83