English
Language : 

EZ-USB Datasheet, PDF (115/334 Pages) Cypress Semiconductor – The EZ-USB USB Integrated Circuit
2. Write the INT2 interrupt vector.
; -----------------
; Interrupt Vectors
; -----------------
org
ljmp
43h
USB_Jump_Table
; int2 is the USB vector
; Autovector will replace byte 45
Figure 6-8. INT2 Interrupt Vector
3. Write the interrupt service routine.
Put it anywhere in memory and the jump table in step 1 will automatically jump to it.
; -----------------------------
; USB Interrupt Service Routine
; -----------------------------
EP2OUT_ISR push dps
push dpl
push dph
push dpl1
push dph1
push acc
; save both dptrs, dps, and acc
mov a,EXIF
clr acc.4
mov EXIF,a
; clear USB IRQ (INT2)
mov
mov
movx
setb
dptr,#OUT07IRQ
a,#01000000b
@dptr,a
got_EP2_data
; a “1” clears the IRQ bit
; clear OUT2 int request
; set my flag
pop
pop
pop
pop
pop
pop
reti
acc
dph1
dpl1
dph
dpl
dps
; restore vital registers
Figure 6-9. Interrupt Service Routine (ISR) for Endpoint 2-OUT
In this example, the ISR simply sets the 8051 flag “got_EP2_data” to indicate to the back-
ground program that the endpoint requires service. Note that both data pointers and the
DPS (Data Pointer Select) registers must be saved and restored in addition to the accumu-
lator.
Page 6-18
Chapter 6. EZ-USB CPU
EZ-USB TRM v1.9