The ST62T80B and ST62E80B devices are low
cost members of the ST62xx 8-bit HCMOS family
of microcontrollers, which is targetedat low to medium complexity applications. All ST62xx devices
are based on a building block approach: a com-
mon core is surrounded by a number of on-chip
peripherals.
The ST62E80B is the erasable EPROM version of
the ST62T80B device, which may be used to emulate the ST62T80B device, as well as the respective ST6280B ROM devices.
PA2..PA3 / 20mA Sink
PORT A
PORT B
ARTIMER
UART
PORT C
LCD DRIVER
OSC 32kHz
TIMER
DIGITAL
WATCHDOG
SPI (SERIAL
PERIPHERAL
INTERFACE)
PA4 / TIMER / 20mA Sink
PA5 / Scl / 20mA Sink
PA6 / Sin / 20mA Sink
PA7 / Sout / 20mA Sink
PB0 / RXD / Ain
PB1 / TXD / Ain
PB2..PB5 / Ain
PB6 / ARTIMin/ Ain
PB7 / ARTIMout / Ain
PC0..PC3/ 20mA Sink
PC4..PC7/ Ain
COM1..COM8
S9..S56
COM9..COM16 / S1..S8
VLCD
VLCD1/5
VLCD2/5
VLCD3/5
VLCD4/5
OSC32in
OSC32out
V
DDVSS
(V
on EPROM/OTP versions only)
PP
OSCin OSCoutRESET
VA0479
5/78
5
ST62T80B/E80B
INTRODUCTION (Cont’d)
OTP and EPROM devices are functionally identical. The ROM based versions offer the same functionality selecting as ROM options the options defined in the programmable option byte of the
OTP/EPROM versions.OTP devices offer all the
advantages of user programmability at low cost,
which make them the ideal choice in a wide range
of applications where frequent code changes, multiple code versions or last minute programmability
are required.
These compact low-cost devices feature one Timer comprising an 8-bit counter and a 7-bit programmable prescaler, one 8-bit autoreload timer
with 7-bit programmable prescaler (ARTimer),
EEPROM data capability, a serial synchronous
port interface (SPI), an 8-bit A/D Converterwith 12
analog inputs, a Digital Watchdog timer, and a
complete LCD controller driver, making them well
suited for a wide range of automotive, appliance
and industrial applications.
these two pins. VDDis the power connection and
VSSis the ground connection.
OSCin and OSCout. These pins are internally
connected tothe 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 restart the microcontroller.
TEST/VPP. The TEST must be held at VSSfor nor-
mal operation. If TEST pin is connected to a
+12.5V level during the reset phase, the
EPROM/OTP programming Mode is entered.
NMI. TheNMI pin provides the capability for asynchronous interruption, byapplying an external non
maskable interrupt to the MCU. The NMI input is
falling edge sensitive with Schmitt trigger characteristics. The user can select as option the availability of an on-chip pull-up at this pin.
PA2-PA7. These 6 lines are organised as one I/O
port (A). Each line may be configured under software controlas inputs with or without internal pullup resistors, interrupt generating inputs with pullup resistors, open-drain or push-pull outputs,
PA5/SCL, PA6/Sin and PA7/Sout can be used respectively as data clock, data in and clock pins for
the on-chip SPI, while PA4/TIMER can be used as
Timer I/O. In addition, PA2-PA7 can sink20mA for
direct LED or TRIAC drive.
PB0...PB7. These 8 lines are organised asone I/O
port (B). Each line may be configured under software controlas inputs with or without internal pullup resistors, interrupt generating inputs with pullup resistors, open-drain or push-pull outputs, analog inputs for the A/D converter. PB6/ARTIMin
and PB7/ARTIMout are either Port B I/O bitsor the
input and output of the ARTimer. PB0 (resp. PB1)
can also be usedas reception (resp. transmission)
line for the embedded UART.
PC0-PC7. These 8 lines are organised as one I/O
port (C). Each line may be configured under software control as input with or without internal pullup resistor, interrupt generating input with pull-up
resistor, open-drain or push-pull output, or analog
imputs for the A/D Converter. PC0-PC3 can sink
20mA for direct LED or TRIAC drive, while PC4PC7 can be used as analog inputs for the A/D
Converter.
COM1-COM8. These eight pins are the LCD peripheral common outputs. They are the outputs of
the on-chip backplane voltage generator which is
used for multiplexing the LCD lines.
COM9/S1-COM16/S8. These pins are the 8 multiplexed common/segment lines. Under software
selected control, they can act as LCD common
outputs allowing a 48x 16 dot matrix operation, or
they can act as segment outputs alowwing 56 x 8
dot matrix operation.
S9-S56. These pins are the 48 LCD peripheral
segment outputs.
VLCD1/5, VLCD5/5. Display supplyvoltage inputs
for determining the display voltage levels on
common and segment pins during multiplex operation.
OSC32in and OSC32out. These pins are internally connected with the on-chip 32kHz oscillator
circuit. A 32.768kHz quartz crystal can be connected between these two pins if it is necessary to
provide the LCD stand-by clockand real time interrupt. OSC32in is the input pin, OSC32out is the
output pin.
7/78
7
ST62T80B/E80B
1.3 MEMORY MAP
1.3.1 Introduction
The MCU operates in three separate memory
spaces: Program space, Data space, and Stack
space. Operationin these three memory spaces is
described in the following paragraphs.
Briefly, Program space contains user program
code in Program memory and user vectors; Data
space contains user data in RAM and in Program
memory, and Stack space accommodates six levels of stack for subroutine and interrupt service
routine nesting.
1.3.2 Program Space
Program Space comprises the instructions to be
executed, the data required for immediate addressing mode instructions, the reserved factory
test area and the user vectors. Program Space is
addressed via the 12-bit Program Counter register
(PC register).
Program Space is organised in four 2K pages.
Three of them are addressedin the 000h-7FFh locations of the Program Space by the Program
Counter and by writing the appropriate code in the
Program ROM Page Register (PRPR register). A
Figure 4. Memory Addressing Diagram
common (STATIC) 2K page is available all the
time for interrupt vectors and common subroutines, independently of the PRPR register content.
This “STATIC” page is directly addressed in the
0800h-0FFFh by the MSB of the ProgramCounter
register PC 11. Note this page can also be addressed in the 000-7FFh range. It is two different
ways of addressing the same physical memory.
Jump from a dynamic page to another dynamic
page is achieved by jumping back to the static
page, changing contents of PRPR and then jumping to the new dynamic page.
Figure 3. 8Kbytes Program Space Addressing
PC
SPACE
000h
7FFh
800h
FFFh
0000h
Page 0
Page 1
Static
Page
ROM SPACE
Page 1
Static
Page
1FFFh
Page 2Page 3
0000h
0FF0h
0FFFh
PROGRAM SPACE
PROGRAM
MEMORY
INTERRUPT &
RESET VECTORS
0-63
000h
03Fh
040h
07Fh
080h
081h
082h
083h
084h
0C0h
0FFh
DATA SPACE
RAM / EEPROM
BANKING AREA
DATA READ-ONLY
MEMORY
X REGISTER
Y REGISTER
V REGISTER
W REGISTER
DATA READ-ONLY
WINDOW SELECT
BANK SELECT
ACCUMULATOR
WINDOW
RAM
MEMORY
DATA RAM
VR01568
8/78
8
MEMORY MAP (Cont’d)
ST62T80B/E80B
Table 1. ST62E80B/T80B Program MemoryMap
ROM PageDevice AddressDescription
Page 0
Page 1
“STATIC”
Page 2
Page 3
0000h-007Fh
0080h-07FFh
0800h-0F9Fh
0FA0h-0FEFh
0FF0h-0FF7h
0FF8h-0FFBh
0FFCh-0FFDh
0FFEh-0FFFh
0000h-000Fh
0010h-07FFh
0000h-000Fh
0010h-07FFh
Reserved
User ROM
User ROM
Reserved
Interrupt Vectors
Reserved
NMI Vector
Reset Vector
Reserved
User ROM
Reserved
User ROM
Note: OTP/EPROM devices can be programmed
with thedevelopment toolsavailable fromSTMicroelectronics (ST62E8X-EPB).
1.3.2.1 Program ROM Page Register (PRPR)
The PRPR register can be addressed like a RAM
location in the Data Space at the address CAh ;
nevertheless it is a write only register that cannot
be accessed with single-bit operations. This register is used to select the 2-Kbyte ROM bank of the
Program Space that will be addressed. The
number of the page has to be loaded in the PRPR
register. Refer to the Program Space description
for additional information concerning the use of
this register. The PRPR register is not modified
when an interrupt or a subroutine occurs.
Care is required when handling the PRPR register
as it is write only. For this reason, it is not allowed
to change the PRPR contents while executing interrupt service routine, as the service routine
cannot save and then restore its previous content.
This operation may be necessary if common routines and interrupt service routines take more than
2K bytes ; in this case it could be necessary to divide the interruptservice routineinto a (minor) part
in the static page (start and end) and to a second
(major) part in one ofthe dynamic pages. If it is impossible to avoid the writing ofthis register in interrupt service routines, an image of this register
must be saved in a RAM location, and each time
the program writes to the PRPR it must write also
to the image register. The image register must be
written before PRPR, so if an interrpt occurs between the two instructions the PRPR is not affected.
Program ROM Page Register (PRPR)
Address: CAh — Write Only
70
------PRPR1 PRPR0
Bits 2-7= Not used.
Bit 5-0 = PRPR1-PRPR0:
Program ROM Select.
These two bits select the corresponding page to
be addressed in the lower part of the 4K program
address space as specified in Table 2.
This register is undefined on Reset. Neither read
nor single bit instructions may be used to address
this register.
The Program Memory in OTP or EPROM devices
can be protected againstexternal readoutof memory by selecting the READOUT PROTECTION option 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 Program memory contents.
Returned parts with a protection set can therefore
not be accepted.
9/78
9
ST62T80B/E80B
MEMORY MAP (Cont’d)
1.3.3 Data Space
Data Space accommodates all the data necessary
for processing the user program. This space comprises the RAM resource, the processor core and
peripheral registers, as well as read-only data
such as constants and look-up tables in Program
memory.
1.3.3.1 Data ROM
All read-only data is physically stored in program
memory, which also accommodates the Program
Space. The program memory consequently contains the program code to be executed, as well as
the constants and look-up tables required by the
application.
The Data Space locations in which the different
constants and look-up tables are addressedby the
processor core may be thought of as a 64-byte
window through which it is possible to access the
read-only data stored in Program memory.
1.3.3.2 Data RAM/EEPROM
In ST62T80B and ST62E80B devices, the data
space includes 60 bytes of RAM, the accumulator
(A), the indirect registers (X), (Y), the short direct
registers (V), (W), the I/O port registers, the peripheral 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 banks of 64 bytes located between 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 3. Additional RAM/EEPROM Banks.
DeviceRAMEEPROMLCD RAM
ST62T80B/E80B 2 x 64 bytes 2 x 64 bytes 2 x 64 bytes
Table 4. ST62T80B/E80B Data Memory Space
DATA RAM/EEPROM, LCD RAM
DATA ROM WINDOW AREA
X REGISTER080h
Y REGISTER081h
V REGISTER082h
W REGISTER083h
DATARAM
PORT A DATAREGISTER0C0h
PORT B DATAREGISTER0C1h
SPI INTERRUPT DISABLE REGISTER0C2h
PORT C DATAREGISTER0C3h
PORT A DIRECTION REGISTER0C4h
PORT B DIRECTION REGISTER0C5h
PORT C DIRECTION REGISTER0C6h
RESERVED0C7h
INTERRUPTOPTION REGISTER0C8h*
DATAROM WINDOW REGISTER0C9h*
ROM BANK SELECTREGISTER0CAh*
DATARAM/EEPROM, LCD BANK SELECT REGISTER 0CBh*
PORT A OPTION REGISTE R0CCh
RESERVED0CDh
PORT B OPTION REGISTE R0CEh
PORT C OPTION REGISTER0CFh
TheData read-only memorywindowislocatedfrom
address 0040h to address 007Fh in Data space. It
allows directreading of 64 consecutive bytes located anywhere in program memory, between address 0000h and 1FFFh (top memory address depends on the specific device). All the program
memory can therefore be used to store either instructions or read-only data. Indeed, the window
can be moved in steps of 64 bytes along the program memoryby writingtheappropriate code inthe
Data Window Register (DWR).
The DWR can beaddressed like anyRAM location
in the Data Space, it is however a write-only register and therefore cannotbe accessed using singlebit operations. This register is used to position the
64-byte read-only data window (from address 40h
to address 7Fh of the Data space) in program
memory in 64-byte steps. The effective address of
the byte to be read as data in program memory 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 illustrated in Figure 5 below. For instance, when addressing location 0040h of the Data Space, with 0 loaded in the DWR register, the physical location addressed inprogram memory is 00h. The DWRregister is not cleared on reset, therefore it must be
written to prior tothe first access to the Data readonly memory window area.
Address: 0C9h — Write Only
70
-DWR6 DWR5 DWR4 DWR3 DWR2 DWR1 DWR0
Bits 7 = Not used.
Bit 6-0 = DWR6-DWR0:
Window Register Bits.
Data read-only memory
These are the Data readonly memory Window bits that correspond to the
upper bits of the data read-only memory space.
Caution:
This register is undefined on reset. Neither 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 not be changed while executing an interrupt service routine, as the service
routine cannot saveand then restore the register’s
previous contents. If it is impossible to avoid writing to the DWR during the interrupt service routine,
an image of the register must 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 interrupt occurs between the two instructions, the
DWR is not affected.
Figure 5. Data read-only memory Window Memory Addressing
543210
DATA ROM
WINDOW REGISTER
CONTENTS
(DWR)
12
13
7654320
67891011
1
543210
01
Example:
DWR=28h
ROM
ADDRESS:A19h
11
00000000
11
0
0000
0
1
1
01001
1
11
PROGRAM SPACE ADDRESS
READ
DATA SPACE ADDRESS
40h-7Fh
IN INSTRUCTION
DATA SPACE ADDRESS
59h
VR0A1573
11/78
11
ST62T80B/E80B
MEMORY MAP (Cont’d)
1.3.6 Data RAM/EEPROM and LCD RAM Bank
Register (DRBR)
Address: CBh — Write only
70
-DRBR6DRBR5 DRBR4DRBR3- DRBR1 DRBR0
Bit 7 = This bit is not used
Bit 6 - DRBR6. This bit, when set, selects LCD
RAM Page 2.
Bit 5 - DRBR5. This bit, when set, selects LCD
RAM Page 1.
Bit 4 - DRBR4. This bit, when set, selects RAM
Page 2.
Bit 3 - DRBR3. This bit, when set, selects RAM
Page 1.
Bit2. These bits are not used.
Bit 1 - DRBR1. This bit, when set, selects
EEPROM Page 1.
Bit 0 - DRBR0. This bit, when set, selects
EEPROM Page 0.
The selection of the bank is made by programming
the Data RAM Bank Switch register (DRBR register) located at address CBh of the Data Space according to Table 1. No more than one bank should
be set at a time.
The DRBR register can be addressed like a RAM
Data Space at the address CBh; nevertheless it is
a write only register that cannot be accessed with
single-bit operations. This register isused to select
the desired 64-byte RAM/EEPROM bank of the
Data Space. Thenumber of banks 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 initialization, therefore it must be written before the first
access to the Data Space bank region. Refer to
the Data Space description for additional information. The DRBR register is not modified when 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 interrupt service routine, as the service routine cannot save and thenrestore 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 DRBR it must write also to
the image register. The image register must be
written first, so if an interrupt occurs between the
two instructions the DRBR is not affected.
In DRBR Register, only 1 bit must be set. Otherwise two or more pages are enabled in parallel,
producing errors.
EEPROM memory is located in 64-byte pages in
data space. This memory maybe used by theuser
program for non-volatile data storage.
Data spacefrom 00h to3Fh is paged as described
in Table 6. EEPROM locations are accessed directly by addressing these paged sections of data
space.
The EEPROM does not require dedicated instructions forreadorwrite access.Onceselectedvia the
Data RAM Bank Register, the active EEPROM
page is controlled by the EEPROM Control Register (EECTL), which is described below.
Bit E20FFof the EECTL registermust bereset prior
to any write or read access to the EEPROM. If no
bank hasbeen selected, or if E2OFF is set, any access is meaningless.
Programming must be enabled by setting the
E2ENA bit of the EECTL register.
The E2BUSY bitof the EECTL register is setwhen
the EEPROM is performing a programming cycle.
Any access to the EEPROM when E2BUSY is set
is meaningless.
Provided E2OFF and E2BUSY are reset, an EEPROM location is read just like any other data location, also in terms of access time.
Writing to the EEPROM may be carried out in two
modes: Byte Mode (BMODE) and Parallel Mode
ST62T80B/E80B
(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 consequent 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 nobuffer memory 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 the status of E2BUSY. This
implies that as long as the EEPROM is busy, it is
not possible to change the status of the EEPROM
Control Register. EECTL bits 4 and 5 are reserved
and must never be set.
Care is required whendealing withthe EECTL register, as some bits are write only. For this reason,
the EECTL contents must not be altered while executing 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 occurs between the two instructions, the EECTL will
not be affected.
Table 6. Row Arrangement for Parallel Writing of EEPROM Locations
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.
13/78
13
ST62T80B/E80B
MEMORY MAP (Cont’d)
Additional Notes on Parallel Mode:
If the user wishes to perform parallel programming, the first step should be to set the E2PAR2
bit. From this time on, the EEPROM will be addressed in write mode, the ROW address will be
latched and it will be possible to change it only at
the end of the programming cycle, or by resetting
E2PAR2 without programming the EEPROM. After the ROW addressis 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 allor in part ofthe ROW.
Setting E2PAR1 will modify the EEPROM registers 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, these three registers will be modified simultaneously; 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 setthe E2PAR2 bit between two parallel programming cycles. Note that if the user tries to set
E2PAR1 while E2PAR2 is not set, there will be no
programming cycleand the E2PAR1 bit will be unaffected. Consequently, the E2PAR1bit cannot be
set if E2ENA is low. The E2PAR1 bit can be setby
the user, only if the E2ENA and E2PAR2 bits are
also set.
EEPROM Control Register (EECTL)
Address: DFh — Read/Write
Reset status: 00h
70
D7 E2OFF D5D4 E2PAR1 E2PAR2 E2BUSY E2ENA
Bit 7 = D7:
Bit6= E2OFF:
Unused.
Stand-byEnable Bit.
WRITE ONLY.
IfthisbitissettheEEPROMisdisabled(anyaccess
will bemeaningless) and the power consumption of
the EEPROM is reduced to its lowest value.
Bit 5-4 = D5-D4:
Bit 3 = E2PAR1:
Reserved.
MUST be kept reset.
Parallel Start Bit.
WRITE ONLY.
OnceinParallelMode,as soonastheuser software
sets the E2PAR1 bit, parallel writing of the 8 adjacent registers will start. This bit is internally reset at
the end of the programming procedure. Note that
less than 8 bytescan bewritten if required, the undefined bytes being unaffected by the parallel programmingcycle;thisis explained ingreater detailin
the Additional Notes on Parallel Mode overleaf.
Bit 2 = E2PAR2:
Parallel Mode En. Bit.
WRITE
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 can be written simultaneously. 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 changingbits, as
illustrated in Table 6. E2PAR2 is automatically reset at the end of any parallel programming procedure. It can be reset by the user software before
starting the programming procedure, thus leaving
the EEPROM registers unchanged.
Bit 1 = E2BUSY:
EEPROM Busy Bit.
READ ONLY. This bit is automatically set by the EEPROM
control logic when the EEPROM is in programming mode. The userprogram should test it before
any EEPROM read or write operation; any attempt
to access the EEPROM while the busy bit is set
will be aborted and the writing procedure in
progress will be completed.
Bit 0 = E2ENA:
EEPROM Enable Bit.
WRITE ONLY. This bit enables programming of the EEPROM
cells. It must be set before any write to the EEPROM register. Any attempt to write to the EEPROM when E2ENA is low is meaningless and will
not trigger a write cycle.
14/78
14
1.4 PROGRAMMING MODES
ST62T80B/E80B
1.4.1 Option Byte
The Option Byte allows configuration capability to
the MCUs. Option byte’s content is automatically
read, and the selected options enabled, when the
chip reset is activated.
It can only be accessed during the programming
mode. This access is made either automatically
(copy from a master device) or by selecting the
OPTION BYTE PROGRAMMING modeof the programmer.
The option byte is located in a non-user map. No
address has to be specified.
EPROM Code Option Byte
70
--
PRO-
TECT
NMI
PULL
-WDACT-
Bit 7-5. Reserved.
Bit 5= PROTECT. This bit allows the protection of
the software contents against piracy. When the bit
PROTECT is set high, readout of the OTP contents is prevented by hardware. No programming
equipment is able to gain access to the user program. When this bit is low, the user program can
be read.
Bit 4. Reserved.
Bit 3 = NMI PULL. . This bit must beset highto en-
able the internal pull-up resistor. When low, no
pull-up is provided.
Bit 2. Reserved.
Bit 1 = WDACT. This bit controls the watchdog ac-
tivation. When it is high, hardware activation is selected. The software activation is selected when
WDACT is low.
Bit 0 = Reserved.
The Option byte is written during programming ei-
ther by using the PC menu (PC driven Mode) or
1.4.2 Program Memory
EPROM/OTP programming mode is set by a
+12.5V voltage applied to the TEST/VPPpin. The
programming flow of the ST62T80B/E80B is described in the User Manual of the EPROM Programming Board.
The MCUscan be programmed with the
ST62E8xB EPROM programming tools available
from STMicroelectronics.
1.4.3 EEPROM Data Memory
EEPROM data pages are supplied in the virgin
state FFh. Partial or total programming of EEPROM data memory can be performed either
through the application software, or through anexternal programmer. Any STMicroelectronics tool
used for the program memory (OTP/EPROM) can
also be used to program the EEPROM data memory.
1.4.4 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 exposed to light with a wave lengths shorter than approximately 4000Å. It should be noted that sunlights and some types of fluorescent lamps 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
prevent unintentional erasure problems when testing the application in such an environment.
The recommended erasure procedure of the
MCUs EPROM is the exposure to short wave ultraviolet 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 15Wsec/cm2. The erasure time with this dosage is approximately 15 to 20 minutes using an ultraviolet
lamp with 12000µW/cm2power rating. The
ST62E80B should be placed within 2.5cm (1Inch)
of the lamp tubes during erasure.
automatically (stand-alone mode)
15/78
15
ST62T80B/E80B
2 CENTRAL PROCESSING UNIT
2.1 INTRODUCTION
The CPU Coreof ST6devicesisindependent ofthe
I/O or Memory configuration. As such, it may be
thought of as an independent central processor
communicating with on-chip I/O, Memory and Peripherals 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 thecore is linked to thededicated on-chip peripherals via the serial data bus and indirectly, for
interrupt purposes, through the control registers.
2.2 CPU REGISTERS
TheST6FamilyCPUcorefeaturessixregisters 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 calculations, logical operations, and data manipulations. The accumulator can be addressed in Data
space as a RAM location at address FFh. Thus the
ST6 can manipulate the accumulator 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 addressed in the dataspace as RAM locations at addresses 80h (X) and 81h (Y). They can also beaccessed with the direct, short direct, or bit direct addressing modes. Accordingly, the ST6 instruction
set can usethe indirect registers as any other register of the data space.
Short Direct Registers (V, W). These two registers are used to save a byte in short direct addressing mode. They can be addressed in Data
space as RAM locations at addresses 82h (V)and
83h (W). They can also be accessed using the direct and bit direct addressing modes. Thus, the
ST6 instruction set can use the short direct registers as any other register of the data space.
Program Counter (PC). The program counter is a
12-bit register which contains the address of the
next ROM location to be processed by the core.
This ROM location may be an opcode, an operand, 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
Program 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/78
16
CPU REGISTERS (Cont’d)
However, ifthe 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 address of the current instruction. Toexecute relative
jumps, the PC and the offset are shifted through
the ALU, where they are added; the result is then
shifted backinto the PC.The programcounter can
be changedin the following ways:
- JP (Jump) instructionPC=Jump address
- CALL instructionPC= Call address
- Relative Branch Instruction.PC= PC +/- offset
- InterruptPC=Interrupt vector
- ResetPC= 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 Maskable
Interrupt mode. Each pair consists of a CARRY
flag and a ZERO flag. One pair (CN, ZN) is used
during Normal operation, another pair is used during Interrupt mode (CI, ZI), and a third pair is used
in the Non Maskable Interrupt mode (CNMI, ZNMI).
The ST6 CPU uses the pair of flags associated
with the current mode: as soon as an interrupt (or
a Non Maskable Interrupt) is generated, the ST6
CPU uses the Interrupt flags (resp. the NMI flags)
instead of the Normal flags. When the RETI instruction 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 routine). The flags are not cleared during context
switching and thus retain their status.
The Carry flag is set when a carry or a borrow occurs during arithmetic operations; otherwise it is
cleared. The Carry flag is also set to the value of
the bit tested in a bit test instruction; it also participates in the rotate left instruction.
The Zero flag is set if the result of the last arithmetic or logical operation was equal to zero; otherwise it is cleared.
Switching between the three sets of flags is performed automatically when an NMI, an interrupt or
a RETI instructions occurs. As the NMI mode is
ST62T80B/E80B
automatically selected after the reset of the MCU,
the ST6 core uses at first the NMI flags.
Stack. The ST6 CPU includes a true LIFO hardware 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 interrupt request) occurs, the contents of each level are
shifted intothe next higher level, while the content
of the PC is shifted into the first level (the original
contents of the sixth stack level are lost). When a
subroutine or interruptreturn occurs (RET or RETI
instructions), the first level register is shifted back
into the PC and the value of each level is popped
back into the previous level. Since the accumulator, in common with all other data space registers,
is not stored in this stack, management of these
registers should be performed within the subroutine. The stack will remain in its “deepest” position
if morethan 6 nested calls orinterrupts are executed, and consequently the last return address will
be lost. It will also remain in its highest position if
the stack is emptyand aRET or RETI is executed.
In this case the next instruction will be executed.
Figure 7. ST6 CPU Programming Mode
l
INDEX
REGISTER
INTERRUPTFLAGS
NMI FLAGS
b7
b7
b7
b7
b7
PROGRAMCOUNTER
SIX LEVELS
STACKREGISTER
X REG. POINTER
Y REG. POINTER
VREGISTER
W REGISTER
ACCUM ULATOR
b0
b0
b0
b0
b0
b0b11
CZNORMAL FLAGS
CZ
CZ
SHORT
DIRECT
ADDRESSING
MODE
VA000 4 23
17/78
17
ST62T80B/E80B
3 CLOCKS, RESET, INTERRUPTS AND POWER SAVING MODES
3.1 CLOCK SYSTEM
3.1.1 Main Oscillator
The MCU featuresa Main Oscillator which can be
driven by an external clock, or used in conjunction
with an AT-cut parallel resonant crystal or a suitable ceramic resonator.
Figure 8 illustrates various possible oscillator configurations using anexternal crystal or ceramic resonator, an external clock input. CL1an CL2should
have acapacitance in the range 12 to 22 pF for an
oscillator frequency in the 4-8 MHz range.
The internal MCU clock Frequency (F
) is divid-
INT
ed by 13 to drive the CPU core and by 12 to drive
the A/D converter and the watchdog timer, while
clock used to drive on-chip peripherals depends
on the peripheral as shown in the clock circuit
block diagram.
With an 8MHz oscillator frequency, the fastest machine cycle is therefore 1.625µs.
A machine cycle is the smallest unit of time needed
to executeany operation (for instance, toincrement
the Program Counter). An instruction may require
two, four, or five machine cycles for execution.
Figure 9. Clock Circuit Block Diagram
Figure 8. Oscillator Configurations
CRYSTAL/RESONATOR CLOCK
ST6xxx
OSC
C
L1n
EXTERNAL CLOCK
OSC
in
ST6xxx
in
OSC
OSC
NC
out
out
C
L2
VA0016
VA0015A
OSCin
OSCout
OSC32in
OSC32out
18/78
18
f
OSC
MAIN
OSCILLATOR
32kHz
OSCILLATOR
POR
f
INT
f
INT
MUX
EOCR bit 5
(START/STOP)
:13
:12
Core
Timer 1 & 2
Watchdog
ADC
LCD
CONTROLLER
DRIVER
CLOCK SYSTEM (Cont’d)
3.1.2 32 KHz STAND-BY OSCILLATOR
An additional32KHz stand-by on chip oscillatorallows to generate real time interrupts and to supply
the clock to the LCD driver with the main oscillator
stopped. This enables the MCU to perform real
time functions with the LCD display running while
keeping advantages of low power consumption.
Figure 10 shows the 32KHz oscillator block diagram.
A 32.768KHz quartz crystalmust be connected to
the OSC32in and OSC32out pins to perform the
real time clock operation. Two external capacitors
of 15-22pF each must be connected between the
oscillator pinsand ground. The 32KHz oscillator is
managed by the dedicated status/control register
32OCR.
As long as the 32KHz stand-by oscillator is enabled, 32KHz internal clock is available to drive
LCD controller driver. This clock is divide by 214to
generate interrupt request every 500ms . The periodic interrupt request serves as reference timebase for real time functions.
Note: When the 32KHz stand-by oscillator is
stopped (bit 5 of the Status/Control register
cleared) the divider chain is supplied with a clock
signal synchronous with machine cycle (f
this produces an interrupt request every 13x2
INT
/13),
14
clock cycle (i.e. 26.624ms) with an 8MHz quartz
crystal.
ST62T80B/E80B
32KHz Oscillator Register (32OCR)
Address: DBh - Read/Write
70
EOSCI OSCEOC S/SD4D3D2D1D0
Bit 7= EOSCI.
when set, enables the 32KHz oscillator interrupt
request.
Bit 6 = OSCEOC.
indicates whenthe 32KHzoscillator has measured
a500mselapsedtime(providinga
32.768KHzquartz crystal is connected to the
32KHz oscillator dedicated pins). An interrupt request can be generated in relation to the state of
EOSCI bit. This bit must be cleared by the user
program before leaving the interrupt service routine.
Bit 5 = START/STOP.O
This bit, when set, enables the 32KHz stand-by
oscillator and the free running divider chainis supplied by the 32KHz oscillator signal. When this bit
is cleared to zero the divider chain is supplied with
f
/13.
INT
This register is cleared during reset.
Note:
To achieve minimumpower consumption in STOP
mode (no system clock), the stand-by oscillator
must be switched off (real time function not available) by clearing the Start/Stop bit in the oscillator
status/control register.
Enable Oscillator Interrupt
Oscillator Interrupt Flag
scillator Start/Stop bit
. This bit,
. This bit
.
Figure 10. 32KHz Oscillator Block Diagram
2x15...22pF
OSC32IN
OSC32KHzMUX
32.768KHz
Crystal
OSC32OUT
EOSCI OSCEOC
START
STOP
OSC32KHz
f
INT
INT
1
0
/13
XXXXX
DIV2
14
19/78
19
ST62T80B/E80B
3.2 RESETS
The MCU can be reset in 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 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 is active low
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, provided VDDhas
completed its risingphase andthat the oscillator is
running correctly (normal RUN or WAIT modes).
The MCU is kept in the Reset state as long as the
RESET pin is held low.
If RESET activation occurs in the RUN or WAIT
modes, processing of the user program is stopped
(RUN modeonly), the Inputs and Outputs are configured as inputs with pull-up resistors and the
main Oscillator is restarted. When the level on the
RESET pin then goes high, the initialization sequence is executed following expiry of the internal
delay period.
If RESET pin activation occurs in the STOP mode,
the oscillator starts up and all Inputs and Outputs
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 consists in waking
up the MCU at an appropriate stage during the
power-on sequence. At the beginning of this sequence, the MCU is configured in the Reset state:
all I/O ports are configured as inputs with pull-up
resistors and no instruction is executed. When the
power supplyvoltage rises to a sufficient level, the
oscillator starts to operate, whereupon an internal
delay is initiated, in order to allow the oscillator to
fully stabilize before executing the first instruction.
The initialization sequence isexecuted immediately following the internal delay.
The internaldelay isgenerated byan on-chipcounter. Theinternal reset lineis released 2048 internal
clock cycles after release of the external reset.
Notes:
To ensure correct start-up, the user should take
care that the reset signal is not released before the
VDDlevel is sufficient to allow MCU operation at
the chosen frequency (see Recommended Operating Conditions).
A proper reset signal for a slow rising VDDsupply
can generally be provided by an external RC network connected to the RESET pin.
Figure 11. Reset and Interrupt Processing
RESET
NMI MASK 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
20/78
20
RESETS (Cont’d)
3.2.3 Watchdog Reset
The MCU provides a Watchdog timer function in
order to ensure graceful recovery from software
upsets. If the Watchdog register is not refreshed
before an end-of-count condition is reached, the
internal reset will be activated. This, amongst other 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
No external resistor is required between VDDand
the Reset pin, thanks to the built-in pull-up device.
The POR circuit operates dynamically, in that it
triggers MCU initialization on detecting the rising
edge of VDD. The typical threshold is in the region
of 2 volts, but the actual value of the detected
threshold depends on the way in which VDDrises.
The POR circuit is
NOT
designed to supervise
static, or slowly rising or falling VDD.
3.2.5 MCU Initialization Sequence
When a reset occurs the stack is reset, the PC is
loaded with the address of the Reset Vector (located in program ROM starting at address 0FFEh). A
jump tothe beginning of theuser program must be
coded at this address. Following a Reset, the Interrupt flag is automatically set, so that the CPU is
in Non Maskable Interrupt mode; this prevents the
ST62T80B/E80B
initialisation routine from being interrupted. The initialisation routine should therefore be terminated
by a RETI instruction, in order to revert to normal
mode and enable interrupts. Ifno pending interrupt
is presentat theend of the initialisation routine, the
MCU will continue by processing the instruction
immediately following the RETI instruction. If, however, a pending interrupt is present, it will be serviced.
Figure 12. Reset and Interrupt Processing
RESET
JP:2 BYTES/4 CYCLES
RESET
VECTOR
INITIALIZATION
ROUTINE
JP
RETI: 1 BYTE/2 CYCLES
RETI
VA00181
Figure 13. Reset Block Diagram
V
DD
300kΩ
RESET
2.8kΩ
POWER
WATCHDOG RESET
ON RESET
f
OSC
RESET
CK
COUNTER
RESET
ST6
INTERNAL
RESET
VA0200B
21/78
21
ST62T80B/E80B
RESETS (Cont’d)
Table 7. Register Reset Status
RegisterAddress(es)StatusComment
EEPROM Control Register
Port Data Registers
Port A,B Direction Register
Port A,B Option Register
Interrupt Option Register
AR TIMER Mode Control Register
AR TIMER Status/Control 1 Register
AR TIMER Status/Control 2Register
AR TIMER Compare Register
0C2h, 0DDh
0DCh
0DBh
080H TO 083H
0FFh
084h to 0BFh
0CBh
0C9h
00h to 03Fh
0D0h
0D4h
0D3h
0D2h
0D8h
0D1h
0E5h
0E6h
0E7h
0EAh
SPI disabled
LCD display off
Interrupt disabled
00hUART disabled
UndefinedAs written if programmed
00h
FFh
7Fh
FEh
40h
00h
TIMER 1 disabled/Max count
loaded
A/D in Standby
AR TIMER stopped
AR TIMER Load Register
AR TIMER Reload/Capture Register
22/78
22
0EBh
0E9h
Undefined
As written if programmed
3.3 DIGITAL WATCHDOG
ST62T80B/E80B
The digital Watchdog consists of a reloadable
downcounter timer which can be used to provide
controlled recovery from software upsets.
The Watchdog circuit generates a Reset when the
downcounter reaches zero. User software can
prevent this reset by reloading the counter, and
should therefore be written so that the counter is
regularly reloaded while the user program runs
correctly. Inthe event of a software mishap (usually caused by externally generated interference),
the userprogram will no longer behave in its usual
fashion and the timer register will thus not be reloaded periodically. Consequently the timer will
decrement down to 00h and reset the MCU. In order to maximise the effectiveness of the Watchdog
function, user software must be written with this
concept in mind.
Table 8. Recommended Option Choices
Functions RequiredRecommended Options
Stop Mode“SOFTWARE WATCHDOG”
Watchdog“HARDWARE WATCHDOG”
Watchdog behaviour is governed by one option,
known as “WATCHDOG ACTIVATION” (i.e.
HARDWARE or SOFTWARE) (See Table8).
In the SOFTWARE option, the Watchdog is disabled until bit C of the DWDR register has been set.
When the Watchdog is disabled, low power Stop
mode is available. Once activated, the Watchdog
cannot be disabled, except by resetting the MCU.
In the HARDWARE option, the Watchdog is permanently enabled. Sincethe oscillatorwill run continuously, low power mode is not available. The
STOP instruction is interpreted as a WAIT instruction, and the Watchdog continues to countdown.
When the MCU exits STOP mode (i.e. when aninterrupt is generated), the Watchdog resumes its
activity.
23/78
23
ST62T80B/E80B
DIGITAL WATCHDOG (Cont’d)
The Watchdog is associated with a Data space
register (Digital WatchDog Register, DWDR, location 0D8h) which is described in greater detail in
Section 3.3.1 . This register is set to 0FEh on Reset: bit C is cleared to “0”, which disables the
Watchdog; the timer downcounter bits, T0 to T5,
and the SR bit are all set to “1”, thus selecting the
longest Watchdog timer period. This time period
can be set to the user’s requirements by setting
the appropriate value for bits T0 to T5 in the
DWDR register. The SR bit must be set to “1”,
since itis this bit which generates the Reset signal
when it changes to “0”; clearing this bit would generate an immediate Reset.
It should be noted that the order of the bits in the
DWDR register is inverted with respect to the associated bits in the down counter: bit 7 of the
DWDR register corresponds, in fact, to T0 and bit
2 to T5. The user should bear in mind the fact that
these bits are inverted and shifted with respect to
the physicalcounter bits when writing tothis register. The relationship between the DWDR register
bits and the physical implementation ofthe Watchdog timer downcounter is illustrated in Figure 14.
Only the 6 most significant bits may be used to define the time period, since it is bit 6 which triggers
the Reset when it changes to “0”. This offers the
user a choice of 64 timed periods ranging from
3,072 to 196,608 clock cycles (with an oscillator
frequency of8MHz, this is equivalent to timer periods ranging from 384µs to 24.576ms).
Figure 14. Watchdog Counter Control
D0
D1
C
SR
RESET
D2
D3
D4
D5
D6
WATCHDOG CONTROL REGISTER
D7
T5
T4
T3
WATCHDOG COUNTER
T2
T1
T0
8
÷2
OSC÷12
VR02068A
24/78
24
Loading...
+ 54 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.