6.6.1 Data .................................................................................................................................................. 9
6.6.2 Direct ................................................................................................................................................ 9
— 6-MHz external ceramic resonator or internal clock mode
— 12-MHz internal CPU clock
— Internal memory
— 96 bytes of RAM
— 3 Kbytes of EPROM
— Interface can auto-configure to operate as PS/2 or USB
— No external components for switching between PS/2 and USB modes
• I/O ports
— Up to 10 versatile General Purpose I/O (GPIO) pins, individually configurable
— High current drive on any GPIO pin: 50 mA/pin current sink
— Each GPIO pin supports high-impedance inputs, internal pull-ups, open drain outputs, or traditional CMOS outputs
— Maskable interrupts on all I/O pins
— XTALIN, XTALOUT and VREG can be configured as additional input pins
• Internal low-power wake-up timer during suspend mode
— Periodic wake-up with no external components
• Optional 6-MHz internal oscillator mode
— Allows fast start-up from suspend mode
• Watchdog timer (WDT)
• Low-voltage Reset at 3.75V
• Internal brown-out reset for suspend mode
• Improved output drivers to reduce EMI
• Operating voltage from 4.0V to 5.5VDC
• Operating temperature from 0 to 70 degrees Celsius
• available in DIE form or 16-pin PDIP
• available in 18-pin SOIC, 18-pin PDIP
• Industry-standard programmer support
Document #: 38-08028 Rev. *BPage 5 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
2.0 Functional Overview
2.1enCoRe USB - The New USB Standard
Cypress has reinvented its leadership position in the low-speed USB market with a new family of innovative microcontrollers.
Introducing...enCoRe™ USB—“enhanced Component Reduction.” Cypress has leveraged its design expertise in USB solutions
to create a new family of low-speed USB microcontrollers that enables peripheral developers to design new products with a
minimum number of components. At the heart of the Cypress enCoRe USB technology is the breakthrough design of a crystalless oscillator. By integrating the oscillator into the chip, an external crystal or resonator is no longer needed. We have also
integrated other external components commonly found in low-speed USB applications such as pull-up resistors, wake-up circuitry,
and a 3.3V regulator. All of this adds up to a lower system cost.
The family is comprised of 8-bit RISC One Time Programmable (OTP) microcontrollers. The instruction set has been optimized
specifically for USB and PS/2 operations, although the microcontrollers can be used for a variety of other embedded applications.
The features up to 10 general-purpose I/O (GPIO) pins to support USB, PS/2 and other applications. The I/O pins are grouped
into two ports (Port 0 to 1) where each pin can be individually configured as inputs with internal pull-ups, open drain outputs, or
traditional CMOS outputs with programmable drive strength of up to 50 mA output drive. Additionally, each I/O pin can be used
to generate a GPIO interrupt to the microcontroller.
The microcontrollers feature an internal oscillator. With the presence of USB traffic, the internal oscillator can be set to precisely
tune to USB timing requirements (6 MHz ±1.5%). This clock generator has been optimized to reduce clock-related noise
emissions (EMI), and provides the 6-MHz and 12-MHz clocks that remain internal to the microcontroller. When using the internal
oscillator, XTALIN and XTALOUT can be configured as additional input pins that can be read on port 2. Optionally, an external 6MHz ceramic resonator can be used to provide a higher precision reference if needed.
The is offered with 3 Kbytes of EPROM to minimize cost, and has 96 bytes of data RAM for stack space, user variables, and
USB endpoint FIFOs.
The family includes low-voltage reset logic, a watchdog timer, a vectored interrupt controller, and a 12-bit free-running timer. The
low-voltage reset (LVR) logic detects when power is applied to the device, resets the logic to a known state, and begins executing
instructions at EPROM address 0x0000. LVR will also reset the part when V
watchdog timer can be used to ensure the firmware never gets stalled for more than approximately 8 ms.
The microcontroller supports 7 maskable interrupts in the vectored interrupt controller. Interrupt sources include the USB BusReset, the 128-µs and 1.024-ms outputs from the free-running timer, two USB endpoints, an internal wake-up timer and the GPIO
port. The timers bits cause periodic interrupts when enabled. The USB endpoints interrupt after USB transactions complete on
the bus. The GPIO port has a level of masking to select which GPIO inputs can cause a GPIO interrupt. For additional flexibility,
the input transition polarity that causes an interrupt is programmable for each GPIO pin. The interrupt polarity can be either rising
or falling edge.
The free-running 12-bit timer clocked at 1 MHz provides two interrupt sources as noted above (128 µs and 1.024 ms). The timer
can be used to measure the duration of an event under firmware control by reading the timer at the start and end of an event,
and subtracting the two values.
The CY7C63221/31A includes an integrated USB serial interface engine (SIE). The hardware supports one USB device address
with two endpoints. The SIE allows the USB host to communicate with the function integrated into the microcontroller. A 3.3V
regulated output pin provides a pull-up source for the external USB resistor on the D– pin. When using an external voltage
regulator VREG can be configured as an input pin that can be read on port 2 (P2.0).
The USB D+ and D– USB pins can alternately be used as PS/2 SCLK and SDATA signals, so that products can be designed to
respond to either USB or PS/2 modes of operation. PS/2 operation is supported with internal pull-up resistors on SCLK and
SDATA, the ability to disable the regulator output pin, and an interrupt to signal the start of PS/2 activity. No external components
are necessary for dual USB and PS/2 systems, and no GPIO pins need to be dedicated to switching between modes. Slow edge
rates operate in both modes to reduce EMI.
drops below the operating voltage range. The
CC
Document #: 38-08028 Rev. *BPage 6 of 50
3.0 Logic Block Diagram
FOR
FOR
enCoRe™ USB
CY7C63221/31A
XTALIN/P2.1
XTALIN/P2.1XTALOUT
Internal
Oscillato r
EPROM
3 Kbytes
Brown-Out
Reset
Watch Dog
Timer
Low Voltage
Reset
4.0 Pin Configurations
CY7C63221A
16-pin PDIP
P0.0
P0.1
P0.2
P0.3
V
SS
V
PP
VREG/P2.0
XTALIN/P2.1
1
2
3
4
5
6
7
8
P0.4
16
15
P0.5
P0.6
14
P0.7
13
12
D+/SCLK
11
D–/SDATA
10
V
XTALOUT/P2.2
9
CC
XTALOUT/P2.2
Xtal
Oscillato r
8-bit
RISC
Core
Wake-Up
Timer
Interrupt
Controller
3.3V
Regulator
RAM
96 Bytes
USB
Engine
USB &
PS/2
Xcvr
12-bit
Timer
Port 0
GPIO
VREG/P2.0D+ D-P0.0-P0.7 P1.0-P1.1
(Top View)
CY7C63231A
18-pin SOIC/PDIP
P0.0
1
P0.1
2
P0.2
3
P0.3
4
P1.0
5
6
V
SS
7
V
PP
VREG/P2.0
XTALIN/P2.1
8
9
P0.4
18
17
P0.5
P0.6
16
P0.7
15
P1.1
14
13
D+/SCLK
12
D–/SDATA
V
11
XTALOUT/P2.2
10
CC
CY7C63221A-XC/XWC
DIE
P0.3
P1.0
Vss
Port 1
GPIO
4
5
6
3 P0.2
2 P0.1
7 8 9
Vpp
VREG/P2.0
1 P0.0
18 P0.4
101112
XTALIN/P2.1
XTALOUT/P2.2
17 P0.5
Vcc
16 P0.6
15
14
13
D-/SDATA
P0.7
P1.1
D+/SCLK
5.0 Pin Assignments
CY7C63231A/
CY7C63221A-XC
NameI/O
D–/SDATA,
D+/SCLK
P0[7:0]I/O1, 2, 3, 4,
I/O11
12
13, 14, 15, 16
12
13
1, 2, 3, 4,
15, 16, 17, 18
USB differential data lines (D– and D+), or PS/2 clock and data
signals (SDATA and SCLK)
GPIO Port 0 capable of sinking up to 50 mA/pin, or sinking
controlled low or high programmable current. Can also source
2 mA current, provide a resistive pull-up, or serve as a highimpedance input.
P1[1:0]I/ONA5,14IO Port 1 capable of sinking up to 50 mA/pin, or sinking controlled
low or high programmable current. Can also source 2 mA current,
provide a resistive pull-up, or serve as a high-impedance input.
Document #: 38-08028 Rev. *BPage 7 of 50
Description16-Pin18-Pin/Pad
FOR
FOR
enCoRe™ USB
CY7C63221/31A
5.0 Pin Assignments (continued)
CY7C63231A/
CY7C63221A-XC
NameI/O
XTALIN/P2.1IN896-MHz ceramic resonator or external clock input, or P2.1 input
XTALOUT/P2.2IN9106-MHz ceramic resonator return pin or internal oscillator output,
or P2.2 input
V
PP
V
CC
VREG/P2.0 78Voltage supply for 1.3-kΩ USB pull-up resistor (3.3V nominal).
V
SS
67Programming voltage supply, ground for normal operation
1011Voltage supply
Also serves as P2.0 input.
56Ground
6.0 Programming Model
Refer to the CYASM Assembler User’s Guide for more details on firmware operation with the microcontrollers.
6.1Program Counter (PC)
The 14-bit program counter (PC) allows access for 3 Kbytes of EPROM using the architecture. The program counter is cleared
during reset, such that the first instruction executed after a reset is at address 0x0000. This is typically a jump instruction to a
reset handler that initializes the application.
The lower 8 bits of the program counter are incremented as instructions are loaded and executed. The upper 6 bits of the program
counter are incremented by executing an XPAGE instruction. As a result, the last instruction executed within a 256-byte “page”
of sequential code should be an XPAGE instruction. The assembler directive “XPAGEON” will cause the assembler to insert
XPAGE instructions automatically. As instructions can be either one or two bytes long, the assembler may occasionally need to
insert a NOP followed by an XPAGE for correct execution.
The program counter of the next instruction to be executed, carry flag, and zero flag are saved as two bytes on the program stack
during an interrupt acknowledge or a CALL instruction. The program counter, carry flag, and zero flag are restored from the
program stack only during a RETI instruction.
Please note the program counter cannot be accessed directly by the firmware. The program stack can be examined by reading
SRAM from location 0x00 and up.
Note that there are restrictions in using the JMP, CALL, and INDEX instructions across the 4-KB boundary of the program memory.
Refer to the CYASM Assembler User’s Guide for a detailed description.
Description16-Pin18-Pin/Pad
6.28-bit Accumulator (A)
The accumulator is the general-purpose, do-everything register in the architecture where results are usually calculated.
6.38-bit Index Register (X)
The index register “X” is available to the firmware as an auxiliary accumulator. The X register also allows the processor to perform
indexed operations by loading an index value into X.
6.48-bit Program Stack Pointer (PSP)
During a reset, the program stack pointer (PSP) is set to zero. This means the program “stack” starts at RAM address 0x00 and
“grows” upward from there. Note that the program stack pointer is directly addressable under firmware control, using the MOV
PSP,A instruction. The PSP supports interrupt service under hardware control and CALL, RET, and RETI instructions under
firmware control.
During an interrupt acknowledge, interrupts are disabled and the program counter, carry flag, and zero flag are written as two
bytes of data memory. The first byte is stored in the memory addressed by the program stack pointer, then the PSP is incremented.
The second byte is stored in memory addressed by the program stack pointer and the PSP is incremented again. The net effect
is to store the program counter and flags on the program “stack” and increment the program stack pointer by two.
The return from interrupt (RETI) instruction decrements the program stack pointer, then restores the second byte from memory
addressed by the PSP. The program stack pointer is decremented again and the first byte is restored from memory addressed
by the PSP. After the program counter and flags have been restored from stack, the interrupts are enabled. The effect is to restore
the program counter and flags from the program stack, decrement the program stack pointer by two, and re-enable interrupts.
Document #: 38-08028 Rev. *BPage 8 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
The call subroutine (CALL) instruction stores the program counter and flags on the program stack and increments the PSP by two.
The return from subroutine (RET) instruction restores the program counter, but not the flags, from program stack and decrements
the PSP by two.
6.58-bit Data Stack Pointer (DSP)
The data stack pointer (DSP) supports PUSH and POP instructions that use the data stack for temporary storage. A PUSH
instruction will pre-decrement the DSP, then write data to the memory location addressed by the DSP. A POP instruction will read
data from the memory location addressed by the DSP, then post-increment the DSP.
During a reset, the Data Stack Pointer will be set to zero. A PUSH instruction when DSP equals zero will write data at the top of
the data RAM (address 0xFF). This would write data to the memory area reserved for a FIFO for USB endpoint 0. In non-USB
applications, this works fine and is not a problem.
For USB applications, the firmware should set the DSP to an appropriate location to avoid a memory conflict with RAM dedicated
to USB FIFOs. Since there are only 80 bytes of RAM available (except Endpoint FIFOs) the DSP should be set between 0x00
and 0x4Fh. The memory requirements for the USB endpoints are shown in Section 8.2. For example, assembly instructions to
set the DSP to 20h (giving 32 bytes for program and data stack combined) are shown below:
MOV A,20h; Move 20 hex into Accumulator (must be D8h or less to avoid USB FIFOs)
SWAP A,DSP ; swap accumulator value into DSP register
6.6Address Modes
The microcontroller supports three addressing modes for instructions that require data operands: data, direct, and indexed.
6.6.1Data
The “Data” address mode refers to a data operand that is actually a constant encoded in the instruction. As an example, consider
the instruction that loads A with the constant 0x30:
• MOV A, 30h
This instruction will require two bytes of code where the first byte identifies the “MOV A” instruction with a data operand as the
second byte. The second byte of the instruction will be the constant “0xE8h”. A constant may be referred to by name if a prior
“EQU” statement assigns the constant value to the name. For example, the following code is equivalent to the example shown
above:
• DSPINIT: EQU 30h
• MOV A,DSPINIT
6.6.2Direct
“Direct” address mode is used when the data operand is a variable stored in SRAM. In that case, the one byte address of the
variable is encoded in the instruction. As an example, consider an instruction that loads A with the contents of memory address
location 0x10h:
• MOV A, [10h]
In normal usage, variable names are assigned to variable addresses using “EQU” statements to improve the readability of the
assembler source code. As an example, the following code is equivalent to the example shown above:
• buttons: EQU 10h
• MOV A,[buttons]
6.6.3Indexed
“Indexed” address mode allows the firmware to manipulate arrays of data stored in SRAM. The address of the data operand is
the sum of a constant encoded in the instruction and the contents of the “X” register. In normal usage, the constant will be the
“base” address of an array of data and the X register will contain an index that indicates which element of the array is actually
addressed:
• array: EQU 10h
•MOV X,3
• MOV A,[x+array]
This would have the effect of loading A with the fourth element of the SRAM “array” that begins at address 0x10h. The fourth
element would be at address 0x13h.
Document #: 38-08028 Rev. *BPage 9 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
7.0 Instruction Set Summary
Refer to the CYASM Assembler User’s Guide for detailed information on these instructions. Note that conditional jump instructions
(i.e. JC, JNC, JZ, JNZ) take 5 cycles if jump is taken, 4 cycles if no jump.
MNEMONICOperandOpcodeCycles
HALT 007NOP 204
ADD A,expr data014
ADD A,[expr] direct026INC X x224
ADD A,[X+expr] index037
ADC A,expr data044INC [X+expr] index248
ADC A,[expr] direct056DEC A acc254
ADC A,[X+expr] index067
SUB A,expr data074DEC [expr] direct277
SUB A,[expr] direct086DEC [X+expr] index288
SUB A,[X+expr] index097
SBB A,expr data0A4IOWR expr address2A5
SBB A,[expr] direct0B6POP A2B4
SBB A,[X+expr] index0C7
OR A,expr data0D4PUSH A2D5
OR A,[expr] direct0E6PUSH X2E5
OR A,[X+expr] index0F7
AND A,expr data104SWAP A,DSP305
AND A,[expr] direct116MOV [expr],A direct315
AND A,[X+expr] index127
XOR A,expr data134OR [expr],A direct337
XOR A,[expr] direct146OR [X+expr],A index348
XOR A,[X+expr] index157
CMP A,expr data165AND [X+expr],A index368
CMP A,[expr] direct177XOR [expr],A direct377
CMP A,[X+expr] index188
MOV A,expr data194
MOV A,[expr] direct1A5
MOV A,[X+expr] index1B6
MOV X,expr data1C4ASR 3C4
MOV X,[expr] direct1D5RLC 3D4
reserved 1E
XPAGE 1F4RET 3F8
MOV A,X404
MOV X,A414EI 724
MOV PSP,A604
CALL addr50 - 5F10
JMP addr80-8F5
CALL addr90-9F10
JZ addrA0-AF5 (or 4)
JNZ addrB0-BF5 (or 4)
MNEMONICOperandOpcodeCycles
INC A acc214
INC [expr] direct237
DEC X x264
IORD expr address295
POP X2C4
SWAP A,X2F5
MOV [X+expr],A index326
AND [expr],A direct357
XOR [X+expr],A index388
IOWX [X+expr] index396
CPL 3A4
ASL 3B4
RRC 3E4
DI 704
RETI 738
JC addrC0-CF5 (or 4)
JNC addrD0-DF5 (or 4)
JACC addrE0-EF7
INDEX addrF0-FF14
Document #: 38-08028 Rev. *BPage 10 of 50
FOR
FOR
8.0 Memory Organization
8.1Program Memory Organization
After resetAddress
14-bit PC0x0000Program execution begins here after a reset.
enCoRe™ USB
CY7C63221/31A
0x0002USB Bus Reset interrupt vector
0x0004128-µs timer interrupt vector
0x00061.024-ms timer interrupt vector
0x0008USB endpoint 0 interrupt vector
0x000AUSB endpoint 1 interrupt vector
0x000CReserved
0x000EReserved
0x0010Reserved
0x0012Reserved
0x0014GPIO interrupt vector
0x0016Wake-up interrupt vector
0x0018Program Memory begins here
0x0BDF3 KB PROM ends here (3K - 32 bytes). See Note 1 below
Figure 8-1. Program Memory Space with Interrupt Vector Table
Note:
1. The upper 32 bytes of the 3K PROM are reserved. Therefore, user’s program must not over-write this space.
Document #: 38-08028 Rev. *BPage 11 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
8.2Data Memory Organization
The microcontroller provides 96 bytes of data RAM. In normal usage, the SRAM is partitioned into four areas: program stack,
data stack, user variables and USB endpoint FIFOs as shown below:
After resetAddress
8-bit DSP8-bit PSP0x00Program Stack Growth
(User’s firmware
moves DSP)
8-bit DSPUser selectedData Stack Growth
User Variables
0x4F
0xF0
0xF8
Top of RAM Memory0xFF
USB FIFO for Address A endpoint 1
USB FIFO for Address A endpoint 0
Document #: 38-08028 Rev. *BPage 12 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
8.3I/O Register Summary
I/O registers are accessed via the I/O Read (IORD) and I/O Write (IOWR, IOWX) instructions. IORD reads the selected port into
the accumulator. IOWR writes data from the accumulator to the selected port. Indexed I/O Write (IOWX) adds the contents of X
to the address in the instruction to form the port address and writes data from the accumulator to the specified port. Note that
specifying address 0 with IOWX (e.g., IOWX 0h) means the I/O port is selected solely by the contents of X.
Note:All bits of all registers are cleared to all zeros on reset, except the Processor Status and Control Register (Figure 18-
1). All registers not listed are reserved, and should never be written by firmware. All bits marked as reserved should always be
written as 0 and be treated as undefined by reads.
Table 8-1. I/O Register Summary
Register NameI/O AddressRead/WriteFunctionFig.
Port 0 Data0x00R/WGPIO Port 012-2
Port 1 Data0x01R/WGPIO Port 112-3
Port 2 Data0x02RAuxiliary input register for D+, D–, VREG, XTALIN,
XTALOUT
Port 0 Interrupt Enable0x04WInterrupt enable for pins in Port 019-4
Port 1 Interrupt Enable0x05WInterrupt enable for pins in Port 119-5
Port 0 Interrupt Polarity 0x06WInterrupt polarity for pins in Port 019-6
Port 1 Interrupt Polarity 0x07WInterrupt polarity for pins in Port 119-7
Port 0 Mode0 0x0AWControls output configuration for Port 012-4
Port 0 Mode10x0BW12-5
Port 1 Mode00x0CWControls output configuration for Port 112-6
Port 1 Mode10x0DW12-7
USB Device Address0x10R/WUSB Device Address register14-1
Processor Status & Control0xFFR/WProcessor status and control18-1
12-8
Document #: 38-08028 Rev. *BPage 13 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
9.0 Clocking
The chip can be clocked from either the internal on-chip clock, or from an oscillator based on an external resonator/crystal, as
shown in Figure 9-1. No additional capacitance is included on chip at the XTALIN/OUT pins. Operation is controlled by the Clock
Configuration Register, Figure 9-2.
External Clock Resume Delay bit selects the delay time when switching to the external oscillator from the internal oscillator
mode, or when waking from suspend mode with the external oscillator enabled.
1 = 4 ms delay.
0 = 128 µs delay.
The delay gives the oscillator time to start up. The shorter time is adequate for operation with ceramic resonators, while the
longer time is preferred for start-up with a crystal. (These times do not include an initial oscillator start-up time which depends
on the resonating element. This time is typically 50–100 µs for ceramic resonators and 1–10 ms for crystals). Note that this
bit only selects the delay time for the external clock mode. When waking from suspend mode with the internal oscillator (Bit 0
is LOW), the delay time is only 8 µs in addition to a delay of approximately 1 µs for the oscillator to start.
Bit [6:4]: Wake-up Timer Adjust Bit [2:0]
The Wake-up Timer Adjust Bits are used to adjust the Wake-up timer period.
If the Wake-up interrupt is enabled in the Global Interrupt Enable Register, the microcontroller will generate wake-up interrupts
periodically. The frequency of these periodical wake-up interrupts is adjusted by setting the Wake-up Timer Adjust Bit [2:0],
as described in Section 11.2. One common use of the wake-up interrupts is to generate periodical wake-up events during
suspend mode to check for changes, such as looking for movement in a mouse, while maintaining a low average power.
Bit 3: Low-voltage Reset Disable
When V
microcontroller enters a partial suspend state for a period of t
drops below V
CC
(see Section 23.0 for the value of V
LVR
) and the Low-voltage Reset circuit is enabled, the
LVR
(see Section 24.0 for the value of t
START
START
). Program
Document #: 38-08028 Rev. *BPage 14 of 50
FOR
FOR
enCoRe™ USB
CY7C63221/31A
execution begins from address 0x0000 after this t
executes code. See Section 10.1 for more details.
1 = Disables the LVR circuit.
0 = Enables the LVR circuit.
Bit 2: Precision USB Clocking Enable
The Precision USB Clocking Enable only affects operation in internal oscillator mode. In that mode, this bit must be set to
1 to cause the internal clock to automatically precisely tune to USB timing requirements (6 MHz ±1.5%). The frequency
may have a looser initial tolerance at power-up, but all USB transmissions from the chip will meet the USB specification.
1 = Enabled. The internal clock accuracy is 6 MHz ±1.5% after USB traffic is received.
0 = Disabled. The internal clock accuracy is 6 MHz ±5%.
Bit 1: Internal Clock Output Disable
The Internal Clock Output Disable is used to keep the internal clock from driving out to the XTALOUT pin. This bit has no effect
in the external oscillator mode.
1 = Disable internal clock output. XTALOUT pin will drive HIGH.
0 = Enable the internal clock output. The internal clock is driven out to the XTALOUT pin.
Bit 0: External Oscillator Enable
At power-up, the chip operates from the internal clock by default. Setting the External Oscillator Enable bit HIGH disables the
internal clock, and halts the part while the external resonator/crystal oscillator is started. Clearing this bit has no immediate
effect, although the state of this bit is used when waking out of suspend mode to select between internal and external clock.
In internal clock mode, XTALIN pin will be configured as an input with a weak pull-down and can be used as a GPIO input
(P2.1).
1 = Enable the external oscillator. The clock is switched to external clock mode, as described in Section 9.1.
0 = Enable the internal oscillator.
delay period. This provides time for VCC to stabilize before the part
START
9.1Internal/External Oscillator Operation
The internal oscillator provides an operating clock, factory set to a nominal frequency of 6 MHz. This clock requires no external
components. At power-up, the chip operates from the internal clock. In this mode, the internal clock is buffered and driven to the
XTALOUT pin by default, and the state of the XTALIN pin can be read at Port 2.1. While the internal clock is enabled, its output
can be disabled at the XTALOUT pin by setting the Internal Clock Output Disable bit of the Clock Configuration Register.
Setting the External Oscillator Enable bit of the Clock Configuration Register HIGH disables the internal clock, and halts the part
while the external resonator/crystal oscillator is started. The steps involved in switching from Internal to External Clock mode are
as follows:
1. At reset, chip begins operation using the internal clock.
2. Firmware sets Bit 0 of the Clock Configuration Register. For example,
mov A, 1h ; Set Bit 0 HIGH (External Oscillator Enable bit). Bit 7 cleared gives faster start-up
iowr F8h; Write to Clock Configuration Register
3. Internal clocking is halted, the internal oscillator is disabled, and the external clock oscillator is enabled.
4. After the external clock becomes stable, chip clocks are re-enabled using the external clock signal. (Note that the time for the
external clock to become stable depends on the external resonating device; see next section.)
5. After an additional delay the CPU is released to run. This delay depends on the state of the Ext. Clock Resume Delay bit of
the Clock Configuration Register. The time is 128 µs if the bit is 0, or 4 ms if the bit is 1.
6. Once the chip has been set to external oscillator, it can only return to internal clock when waking from suspend mode. Clearing
bit 0 of the Clock Configuration Register will not re-enable internal clock mode until suspend mode is entered. See Section
11.0 for more details on suspend mode operation.
If the Internal Clock is enabled, the XTALIN pin can serve as a general-purpose input, and its state can be read at Port 2, Bit 1
(P2.1). Refer to Figure 12-8 for the Port 2 Data Register. In this mode, there is a weak pull-down at the XTALIN pin. This input
cannot provide an interrupt source to the CPU.
9.2External Oscillator
The user can connect a low-cost ceramic resonator or an external oscillator to the XTALIN/XTALOUT pins to provide a precise
reference frequency for the chip clock, as shown in Figure 9-1. The external components required are a ceramic resonator or
crystal and any associated capacitors. To run from the external resonator, the External Oscillator Enable bit of the Clock Configuration Register must be set to 1, as explained in the previous section.
Document #: 38-08028 Rev. *BPage 15 of 50
Loading...
+ 35 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.