4.2 I/O Registe r Su mmary ......... ............. .. .............. .. ............. .. ............. ... ............. ............. .. .. ............10
4.3 Instruction Set Summary ............................................................................................................12
5.0 PROGRAMM I N G M OD E L ..... .. .. .............. .. ............. .. ............. ... ............. .. ............. ... ............. .. .......13
5.1 14-Bit Program Counter (PC) ......................................................................................................13
5.1.1 Program Memory Organization .........................................................................................................14
5.4 8-Bit Program Stack Pointer (PSP) ............................................................................................15
5.4.1 Data Memory Organization ................................................................................................................15
5.5 8-Bit Data Stack Pointer (DSP) ................................................................................................... 15
5.6 Address Mo d e s ............... ... ............. .. ............. ... ............. .. ............. .. .............. .. ............. ................16
5.6.1 Data (Immediate) .................................................................................................................................16
5.6.2 Direct ...................................................................................................................................................16
16.1 Interrup t V e c to r s ........... ... ............. .. ............. ... ............. .. ............. .. .............. .. .............................28
16.2 Interrup t L a te n c y ..................... ... ............. .. ............. ... ............. .. .. .............. .. ............. ..................30
16.3 USB Bus Reset Interrupt ...........................................................................................................30
16.6 USB Hub Int e rr u p t ................... ... ............. .. ............. ... .. ............. .. .............. .. ............. .. ................30
18.0 USB HUB ....................................................................................................................................33
18.1 Connecting/Disconnecting a USB Device ...............................................................................33
18.2 Enablin g/ D is a b l in g a U SB D e vice .......... .. ............. ... ............. .. ............. ... ............. ............. .. .....34
18.3 Hub Downstream Ports Status and Control ............................................................................34
18.4 Downstream Port Suspend and Resume ................................................................................35
18.5 USB Upstream Port Status and Control ..................................................................................36
19.0 USB SERIAL IN T E R F A CE ENGINE OP ER A T ION ..................... .. .............. .. ............. .. ..............37
19.1 USB Device Addresses .............................................................................................................37
19.2 USB Device Endpoints ..............................................................................................................37
19.3 USB Contr o l E n dp o i n t M o d e Re g i sters ... .. .............. .. ............. .. .............. .. ............. .. ............. ...38
19.4 USB Non-Control Endpoint Mode Registers ............................... ............................................38
19.5 USB Endpoint Counter Registers ............................................................................................39
19.6 Endpoint Mode/Count Registers Update and Locking Mechanism ....................... ...............39
20.0 USB MODE T A B L E S .............. .............. .. ............. .. ............. ... ............. .. ............. ... ............. .........41
Figure 18-8. Hub Ports Suspend Register 0x4D (read/write), 1 = Port is Selectivel y Su spended36
Figure 18-9. Hub Ports Resume Status Register 0x4E (read only), 1 = Port is in Resume State 36
Figure 18-10. USB Status and Control Register 0x1F (read/write) .......................................... ......36
• Hardware Assisted Parallel Interface (HAPI) for data transfer to external devices
• I/O ports
—Three GPIO ports (Port 0 to 2) capable of sinking 8 mA per pin (typical)
—An additional GPIO port (Port 3) capable of sinking 12 mA per pin (typical) for high current requirements: LEDs
—Higher current drive achievable by connecting multiple GPIO pins together to drive a common output
—Each GPIO port can be configured as inputs w ith internal pull-ups or open drain outputs or traditional CMO S outputs
—A Digital to Analog Conversion (DAC) port with programma ble current sink outputs is available on the CY7C66 113
device
—Maskable interrupts on all I/O pins
• 12-bit free-running timer with one microsecond clock ticks
• Watch Dog Timer (WDT)
• Internal Power-On Reset (POR)
• USB Specification Compliance
—Conforms to USB Specification, Version 1.1
—Conforms to USB HID Specification, Version 1.1
—Supports one or two device addresses with up to 5 user configured endpoints
Up to two 8-byte control endpoints
Up to four 8-byte data endpoints
Up to two 32-byte data endpoints
—Integrated USB transceivers
—Supports 4 Downstream USB ports
—GPIO pins can provide individual power control outputs for each Downstream USB port
—GPIO pins can provide individual port over current inputs for each Downstream USB port
• Improved output drivers to reduce EMI
• Operating voltage from 4.0V to 5.5V DC
• Operating temperature from 0 to 70 degrees Celsius
• CY7C66013 available in 48-pin PDIP (-PC) or 48-pin SSOP (-PVC) packages
• CY7C66113 available in 56-pin SSOP (-PVC) packages
• Industry-standard programmer support
Document #: 38-08024 Rev. **Page 6 of 53
CY7C66013
CY7C66113
2.0 Functional Overview
The CY7C66013 and CY 7C66 113 are compound devices with a ful l-s pee d U SB mi cro co ntro lle r in c om bin ati on with a USB hub.
Each device is well suited for combination peripheral functions with hubs, such as a keyboard hub function. The 8-bit
one-time-programmable microcontroller with a 12-MBps USB Hub supports as many as 4 downstream ports.
The CY7C66013 feat ures 29 GP IO pins to s upport USB a nd other appli cations . The I/O pins are groupe d into four ports (P0[7:0 ],
P1[7:0], P2[7:0], P3[4:0]) where each port can be configured as inputs with internal pull-ups, open drain outputs, or traditional
CMOS outputs. Ports 0 to 2 are rated at 8 mA per pin (typical) sink current. Port 3 pins are rated at 12 mA per pin (typical) sink
current, which allows these pins to drive LEDs. Multiple GPIO pins can be connected together to drive a single output for more
drive current capac ity. Additio nal ly, eac h I /O pi n c an be us ed to g ene rate a GPIO interrupt to the micro co ntro lle r. All of the GPIO
interrupts all share the same “GPIO” interrupt vector.
The CY7C66113 has 31 GPIO p ins (P0 [7:0 ], P1 [7:0 ], P2 [7:0 ], P3 [6:0 ]). Additionally, the CY7C66113 featur es an ad diti ona l 8 I/O
pins in the Digital to Analog Conversion (DAC) port (P4[7:0] ). Every DAC pin includes an in tegrated 14-k Ω pull-up resistor. When
a ‘1’ is wr itten to a DAC I/O pin, th e output current sink is disabled a nd the output pin i s driven HIGH by the internal pull-up re sistor.
When a ‘0’ is written to a DAC I/ O pin, the internal p ull-up is disable d and the o utput pin p rovides the program med amount of sink
current. A DAC I/O pin can be used as an input with an internal pull-up by writing a ‘1’ to the pin.
The sink current for each DAC I/O pin can be individually programmed to one of sixteen values using dedicated Isink registers.
DAC bits DAC[1:0] can be used as high current outputs with a programmable sink current range of 3.2 to 16 mA (typical). DAC
bits DAC[7:2] have a programmable current sink range of 0.2 to 1.0 mA (typical). Multiple DAC pins can be connected together
to drive a single output that requires more sink current capacity. Each I/O pin can be used to generate a DAC interrupt to the
microcontroller. Also, the interrupt polarity for each DAC I/O pin is individually programmable.
The microcontroller uses an external 6-MHz crystal and an internal oscillator to provide a reference to an internal PLL-based
clock generator. This technology allow s the c ustom er appli cation to use an i nexpe nsive 6-MHz fundam ental crysta l that redu ce s
the clock-related noise emissions (EMI). A PLL clock generator provides the 6-, 12-, and 48-MHz clock signals for distribution
within the microcontroller.
The CY7C66013 and CY7C 66113 have 8 KB of PROM . These parts als o include Power-on Reset lo gic, a W atch Dog T imer, and
a 12-bit free-running timer. The Power-On Reset (POR) logic detects when power is applied to the device, resets the logic to a
known state, and begins executing instructions at PROM address 0x0000. The Watch Dog Timer is used to ensure the microcontroller recovers after a peri od of inac tiv ity. The firmw are may beco me inac tive for a va riety of reasons, including errors in the
code or a hardware failure such as waiting for an interrupt that never occurs.
2
The microcontroller can communicate with external electronics through the GPIO pins. An I
dates a 100-kHz serial link with an external device. There is also a Hardware Assisted Parallel Interface (HAPI) which can be
used to transfer data to an external device.
The free-running 12-bit timer clocked at 1 MHz provides two interrupt sources, 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 of the event and after the event is
complete. The difference between the two readings indicates the duration of the event in microseconds. The upper four bits of
the timer are latched into a n internal register whe n the firmware reads the lower eight bits. A rea d from the upper four bits actually
reads data from the internal register, instead of the timer. This feature eliminates the need for firmware to try to compensate if
the upper four bits increment immediately after the lower eight bits are read.
The microcontroller su pports 11 m as kab le in terru pts in the vectored interrupt control ler. Interrupt s ou rces i nc lud e th e 1 28-µs (bit
6) and 1.024-ms (bit 9) outpu ts from the free-runn ing timer, five USB endpoints , the USB hub, the DAC po rt, the GPIO ports, an d
2
C-compatible master mode interface. The timer bits cause an interrupt (if enabled) when the bit toggles from LOW ‘0’ to
the I
HIGH ‘1.’ The USB en dpoints interrupt after the USB host h as written data to the endpoint FIFO or af ter the USB controlle r sends
a packet to the USB host. The DAC ports have an additional level of masking that allows the user to select which DAC inputs
can cause a DAC interrupt. Th e GPIO ports a lso have a level of m asking to select which GPIO inpu ts can cause a GPIO int errupt.
For additional flexibility, the input transition polarity that causes an interrupt is programmable for each pin of the DAC port. Input
transition polarity can be programmed for each GPIO port as part of the port configuration. The interrupt polarity can be rising
edge (‘0’ to ‘1’) or falling edge (‘1’ to ‘0’).
The CY7C66013 and CY7C66113 include an integrated USB Serial Interface Engine (SIE) that supports the integrated peripherals and the hub controller function. The hardware supports up to two USB device addresses with one device address for the
hub (two endpoints) and a dev ice address for a compound de vice (three endpoints). The SIE allows the USB host to communi cate
with the hub and functions integrated into the microcontroller. The part includes a 1:4 hub repeater with one upstream port and
four downstream po rts . Th e USB H ub al lows p ow er-management control of th e dow n stre am po rts by u si ng GPI O pin s as si gne d
by the user firmware. The user has the o ption of ganging t he downstre am ports together wi th a sing le pair o f power-mana gement
pins, or providing power management for each port with four pairs of power-management pins.
C-compatible interface accommo-
Document #: 38-08024 Rev. **Page 7 of 53
.
Logic Block Diagram
CY7C66013
CY7C66113
6-MHz crystal
PLL
48 MHz
Clock
Divider
12 MHz
6 MHz
12-MHz
8-bit
CPU
PROM
8 KB
RAM
256 byte
12-bit
Timer
8-bit Bus
USB
SIE
Interrupt
Controller
GPIO
PORT 0
USB
Transceiver
Repeater
P0[0]
P0[7]
D+[0]
Upstream
USB Port
D–[0]
USB
Transceiver
USB
Transceiver
USB
Transceiver
USB
Transceiver
Downstream USB Ports
Power management under firmware
control using GPIO pins
D+[1]
D–[1]
D+[2]
D–[2]
D+[3]
D–[3]
D+[4]
D–[4]
Watch Dog
Timer
Power-On
Reset
GPIO
PORT 1
GPIO/
HAPI
PORT 2
GPIO
PORT 3
GPIO
PORT 3
DAC
PORT
I2C
Interface
*I2C Compatible interface enabled by firmware through
P2[1:0] or P1[1:0]
D+[0], D–[0]I/O8, 98, 9Upstream port, USB differential data.
D+[1], D–[1]I/O12, 1313, 14Downstream port 1, USB differential data.
D+[2], D–[2]I/O15, 1616, 17Downstream port 2, USB differential data.
D+[3], D–[3]I/O40, 4148, 49Downstream port 3, USB differential data.
D+[4], D–[4]I/O35, 3644, 45Downstream port 4, USB differential data.
P0[7:0]I/O21, 25, 22, 26,
P1[7:0]I/O6, 43, 5, 44, 4,
P2[7:0]I/O19, 30, 18, 31,
P3[6:0]I/O37, 10, 39, 7, 4243, 12, 46,
DAC[7:0]I/On/a21, 29, 26,
XTAL
IN
XTAL
OUT
V
PP
V
CC
GND11, 20, 32, 3811, 40Ground.
V
REF
OUT116-MHz crystal out.
23, 27, 24, 28
45, 47, 46
17, 33, 14, 34
IN226-MHz crystal or external clock input.
2936Programming voltage supply, tie to ground during normal operation.
4856Voltage supply.
IN33External 3.3V supply voltage for the differ ential data output buf fers and
22, 32, 23,
33, 24, 34,
25, 35
6, 51, 5, 52,
4, 53, 55, 54
20, 38, 19,
39, 18, 41,
15, 42
10, 47, 7, 50
30, 27, 31,
28, 37
GPIO Port 0.
GPIO Port 1.
GPIO Port 2.
GPIO Port 3, capable of sinking 12 mA (typical).
Digital to Analog Converter (DAC) Port with programmable current sink
outputs. DAC[1:0] offer a progra mmable range of 3.2 to 16 mA typ ical.
DAC[7:2] have a programmable sink current range of 0.2 to 1.0 mA
typical.
the D+ pull up.
CY7C66013
CY7C66113
4.2I/O Register Summary
I/O registers are access ed via the I/O Read (IO RD) and I/O Wr ite (IOWR, IOWX) instr uctions. IORD read s data from the sele cted
port into the accum ulato r. IOWR performs the re verse; it write s dat a f rom th e accum ulator to the sele cted port. In dexed I/O W ri te
(IOWX) adds the con t en ts of X to th e address in the instructio n to form the port addres s and writes data from the ac cu mu lator to
the specified port. Specifying address 0 (e.g., IOWX 0h) means the I/O register is selected solely by the contents of X.
All undefined registers are reserved. It is important not to write to reserved registers as this may cause an undefined operation
or increased current consumption dur ing operati on. When writing to registers wit h reserved bits, the reserved bits mus t be written
with ‘0.’
Table 4-2. I/O Register Summary
Register NameI/O AddressRead/WriteFunctionPage
Port 0 Data0x00R/WGPIO Port 0 Data 19
Port 1 Data0x01R/WGPIO Port 1 Data19
Port 2 Data0x02R/WGPIO Port 2 Data19
Port 3 Data0x03R/WGPIO Port 3 Data19
Port 0 Interrupt Enable0x04WInterrupt Enable for Pins in Port 020
Port 1 Interrupt Enable0x05WInterrupt Enable for Pins in Port 120
Port 2 Interrupt Enable0x06WInterrupt Enable for Pins in Port 220
Document #: 38-08024 Rev. **Page 10 of 53
CY7C66013
CY7C66113
Table 4-2. I/O Register Summary (continued)
Register NameI/O AddressRead/WriteFunctionPage
Port 3 Interrupt Enable0x07WInterrupt Enable for Pins in Port 320
GPIO Configuration0x08R/WGPIO Port Configurations20
2
HAPI and I
USB Device Address A0x10R/WUSB Device Address A37
EP A0 Counter Register0x11R/WUSB Address A, Endpoint 0 Counter 39
EP A0 Mode Register0x12R/WUSB Address A, Endpoint 0 Configuration 38
EP A1 Counter Register0x13R/WUSB Address A, Endpoint 1 Counter 39
EP A1 Mode Register0x14R/WUSB Address A, Endpoint 1 Configuration 39
EP A2 Counter Register0x15R/WUSB Address A, Endpoint 2 Counter 39
EP A2 Mode Register0x16R/WUSB Address A, Endpoint 2 Configuration 39
USB Status & Control0x1FR/WUSB Upstream Port Traffic Status and Control36
Global Interrupt Enable0x20R/WGlobal Interrupt Enable 27
Endpoint Interrupt Enable0x21R/WUSB Endpoint Interrupt Enables27
Interrupt Vector0x23RPending Interrupt Vector Read/Clear29
Timer (LSB)0x24RLower 8 Bits of Free-running Timer (1 MHz)22
Timer (MSB)0x25RUpper 4 Bits of Free-running Timer 22
WDT Clear0x26WWatch Dog Timer Clear17
2
C Control & Status0x28R/WI2C Status and C ontrol24
I
2
C Data0x29R/WI2C Data24
I
DAC Data0x30R/WDAC Data21
DAC Interrupt Enable0x31WInterrupt Enable for each DAC Pin22
DAC Interrupt Polarity0x32WInterrupt Polarity for each DAC Pin22
DAC Isink0x38-0x3FWInput Sink Current Control for each DAC Pin21
USB Device Address B0x40R/WUSB Device Address B (not used in 5-endpoin t mode) 37
EP B0 Counter Register0x41R/WUSB Address B, Endpoint 0 Counter39
EP B0 Mode Register0x42R/WUSB Address B, Endpoint 0 Configuration, or
EP B1 Counter Register0x43R/WUSB Address B, Endpoint 1 Counter39
EP B1 Mode Register0x44R/WUSB Address B, Endpoint 1 Configuration, or
Hub Port Connect Status0x48R/WHub Downstream Port Connect Status33
Hub Port Enable0x49R/WHub Downstream Ports Enable34
Hub Port Speed0x4AR/WHub Downstream Ports Speed34
Hub Port Control (Ports [4:1])0x4BR/WHub Downstream Ports Control 34
Hub Port Suspend0x4DR/WHub Downstream Port Suspend Control36
Hub Port Resume Status0x4ERHub Downstream Ports Resume Status36
Hub Ports SE0 Status0x4FRHub Downstream Ports SE0 Status35
Hub Ports Data0x50RHub Downstream Ports Differential data35
Hub Downstream Force Low0x51R/WHub Downstream Ports Force LOW35
Processor Status & Control0xFFR/WMicroprocessor Status and Control Register26
C Configuration0x09R/WHAPI Width and I2C Position Configuration23
USB Address A, Endpoint 3 in 5-endpoint mode
USB Address A, Endpoint 4 in 5-endpoint mode
38
39
Document #: 38-08024 Rev. **P age 11 of 53
CY7C66013
CY7C66113
4.3Instruction Set Summary
Refer to the CYASM Assembler User’s Guide for more details.
HAL T007NOP204
ADD A,exprdata014INC Aacc214
ADD A,[expr]direct026INC Xx224
ADD A,[X+expr]index037INC [expr]direct237
ADC A,exprdata044INC [X+expr]index248
ADC A,[expr]direct056DEC Aacc254
ADC A,[X+expr]index067DEC Xx264
SUB A,exprdata074DEC [expr]direct277
SUB A,[expr]direct086DEC [X+expr]index288
SUB A,[X+expr]index097IORD expraddress295
SBB A,exprdata0A4IOWR expraddress2A5
SBB A,[expr]direct0B6POP A2B4
SBB A,[X+expr]index0C7POP X2C4
OR A,exprdata0D4PUSH A2D5
OR A,[expr]direct0E6PUSH X2E5
OR A,[X+expr]index0F7SWAP A,X2F5
AND A,exprdata104SWAP A,DSP305
AND A,[expr]direct116MOV [expr],Adirect315
AND A,[X+expr]index127MOV [X+expr],Aindex326
XOR A,exprdata134OR [expr],Adirect337
XOR A,[expr]direct146OR [X+expr],Aindex348
XOR A,[X+expr]index157AND [expr],Adirect357
CMP A,exprdata165AND [X+expr],Aindex368
CMP A,[expr]direct177XOR [expr],Adirect377
CMP A,[X+expr]index188XOR [X+expr],Aindex388
MOV A,exprdata194IOWX [X+expr]index396
MOV A,[expr]direct1A5CPL3A4
MOV A,[X+expr]index1B6ASL3B4
MOV X,exprdata1C4ASR3C4
MOV X,[expr]direct1D5RLC3D4
reserved1ERRC3E4
XPAGE1F4RET3F8
MOV A,X404DI704
MOV X,A414EI724
MOV PSP,A604RETI738
CALLaddr50 - 5F10JCaddrC0-CF5
JMPaddr80-8F5JNCaddrD0-DF5
CALLaddr90-9F10JACCaddrE0-EF7
JZaddrA0-AF5INDEXaddrF0-FF14
JNZaddrB0-BF5
Document #: 38-08024 Rev. **Page 12 of 53
CY7C66013
CY7C66113
5.0 Programming Model
5.114-Bit Program Counter (PC)
The 14-bit Program Counter (PC) allows acc es s to up to 8 KB of PROM avail abl e wi th the CY7C 66 x1 3 arch ite ctu re. The top 32
bytes of the ROM in the 8K part are reserved for testing purposes. The program counter is cleared during reset, such that the
first instruction e xe cut ed afte r a re se t is at add res s 0 x0 000 h. Typicall y, this is a ju mp in stru ction to a reset handler tha t initializes
the application (see Interrupt Vectors on page 28).
The lower eight bits of the program counter are incremented as instructions are loaded and executed. The upper six bits of the
program counter are increm ented by exe cuting an XPAGE instr uction . As a result, the la st instruc tion execu ted within a 256 -byte
“page” of sequential code should be an XPAGE instruction. The assembler directive “XPAGEON” causes the assembler to insert
XPAGE instructions automatically. Because instructions can be either one or two bytes long, the assembler may occasionally
need to insert a NOP followed by an XPAGE to execute correctly.
The address of the nex t inst ruction to be execu ted, the ca rry flag , and th e zero flag are save d as two bytes on the program sta ck
during an interrupt acknowledge or a CALL instruction. The program counter, carry flag, and zero flag are restored from the
program stack during a RETI instruction. Only the program counter is restored during a RET instruction.
The program counter cann ot be acc es se d di rec tly by t he fi rmwa re. Th e pro gram st ack ca n be examined by reading SRAM from
location 0x00 and up.
Document #: 38-08024 Rev. **Page 13 of 53
5.1.1Program Memory Organization
after resetAddress
14-bit PC0x0000Program execution begins here after a reset
CY7C66013
CY7C66113
0x0002USB Bus Reset interrupt vector
0x0004128-µs timer interrupt vector
0x00061.024-ms timer interrupt vector
0x0008USB address A endpoint 0 interrupt vector
0x000AUSB address A endpoint 1 interrupt vector
0x000CUSB address A endpoint 2 interrupt vector
0x000EUSB address B endpoint 0 interrupt vector
0x0010USB address B endpoint 1 interrupt vector
0x0012Hub interrupt vector
0x0014DAC interrupt vector
0x0016GPIO interrupt vector
0x0018
0x001AProgram Memory begins here
0x1FDF8 KB (-32) PROM ends here (CY7C66013, CY7C66113)
Figure 5-1. Program Memory Space with Interrupt Vector Table
I2C interrupt vector
5.28-Bit Accumulator (A)
The accumulator is the general-purpose register for the microcontroller.
5.38-Bit Temporary Register (X)
The “X” register is availa ble to the firmware for temporary storage of intermediate res ults. The microcontrol ler can perform inde xed
operations based on the value in X. Refer to Section 5.6.3 for additional information.
Document #: 38-08024 Rev. **Page 14 of 53
CY7C66013
CY7C66113
5.48-Bit Program Stack Pointer (PSP)
During a reset, the Program Stack Pointer (PSP) is set to 0x00 and “grows” upward from this address. The PSP may be set by
firmware, using the MOV PSP,A instruction. The PSP supports interrupt service under hardware control and CALL, RET, and
RETI instructions under firmware control. The PSP is not readable by the firmware.
During an interrupt acknowledge, interrupts are disabled and the 14-bit program counter, carry flag, and zero flag are written as
two bytes of data memory . The first byte is stored in the mem ory addressed by the PSP, then the PSP is incremented. The second
byte is stored in memory addressed by the PSP, and the PSP is incremented again. The overall effect is to store the program
counter and flags on the program “stack” and increment the PSP by two.
The Return From Interrup t (RETI) in struction decreme nts the PSP, then restores the second byte from memory a ddressed by the
PSP. The PSP is decrem ented again an d the first byte is restore d from memory addre ssed by the PSP. After the program counter
and flags have been res tored from stack, th e interrupts are enabled. The ov erall effe ct is to restore t he program counter a nd flags
from the program stack, decrement the PSP by two, and re-enable interrupts.
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 the program stack and
decrements the PSP by two.
5.4.1Data Memory Organization
The CY7C66x13 microcontrollers provide 256 bytes of data RAM. Normally, the SRAM is partitioned into four areas: program
stack, user variab les, data s tack, and U SB endpoint FIFOs. The foll owing is one example o f where the program stack , data stack ,
and user variables areas could be located.
After resetAddress
8-bit DSP8-bit PSP0x00Program Stack Growth
(Move DSP
8-bit DSP
[1]
)
user selectedData Stack Growth
User variables
USB FIFO space for up to two Addre sses and five endpo ints
0xFF
[2]
5.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 pre-decrements the DSP, then writes data to the memory location addressed by the DSP. A POP instruction reads
data from the memory location addressed by the DSP, then post-increments the DSP.
During a reset, the DSP is reset to 0x00. A PUSH instruction when DSP equals 0x00 writes data at the top of the data RAM
(address 0xFF). This writes data to the memory area reserved for USB endpoint FIFOs. Therefore, the DSP should be indexed
at an appropriate memory location that does not compromise the Program Stack, user-defined memory (variables), or the USB
endpoint FIFOs.
For USB applications , the firmw are shou ld set the DSP to a n appropriate location to avoid a memo ry confli ct with RAM dedic ated
to USB FIFOs. The memory requirements for the USB endpoints are described in Section 19.2. Example assembly instructions
to do this with two device addresses (FIFOs begin at 0xD8) are shown below:
MOV A,20h; Move 20 hex into Accumulator (must be D8h or less)
SWAP A,DSP ; swap accumulator value into DSP register
Notes:
1. Refer to Section 5.5 for a description of DSP.
2. Endpoint sizes are fixed by the Endpoint Size Bit (I/O register 0x1F, Bit 7), see Table 19-1.
Document #: 38-08024 Rev. **Page 15 of 53
CY7C66013
CY7C66113
5.6Address Modes
The CY7C66013 and CY7C66113 microcontrollers support three addressing modes for instructions that require data operands:
data, direct, and indexed.
5.6.1Data (Immediate)
“Data” address mode refers to a data operan d that is actually a con stant encoded in the instruct ion. As an example, co nsider the
instruction that loads A with the constant 0xD8:
• MOV A,0D8h
This instruction requires 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 is the constant “0xD8”. A constant may be refe r red to by na me if a pr ior “EQU”
statement assigns the constant value to the name. For example, the following code is equivalent to the example shown above:
• DSPINIT: EQU 0D8h
• MOV A,DSPINIT
5.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 0x10:
• MOV A,[10h]
Normally, variable names are assigned to variable addresses using “EQU” statements to imp rove the rea dability of the assembl er
source code. As an example, the following code is equivalent to the example shown above:
• buttons: EQU 10h
• MOV A,[buttons]
5.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 e ncoded in the instructio n and the c ontents of t he “X” registe r . Normal ly, the constant is the “base” address
of an array of data and the X register contains 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 0x10. The fourth
element would be at address 0x13.
6.0 Clocking
XTALOUT
(pin 1)
XTALIN
(pin 2)
30 pF
Figure 6-1. Clock Oscillator On-Chip Circuit
The XTALIN and XTALOUT are the clock pins to the microcontroller. The user can connect an external oscillator or a crystal to
these pins. When using an ex tern al c rys tal , kee p PC B traces be tw een the ch ip le ads and crys tal as sh ort as pos sible (less than
2 cm). A 6-MHz fundamenta l frequency p arallel resonant crystal can be connecte d to these pin s to provide a reference fre quency
for the internal PLL. Th e two inte rnal 30 -pF load caps appear i n series t o the ex ternal c rystal an d wou ld be e quiva lent to a 15-pF
load. Therefore, the crystal must have a required load capacitance of about 15–18 pF. A ceramic resonator does not allow the
microcontroller to meet the timing specifications of full speed USB and therefore a ceramic resonator is not recommended with
these parts.
An external 6-MHz clock can be applied to the XTALIN pin if the XTALOUT pin is left open. Grounding the XTALOUT pin when
driving XTALIN with an oscillator does not work because the internal clock is effectively shorted to ground.
to internal PLL
30 pF
Document #: 38-08024 Rev. **Page 16 of 53
Loading...
+ 37 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.