📄 eziso.a51
字号:
;-----------------------------------------------------------------
; eziso.A51 6-17-98 LTH
;
; A Simple isochronous transfer. Reads 8051 ports A,B and C, and
; continuously sends a five byte packet over EP8IN:
;
; Byte0: Frame Count H
; Byte1: Frame Count L
; Byte2: PORTA pins
; Byte3: PORTB pins
; Byte4: PORTC pins
;
; You can observe and study USB Isochronous transfers using this code with
; the Using the EZ-USB development board with the Anchor Control Panel.
; The code illustrates how to transport IO PORT data to the isochronous
; endpoint buffer EP8IN. For simplicity the interrupt system is not used,
; instead the SOF (Start of Frame) bit is polled to detect the arrival of
; and SOF token.
;
; To use with the Anchor Control Panel:
; 1. Download 'eziso.hex'.
; 2. On the Iso Trans bar, set:
; Pipe to '7:Endpoint 8 IN'
; PktCount=1
; PktSize=5
; BuffCount=1
; FrmPerBuff=1
;
; Then click the 'Iso Trans' button as many times as you wish. The frame
; count and all 24 input port lines appear in the data window.
;-----------------------------------------------------------------
$NOMOD51 ; disable predefined 8051 registers
$nolist
$include (..\..\..\target\inc\ezregs.inc) ; EZ-USB register assignments
$list
;
NAME eziso
;
CSEG AT 0
mov dptr,#IN8ADDR ; set the FIFO start for EP8 to 0
mov a,#0
movx @dptr,a
ljmp loop
; -------------------------------------------------
org 100h
; -------------------------------------------------
loop: mov dptr,#USBIRQ ; wait for SOF IRQ bit
movx a,@dptr
jnb acc.1,loop
;
mov a,#00000010b ; SOFIR bit
movx @dptr,a ; writing 1 clears the SOF IRQ bit
;
mov dptr,#USBFRAMEH ; put the frame number into first two EP8IN bytes
movx a,@dptr
mov dptr,#IN8DATA ; "IN8DATA" is a FIFO inside the EZ-USB chip
movx @dptr,a ; byte 0
mov dptr,#USBFRAMEL
movx a,@dptr
mov dptr,#IN8DATA
movx @dptr,a ; byte 1
mov dptr,#PINSA ; read PORTA pins
movx a,@dptr
mov dptr,#IN8DATA
movx @dptr,a ; byte 2
mov dptr,#PINSB ; read PORTB pins
movx a,@dptr
mov dptr,#IN8DATA
movx @dptr,a ; byte 3
mov dptr,#PINSC ; read PORTC pins
movx a,@dptr
mov dptr,#IN8DATA
movx @dptr,a ; byte 4
;
sjmp loop
;
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -