SN8P2200 Series
USB 1.1 Low-Speed 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 104
Version 1.7
Example 1. Set endpoint 0’s FIFO address, when reading data from FIFO.
EP0_FIFO_READ_Address:
B0BTS0 0xA9.7
JMP udp0_address_set
;Go to set the UDP0 address
JMP udp1_address_set
;Go to set the UDP1 address
udp0_address_set:
MOV
A,
address
MOV
UDP0,
A
JMP
user_define_routine
udp1_address_set:
MOV
A,
address
MOV
UDP1,
A
JMP
user_define_routine
Example 2. Read data from EP0 FIFO.
EP0_FIFO_RD_data:
B0BTS0 0xA9.7
;check the bit to select the right FIFO
JMP
read_endpoint0_FIFO_UDR0
JMP
read_endpoint0_FIFO_UDR1
read_endpoint0_FIFO_UDR0:
MOV
A,
UDR0
;
move
FIFO’s
data
to
A
JMP
user_define_routine
read_endpoint0_FIFO_UDR1:
MOV
A,
UDR1
;move
FIFO’s
data
to
A
JMP
user_define_routine
Example 3. Set endpoint 1’s FIFO address, when writing data to FIFO.
EP1_FIFO_WRITE_Address:
B0BTS1 0xA2.6
JMP
udp0_address_set
;Go to set the UDP0 address
JMP
udp1_address_set
;Go to set the UDP1 address
udp0_address_set:
MOV
A, address
; set the right address to UDP. Address of EP1 is from 0x08 ~ 0x0F
MOV
UDP0,
A
JMP
user_define_routine
udp1_address_set:
MOV
A, address
; set the right address to UDP. Address of EP1 is from 0x08 ~ 0x0F
MOV
UDP1,
A
JMP
user_define_routine
Example 4. Write data to EP2 FIFO.
EP2_FIFO_WRITE_data:
B0BTS1 0xA3.6
;check the bit to select the right FIFO
JMP
write_endpoint2_FIFO_UDR0
JMP
write_endpoint2_FIFO_UDR1
write _endpoint2_FIFO_UDR0
MOV
A,
UDR0
JMP
user_define_routine
write _endpoint2_FIFO_UDR1
MOV
A,
UDR1
JMP
user_define_routine