TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in
this document. Any information provided in this document, inclu ding any sample design info rmation o r progra mming co de, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test
the functionality and safety of any application made of this information and any resulting p roduct. Cypress products are not
designed, intended, or authorized for use as critical components in systems designed o r intended for the operation of we apons, weapons systems, nuclear installations, life-support devices or systems, other medical devices or systems (including
resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses where
the failure of the device or system could cause personal injury, death, or property damage ("Unintended Uses"). A critical
component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure
of the device or system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall a nd
hereby do release Cypress from any claim, damage, or other liability arising from or related to all Unintended Uses of Cypress
products. You shall indemnify and hold Cypress harmless from and against all cla ims, costs, damages, and other liabilities,
including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, FRAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more
complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respective owners.
The PSoC® family consists of programmable system-on-chips with on-chip controller devices. As described in this technical
reference manual (TRM), a PSoC device includes configurable blocks of analog circuits and digital logic, as well as programmable interconnect. This architecture allows the user to create customized peripheral configurations, to match the
requirements of each individual application. Additionally, a fast CPU, Flash program memory, SRAM data memory, and configurable input/output (IO) are included in a range of pinouts.
This document is a technical reference manual for the PSoC device: CY8C24533, CY8C23533, CY8C23433CY8C24633. For
the most up-to-date Ordering, Pinout, Packaging, or Electrical Specification inf ormation, refer to the PSoC data sheet. For the
most current technical reference manual information, refer to the addendum. To obtain the newest product documentation, go
to the Cypress web site at http://www.cypress.com/psoc. This section encompasses the following chapter:
■ Pin Information on page 25
Document Organization
This manual is organized into sections and chap ters, according to PSoC functionali ty. Each section begins with documentation interpretation, a top-level architectural explanation, PSoC device distinctions (if relevant), and a register summary (if
applicable). Most chapters within the sections have an introduction, an architectural/application description, PSoC device distinctions (if relevant), register definitions, and timing diagrams. The sections are as follows:
■ Overview – Presents the PSoC top-level architecture, PSoC device characteristics and distinctions, how to get started
with helpful information, and document history and conventions. The PSoC device pinouts are detailed in the Pin
Information chapter on page 25.
■ PSoC Core – Describes the heart of the PSoC device in various chapters, beginning with an architectural overview and a
summary list of registers pertaining to the PSoC core. See “PSoC Core” on page 31.
■ Register Reference – Lists all PSoC device registers in Register Mapping Tables, on page 43, and presents bit-level
detail of each PSoC register in its own Register Details chapter on page 47. Where applicable, detailed register descriptions are also located in each chapter.
■ Digital System – Describes the configurable PSoC digital system in various chapters, beginning with an architectural
overview and a summary list of registers pertaining to the digital system. See the “Digital System” on page 161.
■ Analog System – Describes the configurable PSoC analog system in various chapters, beginning with an architectural
overview and a summary list of registers pertaining to the analog system. See the “Analog System ” on page 215.
■ System Resources – Presents additional PSoC system resources, depending on the PSoC device, beginning with an
overview and a summary list of registers pertaining to system resources. See “System Resources” on page 271.
■ Glossary – Defines the specialized terminology used in this manual. Glossary terms are presented in bold, italic font
throughout this manual. See the “Glossary” on page 321.
■ Index – Lists the location of key topics and elements that constitute and empower the PSoC device. See the “Index” on
page 401.
Document # 001-20559 Rev. *D17
Section A: Overview
Top-Level Architecture
The PSoC block diagram on the next page illustrates the
top-level architecture of the PSoC device. Each major
grouping in the diagram is covered in this manual in its own
section: PSoC Core, Digital System, Analog System, and
the System Resources. Banding these four main areas
together is the communication network of the system bus.
PSoC Core
The PSoC Core is a powerful engine that supports a rich
instruction set. It encompasses the SRAM for data storage,
an interrupt controller fo r easy program execution to new
addresses, sleep and watchdog timers, and multiple clock
sources that include the phase locked loop (PLL), IMO
(internal main oscillator), ILO (internal low speed oscillator),
and ECO (32.768 kHz external crystal oscillator) for precision, programmable clocking. The clocks, together with programmable clock dividers (as a System Resource), provide
the flexibility to integrate almost any timing requirement into
the PSoC device.
The CPU core, called the M8C, is a powerful processor with
speeds up to 24 MHz. The M8C is a four MIPS 8-bit Harvard architecture microprocessor. Within the CPU core are
the SROM and Flash memory components that provide
flexible programming.
PSoC GPIOs provide connection to the CPU, digital and
analog resources of the device. Each pin’s drive mode may
be selected from eight options, allowing great flexibility in
external interfacing. Every pin also has the capability to generate a system interrupt on high level, low level, and change
from last read.
Digital System
The Digital System is composed of digital rows in a block
array, and the Global, Array, and Row Digital Interconnects
(GDI, ADI, and RDI, respectively).The digital system block is
composed of 4 digital PSoC blocks. Each block is an 8-bit
resource that can be used alone or combined with other
blocks to form 8-, 16-, 24-, and 32-bit peripherals, which are
called user modules.
Analog System
The Analog System is composed of analog columns in a
block array, analog references, analog input muxing, and
analog drivers. The analog system block is composed of 6
configurable blocks, each comprised of an opamp circuit
allowing the creation of complex analog signal flows.
Analog blocks are arranged in a column of three, which
includes one CT (Continuous Time) and two SC (Switched
Capacitor) blocks. The Analog Column 0 contains the SAR8
ADC block rather than the standard SC blocks.
System Resources
The System Resources provide additional PSoC capability.
These system resources include:
■ Digital clocks to increase the flexibility of the PSoC
device.
■ One multiply accumulate (MAC) provides a fast 8-bit
multiplier with 32-bit accumulate to assist in both general
math as well as digital filters.
■ The decimator provides a custom hardware filter for digi-
tal signal processing applications, including the creation
of Delta Sigma ADCs.
■ I2C functionality for implementing either I2C slave or
master.
■ Low Voltage Detection (LVD) interrupts can signal the
application of falling voltage levels, while the advanced
POR (Power On Reset) circuit eliminates the need for a
system supervisor.
■ An internal voltage reference that provides an absolute
value of 1.3 V to a variety of PSoC subsystems.
■ Various system resets supported by the M8C.
The digital blocks can be connected to any GPIO through a
series of global buses that can route any signal to any p in.
The buses also allow for signal multiplexing and for performing logic operations. This configurability frees your designs
from the constraints of a fixed peripheral controller.
18Document # 001-20559 Rev. *D
PSoC Top-Level Block Diagram
DIGITAL SYSTEM
SRAM
256 Bytes
Interrupt
Controller
Sleep and
Watchdog
Multiple Clock Sources
(Includes IMO, ILO, PLL, and ECO)
Global Digital Interconnect
Global Analog Interconnect
PSoC CORE
CPU Core (M8C)
SROMFlash 8K
Multiply
Accum.
(MAC)
Internal
Voltage
Ref.
Digital
Clocks
POR and LVD
System Resets
Decimator
SYSTEM RESOURCES
ANALOG SYSTEM
Analog
Ref
I2C
Port 2 Port 1 Port 0
Analog
Drivers
System Bus
Analog
Block Array
Digital PSoC
Block Array
DBB0
1
DBB0
0
DCB02 DCB03
SAR8
ADC
SC
SC
CT
Analog
Input
Muxing
1 Digital Row
2 Analog Columns
Port 3
CT
Section A: Overview
Document # 001-20559 Rev. *D19
Section A: Overview
PSoC Device Characteristics
The PSoC digital system has 1 digital row and the analog
system has 2 analog columns, as described in the following
table.
The following table lists the resources available for
CY8C24633, CY8C24533, CY8C23533, CY8C23433-specific PSoC device groups. The check mark or appropriate
information denotes that a system resource is available for
the PSoC device. Blank fields denote that the system
resource is not available. These resources are detailed in
the section titled “System Resources” on page 271.
The PSoC device distinctions are listed in the table below and in each chapter section where it is app ropriate. The PSoC
device distinctions are significant exceptions or differences between PSoC groups and devices.
PSoC Device Distinctions
Device Distinctions Devices AffectedDescribed in Chapter
Low Power Oscillator Capability The slow IMO (SLIMO) bit is available to
enable SYSCLK operation at 6 MHz and 12 MHz, instead of only 24 MHz.
The SLIMO bit is located in the
POR and LVD Trip Levels The lowest POR level is set for 2.4V operation;
the next lowest is set for 3.0V operation (instead of 3.0V or 4.5V operation).
Register Distinction
IMO mode) is reserved.
Register Distinction
2 (ECO EXW and ECO EX, respectively) cannot be used.
Register Distinction
is only available in devices with a type 1 decimator.
External Crystal Oscillator
(ECO) chapter on page 21
.
Analog Interface chapter on page 219
Decimator chapter on page 291.
and
Digital Clocks chapter on page 275.
20Document # 001-20559 Rev. *D
Section A: Overview
Getting Started
The quickest path to understanding PSoC is by reading the PSoC device’s data sheet and using the PSoC Desi gner Integrated Development Environment (IDE). This manual is useful for understanding the details of the PSoC integrated circuit.
Important Note: For the most up-to-date Ordering, Packaging, or Electrical Specification information, refer to the individual
PSoC device’s data sheet or go to http://www.cypress.com/psoc.
Support
Free support for PSoC products is available online at http://www.cypress.com. Resources include Training Seminars, Discussion Forums, Application Notes, PSoC Consultants, TightLink Technical Support Email/Knowledge Base, and Application
Support Technicians. Technical Support can be reached athttp://www.cypress.com/supportor by phone at:1-425-787-4814.
Product Upgrades
Cypress provides scheduled upgrades and version enhancements for PSoC Designer free of charge. You can order the
upgrades from your distributor on CD-ROM or download them directly fromhttp://www.cypress.com.
Development Kits
Development Kits are available from the following distributors: Digi-Key, Avnet, Arrow, and Future. The Cypress Online Store
contains development kits, C compilers, and all accessories for PSoC development. Go to the Cypress Online Store web site
athttp://www.onfulfillment.com/cypressstore.
Document History
This section serves as a chronicle of the PSoC CY8C24533, CY8C23533, CY8C23433 Technical Reference Manual
PSoC Technical Reference Manual History
Version/
Release Date
**
August, 2007
*A
February 2010
*B
July 2013
*C
December 2013
*D
January 2017
OriginatorDescription of Change
HMTFirst release of the PSoC CY8C24533 Technical Reference Manual. This release encompasses the following PSoC device:
HMTAdd CY8C23533, CY8C23433 and update pinout diagrams.
RJVBRemoved reference to the IMODIS bit.
MSONNo content update; sunset review
RJVBAdded information for "no glitch protection in the device for an external clock".
CY8C24533.
Document # 001-20559 Rev. *D21
Section A: Overview
Documentation Conventions
There are only four distinguishing font types used in this
manual, besides those found in the headings.
■ The first is the use of italics when referencing a docu-
ment title or file name.
■ The second is the use of bold italics when referencing a
term described in the Glossary of this manual.
■ The third is the us e of T imes New Roman font, distinguish-
ing equation examples.
■ The fourth is the use of Courier New font, distinguish-
ing code examples.
Register Conventions
The following table lists the register conventions that are
specific to this manual. A more detailed set of register conventions is located in the Register Details chapter on
page 47.
Register Conventions
ConventionExampleDescription
‘x’ in a register
name
RR : 00Read register or bit(s)
WW : 00Write register or bit(s)
LRL : 00Logical register or bit(s)
CRC : 00Clearable register or bit(s)
00RW : 00Reset value is 0x00 or 00h
XXRW : XXRegister is not reset
0,0,04hRegister is in bank 0
1,1,23hRegister is in bank 1
x,x,F7hRegister exists in register bank 0 and reg-
Empty, grayedout table cell
ACBxxCR1Multiple instances/address ranges of the
same register
ister bank 1
Reserved bit or group of bits, unless oth-
erwise stated
Units of Measure
The following table lists the units of measure used in this
manual.
Units of Measure
SymbolUnit of Measure
dBdecibels
Hzhertz
kkilo, 1000
K
KB1024 bytes
Kbit1024 bits
kHzkilohertz (32.000)
MHzmegahertz
Amicroampere
Fmicrofarad
smicrosecond
Vmicrovolts
mAmilli-ampere
msmilli-second
mVmilli-volts
nsnanosecond
pFpicofarad
ppmparts per million
Vvolts
210, 1024
Numeric Naming
Hexidecimal numbers are represented with all letters in
uppercase with an appended lowercase ‘h’ (for example,
‘14h’ or ‘3Ah’) and hexidecimal numbers may also be represented by a ‘0x’ prefix, the C coding convention. Binary
numbers have an appended lowercase ‘b’ (for example,
01010100b’ or ‘01000011b’). Numbers not indicated by an
‘h’ or ‘b’ are decimal.
22Document # 001-20559 Rev. *D
Section A: Overview
Acronyms
The following table lists the acronyms that are used in this
manual.
Acronyms
AcronymDescription
ABUSanalog output bus
ACalternating current
ADCanalog-to-digital converter
APIApplication Programming Interface
BCbroadcast clock
BRbit rate
BRAbus request acknowledge
BRQbus request
CBUScomparator bus
CIcarry in
CMPcompare
COcarry out
CPUcentral processing unit
CRCcyclic redundancy check
CTcontinuous time
DACdigital-to-analog converter
DCdirect current
DIdigital or data input
DMAdirect memory access
DOdigital or data output
ECOexternal crystal oscillator
FBfeedback
GIEglobal interrupt enable
GPIOgeneral purpose IO
ICEin-circuit emulator
IDEintegrated development environment
ILOinternal low speed oscillator
IMOinternal main oscillator
IOinput/output
IORIO read
IOWIO write
IPORimprecise power on reset
IRQinterrupt request
ISRinterrupt service routine
ISSPin system serial programming
IVRinterrupt vector read
LFSRlinear feedback shift register
LRblast received bit
LRBlast received byte
LSbleast significant bit
LSBleast significant byte
LUTlook-up table
MISOmaster-in-slave-out
MOSImaster-out-slave-in
MSbmost significant bit
MSBmost significant byte
PCprogram counter
Acronyms (continued)
AcronymDescription
PCHprogram counter high
PCLprogram counter low
PDpower down
PMAPSoC® memory arbiter
PORpower on reset
PPORprecision power on reset
PRSpseudo random sequence
PSoC®Programmable System-on-Chip™
PSSDCpower system sleep duty cycle
PWMpulse width modulator
RAMrandom access memory
RETIreturn from interrupt
RIrow input
ROrow output
ROMread only memory
RWread/write
SARsuccessive approximation register
SCswitched capacitor
SIEserial interface engine
SE0single-ended zero
SOFstart of frame
SPstack pointer
SPIserial peripheral interconnect
SPIMserial peripheral interconnect master
SPISserial peripheral interconnect slave
SRAMstatic random access memory
SROMsupervisory read only memory
SSADCsingle slope ADC
SSCsupervisory system call
TCterminal count
USBuniversal serial bus
WDTwatchdog timer
WDRwatchdog reset
XRESexternal reset
Document # 001-20559 Rev. *D23
Section A: Overview
24Document # 001-20559 Rev. *D
1.Pin Information
This chapter lists, describes, and illustrates CY8C24533, CY8 C23533, CY8C23433CY8C2463 3 device pins and pino ut configurations. For up-to-date Ordering, Pinout, and Packaging information, refer to the individual PSoC device’s data sheet at
http://www.cypress.com/psoc.
1.1Pinouts
The PSoC CY8C24533, CY8C23533, CY8C23433CY8C24633 are available in 28-pin SSOP and 32-pin QFN and 56-pin
SSOP OCDpackages. Refer to the following information for details. Every port pin (labeled with a “P”), except for Vss and
Vdd, and XRES in the following tables and illustrations, is capable of Digital IO.
Document # 001-20559 Rev. *D25
Pin Information
AIO, P0[7]
IO, P0[5]
IO, P0[3]
AIO, P0[1]
IO, P2[7]
IO, P2[5]
AIO, P2[3]
AIO, P2[1]
AVref, IO, P3[0]
I2C SCL, IO, P1[7]
I2C SDA, IO, P1[5]
IO, P1[3]
I2C SCL, ISSP SCL, XTALin, IO, P1[1]
Vss
Vdd
P0[6],
AIO, AnColMux and ADC IP
P0[4], AIO, AnColMux and ADC IP
P0[2], AIO, AnColMux and ADC IP
P0[0], AIO, AnColMux and ADC IP
P2[6], IO
P2[4], IO
P2[2], AIO
P2[0], AIO
P3[1], IO
P1[6], IO
P1[4], IO, EXTCLK
P1[2], IO
P1[0], IO, XTALout, ISSP SDA, I2C SDA
SSOP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
28
27
26
25
24
23
22
21
20
19
18
17
16
15
1.1.128-Pin Part Pinout
The 28-pin part is for the CY8C24533 CY8C24633 PSoC device.
16IOP1[2]GPIO
17IOP1[4]GPIO, external clock IP
18IOP1[6]GPIO
19IOP3[1]*** GPIO
19
20IOIP2[0]Direct switched capacitor
21IOIP2[2]Direct switched capacitor
22IOP2[4]GPIO
23IOP2[6]GPIO
24IOIP0[0]Analog Col Mux IP and ADC
25IOIP0[2]Analog Col Mux IP and ADC
26IOIP0[4]Analog Col Mux IP and ADC
27IOIP0[6]Analog Col Mux IP and ADC
28
LEGEND: A = Analog, I = Input, and O = Output.
* Even though P3[0] is an odd port, it resides on the left side of the pinout.
** ISSP pin, which is not High Z at POR.
*** Even though P3[1] is an even port, it resides on the right side of the pinout.
26Document # 001-20559 Rev. *D
PowerVssGround pin
PowerVddSupply voltage
Description
Analog
Pin Name
IP
umn O/P and ADC IP
umn O/P and ADC IP
IP
input
input
ISSP SCL
ISSP SDA
XRESActive high pin reset with
internal pull down
input
input
IP
IP
IP
IP
CY8C24533 CY8C24633 PSoC Device
The 28-pin part is for the CY8C23433 PSoC device.
AIO, P0[7 ]
IO, P0[5]
IO, P0[3]
AIO, P0[ 1]
IO, P2[7]
IO, P2[5]
AIO, P2[ 3]
AIO, P2[1]
AVref, IO, P3[0]
I2C SCL, IO, P1[7]
I2C SDA, IO, P1[5]
IO, P1[3]
I2C SCL,ISSP SCL,XTALin,IO, P1[1]
Vss
Vd
d
P0[6], AIO, AnColMux and ADC IP
P0[4], AIO, AnColMux and ADC IP
P0[2], AIO, AnColMux and ADC IP
P0[0], AIO, AnColMux and ADC IP
P2[6], VREF
P2[4], AGND
P2[2], AIO
P2[0], AIO
P3[1], IO
P1[6], IO
P1[4], IO, EXTCLK
P1[2], IO
P1[0],IO,XTALout,ISSP S DA,I2C SDA
16IOP1[2]GPIO
17IOP1[4]GPIO, External Clock IP
18IOP1[6]GPIO
19IO
20IOIP2[0]Direct Switched Capacitor
21IOIP2[2]Direct Switched Capacitor
22IOP2[4]External Analog Ground
23IOP2[6]Analog Voltage Reference
24IOIP0[0]Analog Column Mux IP and
25IOIP0[2]Analog Column Mux IP and
26IOIP0[4]Analog Column Mux IP and
27IOIP0[6]Analog Column Mux IP and
28
LEGEND: A = Analog, I = Input, and O = Output.
* Even though P3[0] is an odd port, it resides on the left side of the pinout.
** ISSP pin, which is not High Z at POR.
*** Even though P3[1] is an even port, it resides on the right side of the pinout.
Document # 001-20559 Rev. *D27
Description
Digital
Analog
Pin Name
ADC IP
Column O/P and ADC IP
Column O/P and ADC IP
ADC IP
Input
Input
GPIO/ADC Vref (optional)
*
P3[0]
GPIO, Xtal Input, I2C SCL,
**
P1[1]
ISSP SCL
PowerVssGround Pin
P1[0]**
P3[1]
GPIO, Xtal Output, I2C SDA,
ISSP SDA
GPIO
***
Input
Input
(AGnd)
(VRef)
ADC IP
ADC IP
ADC IP
ADC IP
PowerVddSupply Voltage
Pin Information
CY8C23433 28-Pin PSoC Device
Pin Information
GPIO, P2[7]
GPIO, P2[5]
A, I, P2[3]
A, I, P2[1]
AVref, P3[0]
NC
QFN
(Top View)
9
10111213141516
1
2
3
4
5
6
7
8
24
23
22
21
20
19
18
17
32313029282726
25
P0[1], A , I
P0[3], A , IO
P0[5], A , IO
P0[7], A , I
Vdd
P0[6], A , I
P0[4], A , I
NC
I2C SCL, P1[7]
I2C SDA, P1[5]
P0[2], A , I
P0[0], A , I
XRES
P1[6], GPIO
NC
GPIO P1[3]
I2C SCL, XTAL in, P1[1]
Vss
I2C SDA, XTALout, P1[0]
GPIO P1[2]
GP IO, E XT CL K, P 1 [4 ]
NC
P2[6], Vref
P2[4], AGnd
P2[2], A , I
P2[0], A , I
1.1.232-Pin Part Pinout
The 32-pin part is for the CY8C23533 PSoC device.
Table 1-3. 32-Pin Part Pinout (QFN)
Pin
No.
1IOP2[7] GPIO
2IOP2[5] GPIO
3IOIP2[3] Direct Switched Capacitor Block Input
4IOIP2[1] Direct Switched Capacitor Block Input
5IOAVrefP3[0]* GPIO/ADC Vref (optional)
6NCNo Connection
7IOP1[7] I2C Serial Clock (SCL)
8IOP1[5] I2C Serial Data (SDA)
14IOP1[2] GPIO
15IOP1[4] GPIO, External Clock IP
16NCNo Connection
17IOP1[6] GPIO
18InputXRES Active High External Reset with Internal
19IOIP2[0] Direct Switched Capacitor Block Input
20IOIP2[2] Direct Switched Capacitor Block Input
21IOP2[4] External Analog Ground (AGnd)
22IOP2[6] External Voltage Reference (VRef)
23IOIP0[0] Analog Column Mux Input and ADC Input
24IOIP0[2] Analog Column Mux Input and ADC Input
25NCNo Connection
26IOIP0[4] Analog Column Mux Input and ADC Input
27IOIP0[6] Analog Column Mux Input and ADC Input
28PowerVddSupply Voltage
29IOIP0[7] Analog Column Mux Input and ADC Input
30IOIOP0[5] Analog Column Mux Input, Column Output
31IOIOP0[3] Analog Column Mux Input, Column Output
32IOIP0[1] Analog Column Mux Input.and ADC Input
LEGEND: A = Analog, I = Input, and O = Output.
* Even though P3[0] is an odd port, it resides on the left side of the pinout.
** ISSP pin, which is not High Z at POR.
Type
Digital Analog
Pin
Name
Clock (SCL), ISSP-SCLK
Serial Data (SDA), ISSP-SDATA
Pull Down
and ADC Input
and ADC Input
Description
CY8C23533 32-Pin PSoC Device
28Document # 001-20559 Rev. *D
1.1.356-Pin Part Pinout
OCD
SSOP
156
Vdd
2AI, P0[7]55P 0[6 ], AI
3
AIO, P0 [5 ]
54P 0 [4 ], AIO
4
AIO, P0 [3 ]
53P 0 [2 ], AIO
5
AI, P0[1]
52
P0[0], AI
6
P2[7]
51P 2 [6 ], External VRef
7
P2[5]
50
P2[4], External AGND
8
AI, P2[3]
49P 2 [2 ], AI
9AI, P2[1]
48P 2 [0 ], AI
10
47
11
GPIO/ADC VRef, P3[0]
46
1245
1344
14
OCDE
43
CCLK
15OCDO42HCLK
1641
XRES
17
NC
40
NC
18
NC
39
NC
19NC
38
NC
2037P 3[1 ]
21
NC
36NC
22
NC35NC
23
I2C SCL, P1[7]
34
P1[6]
24I2C SDA, P1[5]33P1[4], EXTCLK
25NC32
P1[2]
26
P1[3]
31P 1 [0 ], XTALout, I2C SDA, SDATA
27
SCLK, I2C SC L, XTALin, P1[1]30NC
28
Vss29NC
NC
NC
NC
NC
NC
NC
NC
NC
NC
NC
The 56-pin OCD (On-Chip Debug) part is for the CY8C24633 (CY8C24033) PSoC device.
Note OCD parts are only used for in-circuit debugging. OCD parts are NOT available for production.
Table 1-4. 56-Pin OCD Part Pinout (SSOP)
Pin
NameDescription
No.
1 NCNo internal connection
2 P0[7]Analog column mux input: AI
3 P0[5]Analog column mux input and column output: AIO
4 P0[3]Analog column mux input and column output: AIO
5 P0[1]Analog column mux input: AI
6 P2[7]
7 P2[5]
8 P2[3]Direct switched capacitor block input: AI
31 P1[0]* Crystal (XTALout), I2C Serial Data (SDA)44 NCNo internal connection
32 P1[2]45 NCNo internal connection
33 P1[4]Optional External Clock Input (EXTCLK)46 NCNo internal connection
34 P1[6]47 NCNo internal connection
35 NCNo internal connection48 P2[0]Direct switched capacitor block input: AI
36 NCNo internal connection49 P2[2]Direct switched capacitor block input: AI
37 P3[1]GPIO50 P2[4]External Analog Ground (AGND)
38 NCNo internal connection51 P2[6]External Voltage Reference (VRef)
39 NCNo internal connection52 P0[0]Analog column mux input: AI
40 NCNo internal connection53 P0[2]Analog column mux input and column output: AIO
41 XRES Active high pin reset with internal pull down54 P0[4]Analog column mux input and column output: AIO
LEGEND A = Analog, I = Input, O = Output.
Document # 001-20559 Rev. *D29
42 HCLK OCD high speed clock output55 P0[6]Analog column mux input: AI
43 CCLK OCD CPU clock output56 VddSupply voltage
* ISSP pin, which is not High Z at POR.
CY8C24033 OCD PSoC Device
NOT FOR PRODUCTION
NameDescription
No.
Pin Information
Pin Information
30Document # 001-20559 Rev. *D
Section B:PSoC Core
SRAM
SYSTEM BUS
Interrupt
Controller
Sleep
and
Watchdog
CPU Core (M8C)
Supervisory ROM
(SROM)
Flash Nonvolatile
Memory
Multiple Clock Sources
Internal Low Speed
Oscillator (ILO)
24 MHz Internal Main
Oscillator (IMO)
Phase Locked
Loop (PLL)
32 kHz Crystal
Oscillator (ECO)
Port 2 Port 1 Port 0
Analog
Drivers
PSoC CORE
Port 3
The PSoC Core section discusses the core components of the PSoC devices: CY8C24533, CY8C23533,
CY8C23433CY8C24533, and the registers associated with those components. This section encompasses the following chapters:
■ CPU Core (M8C) on page 35
■ Supervisory ROM (SROM) on page 45
■ RAM Paging on page 55
■ Interrupt Controller on page 61
■ General Purpose IO (GPIO) on page 5
■ Analog Output Drivers on page 13
■ Internal Main Oscillator (IMO) on page 15
■ Internal Low Speed Oscillator (ILO) on page 19
■ External Crystal Oscillator (ECO) on page 21
■ Phase-Locked Loop (PLL) on page 27
■ Sleep and Watchdog on page 31
Top-Level Core Architecture
The figure below displays the top-level architecture of the
PSoC’s core. Each component of the figure is discussed at
length in this section.
PSoC Core Block Diagram
Interpreting Core Documentation
The core section covers the heart of the PSoC device which
includes the M8C microcontroller; SROM, interrupt controller, GPIO, analog output drivers, and SRAM paging; multiple clock sources such as IMO, ILO, ECO, and PLL; and
sleep and watchdog functionality.
The analog output drivers are described in this section and
not the Analog System section because they are part of the
PSoC core input and output signals.
Document # 001-20559 Rev. *D31
Section B: PSoC Core
Core Register Summary
The table below lists all the PSoC registers for the CPU core in address order within their system resource configuration. The
bits that are grayed out are reserved bits. If these bits are written, they should always be written with a value of ‘0’. For the
core registers, the first ‘x’ in some register addresses represents either bank 0 or bank 1. These registers are listed throughout this manual in bank 0, even though they are also available in bank 1.
The CY8C24533, CY8C23533, CY8C23433CY8C24633 PSoC devices have 1 digital row and 2 analog columns.
Summary Table of the Core Registers
L The and f, expr; or f, expr; and xor f, expr instructions can be used to modify this register.
# Access is bit specific. Refer to the
X The value for power on reset is unknown.
x An “x” before the comma in the address field indicates that this register can be accessed or written to no matter what bank is used.
C Clearable register or bit(s).
R Read register or bit(s).
W Write register or bit(s).
ILO_TR
ECO_TR
PSSDC[1:0]W : 00
Register Details chapter on page 47 for additional information.
Bias Trim[1:0]Freq Trim[3:0]W : 00
RW : 00
34Document # 001-20559 Rev. *D
2.CPU Core (M8C)
This chapter explains the CPU Core, called M8C, and its associated register. It covers the inte rnal M8C registers, address
spaces, instruction formats, and addressing modes. For additional information concerni ng the M8C instruction set, refer to
the PSoC Designer Assembly Language User Guide available at the Cyp ress web site (http://www.cypress.com/psoc). For a
complete table of the CPU Core registers, refer to the “Summary Table of the Core Registers” on page 32. For a quick refer-
ence of all PSoC registers in address order, refer to the Register Details chapter on page 47.
2.1Overview
The M8C is a four MIPS 8-bit Harvard architecture micropro-
cessor. Selectable processor clock speeds from 93.7 kHz to
24 MHz allow the M8C to be tuned to a particular appl ication’s performance and power requirements. The M8C supports a rich instruction set which allows for efficient low level
language support.
2.2Internal Registers
The M8C has five internal registers that are used in program
execution. The following is a list of these registers.
■ Accumulator (A)
■ Index (X)
■ Program Counter (PC)
■ Stack Pointer (SP)
■ Flags (F)
All of the internal M8C registers are eight bits in width,
except for the PC, which is 16 bits wide. Upon reset, A, X,
PC, and SP are reset to 00h. The Flag register (F) is reset to
02h, indicating that the Z flag is set.
With each stack operation, the SP is automatically incremented or decremented so that it always points to the next
stack byte in RAM. If the last byte in the stack is at address
, the stack pointer wraps to RAM address 00h. It is the
FFh
firmware developer’s responsibility to ensu re that the stack
does not overlap with user-defined variables in RAM.
With the exception of the F register, the M8C internal registers are not accessible via an explicit register address. The
internal M8C registers are accessed using the following
instructions:
■ MOV A, expr
■ MOV X, expr
■ SWAP A, SP
■ OR F, expr
■ JMP LABEL
The F register can be read by using address F7h in either
register bank
2.3Address Spaces
The M8C has three address spaces: ROM, RAM, and registers. The ROM address space includes the supervisory
ROM (SROM) and the Flash. The ROM address space is
accessed via its own address and data bus.
The ROM address space is composed of the Supervisory
ROM and the on-chip Flash program store. Flash is organized into 64-byte blocks. The user need not be concerned
with program store page boundaries, as the M8C automatically increments the 16-bit PC on every instruction making
the block boundaries invisible to user code. Instructions
occurring on a 256-byte Flash page boundary (with the
exception of jmp instructions) incur an extra M8C clock
cycle, as the upper byte of the PC is incremented.
The register address space is used to configure the PSoC
microcontroller’s programmable blocks. It consists of two
banks of 256 bytes each. To switch between banks, the XIO
bit in the Flag register is set or cleared (set for Bank1,
cleared for Bank0). The common convention is to l eave the
bank set to Bank0 (XIO cleared), switch to Bank1 as needed
(set XIO), then switch back to Bank0.
Document # 001-20559 Rev. *D35
CPU Core (M8C)
2.4Instruction Set Summary
The instruction set is summarized in both Table 2-1 and Table 2-2 (in numeric and mnemonic order, respectively), and serves
as a quick reference. If more information is needed, the Instruction Set Summary tables are described in detail in the PSoCDesigner Assembly Language User Guide (refer to http://www.cypress.com/psoc).
Table 2-1. Instruction Set Summary Sorted Numerically by Opcode
Instruction FormatFlags
Bytes
Cycles
Opcode Hex
00 151 SSC2D82 OR [X+e xp r] , AZ5A 52 MOV [expr], X
01 42 ADD A, exprC, Z2E 93 OR [expr], exprZ5B4 1 MOV A, XZ
02 62 ADD A, [expr]C, Z2F 103 OR [X+expr], exprZ5C4 1 MOV X, A
03 72 ADD A, [X+expr]C, Z30 91 HALT5D 62 MOV A, reg[expr ]Z
04 72 ADD [expr], AC, Z314 2 XOR A, exprZ5E7 2 MOV A, reg[X+expr]Z
05 82 ADD [X+expr], AC, Z3262 XOR A, [expr]Z5F 103 MOV [expr], [expr]
06 93 ADD [expr], exprC, Z33 72 XOR A, [X+expr]Z605 2 MOV reg[expr], A
07 103 ADD [X+exp r] , exprC, Z34 72 XOR [expr], AZ61 62 MOV reg[X+expr], A
08 41 PUSH A35 82 XOR [X+expr], AZ6283 MOV reg[expr], expr
09 42 ADC A, exprC, Z36 93 XOR [expr], exprZ63 93 MOV reg[X+expr], expr
0A 62 ADC A, [expr]C, Z37 103 XOR [X+expr], exprZ64 41 ASL AC, Z
0B 72 ADC A, [X+expr]C, Z38 52 ADD SP, expr65 72 ASL [expr]C, Z
0C 72 ADC [expr], AC, Z39 52 CMP A, expr
0D 82 ADC [X+expr], AC, Z3A 72 CMP A, [expr]67 41 ASR AC, Z
0E 93 ADC [expr], exprC, Z3B 82 CMP A, [X+expr]68 72 ASR [expr]C, Z
0F 103 ADC [X+exp r] , exprC, Z3C 83 CMP [expr], expr69 82 ASR [X+expr]C, Z
11 42 SUB A, exprC, Z3E 102 MVI A, [ [expr]++ ]Z6B 72 RLC [expr]C, Z
12 62 SUB A, [expr]C, Z3F 102 MVI [ [expr]++ ], A6C 82 RLC [X+expr]C, Z
13 72 SUB A, [X+expr]C, Z40 41 NOP6D 41 RRC AC, Z
14 72 SUB [expr], AC, Z41 93 AND reg[expr], exprZ6E 72 RRC [expr]C, Z
15 82 SUB [X+expr], AC, Z42 103 AND reg[X+expr], exprZ6F 82 RRC [X+expr]C, Z
16 93 SUB [expr], exprC, Z43 93 OR reg[expr], exprZ70 42 AND F, exprC, Z
17 103 SUB [X+expr], exprC, Z44 103 OR reg[X+expr], exprZ71 42 OR F, exprC, Z
18 51 POP AZ45 93 XOR reg[expr], exprZ72 42 XOR F, exprC, Z
19 42 SBB A, exprC, Z46 103 XOR reg[X+expr], exprZ73 41 CPL AZ
1A 62 SBB A, [expr]C, Z47 83 TST [expr], exprZ74 41 INC AC, Z
1B 72 SBB A, [X+expr]C, Z48 93 TST [X+expr], exprZ75 41 INC XC, Z
1C 72 SBB [expr], AC, Z49 93 TST reg[expr], exprZ76 72 INC [expr]C, Z
1D 82 SBB [X+expr], AC, Z4A 103 TST reg[X+expr], exprZ77 82 INC [X+expr]C, Z
1E 93 SBB [expr], exprC, Z4B 51 SWAP A, XZ78 41 DEC AC, Z
1F 103 SBB [X+expr], exprC, Z4C 72 SWAP A, [expr]Z79 41 DEC XC, Z
20 51 POP X4D 72 SWAP X, [expr]7A 72 DEC [expr]C, Z
21 42 AND A, exprZ4E 51 SWAP A, SPZ7B 82 DEC [X+expr]C, Z
22 62 AND A, [expr]Z4F 41 MOV X, SP7C 133 LCALL
23 72 AND A, [X+expr]Z5042 MOV A, exprZ7D73 LJMP
24 72 AND [expr], A Z51 52 MOV A, [expr]Z7E 101 RETIC, Z
25 82 AND [X+expr], A Z52 62 MOV A, [X+expr]Z7F 81 RET
26 93 AND [expr], exprZ535 2 MOV [expr], A8x 52 JMP
27 103 AND [X+exp r] , exprZ546 2 MOV [X+expr], A9x 112 CALL
28 111 ROMXZ55 83 MOV [expr], exprAx 52 JZ
29 42 OR A, exprZ569 3 MOV [X+expr], exprBx 52 JNZ
2A 62 OR A, [expr]Z574 2 MOV X, exprCx5 2 JC
2B 72 OR A, [X+expr]Z586 2 MOV X, [expr]Dx 52 JNC
2C 72 OR [expr], AZ597 2 MOV X, [X+expr]Ex7 2 JACC
Note 1 Interrupt acknowledge to Interrupt Vector table = 13 cycles.Fx 132 INDEXZ
Note 2 The number of cycles required by an instruction is increased by one for instructions that span
256 byte page boundaries in the Flash memory space.
Opcode Hex
Instruction FormatFlags
Bytes
Cycles
if (A=B) Z=1
if (A<B) C=1
Instruction FormatFlags
Bytes
Cycles
Opcode Hex
66 82 ASL [X+expr]C, Z
36Document # 001-20559 Rev. *D
Table 2-2. Instruction Set Summary Sorted Alphabetically by Mnemonic
CPU Core (M8C)
Bytes
Cycles
Opcode Hex
09 42 ADC A, exprC, Z76 7 2 INC [expr]C, Z20 5 1 POP X
0A 6 2 ADC A, [expr]C, Z77 8 2 INC [X+expr]C, Z18 5 1 POP AZ
0B 7 2 ADC A, [X+expr]C, ZFx 13 2 INDEXZ10 4 1 PUSH X
0C 72 ADC [expr], AC, ZEx 7 2 JACC08 4 1 PUSH A
0D 82 ADC [X+expr], AC, ZCx 5 2 JC7E 10 1 RETIC, Z
0E 9 3 ADC [expr], exprC, Z8x 5 2 JMP7F 8 1 RET
0F 10 3 ADC [X+expr], exprC, ZDx 5 2 JNC6A 4 1 RLC AC, Z
01 42 ADD A, exprC, ZBx 5 2 JNZ6B 7 2 RLC [expr]C, Z
02 62 ADD A, [expr]C, ZAx 5 2 JZ6C 8 2 RLC [X+expr]C, Z
03 72 ADD A, [X+expr]C, Z7C 13 3 LCALL28 11 1 ROMXZ
04 72 ADD [expr], AC, Z7D 73 LJMP6D 4 1 RRC AC, Z
05 82 ADD [X+expr], AC, Z4F 41 MOV X, SP6E 7 2 RRC [expr]C, Z
06 93 ADD [expr], exprC, Z50 42 MOV A, exprZ6F 8 2 RRC [X+expr]C, Z
07 10 3 ADD [X+expr], exprC, Z51 52 MOV A, [expr]Z19 4 2 SBB A, exprC, Z
38 5 2 ADD SP, expr52 6 2 MOV A, [X+expr]Z1A 6 2 SBB A, [expr]C, Z
21 4 2 AND A, exprZ53 52 MOV [expr], A1B 7 2 SBB A, [X+expr]C, Z
22 6 2 AND A, [expr]Z54 62 MOV [X+expr], A1C 7 2 SBB [expr], AC, Z
23 7 2 AND A, [X+expr]Z55 8 3 MOV [expr], e xp r1D 8 2 SBB [X+expr], AC, Z
24 7 2 AND [expr], A Z56 9 3 MOV [X+exp r] , exp r1E 9 3 SBB [expr], exprC, Z
25 8 2 AND [X+expr], A Z57 4 2 MOV X, expr1F 10 3 SBB [X+expr], exprC, Z
26 9 3 AND [expr], exprZ58 6 2 MOV X, [expr]00 15 1 SSC
27 10 3 AND [X+expr], exprZ59 7 2 MOV X, [X+expr]11 4 2 SUB A, exprC, Z
70 4 2 AND F, exprC, Z5A 5 2 MOV [expr], X12 6 2 SUB A, [expr]C, Z
41 9 3 AND reg[expr], exprZ5B 4 1 MOV A, XZ13 7 2 SUB A, [X+expr]C, Z
42 10 3 AND reg[X+expr], exprZ5C 4 1 MOV X, A14 7 2 SUB [expr], AC, Z
64 4 1 ASL AC, Z5D 6 2 MOV A, reg[expr]Z15 8 2 SUB [X+expr], AC, Z
65 7 2 ASL [expr]C, Z5E 7 2 MOV A, reg[X+expr]Z16 9 3 SUB [expr], exprC, Z
66 8 2 ASL [X+expr]C, Z5F 10 3 MOV [expr], [e xp r ]17 10 3 SUB [X+expr], exprC, Z
67 4 1 ASR AC, Z60 5 2 MOV reg[expr], A4B 5 1 SWAP A, XZ
68 7 2 ASR [expr]C, Z61 6 2 MOV reg[X+expr], A4C 7 2 SWAP A, [expr]Z
69 8 2 ASR [X+expr]C, Z62 8 3 MOV reg[expr], expr4D 7 2 SWAP X, [expr]
9x 11 2 CALL63 9 3 MOV reg[X+expr], expr4E 5 1 SWAP A, SPZ
39 5 2 CMP A, expr
3A 7 2 CMP A, [expr]3F 10 2 MVI [ [expr]++ ], A48 9 3 TST [X+expr], exprZ
3B 8 2 CMP A, [X+expr]40 4 1 NOP49 9 3 TST reg[expr], exprZ
3C 8 3 CMP [expr], expr29 4 2 OR A, exprZ4A 10 3 TST reg[X+expr], exprZ
3D 9 3 CMP [X+expr], expr2A 6 2 OR A, [expr]Z72 4 2 XOR F, exprC, Z
73 4 1 CPL AZ2B 7 2 OR A, [X+expr]Z31 4 2 XOR A, exprZ
78 4 1 DEC AC, Z2C 72 OR [expr], AZ32 6 2 XOR A, [expr]Z
79 4 1 DEC XC, Z2D 82 OR [X+expr], AZ33 7 2 XOR A, [X+expr]Z
7A 7 2 DEC [expr]C, Z2E 93 OR [expr], exprZ34 7 2 XOR [expr], AZ
7B 8 2 DEC [X+expr]C, Z2F 10 3 OR [X+expr], exprZ35 8 2 XOR [X+expr], AZ
30 9 1 HALT43 9 3 OR reg[expr], exprZ36 9 3 XOR [expr], exprZ
74 4 1 INC AC, Z44 10 3 OR reg[X+expr], exprZ37 10 3 XOR [X+expr], exprZ
75 4 1 INC XC, Z71 4 2 OR F, exprC, Z45 9 3 XOR reg[expr], exprZ
Note 1 Interrupt acknowledge to Interrupt Vector table = 13 cycles.46 10 3 XOR reg[X+expr], exprZ
Note 2 The number of cycles required by an instruction is increased by one for instructions that span
Instruction FormatFlags
3E 10 2 MVI A, [ [expr]++ ]Z47 8 3 TST [expr], exprZ
if (A=B) Z=1
if (A<B) C=1
256 byte page boundaries in the Flash memory space.
Cycles
Opcode Hex
Bytes
Instruction FormatFlags
Cycles
Opcode Hex
Bytes
Instruction FormatFlags
Document # 001-20559 Rev. *D37
CPU Core (M8C)
2.5Instruction Formats
The M8C has a total of seven instruction formats which use
instruction lengths of one, two, and three bytes. All instruction bytes are fetched from the program memory (Flash),
using an address and data bus that are independent from
the address and data buses used for register and RAM
access.
While examples of instructions are given in this section,
refer to the PSoC Designer Assembly Language User Guide
for detailed information on individual instructions.
2.5.1One-Byte Instructions
Many instructions, such as some of the MOV instructions,
have single-byte forms because they do not use an address
or data as an operand. As shown in Table 2-3, one-byte
instructions use an 8-bit opcode. The set of one-byte
instructions can be divided into four categories, according to
where their results are stored.
Table 2-3. One-Byte Instruction Format
Byte 0
8-Bit Opcode
The first category of one-byte instructions are those that do
not update any registers or RAM. Only the one-byte NOP
SSC instructions fit this category. While the program
and
counter is incremented as these instructions execute, they
do not cause any other internal M8C registers to be
updated, nor do these instructions directly affect the register
space or the RAM address space. The SSC instruction
causes SROM code to run, which modifies RAM and the
M8C internal registers.
The second category has only the two PUSH instructions in
it. The PUSH instructions are unique, because they are the
only one-byte instructions that cause a RAM address to be
modified. These instructions automatically increment the SP.
The third category has only the HALT instruction in it. The
HALT instruction is unique, because it is the only one-byte
instruction that causes a user register to be modified. The
HALT instruction modifies user register space address FFh
(CPU_SCR register).
The final category for one-byte instructions are those that
cause updates of the internal M8C registers. This category
holds the largest number of instructions:
DEC, INC, MOV, POP, RET, RETI, RLC, ROMX, RRC,
SWAP. These instructions can cause the A, X, and SP regis-
ters or SRAM to update.
ASL, ASR, CPL,
2.5.2Two-Byte Instructions
The majority of M8C instructions are two bytes in length.
While these instructions can be divided into categories identical to the one-byte instructions, this would not provide a
useful distinction between the three two-byte instruction formats that the M8C uses.
The first two-byte instruction format, shown in the first row of
Table 2-4, is used by short jumps and calls: CALL, JMP,
JACC, INDEX, JC, JNC, JNZ, JZ. This instruction format
uses only four bits for the instruction opcode, leaving 12 bits
to store the relative destination address in a two’s-complement form. These instructions can change program execution to an address relative to the current address by -2048 or
+2047.
The second two-byte instruction format, shown in the second row of Table 2-4, is used by instructions that employ the
Source Immediate addressing mode (see “Source Immedi-
ate” on page 39). The destination for these instructions is an
internal M8C register, while the source is a constant value.
An example of this type of instruction would be
The third two-byte instruction format, shown in the third row
of Table 2-4, is used by a wide range of instructions and
addressing modes. The following is a list of the addressing
modes that use this third two-byte instruction format:
■ Source Direct (ADD A, [7])
■ Source Indexed (ADD A, [X+7])
■ Destination Direct (ADD [7], A)
■ Destination Indexed (ADD [X+7], A)
■ Source Indirect Post Increment (MVI A, [7])
■ Destination Indirect Post Increment (MVI [7], A)
For more information on addressing modes see “Addressing
Modes” on page 39.
ADD A, 7.
38Document # 001-20559 Rev. *D
CPU Core (M8C)
2.5.3Three-Byte Instructions
The first instruction format, shown in the first row of
Table 2-5, is used by the LJMP and LCALL instructions.
The three-byte instruction formats are the second most
prevalent instruction formats. These instructions need three
bytes because they either move data between two
addresses in the user-accessible address space (registers
and RAM) or they hold 16-bit absolute addresses as the
destination of a long jump or long call.
These instructions change program execution unconditionally to an absolute address. The instructions use an 8-bit
opcode, leaving room for a 16-bit destination address.
The second three-byte instruction format, shown in the second row of Table 2-5, is used by the following two addressing modes:
The third three-byte instruction format, shown in the third
row of Table 2-5, is for the Destination Direct Source Direct
addressing mode, which is used by only one instruction.
This instruction format uses an 8-bit opcode followed by two
8-bit addresses. The first address is the destination address
in RAM, while the second address is the source address in
RAM. The following is an example of this instruction:
MOV [7], [5]
2.6Addressing Modes
The M8C has ten addressing modes. These modes are detailed and located on the following pages:
■ “Source Immediate” on page 39.
■ “Source Direct” on page 40.
■ “Source Indexed” on page 40.
■ “Destination Direct” on page 41.
■ “Destination Indexed” on page 41.
■ “Destination Direct Source Immediate” on page 41.
■ “Destination Indexed Source Immediate” on page 42.
■ “Destination Direct Source Direct” on page 42.
■ “Source Indirect Post Increment” on page 43.
■ “Destination Indirect Post Increment” on page 43.
2.6.1Source Immediate
For these instructions, the source value is stored in operand 1 of the instructi on. The result of th ese instructions i s placed in
either the M8C A, F, or X register as indicated by the instruction’s opcode. All instructions using the Source Immediate
addressing mode are two bytes in length.
Table 2-6. Source Immediate
OpcodeOperand 1
InstructionImmediate Value
Source Immediate Examples:
Source CodeMachine CodeComments
ADDA, 701 07The immediate value 7 is added to the Accumulator. The result is placed
in the Accumulator.
MOVX, 857 08The immediate value 8 is moved to the X register.
ANDF, 970 09The immediate value 9 is logically AND’ed with the F register and the
result is placed in the F register.
Document # 001-20559 Rev. *D39
CPU Core (M8C)
2.6.2Source Direct
For these instructions, the source address is stored in operand 1 of the instruction. During instruction execution, the address
is used to retrieve the source value from RAM or register address space. The result of these instructions is placed in either
the M8C A or X register as indicated by the instruction’s opcode. All instructions using the Source Direct addressing mode are
two bytes in length.
Table 2-7. Source Direct
OpcodeOperand 1
InstructionSource Address
Source Direct Examples:
Source CodeMachine CodeComments
ADDA, [7]02 07The value in memory at address 7 is added to the Accumulator and the
result is placed in the Accumulator.
MOVA, REG[8]5D 08The value in the register space at address 8 is moved to the Accumulator.
2.6.3Source Indexed
For these instructions, the source offset from the X register is stored in operand 1 of the instruction. During instruction execution, the current X register value is added to the signed offset, to determine the address of the source value in RAM or register
address space. The result of these instructions is placed in either the M8C A or X register a s indicated by the instruction’s
opcode. All instructions using the Source Indexed addressing mode are two bytes in length.
Table 2-8. Source Indexed
OpcodeOperand 1
InstructionSource Index
Source Indexed Examples:
Source CodeMachine CodeComments
ADDA, [X+7]03 07The value in memory at address X+7 is added to the Accumulator. The
result is placed in the Accumulator.
MOVX, [X+8]59 08The value in RAM at address X+8 is moved to the X register.
40Document # 001-20559 Rev. *D
CPU Core (M8C)
2.6.4Destination Direct
For these instructions, the destination address is stored in the machine code of the instruction. The source for the operation is
either the M8C A or X register as indicated by the instruction’s opcode. All instructions using the Destination Direct addressing mode are two bytes in length.
Table 2-9. Destination Direct
OpcodeOperand 1
InstructionDestination Address
Destination Direct Examples:
Source CodeMachine CodeComments
ADD[7], A04 07The value in the Accumulator is added to memory at address 7. The
result is placed in memory at address 7. The Accumulator is unchanged.
MOVREG[8], A60 08The Accumulator value is moved to register space at address 8. The
Accumulator is unchanged.
2.6.5Destination Indexed
For these instructions, the destination offset from the X register i s stored in th e machine code for the instruction. The source
for the operation is either the M8C A register or an immediate value as indicated by the i nstruction’s opcode. All instructions
using the Destination Indexed addressing mode are two bytes in length.
Table 2-10. Destination Indexed
OpcodeOperand 1
InstructionDestination Index
Destination Indexed Example:
Source CodeMachine CodeComments
ADD[X+7], A05 07The value in memory at address X+7 is added to the Accumulator. The
result is placed in memory at address X+7. The Accumulator is
unchanged.
2.6.6Destination Direct Source Immediate
For these instructions, the destination address is stored in operand 1 of the instruction. The source value is stored in operand
2 of the instruction. All instructions using the Destination Direct Source Immediate addressing mode are three bytes in length.
Table 2-11. Destination Direct Source Immediate
OpcodeOperand 1Operand 2
InstructionDestination AddressImmediate Value
Destination Direct Source Immediate Examples:
Source CodeMachine CodeComments
ADD[7], 506 07 05The value in memory at address 7 is added to the immediate value 5. The
result is placed in memory at address 7.
MOVREG[8], 662 08 06The immediate value 6 is moved to register space at address 8.
Document # 001-20559 Rev. *D41
CPU Core (M8C)
2.6.7Destination Indexed Source Immediate
For these instructions, the destination offset from the X register is stored in operand 1 of the instruct ion. The source value is
stored in operand 2 of the instruction. All instructions using the Destination Indexed Source Immediate addressing mo de are
three bytes in length.
Table 2-12. Destination Indexed Source Immediate
OpcodeOperand 1Operand 2
InstructionDestination IndexImmediate Value
Destination Indexed Source Immediate Examples:
Source CodeMachine CodeComments
ADD[X+7], 507 07 05The value in memory at address X+7 is added to the immediate value 5.
The result is placed in memory at address X+7.
MOVREG[X+8], 663 08 06The immediate value 6 is moved to the register space at address X+8.
2.6.8Destination Direct Source Direct
Only one instruction uses this addressing mode. The destination address is stored in operand 1 of the instruction. The source
address is stored in operand 2 of the instruction. The instruction using the Destination Direct Source Direct addressin g mode
is three bytes in length.
Table 2-13. Destination Direct Source Direct
OpcodeOperand 1Operand 2
InstructionDestination AddressSource Address
Destination Direct Source Direct Example:
Source CodeMachine CodeComments
MOV[7], [8]5F 07 08The value in memory at address 8 is moved to memory at address 7.
42Document # 001-20559 Rev. *D
CPU Core (M8C)
2.6.9Source Indirect Post Increment
Only one instruction uses this addressing mode. Th e source address stored in operand 1 is actually the address of a pointer.
During instruction execution, the pointer ’s current value is read to determine the address in RAM where the source value is
found. The pointer’s value is incremented after the source value is read. For PSoC microcontrollers with more than 256 bytes
of RAM, the Data Page Read (MVR_PP) register is used to determine which RAM page to use with the source address.
Therefore, values from pages other than the current page can be retrieved without changing the Current Page Pointer
(CUR_PP). The pointer is always read from the current RAM page. For information on the MVR_PP and CUR_PP registers,
see the Register Details chap ter on page 47 . The instruction using the Source Indirect Post Increment addressing mode is
two bytes in length.
Table 2-14. Source Indirect Post Incremen t
OpcodeOperand 1
InstructionSource Address Pointer
Source Indirect Post Increment Example:
Source CodeMachine CodeComments
MVIA, [8]3E 08The value in memory at address 8 (the indirect address) points to a mem-
ory location in RAM. The value at the memory location, pointed to by the
indirect address, is moved to the Accumulator. The indirect address, at
address 8 in memory, is then incremented.
2.6.10Destination Indirect Post Increment
Only one instruction uses this addressing mode. The destination address store d in operand 1 is actually the address of a
pointer. During instruction execution, the pointer’s current value is read to determine the destination address in RAM where
the Accumulator’s value is stored. The pointer’s value is incremented after the value is written to the destination address. For
PSoC microcontrollers with more than 256 bytes of RAM, the Data Page Write (MVW_PP) register is used to determine which
RAM page to use with the destination address. Therefore, values can be stored in pages other than the current page without
changing the Current Page Pointer (CUR_PP). The pointer is always read from the current RAM page. For information on the
MVR_PP and CUR_PP registers, see the Register Details chapter on page 47. T he instructio n using the Destination Indirect
Post Increment addressing mode is two bytes in length.
Table 2-15. Destination Indirect Post Increment
OpcodeOperand 1
InstructionDestination Address Pointer
Destination Indirect Post Increment Example:
Source CodeMachine CodeComments
MVI[8], A3F 08The value in memory at address 8 (the indirect address) points to a mem-
ory location in RAM. The Accumulator value is moved to the memory
location pointed to by the indirect address. The indirect address, at
address 8 in memory, is then incremented.
Document # 001-20559 Rev. *D43
CPU Core (M8C)
2.7Register Definitions
The following register is associated with the CPU Core (M8C). The register description has an associated register table showing the bit structure. The bits that are grayed out in the table are reserved bits and are not detailed in the register descrip tion
that follows. Reserved bits should always be written with a value of ‘0’.
L The AND F, expr; OR F, expr; and XOR F, expr flag instructions can be used to modify this register.
x An “x” before the comma in the address field indicate s that this register can be read or written to no matter what bank is used.
CPU_F
PgMode[1:0]XIOCarryZeroGIERL : 02
The M8C Flag Register (CPU_F) provides read access to
the M8C flags.
Bits 7 and 6: PgMode[1:0]. PgMode determines how the
CUR_PP, STK_PP, and IDX_PP registers are used in forming effective RAM addresses for Direct Address mode and
Indexed Address mode operands. PgMode also determin es
whether the stack page is determined by the STK_PP or
IDX_PP register.
Bit 4: XIO. The IO Bank Select bit, also known as the register bank select bit, is used to select the register bank that is
active for a register read or write. This bit allows the PSoC
device to have 512 8-bit registers and therefore, can be
thought of as the ninth address bit for registers. The address
space accessed when the XIO bit is set to ‘0’ is called the
user space, while the address space accessed when the
XIO bit is set to ‘1’ is called the configura t ion space.
Bit 2: Carry. The Carry flag bit is set or cleared in response
to the result of several instructions. It can also be manipulated by the flag-logic opcodes (for example, OR F, 4). See
the PSo C Designer Assembly Guide User Manual for more
details.
Bit 1: Zero. The Zero flag bit is set or cleared in response
to the result of several instructions. It can also be manipulated by the flag-logic opcodes (for example, OR F, 2). See
the PSoC Design er Assembly Guide User Manual for more
details.
Bit 0: GIE. The state of the Global Interrupt Enable bit
determines whether interrupts (by way of the interrupt
request (IRQ)) are recognized by the M8C. This bit is set or
cleared by the user, using the flag-logic instructions (for
example, OR F, 1). GIE is also cleared automatically when
an interrupt is processed, after the flag byte has been stored
on the stack, preventing nested interrupts. If desired, the bit
can be set in an interrupt service routine (ISR).
For GIE=1, the M8C samples the IRQ input for each instruction. For GIE=0, the M8C ignores the IRQ.
For additional information, refer to the CPU_F register on
page 120.
44Document # 001-20559 Rev. *D
3.Supervisory ROM (SROM)
This chapter discusses the Supervisory ROM (SROM) functions and its associated registers. For a complete table of the
SROM registers, refer to the “Summary Table of th e Core Registers” on page 32. For a quick reference of all PSoC registers
in address order, refer to the Register Details chapter on page 47.
3.1Architectural Description
The SROM holds code that is used to boot the PSoC
device, calibrate circuitry, and perform Flash operations.
The functions provided by the SROM are called from code
stored in the Flash or by device programmers.
The SROM is used to boot the part and provide interface
functions to the Flash banks. (Table 3-1 lists the SROM
functions.) The SROM functions are accessed by executing
the Supervisory System Call instruction (SSC) which has an
opcode of 00h. Before executing the SSC, the M8C’s accu-mulator needs to load with the desired SROM function code
from Table 3-1.
Attempting to access undefined functions causes a halt. The
SROM functions execute code with calls; therefore, the
functions require stack space. With the exception of Reset,
all of the SROM functions have a parameter block in
SRAM that you must configure before executing the SSC.
Table 3-2 lists all possible parameter block variables. The
meaning of each parameter, with regards to a specific
SROM function, is described later in this chapter. Because
the SSC instruction clears the CPU_F PgMode bits, all
parameter block variable addresses are in SRAM Page 0.
The CPU_F value is automatically restored at the end of the
SROM function.
Note For PSoC devices with more than 256 bytes of SRAM
(that is, more than 1 page of SRAM, see the table titled
“PSoC Device SRAM Availability, on page 55”), the
MVR_PP and the MVW_PP pointers are not disabled by
clearing the CPU_F PgMode bits. Therefore, the POINTER
parameter is interpreted as an address in the page indicated
by the MVI page pointers, when the supervisory operation is
called. This allows the data buffer used in the supervisory
operation to be located in any SRAM page. (See the RAM
Paging chapter on page 55 for more details regarding the
Note ProtectBlock (described on page 49) and EraseAll (described on page
Stack Sp ace
Needed
Page
46
47
48
48
49
50
50
50
49) SROM functions are not listed in the table above because they depend
upon external programming.
Two important variables that are used for all functions are
KEY1 and KEY2. These variables are used to help discriminate between valid SSCs and inadvertent SSCs. KEY1 must
always have a value of 3Ah, while KEY2 must have the
same value as the stack pointer (SP) when the SROM function begins execution. This would be the SP value when the
SSC opcode is executed, plus three. For all SROM functions except SWBootReset, if either of the keys do not
match the expected values, the M8C halts. The SWBootReset function does not check the key values. It only checks to
see if the accumulator’s value is 0x00. Th e following code
example puts the correct value in KEY1 and KEY2. The
code is preceded by a HALT, to force the program to jump
directly into the setup code and not accidentally run into it.
The SROM has the following additional feature.
Return Codes: These aid in the determination of success
or failure of a particular function. The return code is stored in
KEY1’s position in the parameter block. The CheckSum and
TableRead functions do not have return codes because
KEY1’s position in the parameter block is used to return
other data.
Table 3-3. SROM Return Code Descriptions
Return Code ValueDescription
00hSuccess
01hFunction not allowed due to level of pr otection on
02hSoftware reset without hardware reset.
03hFatal error, SROM halted.
the block.
The SWBootReset function is executed whenever the
SROM is entered with an M8C accumulator value of 00h;
the SRAM parameter block is not used as an input to the
function. This happens, by design, after a hardware reset,
because the M8C's accumulator is reset to 00h or when
user code executes the SSC instruction with an accumulator
value of 00h.
If the checksum of the calibration data is valid, the
SWBootReset function ends by setting the internal M8C registers (CPU_SP, CP U_PC, CPU_X, CPU_F, CPU_A) to 00h
writing 00h to most SRAM addresses in SRAM Page 0 and
then begins to execute user code at address 00 00h. (See
Table 3-4 and the followin g paragraphs for more in forma tion
on which SRAM addresses are modified.) If the checksum is
not valid, an internal reset is executed and the boot process
starts over. If this condition occurs, the internal reset status
bit (IRESS) is set in the CPU_SCR1 register.
Table 3-4 documents the value of all the SRAM addresses in
Page 0 after a successful SWBootReset. A cell in the table
with “xx” indicates that the SRAM address is not modified by
the SWBootReset function. A hex value in a cell indicates
that the address should always have the indicated value
after a successful SWBootReset. A cell with a “??” in it indicates that the value, after a SWBootReset, is determined by
the value of IRAMDIS bit in the CPU_SCR1 register. If
IRAMDIS is not set, these addresses are initialized to 00h. If
IRAMDIS is set, these addresses are not modified by a
SWBootReset after a watchdog reset.
The IRAMDIS bit allows variables to be preserved even if a
watchdog reset (WDR) occurs. The IRAMDIS bit is reset by
all system resets except watchdog reset. Therefore, this bit
is only useful for watchdog resets and not general resets.
Note Read, write, and erase operations may fail if the target
block is read or write protected. Block protection levels are
set during device programming and cannot be modified from
code in the PSoC device.
3.1.2SROM Function Descriptions
3.1.2.1SWBootReset Function
The SROM function SWBootReset is responsible for transitioning the device from a reset state to running user code.
See “System Resets” on page 313 for more information on
what events cause the SWBootReset function to execute.
Address F8h is the return code byte for all SROM functions
(except Checksum and TableRead); for this function, the
only acceptable values are 00h and 02h. Address FCh is the
fail count variable. After POR (Power on Reset) or WDR, or
XRES (External Reset), the variable is initialized to 00h by
the SROM. Each time the checksum fails, the fail count is
incremented. Therefore, if it takes two passes through
SWBootReset to get a good checksum, the fail count would
be 01h.
3.1.2.2ReadBlock Function
The ReadBlock function is used to read 64 contiguous bytes
from Flash: a block. The number of blocks in a device is the
total number of bytes divided by 64. Refer to Table 3-5 to
determine the amount of space in your PSoC device.
The first thing the ReadBlock function does is check the protection bits to determine if the desired BLOCKID is readable.
If read protection is turned on, the ReadBlock function exits
setting the accumulator and KEY2 back to 00h. KEY1 has a
value of 01h, indicating a read failure.
If read protection is not enabled, the function reads 64 bytes
from the Flash using a ROMX instruction and stores the
results in SRAM using an MVI instruction. The 64 bytes are
stored in SRAM, beginning at the address indicated by the
value of the POINTER parameter. When the ReadBlock
completes successfully, the accumulator, KEY1, and KEY2
all have a value of 00h.
If the PSoC device has more than one bank of Flash, the
bank value in the FLS_PR1 register must be set prior to
executing the SSC instruction. Refer to Table 3-5.
Note MVI [expr], A is used to store the Flash block contents
in SRAM; thus, the MVW_PP register can be set to indicate
which SRAM pages receive the data.
Table 3-6. ReadBlock Parameters (01h)
NameAddressTypeDescription
MVW_PP0,D5hRegister MVI write page pointer register.
KEY10,F8hRAM3Ah.
KEY20,F9hRAMStack Pointer value+3, when SSC is
BLOCKID0,FAhRAMFlash block number.
POINTER0,FBhRAMAddresses in SRAM where returned
FLS_PR11,FAhRegister Flash bank number.
executed.
data should be stored.
Number of
Blocks
per Bank
Number of
Banks
Document # 001-20559 Rev. *D47
Supervisory ROM (SROM)
3.1.2.3WriteBlock Function
The WriteBlock function is used to store data in the Flash.
Data is moved 64 bytes at a time from SRAM to Flash using
this function. Before a write can be performed, either an
EraseAll or an EraseBlock must be completed successfully.
The first thing the WriteBlock function does is check the protection bits and determine if the desired BLOCKID is writeable. If write protection is turned on, the WriteBlock function
exits, setting the accumulator and KEY2 back to 00h. KEY1
has a value of 01h, indicating a write failure. Write protection
is set when the PSoC device is programmed externally and
cannot be changed through the SSC function.
The BLOCKID of the Flash block, where the data is stored,
must be determined and stored at SRAM address FAh. For
valid BLOCKID values, refer to Table 3-5.
An MVI A, [expr] instruction is used to move data from
SRAM into Flash. Therefore, the MVI read pointer (MVR_PP
register) can be used to specify which SRAM page data is
pulled from. Using the MVI read pointer and the parameter
blocks POINTER value allows the SROM WriteBlock function to move data from any SRAM page into any Flash
block, in either Flash bank.
The SRAM address, of the first of the 64 bytes to be stored
in Flash, must be indicated using the POINTER variable in
the parameter block (SRAM address FBh).
Finally, the CLOCK and DELAY value must be set correc tly.
The CLOCK value determines the length of the write pulse
that is used to store the data in the Flash. The CLOCK and
DELAY values are dependent on the CPU speed and must
be set correctly. Refer to “Clocking” on page 53 for additional information.
If the PSoC device you are using has more than one bank of
Flash, the bank value in the FLS_PR1 register must be set
prior to executing the SSC instruction. Refer to Table 3-5.
3.1.2.4EraseBlock Function
The EraseBlock function is used to erase a block of 64 contiguous bytes in Flash.
The first thing the EraseBlock function does is check the
protection bits and determine if the desired BLOCKID is
writeable. If write protection is turned on, the EraseBlock
function exits, setting the accumulator and KEY2 back to
00h. KEY1 has a value of 01h, indicating a write failure.
To set up the parameter block for the EraseBlock function,
correct key values must be stored in KEY1 and KEY2. The
block number to be erased must be stored in the BLOCKID
variable, and the CLOCK and DELAY values must be set
based on the current CPU speed. For more information on
setting the CLOCK and DELAY values, see “Clocking” on
page 53.
If the PSoC device you are using has more than one bank of
Flash, the bank value in the FLS_PR1 register must be set
prior to executing the SSC instruction. Refer to Table 3-5.
Table 3-8. EraseBlock Parameters (03h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah
KEY20,F9hRAMStack Pointer value+3, when SSC is
BLOCKID0,FAhRAMFlash block number.
CLOCK0,FChRAMClock divider used to set the erase
DELAY0,FEhRAMFor a CPU speed of 12 MHz, set to
FLS_PR11,FAhRegister Flash bank num b e r.
executed.
pulse width.
56h.
Table 3-7. WriteBlock Parameters (02h)
NameAddressTypeDescription
MVR_PP0,D4hRegister MVI read page pointer register.
KEY10,F8hRAM3Ah.
KEY20,F9hRAMSta ck Pointer value+3, when SSC is
BLOCKID0,FAhRAMFlash block number.
POINTER0,FBhRAMFirst of 64 addresses in SRAM, where
CLOCK0,FChRAMClock divider used to set the write pulse
DELAY0,FEhRAMFor a CPU speed of 12 MHz, set to 56h.
FLS_PR11,FAhRegister Flash bank number.
executed.
the data to be stored in Flash is located
prior to calling WriteBlock.
width.
48Document # 001-20559 Rev. *D
Supervisory ROM (SROM)
3.1.2.5ProtectBlock Function
The PSoC devices offer Flash protection on a block-byblock basis. Table 3-9 lists the protection modes a vailable.
In the table, ER and EW are used to indicate the ability to
perform external reads and writes (that is, by an external
programmer). For internal writes, IW is used. Internal reading is always permitted by way of the ROMX instruction. The
ability to read by way of the SROM ReadBlock function is
indicated by SR.
In the table below, note that all protection is removed by
EraseAll.
Table 3-9. ProtectBlock Modes
ModeSettingsDescriptionIn PSoC Designer
00bSR ER EW IWUnprotectedU = Unprotected
01bSR
10bSR
11bSR
ER EW IWRead protectF = Factory upgrade
ER EW IWDisable external writeR = Field upgrade
ER EW IWDisable internal writeW = Full protection
3.1.2.6TableRead Function
The TableRead function gives the user access to part-specific data stored in the Flash during manufacturing. The
Flash for these tables is separate from the program Flash
and is not directly accessible.
One of the uses of the SROM TableRead function is to
retrieve the values needed to optimize Flash programming
for temperature. More information about how to use these
values may be found in the section titled “Clocking” on
page 53.
Table 3-10. TableRead Parameters (06h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah
KEY20,F9hRAMSt ack Pointer value+3, when SSC is
BLOCKID0,FAhRAMT able number to read.
executed.
3.1.2.7EraseAll Function
The EraseAll function performs a series of steps that
destroys the user data in the Flash banks and resets the
protection block in each Flash bank to all zero s (the unprotected state). This function may only be executed by an
external programmer. If EraseAll is executed from code, the
M8C halts without touching the Flash or protections.
Table 3-11. Flash Tables with Assigned Values in Flash Bank 0
F8hF9hFAhFBhFChFDhFEhFFh
Table 0S ilicon ID
Table 1Voltage
Table 2Voltage
Table 3M (cold)B (cold)Mult (cold)M (hot)B (hot)Mult (hot)00h01h
* CY8C24x94 and CY7C64215 Table 2: FAh = IMO Trim 2 for 3.3V , FBh = IMO Trim 2 for 5V.
Reference Trim
for 3.3V
reg[1,EA]
Reference Trim
for 2.7V
reg[1,EA]
IMO Trim
for 3.3V
reg[1,E8]
IMO Slow Trim
12 MHz
Vdd = 2.7V
Room
Temperature
Calibration
for 3.3V
Room
Temperature
Calibration
for 2.7V *
Hot
Temperature
Calibration
for 3.3V
Hot
Temperature
Calibration
for 2.7V *
Voltage
Reference Trim
for 5V
reg[1,EA]
IMO Slow Trim
6 MHz
Vdd = 3.3V
IMO Trim
for 5V
reg[1,E8]
IMO Slow Trim
6 MHz
Vdd = 2.7V
Room
Temperature
Calibration
for 5V
IMO Slow Trim
6 MHz
Vdd = 5.0V
Hot
Temperature
Calibration
for 5V
Document # 001-20559 Rev. *D49
Supervisory ROM (SROM)
3.1.2.8Checksum Function
The Checksum function calculates a 16-bit checksum over a
user specifiable number of blocks, within a single Flashbank starting at block zero. The BLOCKID parameter is
used to pass in the number of blocks to checksum. A
BLOCKID value of '1' calculates the checksum of only block
0, a BLOCKID of '2' calculates the checksum of block 0 and
block 1, and so on. A BLOCKID value of '0' calculates the
checksum of the entire flash bank. Note that if the BLOCKID
is greater than the number of blocks that the device has in a
flash bank, the function calculates the checksum for the
entire flash bank and repeats the checksum process again
from block 0 in that flash bank. For example, for the
CY8C24533 device, if the BLOCKID is equal to 150, the
function calculates checksum for block 0 to block 127 and
again for block 0 to block 21.
The 16-bit checksum is returned in KEY1 and KEY2. The
parameter KEY1 holds the lower 8 bits of the checksum and
the parameter KEY2 holds the upper 8 bits of the checksum.
For devices with multiple Flash banks, the checksum function must be called once for each Flash bank. The SROM
Checksum function operates on the Flash bank indicated by
the Bank bit in the FLS_PR1 register.
Table 3-12. Checksum Parameters (07h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah.
KEY20,F9hRAMStack Pointer value+3, when SSC is
BLOCKID0,FAhRAMNumber of Flash blocks to calculate
FLS_PR11,FAhRegister Flash bank number.
executed.
checksum on.
3.1.2.9Calibrate0 Function
The Calibrate0 function transfers the calibration values
stored in a special area of the Flash to their appropriate registers. This function may be executed at any time to set all
calibration values back to their 5V values. However, it
should not be necessary to call this function. This function is
simply documented for completeness. 3.3V calibration values are accessed by way of the TableRead function, which
is described in the section titled “TableRead Function” on
page 49.
Table 3-13. Calibrate0 Parameters (08h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah
KEY20,F9hRAMStack Pointer value+3, when SSC is
executed.
3.1.2.10Calibrate1 Function
While the Calibrate1 function is a completely separate function from Calibrate0, they perform the same function, which
is to transfer the calibration values stored in a special area
of the Flash to their appropriate registers. What is unique
about Calibrate1 is that it calculates a checksum of the calibration data and, if that checksum is determined to be
invalid, Calibrate1 causes a hardware reset by generating
an internal reset. If this occurs, it is indicated by setting the
Internal Reset Status bit (IRESS) in the CPU_SCR1 register.
The Calibrate1 function uses SRAM to calculate a checksum of the calibration data. The POINTER value is used to
indicate the address of a 30-byte buffer used by this function. When the function completes, the 30 bytes is set to
00h.
An MVI A, [expr] and an MVI [expr], A instruction are used to
move data between SRAM and Flash. Therefore, the MVI
write pointer (MVW_PP) and the MVI read pointer
(MVR_PP) must be specified to the same SRAM page to
control the page of RAM used for the operations.
Calibrate1 was created as a sub-function of SWBootReset
and the Calibrate1 function code was added to provide
direct access. For more information on how Calibrate1
works, see the SWBootReset section.
This function may be executed at any time to set all calibration values back to their 5V values. However, it should not
be necessary to call this function. This function is simply
documented for completeness. This function has no argument to select between 5V and 3.3V calibration values;
therefore, it always defaults to 5V values. 3.3V calibration
values are accessed by way of the TableRead function,
which is described in the section titled “TableRead Function”
on page 49.
Table 3-14. Calibrate1 Parameters (09h)
NameAddressTypeDescription
KEY10,F8hRAM3Ah
KEY20,F9hRAMStack Pointer value+3, when SSC is
The following registers are associated with the Supervisory ROM (SROM) and are listed in address order. The register
descriptions have an associated register table showing the bit structure for that register. The bits in the tables that are grayed
out are reserved bits and are not detailed in the register descriptions that follow. Reserved bits should always be written with
a value of ‘0’. For a complete table of SROM registers, refer to the “Summary Table of the Core Registers” on page 32.
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
# Access is bit specific. Refer to the
* Bits 3 and 2 (ECO EXW and ECO EX, respectively) cannot be used by the CY8C27x43 for silicon revision A, and by the CY8C24533, CY8C23533,
CY8C23433, CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
IRESSSLIMOECO EXW *ECO EX *IRAMDIS# : 00
Register Details chapter on page 47 for additional information.
The System Status and Control Register 1 (CPU_SCR1) is
used to convey the status and control of events related to
internal resets and watchdog reset.
Bit 7: IRESS. The Internal Reset Status bit is a read only bi t
that can be used to determine if the booting process
occurred more than once.
When this bit is set, it indicates that the SROM SWBootReset code was executed more than once. If this bit is not set,
the SWBootReset was executed only once. In either case,
the SWBootReset code does not allow execution from code
stored in Flash until the M8C Core is in a safe operating
mode with respect to supply voltage and Flash operation.
There is no need for concern when this bit is set. It is provided for systems that may be sensitive to boot time, so that
they can determine if the normal one-pass boot time was
exceeded.
Bit 4: SLIMO. When set, the Slow IMO bit allows the active
power dissipation of the PSoC device to be reduced by
slowing down the IMO from 24 MHz to 6 MHz. The IMO trim
value must also be changed when SLIMO is set. When not
in external clocking mode, the IMO is the source for SYSCLK; therefore, when the speed of the IMO changes, so
does SYSCLK.
Bit 3: ECO EXW. The ECO Exists Written bit is used as a
status bit to indicate that the ECO EX bit has been previously written to. It is read only. Note that this bit cannot be
used by the CY8C27x43 for silicon revision A, and by the
CY8C24533, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, and CY8C22x13 PSoC devices.
Bit 2: ECO EX. The ECO Exists bit serves as a flag to the
hardware, to indicate that an external crystal oscillator
exists in the system. Just after boot, it may be written only
once to a value of ‘1’ (crystal exists) or ‘0’ (crystal does not
exist). If the bit is ‘0’, a switch-over to the ECO is locked out
by hardware. If the bit is ‘1’, hardware allows the firmware to
freely switch between the ECO and ILO. It should be written
as early as possible after a Power On Reset (POR) or
External Reset (XRES) event, where it is assumed that program execution integrity is high. Note that this bit cannot be
used by the CY8C27x43 for silicon revision A, and by the
CY8C24533, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, and CY8C22x13 PSoC devices.
Bit 0: IRAMDIS. The Initialize RAM Disable bit is a control
bit that is readable and writeable. The defaul t value for this
bit is ‘0’, which indicates that the maximum amount of SRAM
should be initialized on watchdog reset to a value of 00h.
When the bit is ‘1’, the minimum amount of SRAM i s initialized after a watchdog reset. For more information on this bit,
see the “SROM Function Descriptions” on page 4 6.
For additional information, refer to the CPU_SCR1 register
The Flash Program Register 1 (FLS_PR1) is used to specify
which Flash bank should be used for SROM operations.
Note This register has no effect on products with one Flash
bank. Refer to the table titled “Flash Memory Organization”
on page 47 to determine the number of Flash banks in
PSoC devices.
Bits 1 and 0: Bank[1:0]. The Bank bits in this register indicate which Flash bank the SROM Flash functions should
operate on. The default value for the Bank bit is zero. Flash
bank 0 holds up to the first 8K of user code, as wel l as the
cal table. The optional Flash banks 1, 2, and 3 hold additional user code.
For additional information, refer to the FLS_PR1 register on
Successful programming and erase operations, on the
Flash, require that the CLOCK and DELAY parameters be
set correctly. To determine the proper value for the DELAY
parameter only, the CPU speed must be considered. However, three factors should be used to determine the proper
value for CLOCK: operating temperature, CPU speed, and
characteristics of the individual device. Equations and additional information on calculating the DELAY and CLOCK values follow.
3.3.1DELA Y Parameter
To determine the proper value for the DELAY parameter, the
CPU speed during the Flash operation must be considered.
Equation 1 displays the equation for calculating DELAY
based on a CPU speed value. In this equation the units for
CPU are hertz (Hz).
Equation 1
Equation 2 shows the calculation of the DELAY value for a
CPU speed of 12 MHz. The numerical result of this calculation should be rounded to the nearest whole number. In the
case of a 12 MHz CPU speed, the correct value for DELAY
is 86 (0x56).
Equation 3
Using the correct values for B, M, and T, in the equation
above, is required to achieve the endura nce specifications
of the Flash. However, for device programmers, where this
calculation may be difficult to perform, the equation can be
simplified by setting T to 0°C and using the hot value for B
and M. This simplification is acceptable only if the total number of erase write cycles are kept to less than 10 and the
operation is performed near room temperature. When T is
set to 0, Equation 3 simplifies to the following.
Equation 4
Once a value for the erase CLOCK value has been determined, the write CLOCK value can be calculated. The equation to calculate the CLOCK value for a write is as follows.
Equation 5
In the equation above, the correct value for Mult must be
determined, based on temperature, in the same way that the
B and M values were determined for Equation 3.
Equation 2
3.3.2CLOCK Parameter
The CLOCK parameter must be calculated using different
equations for erase and write operations. The erase value
for CLOCK must be calculated first. In Equation 3, the erase
CLOCK value is indicated by a subscript E after the word
CLOCK and the write CLOCK value is indicated by a subscript W after the word CLOCK.
Before either CLOCK value can be calculated, the values for
M, B, and Mult must be determined. These are device specific values that are stored in the Flash table 3 and are
accessed by way of the TableRead SROM function (see the
“TableRead Function” on page 49). If the operating tempera-
ture is at or below 0°C, the cold values should be used. For
operating temperatures at or above 0°C, the hot values
should be used. See Table 3-11 for more information.
Equations for calculating the correct value of CLOCK for
write operations are first introduced with the assumption that
the CPU speed is 12 MHz.
The equation for calculating the CLOCK value for an erase
Flash operation is shown in Equation 3. In this equation the
T has units of °C.
Document # 001-20559 Rev. *D53
Supervisory ROM (SROM)
54Document # 001-20559 Rev. *D
4.RAM Paging
Page 0
SRAM
256 Bytes
ISR
Page 6
SRAM
256 Bytes
Page 5
SRAM
256 Bytes
Page 3
SRAM
256 Bytes
Page 2
SRAM
256 Bytes
Page 1
SRAM
256 Bytes
Page 7
SRAM
256 Bytes
Page 4
SRAM
256 Bytes
00h
FFh
This chapter explains the PSoC device’s use of RAM Paging and its associated re gisters. For a complete table of the RAM
Paging registers, refer to the “Summary Table of the Core Registers” on page 32. For a quick reference of all PSoC registers
in address order, refer to the Register Details chapter on page 47.
4.1Architectural Description
The M8C is an 8-bit CPU with an 8-bit address bus. The 8bit memory address bus allows the M8C to access up to 256
bytes of SRAM, to increase the amount of available SRAM
and preserve the M8C assembly language.
The memory paging architecture consists of five areas:
■ Stack Operations
■ Interrupts
■ MVI Instructions
■ Current Page Pointer
■ Indexed Memory Page Pointer
The first three of these areas have no dependency on the
CPU_F register's PgMode bits and are covered in the next
subsections after Basic Paging. The function of the last two
depend on the CPU_F PgMode bits and are covered last.
4.1.1Basic Paging
The M8C is an 8-bit CPU with an 8-bit memory address bus.
The memory address bus allows the M8C to access up to
256 bytes of SRAM. To increase the amount of SRAM, the
M8C accesses memory page bits. The memory page bits
are located in the CUR_PP register and allow for selection
of one of eight SRAM pages. In addition to setting the page
bits, Page mode must be enabled by setting the CPU_F[7]
bit. If Page mode is not enabled, the page bits are ignored
and all non-stack memory access is directed to Page 0.
Once Page mode is enabled and the page bits are set, all
instructions that operate on memory access the SRAM page
indicated by the page bits. The exceptions to this are the
instructions that operate on the stack and the MVI instructions: PUSH, POP, LCALL, RETI, RET, CALL, and MVI.
See the description of Stack Operations and MVI Instructions below for a more detailed discussion.
Figure 4-1. Data Memory Organization
Document # 001-20559 Rev. *D55
RAM Paging
4.1.2Stack Operations
As mentioned previously, the paging architecture's reset
state puts the PSoC in a mode that is identical to that of a
256 byte PSoC device. Therefore, upon rest, all memory
accesses are to Page 0. The SRAM page that stack operations uses is determined by the value of the three least significant bits of the Stack Page Pointer register (STK_PP).
Stack operations have no dependency on the PgMode bits
in the CPU_F register. Stack operations are those that use
the Stack Pointer (SP) to calculate their affected address.
Refer to the PSoC Designer Assembly Language UserGuide for more information on all M8C instructions.
Stack memory accesses must be treated as a special case.
If they are not, the stack could be fragmented across several
pages. To prevent the stack from becoming fragmented, all
instructions that operate on the stack automatically use the
page indicated by the STK_PP register. Therefore, if a CALL
is encountered in the program, the PSoC device automatically pushes the program counter onto the stack page indicated by STK_PP. Once the program counter is pushed, the
SRAM paging mode automatically switches back to the precall mode. All other stack operations, such as RET and POP,
follow the same rule as CALL. The stack is confined to a single SRAM page and the SP wraps from 00h to FFh and FFh
to 00h. The user code must ensure that the stack is not
damaged due to stack wrapping.
Because the value of the STK_PP register can be changed
at any time, it is theoretically possible to manage the stack in
such a way as to allow it to grow beyond one SRAM page or
manage multiple stacks. However, the only supported use of
the STK_PP register is when its value is set prior to the first
stack operation and not changed again.
4.1.3Interrupts
Interrupts, in a multi-page SRAM PSoC device, operate the
same as interrupts in a 256 byte PSoC device. However,
because the CPU_F register is automatically set to 0x00 on
an interrupt and because of the non-linear nature of interrupts in a system, other parts of the PSoC memory paging
architecture can be affected.
Interrupts are an abrupt change in program flow. If no special action is taken on interrupts by the PSoC device, the
interrupt service routine (ISR) could be thrown into any
SRAM page. To pre vent this problem, the special addressing modes for all memory accesses, except for stack and
MVI, are disabled when an ISR is entered. The special
addressing modes are disabled when the CUP_F register is
cleared. At the end of the ISR, the previous SRAM addressing mode is restored when the CPU_F register value is
restored by the RETI instruction.
Therefore, all interrupt service routine code starts execution
in SRAM Page 0. If it is necessary for the ISR to change to
another SRAM page, it can be accomplished by changing
the values of the CPU_F[7:6] bits to enable the special
SRAM addressing modes. However, any change made to
the CUR_PP, IDX_PP, or STK_PP registers persist after the
ISR returns. Therefore, the ISR should save the current
value of any paging register it modifies and restore its value
before the ISR returns.
4.1.4MVI Instructions
MVI instructions use data page pointers of their own
(MVR_PP and MVW_PP). This allows a data buffer to be
located away from other program variables, but accessible
without changing the Current Page Pointer register
(CUR_PP).
An MVI instruction performs three memory operations. Both
forms of the MVI instruction access an address in SRAM
that holds the data pointer (a memory read 1st access),
incrementing that value and then storing it back in SRAM (a
memory write 2nd access). This pointer value must reside in
the current page, just as all other non-stack and nonindexed operations on memory must. However, the third
memory operation uses the MVx_PP register. This third
memory access can be either a read or a write, depending
on which MVI instruction is used. The MVR_PP pointer is
used for the MVI instruction that moves data into the accumulator. The MVW_PP pointer is used for the MVI instruction that moves data from the accumulator into SRAM. The
MVI pointers are always enabled, regardless of the state of
the Flag register page bits (CPU_F register).
4.1.5Current Page Pointer
The Current Page Pointer is used to determine which SRAM
page should be used for all memory accesses. Normal
memory accesses are those not covered by other pointers
including all non-stack, non-MVI, and non-indexed memory
access instructions. The normal memory access instructions
have the SRAM page they operate on determined by the
value of the CUR_PP register. By default, the CUR_PP register has no affect on the SRAM page used for normal memory access, because all normal memory access is forced to
SRAM Page 0.
The upper bit of the PgMode bits in the CPU_F register
determines whether or not the CUR_PP register affects normal memory access. When the upper bit of the PgMode bits
is set to ’0’, all normal memory access is forced to SRAM
Page 0. This mode is automatically enabled when an ISR is
entered. This is because, before the ISR is entered, the
M8C pushes the current value of the CPU_F register onto
the stack and then clears the CPU_F register. Therefore, by
default, any normal memory access in an ISR is guaranteed
to occur in SRAM Page 0.
56Document # 001-20559 Rev. *D
RAM Paging
When the RETI instruction is executed, to end the ISR, the
previous value of the CPU_F register is restored, restoring
the previous page mode. Note that this ISR behavior is the
default and that the PgMode bits in the CPU_F register can
be changed while in an ISR. If the PgMode bits are changed
while in an ISR, the pre-ISR value is still restored by the
RETI; but if the CUR_PP register is changed in the ISR, th e
ISR is also required to restore the value before executing
the RETI instruction.
When the upper bit of the PgMode bits is set to ’1’, all normal memory access is forced to the SRAM page indicated
by the value of the CUR_PP register. Table 4-2 gives a summary of the PgMode bit values and the corresponding Memory Paging mode.
4.1.6Index Memory Page Pointer
The source indexed and destination indexed addressing
modes to SRAM are treated as a unique addressing mode
in a PSoC device, with more than one page of SRAM. An
example of an indexed addressing mode is the MOV A,
[X+expr] instruction. Note that register access also has
indexed addressing; however, those instructions are not
affected by the SRAM paging architecture.
Important Note If you are not using assembly to program a
PSoC device, be aware that the compiler writer may restrict
the use of some memory paging modes. Review the conventions in your compiler’s user guide for mo re information
on restrictions or conventions associated with memory paging modes.
Indexed SRAM accesses operate in one of three modes:
■ Index memory access modes are forced to SRAM
Page 0.
■ Index memory access modes are directed to the SRAM
page indicated by the value in the STK_PP register.
■ Index memory access is forced to the SRAM page indi-
cated by the value in the IDX_PP register.
The mode is determined by the value of the PgMode bits in
the CPU_F register. However, the final SRAM page that is
used also requires setting either the Stack Page Pointer
(STK_PP) register or the Index Page Pointer (IDX_PP) register. The table below shows the three indexed memory
access modes. The third column of the table is provided for
reference only.
After reset, the PgMode bits are set to 00b. In this mode,
index memory accesses are forced to SRAM Page 0, just as
they would be in a PSoC device with only 256 bytes of
SRAM. This mode is also automatically enabled when an
interrupt occurs in a PSoC device and is therefore considered the default ISR mode. This is because before the ISR
is entered, the M8C pushes the current value of the CPU_F
register on to the stack and then clears the CPU_F register.
Therefore, by default, any indexed memory access in an
ISR is guaranteed to occur in SRAM Page 0. When the
RETI instruction is executed to end the ISR, the previous
value of the CPU_F register is restored and the previous
page mode is then also restored. Note that this ISR behavior
is the default and that the PgMode bits in the CPU_F register may be changed while in an ISR. If the PgMode bits are
changed while in an ISR, the pre-ISR value is still restored
by the RETI; but if the STK_PP or IDX_PP registers are
changed in the ISR, the ISR is also required to restore the
values before executing the RETI instruction.
The most likely PgMode bit change, while in an ISR, is from
the default value of 00b to 01b. In the 01b mode, indexed
memory access is directed to the SRAM page indicated by
the value of the STK_PP register. By using the PgMode, the
value of the STK_PP register is not required to be modified.
The STK_PP register is the register that determines which
SRAM page the stack is located on. The 01b paging mode is
intended to provide easy access to the stack, while in an
ISR, by setting CPU_X register (just X in instruction format)
equal to the value of SP using the MOV X, SP instruction.
The two previous paragraphs covered two of the three
indexed memory access modes: STK_PP and forced to
SRAM Page 0. Note, as shown in Table 4-2, that the
STK_PP mode for indexed memory access is available
under two PgMode settings. The 01b mode is intended for
ISR use and the 11b mode is intended for non-ISR use. The
third indexed memory access mode requires the PgMode
bits to be set to 10b. In this mode indexed memory access is
forced to the SRAM page indicated by the value of the
IDX_PP register.
Table 4-2. CPU_F PgMode Bit Modes
CPU_F
PgMode BIts
00b00ISR*
01b0STK_PPISR with variables on stack
10bCUR_PPIDX_PP
11bCUR_PPSTK_PP
*
Mode used by SROM functions initiated by the SSC instruction.
Current
SRAM Page
Indexed
SRAM Page
Typical Use
Document # 001-20559 Rev. *D57
RAM Paging
4.2Register Definitions
The following registers are associated with RAM Paging and ar e listed in address order. The register descriptions have an
associated register table showing the bit structure for that register. The bits in the tables that are grayed out are reserved bits
and are not detailed in the register descriptions that follow. Reserved bits should always be written with a value of ‘0’. For a
complete table of RAM Paging registers, refer to the “Summary Table of the Core Registers” on page 32.
x An ‘x’ before the comma in the address fi eld indicates that this register can be read or written to no matter what bank is used. An “x” after the comma in the
address field indicates that there are multiple instances of the register.
Data[7:0]RW : 00
The Temporary Data Registers (TMP_DR0, TMP_DR1,
TMP_DR2, and TMP_DR3) are used to enhance the performance in multiple SRAM page PSoC devices.
These registers have no pre-defined function (for example,
the compiler and hardware do not use these registers) and
exist for the user to use as desired.
Bits 7 to 0: Data[7:0]. Due to the paged SRAM architecture of PSoC devices with more than 256 bytes of SRAM, a
value in SRAM may not always be accessible without first
changing the current page.
The TMP_DRx registers are readable and writable registers
that are provided to improve the performance of multiple
SRAM page PSoC devices, by supplying some register
space for data that is always accessible.
For expanded listing of TMP_DRx registers, refer to “Sum-
mary Table of the Core Registers” on page 32. For addi-
tional information, refer to TMP_DRx register on page 72.
L The AND F, expr; OR F, expr; and XOR F, expr flag instructions can be used to modify this register.
x An ‘x’ before the comma in the address field indicates th at this register can be read or written to no matter what bank is used.
CPU_F
PgMode[1:0]XIOCarryZeroGIERL : 02
The M8C Flag Register (CPU_F) provides read access to
the M8C flags.
Bits 7 and 6: PgMode[1:0]. PgMode determines how the
CUR_PP and IDX_PP registers form effective RAM
addresses for Direct Address mode and Indexed Address
mode operands.
Bit 4: XIO. The IO Bank Select bit, also know as the register bank select bit, is used to select the register bank that is
active for a register read or write. This bit allows the PSoC
device to have 512 8-bit registers and, therefore, can be
thought of as the ninth address bit for registers. The address
space accessed when the XIO bit is set to ‘0’ is called the
user space, while the address space accessed when the
XIO bit is set to ‘1’ is called the configura t ion space.
Bit 2: Carry. The Carry Flag bit is set or cleared in
response to the result of several instructions. It can also be
manipulated by the flag-logic opcodes (for example, OR F,
4). See the PSoC Designer Assembly Guide User Manual
for more details.
Bit 1: Zero. The Zero Flag bit is set or cleared in response
to the result of several instructions. It can also be manipulated by the flag-logic opcodes (for example, OR F, 2). See
the PSoC Design er Assembly Guide User Manual for more
details.
Bit 0: GIE. The state of the Global Interrupt Enable bit
determines whether interrupts (by way of the IRQ) are recognized by the M8C. This bit is set or cleared by the user,
using the flag-logic instructions (for example, OR F, 1). GIE
is also cleared automatically by the M8C upon entering the
ISR, after the flag byte has been stored on the stack, preventing nested interrupts. Note that the bit can be set in an
ISR if desired. For GIE=1, the M8C samples the IRQ input
for each instruction. For GIE=0, the M8C ignores the IRQ.
For additional information, refer to the CPU_F register on
page 120.
Document # 001-20559 Rev. *D59
RAM Paging
60Document # 001-20559 Rev. *D
5.Interrupt Controller
M8C Core
Interrupt
Source
(Timer,
GPIO, etc.)
Interrupt Taken
or
Posted
Interrupt
Pending
Interrupt
GIE
Interrupt Vector
Mask Bit Setting
DRQ1
Priority
Encoder
Interrupt
Request
...
INT_MSKx:n
INT_CLRx:n Write
CPU_F[0]
...
n
0
This chapter presents the Interrupt Controller and its associated registers. The interrupt controller provides a mechanism for a
hardware resource in PSoC devices, to change program execution to a new address without regard to the current task being
performed by the code being executed. For a complete table of the Interrupt Controller registers, refer to the “Summary Table
of the Core Registers” on page 32. For a quick reference of all PSoC registers in address order, refer to the Register
Details chapter on page 47.
5.1Architectural Description
A block diagram of the PSoC Interrupt Controller is shown in Figure 5-1, illustrating the concepts of posted interrupts and
pending interrupts.
Figure 5-1. Interrupt Controller Block Diagram
The sequence of events that occur during interrupt processing is as follows.
1. An interrupt becomes active, either because (a) the
interrupt condition occurs (for example, a timer expires),
(b) a previously posted interrupt is enabled through an
update of an interrupt mask register, or (c) an interrupt is
pending and GIE is set from ‘0’ to ‘1’ in the CPU Flag
register.
2. The current executing instruction finishes.
3. The internal interrupt routine executes, taking 13 cycles.
During this time, the following actions occur:
■ The PCH, PCL, and Flag register (CPU_F) are
pushed onto the stack (in that order).
Document # 001-20559 Rev. *D61
■ The CPU_F register is then cleared. Since this clears
the GIE bit to 0, additional interrupts are temporarily
disabled.
■ The PCH (PC[15:8]) is cleared to zero.
■ The interrupt vector is read from the interrupt control-
ler and its value is placed into PCL (PC[7:0]). This
sets the program counter to point to the appropriate
address in the interrupt table (for example, 001Ch for
the GPIO interrupt).
4. Program execution vectors to the interrupt table. Typically, a LJMP instruction in the interrupt table sends execution to the user's interrupt service routine (ISR) for this
interrupt. (See “Instruction Set Summary” on page 36.)
Interrupt Controller
5. The ISR executes. Note that interrupts are disabled
since GIE = 0. In the ISR, interrupts can be re-enabled if
desired, by setting GIE = 1 (take care to avoid stack
overflow in this case).
6. The ISR ends with a RETI instruction. This pops the Flag
register, PCL, and PCH from the stack, restoring those
registers. The restored Flag register re-enables interrupts, since GIE = 1 again.
7. Execution resumes at the next instruction, after the one
that occurred before the interrupt. However, if there are
more pending interrupts, the subsequent interrupts are
processed before the next normal program instruction.
Interrupt Latency. The time between the assertion of an
enabled interrupt and the start of its ISR can be calculated
using the following equation:
Latency = Equation 1
Time for current instruction to finish +
Time for M8C to change program counter to interrupt address +
Time for LJMP instruction in interrupt table to exe cute.
For example, if the 5-cycle JMP instruction executes when
an interrupt becomes active, the total number of CPU clock
cycles before the ISR begins is as follows:
(1 to 5 cycles for JMP to finish) + Equation 2
(13 cycles for interrupt routine) +
(7 cycles for LJMP) = 21 to 25 cycles.
In the example above, at 24 MHz, 25 clock cycles take
1.042 s.
5.1.1Posted versus Pending Interrupts
An interrupt is posted when its interrupt conditions occur.
This results in the flip-flop in Figure 5-1 clocking in a ‘1’. The
interrupt remains posted until the interrupt is taken or until it
is cleared by writing to the appropriate INT_CLRx register.
A posted interrupt is not pending unless it is enabled by setting its interrupt mask bit (in the appropriate INT_MSKx register). All pending interrupts are processed by the priority
encoder to determine the highest priority interrupt to be
taken by the M8C if the Global Interrupt Enable bit is set in
the CPU_F register.
Disabling an interrupt by clearing its interrupt mask bit (in
the INT_MSKx register) does not clear a posted interrupt,
nor does it prevent an interrupt from being posted. It simply
prevents a posted interrupt from becoming pending.
It is especially important to understand the functionality of
clearing posted interrupts, if the configuration of the PSoC
device is changed by the application.
For example, if a digital PSoC block is configured as a counter and has posted an interrupt but is later reconfigured to a
serial communications receiver, the posted interrupt from
the counter remains. Therefore, if the digital PSoC block's
INT_MSKx bit is set after configuring the block as a serial
communications receiver, a pending interrupt is generated
immediately. To prevent the carryover of posted interrupts
from one configuration to the next, the INT_CLRx registers
should be used to clear posted interrupts prior to enabling
the digital PSoC block.
Interrupt Priority . The priorities of the interrupts only come
into consideration if more than one interrupt is pending during the same instruction cycle. In this case, the priority
encoder (see Figure 5-1) generates an interrupt vector for
the highest priority interrupt that is pending.
62Document # 001-20559 Rev. *D
Interrupt Controller
5.2Application Description
The interrupt controller and its associated registers allow the user ’s code to respond to an in terrupt from almost every functional block in the PSoC devices. Interrupts for all the digital blocks and each of the analog columns are available, as well as
interrupts for supply voltage, sleep, variable clocks, and a general GPIO (pin) interrupt.
The registers associated with the interrupt controller allow interrupts to be disabled either globally or individually. The registers
also provide a mechanism by which a user can clear all pendin g and posted interrupts, or clear indivi dual posted or pe nding
interrupts. A software mechanism is provided to set individual interrupts. Setting an interrupt by way of software is very useful
during code development, when one may not have the complete hardware system necessary to generate a real interrupt.
The following table lists the interrupts for all PSoC devices (highlighting specifically the CY8C24533, CY8C23533,
CY8C23433CY8C24633) and the priorities that are available in each PSoC device.
Reset
Supply Voltage Monitor
Analog Column 0
Analog Column 1
SAR8 ADC
VC3
GPIO
PSoC Block DBB00
PSoC Block DBB01
PSoC Block DCB02
PSoC Block DCB03
I2C
Sleep Timer
Document # 001-20559 Rev. *D63
Interrupt Controller
5.3Register Definitions
The following registers are associated with the Interrupt Con troller and are listed in addre ss order. The register descriptions
have an associated register table showing the bit structure for that register. The bits in the tables that are grayed out are
reserved bits and are not detailed in the register descriptions that follow. Reserved bits should always be written with a value
of ‘0’. For a complete table of Interrupt Controller registers, refer to the “Summary Table of the Core Registers” on page 32.
Depending on the PSoC device you have, only certain bits are accessible to be read or written, such as the INT_CLR0 and
INT_MSK0 registers that are analog column and digital row dependent. The analog column dependent registers have the column number listed to the right of the Address column. The digital row dependent registers are set up the same way, only with
the term “Row” in the Address column.
The Interrupt Clear Registers (INT_CLRx) are used to
enable the individual interrupt sources’ ability to clear posted
interrupts.
There are three interrupt clear registers (INT_CLR0,
INT_CLR1, and INT_CLR3) which may be referred to in
general as INT_CLRx.The INT_CLRx registers are similar to
the INT_MSKx registers in that they hold a bit for each interrupt source. Functionally the INT_CLRx registers are similar
to the INT_VC register, although their operation is completely independent. When an INT_CLRx register is read,
any bits that are set indicate an interrupt has been posted
for that hardware resource. Therefore, reading these registers gives the user the ability to determine all posted interrupts.
The Enable Software Interrupt (ENSWINT) bit in
INT_MSK3[7] determines the way an individual bit value
written to an INT_CLR0 register is interpreted. When
ENSWINT is cleared (the default state), writing 1's to an
INT_CLRx register has no effect. However, writing 0's to an
INT_CLRx register, when ENSWINT is cleared, causes the
corresponding interrupt to clear. If the ENSWINT bit is set,
any 0's written to the INT_CLRx registers are ignored. However, 1's written to an INT_CLRx register, while ENSWINT is
set, causes an interrupt to post for the corresp onding interrupt.
Note When using the INT_CLRx register to post an interrupt, the hardware interrupt source, such as a digital clock,
must not have its interrupt output high. Therefore, it may be
difficult to use software interrupts with interrupt sources that
do not have enables such as VC3.
Software interrupts can aid in debugging interrupt service
routines by eliminating the need to create system level inter-
actions that are sometimes necessary to create a hardwareonly interrupt.
5.3.1.1INT_CLR0 Register
Bit 7: VC3. This bit allows posted VC3 interrupts to be
read, cleared, or set.
Bit 6: Sleep. This bit allows posted sleep interrupts to be
read, cleared, or set.
Bit 5: GPIO. This bit allows posted GPIO interrupts to be
read, cleared, or set.
Bit 4: SAR8 ADC. This bit allows posted SAR8 ADC interrupts to be read, cleared, or set.
Bit 3: Analog 2. This bit allows posted analog column 2
interrupts to be read, cleared, or set.
Bit 2: Analog 1. This bit allows posted analog column 1
interrupts to be read, cleared, or set.
Bit 1: Analog 0. This bit allows posted analog column 0
interrupts to be read, cleared, or set.
Bit 0: V Monitor. This bit allows posted V monitor interrupts to be read, cleared, or set.
For additional information, refer to the INT_CLR0 register on
page 99 .
64Document # 001-20559 Rev. *D
Interrupt Controller
5.3.1.2INT_CLR1 Register
Bit 3: DCB03. This bit allows posted DCB03 interrupts to
be read, cleared, or set for row 0 block 3.
Bit 2: DCB02. This bit allows posted DCB02 interrupts to
be read, cleared, or set for row 0 block 2.
5.3.1.3INT_CLR3 Register
Bit 0: I2C. This bit allows posted I2C interrupts to be read,
cleared, or set.
For additional information, refer to the INT_CLR3 register on
page 102.
Bit 1: DBB01. This bit allows posted DBB01 interrupts to
be read, cleared, or set for row 0 block 1.
Bit 0: DBB00. This bit allows posted DBB00 interrupts to
be read, cleared, or set for row 0 block 0.
For additional information, refer to the INT_CLR1 register on
The Interrupt Mask Registers (INT_MSKx) are used to
enable the individual interrupt sources’ ability to create
pending interrupts.
There are three interrupt mask registers (INT_MSK0,
INT_MSK1, and INT_MSK3) which may be referred to in
general as INT_MSKx. If cleared, each bit in an INT_MSKx
register prevents a posted interrupt from becoming a pending interrupt (input to the priority encoder). However, an
interrupt can still post even if its mask bit is zero. All
INT_MSKx bits are independent of all other INT_MSKx bits.
If an INT_MSKx bit is set, the interrupt source associated
with that mask bit may generate an interrupt that becomes a
pending interrupt. For example, if INT_MSK0[5] is set and at
least one GPIO pin is configured to generate an interrupt,
the interrupt controller allows a GPIO interrupt request to
post and become a pending interrupt for the M8C to respond
to. If a higher priority interrupt is generated before the M8C
responds to the GPIO interrupt, the higher priority interrupt
is responded to and not the GPIO interrupt.
Each interrupt source may require configuration at a block
level. Refer to the other chapters in this manual for information on how to configure an individual interrupt source.
5.3.2.1INT_MSK3 Register
Bit 7: ENSWINT. This bit is a special non-mask bit that
controls the behavior of the INT_CLRx registers. See the
INT_CLRx register in this section for more information.
Bit 0: I2C. This bit allows posted I2C interrupts to be read,
masked, or set.
For additional information, refer to the INT_MSK3 register
on page 103.
Document # 001-20559 Rev. *D65
Interrupt Controller
5.3.2.2INT_MSK0 Register
Bit 7: VC3. This bit allows posted VC3 interrupts to be
read, masked, or set.
Bit 6: Sleep. This bit allows posted sleep interrupts to be
read, masked, or set.
Bit 5: GPIO. This bit allows posted GPIO interrupts to be
read, masked, or set.
Bit 4: SAR8 ADC. This bit allows posted SAR8 ADC interrupts to be read, masked, or set.
Bit 3: Analog 2. This bit allows posted analog column 2
interrupts to be read, masked, or set.
Bit 2: Analog 1. This bit allows posted analog column 1
interrupts to be read, masked, or set.
Bit 1: Analog 0. This bit allows posted analog column 0
interrupts to be read, masked, or set.
Bit 0: V Monitor. This bit allows posted V monitor interrupts to be read, masked, or set.
For additional information, refer to the INT_MSK0 register
on page 104.
5.3.2.3INT_MSK1 Register
Bit 3: DCB03. This bit allows posted DCB03 interrupts to
be read, masked, or set for row 0 block 3.
Bit 2: DCB02. This bit allows posted DCB02 interrupts to
be read, masked, or set for row 0 block 2.
Bit 1: DBB01. This bit allows posted DBB01 interrupts to
be read, masked, or set for row 0 block 1.
Bit 0: DBB00. This bit allows posted DBB00 interrupts to
be read, masked, or set for row 0 block 0.
For additional information, refer to the INT_MSK1 register
The Interrupt Vector Clear Register (INT_VC) returns the
next pending interrupt and clears all pending interrupts
when written.
Bits 7 to 0: Pending Interrupt[7:0]. When the register is
read, the least significant byte (LSB), of the highest priority pending interrupt, is returned. For example, if the GPIO
and I2C interrupts are pending and the INT_VC register was
read, the value 1Ch is be read. However, if no interrupts are
pending, the value 00h is returned. This is the reset vector in
the interrupt table; however, reading 00h from the INT_VC
register should not be considered an indication that a system reset is pending. Rather, reading 00h from the INT_VC
register simply indicates that there are no pending interrupts.
Pending Interrupt[7:0]RC : 00
The highest priority interrupt, indicated by the value returned
by a read of the INT_VC register, is removed from the list of
pending interrupts when the M8C services an interrupt.
Reading the INT_VC register has limited usefulness. If interrupts are enabled, a read to the INT_VC register does not
determine that an interrupt was pending before the interrupt
was actually taken. However, while in an interrupt, a user
may wish to read the INT_VC register to see what the next
interrupt is. When the INT_VC register is written, with any
value, all pending and posted interrupts are cleared by
asserting the clear line for each interrupt.
For additional information, refer to the INT_VC register on
L The AND F, expr; OR F, expr; and XOR F, expr f l ag instructions can be used to modify this register.
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
CPU_F
PgMode[1:0]XIOCarryZeroGIERL : 02
The M8C Flag Register (CPU_F) provides read access to
the M8C flags. Note that only the GIE (Global Interrupt
Enable) bit is related to the interrupt controller.
Bits 7 to 1. The CPU_F register holds bits that are used by
different resources. For information on the other bits in this
register, refer to the CPU Core (M8C) chapter on page 35.
Bit 0: GIE. The state of the Global Interrupt Enable bit
determines whether interrupts (by way of the IRQ) are recognized by the M8C. This bit is set or cleared by the user,
using the flag-logic instructions (for example, OR F, 1).
GIE is also cleared automatically by the M8C upon entering
the interrupt service routine (ISR), after the flag byte has
been stored on the stack, preventing nested interrupts. Note
that the bit can be set in an ISR if desired.
For GIE=1, the M8C samples the IRQ input for each instruction. For GIE=0, the M8C ignores the IRQ.
For additional information, refer to the CPU_F register on
page 120.
Document # 001-20559 Rev. *D67
Interrupt Controller
68Document # 001-20559 Rev. *D
6.General Purpose IO (GPIO)
This chapter discusses the General Purpose IO (GPIO) and its associated registers, which is the circuit respon sible for interfacing to the IO pins of a PSoC device. The GPIO blocks provide the interface between the M8C core and the outside world.
They offer a large number of configurations to support several types of input/output (IO) operations for both digital and analog systems. For a complete table of the GPIO registers, refer to the “Summary Tab le of the Core Regi sters” on page 32. For
a quick reference of all PSoC registers in address order, refer to the Register Details chapter on page 47.
6.1Architectural Description
The GPIO contains input buffers, output drivers, register bit
storage, and configuration logic for connecting the PSoC
device to the outside world.
IO ports are arranged with (up to) 8 bits per port. Each full
port contains eight identical GPIO blocks, with connections
to identify a unique address and register bit number for each
block. Each GPIO block can be used for the following types
of IO:
■ Digital IO (digital input and output controlled by software)
■ Global IO (digital PSoC block input and output)
■ Analog IO (analog PSoC block input and output)
Each IO pin also has several drive modes, as well as interrupt capabilities. While all GPIO pins are identical and provide digital IO, some pins may not connect internally to
analog functions.
The main block diagram for the GPIO block is shown in
Figure 6-1. Note that some pins do not have all of the func-
tionality shown, depending on internal connections.
6.1.1Digital IO
One of the basic operations of the GPIO ports is to allow the
M8C to send information out of the PSoC device a nd get
information into the M8C from outside the PSoC device.
This is accomplished by way of the port data register
(PRTxDR). Writes from the M8C to the PRTxDR register
store the data state, one bit per GPIO. In the standard nonbypass mode, the pin drivers drive the pin in response to
this data bit, with a drive strength determined by the Drive
mode setting (see Figure 6-1). The actual voltage on the pin
depends on the Drive mode and the external load.
Note that the pin voltage can represent a different logic
value than the last value written to the PRTxDR register.
This is an important distinction to remember in situations
such as the use of a read modify write to a PRTxDR register.
Examples of read modify write instructions include AND,OR, and XOR.
The following is an example of how a read modify write, to a
PRTxDR register, can have an unexpected and even indeterminate result in certain systems. Consider a scenario
where all bits of Port 1 on the PSoC device are in the Strong
1 Resistive 0 Drive mode; so that in some cases, the system
the PSoC is in may pull up one of the bits.
movreg[PRT1DR], 0x00
orreg[PRT1DR], 0x80
In the first line of code above, writing a 0x00 to the port does
not affect any bits that happen to be driven by the system
the PSoC is in. However, in the second line of code, it does
not guarantee that only bit 7 is the one se t to a strong 1.
Because the OR instruction first reads the port, any bits that
are in the pull up state are read as a ‘1’. These ones are
then written back to the port. When this happens, the pin
goes into a strong 1 state; therefore, if the pull up condition
ends in the system, the PSoC keeps the pin value at a logic
1.
The M8C can read the value of a port by reading the
PRTxDR register address. When the M8C reads the
PRTxDR register address, the current value of the pin voltage is translated into a logic value and returned to the M8C.
Document # 001-20559 Rev. *D5
General Purpose IO (GPIO)
DM[2:0]=110b
R
DENQ
RESET
I2C Input
Global
Input Bus
QinLatch
5.6K
Vdd
Write PRTxDR
2:1
Drive
Logic
DM2
DM1
DM0
DATA
2:1
BYP
Global
Output Bus
I2C Output
I2C Enable
Slew
Control
Vdd
5.6K
PIN
(To Readmux,
Interrupt Logic)
Output Path
Input Path
DM1
DM0
BYP
CELLRD
AIN
Data Bus
Read PRTxDR
INBUF
Vdd
0.2.3.
4.5.6.7.
Drive Modes
DM1DM2
Drive Mode
0 0 0 Resistive Pull Down0ResistiveStron g
DM0
0 0 1 Strong Drive1St ro n gS tro ng
0 1 0 High Impedance 2 High Z High Z
0 1 1 Resistive Pull Up 3 Stro n gResistive
1 0 0 Open Drain, Drives H ig h 4 High ZStrong (Slow)
1 0 1 Slow Strong D rive 5Strong (Slow)Stron g (Slow)
1 1 0 High Impedance Analog6High ZHigh Z
1 1 1 Open Drain, Drives L ow7Strong (Slow)H igh Z
Diagram
Number
Data = 0Data = 1
AOUT
1.
6.1.2Global IO
The GPIO ports are also used to interconnect signals to and
from the digital PSoC blocks, as global inputs or outputs.
The global IO feature of each GPIO (port pin) is off by
default. To access the feature, two parameters must be
changed. To configure a GPIO as a global input, the port
global select bit must be set for the desired GPIO using the
PRTxGS register. This sets BYP = 1 in Figure 6-1 and disconnects the output of the PRTxDR register from the pin.
Also, the Drive mode for the GPIO must be set to the digital
High Z state. (Refer to the “PRTxDMx Registers” on page10
for more information.) To configure a GPIO as a global output, the port global select bit must again be set. But in this
case, the drive state must be set to any of the non-High Z
states.
Figure 6-1. GPIO Block Diagram
6.1.3Analog Input
Analog signals can pass into the PSoC device core from
PSoC device pins through the block’s AOUT pin. This provides a resistive path (~300 ohms) directly through the
GPIO block. For analog modes, the GPIO block is typically
configured into a high impedance analog drive mode (High
Z). The mode turns off the Schmitt trigger on the input path,
which may reduce power consumption and decrease internal switching noise when using a particular IO as an analog
input. Refer to the Electrical Specifications chapter in the
device data sheet.
6Document # 001-20559 Rev. *D
General Purpose IO (GPIO)
Low
PRTxIE:n
High
Change
DQ
S
R
INTO
INBUF (from figure 1 in ch apter)
CELLRD
EN
QinLatch
Interrupt Mode
PRTxIC0:n
PRTxIC1:n
Output
0 0 Disabled
0 1 Low
1 0 High
1 1 Change from last read
Vss
PRTxIC1:n
PRTxIC0:n
PRTxIC1:n
PRTxIC0:n
PRTxIC1:n
PRTxIC0:n
6.1.4GPIO Block Interrupts
Each GPIO block can be individually configured for interrupt
capability. Blocks are configured by pin interrupt enables
and also by selection of the interrupt state. Blocks can be
set to interrupt when the pin is high, low, or when it changes
from the last time it was read. The block provides an opendrain interrupt output (INTO) that is connected to other
GPIO blocks in a wire-OR fashion.
All pin interrupts that are wire-OR’ed together are tied to the
same system GPIO interrupt. Therefore, if interrupts are
enabled on multiple pins, the user’s interrupt service routine
must provide a mechanism to determine which pin was the
source of the interrupt.
Using a GPIO interrupt requires the following steps:
1. Set the Interrupt mode in the GPIO pin block.
2. Enable the bit interrupt in the GPIO block.
3. Set the mask bit for the (global) GPIO interrupt.
4. Assert the overall Global Interrupt Enable.
The first two steps, bit interrupt enable and Interrupt mode,
are set at the GPIO block level (that is, at each port pin), by
way of the block’s configuration registers.
The last two steps are common to all interrupts and are
described in the Interrupt Controller chapter on page 61.
At the GPIO block level, asserting the INTO line depends
only on the bit interrupt enable and the state of the pin relative to the chosen Interrupt mode. At the PSoC device level,
due to their wire-OR nature, the GPIO interrupts are neither
true edge-sensitive interrupts nor true level-sensitive interrupts. They are considered edge-sensitive for asserting, but
level-sensitive for release of the wire-OR interrupt line.
pin transitions, if not already transitioned, appropriately high
or low, to match the Interrupt mode configuration. Once this
happens, the INTO line pulls low to assert the GPIO interrupt. This assumes the other system-level enables are on,
such as setting the global GPIO interrupt enable and the
Global Interrupt Enable. Setting the pin interrupt enable may
immediately assert INTO, if the Interrupt mode conditions
are already being met at the pin.
Once INTO pulls low, it continues to hold INTO low until one
of these conditions change: (a) the pin interrupt enable is
cleared; (b) the voltage at pin transitions to the opposite
state; (c) in interrupt-on-change mode, the GPIO data register is read, thus setting the local interrupt level to the opposite state; or (d) the Interrupt mode is changed so that the
current pin state does not create an interrupt. Once one of
these conditions is met, the INTO releases. At this point,
another GPIO pin (or this pin again) could assert its INTO
pin, pulling the common line low to assert a new interrupt.
Note that the GPIO data register state is latched during read
operation. Interrupt-on-change may not behave as expected
if the input signal changes during the metastability time of
the latch, that is, when the GPIO is being read.
Note the following behavior from this level-release feature. If
one pin is asserting INTO and then a second pin asserts its
INTO, when the first pin releases its INTO, the second pin is
already driving INTO and thus no change is seen (that is, no
new interrupt is asserted on the GPIO interrupt). Care must
be taken, using polling or the states of the GPIO pin and
Global Interrupt Enables, to catch all interrupts among a set
of wire-OR GPIO blocks.
Figure 6-2 shows the interrupt logic portion of the block.
If no GPIO interrupts are asserting, a GPIO interrupt occurs
whenever a GPIO pin interrupt enable is set and the GPIO
Document # 001-20559 Rev. *D7
Figure 6-2. GPIO Interrupt Logic Diagram
General Purpose IO (GPIO)
6.2Register Definitions
The following registers are associated with the General Purpose IO (GPIO) and are liste d in address order. The register
descriptions in this section have an associated register table showing the bit structure for that register. For a complete table of
GPIO registers, refer to the “Summary Table of the Core Registers” on page 32.
For a selected GPIO block, the individual registers are addressed in the Summary Table of the Core Registers. In the register
names, the ‘x’ is the port number, configured at the PSoC device level (x = 0 to 7, typically). All register values are readable,
except for the PRTxDR register; reads of this register return the pin state instead of the register bit state.
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an exp anded address listing of these registers,
refer to the
PRTxDR
“Summary Table of the Core Registers” on page 32.
Data[7:0]RW : 00
The Port Data Register (PRTxDR) allows for write or read
access of the current logical equivalent of the voltage on the
pin.
Reading the PRTxDR register returns the actual pin state,
as seen by the input buffer. This may not be the same as the
expected output state, if the load pulls the pin more strongly
than the pin’s configured output drive. See “Digital IO” onBits 7 to 0: Data[7:0]. Writing the PRTxDR register bits
sets the output drive state for the pin to high (for DIN=1) or
low (DIN=0), unless a bypass mode is selected (either I2C
Enable=1, or the global select register written high).
page 5 for a detailed discussion of digital IO.
For additional information, refer to the PRTxDR register on
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an exp anded address listing of these registers,
refer to the
PRTxIE
“Summary Table of the Core Registers” on page 32.
The Port Interrupt Enable Register (PRTxIE) is used to
enable/disable the interrupt enable internal to the GPIO
block.
Interrupt Enables[7:0]RW : 00
Bits 7 to 0: Interrupt Enables[7:0]. A ‘1’ enables the INTO
output at the block and a ‘0’ disable s INTO so it is on ly Hi gh
Z.
For additional information, refer to the PRTxIE register on
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an expanded address listing of these registers,
refer to the
PRTxGS
“Summary Table of the Core Registers” on page 32.
Global Select[7:0]RW : 00
The Port Global Select Register (PRTxGS) is used to select
the block for connection to global inputs or outputs.
Bits 7 to 0:Global Select[7:0]. Writing this register high
enables the global bypass (BYP = 1 in Figure 6-1). If the
Drive mode is set to digital High Z (DM[2:0] = 010b), then
the pin is selected for global input (PIN drives to the Global
Input Bus). In non-High Z modes, the block is selected for
global output (the Global Output Bus drives to PIN), bypassing the data register value (assuming I2C Enable = 0).
If the PRTxGS register is written to zero, the global in/out
function is disabled for the pin and the pin reflects the value
of PRT_DR.
For additional information, refer to PRTxGS register on page
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an expanded address listing of these registers,
refer to the
“Summary Table of the Core Registers” on page 32.
Drive Mode 2[7:0]RW : FF
Drive Mode 0[7:0]RW : 00
Drive Mode 1[7:0]RW : FF
The Port Drive Mode Bit Registers (PRTxDMx) are used to
specify the Drive mode for GPIO pins.
Bits 7 to 0: Drive Mode x[7:0]. In the PRTxDMx registers
there are eight possible drive modes for each port pin. Three
mode bits are required to select one of these modes, and
these three bits are spread into three different registers
(PRTxDM0, PRTxDM1, and PRTxDM2). The bit position of
the effected port pin (for example, Pin[2] in Port 0) is the
same as the bit position of each of the three drive mode register bits that control the Drive mode for that pin (for example, bit[2] in PRT0DM0, bit[2] in PRT0DM1, and bit[2] in
PRT0DM2). The three bits from the three registers are
treated as a group. These are referred to as DM2, DM1, and
DM0, or together as DM[2:0]. Drive modes are shown in
Table 6-1.
For analog IO, the Drive mode should be set to one of the
High Z modes, either 010b or 110b. The 110b mode has the
advantage that the block’s digital input buffer is disabled, so
no crowbar current flows even when the analog input is not
close to either power rail. When digital inputs are needed on
the same pin as analog inputs, the 010b Drive mode should
be used. If the 110b Drive mode is used, the pin is always
read as a zero by the CPU and the pin is not able to generate a useful interrupt. (It is not strictly required that a High Z
mode be selected for analog operation.)
For global input modes, Drive mode must be set to 010b.
Table 6-1. Pin Drive Modes
Drive Modes
DM2 DM1 DM0
000Resistive pull downStrong high, resistive low
001Strong driveStrong high, strong low
010High impedanceHigh Z high and low, digital
xx An “x” after the comma in the address field indicates that there are multiple instances of the register. For an expanded address listing of these registers,
refer to the
PRTxIC0
PRTxIC1
“Summary Table of the Core Registers” on page 32.
Interrupt Control 0[7:0]RW : 00
Interrupt Control 1[7:0]RW : 00
The Port Interrupt Control Registers (PRTxIC1 and
PRTxIC0) are used to specify the Interrupt mode for GPIO
pins.
Bits 7 to 0: Interrupt Control x[7:0]. In the PRTxICx registers, the Interrupt mode for the pin is determined by bi ts in
these two registers. These are referred to as IC1 and IC0, or
together as IC[1:0].
There are four possible interrupt modes for each port pin.
Two mode bits are required to select one of these modes
and these two bits are spread into two different registers
(PRTxIC0 and PRTxIC1). The bit position of the effected
port pin (for example, Pin[2] in Port 0) is the same as the bit
position of each of the interrupt control register bits that control the Interrupt mode for that pin (for example, bit[2] in
PRT0IC0 and bit[2] in PRT0IC1). The two bits from the two
registers are treated as a group.
The Interrupt mode must be set to one of the non-zero
modes listed in Table 6-2, in ord er to get an interrupt from
the pin.
The GPIO Interrupt mode “disabled” (00b) disables interrupts from the pin, even if the GPIO’s bit interrupt enable is
on (from the PRTxIE register).
Interrupt mode 01b means that the block asserts the interrupt line (INTO) when the pin voltage is low, providing the
block’s bit interrupt enable line is set (high).
Interrupt mode 10b means that the block asserts the interrupt line (INTO) when the pin voltage is high, providing the
block’s bit interrupt enable line is set (high).
Interrupt mode 11b means that the block asserts the interrupt line (INTO) when the pin voltage is the opposite of the
last state read from the pin, providing the block’s bit interrupt
enable line is set high. This mode switches between low
mode and high mode, depending on the last value read from
the port during reads of the data register (PRTxDR). If the
last value read from the GPIO was ‘0’, the GPIO subsequently is in Interrupt High mode.
If the last value read from the GPIO was ‘1’, the GPIO then
is in Interrupt Low mode.
Table 6-2. GPIO Interrupt Modes
Interrupt Modes
IC1IC0
00Bit interrupt disabled, INTO de-asserted
01Assert INTO when PIN = low
10Assert INTO when PIN = high
11Assert INTO when PIN = change from last read
Description
Figure 6-3. GPIO Interrupt Mode 11b
Figure 6-3 assumes that the GIE is set, GPIO interrupt mask
is set, and that the GPIO Interrupt mode is set to 11b. The
Change Interrupt mode is different from the other modes, in
that it relies on the value of the GPIO’s read latch to determine if the pin state has changed. Therefore, the port that
contains the GPIO in question must be read during every
interrupt service routine. If the port is not read, the Interrupt
mode acts as if it is in high mode when the latch value is ‘0’
and low mode when the latch value is ‘1’.
For additional information, refer to the PRTxIC0 register on
page 125 and the PRTxIC1 register on page 126.
Document # 001-20559 Rev. *D11
General Purpose IO (GPIO)
12Document # 001-20559 Rev. *D
7.Analog Output Drivers
P0[5]
P0[3]
P0[4]
P0[2]
Analog
Array
ACB01
ASD11
ASC21
ACB00
SAR8
ADC
ACB02
ASC12
ASD22
ACB03
ASD13
ASC23
Analog
Output
Drivers
This chapter presents the Analog Output Drivers and their associated register. The analog output drivers provide a means for
driving analog signals off the PSoC device. For a quick reference of all PSoC registers in address order, refer to the Register
Details chapter on page 47. For information on the analog system, refer to the “Analog System” on page 215.
7.1Architectural Description
The CY8C24533, CY8C23533, CY8C23433CY8C24633
PSoC devices have up to two analog drivers used to output
analog values on port pins.
Table 7-1. PSoC Analog Output Drivers
Port Pin
CY8C23533
CY8C23433
P0[5]
P0[4]
P0[3]
P0[2]
CY8C24x23A
CY8C24533CY8C24633
Figure 7-1. Analog Output Drivers for CY8C24533, CY8C23533, CY8C23433CY8C24633
Each of these drivers is a resource available to all the ana-log blocks in a particular analog column. Therefore, the
number of analog output drivers matches the number of
analog columns in a device. The user must select no more
than one analog block per column to drive a signal on its
analog output bus (ABUS), to serve as the i nput to the analog driver for that column. The output from the analog output
driver for each column can be enabled and disabled using
the Analog Output Driver register ABF_CR0. If the analog
output driver is enabled, then it must have an analog block
driving the ABUS for that column. Otherwise, the analog
output driver can enter a high current consumption mode.
Figure 7-1 illustrates the drivers and their relationship within
the analog array. For a detailed drawing of the analog output
drivers in relation to the analog system, refer to the Analog
Input Configuration chapter on page 241.
Document # 001-20559 Rev. *D13
Analog Output Drivers
7.2Register Definitions
The following register is associated with the Ana log Outpu t Dr ivers. The regi ster description has an associated register table
showing the bit structure of the register. The bits that are grayed out in the table below are rese rve d bi ts and are no t detail ed
in the register description that follows. Reserved bits should always be written with a value of ‘0’. Depending on the number of
analog columns your PSoC device has (see the Cols. column in the register table below), some bits may be reserved (refer to
the table titled “PSoC Device Characteristics” on page 20).
The Analog Output Buffer Control Register 0 (ABF_CR0)
controls analog input muxes from Port 0 and the output buffer amplifiers that drive column outputs to device pins.
For more information on bit 7, see the Analog Input
Configuration chapter on page 241.
Bit 7: ACol1MUX. A mux selects the output of column 0
input mux or column 1 input mux. When set, this bit sets the
column 1 input to column 0 input mux output.
Bit 5: ABUF1EN. Enables the analog output buffer for Analog Column 1 (Pin P0[5]). A ‘0’ disables the analog output
buffer, a ‘1’ enables.
Bit 3: ABUF0EN. Enables the analog output buffer for Ana-
Bit 1: Bypass. Bypass mode connects the analog output
driver input directly to the output. When this bit is set, all
analog output drivers are in bypass mode. This is a high
impedance connection used primarily for measurement a nd
calibration of internal references. Use of this feature is not
recommended for customer designs.
Bit 0: PWR. This bit is used to set the power level of the
analog output drivers. When this bit is set, all of the a nalog
output drivers are in a High Power mode.
For additional information, refer to the ABF_CR0 register on
page 135.
14Document # 001-20559 Rev. *D
8.Internal Main Oscillator (IMO)
This chapter presents the Internal Main Oscillator (IMO) and its associated registers. Th e IMO produces clock signals of 24
MHz and 48 MHz. For a complete table of the IMO registers, refer to the “Summary Table of the Core Registers” on page 32.
For a quick reference of all PSoC registers in address order, refer to the Register Details chapter on page 47.
8.1Architectural Description
The Internal Main Oscillator (IMO) outputs two clocks: a
SYSCLK, which can be the internal 24 MHz clock or an
external clock, and a SYSCLKX2 that is always twice the
SYSCLK frequency. In the absence of a high-precision input
source from the 32.768 kHz crystal oscillator, the accuracy
of the internal 24/48 MHz clocks is ±2.5% over temperature
variation and two voltage ranges (3.3V ± 0.3V and 5.0V ±
0.25%). No external components are required to achieve
this level of accuracy.
There is an option to phase lock this oscillator to the External Crystal Oscillator (ECO). The choice of crystal and its
inherent accuracy determines the overall accuracy of the
oscillator. The ECO must be stable prior to locking the frequency of the IMO to this reference source.
The frequency doubler circuit, which produces SYSCLKX2,
can be disabled to save power. The lower frequency SYSCLK settings are available by setting the slow IMO (SLIMO)
bit in the CPU_SCR1 register. With this bit set and the corresponding factory trim value applied to the IMO_TR register,
SYSCLK can be lowered to 6 MHz. This offers lower device
power consumption for systems that can operate with the
reduced system clock. Slow IMO mode is discussed further
in the “Application Description” on page 15.
8.2Application Description
To save power, the IMO frequency can be reduced from 24
MHz to 6 MHz or 12 MHz using the SLIMO bit in the
CPU_SCR1 register, in conjunction with the Trim values in
the IMO_TR register. Note that the CY8C27x43,
CY8C24533, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, CY8C22x13, CY7C603xx, and CYWUSB6953
devices do not have this functionality.
8.2.1Trimming the IMO
An 8-bit register (IMO_TR) is used to trim the IMO. Bit 0 is
the LSB and bit 7 is the MSB. The trim step size is approximately 80 kHz.
A factory trim setting is loaded into the IMO_TR register at
boot time for 5V ± 0.25V operation, except for the
CY7C603xx, which is 3.3V ± 0.25V . For operation in the voltage ranges of 3.3V ± 0.3V and 2.7V ± 0.3V, user code must
modify the contents of this register with values stored in
Flash bank 0 as shown in Table 3-11 on page 49. This is
done with a Table Read command to the Supervisory ROM.
Document # 001-20559 Rev. *D15
Internal Main Oscillator (IMO)
8.3Register Definitions
The following registers are associated with the Internal Mai n Oscillator (IMO). The register descriptions have an associated
register table showing the bit structure for that register. The bits in the tables that are grayed out are reserved bits and are not
detailed in the register descriptions that follow. Reserved bits should always be written with a value of ‘0’. For a complete table
showing all oscillator registers, refer to the “Summary Table of the Core Registers” on page 32.
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
# Access is bit specific. Refer to the
* Bits 3 and 2 (ECO EXW and ECO EX, respectively) cannot be used by the CY8C27x43 for silicon revision A, and by the CY8C24533, CY8C23533,
CY8C23433, CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
IRESSSLIMOECO EXW *ECO EX *IRAMDIS# : 00
Register Details chapter on page 47 for additional information.
The System Status and Control Register 1 (CPU_SCR1) is
used to convey the status and control of events related to
internal resets and watchdog reset.
Bit 7: IRESS. The Internal Reset Status bit is a read only bit
that may be used to determine if the booting process
occurred more than once.
When this bit is set, it indicates that the SROM SWBootReset code was executed more than once. If this bit is not set,
the SWBootReset executed only once. In either case, the
SWBootReset code does not allow execution from code
stored in Flash until the M8C Core is in a safe operating
mode with respect to supply voltage and Flash operation.
There is no need for concern when this bit is set. It is provided for systems which may be sensitive to boot time, so
that they can determine if the normal one-pass boot time is
exceeded. For more information on the SWBootReest code
see the Supervisory ROM (SROM) chapter on page 45.
Bit 4: SLIMO. When set, the Slow IMO bit allows the active
power dissipation of the PSoC device to be reduced by
slowing down the IMO from 24 MHz to 6 MHz. The IMO trim
value must also be changed when SLIMO is set. When not
in external clocking mode, the IMO is the source for SYSCLK; therefore, when the speed of the IMO changes, so
does SYSCLK.
Bit 3: ECO EXW. The ECO Exists Written bit is used as a
status bit to indicate that the ECO EX bit has been previ-
ously written to. It is read only. When this bit is a ‘1’, this indi-
cates that the CPU_SCR1 register has been written to and
is now locked. When this bit is a ‘0’, the register has not
been written to since the last reset event. Note that this bit
cannot be used by the CY8C27x43 for silicon revision A,
and by the CY8C24533, CY8C23533, CY8C23433,
CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
Bit 2: ECO EX. The ECO Exists bit serves as a flag to the
hardware, to indicate that an external crystal oscillator
exists in the system. Just after boot, it may be written only
once to a value of ‘1’ (crystal exists) or ‘0’ (crystal does not
exist). If the bit is ‘0’, a switch-over to the ECO is locked out
by hardware. If the bit is ‘1’, hardware allows the firmware to
freely switch between the ECO and ILO. It should be written
as early as possible after a Power On Reset (POR) or
External Reset (XRES) event, where it is assumed that pro-
gram execution integrity is high. Note that this bit cannot be
used by the CY8C27x43 for silicon revision A, and by the
CY8C24533, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, and CY8C22x13 PSoC device s.
Bit 0: IRAMDIS. The Initialize RAM Disable bit is a control
bit that is readable and writeable. The defa ult valu e for this
bit is ‘0’, which indicates that the maximum amount of SRAM
should be initialized on watchdog reset to a value of 00h.
When the bit is ‘1’, the minimum amount of SRAM is initial-
ized after a watchdog reset. For more information on this bit,
see the “SROM Function Descriptions” on page 46.
For additional information, refer to the CPU_SCR1 register
The Oscillator Control Register 2 (OSC_CR2) is used to
configure various features of internal clock sources and
clock nets.
Bit 7: PLLGAIN. This is the only bit in the OSC_CR2 register that directly influences the PLL. When set, thi s bit keeps
the PLL in Low Gain mode. If this bit is held low, the lock
time is less than 10 ms. If this bit is held high, the lock time
is on the order of 50 ms. After lock is achieved, it is recommended that this bit be forced high to decrease the jitter on
the output. If longer lock time is tolerable, the PLLGAIN bit
can be held high all the time.
Bit 2: EXTCLKEN. When the EXTCLKEN bit is set, the
external clock becomes the source for the internal clock
tree, SYSCLK, which drives most PSoC device clocking
this clock source. If an external clock is enabled, PLL mode
should be off.
The external clock input is located on port P1[4]. When
using this input, the pin Drive mode should be set to High Z
(not High Z analog).
Bit 1: RSVD. Reserved bit - This bit should always be 0.
Bit 0: SYSCLKX2DIS. When SYSCLKX2DIS is set, the
IMO’s doubler is disabled. This results in a reduction of overall device power, on the order of 1 mA. It is advised that any
application that does not require this doubled clock should
have it turned off.
For additional information, refer to the OSC_CR2 register on
page 153.
functions. All external and internal signals, in cluding the 32
kHz clock, whether derived from the Internal Low Speed
Oscillator (ILO) or the crystal oscillator, are synchronized to
The Internal Main Oscillator Trim Register (IMO_TR) is used
to manually center the oscillator’s output to a target fre-
It is strongly recommended that the user not alter the
register value, unless Slow IMO mode is used.
quency.
The PSoC device specific value for 5V operation is loaded
into the Internal Main Oscillator Trim register (IMO_TR) at
boot time. The Internal Main Oscillator operates within specified tolerance over a voltage range of 4.75V to 5.25V, with
no modification of this register. If the PSoC device operates
Bits 7 to 0: Trim[7:0]. These bits are used to trim the Internal Main Oscillator. A larger value in this register increases
the speed of the oscillator.
For additional information, refer to the IMO_TR register on
page 156.
at a lower voltage, user code must modify the contents of
this register. For operation in the voltage range of 3.3V ±
.3V, this is accomplished with a Table Read command to the
Supervisory ROM, which supplies a trim value for operation
in this range. For operation between these voltage ranges,
user code can interpolate the best value using both available factory trim values.
Document # 001-20559 Rev. *D17
Internal Main Oscillator (IMO)
18Document # 001-20559 Rev. *D
9.Internal Low S peed Oscillator
(ILO)
This chapter briefly explains the Internal Low Speed Oscillator (ILO) and its associated register. The Internal Low Speed
Oscillator produces a 32 kHz clock. For a quick reference of all PSoC registers in address order, refer to the Register
Details chapter on page 47.
9.1Architectural Description
The Internal Low Speed Oscillator (ILO) is an oscillator with
a nominal frequency of 32 kHz. It is used to generate sleep
wake-up interrupts and watchdog resets. This oscillator can
also be used as a clocking source for the digital PSoC
blocks.
The oscillator operates in three modes: normal power, low
power, and off. The normal power mode consumes more
current to produce a more accurate frequency. The low
power mode is always used when the part is in a power
down (sleep) state.
9.2Register Definitions
The following register is associated with the Internal Low Speed Oscillator (ILO). The register descripti on has an associated
register table showing the bit structure. The bits in the table that are grayed out are reserved bits and are not detailed in the
register description that follows. Note that reserved bits should always be written with a value of ‘0’.
The Internal Low Speed Oscillator Trim Register (ILO_TR)
sets the adjustment for the internal low speed oscillator.
The device-specific value, placed in the trim b its of this register at boot time, is based on factory testing. It is strongly
recommended that the user not alter the values in the
register.
Bits 5 and 4: Bias Trim[1:0]. These two bits are used to
set the bias current in the PTAT Current Source. Bit 5 gets
inverted, so that a medium bias is selected when both bits
are ‘0’. The bias current is set according to T able9-1.
ILO_TR
Bias Trim[1:0]Freq Trim[3:0]W : 00
Table 9-1. Bias Current in PTAT
Bias CurrentBi a s Trim [1:0]
Medium Bias00b
Maximum Bias01b
Minimum Bias10b
Reserved 11b
Bits 3 to 0: Freq Trim[3:0]. These four bits are used to
trim the frequency. Bit 0 is the LSb and bit 3 is the MSb. Bit 3
gets inverted inside the register.
For additional information, refer to the ILO_TR register on
page 157.
Document # 001-20559 Rev. *D19
Internal Low Speed Oscillator (ILO)
20Document # 001-20559 Rev. *D
10. External Crystal Oscillator (ECO)
(Default
POR State)
ECO Inactive
ILO Active
ECO Active
ILO Inactive
(User has
stated that
ECO is in use.)
Transitions allowed only if write once
"ECO Exists" register bit is set.
Clear OSC_CR0[7] to
immediately revert back
to ILO as 32 kHz
source.
Set OSC_CR0[7] to
activate the ECO, then
on the next Sleep
interrupt, ECO becomes
the 32.768 kHz source.
This chapter briefly explains the External Crystal Oscillator (ECO) and its associated registers. The 32.768 kHz external crystal oscillator circuit allows the user to replace the internal low speed oscillator with a more precise time source at low cost and
low power. For a complete table of the External Crystal Oscillator registers, refer to the “Summary Table of the Core Regis-
ters” on page 32. For a quick reference of all PSoC registers in address order, refer to the Register Details chapter on
page 47.
10.1Architectural Description
The External Crystal Oscillator (ECO) circuit uses an inexpensive watch crystal and two small value capacitors as
external components, with all other components being on
the PSoC device. The crystal oscillator may be configured to
provide a reference to the Internal Main Oscillator (IMO) in
PLL mode, for generating a 24 MHz system clock.
The XTALIn and XTALOut pins support connection of a
32.768 kHz watch crystal. To use the external crystal, bit 7 of
the Oscillator Control 0 register (OSC_CR0) must be set
(the default is off). The only external components needed
are the crystal and the two capacitors that connect to Vdd.
Note that transitions between the internal and external oscillator domains may produce glitches on the clock bus.
During the process of activating the ECO, there must be a
hold-off period before using it as the 32.768 kHz source.
This hold-off period is partially implemented in hardware
using the sleep timer. Firmware must set up a sleep period
of one second (maximum ECO settling time), and then
enable the ECO in the OSC_CR0 register. At the one second time-out (the sleep interrupt), the switch is made by
hardware to the ECO. If the ECO is subsequently deactivated, the Internal Low Speed Oscillator (ILO) is again activated and the switch is made back to the ILO immediately.
The ECO Exists bit (ECO EX, bit 2 in the CPU_SCR1 register) is used to control whether the switch-over is allowed or
locked. This is a write once bit. It is written early in code execution after a Power On Reset (POR) or External Reset
(XRES) event. A ‘1’ in this bit indicates to the hardware that
a crystal exists in the system, and firmware is allowed to
switch back and forth between ECO and ILO operation. If
the bit is ‘0’, switch-over to the ECO is locked out. The ECO
Exists Written bit (ECO EXW, bit 3 in the CPU_SCR1 register) is read only and is set on the first write to this register.
When this bit is ‘1’, it indicates that the state of ECO EX is
locked. This is illustrated in Figure 10-1.
Document # 001-20559 Rev. *D21
Note Bits 3 and 2 (ECO EXW and ECO EX, respectively) in
the CPU_SCR1 register cannot be used by the CY8C27x43
for silicon revision A, and by the CY8C24533, CY8C23533,
CY8C23433, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, and CY8C22x13 PSoC devices.
Figure 10-1. Transition Between ECO and ILO Operation
The firmware steps involved in switching between the Internal Low Speed Oscillator (ILO) to the 32.768 kHz External
Crystal Oscillator (ECO) are as follows.
1. At reset, the PSoC device begins operation, using the
ILO.
2. Set the ECO EX bit to allow crystal operation.
3. Select a sleep interval of one second, using bits[4:3] in
the Oscillator Control 0 register (OSC_CR0), as the
oscillator stabilization interval.
4. Enable the ECO by setting bit [7] in Oscillator Control 0
register (OSC_CR0) to ‘1’.
External Crystal Oscillator (ECO)
C3
PSoC
Vdd
Vss
P1[1]
P1[0]
X1
Vss
VddVdd
C1C2
5. The ECO becomes the selected source at the end of the
one-second interval on the edge created by the sleep
interrupt logic. The one-second interval gives the oscillator time to stabilize before it becomes the active source.
The sleep interrupt need not be enabled for the switchover to occur. Reset the sleep timer (if this does not
interfere with any ongoing real-time clock operation), to
guarantee the interval length. Note that the ILO continues to run until the oscillator is automatically switched
over by the sleep timer interrupt.
6. It is strongly advised to wait the one-second stabilization
period prior to engaging the PLL mode to lock the IMO
frequency to the ECO frequency.
Note 1 The ILO switches back instantaneously by writing
the 32 kHz Select Control bit to ‘0’.
Note 2 If the proper settings are selected in PSoC
Designer, the above steps are automatically done in
boot.asm.
Note 3 Transitions between oscillator domains may produce glitches on the 32 kHz clock bus. Functions that
require accuracy on the 32 kHz clock should be enabled
after the transition in oscillator domains.
10.1.1ECO External Components
The external component connections and selections o f the
External Crystal Oscillator are illustrated in Figure 10-2.
An error of 1 pF in C1 and C2 gives about a 3 ppm error in
frequency.
Figure 10-2. 20-Pin Example of the ECO External
Connections
Refer to the device data sheet, in the packaging chapter, for
typical package capacitances on crystal pins.
■ Crystal – 32.768 kHz watch crystal such as Epson C-
002RX.
■ Capacitors – C1, C2 use NPO ceramic caps.
Use the equation below if you do not employ PLL mode.
C1 = C2 = 25 pF - (Package Capacitance) -
(Board Parasitic Capacitance)
10.2PSoC Device Distinctions
Bits 3 and 2 (ECO EXW and ECO EX, respectively) in the
CPU_SCR1 register cannot be used by the CY8C27x43 for
silicon revision A, and by the CY8C24533, CY8C23533,
CY8C23433, CY8C24633, CY8C24x23, and CY8C22x13
PSoC devices.
22Document # 001-20559 Rev. *D
External Crystal Oscillator (ECO)
10.3Register Definitions
The following registers are associated with the External Crystal Oscillator and are listed in address order. Each register
description has an associated register table showing the bit structure for that register. The bits that are grayed out in the
tables below are reserved bits and are not detailed in the register descriptions. Note that reserved bits should always be wri tten with a value of ‘0’. For a complete table of external crystal oscillator registers, refer to the “Summary Table of the Core
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
# A ccess is bi t sp ec if ic. Re fe r to th e
* Bits 3 and 2 (ECO EXW and ECO EX, respectively) cannot be used by the CY8C27x43 for silicon revision A, and by the CY8C24533, CY8C23533,
CY8C23433, CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
IRESSSLIMOECO EXW *ECO EX *IRAMDIS# : 00
Register Details chapter on page 47 for additional information.
The System Status and Control Register 1 (CPU_SCR1) is
used to convey the status and control of events related to
internal resets and watchdog reset.
Bit 7: IRESS. The Internal Reset Status bit is a read only bi t
that may be used to determine if the booting process
occurred more than once.
When this bit is set, it indicates that the SROM SWBootReset code was executed more than once. If this bit is not set,
the SWBootReset executed only once. In either case, the
SWBootReset code does not allow execution from code
stored in Flash until the M8C Core is in a safe operating
mode with respect to supply voltage and Flash operation.
There is no need for concern when this bit is set. It is provided for systems which may be sensitive to boot time, so
that they can determine if the normal one-pass boot time is
exceeded. For more information on the SWBootReest code
see the Supervisory ROM (SROM) chapter on page 45.
Bit 4: SLIMO. When set, the Slow IMO bit allows the active
power dissipation of the PSoC device to be reduced by
slowing down the IMO from 24 MHz to 6 MHz. The IMO trim
value must also be changed when SLIMO is set. When not
in external clocking mode, the IMO is the source for SYSCLK; therefore, when the speed of the IMO changes, so
does SYSCLK.
Bit 3: ECO EXW. The ECO Exists Written bit is used as a
status bit to indicate that the ECO EX bit has been previously written to. It is read only. When this bit is a ‘1’, this indicates that the CPU_SCR1 register has been written to and
is now locked. When this bit is a ‘0’, the register has not
been written to since the last reset event. Note that this bit
cannot be used by the CY8C27x43 for silicon revision A,
and by the CY8C24533, CY8C23533, CY8C23433,
CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
Bit 2: ECO EX. The ECO Exists bit serves as a flag to the
hardware, to indicate that an external crystal oscillator
exists in the system. Just after boot, it may be written onlyonce to a value of ‘1’ (crystal exists) or ‘0’ (crystal does not
exist). If the bit is ‘0’, a switch-over to the ECO is locked out
by hardware. If the bit is ‘1’, hardware allows the firmware to
freely switch between the ECO and ILO. It should be written
as early as possible after a Power On Reset (POR) or
External Reset (XRES) event, where it is assumed that program execution integrity is high. Note that this bit cannot be
used by the CY8C27x43 for silicon revision A, and by the
CY8C24533, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, and CY8C22x13 PSoC devices.
Bit 0: IRAMDIS. The Initialize RAM Disable bit is a control
bit that is readable and writeable. The defaul t value for this
bit is ‘0’, which indicates that the maximum amount of SRAM
should be initialized on watchdog reset to a value of 00h.
When the bit is ‘1’, the minimum amount of SRAM i s initialized after a watchdog reset. For more information on this bit,
see the “SROM Function Descriptions” on page 4 6.
For additional information, refer to the CPU_SCR1 register
The Oscillator Control Register 0 (OSC_CR0) is used to
configure various features of internal clock sources and
clock nets.
Bit 7: 32k Select. By default, the 32 kHz clock source is
the Internal Low Speed Oscillator (ILO). Optionally, the
32.768 kHz External Crystal Oscillator (ECO) may be
selected.
Bit 6: PLL Mode. This is the only bit in the OSC_ CR0 reg-
ister that directly influences the Phase-Locked Loop (PLL).
When set, this bit enables the PLL. The EXTCLKEN bit in
the OSC_CR2 register should be set low during PLL operation. For information on the PLL, refer to the Phase-Locked
Loop (PLL) chapter on page 27.
Bit 5: No Buzz. Normally, when the Sleep bit is set in the
CPU_SCR register, all PSoC device systems are powered
down, including the bandgap reference. However, to facilitate the detection of POR and LVD events at a rate higher
than the sleep interval, the bandgap circuit is powered u p
periodically for about 60 s at the Sleep System Duty Cycle
(set in ECO_TR), which is independent of the sleep interval
and typically higher. When the No Buzz bit is set, the Sleep
System Duty Cycle value is overridden and the bandgap circuit is forced to be on during sleep. This results in a faster
response to an LVD or POR event (continuous detection as
opposed to periodic detection), at the expense of higher
average sleep current.
Bits 4 and 3: Sleep[1:0]. The available sleep interval
selections are shown in Table 10-1. Remember that when
the ILO is the selected 32 kHz clock source, sleep intervals
are approximate.
Table 10-1. Sleep Interval Selections
Sleep Interval
OSC_CR[4:3]
00b (default)641.95 ms6 ms
01b51215.6 ms47 ms
10b4,096125 ms375 ms
11b32,7681 sec3 sec
Sleep Timer
Clocks
Sleep Period
(nominal)
Watchdog
Period (nominal)
Bits 2 to 0: CPU Speed[2:0]. The PSoC M8C may operate
over a range of CPU clock speeds (see Table 10-2), allowing the M8C’s performance and power requirements to be
tailored to the application.
The reset value for the CPU Speed bits is zero; therefore,
the default CPU speed is one-eighth of the clock source.
The Internal Main Oscillator (IMO) is the default clock
source for the CPU speed circuit; therefore, the default CPU
speed is 3 MHz.
The CPU frequency is changed with a write to the
OSC_CR0 register. There are eight frequencies generated
from a power-of-two divide circuit, which are selected by a
3-bit code. At any given time, the CPU 8-to-1 clock mux is
selecting one of the available frequencies, which is resynchronized to the 24 MHz master clock at the output.
Regardless of the CPU Speed bit’s setting, if the actual CPU
speed is greater than 12 MHz, the 24 MHz operating
requirements apply. An example of this scenario is a device
that is configured to use an external clock, which is supplying a frequency of 20 MHz. If the CPU speed register’s
value is 0b011, the CPU clock is 20 MHz. Therefore, the
supply voltage requirements for the device are the same as
if the part was operating at 24 MHz off of the IMO. The operating voltage requirements are not relaxed until the CPU
speed is at 12 MHz or less.
The External Crystal Oscillator Trim Register (ECO_TR)
sets the adjustment for the 32.768 kHz External Crystal
Oscillator.
The device-specific value placed in this register at boot time
is based on factory testing. This register does not adjust the
frequency of the external crystal oscillator.
It is strongly recommended that the user not alter the
register value.
Bits 7 and 6: PSSDC[1:0]. These bits are used to set the
sleep duty cycle. These bits should not be altered.
For additional information, refer to the ECO_TR register on
page 159.
Document # 001-20559 Rev. *D25
External Crystal Oscillator (ECO)
26Document # 001-20559 Rev. *D
11.Phase-Locked Loop (PLL)
This chapter presents the Phase-Locked Loop (PLL) and its associated registers. For a complete table of the PLL reg isters,
refer to the “Summary Table of the Core Registers” on page 32. For a quick reference of all PSoC registers in address order,
refer to the Register Details chapter on page 47.
11.1Architectural Description
A Phase-Locked Loop (PLL) function generates the system clock with crystal accuracy. It is designed to provide a
23.986 MHz oscillator, when utilized with an external 32.768
kHz crystal.
Although the PLL tracks crystal accuracy, it requires time to
lock onto the reference frequency when first starting. The
length of time depends on the PLLGAIN controlled by bit 7
of the OSC_CR2 register. If this bit is held low, the lock time
is less than 10 ms. If this bit is held high, the lock time is on
the order of 50 ms. After lock is achieved, it is recommended
that this bit be forced high to decrease the jitter on the output. If longer lock time is tolerable, the PLLGAIN bit can be
held high all the time.
After the 32.768 kHz External Crystal Oscillator (ECO) has
been selected and enabled, the following procedure should
be followed to enable the PLL and allow for proper frequency lock.
■ Select a CPU frequency of 3 MHz or less.
■ Enable the PLL.
■ Wait between 10 and 50 ms, depending on bit 7 of the
OSC_CR2 register.
■ Set the CPU to a faster frequency, if desired. To do this,
write the CPU Speed[2:0] bits in the OSC_CR0 register .
The CPU frequency immediately changes when these
bits are set.
If the proper settings are selected in PSoC Designer, the
above steps are automatically done in boot.asm.
11.2Register Definitions
The following registers are associated with the Phase-Locked Loop (PLL) and are listed in address order. Each register
description has an associated register table showing the bit structure for that register. The bits that are grayed out in the
tables below are reserved bits and are not detailed in the register descriptions. Note that reserved bits should always be wri tten with a value of ‘0’. For a complete table of the PLL registers, refer to the “Summary Table of the Core Registers” on
The Oscillator Control Register 0 (OSC_CR0) is used to
configure various features of internal clock sources and
clock nets.
Bit 7: 32k Select. By default, the 32 kHz clock source is
the Internal Low Speed Oscillator (ILO). Optionally, the
32.768 kHz External Crystal Oscillator (ECO) may be
selected.
Bit 6: PLL Mode. This is the only bit in the OSC_ CR0 reg-
ister that directly influences the Phase-Locked Loop (PLL).
When set, this bit enables the PLL. The EXTCLKEN bit in
the OSC_CR2 register should be set low during PLL operation.
Bit 5: No Buzz. Normally, when the Sleep bit is set in the
CPU_SCR register, all PSoC device systems are powered
down, including the bandgap reference. However, to facilitate the detection of POR and LVD events at a rate higher
than the sleep interval, the bandgap circuit is powered u p
periodically for about 60 s at the Sleep System Duty Cycle
(set in ECO_TR), which is independent of the sleep interval
and typically higher. When the No Buzz bit is set, the Sleep
System Duty Cycle value is overridden and the bandgap circuit is forced to be on during sleep. This results in a faster
response to an LVD or POR event (continuous detection as
opposed to periodic detection), at the expense of slightly
higher average sleep current.
Bits 4 and 3: Sleep[1:0]. The available sleep interval
selections are shown in Table 11-1. It must be remembered
that when the ILO is the selected 32 kHz clock source, sleep
intervals are approximate.
Table 1 1-1. Sleep Interval Selections
Sleep Interval
OSC_CR[4:3]
00b (default)641.95 ms6 ms
01b51215.6 ms47 ms
10b4096125 ms375 ms
11b32,7681 sec3 sec
Sleep Timer
Clocks
Sleep Period
(nominal)
Watchdog
Period (nominal)
Bits 2 to 0: CPU Speed[2:0]. The PSoC M8C may operate
over a range of CPU clock speeds (see Table 11-2), allowing
the M8C’s performance and power requirements to be tailored to the application.
The reset value for the CPU Speed bits is zero; therefore,
the default CPU speed is one-eighth of the clock source.
The Internal Main Oscillator (IMO) is the default clock
source for the CPU speed circuit; therefore, the default CPU
speed is 3 MHz.
The CPU frequency is changed with a write to the
OSC_CR0 register. There are eight frequencies generated
from a power-of-two divide circuit, which are selected by a
3-bit code. At any given time, the CPU 8-to-1 clock mux is
selecting one of the available frequencies, which is resynchronized to the 24 MHz master clock at the output.
Regardless of the CPU Speed bit’s setting, if the actual CPU
speed is greater than 12 MHz, the 24 MHz operating
requirements apply. An example of this scenario is a device
that is configured to use an external clock, which is supplying a frequency of 20 MHz. If the CPU speed register’s
value is 0b011, the CPU clock is 20 MHz. Therefore, the
supply voltage requirements for the device are the same as
if the part was operating at 24 MHz off of the IMO. The operating voltage requirements are not relaxed until the CPU
speed is at 12 MHz or less.
Some devices support the slow IMO option, as discussed in
the IMO chapter in the “Architectural Description” on
page 15. This offers an option to lower both system and
CPU clock speed in order to save power.
An automatic protection mechanism is available for systems
that need to run at peak CPU clock speed but cannot guarantee a high enough supply voltage for that clock speed.
See the LVDTBEN bit in the “VLT_CR Register” on
The Oscillator Control Register 2 (OSC_CR2) is used to
configure various features of internal clock sources and
clock nets.
Bit 7: PLLGAIN. This is the only bit in the OSC_CR2 register that directly influences the PLL. When set, thi s bit keeps
the PLL in Low Gain mode.
If this bit is held low, the lock time is less than 10 ms. If this
bit is held high, the lock time is on the order of 50 ms. After
lock is achieved, it is recommended that this bit be forced
high to decrease the jitter on the output. If longer lock time is
tolerable, the PLLGAIN bit can be held high all the time.
Bit 2: EXTCLKEN. When the EXTCLKEN bit is set, the
external clock becomes the source for the internal clock
tree, SYSCLK, which drives most PSoC device clocking
functions. All external and internal signals, in cluding the 32
kHz clock, whether derived from the Internal Low Speed
Oscillator (ILO) or the crystal oscillator, are synchronized to
this clock source. If an external clock is enabled, PLL mode
should be off.
The external clock input is located on port P1[4]. When
using this input, the pin Drive mode should be set to High Z
(not High Z analog).
Bit 1: RSVD. Reserved bit - This bit should always be 0.
Bit 0: SYSCLKX2DIS. When SYSCLKX2DIS is set, the
IMO’s doubler is disabled. This results in a reduction of overall device power, on the order of 1 mA. It is advised that any
application that does not require this doubled clock should
have it turned off. During emulation with the In-Circuit Emulator (ICE), the IMO’s doubler is always active regardless of
the status of SYSCLKX2DIS.
For additional information, refer to the OSC_CR2 register on
page 153.
Document # 001-20559 Rev. *D29
Phase-Locked Loop (PLL)
30Document # 001-20559 Rev. *D
12. Sleep and W atchdog
This chapter discusses the Sleep and Watchdog operations and their associated registers. For a complete table of the Sleep
and Watchdog registers, refer to the “Summary Table of the Core Registers” on page 32 . For a quick reference of all PSoC
registers in address order, refer to the Register Details chapter on page 47.
12.1Architectural Description
Device components that are involved in Sleep and Watchdog operation are the selected 32 kHz clock (external crystal
or internal), the sleep timer, the Sleep bit in the CPU_SCR0
register, the sleep circuit (to sequence going into and coming out of sleep), the bandgap refresh circuit (to periodically
refresh the reference voltage during sleep), and the watch-dog timer.
The goal of sleep operation is to reduce average power consumption as much as possible. The system has a sleep
state that can be initiated under firmware control. In this
state, the CPU is stopped at an instruction boundary and the
24/48 MHz oscillator (IMO), the Flash memory module, and
bandgap voltage reference are powered down. The only
blocks that remain in operation are the 32 kHz oscillator
(external crystal or internal), PSoC blocks clocked from the
32 kHz clock selection, and the supply voltage monitor circuit.
Analog PSoC blocks have individual power down settings
that are controlled by firmware, independently of the sleep
state. Continuous time analog blocks may remain in operation, since they do not require a clock source. Typically,
switched capacitor analog blocks do not operate, since the
internal sources of clocking for these blocks are stopped.
The system can only wake up from sleep as a result of an
interrupt or reset event. The sleep timer can provide periodic
interrupts to allow the system to wake up, poll peripherals,
or do real-time functions, and then go to sleep again. Th e
GPIO (pin) interrupt, supply monitor interrupt, analog column interrupts, and timers clocked externally or from the 32
kHz clock are examples of asynchronous interrupts that
can also be used to wake the system up.
The Watchdog Timer (WDT) circuit is designed to assert a
hardware reset to the device after a pre-programmed interval, unless it is periodically serviced in firmware. In the event
that an unexpected execution path is taken through the
code, this functionality serves to reboot the system. It also
restarts the system from the CPU halt state.
Once the WDT is enabled, it is only disabled by a Power On
Reset (POR) or an External Reset (XRES). A WDT reset
leaves the WDT enabled. Therefore, if the WDT is used in
an application, all code (including initialization code) must
be written as though the WDT is enabled.
12.1.132 kHz Clock Selection
By default, the 32 kHz clock source is the Internal Low
Speed Oscillator (ILO). Optionally, the 32.768 kHz External
Crystal Oscillator (ECO) may be activated. This selection is
made in bit 7 of the OSC_CR0 register. Selecting the ECO
as the source for the 32 kHz clock allows the sleep timer
and sleep interrupt to be used in real-time clock applications. Regardless of the clock source selected, the 32 kHz
clock plays a key role in sleep functionality. It runs continuously and is used to sequence system wake up. It is also
used to periodically refresh the bandgap voltage during
sleep.
Refer to the External Crystal Oscillator (ECO) chapter on
page 21, for details on activating an external crystal oscilla-
tor.
12.1.2Sleep Timer
The sleep timer is a 15-bit up counter clocked by the currently selected 32 kHz clock source, either the ILO or ECO.
This timer is always enabled. The exception to this is within
an ICE (in-circuit emulator) in debugger mode and when
the Stop bit in the CPU_SCR0 is set; the sleep timer is disabled, so that the user does not get continual watchdog
resets when a breakpoint is hit in the debugger environment.
If the associated sleep timer interrupt is enabled, a periodic
interrupt to the CPU is generated based on the sleep interval selected from the OSC_CR0 register. The sleep timer
functionality does not need to be directly associated with the
sleep state. It can be used as a general purpose timer interrupt regardless of sleep state.
Document # 001-20559 Rev. *D31
Sleep and Watchdog
The reset state of the sleep timer is a count value of all
zeros. There are two ways to reset the sleep timer. Any
hardware reset (that is, POR, XRES, or Watchdog Reset
(WDR), or Internal Reset (IRES) resets the sleep timer.
There is also a method that allows the user to reset the
sleep timer in firmware. A write of 38h to the RES_WDT register clears the sleep timer.
Note Any write to the RES_WDT register also clears the
watchdog timer.
Clearing the sleep timer may be done at anytime to synchronize the sleep timer operation to CPU processing. A good
example of this is after POR. The CPU hold-off, due to voltage ramp and others, may be significant. In addition, a significant amount of program initialization may be required.
However, the sleep timer starts counting immediately after
POR and is at an arbitrary count when user code begins
execution. In this case, it may be desirable to clear the sleep
timer before enabling the sleep interrupt initially, to ensure
that the first sleep period is a full interval.
12.2Application Description
The following are notes regarding sleep as it relates to firmware and application issues.
Note 1 If an interrupt is pending, enabled, and scheduled to
be taken at the instruction boundary after the write to the
sleep bit, the system does not go to sleep. The instruction
still executes, but it is not able to set the SLEEP bit in the
CPU_SCR0 register. Instead, the interrupt is taken and the
effect of the sleep instruction is ignored.
Note 2 The Global Interrupt Enable (CPU_F register) does
not need to be enabled to wake the system out of sleep
state. Individual interrupt enables, as set in the interrupt
mask registers, are sufficient. If the Global Interrupt Enable
is not set, the CPU does not service the ISR associated with
that interrupt. However, the system wakes up and continues
executing instructions from the point at which it went to
sleep. In this case, the user must manually clear the pending interrupt or subsequently enable the Global Interrupt
Enable bit and let the CPU take the ISR. If a pending interrupt is not cleared, it is continuously asserte d. Although the
sleep bit may be written and the sleep sequence executed
as soon as the device enters Sleep mode, the Sleep bit is
cleared by the pending interrupt and Sleep mode is exited
immediately.
Note 3 On wake up, the instruction immediately after the
sleep instruction is executed before the interrupt service
routine (if enabled). The instruction after the sleep instruction is pre-fetched, before the system actually goes to sleep.
Therefore, when an interrupt occurs to wake the system up,
the pre-fetched instruction is executed and then the interrupt
service routine is executed. (If the Global Interrupt Enable is
not set, instruction execution just continues where it left off
before sleep.)
Note 4 If PLL mode is enabled, CPU frequency must be
reduced to 3 MHz before going to sleep. Since the PLL
overshoots as it attempts to re-lock after wake up, the CPU
frequency must be relatively low. It is recommended to wait
10 ms after wake up, before normal CPU operating frequency may be restored.
Note 5 Analog power must be turned o ff by firmware before
going to sleep, to achieve the smallest sleep current. The
system sleep state does not control the analog array. There
are individual power controls for each analog block and
global power controls in the reference block. These power
controls must be manipulated by firmware.
Note 6 If the Global Interrupt Enable bit is disabled, it can
be safely enabled just before the in struction that writes the
sleep bit. It is usually undesirable to get an interrupt on the
instruction boundary, just before writing the Sleep bit. This
means that on the return from interrupt, the sleep command
executes, possibly bypassing any firmware preparations
that are made in order to go to sleep. To prevent this, disable interrupts before preparations are made. After sleep
preparations, enable global interrupts and write the Sleep bit
with the two consecutive instructions as follows.
and f,~01h // disable global interrupts
// (prepare for sleep, could
// be many instructions)
or f,01h // enable global interrupts
mov reg[ffh],08h // Set the sleep bit
Due to the timing of the Global Interrupt Enable instruction, it
is not possible for an interrupt to occur immediately after that
instruction. The earliest the interrupt can occur is after the
next instruction (write to the Sleep bit) has been executed.
Therefore, if an interrupt is pending, the sleep instruction is
executed; but as described in Note 1, the sleep instruction is
ignored. The first instruction executed after the ISR is the
instruction after sleep.
32Document # 001-20559 Rev. *D
Sleep and Watchdog
12.3Register Definitions
The following registers are associated with Sleep and Watchdog and are listed in address order. Each register description has
an associated register table showing the bit structure for that register. The bits that are grayed out in the tables below are
reserved bits and are not detailed in the register descriptions. Note that reserved bits should always be written with a value of
‘0’. For a complete table of the Sleep and Watchdog registers, refer to the “Summary T able of the Core Registers” on page 32.
The Interrupt Mask Register 0 (INT_MSK0) is used to
enable the individual sources’ ability to create pending interrupts.
Only certain bits are accessible to be read or written in the
analog column dependent INT_MSK0 register. In the table
above, the analog column numbers are listed to the right in
the Address column.
Bits 7 and 5 to 0. The INT_MSK0 register holds bits that
are used by several different resources. For a full discussion
of the INT_MSK0 register, see the Interrupt
Controller chapter on page 61.
Bit 6: Sleep. This bit controls the sleep interrupt enable.
For additional information, refer to the INT_MSK0 register
The Reset Watchdog Timer Register (RES_WDT) is used to
clear the watchdog timer (a write of any value) and clear
both the watchdog timer and the sleep timer (a write of 38h).
Bits 7 to 0: WDSL_Clear[7:0]. The Watchdog Timer
(WDT) write-only register is designed to timeout at three rollover events of the sleep timer. Therefore, if only the WDT is
cleared, the next Watchdog Reset (WDR) occurs anywhere
from two to three times the current sleep interval setting. If
the sleep timer is near the beginning of its count, the watchdog timeout is closer to three times.
WDSL_Clear[7:0]W : 00
However, if the sleep timer is very close to its terminalcount, the watchdog timeout is closer to two times. To
ensure a full three times timeout, both the WDT and the
sleep timer may be cleared. In applications that need a realtime clock, and thus cannot reset the sleep timer when
clearing the WDT, the duty cycle at which the WDT must be
cleared should be no greater than two times the sleep interval.
For additional information, refer to the RES_WDT register
x An “x” before the comma in the address field indicates that this register can be read or writt en to no matter what bank is used.
# Access is bit spec ific. Refer to the
* Bits 3 and 2 (ECO EXW and ECO EX, respectively) cannot be used by the CY8C27x43 for silicon revision A, and by the CY8C24533, CY8C23533,
CY8C23433, CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
IRESSSLIMOECO EXW *ECO EX *IRAMDIS# : 00
Register Details chapter on page 47 for additional information.
The System Status and Control Register 1 (CPU_SCR1) is
used to convey the status and control of events related to
internal resets and watchdog reset.
Bit 7: IRESS. The Internal Reset Status bit is a read only bit
that may be used to determine if the booting process
occurred more than once.
When this bit is set, it indicates that the SROM SWBootReset code executed more than once. If this bit is not set, the
SWBootReset executed only once. In either case, the
SWBootReset code does not allow execution from code
stored in Flash until the M8C Core is in a safe operating
mode with respect to supply voltage and Flash operation.
There is no need for concern when this bit is set. It is provided for systems which may be sensitive to boot time, so
that they can determine if the normal one-pass boot time is
exceeded. For more information on the SWBootReest code
see the Supervisory ROM (SROM) chapter on page 45.
Bit 4: SLIMO. When set, the Slow IMO bit allows the active
power dissipation of the PSoC device to be reduced by
slowing down the IMO from 24 MHz to 6 MHz. The IMO trim
value must also be changed when SLIMO is set. When not
in external clocking mode, the IMO is the source for SYSCLK; therefore, when the speed of the IMO changes, so
does SYSCLK.
Bit 3: ECO EXW. The ECO Exists Written bit is used as a
status bit to indicate that the ECO EX bit has been previously written to. It is read only. When this bit is a ‘1’, this indicates that the CPU_SCR1 register has been written to and
is now locked. When this bit is a ‘0’, the register has not
been written to since the last reset event. Note that this bit
cannot be used by the CY8C27x43 for silicon revision A,
and by the CY8C24533, CY8C23533, CY8C23433,
CY8C24633, CY8C24x23, and CY8C22x13 PSoC devices.
Bit 2: ECO EX. The ECO Exists bit serves as a flag to the
hardware, to indicate that an external crystal oscillator
exists in the system. Just after boot, it may be written onlyonce to a value of ‘1’ (crystal exists) or ‘0’ (crystal does not
exist). If the bit is ‘0’, a switch-over to the ECO is locked out
by hardware. If the bit is ‘1’, hardware allows the firmware to
freely switch between the ECO and ILO. It should be written
as early as possible after a Power On Reset (POR) or
External Reset (XRES) event, where it is assumed that program execution integrity is high. Note that this bit cannot be
used by the CY8C27x43 for silicon revision A, and by the
CY8C24533, CY8C23533, CY8C23433, CY8C24633,
CY8C24x23, and CY8C22x13 PSoC device s.
Bit 0: IRAMDIS. The Initialize RAM Disable bit is a control
bit that is readable and writeable. The defa ult valu e for this
bit is ‘0’, which indicates that the maximum amount of SRAM
should be initialized on watchdog reset to a value of 00h.
When the bit is ‘1’, the minimum amount of SRAM is initialized after a watchdog reset. For more information on this bit,
see the “SROM Function Descriptions” on page 46.
For additional information, refer to the CPU_SCR1 register
X The value for power on reset is unknown.
x An “x” before the comma in the address field indicates that this register can be read or written to no matter what bank is used.
# Access is bit specific. Refer to register detail for additional information.
GIESWDRSPORSSleepSTOP# : XX
The System Status and Control Register 0 (CPU_SCR0) is
used to convey the status and control of events for various
functions of the PSoC device.
Bit 7: GIES. The Global Interrupt Enable Status bit is a
read only status bit and its use is discouraged. The GIES bit
is a legacy bit which was used to provide the ability to read
the GIE bit of the CPU_F register. However, the CPU_F register is now readable. When this bit is set, it indicates that
the GIE bit in the CPU_F register is also set which, in turn,
indicates that the microprocessor services interrupts.
Bit 5: WDRS. The WatchDog Reset Status bit may not be
set. It is normally ‘0’ and automatically set whenever a
watchdog reset occurs. The bit is readable and clearable by
writing a zero to its bit position in the CPU_SCR0 register.
Bit 4: PORS. The Power On Reset Status (PORS) bit,
which is the watchdog enable bit, is set automatically by a
POR or External Reset (XRES). If the bit is cleared by user
code, the watchdog timer is enabled. Once cleared, the only
way to reset the PORS bit is to go through a POR or XRES.
Thus, there is no way to disable the watchdog timer, other
than to go through a POR or XRES.
Bit 3: Sleep. The Sleep bit is used to enter Low Power
Sleep mode when set. To wake up the system, this register
bit is cleared asynchronously by any enabled interrupt.
There are two special features of this register bit that
ensures proper sleep operation. First, the write to set the
register bit is blocked, if an interrupt is about to be taken on
that instruction boundary (immediately after the write). Second, there is a hardware interlock to ensure that, once set,
the Sleep bit may not be cleared by an incoming interrupt
until the sleep circuit has finished performing the sleep
sequence and the system-wide power down signal has been
asserted. This prevents the sleep circuit from being interrupted in the middle of the process of system power down,
possibly leaving the system in an indeterminate state.
Bit 0: STOP. The STOP bit is readable and writeable.
When set, the PSoC M8C stops executing code until a reset
event occurs. This can be either a POR or WDR, or XRES. If
an application wants to stop code execution until a reset, the
preferred method is to use the HALT instruction rather than
a register write to this bit.
For additional information, refer to the CPU_SCR0 register
The Oscillator Control Register 0 (OSC_CR0) is used to
configure various features of internal clock sources and
clock nets.
Bit 7: 32k Select. By default, the 32 kHz clock source is
the Internal Low Speed Oscillator (ILO). Optionally, the
32.768 kHz External Crystal Oscillator (ECO) may be
selected.
Bit 6: PLL Mode. This is the only bit in the OSC_ CR0 register that directly influences the Phase-Locked Loop (PLL).
When set, this bit enables the PLL. The EXTCLKEN bit in
the OSC_CR2 register should be set low during PLL operation. For information on the PLL, refer to the Phase-Locked
Loop (PLL) chapter on page 27.
Bit 5: No Buzz. Normally, when the Sleep bit is set in the
CPU_SCR register, all PSoC device systems are powered
down, including the bandgap reference. However, to facilitate the detection of POR and LVD events at a rate higher
than the sleep interval, the bandgap circuit is powered u p
periodically for about 60 s at the Sleep System Duty Cycle
(set in ECO_TR), which is independent of the sleep interval
and typically higher. When the No Buzz bit is set, the Sleep
System Duty Cycle value is overridden and the bandgap circuit is forced to be on during sleep. This results in a faster
response to an LVD or POR event (continuous detection as
opposed to periodic detection), at the expense of slightly
higher average sleep current.
Bits 4 and 3: Sleep[1:0]. The available sleep interval
selections are shown in Table 12-1. The accuracy of the
sleep intervals is dependent on the accuracy of the oscillator
used.
Table 12-1. Sleep Interval Selections
Sleep Interval
OSC_CR[4:3]
00b (default)641.95 ms6 ms
01b51215.6 ms47 ms
10b4,096125 ms375 ms
11b32,7681 sec3 sec
Sleep Timer
Clocks
Sleep Period
(nominal)
Watchdog
Period (nominal)
Bits 2 to 0: CPU Speed[2:0]. The PSoC M8C operates
over a range of CPU clock speeds (see T able 12-2), allowing the M8C’s performance and power requirements to be
tailored to the application.
The reset value for the CPU Speed bits is zero; therefore,
the default CPU speed is one-eighth of the clock source.
The Internal Main Oscillator (IMO) is the default clock
source for the CPU speed circuit; therefore, the default CPU
speed is 3 MHz.
The CPU frequency is changed with a write to the
OSC_CR0 register. There are eight frequencies generated
from a power-of-two divide circuit, which are selected by a
3-bit code. At any given time, the CPU 8-to-1 clock mux is
selecting one of the available frequencies, which is resynchronized to the 24 MHz master clock at the output.
Regardless of the CPU Speed bit’s setting, if the actual CPU
speed is greater than 12 MHz, the 24 MHz operating
requirements apply. An example of this scenario is a device
that is configured to use an external clock, which is supplying a frequency of 20 MHz. If the CPU speed register’s
value is 011b, the CPU clock is 20 MHz. Therefore, the supply voltage requirements for the device are the same as if
the part was operating at 24 MHz off of the IMO. The operating voltage requirements are not relaxed until the CPU
speed is at 12 MHz or less.