STMicroelectronics ST62T55C, ST62T65C, ST62E65C Technical data

8-BIT OTP/EPROM MCUs WITH A/D CONVERTER,
SAFE RESET, AUTO-RELOAD TIMER, EEPROM AND SPI
3.0 to 6.0V Supply Operating Range
8 MHz Maximum Clock Frequency
Run, Wait and Stop Modes
5 Interrupt Vectors
Look-up Table capability in Program Memory
Data Storage in Program Memory:
User selectable size
Data RAM: 128 bytes
Data EEPROM: 128 bytes (none on ST6 2T55C)
User Programmable Options
21 I/O pins, fully programmable as:
– Input with pull-up resistor – Input without pull-up resistor – Input with interrupt generation – Open-drain or push-pull output – Analog Input
8 I/O lines can sink up to 30mA to drive LEDs or
TRIACs directly
8-bit Timer/Counter with 7-bit programmable
prescaler
8-bit Auto-reload Timer with 7-bit programmable
prescaler (AR Timer)
Digital Watchdog
Oscillator Safe Guard
Low Voltage Detector for Safe Reset
8-bit A/D Converter with 13 analog inputs
8-bit Synchronous Peripheral Interface (SPI)
On-chip Clock oscillator can be driven by Quartz
Crystal Ceramic resonator or RC network
User configurable Power-on Reset
One external Non-Maskable Interrupt
ST626x-EMU2 Emulation and Development
System (connects to an MS-DOS PC via a parallel port)
ST62T55C
ST62T 65C/E 65 C
PDIP28
PS028
SS0P28
CDIP28W
(See end of Datasheet for Ordering Information)
DEVICE SUMMARY
DEVICE
ST62T55C 3884 - ­ST62T65C 3884 - 128 ST62E65C 3884 128
OTP
(Bytes)
EPROM
(Bytes)
EEPROM
Rev. 2.9
July 2001 1/86
Table of Contents
Document
Page
ST62T55C
ST62T65C/E65C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 GENERAL DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 PIN DESCRIPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 MEMORY MAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3.2 Program Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.3 Data Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.4 Stack Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.5 Data Window Register (DWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.6 Data RAM/EEPROM Bank Register (DRBR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.3.7 EEPROM Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4 PROGRAMMING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.1 Option Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.2 EPROM Erasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2 CENTRAL PROCESSING UNIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2 CPU REGISTERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 CLOCKS, RESET, INTERRUPTS AND POWER SAVING MODES . . . . . . . . . . . . . . . . . . . . . 18
3.1 CLOCK SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.1.1 Main Oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.1.2 Low Frequency Au xi liary Osc illator (LFAO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.3 Oscillator Safe Guard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 RESETS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.1 RESET Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.2 Power-on Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.3 Watchdog Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.4 LVD Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.5 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.6 MCU Initialization Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3 DIGITAL WATCHDOG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.3.1 Digital Watchdog Register (DWDR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3.2 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4 INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.4.1 Interrupt request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.4.2 Interrupt Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4.3 Interrupt Option Register (IOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.4.4 Interrupt sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.5 POWER SAVING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5.1 WAIT Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5.2 STOP Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5.3 Exit from WAIT and STOP Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
86
2/86
Table of Contents
4 ON-CHIP PERIPHERALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 7
4.1 I/O PORTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.1.1 Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.1.2 Safe I/O State Switching Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.3 Timer 1 Alternate function Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.1.4 AR Timer Alternate function Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.1.5 SPI Alternate function Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2 TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.2.1 Timer Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2.2 Timer Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2.3 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.2.4 Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3 AUTO-RELOAD TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.1 AR Timer Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.2 Timer Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.3 AR Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4 A/D CONVERTER (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.4.1 Application Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.5 SERIAL PERIPHERAL INTERFACE (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.5.1 SPI Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.6 SPI TIMING DIAGRAMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5 SOFTWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1 ST6 ARCHITECTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.2 ADDRESSING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3 INSTRUCTION SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6 ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.1 ABSOLUTE MAXIMUM RATINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.2 RECOMMENDED OPERATING CONDITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.3 DC ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.4 AC ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.5 A/D CONVERTER CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.6 TIMER CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.7 SPI CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.8 ARTIMER ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
7 GENERAL INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.1 PACKAGE MECHANICAL DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.2 ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Document
Page
3/86
86
Table of Contents
Document
Page
ST62P55C
ST62P65C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1 GENERAL DESCRIPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.2 ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.2.1 Transfer of Customer Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
1.2.2 Listing Generation and Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ST6255C
ST6265 B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
1 GENERAL DESCRIPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
1.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
1.2 ROM READOUT PROTECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
1.3 ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
1.3.1 Transfer of Customer Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
1.3.2 Listing Generation and Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2 SUMMARY OF CHANGES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4/86
86
1 GENERAL DESCRIPTION
1.1 INTRODUCTION
ST62T55C ST62T65C/E65C
The ST62T55C, ST62T65C and ST62E65C devic­es are low cost m em bers of the ST62xx 8-bit HC­MOS family of microcontrollers, which is targeted at low to medium complexity applications. All ST62xx devices are based on a building block ap­proach: a common core is surrounded by a number of on-chip peripherals.
The ST62E65C is the erasable EPROM version of the ST62T65C device, whi ch may be used to em ­ulate the ST62T55C and ST62T65C device, as well as the respective ST6255C and ST6265C ROM devices.
OTP and EPROM devices are functional ly identi­cal. The ROM based versions offer the same func­tionality selecting as ROM options the options de-
Figure 1. Block Diagram
j
8-BIT
TEST/V
PP
NMI INTER RUPT
TEST
PROGRAM
MEMORY
3884 bytes
(ST62T55C, T65C,
E65C)
A/D CONVERTER
DATA ROM
USER
SELECTABLE
DATA RAM
128 Bytes
fined in the programmable option byte of the OTP/ EPROM versions.
OTP devices offer all the advant ages of user pro­grammability at low cost, which make them the ideal choice in a wide range of applications where frequent code chang es, mu ltiple code vers ions or last minute programmability are required.
These compact low -cost devices feature a Timer comprising an 8-bit counter and a 7-bit program­mable prescaler, an 8-bit Auto-Reload Timer, EEPROM data capability (except ST62T55C), a serial port communication interface, an 8-bit A/D Converter with 13 analog inputs and a Digital Watchdog timer, making them well suited for a wide range of automotive, appliance and industrial applications.
PORT A
PORT B
PORT C
AUTORELOAD
TIMER
PA0..PA7 / Ain
PB0..PB5 / 30 mA Sink PB6 / ARTimin / 30 mA Sink PB7 / ARTimout / 30 mA Sink
PC0 / Ain PC1 / Tim1 / Ain PC2 / Sin / Ain PC3 / Sout / Ain PC4 / Sck / Ain
PC
STACK LEVEL 1 STACK LEVEL 2 STACK LEVEL 3 STACK LEVEL 4 STACK LEVEL 5 STACK LEVEL 6
POWER
SUPPLY
V
DDVSS
OSCILLATOR
OSCin OSCout RESET
DATA EEPROM
128 Bytes
(ST62T65C/E65C)
8 BIT CORE
RESET
TIMER
SPI (SERIAL
PERIPHERAL
INTERFACE)
DIGITAL
WATCHDOG
5/86
ST62T55C ST62T65C/E65C
1.2 PIN DESCRIPTI ONS V
and VSS. Power is suppl ied to the MCU vi a
DD
these two pins. V V
is the ground connection.
SS
is the power conn ection and
DD
OSCin and OSCout. These pins are internally connected to the on-chip oscillator circuit. A quartz crystal, a ceramic resonator or an external clock signal can be connected between these two pins. The OSCin pin is the input pin, the OSCout pin is the output pin.
RESET
. The active-low RESET pin is used to re-
start the microcontroller.
TEST/V
. T he TEST m ust be held at VSS for nor-
PP
mal operation. If TEST pin is connected to a +12.5V level during t he res et phas e, t he E PR OM / OTP programming Mode is entered.
NMI. The NMI pin provides the capability for asyn­chronous interruption, by applying an external non maskable interrupt to the MCU. Th e NMI input is falling edge sensitive. It is provided with an on-chip pullup resistor (if option has been e nabled), and Schmitt trigger characteristics.
PA0-PA7. These 8 lines are organized as one I /O port (A). Each line may be configu red under soft­ware control as inputs with or without internal pull­up resistors, interrupt generating inputs with pull­up resistors, open-drain or push-pull outputs, ana­log inputs for the A/D converter.
PB0-PB5. These 6 lines are organized as one I/O port (B). Each line may be configu red under soft­ware control as inputs with or without internal pull­up resistors, interrupt generating inputs with pull­up resistors, open-drain or push-pull outputs. PB0-PB5 can also sink 30mA for direct LED driving.
PB6/ARTIMin, PB7/ARTIM out. These pins are ei­ther Port B I/O bits or the Input and Output pins of the AR TIMER. To be used as timer input function
PB6 has to be programmed as input with or with­out pull-up. A dedicated bit in the AR TIMER Mode Control Register sets PB7 as timer out put function. PB6-PB7 can also sink 30mA for direct LED driv­ing.
PC0-PC4. These 5 lines are organized as one I/O port (C). Each line may be configured under soft­ware control as input with or without internal pull­up resistor, interrupt generating in put with pull-up resistor, analog input for the A/D converter, open­drain or push-pull output. PC1 can also be used as Timer I/O bit while PC2-PC4 can also be used as respe ctively Data in, Data out and Clock I/O pins for the on-chip SPI to carry the synchronous serial I/O signals.
Figure 2. ST62T55C, T65C, E65C Pin
Configuration
PB0 PB1
/TEST
V
PP
PB2 PB3 PB4 PB5
ARTIMin/PB6
ARTIMout/PB7
Ain / PA0
V
DD
V
SS
Ain/PA1
Ain/PA2
1 2 3 4 5 6 7 8 9 10 11 12 13
14
28 27 26 25 24 23 22 21 20 19 18 17 16 15
PC0/Ain PC1/TIM1/Ain
PC2/Sin/Ain PC3/Sout/Ain PC4/Sck/Ain NMI RESET OSCout OSCin PA7/Ain PA6/Ain PA5/Ain PA4/Ain
PA3/Ain
6/86
1.3 MEMORY MAP
ST62T55C ST62T65C/E65C
1.3.1 Introd uction
The MCU operates in three separate memory spaces: Program space, Data space, and Stack space. Operation in these three memory spaces is described in the following paragraphs.
Figure 3Memory Addressing Diagram
PROGRAM SPACE
0000h
0-63
PROGRAM
MEMORY
Briefly, Program space contains user program code in OTP and user vectors; Data space con­tains user data in RAM and in OTP, and Stack space accommodat es six levels of stack for sub­routine and interrupt service routine nesting.
DATA SPACE
000h
RAM / EEPROM BANKING AREA
03Fh 040h
DATA READ-ONLY
WINDOW
RAM
07Fh 080h 081h 082h 083h 084h
MEMORY
X REGISTER Y REGISTER V REGISTER
W REGISTER
0FF0h
0FFFh
INTERRUPT &
RESET VECTORS
0C0h
0FFh
DATA READ-ONLY
MEMORY
WINDOW SELECT
DATA RAM
BANK SELECT
ACCUMULATOR
7/86
ST62T55C ST62T65C/E65C
MEMORY MAP (Cont’d)
1.3.2 Program Space
Program Space comprises the instructions to b e executed, the data required for immediate ad­dressing mode instructions, the reserved factory test area and the user v ectors. Program Space is addressed via the 12-bit Program Counter register (PC register).
1.3.2.1 Program Memory Protection
The Program Mem ory i n O TP or E P ROM devices can be protected against external readout of mem­ory by selecting the READOUT PROTECTION op­tion in the option byte.
In the EPROM parts, READOUT PROTECTION option can be disactivated only by U.V. erasure that also results into the whole EPROM context erasure.
Note: Once the Readout Protection is activated, it is no longer possible, even for STMicroelectronics, to gain access to the OTP contents. Returned parts with a protection set can therefore not be ac­cepted.
Figure 4.ST62T55C/T65C/E 65C Prog ram
Memory Map
0000h
007Fh
0080h
RESERVED
USER
PROGRAM MEMORY
(OTP/EPROM)
3872 BYTES
*
0F9Fh 0FA0h 0FEFh 0FF0h 0FF7h 0FF8h
0FFBh 0FFCh 0FFDh
0FFEh
0FFFh
RESERVED
INTERRUPT VECTORS
RESERVED
NMI VECTOR
USER RESET VECTOR
*
(*) Reserved areas should be filled with 0FFh
8/86
MEMORY MAP (Cont’d)
1.3.3 Data Space
Data Space accommodates all the data necessary for processing the user program. This space com­prises the RAM resource, the proc essor core an d peripheral registers, as well as read-only data such as constants and look-up tables in OTP/ EPROM.
1.3.3.1 Data ROM
All read-only data is physically stored in program memory, which also accommodates the Program Space. The program mem ory consequently con­tains the program code to be executed, as well as the constants and look-up tables required by th e application.
The Data Space locations in which the different constants and look-up tables are addressed by the processor core may be thought of as a 64-byte window through which it is possible to acc ess the read-only data stored in OTP/EPROM.
1.3.3.2 Data RAM/EEPROM
In ST62T55C, ST62T65C and ST62E65C devic­es, the data space includes 60 byt es of RAM, the accumulator (A), the indirect registers (X), (Y), the short direct registers (V), (W), the I/O port regis­ters, the peripheral data and control registers, the interrupt option register and t he Data ROM Win­dow register (DRW register).
Additional RAM and EEPROM pages can also be addressed using banks of 64 bytes located be­tween addresses 00h and 3Fh.
1.3.4 Stack Space
Stack space consists of six 12-bit registers which are used to stack subroutine and interrupt return addresses, as well as the current program counter contents.
Table 1. Additional RAM/EEPROM Banks
Device RAM EEPROM
ST62T55C 1 x 64 bytes ­ST62T65C/E65C 1 x 64 bytes 2 x 64 bytes
ST62T55C ST62T65C/E65C
Table 2. ST62T55C, ST62T65C and ST62E65C Data Memory Space
RAM and EEPROM
DATA ROM WINDOW AREA
X REGISTER 080h Y REGISTER 081h V REGISTER 082h
W REGISTER 083h
DATA RAM 60 BYTES
PORT A DATA REGISTER 0C0h PORT B DATA REGISTER 0C1h PORT C DA T A REGISTE R 0C2h
RESERVED 0C3h PORT A DIRECTION REGISTER 0C4h PORT B DIRECTION REGISTER 0C5h PORT C DIRECTION REGISTER 0C6h
RESERVED 0C7h
INTERRUPT OPTION REGISTER 0C8h* DATA RO M WINDOW RE G IS T E R 0C9h*
RESERVED
PORT A OPTION REGISTER 0CCh PORT B OPTION REGISTER 0CDh PORT C OPTION REGISTER 0CEh
RESERVED 0CFh
A/D DATA REGISTE R 0D0h
A/D CONTROL REGISTER 0D1h
TIMER PRESCALER REGISTE R 0D2h
TIMER COUNTER REGISTE R 0D3h
TIMER S T A T US CONTR OL REGISTER 0D4h
AR TIMER MODE CONTROL REGI STER 0D5h AR TIMER STATUS/CONTROL REGISTER 1 0D6h AR TIMER STATUS/CONTROL REGISTER 2 0D7h
WATCHDOG REGISTER 0D8h
AR TIMER RELOAD/CAPTURE REGISTER 0D9h
AR TIMER COMPARE REGISTER 0DAh
AR TIMER LOAD REGISTER 0 DBh
OSCILLATOR CONTROL REGISTER 0DCh*
MISCELLANEOUS 0DDh
RESERVED
SPI DATA REGISTER 0E0h
SPI DIVIDER REGISTER 0E1h
SPI MODE REGISTER 0E2h
RESERVED
DATA RAM/EEPROM REGISTER 0E8h*
RESERVED 0E9h
EEPROM CONTROL REGISTER 0EAh
RESERVED
ACCUMULATOR 0FFh
* WRITE ONLY REGISTE R
000h
03Fh
040h
07Fh
084h
0BFh
0CAh 0CBh
0DEh 0DFh
0E3h 0E7h
0EBh 0FEh
9/86
ST62T55C ST62T65C/E65C
MEMORY MAP (Cont’d)
1.3.5 Data Window Register (DWR)
The Data read-only memory window is located from address 0040h to address 007Fh in Data space. It allows direct reading of 64 consecutive bytes locat­ed anywhere in program memory, between ad­dress 0000h and 0FFFh (top memory address de­pends on the specific device). All the program memory can therefore be used to store ei ther in­structions or read-only data. Indeed, the window can be moved i n steps of 64 byt es along the pro­gram memory by writing the appropriate code in the Data Window Register (DWR).
The DWR can be addressed like any RAM location in the Data Space, it is however a write-only regis­ter and therefore cannot be accessed using single­bit operations. This register is used to position the 64-byte read-only data window (from address 40 h to address 7Fh of the Data space) in program memory in 64-byte steps. The effective address of the byte to be rea d as data in program me mory is obtained by concatenating the 6 least significant bits of the register address given in the instruction (as least significant bits) and the content of the DWR register (as most significant bits), as illustrat­ed in Figure 5 below. For instance, when address- ing location 0040h of the Data Space, with 0 load­ed in the DWR register, the physical location ad­dressed in program memory is 00h. The DWR reg­ister is not cleared on reset, therefore it must be written to prior to the first access to the Data read­only memory window area.
Data Wind ow R eg ist er (DWR)
Address: 0C9h Write Only
70
- - DWR5 DWR4 DWR3 DWR2 DWR1 DWR0
Bits 6, 7 = Not used. Bit 5-0 = DWR5-DW R0:
Window Register Bits.
Data read-only memory
These are the Data read­only memory Window bits that correspond to the upper bits of the data read-only memory space.
Caution:
This register is undefined on reset. Nei­ther read nor single bit instructions may be used to address this register.
Note: Care is required when handling the DWR register as it is write only. For this reason, the DWR contents should no t be changed while exe­cuting an interrupt service routine, as the service routine cannot save and then restore the register’s previous contents. If it is impossible to avoid writ­ing to the DWR during the interrupt service routine, an image of the register m ust be saved in a RAM location, and each time the program writes to the DWR, it must also write to the image register. The image register must be written first so that, if an in­terrupt occurs between the two instructions, the DWR is not affected.
Figure 5Data read-only memory Window Memory Addressing
13
DATA ROM
WINDOW REGISTER
CONTENTS
(DWR)
Example:
ADDRESS:A19h
10/86
DWR=28h
ROM
12
765432 0
11
1100000001
1
01
0 0
543210
67891011
543210
000 1
0
1
1
11
00
PROGRAM SPACE ADDRESS
READ
DATA SPACE ADDRESS
40h-7Fh
IN INSTRUCTION
DATA SPACE ADDRESS
1
59h
VR01573C
:
:
ST62T55C ST62T65C/E65C
MEMORY MAP (Cont’d)
1.3.6 Data RAM/EEPROM Bank Register (DRBR)
Address: E8h Write only
70
---
DRBR
4
--
DRBR1DRBR
0
Bit 7-5 = These bits are not used Bit 4 - DRBR4. This bit, when set, selects RAM
Page 2. Bit 3-2 - Reserved. These bits are not used. Bit 1 - DRBR1. This bit, when set, selects
EEPROM Page 1, when available. Bit 0 - DRBR0. This bit, when set, selects
EEPROM Page 0, when available. The selection of the bank is made by programming
the Data RAM Bank Switch register (DRBR regis­ter) located at address E8h of the Data Sp ace ac­cording to Table 1. No more than one bank should be set at a time.
The DRBR register can be addressed l ike a RAM Data Space at the address E8h; nevertheless it is a write only register that cannot be accessed with single-bit operations. This register is used to select the desired 64-byte RAM/EEPROM bank of the Data Space. The bank number has to be loaded in the DRBR register and the instruction has to point to the selected location as if it was in bank 0 (from 00h address to 3Fh address).
This register is not cleared during the MCU initiali­zation, therefore it must be written bef ore the first access to the Data Space bank region. Refer to
the Data Space description for additional informa­tion. The DRBR register is not modified whe n an interrupt or a subroutine occurs.
Notes : Care is required when handling the DRBR register
as it is write only. For this reason, it is not allowed to change the DRBR contents while executing in­terrupt service routine, as the service routine can­not save and then restore its previous content. If it is impossible to avoid the w riting of th is register in interrupt service routine, an image of this register must be saved in a RAM location, and each time the program writes to DRBR it must write also to the image register. The image register must be written first, so if an interrupt occurs between t he two instructions the DRBR is not affected.
In DRBR Register, only 1 bit must be set. Other­wise two or more pages are enabled in parallel, producing errors.
Care must also be taken not to change the E²PROM page (when available) when the parallel writing mode is set for the E²PROM, as defined in EECTL register.
Table 3Data RAM Bank Register Set-up
DRBR ST62T55C ST62T65C/E65C
00 None None 01 Not Available EEPROM Page 0 02 Not Available EEPROM Page 1 08 Not Available Not Available
10h RAM Page 2 RAM Page 2
other Reserved Reserved
11/86
ST62T55C ST62T65C/E65C
MEMORY MAP (Cont’d)
1.3.7 EEPROM Description
EEPROM memory is located in 64-byte pages i n data space. This memory may be used by the user program for non-volatile data storage.
Data space from 00h to 3Fh is paged as described in Table 4. EEPROM locations are accessed di- rectly by addressing these paged sections of data space.
The EEPROM does not require dedicated instruc­tions for read or write access. Once selected via t he Data RAM Bank Register, the active EEPROM page is controlled by the EEPROM Control Regis­ter (EECTL), which is described below.
Bit E20FF of the EECTL register must be reset prior to any write or read access to the EEPROM. If no bank has been selected, or if E2OFF is set, any ac­cess is meaningless.
Programming must be enabled by setting the E2ENA bit of the EECTL register.
The E2BUSY bit of the EECTL register is set when the EEPROM is performing a programming cycle. Any access to the EEPROM when E2B US Y is set is meaningless.
Provided E2OFF and E2BUSY are reset, an EEP­ROM location is read just like any other data loca­tion, also in terms of access time.
Writing to the EEPROM ma y be carried o ut in tw o modes: B yte Mode (BM ODE) and Pa rallel Mode
(PMODE). In BMODE, one byte is accessed at a time, while in PMODE up to 8 bytes in the same row are programmed simultaneously (with conse­quent speed and power consumption advantages, the latter being particularly important in battery powered circuits).
General Notes: Data should be written directly to the intended ad-
dress in EEPROM space. There is no buffer mem­ory between data RAM and the EEPROM space.
When the EEPROM is busy (E2BUSY = “1”) EECTL cannot be accessed in write mode, it is only possible to read t he status of E2BUSY . This implies that as long as the EEPROM is busy, it is not possible to change the status of the EEP ROM Control Register. EECTL bits 4 and 5 are reserved and must never be set.
Care is required when dealing with the EECTL reg­ister, as some bits are w rite on ly. F or this reason, the EECTL contents must not be altered while ex­ecuting an interrupt service routine.
If it is impossible to avoid writing to this register within an interrupt service routine, an image of the register must be saved in a RAM location, and each time the program writes to EECTL it must also write to the image register. The image register must be written to first so that, if an interrupt oc­curs between the two in structions, the E E CT L wi ll not be affected.
Tabl e 4Row Arrang ement for Paralle l Wr iting of EEPROM Locatio ns
Dataspace addresses. Banks 0 and 1.
Byte01234567 ROW7 38h-3Fh ROW6 30h-37h ROW5 28h-2Fh ROW4 20h-27h ROW3 18h-1Fh ROW2 10h-17h ROW1 08h-0Fh ROW0 00h-07h
Up to 8 bytes in each row may be programmed simultaneously in Parallel Write mode.
The number of available 64-byte banks (1 or 2) is device dependent.
Note: The EEP ROM is disabled as soon as STO P instruc tion i s ex ecut ed i n order to achieve the low est power-consumption.
12/86
MEMORY MAP (Cont’d) Addi t i onal Not es on Parallel Mode :
If the user wishes to perform parallel program­ming, the first step should be t o set the E2PAR2 bit. From this time on, the EEPROM will be ad­dressed in write mode, the ROW address and the data will be latched and it will be possible to change them only at the end of the programmin g cycle or by resetting E2PAR2 without program­ming the EEPROM. After the ROW address is latched, the MCU can only “see” the selected EEPROM row and any attempt to write or read other rows will produce errors.
The EEPROM should not be read while E2PAR2 is set.
As soon as the E2PAR2 bit is set, the 8 volatile ROW latches are cleared. From this moment on, the user can load data in all or in part of the ROW. Setting E2PAR1 will modify the EEPROM regis­ters corresponding to the ROW latches accessed after E2PAR2. For example, if the software sets E2PAR2 and accesses the EEPROM by writing to addresses 18h, 1Ah and 1Bh, and then sets E2PAR1, t he s e t h r ee re g is ters will be modified s i­multaneously; the remaining bytes in the row will be unaffected.
Note that E2PAR2 is internally reset at the end of the programming cycle. This implies that the user must set the E2PAR2 bit between two parallel pro­gramming cycles. Note that if the user tries to set E2PAR1 while E2PAR2 is not set, there will be no programming cycle and the E2PAR1 bit will be un­affected. Consequently, the E2PAR1 bit cannot be set if E2ENA is low. The E2PAR1 bit can be set by the user, only if the E2ENA and E2PAR2 bits are also set.
Notes: The EEPROM page shall not be changed through the DRBR register when the E2PAR2 bit is set.
ST62T55C ST62T65C/E65C
EEPROM Control Register (EECTL)
Address: EAh Read/Write Reset status: 00h
70
E2O
D7
Bit 7 = D7: Bit 6 = E2OFF:
FF
D5 D4
Unused.
Stand-by Enable Bit.
If this bit is set the EEPROM is disabled (any access will be meaningless) and the power consumption of the EEPROM is reduced to it s lowe st va lue .
Bit 5-4 = D5-D4:
Reserved.
Bit 3 = E2PAR1: Once in Parallel Mode, as soon as the user software sets the E2PAR1 bit, parallel writing of the 8 adja­cent registers will start. This bit is internally reset at the end of the programming procedure. Note that less than 8 bytes can be written if required, the un­defined bytes being unaffected by the parallel pro­gramming cycle; thi s is explained in greater d etail in the Additional Notes on Parallel Mode overleaf.
Bit 2 = E2PAR2: ONLY. This bit must be set by the user program in order to perform parallel programming. If E2PAR2 is set and the parallel start bit (E2PAR1) is reset, up to 8 adjacent bytes c an be written simultane­ously. These 8 adjacent bytes are considered as a row, whose address lines A7, A6, A5, A4, A3 are fixed while A2, A1 and A0 are the changing bits, as illustrated in Figure 4. E2PAR2 is automatically re­set at the end of any parallel programming proce­dure. It can be reset by the user s oftware before starting the programming procedure, thus leaving the EEPROM registers unchanged.
Bit 1 = E2BUSY: LY. This bit is aut omatically set by the EEP ROM control logic when the EEPROM is in program­ming mode. The user program should test it before any EEPROM rea d or wri te oper at ion; any att emp t to access the EEPROM while the busy bit is set will be aborted and the writing procedure in progress w ill be c ompleted.
Bit 0 = E2ENA:
EEPROM Enable Bi t.
LY. This bit enables programming of the EEPROM cells. It must be set before any write to the EEP­ROM register. Any attempt to write to the EEP­ROM when E2ENA is low is meaningless and will not trigger a write cycle.
E2PAR1E2PAR2E2BUSYE2E
WRIT E ONL Y.
MUST be kept reset.
Parallel Start Bit.
WRITE ONLY.
Parallel Mode En. Bit.
EEPROM Busy Bit.
WRITE ON-
NA
WRITE
READ ON-
13/86
ST62T55C ST62T65C/E65C
1.4 PROGRAMMING MODES
1.4.1 Option Bytes
The two Option Bytes allow configuration capabili-
ty to the MCUs. Option byte’s content is automati­cally read, and the selected options enabled, when the chip reset is activated.
It can only be accessed during the programmin g mode. This access is made either automatically (copy from a master device) or by selecting the OPTION BYTE PROGRAMMING mode of the pro­grammer.
The option bytes are located in a non-user m ap. No address has to be specified.
voltage is too low. When this bit is cleared, only power-on reset or external RESET are active.
PROTECT.
Readout Protection.
protection of the software contents aga inst p iracy. When the bit PROTECT is set high, readout of the OTP contents is prevented by hardware.. When this bit is low, the user program can be read.
EXTCNTL.
External STOP MODE control.
EXTCNTL is high, STOP mode is available with watchdog active by setting NMI pin to one. When EXTCNTL is low, STOP mode is not available with the watchdog active.
PB2-3 PULL. When set this bit removes pull-up at
EPROM Code Option Byte (LSB)
70
PRO-
EXTC-
PB2-3
TECT
NTL
PULL
PB0-1
PULL
WDACT
DE-
LAY
OSCIL OSGEN
reset on PB2-PB3 pins. When cleared PB2-PB3 pins have an internal pull-up resistor at reset.
PB0-1 PULL. When set this bit removes pull-up at reset on PB0-PB1 pins. When cleared PB0-PB1 pins have an internal pull-up resistor at reset.
WDACT. This bit controls the watchdog activation. When it is high, hardware activation is selected.
EPROM Code Option Byte (MSB)
15 8
--­SYNCHRO
ADC
--
NMI
PULL
LVD
The software activation is selected when WDACT is low.
DELAY.
This bit enables the selection of the delay internally generated after the internal reset (exter­nal pin, LVD, or watchdog activated) is released. When DELAY is low, the delay is 2048 cycles of
D15-D13. Reserved . Must be cleared. ADC SYNCHRO
.
When set, an A/D c onvers ion is started upon WAIT instruction execution, in order to reduce supply noise. When this bit is low, an A/ D conversion is started as soon a s the STA bit of the A/D Converter Control Register is set.
,
D11-D10. Reserved NMI PULL.
NMI Pull-Up
must be cleared.
. This bit must be set high to configure the NMI pin with a pull-up resistor. When it is low, no pull-up is provided.
LVD.
LVD RESET enable.
When this bit is set, safe
RESET is performed by MCU when the supply
the oscillat or, it is of 32768 cycles when DELAY is high.
OSCIL.
Oscillat or selection
. When this bit is low, the oscillator must b e controlled by a quartz crys­tal, a ceramic resonator or an ex ternal frequenc y. When it is high, the oscillator must be controlled by an RC network, with only the resistor having to be externally provided.
OSGEN.
Oscillator Safe Guard
set high to enable the Oscillator Safe Guard. When this bit is low, the OSG is disabled.
The Option byte is writt en during programming ei­ther by using the PC menu (PC driven M ode) or automatically (stand-alone mode).
This bit allows the
. When
. This bit must be
14/86
PROGRAMMING MODES (Cont’d)
1.4.2 EPROM Erasing
The EPROM of the windowed package of the MCUs may be erased by exposure to Ultra Violet light. The erasure characteristic of the MCUs is such that erasure begins when the memory is ex­posed to light with a wave lengths shorter than ap­proximately 4000Å. It should be noted that sun­lights and some types of fluorescent lam ps have wavelengths in the range 3000-4000Å.
It is thus recommended that the window of the MCUs packages be covered by an opaque label to
ST62T55C ST62T65C/E65C
prevent unintentional erasure problems when test­ing the application in such an environment.
The recommended erasure procedure of the MCUs EPROM is the exposure to short wave ul­traviolet light which have a wave-length 2537A. The integrated dose (i.e. U.V. intensity x exposure time) for erasure should be a minimum of 15W­sec/cm proximately 15 to 20 minutes using an ultraviolet lamp with 12000µW/cm ST62E65C should be placed within 2.5cm (1Inch) of the lamp tubes during erasure.
2
. The erasure t ime with this dosage i s ap-
2
power rating. The
15/86
ST62T55C ST62T65C/E65C
2 CENTRAL PROCE SSI NG UNIT
2.1 INTRODUCTION
The CPU Core of ST6 devices is independent of the I/O or Memory conf iguration. As such, it may b e thought of as an independent central processor communicating with on-chip I/O, Memory and Pe­ripherals via internal address, data, and control buses. In-core communication is arranged as shown in Figure 6; the controller being externally linked to both the Reset and Oscillator circuits, while the core is linked to the dedicated on-chip pe­ripherals via the serial data bus and indirec tly, for interrupt purposes, through the control registers.
2.2 CPU REGISTERS
The ST6 Family CPU core features six registers and three pairs of flags available to the programmer. These are described in the following paragraphs.
Accumulator (A). The accumulator is an 8-bit general purpose register used in all arithmetic cal­culations, logical operations, and data manipula­tions. The accumulator can be a ddressed in Dat a space as a RAM location at address FFh. Thus the ST6 can manipulate the accumu lator just like any other register in Data space.
Figure 6. ST6 Core Block Diagram
Indirect Registers (X, Y). These two indirect reg-
isters are used as pointers to memory locations in Data space. They are used in the register-indirect addressing mode. These registers can be ad­dressed in the data space as RAM locations at ad­dresses 80h (X) and 81h (Y). They can also be ac­cessed with the direct, short direct, or bit direct ad­dressing modes. Accordingly, the ST6 i nstruction set can use the indirect registers as any other reg­ister of the data space.
Short Direct Registers (V, W). These two regis­ters are used to save a byte in short direct ad­dressing mode. They can be addressed in Data space as RAM locations at addresses 82h (V) and 83h (W). They can also be acc ess ed usin g th e di­rect and bit direct addressing modes. Thus, the ST6 instruction set can use the short direct regis­ters as any other register of the data space.
Program Counter (PC). The program counter is a 12-bit register which cont ains the address of the next ROM location to be processed by the core. This ROM location may b e an opcode, an oper­and, or the address of an operand. The 12-bit length allows the direct addressing of 4096 bytes in Program space.
PROGRAM
ROM/EPROM
12
RESET
CONTROLLER
OPCODE
Progr am Counter
and
6 LAYER STACK
FLAG
VALUES
0,01 TO 8MHz
OSCin
CONTROL
SIGNALS
2
A-DATA
FLAGS
OSCout
ADDRESS/READ LINE
ADDRESS
DECODER
B-DATA
ALU
RESULTS TO DATA SPACE (WRITE LINE)
INTERRUPTS
256
DATA SPACE
DATA
RAM/EEPROM
DATA
ROM/EPROM
DEDICATIONS
ACCUMULATOR
VR01811
16/86
CPU REGISTERS (Cont’d) However, if the program space contains more than
4096 bytes, the additional memory in program space can be addressed by using the Program Bank Switch register.
The PC value is incremented after reading the ad­dress of the current instruction. To execute relative jumps, the PC and the offset are shifted through the ALU, where they are added; the result is then shifted back into the PC. The program counter can be changed in the following ways:
- JP (Jump) instructionPC=Jump address
- CALL instructionPC= Call address
- Relative Branch Instruction.PC= PC +/- offset
- Interrupt PC=Interrupt vector
- Reset PC= Reset vector
- RET & RETI instructionsPC= Pop (stack)
- Normal instructionPC= PC + 1
Flags (C, Z). The ST6 CPU includes three pairs of flags (Carry and Zero), each pair being associated with one of the three normal modes of operation: Normal mode, Interrupt mode and Non Maskabl e Interrupt mode. Each pair consists of a CARRY flag and a ZERO flag. One pair (CN, ZN) is u sed during Normal operation, another pair is used dur­ing Interrupt mode (CI, ZI), and a third pair is used in the Non Maskable Interrupt m ode (CNMI, ZN­MI).
The ST6 CPU uses the pair of flags associated with the current mode: as soon as an interrupt (or a Non Maskable I nterrupt) is generated, the ST 6 CPU uses the Interrupt flags (resp. the NMI flags) instead of the Normal flags. When the RETI in­struction is executed, the previously used set of flags is restored. It should be noted that each flag set can only be addressed in its own context (Non Maskable Interrupt, Normal Interrupt or Main rou­tine). The flags are not cleared during context switching and thus retain their status.
The Carry flag is set when a carry or a borrow oc­curs during arithmetic operations; otherwise it is cleared. The Carry flag is also set to the val ue of the bit tested in a bit test instruction; it also partici­pates in the rotate left instruction.
The Zero flag is set if the result of the last arithme­tic or logical operation was equal to zero; other­wise it is cleared.
Switching between the three sets of flags is per­formed automatically when an NMI, an interrupt or a RETI instructions occurs. As the NMI mode is
ST62T55C ST62T65C/E65C
automatically selected aft er the reset of the MCU, the ST6 core uses at first the NMI flags.
Stack. The ST6 CPU includes a true LIFO hard­ware stack which eliminates the need for a stack pointer. The stack consists of six separate 12-bit RAM locations that do not belong to the data space RAM area. When a subroutine call (or inter­rupt request) occurs, the contents of each level are shifted into the next higher level, while the content of the PC is shifted into the first level (the original contents of the sixth stac k level are lost). Whe n a subroutine or interrupt return occurs (RET or RETI instructions), the first level register is shifted back into the PC and the value of ea ch level is popped back into the previous level. Since the acc umula­tor, in common with all other data space registers, is not stored in this sta ck, management of these registers should be performed within the subrou­tine. The stack will rem ain in it s “deep est” pos it ion if more than 6 nested calls or interrupts are execut­ed, and consequent ly the last return address wi ll be lost. It will als o remain in its highe st pos ition if the stack is empty and a RET or RETI is executed. In this case the next instruction will be executed.
Figure 7. ST6 CPU Pr ogramming Mode
l
INDEX
REGISTER
INTERRUPT FLAGS
NMI FLAGS
b7 b7 b7
b7 b7
PROGRAMCOUNTER
SIX LEVELS
STACK REGISTER
X REG. POINTER
Y REG. POINTER
VREGISTER
WREGISTER
ACCUMULATOR
b0 b0 b0
b0 b0
b0b11
CZNORMAL FLAGS
CZ
CZ
SHORT
DIRECT
ADDRESSING
MODE
VA 0 0042 3
17/86
ST62T55C ST62T65C/E65C
3 CLOCKS, RESET, INTERRUPTS AND POWER SAVING MO DES
3.1 CLOCK SYSTEM
The MCU f ea tu r es a Main Oscilla tor wh ic h c an be driven by an external clock, or used in conjunction with an AT-cut parallel resonant crystal or a s uita­ble ceramic resonator, or with an external resistor (R
). In addition, a Low Frequency Auxiliary Os-
NET
cillator (LFAO) can be switched in for security rea­sons, to reduce power consumption, or to offer the benefits of a back-up clock system.
The Oscillator Safeguard (OSG) option filters spikes from the oscillator lines, provides access to the LFAO to provide a backup oscillator in the event of main osc illator failure and al so automat i­cally limits the internal clock frequency (f function of V
, in order to guarantee correct oper-
DD
INT
) as a
ation. The se functions a re illustrated in Figure 9,
Figure 10, Figure 11 and Figure 12.
A programmable divider on F
is also provided in
INT
order to adjust the internal clock of the MCU to the best power consum ption and performanc e trade­off.
Figure 8 illustrates vario us po s si ble os c illator con-
figurations using an external crystal or ceramic res­onator, an external clock input, an external resistor (R
), or the lowest cost solution using only the
NET
LFAO. C
an CL2 should have a capacitance in the
L1
range 12 to 22 pF for an oscillator frequency in the 4-8 MHz range.
The internal MCU clock frequency (f
) is divided
INT
by 12 to drive the Timer, the A/D converter and the Watchdog timer, and by 13 to drive the CPU core, as may be seen in F igure 11.
With an 8MHz oscillator frequency, the fastest ma-
chine cycle is therefore 1.625µs. A machine cycle is the smallest unit of ti me needed
to execute any operation (for instance, to increment the Program Counter). An instruction may requi re two, four, or five machine cycles for execution.
3.1.1 Main Oscillator
The oscillator configuration may be specified by se­lecting the appropriate option. When the CRYSTAL/ RESONATOR option is selected, it must be used with a quartz crystal, a ceramic resonator or an external signal provided on the OSCin pin. When the RC NET­WORK option is selec ted, the syst em clock i s gen­erated by an external resistor.
The main oscillator can be turned off (when the OSG ENABLED option is se lected ) by set ting th e OSCOFF bit of the ADC Control Register. The Low Frequency Auxiliary Oscillator is automatical­ly started.
Figure 8. Os cill a tor C on f ig urations
CRYSTAL/RESONATO R CLOCK
CRYSTAL/RESONATOR option
ST6xxx
OSC
C
L1n
EXTERNAL CLOCK
CRYSTAL/RESONATOR option
OSC
RC NETWORK
RC NETW O RK option
OSC
NC
INTEGRATED CL OCK
CRYSTAL/RESONATOR option
OSG ENABLED option
OSC
in
ST6xxx
in
ST6xxx
in
ST6xxx
in
OSC
OSC
NC
OSC
OSC
NC
out
out
out
out
C
L2
R
NET
18/86
ST62T55C ST62T65C/E65C
CLOCK SYSTEM (Cont’d)
Turning on the main oscillator is achieved by re­setting the OSCOFF bit of the A/D Converter Con­trol Register or by resetting the MCU. Restarting the main oscillator implies a delay comprising the oscillator start up delay period plus the duration of the software instruction at f
clock frequency.
LFAO
3.1.2 Low Frequency Auxiliary Oscillator (LFAO)
The Low Frequency Auxiliary Oscillator has three main purposes. Firstly, it can be used to reduce power consumption in non timing critical routines. Secondly, it offers a fully integrated system clock, without any external components. Lastly, it acts as a safety oscillator in case of main oscillator failure.
This oscillator is available when the OSG ENA­BLED option is selected. In this case, it automati­cally starts one of its periods after the first missing edge from the main oscillator, whatever the reason (main oscillator defective, no clock circuitry provid­ed, main osc illator swit ched off...).
User code, normal interrupts, WAIT and STOP in­structions, are processed as normal, at the re­duced f cy is decreased, since the internal frequency is be-
frequency. The A/D converter accura-
LFAO
low 1MHz. At power on, the Low Frequency Aux ilia ry Osc ill a-
tor starts faster than the Main Oscillator. It there­fore feeds the on-chip counter generating the POR delay until the Main Oscillator runs.
The Low Frequency Auxiliary Oscillator is auto­matically switched off as soon as the main oscilla­tor sta r ts.
ADCR
Address: 0D1h Read/Write
70
ADCR7ADCR6ADCR5ADCR4ADCR3OSC
OFF
ADCR1ADCR
0
Bit 7-3, 1-0= ADCR7-ADCR3, ADCR1-ADCR0:
ADC Control Register
. These bits are reserved for
ADC Control. Bit 2 = OSCOFF. When low, this bit enables mai n
oscillator to run. The main oscillator is switched off when OSCOFF is high.
3.1.3 Oscillator Safe Guard
The Oscillator Safe Guard (OSG) affords drastical­ly increased operational integrity in ST62x x dev ic­es. The OSG circuit provides three basic func-
tions: it filters spikes from the oscillator lines which would result in over frequency to the ST62 CPU; it gives access to the Low Frequency Auxiliary Os­cillator (LFAO), used to ensure minimum process­ing in case of main oscillator failure, to offer re­duced power consumption or to provide a fixed fre­quency low cost oscillator; finally, it automatically limits the internal clock frequen cy as a function of supply voltage, in order to ensure correct opera­tion even if the power supply should drop.
The OSG is enabled or disab led by choosin g the relevant OSG option. It may b e viewed as a filter whose cross-over frequency is device dependent.
Spikes on the oscillator lines result in an effectively increased internal clock frequency. In the absence of an OSG circuit, this may lead to an over fre­quency for a given power supply voltage. The OSG filters out such spikes (as illustr ated in Figure
9). In all cases, when the OSG is active, the maxi-
mum internal clock frequency, f f
, which is supply voltage dependent. T his re-
OSG
lationship is illustrated in Figure 12. When the OSG is enabled, the Low Frequency
Auxiliary Oscillator may be accessed. This oscilla­tor starts operating after the first missing edge of the main oscillator (see Figure 10).
Over-frequency, at a given power supp ly level, is seen by the OSG as spikes; it therefore filte rs out some cycles in order that the internal clock fre­quency of the device is kept within the range t he particular device can stand (depending o n V and below f
: the maximum authorised frequen-
OSG
cy with OSG enabled. Note. The OSG should be used wherever possible
as it provides maximum safet y. Care must be tak­en, however, as it ca n increase power consump­tion and reduce the maximum operating frequency to f
OSG
.
Warning: Care has to be taken when using the OSG, as the internal frequency is defined between a minimum and a maximum value and is not accu­rate.
For precise timing measu remen ts, it is no t re com­mended to use the OSG and it should not be ena­bled in applications that use the SPI or the UART.
It should also be noted that power consum ption in Stop mode is higher when the OSG is enabled (around 50µA at nominal conditions and room temperature).
, is limited to
INT
DD
),
19/86
ST62T55C ST62T65C/E65C
CLOCK SYSTEM (Cont’d) Figure 9. OSG Fi l terin g P rin c i pl e
(1)
(2)
(3)
(4)
(1)
Maximum Frequency for the device to work correctly
(2)
Actual Quartz Crystal Frequency at OSCin pin
(3)
Noise from OSCin
(4)
Resulting Internal Frequency
Figure 10. OSG Emergency Oscillator Principle
Main
Oscillator
Emergency
Oscillator
Internal
Frequency
VR001932
20/86
VR001933
ST62T55C ST62T65C/E65C
CLOCK SYSTEM (Cont’d) Oscillator Control Registers
Address: DCh Write only Reset State: 00h
70
----
OSCR
3
-RS1RS0
Bit 7-4. These bits are not used. Bit 3. Reserved. Cleared at Reset. Must be kept
cleared. Bit 2. Reserved. Must be kept low. RS1-RS0. These bits select the division ratio of
the Oscillator Divider in order to generate the inter­nal frequency. The following selcti ons are availa­ble:
RS1 RS0 Division Ratio
0 0 1 1
0 1 0 1
Note: Care is required when handling the OS CR register as some bits are write only. For this rea­son, it is not allowed to change the OSCR contents while executing interrupt service routine, as the service routine cannot save and then restore its previous content. If it is impossible to avoid the writing of this register in interrupt service routine, an image of this register must be saved in a RAM location, and each time the program writes to OSCR it must write also to the image register. The image register must be written first, so if an inter­rupt occurs between the two instructions the OSCR is not affected.
1 2 4 4
21/86
ST62T55C ST62T65C/E65C
CLOCK SYSTEM (Cont’d) Figure 11. Clock Circuit Block Diagram
POR
OSG
MAIN
OSCILLATOR
LFAO
Main Oscillator off
Figure 12. Maximum Operating Frequency (f
Maximum FREQUENCY (MHz)
8
IN THIS AREA
4
3
3.644.555.56
7
6
5
4
3
2
1
2.5
GUARANTEED
FUNCTIONALITY IS NOT
M U
X
) versus Supply Voltage (VDD)
MAX
3
2
1
OSCILLATOR
f
INT
f
OSG
f
Min (at 85 °C)
OSG
f
OSG
DIVIDER RS0,RS1
Min (at 125°C)
:
:
12
13
1
:
Core
TIMER 1
Watchdog
SUPPLY VOLTAGE (V
Notes:
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 guar­anteed at a frequency of at least f
OSG Min.
3. When the OSG is disabled, operation in this
22/86
)
DD
VR01807J
area is guaranteed at the quartz crystal frequency. When the OSG is enab led, access to this area is prevented. The internal frequency is kept a f
OSG.
4. When the OSG is disabled, operation in this area is not guaranteed When the OSG is enab led, access to this area is prevented. The internal frequency is kept at f
OSG.
3.2 RESETS
ST62T55C ST62T65C/E65C
The MCU can be reset in four ways:
– by the external Reset input being pulled low; – by Power-on Res et; – by the digital Watc hdog periph eral timing out. – by Low Voltage Dete ction (LVD)
3.2.1 RESET Input
The RESET
pin may be connected to a device of the application board in order to reset the MCU if required. The RESET
pin may be pulled low in RUN, WAIT or STOP mode. This input can be used to reset the MCU internal state and ensure a correct start-up procedure. The pin i s active lo w and features a Schmitt trigger input. The internal Reset signal is generated by adding a delay to the external signal. Therefore even short pulses on the RESET
pin are acceptable, provide d VDD has completed its rising phase and that the oscillator is running correctly (normal RUN or WAIT modes). The MCU is kept in the Reset state as long as the RESET
If RESET
pin is held low.
activation occurs in the RUN or WAIT modes, processing of the user program is stopped (RUN mode only), the Inputs and Outputs are con­figured as inputs with pull-up resistors and the main Osc illat o r is res t ar ted. When the le v el o n the RESET pin then goes high, the initialization se­quence is executed following expiry of the internal delay period.
If RESET
pin activation occurs in the STOP mode, the oscillator starts u p and a ll Inputs and Out puts are configured as inputs with pull-up resistors. When the level of the RESET
pin then goes high, the initialization sequence is executed following expiry of the internal delay period.
3.2.2 Power-on Reset
The function of the POR circuit cons ists in waking up the MCU by detecting around 2V a dynamic (rising edge) variation of the VDD Supply. At the beginning of this sequence, the MCU is configured in the Reset state: al l I/O ports are c onfigured as inputs with pull-up resistors a nd no instruction is executed. When the power supply voltage rises to a sufficient level, the o scillator starts to operate, whereupon an internal delay is initiated, in order to allow the oscillator to fully stabilize befo re ex ecut ­ing the first instruction. The initialization sequence
is executed immediately following the internal de­lay.
To ensure correct s tart-up, the user s hould take care that the VDD Supply is stabilized at a suffi­cient level for the chosen frequency (see recom­mended operation) before the reset sign al is re­leased. In addition, supply rising must start from 0V.
As a consequence, the POR does not allow to su­pervise static, slowly rising, or falling, or noisy (present in g o s c illation) VDD supplies.
An external RC network connected to the RESET pin, or the LVD reset can b e used instead to get the best performances.
Figure 13. Reset and Interrupt Processing
RESET
NMI M ASK SET
INT LATCH CLEARED
( IF PRESENT )
SELECT
NMI MODE FLAGS
PUT FFEH
ON ADDRESS BUS
YES
IS RESET STILL
PRESENT?
NO
LOAD PC
FROM RESET LOCATIONS
FFE/FFF
FETCH INSTRUCTION
VA000427
23/86
ST62T55C ST62T65C/E65C
RESET
RESETS (Cont’d)
3.2.3 Watchdog Reset
The MCU provides a Wat chdog timer function in order to ensure graceful recovery from software upsets. If the Watchdog regi ster is not refreshed before an end-of-count condition is reached, the internal reset will be activated. This, amongs t ot h­er things, resets the watchdog counter.
The MCU restarts just as though the Reset had been generated by the RESET
pin, including the
built-in stabilisation de l a y peri o d.
3.2.4 LVD Reset
The on-chip Low Voltage Detector, selectable as user option, features static Reset when supply voltage is below a reference value. Thanks to this feature, external reset circuit can be removed while keeping the application safety. This SAFE RESET is effective as well in Power-on phase as in power supply drop with different reference val-
Figure 14. LVD Reset on Power-on and Power-down (Brown-out)
ues, allowing hysteresis effect. Reference value in case of voltage drop has been set lower than the reference value for power-on in order to avoid any parasitic Reset when MCU start's running and sinking current on the supply.
As long as the s upply voltage is below the refer­ence value, there is a internal and static RESET command. The MCU can start only when the sup­ply voltage rises over the reference value. There­fore, only two operating mode exist for the MCU: RESET active below the voltage reference, and running mode over the voltage reference as shown on the Figure 14 , that represents a power­up, power-down sequence.
Note: When the RESET state is controlled by one of the internal RESET sourc es (Low Voltage De­tector, Watchdog, Power on Reset), the RESET pin is tied to low logic level.
V
DD
V
Up
V
dn
3.2.5 Application Notes
No external resistor is requ ired between V
DD
and
the Reset pin, thanks to the built-in pull-up device.
RESET
time
VR02106 A
Direct external connection of the pin RESET to
must be avoided in order to ensure safe be-
V
DD
haviour of the internal reset sources (AND.Wired structure).
24/86
RESETS (Cont’d)
3.2.6 MCU Initializ ation Sequence
When a reset occurs the stack is reset, the PC is loaded with the address of the Reset Vector (locat­ed in program ROM starting at address 0FFEh). A jump to the beginning of the user program must be coded at this address. Following a Reset , the In­terrupt flag is automatically set, so that the CPU is in Non Maskable Interrupt mode; this prevents the initialisation routine from being interrupted. The in­itialisation routine should therefore be t erminated by a RETI instruction, in order to revert to normal mode and enable interrupts. If no pending interrupt is present at the end of the initialisation routine, the MCU will continue by processing the instruction immediately following the RETI instruction. If, how­ever, a pending interrupt is present, it will be serv­iced.
Figure 16. Reset Block Diagram
ST62T55C ST62T65C/E65C
Figure 15. Reset and Interrupt Processing
RESET
JP:2 BYTES/4 CYCLES
RESET
VECTOR
INITIALIZATION ROUTINE
JP
RETI: 1 BYTE/2 CYCLES
RETI
VA00181
V
DD
R
PU
R
RESET
POWER
WATCHDOG R ESET
LVD RESET
1) Resis tive ESD protection. Val ue not guarant eed.
ESD
ON RESET
f
OSC
1)
AND. Wired
RESET
CK
COUNTER
RESET
ST6 INTERNAL RESET
VR02107A
25/86
ST62T55C ST62T65C/E65C
RESETS (Cont’d) Table 5Register Reset Status
Register Address(es) Status Comment
Oscillator Control Register EEPROM Control Register Port Data Registers Port Direction Register Port Option Register Interrupt Option Register TIMER Status/Control
0DCh 0EAh 0C0h to 0C2h 0C4h to 0C6h 0CCh to 0CEh 0C8h 0D4h
00h 00h 00h 00h 00h 00h 00h
EEPROM disabled (if available) I/O are Input with pull-up I/O are Input with pull-up I/O are Input with pull-up Interrupt disabled TIMER disabled
AR TIMER Mode Control Register AR TIMER Status/Control 0 Register AR TIMER Status/Control 1 Register AR TIMER Compare Register AR TIMER Load Register
Miscellaneous Register SPI Registers SPI DIV Register SPI MOD Register SPI DSR Register X, Y, V, W, Register Accumulator Data RAM Data RAM EEPROM Page Register Data ROM Window Register EEPROM A/D Result Register AR TIMER Load Register AR TIMER Reload/Capture Register TIMER Counter Register TIMER Prescaler Register Watchdog Counter Register A/D Control Register
0D5h 0D6h 0D7h 0DAh 0DBh
0DDh 0E0h to 0E2h 0E1h 0E2h 0E0h 080H TO 083H 0FFh 084h to 0BFh 0E8h 0C9h 00h to 03Fh 0D0h 0DBh 0D9h 0D3h 0D2h 0D8h 0D1h
00h 02h 00h 00h 00h
00h 00h 00h 00h
Undefined
Undefined
FFh 7Fh FEh 40h
AR TIMER stopped
SPI Output not connected to PC3 SPI disabled SPI disabled SPI disabled SPI disabled
As written if programmed
Max count loaded
A/D in Standby
26/86
Loading...
+ 60 hidden pages