IC Phoenix
 
Home ›  SS96 > ST62T46B,8-BIT OTP/EPROM MCU WITH LCD DRIVER / EEPROM AND A/D CONVERTER
ST62T46B Fast Delivery,Good Price
Part Number:
If you need More Quantity or Better Price,Welcom Any inquiry.
We available via phone +865332716050 Email
Partno Mfg Dc Qty AvailableDescript
ST62T46BSTN/a504avai8-BIT OTP/EPROM MCU WITH LCD DRIVER / EEPROM AND A/D CONVERTER


ST62T46B ,8-BIT OTP/EPROM MCU WITH LCD DRIVER / EEPROM AND A/D CONVERTERGENERAL DESCRIPTION . . . . . . .... ........51.1 INTRODUCTION ....... .. . ..51.2 PIN DESCRIPTIONS ..
ST62T46BB6 ,8-BIT MICROCONTROLLER ( MCU ) WITH OTP, ROM, FASTROM, EPROM, LCD DRIVER, EEPROM, A/D CONVERTER AND 56 PINS
ST62T52CM3 ,8-BIT MICROCONTROLLER ( MCU ) WITH OTP, ROM, FASTROM, EPROM, A/D CONVERTER, SAFE RESET, AUTO-RELOAD TIMER AND EEPROMTable of ContentsDocument Page4 ON-CHIP PERIPHERALS . . . . . . 364.1 I/O PORTS . . . ..
ST62T52CM6 ,8-BIT MICROCONTROLLER ( MCU ) WITH OTP, ROM, FASTROM, EPROM, A/D CONVERTER, SAFE RESET, AUTO-RELOAD TIMER AND EEPROMapplications. All ST62xx devices are OTP devices offer all the advantages of user pro-based on a bu ..
ST62T52CM6 ,8-BIT MICROCONTROLLER ( MCU ) WITH OTP, ROM, FASTROM, EPROM, A/D CONVERTER, SAFE RESET, AUTO-RELOAD TIMER AND EEPROMGENERAL DESCRIPTION1.1 INTRODUCTIONThe ST62T52C and ST62T62C devices is low cost fined in the progr ..
ST62T53B , 8-BIT OTP/EPROM MCUs WITH A/D CONVERTER, AUTO-RELOAD TIMER, EEPROM AND SPI
STP5N30L ,OLD PRODUCT: NOT SUITABLE FOR NEW DESIGN-INSTP5N30LSTP5N30LFIN - CHANNEL ENHANCEMENT MODEPOWER MOS TRANSISTORTYPE V R IDSS DS(on) DSTP5N30L 30 ..
STP5N90 ,N-CHANNEL ENHANCEMENT MODE POWER MOS TRANSISTORABSOLUTE MAXIMUM RATINGS I_Symbol Parameter T Value Cunit" L., - .0 STPSNQO l STP5N90FI " '_VD ..
STP5NA50 ,Trans MOSFET N-CH 500V 5A 3-Pin(3+Tab) TO-220STP5NA50STP5NA50FIN - CHANNEL ENHANCEMENT MODEFAST POWER MOS TRANSISTORTYPE V R IDSS DS(on) DSTP5NA ..
STP5NA80 ,Trans MOSFET N-CH 800V 4.7A 3-Pin(3+Tab) TO-220STP5NA80STP5NA80FIN - CHANNEL ENHANCEMENT MODEFAST POWER MOS TRANSISTORTYPE V R IDSS DS(on) DSTP5NA ..
STP5NB100 ,N-CHANNEL 1000VABSOLUTE MAXIMUM RATINGSSymbol Parameter Value UnitSTP5NB100 STP5NB100FPV Drain-source Voltage (V = ..
STP5NB100FP ,N-CHANNEL 1000VELECTRICAL CHARACTERISTICS (TCASE = 25 °C UNLESS OTHERWISE SPECIFIED)OFFSymbol Parameter Test Condi ..


ST62T46B
8-BIT OTP/EPROM MCU WITH LCD DRIVER / EEPROM AND A/D CONVERTER
September 1998 1/72
Rev. 2.5
ST62T46B/E46B

8-BIT OTP/EPROM MCU WITH LCD DRIVER,
EEPROM AND A/D CONVERTER 3.0to 6.0V Supply Operating Range 8 MHz Maximum Clock Frequency -40to +85°C Operating Temperature Range Run, Wait and Stop Modes 5 Interrupt Vectors Look-up Table capabilityin Program Memory Data Storagein Program Memory:
User selectable size Data RAM: 128 bytes Data EEPROM: 128 bytes User Programmable Options 20 I/O pins, fully programmable as: Input with pull-up resistor Input without pull-up resistor Input with interrupt generation Open-drainor push-pull output Analog Input LCD segments(8 combiport lines) 4 I/O lines can sinkupto 20mAto drive LEDsor
TRIACs directly Two 8-bit Timer/Counter with 7-bit
programmable prescaler Digital Watchdog 8-bit A/D Converter with8 analog inputs 8-bit Synchronous Peripheral Interface (SPI) LCD driver with 27 segment outputs, 4
backplane outputs and selectable multiplexing
ratio. 32kHz oscillator for stand-by LCD operation Power Supply Supervisor (PSS) On-chip Clock oscillator canbe drivenby Quartz
Crystalor Ceramic resonator One external Non-Maskable Interrupt ST6240-EMU2 Emulation and Development
System (connects to an MS-DOS PC viaa
parallel port).
DEVICE SUMMARY

(See endof Datasheetfor Ordering Information)
PSDIP56
CSDIP56W
DEVICE OTP
(Bytes)
EPROM
(Bytes) I/O Pins

ST62T46B 3884 - 12to20
ST62E46B 3884 12to20
2/72
Table of Contents

Document
Page
ST62T46B/E46B .................................... .1 GENERAL DESCRIPTION....... ...... .... ... ... ... ..... .... ... .... ..... ... ....5

1.1 INTRODUCTION .......... ... ......... .... ... ... ... ... ........ ...... .....5
1.2 PIN DESCRIPTIONS.......... ......... ................ ........ ...... .....7
1.3 MEMORY MAP...... .... ..... ...... ... ...... ... .... ... ..... ...... .......8
1.3.1 Introduction........ ..... ...... ..... ... ..... ...... ... ......... .... ..8
1.3.2 Program Space........................... ....... ........ ...... ... ..9
1.3.3 Data Space........ ..... ...... ..... ... ..... ...... ... ......... .... .10
1.3.4 Stack Space................. .... ... .... .... ......... .... ..... ... ..10
1.3.5 Data Window Register (DWR).................... ...... ........... ....11
1.3.6 Data RAM/EEPROM Bank Register (DRBR).......... ..... .... ...........12
1.3.7 EEPROM Description ..... .... ... ....... ... .... .... ................ .13
1.4 PROGRAMMING MODES ...... ... ........... ............. .... ........ ....15
1.4.1 Option Byte........ ..... ...... ..... ... ..... ...... ... ......... .... .15
1.4.2 Program Memory.... ......... .... ... ... ..... .... ..... ...... ...... ..15
1.4.3 EEPROM Data Memory............ ..... ..... .... ...... ... ...... ... ..15
1.4.4 EPROM Erasing ......... ... ... .... ... ... .... ...... ....... .... ..... .15 CENTRAL PROCESSING UNIT ...... ... ........... ............. .... ........ ....16
2.1 INTRODUCTION .......... ... ......... .... ... ... ... ... ........ ...... ....16
2.2 CPU REGISTERS........ ..... ...... ..... ... ..... ...... ... ......... .... .16 CLOCKS, RESET, INTERRUPTS AND POWER SAVING MODES....... ...... .... ....18
3.1 CLOCK SYSTEM.. ..... ....... ..... ............ ... ..... ............. ... .18
3.1.1 Main Oscillator.......... ......... ................ ........ ...... ....18
3.1.2 32 KHz STAND-BY OSCILLATOR.......... ........... ... ..... ... .....19
3.2 RESETS........ ....... .............. ..... ......... ... ... ............. .20
3.2.1 RESET Input ..... ..... ........ ...... ...... .... ......... ....... ... .20
3.2.2 Power-on Reset............... .... ... ... .... ...... ....... .... ..... .20
3.2.3 Watchdog Reset.... ..... ..... ...... ...... .... ...... .............. .21
3.2.4 Application Notes.... ......... .... ... ... ..... .... ..... ...... ...... ..21
3.2.5 MCU Initialization Sequence .... ........ ....... ........ ....... ...... ..21
3.3 DIGITAL WATCHDOG............... .... ... ... .... ...... ....... .... ..... .23
3.3.1 Digital Watchdog Register (DWDR)... .... ........ .......... ... ...... ...25
3.3.2 Application Notes.... ......... .... ... ... ..... .... ..... ...... ...... ..25
3.4 INTERRUPTS.... ...... ...... ........ ...... ....... .... ... ... ... ...... ..27
3.4.1 Interrupt request............... .... ... ... .... ...... ....... .... ..... .27
3.4.2 Interrupt Procedure... .... ............... .... ... ..... .... ... ... .... .28
3.4.3 Interrupt Option Register (IOR).... ...... ... ... .... ... ... .... ..... ... ..29
3.4.4 Interrupt Sources.... ......... .... ... ... ..... .... ..... ...... ...... ..29
3.5 POWER SAVING MODES ...... ... ........... ............. .... ........ ....31
3.5.1 WAIT Mode........ ..... ...... ..... ... ..... ...... ... ......... .... .31
3.5.2 STOP Mode........... ...... .... ... .... .... ......... .... ..... ... ..31
3.5.3 Exit from WAIT and STOP Modes... ...... ...... ... ... ........ ..... ....32
3/72
Table of Contents Document
Page ON-CHIP PERIPHERALS... .... .............. ..... .......... .... ... ... ... .... .33

4.1 I/O PORTS........ .... ... ..................... ....... ... ... ...... ... ...33
4.1.1 Operating Modes.... ......... .... ... ... ..... .... ..... ...... ...... ..34
4.1.2 Safe I/O State Switching Sequence... .... ........ .......... ... ...... ...35
4.1.3 LCD alternate functions (combiports) .... ...... ....... ........ ...... ....37
4.1.4 SPI alternate functions... ...... ........ .......... ..... .... ......... ..37
4.1.5 I/O Port Option Registers............................. ...... ..... ... ..38
4.1.6 I/O Port Data Direction Registers... ..... ... ....... ..... ................38
4.1.7 I/O Port Data Registers.... .... .... ... ... ..... .... ........ ... ...... ..38
4.2 TIMER1&2..... ...... ..... .... ..... .............. ...... .............. .39
4.2.1 TIMER1&2 Operating Mode.................................... .... .41
4.2.2 Timer Interrupt.......... ......... ................ ........ ...... ....41
4.2.3 Application Notes.... ......... .... ... ... ..... .... ..... ...... ...... ..41
4.2.4 TIMER1 Registers. ....... .... ........ ... ...... ............. ..... ...42
4.2.5 TIMER2 Registers. ....... .... ........ ... ...... ............. ..... ...43
4.3 A/D CONVERTER (ADC)... .... ............... .... ... ..... .... ... ... .... .44
4.3.1 Application Notes.... ......... .... ... ... ..... .... ..... ...... ...... ..44
4.4 SERIAL PERIPHERAL INTERFACE (SPI)............ ...... ... .......... .....46
4.5 LCD CONTROLLER-DRIVER.... .... .... ... ... ..... .... ........ ... ...... ..48
4.5.1 Multiplexing ratio and frame frequency setting.... ...... ........ ..........49
4.5.2 Segment and common plates driving.. ...... ...... ....... ......... ......49
4.5.3 LCD RAM.............. ...... ... ...... .... ...... .... ...... .... ....50
4.5.4 Standbyor STOP operation mode.......... ........... ... ..... ... .....51
4.5.5 LCD Mode Control Register (LCDCR).... .................. ........ ...51
4.6 POWERSUPPLY SUPERVISOR DEVICE (PSS) ........ ....... ...... .... ......52
4.6.1 PSS Operating Mode Description... ...... .......... ...... .............53
4.6.2 PSS Register... .... .............. ..... .......... .... ... ... ... .... .54 SOFTWARE ..... .... ........ .... ... ... ...... .... .... ... ...... .... .... ..... .55
5.1 ST6 ARCHITECTURE............... .... ... ... .... ...... ....... .... ..... .55
5.2 ADDRESSING MODES.... ......... .... ... ... ..... .... ..... ...... ...... ..55
5.3 INSTRUCTION SET... .... .............. ..... .......... .... ... ... ... .... .56 ELECTRICAL CHARACTERISTICS............ ..... ..... .... ...... ... ...... ... ..61
6.1 ABSOLUTE MAXIMUM RATINGS. ..... ...... ... ... ........................ .61
6.2 RECOMMENDED OPERATING CONDITIONS... ...... ........ ............ ....62
6.3 DC ELECTRICAL CHARACTERISTICS... ...... .......... ...... .............63
6.4 AC ELECTRICAL CHARACTERISTICS... ...... .......... ...... .............64
6.5 A/D CONVERTER CHARACTERISTICS... ...... ...... ... ... ........ ..... ....64
6.6 TIMER CHARACTERISTICS... ...... ........ .......... ..... .... ......... ..65
6.7 SPI CHARACTERISTICS... .... ............... .... ... ..... .... ... ... .... .65
6.8 LCD ELECTRICAL CHARACTERISTICS.......... ........... ... ..... ... .....65
6.9 PSS ELECTRICAL CHARACTERISTICS (WHEN AVAILABLE)............... .....65 GENERAL INFORMATION.......... ......... ................ ........ ...... ....66
7.1 PACKAGE MECHANICAL DATA.... ...... ...... ..... ....... .... ... ... .... ..66
7.2 PACKAGE THERMAL CHARACTERISTIC.. ...... ...... ....... ......... ......67
7.3 .ORDERING INFORMATION... ...... ........ .......... ..... .... ......... ..67
4/72
Table of Contents

Document
Page
ST6246B.......................................... .69 GENERAL DESCRIPTION... .... .............. ..... .......... .... ... ... ... .... .70

1.1 INTRODUCTION.......... ..... ...... ... ...... ... .... ... ..... ...... ..... .70
1.2 ROM READOUT PROTECTION... ...... .... ..... .... ......... ... ... ... .... .70
1.3 ORDERING INFORMATION........ .... ..... ...... ... ...... ...... .... .... ..72
1.3.1 Transferof Customer Code. ..... ...... ... ... ........................ .72
1.3.2 Listing Generation and Verification.......... ........... ... ..... ... .....72
5/72
ST62T46B/E46B GENERAL DESCRIPTION
1.1 INTRODUCTION

The ST62T46B and ST62E46B devices are low
cost membersof the ST62xx 8-bit HCMOS family microcontrollers, which are targetedat lowto
medium complexity applications. All ST62xx de-
vices are based ona building block approach:a
common coreis surrounded bya numberof on-
chip peripherals.
The ST62E46Bis the erasable EPROM versionof
the ST62T46B device, which maybe usedto em-
ulate the ST62T46B device,as wellas the respec-
tive ST6246B ROM devices.
Figure1. Block Diagram

TEST
NMI INTERRUPT
PROGRAM
STACK LEVEL1
STACK LEVEL2
STACK LEVEL3
STACK LEVEL4
STACK LEVEL5
STACK LEVEL6
POWER
SUPPLY OSCILLATOR RESET
DATA ROM
USER
SELECTABLE
DATA RAM
PORTA
PORTB
TIMER1
DIGITAL BIT CORE
TEST/VPP
8-BIT
A/D CONVERTER
PA4..PA7/Ain
VDDVSS OSCin OSCout RESET
WATCHDOG
Memory
PORTC
SPI (SERIAL
PERIPHERAL
INTERFACE)
128 Bytes3884 bytes
DATA EEPROM
128 Bytes
PB0..PB3/Ain
PC0..PC7/S33..S40
S9..S16, S25..S32, S41..S43
COM1..COM4
(VPPon EPROM/OTP versions only)
PB4/20mA Sink
PB5/Scl/20mASink
PB6/Sin/20mA Sink
PB7/Sout/20mA Sink
VLCD
VLCD1/3
VLCD2/3
OSC 32kHz
TIMER2
OSC32in
OSC32out
PSS
LCD DRIVER
POWER SUPPLY
SUPERVISOR
6/72
ST62T46B/E46B
INTRODUCTION
(Cont’d)
OTP and EPROM devices are functionally identi-
cal. The ROM based versions offer the same func-
tionality selecting as ROM options the options de-
fined in the programmable option byte of the
OTP/EPROM versions.OTP devices offer all the
advantagesof user programmabilityat low cost,
which make them the ideal choiceina wide range applications where frequent code changes, mul-
tiple code versionsor last minute programmability
are required.
These compact low-cost devices feature two Tim-
ers comprising an 8-bit counter anda 7-bit pro-
grammable prescaler, EEPROM data capability,a
serial synchronous port interface (SPI), an 8-bit
A/D Converter with8 analog inputs,a Digital
Watchdog timer, anda complete LCD controllerdriver, making them well suitedfora wide rangeof
automotive, appliance and industrial applications.
Figure2.56 Pin SDIP Package
29
VLCD
Ain/PA7
Ain/PA6
Ain/PA5
Ain/PA4
OSCout
OSCin
TEST/VPP(1)DD
VSS
S13
S12
S11
S10
PB1/Ain
PB2/Ain
PB3/Ain
PB4*
PB5/Scl*
RESET
NMI
PB7/Sout*
PB6/Sin*
PSS
OSC32in
OSC32out
PB0/Ain
(1)VPPon EPROM/OTPonly 43
PC3/S36
PC4/S37
PC5/S38
PC6/S39
PC7/S40
COM3
COM2
S41
S42
S43
PC2/S35
PC1/S34
PC0/S33
S32
S31
S26
S25
S16
S15
S14
COM4
COM1
VLCD1/3
VLCD2/3
S30
S29
S28
S27
*20mA sink
7/72
ST62T46B/E46B
1.2 PIN DESCRIPTIONSDD andVSS.
Poweris suppliedto the MCU via
these two pins. VDDis the power connection andVSSis the ground connection.
OSCin and OSCout.
These pins are internally
connectedto the on-chip oscillator circuit.A quartz
crystal,a ceramic resonatoror an external clock
signal can be connected between these two pins.
The OSCin pinis the input pin, the OSCout pinis
the output pin.
RESET.
The active-low RESET pinis usedto re-
start the microcontroller.
TEST/VPP.
The TEST must be heldatVSS for nor-
mal operation (an internal pull-down resistor se-
lects normal operating modeif TEST pinis not
connected).If TEST pinis connectedtoa +12.5V
level during the reset phase, the EPROM/OTP
programming Modeis entered.
NMI.
The NMI pin provides the capability for asyn-
chronous interruption,by applyingan external non
maskable interruptto the MCU. The NMI inputis
falling edge sensitive withSchmitt trigger charac-
teristics. The user can selectas option the availa-
bilityofan on-chip pull-upat this pin.
PA4-PA7.
These4 lines are organisedas one I/O
port (A). Each line may be configured under soft-
ware controlas inputs withor without internal pull- resistors, input with interrupt generation and
pull-up resistor, open-drainor push-pull outputs,oras analog inputs for the A/D converter.
PB0...PB7.
These8 lines are organisedas one I/O
port (B). Each line may be configured under soft-
ware controlas inputs withor without internal pull- resistors, input with interrupt generation and
pull-up resistor, open-drain or push-pull outputs,
analog inputs for the A/D converter. PB0..PB3 can usedas analog inputs for the A/D converter,
while PB7/Sout, PB6/Sin and PB5/Scl canbe used
respectivelyas data out, datain and Clock pinsfor
the on-chip SPI.In addition, PB4..PB7 can sink
20mA for direct LEDor TRIAC drive.
PC0-PC7.
These8 lines are organisedas one I/O
port (C). Each line maybe configured under soft-
ware controlas input withor without internal pull- resistor, input with interrupt generation and
pull-up resistor, open-drainor push-pull output,or LCD segment output S33..S40.
COM1-COM4.
These four pins are the LCD pe-
ripheral common outputs. They are the outputsof
the on-chip backplane voltage generator whichis
used for multiplexing the45 LCD lines allowingup 180 segmentstobe driven.
S9..S16, S25..S43.
These pins are the27 LCD pe-
ripheral segment outputs. S33..S40 are alternate
functionsof the PortC I/O pins. (Combiports fea-
ture)
VLCD.
Display voltage supply.It determines the
high voltage level on COM1-COM4 and S4-S48
pins.
VLCD1/3, VLCD2/3.
Display supply voltage inputs
for determining the display voltage levels on
COM1-COM4 and S4-S48 pins during multiplex
operation.
PSS.
Thisis the Power Supply Supervisor sensing
pin. When the voltage appliedto this pinis falling
belowa software programmed value the highest
priority (NMI) interrupt can be generated. This pinhasto be connectedto the voltageto be super-
vised.
OSC32in
and OSC32out. These pins are inter-
nally connected with the on-chip 32kHz oscillator
circuit.A 32.768kHz quartz crystal can be con-
nected between these two pinsifitis necessaryto
provide the LCD stand-by clock and real time inter-
rupt. OSC32inis the input pin, OSC32outis the
output pin.
8/72
ST62T46B/E46B
1.3 MEMORY MAP
1.3.1 Introduction

The MCU operatesin three separate memory
spaces: Program space, Data space, and Stack
space. Operationin these three memory spacesis
describedin the following paragraphs.
Briefly, Program space contains user program
codein Program memory and user vectors; Data
space contains user datain RAM andin Program
memory, and Stack space accommodates six lev-
elsof stack for subroutine and interrupt service
routine nesting.
Figure3. Memory Addressing Diagram

PROGRAM SPACE
PROGRAM
INTERRUPT&
RESET VECTORS
ACCUMULATOR
DATA RAM
BANK SELECT
WINDOW SELECT
RAM REGISTER REGISTER REGISTER REGISTER
DATA READ-ONLY
WINDOW
RAM/ EEPROM
BANKING AREA
000h
03Fh
040h
07Fh
080h
081h
082h
083h
084h
0C0h
0FFh
DATA SPACE
0000h
0FF0h
0FFFh
MEMORY
MEMORY
DATA READ-ONLY
MEMORY
VR01568
9/72
ST62T46B/E46B
MEMORY MAP
(Cont’d)
1.3.2 Program Space

Program Space comprises the instructionsto be
executed, the data required for immediate ad-
dressing mode instructions, the reserved factory
test area and the user vectors. Program Spaceis
addressed via the 12-bit Program Counter register
(PC register).
1.3.2.1 Program Memory Protection

The Program Memoryin OTPor EPROM devices
canbe protected against external readoutof mem-
oryby selecting the READOUT PROTECTION op-
tionin the option byte. the EPROM parts, READOUT PROTECTION
option can be disactivated only by U.V. erasure
that also results into the whole EPROM contexterasure.
Note:
Once the Readout Protectionis activated,itno longer possible, evenfor STMicroelectronics, gain accessto the Program memory contents.
Returned parts witha protection set can therefore
not be accepted.
Figure4. ST62E46B/T46B ProgramMemory Map

0000h
RESERVED*
USER
PROGRAM MEMORY
(OTP/EPROM)
3872 BYTES
0F9Fh
0FA0h
0FEFh
0FF0h
0FF7h
0FF8h
0FFBh
0FFCh
0FFDh
0FFEh
0FFFh
RESERVED*
RESERVED
INTERRUPT VECTORS
NMI VECTOR
USER RESET VECTOR
0080h
(*) Reserved areas shouldbe filled with 0FFh
007Fh
10/72
ST62T46B/E46B
MEMORY MAP
(Cont’d)
1.3.3 Data Space

Data Space accommodatesall the data necessary
for processing the user program. This space com-
prises the RAM resource, the processor core and
peripheral registers, as well as read-only data
suchas constants and look-up tablesin Program
memory.
1.3.3.1 Data ROM

All read-only datais physically storedin program
memory, which also accommodates the Program
Space. The program memory consequently con-
tains the program codetobe executed,as wellas
the constants and look-up tables required by the
application.
The Data Space locationsin which the different
constants and look-up tables are addressedby the
processor core may be thoughtof asa 64-byte
window through whichitis possibleto access the
read-only data storedin Program memory.
1.3.3.2 Data RAM/EEPROM
ST62T46B and ST62E46B devices, the data
space includes 60 bytesof RAM, the accumulator
(A), the indirect registers (X), (Y), the short direct
registers (V), (W), the I/O port registers, the pe-
ripheral data and control registers, the interrupt
option register and the Data ROM Window register
(DRW register).
Additional RAM and EEPROM pages can also be
addressed using banksof 64 bytes located be-
tween addresses 00h and 3Fh.
1.3.4 Stack Space

Stack space consistsof six 12-bit registers which
are usedto stack subroutine and interrupt return
addresses,as wellas the current program counter
contents.
Table1. Additional RAM/EEPROM Banks.
Table2. ST62T46B/E46B Data Memory Space
Device RAM EEPROM

ST62T46B/E46B 1x64 bytes 2x64 bytes
DATAand EEPROM 000h
03Fh
DATAROM WINDOW AREA 040h
07Fh REGISTER 080h REGISTER 081h REGISTER 082h REGISTER 083h
DATA RAM 084h
0BFh
PORTA DATA REGISTER 0C0h
PORTB DATA REGISTER 0C1h
SPI INTERRUPT DISABLE REGISTER 0C2h
PORTC DATAREGISTER 0C3h
PORTA DIRECTION REGISTER 0C4h
PORTB DIRECTION REGISTER 0C5h
PORTC DIRECTION REGISTER 0C6h
RESERVED 0C7h
INTERRUPT OPTIONREGISTER 0C8h*
DATAROM WINDOW REGISTER 0C9h*
RESERVED 0CAh*
RAM/EEPROMBANK SELECT REGISTER 0CBh*
PORTA OPTION REGISTER 0CCh
RESERVED 0CDh
PORTB OPTION REGISTER 0CEh
PORTC OPTION REGISTER 0CFh
A/D DATAREGISTER 0D0h
A/D CONTROL REGISTER 0D1h
TIMER1 PRESCALER REGISTER 0D2h
TIMER1 COUNTER REGISTER 0D3h
TIMER1 STATUS/CONTROL REGISTER 0D4h
TIMER2 PRESCALER REGISTER 0D5h
TIMER2 COUNTER REGISTER 0D6h
TIMER2 STATUS/CONTROL REGISTER 0D7h
WATCHDOG REGISTER 0D8h
RESERVED 0D9h
PSS STATUS/CONTROL REGISTER 0DAh
32kHz OSCILLATORCONTROL REGISTER 0DBh
LCD MODECONTROL REGISTER 0DCh
SPI DATA REGISTER 0DDh
RESERVED 0DEh
EEPROM CONTROL REGISTER 0DFh
LCD RAM 0E0h
0F7h
DATA RAM 0F8h
0FEh
ACCUMULATOR OFFh WRITEONLY REGISTER
11/72
ST62T46B/E46B
MEMORY MAP
(Cont’d)
1.3.5 Data Window Register (DWR)

The Data read-only memory windowis located from
address 0040hto address 007Fhin Data space.It
allows direct readingof64 consecutive bytes locat- anywherein program memory, between ad-
dress 0000h and 1FFFh (top memory address de-
pends on the specific device). All the program
memory can therefore be usedto store either in-
structionsor read-only data. Indeed, the windowcanbe movedin stepsof64 bytes along the pro-
gram memory bywriting the appropriate codein the
Data Window Register (DWR).
The DWR canbe addressed like any RAM location the Data Space,itis howevera write-only regis-
ter and therefore cannotbe accessed using single-
bit operations. This registeris usedto position the
64-byte read-only data window (from address 40h address 7Fhof the Data space)in program
memoryin 64-byte steps. The effective addressof
the byteto be readas datain program memoryis
obtained by concatenating the6 least significant
bitsof the register address givenin the instruction
(as least significant bits) and the contentof the
DWR register (as most significant bits),as illustrat-in Figure5 below. For instance, when address-
ing location 0040hof the Data Space, with0 load-in the DWR register, the physical location ad-
dressedin program memoryis 00h. The DWR reg-
isteris not cleared on reset, thereforeit must be
writtento priorto the first accessto the Data read-
only memory window area.
Data Window Register (DWR)

Address: 0C9h — Write Only
Bits6,7= Not used.
Bit 5-0= DWR5-DWR0: Data read-only memory
Window Register Bits. These are the Data read-
only memory Window bits that correspondto the
upper bitsof the data read-only memory space.
Caution:
This registeris undefined on reset. Nei-
ther read nor singlebit instructions maybe usedto
address this register.
Note:
Careis required when handling the DWR
register asitis write only. For this reason, the
DWR contents should not be changed while exe-
cuting an interrupt service routine, as the service
routine cannot save and then restore the register’s
previous contents.Ifitis impossibleto avoid writ-
ingto the DWR during the interrupt service routine, imageof the register mustbe savedina RAM
location, and each time the program writesto the
DWR,it must also writeto the image register. The
image register mustbe written firstso that,ifanin-
terrupt occurs between the two instructions, the
DWRis not affected.
Figure5. Data read-only memory Window Memory Addressing
- DWR5 DWR4 DWR3 DWR2 DWR1 DWR0
DATA ROM
WINDOW REGISTER
CONTENTS DATA SPACE ADDRESS
40h-7Fh INSTRUCTION
PROGRAM SPACE ADDRESS
765 432 0
543 21 0
543 21 0
READ17891011
VR01573C
DATA SPACE ADDRESS59h00 1 00 11
Example:
(DWR)
DWR=28h 000 00001ROM
ADDRESS:A19h 11
12/72
ST62T46B/E46B
MEMORY MAP
(Cont’d)
1.3.6 Data RAM/EEPROM Bank Register
(DRBR)

Address: CBh — Write only
Bit 7-5= These bits are not used
Bit4- DRBR4. This bit, when set, selects RAM
Page2.
Bit3- DRBR3. This bit, when set, selects RAM
Page1.
Bit2. These bits are not used.
Bit1- DRBR1. This bit, when set, selects
EEPROM Page1.
Bit0- DRBR0. This bit, when set, selects
EEPROM Page0.
The selectionof the bankis madeby programmingthe Data RAM Bank Switch register (DRBR regis-
ter) locatedat address CBhof the Data Space ac-
cordingto Table1. No more than one bank should setata time.
The DRBR register can be addressed likea RAM
Data Spaceat the address CBh; neverthelessitis write only register that cannot be accessed with
single-bit operations. This registeris usedto select
the desired 64-byte RAM/EEPROM bankof the
Data Space. The numberof banks hastobe load-edin the DRBR register and the instruction hasto
pointto the selected locationasifit wasin bank0
(from 00h addressto 3Fh address).
This registeris not cleared during the MCU initiali-
zation, thereforeit must be written before the first
accessto the Data Space bank region. Referto
the Data Space description for additional informa-
tion. The DRBR registeris not modified whenan
interruptora subroutine occurs.
Notes
:
Careis required when handling the DRBR registeritis write only. For this reason,itis not allowed change the DRBR contents while executing in-
terrupt service routine,as the service routine can-
not save and then restoreits previous content.Ifit impossibleto avoid the writingof this registerin
interrupt service routine,an imageof this register
must be savedina RAM location, and each time
the program writesto DRBRit must write alsoto
the image register. The image register must be
written first, soif an interrupt occurs between the
two instructions the DRBRis not affected. DRBR Register, only1bit must be set. Other-
wise twoor more pages are enabledin parallel,
producing errors.
Table3. Data RAM Bank Register Set-up
- - DRBR4 DRBR3 - DRBR1 DRBR0
DRBR ST62T46B/E46B

00h None
01h EEPROM Page0
02h EEPROM Page1
08h Not available
10h RAM Page2
other Reserved
13/72
ST62T46B/E46B
MEMORY MAP
(Cont’d)
1.3.7 EEPROM Description

EEPROM memoryis locatedin 64-byte pagesin
data space. This memory maybe usedby the user
program for non-volatile data storage.
Data space from 00hto 3Fhis pagedas described Table4. EEPROM locations are accessed di-
rectlyby addressing these paged sectionsof data
space.
The EEPROM does not require dedicated instruc-
tionsfor reador write access. Once selected via the
Data RAM Bank Register, the active EEPROM
pageis controlledby the EEPROM Control Regis-
ter (EECTL), whichis described below.
Bit E20FFof the EECTL register mustbe reset prior any writeor read accessto the EEPROM.Ifno
bank has been selected,orif E2OFFis set, any ac-
cessis meaningless.
Programming must be enabled by setting the
E2ENAbitof the EECTL register.
The E2BUSYbitof the EECTL registeris set when
the EEPROMis performinga programming cycle.
Any accessto the EEPROM when E2BUSYis set meaningless.
Provided E2OFF and E2BUSY are reset,an EEP-
ROM locationis read just like any other data loca-
tion, alsoin termsof access time.
Writingto the EEPROM may be carried outin two
modes: Byte Mode (BMODE) and Parallel Mode
(PMODE).In BMODE, one byteis accessedata
time, whilein PMODE upto8 bytesin the same
row are programmed simultaneously (with conse-
quent speed and power consumption advantages,
the latter being particularly importantin battery
powered circuits).
General Notes:

Data shouldbe written directlyto the intended ad-
dressin EEPROM space. Thereisno buffer mem-
ory between data RAM and the EEPROM space.
When the EEPROMis busy (E2BUSY= “1”)EECTL cannot be accessedin write mode,itis
only possibleto read the statusof E2BUSY. This
implies thatas longas the EEPROMis busy,itis
not possibleto change the statusof the EEPROM
Control Register. EECTL bits4 and5 are reserved
and must never be set.
Careis required when dealing with the EECTL reg-
ister,as some bits are write only. For this reason,
the EECTL contents must notbe altered while ex-
ecutingan interrupt service routine.itis impossibleto avoid writingto this register
withinan interrupt service routine,an imageof the
register must be savedina RAM location, and
each time the program writesto EECTLit must
also writeto the image register. The image register
must be writtento firstso that,if an interrupt oc-
curs between the two instructions, the EECTL willnot be affected.
Table4. Row Arrangement for Parallel Writingof EEPROM Locations

Dataspace
addresses.
Banks0 and1.
Byte 0123 45 67
ROW7 38h-3Fh
ROW6 30h-37h
ROW5 28h-2Fh
ROW4 20h-27h
ROW3 18h-1Fh
ROW2 10h-17h
ROW1 08h-0Fh
ROW0 00h-07hto8 bytesin each row maybe programmed simultaneouslyin Parallel Write mode.
The numberof available 64-byte banks(1or2)is device dependent.
14/72
ST62T46B/E46B
MEMORY MAP
(Cont’d)
Additional Notes on Parallel Mode:
the user wishesto perform parallel program-
ming, the first step shouldbeto set the E2PAR2
bit. From this time on, the EEPROM will be ad-
dressedin write mode, the ROW address will be
latched andit will be possibleto changeit onlyat
the endof the programming cycle,orby resetting
E2PAR2 without programming the EEPROM. Af-
ter the ROW addressis latched, the MCU can only
“see” the selected EEPROM row and any attempt writeor read other rows will produce errors.
The EEPROM should not be read while E2PAR2 set. soon as the E2PAR2 bitis set, the8 volatile
ROW latches are cleared. From this moment on,
the user can load datainallorin partof the ROW.
Setting E2PAR1 will modify the EEPROM regis-
ters correspondingto the ROW latches accessed
after E2PAR2. For example,if the software sets
E2PAR2 and accesses the EEPROMby writingto
addresses 18h, 1Ah and 1Bh, and then sets
E2PAR1, these three registers willbe modifiedsi-
multaneously; the remaining bytesin the row will unaffected.
Note that E2PAR2is internally resetat the endof
the programming cycle. This implies that the user
must set the E2PAR2bit between two parallel pro-
gramming cycles. Note thatif the user triesto set
E2PAR1 while E2PAR2is not set, there willbeno
programming cycle and the E2PAR1bit willbe un-
affected. Consequently, the E2PAR1bit cannotbe
setif E2ENAis low. The E2PAR1bit canbe setby
the user, onlyif the E2ENA and E2PAR2 bits are
also set.
EEPROM Control Register (EECTL)

Address: DFh — Read/Write
Reset status: 00h
Bit7= D7: Unused.
Bit6 =E2OFF: Stand-by Enable Bit.WRITE ONLY. thisbitis set the EEPROMis disabled (any access
willbe meaningless) and the powerconsumptionof
the EEPROMis reducedtoits lowest value.
Bit 5-4= D5-D4: Reserved. MUST be kept reset.
Bit3= E2PAR1: Parallel Start Bit. WRITE ONLY.
Oncein Parallel Mode,as soonasthe usersoftware
sets the E2PAR1 bit, parallel writingof the8 adja-
cent registers will start. Thisbitis internally resetat
the endof the programming procedure. Note that
less than8 bytes can be writtenif required, the un-
defined bytes being unaffectedby the parallel pro-
gramming cycle; thisis explainedin greater detailin
the Additional Noteson Parallel Mode overleaf.
Bit2= E2PAR2: Parallel Mode En. Bit. WRITE
ONLY. Thisbit mustbe setby the user programin
orderto perform parallel programming.If E2PAR2 set and the parallel startbit (E2PAR1)is reset,to8 adjacent bytes can be written simultane-
ously. These8 adjacent bytes are consideredasa
row, whose address lines A7, A6, A5, A4, A3 are
fixed while A2, A1 andA0 are the changing bits,as
illustratedin Table4. E2PAR2is automatically re-
setat the endof any parallel programming proce-
dure.It can be reset by the user software before
starting the programming procedure, thus leaving
the EEPROM registers unchanged.
Bit1= E2BUSY: EEPROM Busy Bit. READ ON-
LY. Thisbitis automatically setby the EEPROM
control logic when the EEPROMisin program-
ming mode. The user program should testit before
any EEPROM reador write operation; any attempt access the EEPROM while the busybitis set
will be aborted and the writing procedure in
progress willbe completed.
Bit0= E2ENA: EEPROM Enable Bit. WRITE ON-
LY. Thisbit enables programmingof the EEPROM
cells.It must be set before any writeto the EEP-
ROM register. Any attemptto writeto the EEP-
ROM when E2ENAis lowis meaningless and will
not triggera write cycle.
Caution:
This registeris undefined on reset. Nei-
ther read nor singlebit instructions maybe usedto
address this register. E2OFF D5 D4 E2PAR1 E2PAR2 E2BUSY E2ENA
15/72
ST62T46B/E46B
1.4 PROGRAMMING MODES
1.4.1 Option Byte

The Option Byte allows configuration capabilityto
the MCUs. Option byte’s contentis automatically
read, and the selected options enabled, when the
chip resetis activated. can only be accessed during the programming
mode. This accessis made either automatically(copy froma master device)or by selecting the
OPTION BYTE PROGRAMMING modeof the pro-
grammer.
The option byteis locatedina non-user map. No
address hastobe specified.
EPROM Code Option Byte

Bit7. Reserved.
Bit6= NMI PULL.. Thisbit mustbe set highto re-
move the NMI pin pullup resistor whenitis low,a
pullupis provided.
Bit5= PROTECT. Thisbit allows the protectionof
the software contents against piracy. When thebit
PROTECTis set high, readoutof the OTP con-
tentsis prevented by hardware. No programming
equipmentis ableto gain accessto the user pro-
gram. When thisbitis low, the user program can read.
Bit4. Reserved.
Bit3= WDACT. Thisbit controls the watchdog ac-
tivation. Whenitis high, hardware activationis se-
lected. The software activationis selected when
WDACTis low.
Bit2= Reserved.Mustbe setto1.
Bit 1-0= Reserved.
The Option byteis written during programming ei-
ther by using the PC menu (PC driven Mode)or
automatically (stand-alone mode)
1.4.2 Program Memory

EPROM/OTP programming modeis set bya
+12.5V voltage appliedto the TEST/VPP pin. The
programming flowof the ST62T46B/E46Bis de-
scribedin the User Manualof the EPROM Pro-
gramming Board.
The MCUs can be programmed with theST62E4xB EPROM programming tools available
from STMicroelectronics.
1.4.3 EEPROM Data Memory

EEPROM data pages are suppliedin the virgin
state FFh. Partialor total programmingof EEP-
ROM data memory can be performed either
through the application software,or throughan ex-
ternal programmer. Any STMicroelectronics tool
used for the program memory (OTP/EPROM) can
alsobe usedto program the EEPROM data mem-
ory.
1.4.4 EPROM Erasing

The EPROMof the windowed packageof the
MCUs may be erasedby exposureto Ultra Violet
light. The erasure characteristicof the MCUsis
such that erasure begins when the memoryis ex-
posedto light witha wave lengths shorter than ap-
proximately 4000Å.It should be noted that sun-
lights and some typesof fluorescent lamps have
wavelengthsin the range 3000-4000Å.is thus recommended that the windowof the
MCUs packagesbe coveredbyan opaque labelto
prevent unintentional erasure problems when test-
ing the applicationin such an environment.
The recommended erasure procedure of the
MCUs EPROMis the exposureto short wave ul-
traviolet light which havea wave-length 2537A.
The integrated dose (i.e. U.V. intensityx exposure
time) for erasure should bea minimumof 15W-
sec/cm2. The erasure time with this dosageis ap-
proximately 15to 20 minutes using an ultraviolet
lamp with 12000μW/cm2 power rating. The
ST62E46B should be placed within 2.5cm (1Inch) the lamp tubes during erasure. NMI
PULL
PRO-
TECT - WDACT - - -
16/72
ST62T46B/E46B CENTRAL PROCESSING UNIT
2.1 INTRODUCTION

The CPU Coreof ST6 devicesis independent ofthe
I/Oor Memory configuration. As such,it may be
thoughtof 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
shownin Figure6; the controller being externally
linkedto both the Reset and Oscillator circuits,
while the coreis linkedto the dedicated on-chip pe-
ripherals via the serial data bus and indirectly, for
interrupt purposes, through the control registers.
2.2 CPU REGISTERS

The ST6 Family CPU core featuressixregistersand
three pairsof flags availableto the programmer.
These are describedin the following paragraphs.
Accumulator (A).
The accumulatoris an 8-bit
general purpose register usedinall arithmetic cal-
culations, logical operations, and data manipula-
tions. The accumulator can be addressedin Data
spaceasa RAM locationat address FFh. Thus the
ST6 can manipulate the accumulator just like any
other registerin Data space.
Indirect Registers (X, Y).These
two indirect reg-
isters are usedas pointersto memory locationsin
Data space. They are usedin the register-indirect
addressing mode. These registers can be ad-
dressedin the data spaceas RAM locationsat ad-
dresses 80h (X) and 81h (Y). They can alsobe ac-
cessed with the direct, short direct,orbit direct ad-
dressing modes. Accordingly, the ST6 instruction
set can use the indirect registersas any other reg-
isterof the data space.
Short Direct Registers (V, W).These
two regis-
ters are usedto savea bytein short direct ad-
dressing mode. They can be addressedin Data
spaceas RAM locationsat addresses 82h (V) and
83h (W). They can alsobe accessed using the di-
rect and bit direct addressing modes. Thus, the
ST6 instruction set can use the short direct regis-
tersas any other registerof the data space.
Program Counter (PC). The program counterisa
12-bit register which contains the addressof the
next ROM locationto be processed by the core.
This ROM location may be an opcode, an oper-
and, or the addressof an operand. The 12-bit
length allows the direct addressingof 4096 bytes Program space.
Figure6. ST6 Core Block Diagram

PROGRAM
RESET
OPCODE
FLAG
VALUES
CONTROLLER
FLAGS
ALU
A-DATA B-DATA
ADDRESS/READ LINE
DATA SPACE
INTERRUPTS
DATA
RAM/EEPROM
DATA
ROM/EPROM
RESULTSTO DATASPACE (WRITELINE)
ROM/EPROM
DEDICATIONS
ACCUMULATOR
CONTROL
SIGNALS
OSCin OSCout
ADDRESS
DECODER
Program Counter
and LAYER STACK
0,01TO 8MHz
VR01811
17/72
ST62T46B/E46B
CPU REGISTERS
(Cont’d)
However,if the program space contains more than
4096 bytes, the additional memoryin program
space can be addressed by using the Program
Bank Switch register.
The PC valueis incremented after reading the ad-
dressof the current instruction. To execute relative
jumps, the PC and the offset are shifted through
the ALU, where they are added; the resultis then
shifted back into the PC. The program counter can changedin the following ways:JP (Jump) instruction PC=Jump address CALL instructionPC= Call address Relative Branch Instruction.PC= PC +/- offset Interrupt PC=Interrupt vector Reset PC= Reset vector RET& RETI instructions PC= Pop (stack) Normal instructionPC= PC+1
Flags (C,Z).
The ST6 CPU includes three pairsof
flags (Carry and Zero), each pair being associated
with oneof the three normal modesof operation:
Normal mode, Interrupt mode and Non Maskable
Interrupt mode. Each pair consistsofa CARRY
flag anda ZERO flag. One pair (CN, ZN)is used
during Normal operation, another pairis used dur-
ing Interrupt mode (CI, ZI), anda third pairis used the Non Maskable Interrupt mode (CNMI, ZN-
MI).
The ST6 CPU uses the pairof flags associated
with the current mode:as soonas an interrupt (or Non Maskable Interrupt)is generated, the ST6
CPU uses the Interrupt flags (resp. the NMI flags)
insteadof the Normal flags. When the RETI in-
structionis executed, the previously used setof
flagsis restored.It shouldbe noted that each flag
set can onlybe addressedinits own context (Non
Maskable Interrupt, Normal Interruptor Main rou-
tine). The flags are not cleared during context
switching and thus retain their status.
The Carry flagis set whena carryora borrow oc-
curs during arithmetic operations; otherwiseitis
cleared. The Carry flagis also setto the valueof
thebit testedinabit test instruction;it also partici-
patesin the rotate left instruction.
The Zero flagis setif the resultof the last arithme-
ticor logical operation was equalto zero; other-
wiseitis cleared.
Switching between the three setsof flagsis per-
formed automatically whenan NMI,an interruptor RETI instructions occurs. As the NMI modeis
automatically selected after the resetof the MCU,
the ST6 core usesat first the NMI flags.
Stack.
The ST6 CPU includesa true LIFO hard-
ware stack which eliminates the need fora stack
pointer. The stack consistsof six separate 12-bit
RAM locations that do not belong to the data
space RAM area. Whena subroutine call (or inter-
rupt request) occurs, the contentsof each level are
shifted into the next higher level, while the content the PCis shifted into the first level (the original
contentsof the sixth stack level are lost). Whena
subroutineor interrupt return occurs (RETor RETI
instructions), the first level registeris shifted back
into the PC and the valueof each levelis popped
back into the previous level. Since the accumula-
tor,in common withall other data space registers, not storedin this stack, managementof these
registers should be performed within the subrou-
tine. The stack will remaininits “deepest” position more than6 nested callsor interrupts are execut-
ed, and consequently the last return address will lost.It will also remaininits highest positionif
the stackis empty anda RETor RETIis executed. this case the next instruction willbe executed.
Figure7. ST6 CPU Programming Mode
l
SHORT
DIRECT
ADDRESSING
MODEV REGISTER
WREGISTER
PROGRAM COUNTER
SIX LEVELS
STACK REGISTERNORMAL FLAGS
INTERRUPT FLAGS
NMI FLAGS
INDEX
REGISTER
VA000423b11
ACCUMULATOR
YREG.POINTER
XREG.POINTER
18/72
ST62T46B/E46B CLOCKS, RESET, INTERRUPTS AND POWER SAVING MODES
3.1 CLOCK SYSTEM
3.1.1 Main Oscillator

The MCU featuresa Main Oscillator which canbe
drivenbyan external clock,or usedin conjunction
with an AT-cut parallel resonant crystalora suita-
ble ceramic resonator.
Figure8 illustrates various possible oscillator con-
figurations usingan external crystalor ceramic res-
onator, an external clock input.CL1an CL2 should
havea capacitancein the range12to22pF foran
oscillator frequencyin the 4-8 MHz range.
The internal MCU clock Frequency(FINT)is divid-by 13to drive the CPU core andby12to drive
the A/D converter and the watchdog timer, while
clock usedto drive on-chip peripherals depends the peripheral as shownin the clock circuit
block diagram.
Withan 8MHz oscillator frequency, the fastest ma-
chine cycleis therefore 1.625μs. machine cycleis the smallest unitof time needed execute any operation (for instance,to increment
the Program Counter). An instruction may require
two, four,or five machine cycles for execution.
Figure8. Oscillator Configurations
Figure9. Clock Circuit Block Diagram

OSCin OSCout
CL1n CL2
ST6xxx
CRYSTAL/RESONATOR CLOCK
OSCin OSCout
ST6xxx
EXTERNAL CLOCK
VA0016
VA0015A
MAIN
OSCILLATOR
Core:13
:12
Timer1&2
Watchdog
POR
fINT
ADC
OSCin
OSCout
fOSC
fINT
OSC32in
OSC32out
32kHz
OSCILLATOR
MUX LCD
CONTROLLER
DRIVER
EOCRbit5
(START/STOP)
19/72
ST62T46B/E46B
CLOCK SYSTEM
(Cont’d)
3.1.232 KHz STAND-BY OSCILLATOR
additional 32KHz stand-byon chip oscillatoral-
lowsto generate real time interrupts andto supply
the clockto the LCD driver with the main oscillator
stopped. This enables the MCUto perform real
time functions with the LCD display running while
keeping advantagesof low power consumption.
Figure 10 shows the 32KHz oscillator block dia-
gram. 32.768KHz quartz crystal mustbe connectedto
the OSC32in and OSC32out pinsto perform the
real time clock operation. Two external capacitors 15-22pF each mustbe connected between the
oscillator pins and ground. The 32KHz oscillatoris
managed by the dedicated status/control register
32OCR. long as the 32KHz stand-by oscillatoris ena-
bled, 32KHz internal clockis availableto drive
LCD controller driver. This clockis divideby214to
generate interrupt request every 500ms. The peri-
odic interrupt request serves as reference time-
base for real time functions.
Note:
When the 32KHz stand-by oscillator is
stopped (bit5 of the Status/Control register
cleared) the divider chainis supplied witha clock
signal synchronous with machine cycle(fINT /13),
this produces an interrupt request every 13x214
clock cycle (i.e. 26.624ms) with an 8MHz quartz
crystal.
32KHz Oscillator Register (32OCR)

Address: DBh- Read/Write
Bit7 =EOSCI. Enable Oscillator Interrupt. This bit,
when set, enables the 32KHz oscillator interrupt
request.
Bit6= OSCEOC. Oscillator Interrupt Flag. Thisbit
indicates when the 32KHz oscillator has measured 500ms elapsed time (providing a
32.768KHzquartz crystal is connected to the
32KHz oscillator dedicated pins). An interrupt re-
quest can be generatedin relationto the stateof
EOSCI bit. This bit must be cleared by the user
program before leaving the interrupt service rou-
tine.
Bit5= START/STOP.Oscillator Start/Stop bit.
This bit, when set, enables the 32KHz stand-by
oscillator and the free running divider chainis sup-
pliedby the 32KHz oscillator signal. When thisbit clearedto zero the divider chainis supplied with
fINT/13.
This registeris cleared during reset.
Note:
achieve minimum power consumptionin STOP
mode (no system clock), the stand-by oscillator
mustbe switchedoff (real time function not availa-
ble) by clearing the Start/Stop bitin the oscillator
status/control register.
Figure 10. 32KHz Oscillator Block Diagram

EOSCI OSCEOC S/S D4 D3 D2 D1 D0
OSC32KHz
EOSCI OSCEOC START
STOP XX XXX
INT
OSC32IN
OSC32OUT
2x15...22pF
32.768KHz
Crystal fINT/13
OSC32KHz MUX
DIV214
20/72
ST62T46B/E46B
3.2 RESETS

The MCU canbe resetin three ways:by the external Reset input being pulled low;by Power-on Reset;by the digital Watchdog peripheral timing out.
3.2.1 RESET Input

The RESET pin maybe connectedtoa deviceof
the application boardin orderto reset the MCUif
required. The RESET pin may be pulled lowin
RUN, WAITor STOP mode. This input can be
usedto reset the MCU internal state and ensurea
correct start-up procedure. The pinis active low
and featuresa Schmitt trigger input. The internal
Reset signalis generatedby addinga delayto the
external signal. Therefore even short pulses on
the RESET pin are acceptable, providedVDD has
completedits rising phase and that the oscillatoris
running correctly (normal RUNor WAIT modes).
The MCUis keptin the Reset stateas longas the
RESET pinis held low. RESET activation occursin the RUNor WAIT
modes, processingof the user programis stopped
(RUN mode only), the Inputs and Outputs are con-
figured as inputs with pull-up resistors and the
main Oscillatoris restarted. When the levelon the
RESET pin then goes high, the initialization se-
quenceis executed following expiryof the internal
delay period. RESET pin activation occursin the STOP mode,
the oscillator startsup andall Inputs and Outputs
are configured as inputs with pull-up resistors.
When the levelof the RESET pin then goes high,
the initialization sequenceis executed following
expiryof the internal delay period.
3.2.2 Power-on Reset

The functionof the POR circuit consistsin waking the MCUat an appropriate stage during the
power-on sequence.At the beginningof this se-
quence, the MCUis configuredin the Reset state:
all I/O ports are configured as inputs with pull-up
resistors andno instructionis executed. When the
power supply voltage risestoa sufficient level, the
oscillator startsto operate, whereupon an internal
delayis initiated,in orderto allow the oscillatorto
fully stabilize before executing the first instruction.
The initialization sequenceis executed immediate- following the internal delay.
The internal delayis generatedbyan on-chip coun-
ter. The internal reset lineis released 2048 internal
clock cycles after releaseof the external reset.
Notes:
ensure correct start-up, the user should take
care that the reset signalis not released before the
VDD levelis sufficientto allow MCU operationat
the chosen frequency (see Recommended Oper-
ating Conditions). proper reset signal fora slow risingVDD supply
can generally be providedby an external RC net-
work connectedto theRESET pin.
Figure 11.Reset and Interrupt Processing

INT LATCHCLEARED
NMIMASKSET
RESETIF PRESENT)
SELECT
NMI MODE FLAGS RESET STILL
PRESENT
YES
PUTFFEH ADDRESSBUS
FROM RESET LOCATIONS
FFE/FFF
FETCH INSTRUCTION
LOADPC
VA000427
21/72
ST62T46B/E46B
RESETS
(Cont’d)
3.2.3 Watchdog Reset

The MCU providesa Watchdog timer functionin
orderto ensure graceful recovery from software
upsets.If the Watchdog registeris not refreshed
before an end-of-count conditionis reached, the
internal reset willbe activated. This, amongst oth- 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 delay period.
3.2.4 Application Notes
external resistoris required betweenVDD and
the Reset pin, thanksto the built-in pull-up device.
The POR circuit operates dynamically,in thatit
triggers MCU initialization on detecting the rising
edgeof VDD. The typical thresholdisin the region2 volts, but the actual valueof the detected
threshold depends on the wayin whichVDD rises.
The POR circuitis NOT designedto supervise
static,or slowly risingor fallingVDD.
3.2.5 MCU Initialization Sequence

Whena reset occurs the stackis reset, the PCis
loaded with the addressof the Reset Vector (locat-in program ROM startingat address 0FFEh).A
jumpto the beginningof the user program mustbe
codedat this address. Followinga Reset, the In-
terrupt flagis automatically set,so that the CPUis Non Maskable Interrupt mode; this prevents the
initialisation routine from being interrupted. Thein-
itialisation routine should therefore be terminateda RETI instruction,in orderto revertto normal
mode and enable interrupts.Ifno pending interrupt presentat the endof the initialisation routine, the
MCU will continue by processing the instruction
immediately following the RETI instruction.If, how-
ever,a pending interruptis present,it willbe serv-
iced.
Figure 12.Reset and Interrupt Processing
Figure 13. Reset Block Diagram

RESET
RESET
VECTOR JP:2 BYTES/4CYCLES
RETI
RETI:1 BYTE/2 CYCLES
INITIALIZATION
ROUTINE
VA00181
VDD
RESET
300kΩ
2.8kΩ
POWER
WATCHDOG RESET
COUNTER
RESET
ST6
INTERNAL
RESET
fOSC
RESET RESET
VA0200B
22/72
ST62T46B/E46B
RESETS
(Cont’d)
Table5. Register Reset Status
Register Address(es) Status Comment

EEPROM Control Register
Port Data Registers
Port A,B Direction Register
Port A,B Option Register
Interrupt Option Register
SPI Registers
LCD Mode Control Register
32kHz Oscillator Register
0DFh
0C0h, 0C2h, 0C3h
0C4hto 0C5h
0CCh, 0CEh
0C8h
0C2hto 0DDh
0DCh
0DBh
00h
EEPROM enabled
I/O are Input with pull-up
Interrupt disabled
SPI disabled
LCD displayoff
Interrupt disabled
PortC Direction Register
PortC Option Register
0C6h
0CFh FFh LCD Output Y,V,W, Register
Accumulator
Data RAM
Data RAM Page REgister
Data ROM Window Register
EEPROM
A/D Result Register
080H TO083H
0FFh
084hto 0BFh
0CBh
0C9h
00hto 03Fh
0D0h
Undefined As writtenif programmed
TIMER1 Status/Control
TIMER1 Counter Register
TIMER1 Prescaler Register
TIMER2 Status/Control
TIMER2 Counter Register
TIMER2 Prescaler Register
Watchdog Counter Register
A/D Control Register
0D4h
0D3h
0D2h
0D7h
0D5h
0D6h
0D8h
0D1h
00h
FFh
7Fh
00h
FFh
7Fh
FEh
40h
TIMER1 disabled/Max count loaded
TIMER2 disabled/Max count loaded
A/Din Standby
23/72
ST62T46B/E46B
3.3 DIGITAL WATCHDOG

The digital Watchdog consistsofa reloadable
downcounter timer which canbe usedto provide
controlled recovery from software upsets.
The Watchdog circuit generatesa Reset when the
downcounter reaches zero. User software can
prevent this reset by reloading the counter, and
should therefore be written so that the counteris
regularly reloaded while the user program runs
correctly.In the eventofa software mishap (usual- caused by externally generated interference),
the user program willno longer behaveinits usual
fashion and the timer register will thus notbe re-
loaded periodically. Consequently the timer will
decrement downto 00h and reset the MCU.In or-
derto maximise the effectivenessof the Watchdog
function, user software must be written with this
conceptin mind.
Watchdog behaviouris governed by one option,
known as “WATCHDOG ACTIVATION” (i.e.
HARDWAREor SOFTWARE) (SeeTable6). the SOFTWARE option, the Watchdogis disa-
bled untilbitCof the DWDR register has been set.
When the Watchdogis disabled, low power Stop
modeis available. Once activated, the Watchdog
cannotbe disabled, exceptby resetting the MCU. the HARDWARE option, the Watchdogis per-
manently enabled. Since the oscillator will run con-
tinuously, low power modeis not available. The
STOP instructionis interpretedasa WAIT instruc-
tion, and the Watchdog continuesto countdown.
When the MCU exits STOP mode (i.e. whenanin-
terruptis generated), the Watchdog resumesits
activity.
Table6. Recommended Option Choices
Functions Required Recommended Options

Stop Mode “SOFTWARE WATCHDOG”
Watchdog “HARDWARE WATCHDOG”
24/72
ST62T46B/E46B
DIGITAL WATCHDOG(Cont’d)

The Watchdogis associated witha Data space
register (Digital WatchDog Register, DWDR, loca-
tion 0D8h) whichis describedin greater detailin
Section 3.3.1 Digital Watchdog Register (DWDR).
This registeris set to 0FEh on Reset: bitCis
clearedto “0”, which disables the Watchdog; the
timer downcounter bits, T0to T5, and the SR bit
areall setto “1”, thus selecting the longest Watch-
dog timer period. This time period canbe setto the
user’s requirements by setting the appropriate val- for bits T0to T5in the DWDR register. The SR
bit mustbe setto “1”, sinceitis thisbit which gen-
erates the Reset signal whenit changesto “0”;
clearing thisbit would generate an immediate Re-
set. should be noted that the orderof the bitsin the
DWDR registeris inverted with respectto the as-
sociated bitsin the down counter: bit7of the
DWDR register corresponds,in fact,to T0 andbitto T5. The user should bearin mind the fact that
these bits are inverted and shifted with respectto
the physical counter bits when writingto this regis-
ter. The relationship between the DWDR register
bits and the physical implementationof the Watch-
dog timer downcounteris illustrated inFigure 14.
Only the6 most significant bits maybe usedto de-
fine the time period, sinceitisbit6 which triggers
the Reset whenit changesto “0”. This offers the
usera choiceof 64 timed periods ranging from
3,072to 196,608 clock cycles (with an oscillator
frequencyof 8MHz, thisis equivalentto timer peri-
ods ranging from 384μsto 24.576ms).
Figure 14.Watchdog Counter Control

CHD
NTRO
CHDO
UNTE
OSC ÷12
RESET
VR02068A8
25/72
ST62T46B/E46B
DIGITAL WATCHDOG(Cont’d)
3.3.1 Digital Watchdog Register (DWDR)

Address: 0D8h — Read/Write
Reset status: 1111 1110b
Bit0=C: Watchdog Controlbit the hardware optionis selected, thisbitis forced
high and the user cannot changeit (the Watchdog always active). When the software optionis se-
lected, the Watchdog functionis activatedby set-
tingbitCto1, and cannot thenbe disabled (save resetting the MCU).
WhenCis kept low the counter can be usedasa
7-bit timer.
Thisbitis clearedto “0”on Reset.
Bit1= SR: Software Resetbit
Thisbit triggersa Reset when cleared.
WhenC= “0” (Watchdog disabled)itis the MSBof
the 7-bit timer.
Thisbitis setto “1”on Reset.
Bits 2-7 =T5-T0: Downcounter bits should be noted that the register bits are re-
versed and shifted with respectto the physical
counter: bit-7 (T0)is the LSBof the Watchdog
downcounter and bit-2 (T5)is the MSB.
These bits are setto “1”on Reset.
3.3.2 Application Notes

The Watchdog playsan important supporting role the high noise immunityof ST62xx devices, and
should be used wherever possible. Watchdog re-
lated options shouldbe selectedon the basisofa
trade-off between application security and STOP
mode availability.
When STOP modeis not required, hardware acti-
vation should be preferred, asit provides maxi-
mum security, especially during power-on.
When software activationis selected and the
Watchdogis not activated, the downcounter may usedasa simple 7-bit timer (remember that the
bits arein reverse order).
The software activation option should be chosen
only when the Watchdog counteristo be usedas timer. To ensure the Watchdog has not been un-
expectedly activated, the following instructions
shouldbe executed within the first27 instructions:
jrr 0, WD, #+3
ldi WD, 0FDH T1 T2 T3 T4 T5 SR C
26/72
ST62T46B/E46B
DIGITAL WATCHDOG(Cont’d)

These instructions test theC bit and Reset the
MCU (i.e. disable the Watchdog)if the bitis set
(i.e.if the Watchdogis active), thus disabling the
Watchdog.all modes,a minimumof28 instructions are ex-
ecuted after activation, before the Watchdog can
generatea Reset. Consequently, user software
should load the watchdog counter within the first instructions following Watchdog activation
(software mode),or within the first 27 instructions
executed followinga Reset (hardware activation). shouldbe noted that when the GENbitis low (in-
terrupts disabled), the NMI interruptis active but
cannot causea wakeup from STOP/WAIT modes.
Figure 15. Digital Watchdog Block Diagram

RSFF
DATA BUS
VA00010 -12
OSCILLATOR
RESET
WRITE
RESET
DB0S
DB1.7 SETLOAD 8-2
SET
CLOCK
27/72
ST62T46B/E46B
3.4 INTERRUPTS

The CPU can manage four Maskable Interrupt
sources,in additiontoa Non Maskable Interrupt
source (top priority interrupt). Each sourceis asso-
ciated witha specific Interrupt Vector which con-
tainsa Jump instructionto the associated interrupt
service routine. These vectors are locatedin Pro-
gram space (seeTable7).
When an interrupt source generates an interrupt
request, and interrupt processingis enabled, the registeris loaded with the addressof the inter-
rupt vector (i.e.of the Jump instruction), which
then causesa Jumpto the relevant interrupt serv-
ice routine, thus servicing the interrupt.
Interrupt sources are linkedto events eitheron ex-
ternal pins,or on chip peripherals. Several events
can be ORed on the same interrupt source, and
relevant flags are available to determine which
event triggered the interrupt.
The Non Maskable Interrupt request has the high-
est priority and can interrupt any interrupt routine any time; the other four interrupts cannot inter-
rupt each other.If more than one interrupt request pending, these are processedby the processor
core accordingto their priority level: source#1 has
the higher priority while source#4 the lower. The
priorityof each interrupt sourceis fixed.
Table7. Interrupt Vector Map
3.4.1 Interrupt request

All interrupt sources but the Non Maskable Inter-
rupt source canbe disabledby setting accordingly
the GENbitof the Interrupt Option Register (IOR).
This GENbit also definesifan interrupt source,in-
cluding the Non Maskable Interrupt source, can re-
start the MCU from STOP/WAIT modes.
Interrupt request from the Non Maskable Interrupt
source#0is latchedbya flip flop whichis automat-
ically resetby the coreat the beginningof the non-
maskable interrupt service routine.
Interrupt request from source #1 can be configu-
red eitheras edgeor level sensitiveby setting ac-
cordingly the LESbitof the Interrupt Option Regis-
ter (IOR).
Interrupt request from source #2 are always edge
sensitive. The edge polarity can be configured by
setting accordingly the ESBbitof the Interrupt Op-
tion Register (IOR).
Interrupt request from sources #3& #4 are level
sensitive. edge sensitive mode,a latchis set whena edge
occurs on the interrupt source line andis cleared
when the associated interrupt routineis started.
So, the occurrenceof an interrupt can be stored,
until completionof the running interrupt routine be-
fore being processed.If several interrupt requests
occurs before completionof the running interrupt
routine, only the first requestis stored.
Storageof interrupt requestsis not availablein lev- sensitive mode. To be taken into account, the
low level mustbe presenton the interrupt pin when
the MCU samples the line after instruction execu-
tion. the endof every instruction, the MCU tests the
interrupt lines:if thereis an interrupt request the
next instructionis not executed and the appropri-
ate interrupt service routineis executed instead.
Table8. Interrupt Option Register Description
Interrupt Source Priority Vector Address

Interrupt source#0 1 (FFCh-FFDh)
Interrupt source#1 2 (FF6h-FF7h)
Interrupt source#2 3 (FF4h-FF5h)
Interrupt source#3 4 (FF2h-FF3h)
Interrupt source#4 5 (FF0h-FF1h)
GEN SET Enableall interrupts
CLEARED Disableall interrupts
ESB
SET Rising edge modeon inter-
rupt source#2
CLEARED Falling edge modeon inter-
rupt source#2
LES
SET Level-sensitive modeonin-
terrupt source#1
CLEARED Falling edge modeon inter-
rupt source#1
OTHERS NOT USED
28/72
ST62T46B/E46B
INTERRUPTS
(Cont’d)
3.4.2 Interrupt Procedure

The interrupt procedureis very similartoa call pro-
cedure, indeed the user can consider the interrupt an asynchronous call procedure. As thisisan
asynchronous event, the user cannot know the
context and the timeat whichit occurred. Asa re-
sult, the user should saveall Data space registers
which may be used within the interrupt routines.
There are separate setsof processor flagsfor nor-
mal, interrupt and non-maskable interrupt modes,
which are automatically switched and so do not
needto be saved.
The following list summarizes the interrupt proce-
dure:
MCU
The interruptis detected. TheC andZ flags are replacedby the interrupt
flags (orby the NMI flags). The PC contents are storedin the first levelof
the stack. The normal interrupt lines are inhibited (NMI still
active). The first internal latchis cleared.
–The associatedinterrupt vectoris loaded inthePC.
WARNING:
In some circumstances, whena
maskable interrupt occurs while the ST6 coreisin
NORMAL mode and especially during the execu-
tionof an ”ldi IOR, 00h” instruction (disabling all
maskable interrupts):if the interrupt arrives during
the first3 cyclesof the ”ldi” instruction (whichisa
4-cycle instruction) the core will switchto interrupt
mode BUT the flags CN and ZN will NOT switchto
the interrupt pairCI and ZI.
User
User selected registers are saved within thein-
terrupt service routine (normally ona software
stack). The sourceof the interruptis foundby polling the
interrupt flags(if more than one sourceis associ-
ated with the same vector). The interruptis serviced. Return from interrupt (RETI)
MCU
Automatically the MCU switches backto the nor-
mal flag set (or the interrupt flag set) and pops
the previous PC value from the stack.
The interrupt routine usually beginsby the identify-
ing the device which generated the interrupt re-
quest (by polling). The user should save the regis-
ters which are used within the interrupt routineina
software stack. After the RETI instructionis exe-
cuted, the MCU returnsto the main routine.
Figure 16.Interrupt Processing Flow Chart

INSTRUCTION
FETCH
INSTRUCTION
EXECUTE
INSTRUCTION
WAS
THEINSTRUCTION
ARETI
CLEAR
INTERRUPTMASK
SELECT
PROGRAM FLAGS
”POP”
THE STACKEDPC
CHECKIFTHEREIS INTERRUPTREQUEST
AND INTERRUPTMASK
SELECT
INTERNAL MODE FLAG
PUSHTHEINTOTHE STACK
LOADPC FROM
INTERRUPTVECTOR
(FFC/FFD)
SET
INTERRUPTMASK
YES ISTHE CORE
ALREADYIN
NORMALMODE
VA000014
YES
YES
29/72
ST62T46B/E46B
INTERRUPTS
(Cont’d)
3.4.3 Interrupt Option Register (IOR)

The Interrupt Option Register (IOR)is usedto en-
able/disable the individual interrupt sources andto
select the operating modeof the external interrupt
inputs. This registeris write-only and cannot be
accessedby single-bit operations.
Address: 0C8h — Write Only
Reset status: 00h
Bit7, Bits 3-0= Unused.
Bit6= LES: Level/Edge Selectionbit.
When thisbitis setto one, the interrupt source#1 level sensitive. When clearedto zero the edge
sensitive mode for interrupt requestis selected.
Bit5= ESB: Edge Selectionbit.
The bit ESB selects the polarityof the interrupt
source #2.
Bit4 =GEN: Global Enable Interrupt. When thisbit setto one,all interrupts are enabled. When this
bitis clearedto zeroall the interrupts (excluding
NMI) are disabled.
When the GENbitis low, the NMI interruptis ac-
tive but cannot causea wakeup from STOP/WAIT
modes.
This registeris clearedon reset.
3.4.4 Interrupt Sources

Interrupt sources available on the
ST62E46B/T40B are summarizedin theTable9
with associated maskbitto enable/disable thein-
terrupt request.
Table9. Interrupt Requests and Mask Bits
LES ESB GEN - - - -
Peripheral Register Address
Register Maskbit Masked Interrupt Source Interrupt
source

GENERAL IOR C8h GEN All Interrupts, excluding NMI All
TIMER1
TIMER2
TSCR1
TSCR2
D4h
D7h ETI TMZ: TIMER Overflow source3
A/D CONVERTER ADCR D1h EAI EOC: Endof Conversion source4
SPI SPI C2h ALL Endof Transmission source1
Port PAn ORPA-DRPA C0h-C4h ORPAn-DRPAn PAnpin source2
Port PBn ORPB-DRPB C1h-C5h ORPBn-DRPBn PBnpin source2
Port PCn ORPC-DRPC C6h-CFh ORPCn-DRPCn PCn pin source2
PSS PSSCR DAh PEI PIF: source0
32kHz OSC 32OCR DBh EOSCI OSCEOC source3
30/72
ST62T46B/E46B
INTERRUPTS
(Cont’d)
Figure 17. Interrupt Block Diagram

PORTA
PBEDD
FROM REGISTER PORT A,B,C
SINGLEBIT ENABLE
CLK Q
CLR Start
INT#0 NMI (FFC,D))
INT#2 (FF4,5)
NMI
PORTB
Bits
SPI
CLK Q
CLR
MUX Start
IORbit6 (LES)
PBE FF
CLK Q
CLR
IORbit5 (ESB) Start
INT#1 (FF6,7)
INT#3 (FF2,3)
INT#4 (FF0,1)
IORbit 4(GEN)
PORTC
TMZ
ETI
TMZ
ETI
OSCEOC
EOSCI
EAI
EOC
RESTART
STOP/WAIT
FROM
PBE
PIF
PEI
TIMER1
TIMER2
OSC32kHz
A/D CONVERTER
PSS
31/72
ST62T46B/E46B
3.5 POWER SAVING MODES

The WAIT and STOP modes have been imple-
mentedin the ST62xx familyof MCUsin ordertoreduce the product’s electrical consumption during
idle periods. These two power saving modes are
describedin the following paragraphs.
3.5.1 WAIT Mode

The MCU goes into WAIT mode as soon as the
WAIT instructionis executed. The microcontroller
canbe consideredas beingina “software frozen”
state where the core stops processing the pro-
gram instructions, the RAM contents and peripher- registers are preserved as long as the powersupply voltageis higher than the RAM retention
voltage.In this mode the peripherals are still ac-
tive.
WAIT mode can be used when the user wantsto
reduce the MCU power consumption during idle
periods, while not losing trackof timeor the capa-
bilityof monitoring external events. The active os-
cillatoris not stoppedin orderto providea clock
signalto the peripherals. Timer counting may be
enabledas wellas the Timer interrupt, before en-
tering the WAIT mode: this allows the WAIT mode be exited whena Timer interrupt occurs. The
same appliesto other peripherals which use the
clock signal. the WAIT modeis exited duetoa Reset (either activating the external pinor generated by theWatchdog), the MCU entersa normal reset proce-
dure.If an interruptis generated during WAIT
mode, the MCU’s behaviour dependson the state the processor core priorto the WAIT instruction,
but also on the kindof interrupt request whichisgenerated. Thisis describedin the following para-
graphs. The processor core does not generatea
delay following the occurrenceof the interrupt, be-cause the oscillator clockis still available and no
stabilisation periodis necessary.
3.5.2 STOP Mode
the Watchdogis disabled, STOP modeis availa-
ble. Whenin STOP mode, the MCUis placedin
the lowest power consumption mode.In this oper-
ating mode, the microcontroller canbe consideredas being “frozen”, no instructionis executed, the
oscillatoris stopped, the RAM contents and pe-
ripheral registers are preserved as long as the
power supply voltageis higher than the RAM re-
tention voltage, and the ST62xx core waits for the
occurrenceof an external interrupt requestora
Resetto exit the STOP state. the STOP stateis exited duetoa Reset (by acti-
vating the external pin) the MCU will entera nor-
mal reset procedure. Behaviourin responseto in-
terrupts depends on the stateof the processor
core priorto issuing the STOP instruction, and
also on the kindof interrupt request thatis gener-
ated.
This case willbe describedin the following para-
graphs. The processor core generatesa delayaf-ter occurrenceof the interrupt request,in orderto
wait for complete stabilisationof the oscillator, be-
fore executing the first instruction.
32/72
ST62T46B/E46B
POWER SAVING MODE(Cont’d)
3.5.3 Exit from WAIT and STOP Modes

The following paragraphs describe how the MCU
exits from WAIT and STOP modes, whenan inter-
rupt occurs (nota Reset).It should be noted that
the restart sequence depends on the original state the MCU (normal, interruptor non-maskable in-
terrupt mode) prior to entering WAIT or STOP
mode,as wellason the interrupt type.
Interruptsdo not affect the oscillator selection.
3.5.3.1 Normal Mode
the MCU wasin the main routine when the WAIT STOP instruction was executed, exit from Stop Wait mode will occuras soonasan interrupt oc-
curs; the related interrupt routineis executed and, completion, the instruction which follows the
STOPor WAIT instructionis then executed, pro-
vidingno other interrupts are pending.
3.5.3.2 Non Maskable Interrupt Mode
the STOPor WAIT instruction has been execut- during executionof the non-maskable interrupt
routine, the MCU exits from the Stopor Wait mode soon as an interrupt occurs: the instruction
which follows the STOPor WAIT instructionis ex-
ecuted, and the MCU remainsin non-maskablein-
terrupt mode, evenif another interrupt has been
generated.
3.5.3.3 Normal Interrupt Mode
the MCU wasin interrupt mode before the STOP WAIT instruction was executed,it exits from
STOPor WAIT modeas soon asan interrupt oc-
curs. Nevertheless, two cases must be consid-
ered:If the interruptisa normal one, the interrupt rou-
tinein which the WAITor STOP mode was en-
tered will be completed, starting with the
executionof the instruction which follows the
STOPor the WAIT instruction, and the MCUis
stillin the interrupt mode.At the endof this rou-
tine pending interrupts willbe servicedin accord-
ance with their priority.In the eventofa non-maskable interrupt, the
non-maskable interrupt service routineis proc-
essed first, then the routinein which the WAITor
STOP mode was entered will be completed by
executing the instruction following the STOPor
WAIT instruction. The MCU remainsin normal
interrupt mode.
Notes:
achieve the lowest power consumption during
RUNor WAIT modes, the user program must take
careof: configuring unused I/Osas inputs without pull-up
(these should be externally tiedto well defined
logic levels); placing all peripherals in their power down
modes before entering STOP mode;
When the hardware activated Watchdogis select-
ed,or when the software Watchdogis enabled, the
STOP instructionis disabled anda WAIT instruc-
tion willbe executedinits place.all interrupt sources are disabled (GEN low), the
MCU can only be restarted bya Reset. Although
setting GEN low does not mask the NMIasanin-
terrupt,it will stopit generatinga wake-up signal.
The WAIT and STOP instructions are not execut-ifan enabled interrupt requestis pending.
33/72
ST62T46B/E46B ON-CHIP PERIPHERALS
4.1 I/O PORTS

The MCU features Input/Output lines which may individually programmedas anyof the following
inputor output configurations: Input without pull-upor interrupt Input with pull-up and interrupt Input with pull-up, but without interrupt Analog input Push-pull output Open drain output
The lines are organisedas bytewise Ports.
Each portis associated with3 registersin Data
space. Each bitof these registersis associated
witha particular line (for instance, bits0of PortA
Data, Direction and Option registers are associat- with the PA0 lineof Port A).
The DATA registers (DRx), are usedto read the
voltage level valuesof the lines which have been
configured as inputs,orto write the logic valueof
the signaltobe output on the lines configured as
outputs. The port data registers canbe readto get
the effective logic levelsof the pins, but they can also written by user software,in conjunction
with the related option registers,to select the dif-
ferent input mode options.
Single-bit operations on I/O registers are possible
but careis necessary because readingin input
modeis done from I/O pins while writing will direct- affect the Port data register causing an unde-
sired changeof the input configuration.
The Data Direction registers (DDRx) allow the
data direction (inputor output)of each pinto be
set.
The Option registers (ORx) are usedto select the
different port options available bothin input andin
output mode.
All I/O registers can be reador writtento justas
any other RAM locationin Data space,so no extra
RAM cells are needed for port data storage and
manipulation. During MCU initialization,all I/O reg-
isters are cleared and the input mode with pull-ups
and no interrupt generationis selected forall the
pins, thus avoiding pin conflicts.
Figure 18. I/O Port Block Diagram

VDDRESETSIN CONTROLS
SOUT
SHIFT
REGISTER
DATA
DATA
DIRECTION
REGISTER
REGISTER
OPTION
REGISTER
INPUT/OUTPUT INTERRUPT
VDD ADC VA00413
34/72
ST62T46B/E46B
I/O PORTS
(Cont’d)
4.1.1 Operating Modes

Each pin maybe individually programmedas input output with various configurations.
Thisis achievedby writing the relevant bitin the
Data (DR), Data Direction (DDR) and Option reg-
isters (OR). Table 10 illustrates the various port
configurations which canbe selectedby user soft-
ware.
4.1.1.1 Input Options

Pull-up, High Impedance Option. All input lines
canbe individually programmed withor withoutan
internal pull-up by programming the OR and DR
registers accordingly.If the pull-up optionis not
selected, the input pin will bein the high-imped-
ance state.
4.1.1.2 Interrupt Options

All input lines can be individually connected by
softwareto the interrupt system by programming
the OR and DR registers accordingly. The inter-
rupt trigger modes (falling edge, rising edge and
low level) can be configured by software as de-
scribedin the Interrupt Chapter for each port.
4.1.1.3 Analog Input Options

Some pins can be configuredas analog inputsby
programming the OR and DR registers according-
ly. These analog inputs are connectedto the on-
chip 8-bit Analogto Digital Converter.ONLY ONE
pin should be programmed as an analog inputat
any time, since by selecting more than one input
simultaneously their pins will be effectively short-
ed.
Table 10. I/O Port Option Selection
Note:
X= Don’t care
DDR OR DR Mode Option
0 0 Input With pull-up,no interrupt 0 1 Input No pull-up,no interrupt 1 0 Input With pull-up and with interrupt 1 1 Input Analog input (when available) 0 X Output Open-drain output (20mA sink when available) 1 X Output Push-pull output (20mA sink when available)
35/72
ST62T46B/E46B
I/O PORTS
(Cont’d)
4.1.2 Safe I/O State Switching Sequence

Switching the I/O ports from one stateto another
should be doneina sequence which ensures that unwanted side effects can occur. The recom-
mended safe transitions are illustratedin Figure
19. All other transitions are potentially risky and
should be avoided when changing the I/O operat-
ing mode,asitis most likely that undesirable side-
effects willbe experienced, suchas spurious inter-
rupt generationor two pins shorted togetherby the
analog multiplexer.
Single bit instructions (SET, RES, INC and DEC)
should be used with great caution on Ports Data
registers, since these instructions makean implicit
read and write backof the entire register.In port
input mode, however, the data register reads from
the input pins directly, and not from the data regis-
ter latches. Since data register informationin input
modeis usedto set the characteristicsof the input
pin (interrupt, pull-up, analog input), these may be
unintentionally reprogrammed depending on the
stateof the input pins.Asa general rule,itis better limit the useof single bit instructions on data
registersto when the whole (8-bit) portisin output
mode.In the caseof inputsorof mixed inputs and
outputs,itis advisableto keepa copyof the data
registerin RAM. Single bit instructions may then used on the RAM copy, after which the whole
copy register canbe writtento the port data regis-
ter:
SET bit, datacopy a, datacopy DRA,a
Warning:
Care must also be takento not use in-
structions that act ona whole port register (INC,
DEC,or read operations) whenall8 bits are not
available on the device. Unavailable bits must be
maskedby software (AND instruction).
The WAIT and STOP instructions allow the
ST62xxtobe usedin situations where low power
consumptionis needed. The lowest power con-
sumptionis achievedby configuring I/Osin input
mode with well-defined logic levels.
The user must take care notto switch outputs with
heavy loads during the conversionof oneof the
analog inputsin orderto avoid any disturbanceto
the conversion.
Figure 19. Diagram showing Safe I/O State Transitions
Note*.
xxx= DDR, OR, DR Bits respectively
Interrupt
pull-up
Output
Open Drain
Output
Push-pull
Input
pull-up (Reset
state)
Input
Analog
Output
Open Drain
Output
Push-pull
Input
010*
111
36/72
ST62T46B/E46B
I/O PORTS
(Cont’d)
Table 11. I/O Port configuration for the ST62T46B/E46B
Note1.
Providedthe correct configurationhas been selected.
MODE AVAILABLE ON(1) SCHEMATIC

Input
PA4-PA7
PB0-PB7
PC0-PC7
Input
with pullup
(Reset state exceptfor
PC0-PC7)
PA4-PA7
PB0-PB7
PC0-PC7
Input
with pullup
with interrupt
PA4-PA7
PB0-PB7
PC0-PC7
Analog Input PA4-PA7
PB0-PB3
Open drain output
5mA
Open drain output
20mA
PA4-PA7
PB0-PB7
PC0-PC7 (1mA)
PB4-PB7
Push-pull output
5mA
Push-pull output
20mA
PA4-PA7
PB0-PB7
PC0-PC7 (1mA)
PB4-PB7
Datain
Interrupt
Datain
Interrupt
Datain
Interrupt
Data out
ADC
Data out
ic,good price


TEL:86-533-2716050      FAX:86-533-2716790
   

©2020 IC PHOENIX CO.,LIMITED