?? usb_f245.s
字號:
.module usb_F245.c
.area text(rom, con, rel)
.dbfile G:\mega8\atmega16\mp3_7210\usb_F245.c
.dbfunc e usb_read _usb_read fc
; usb_data -> R16
.even
_usb_read::
.dbline -1
.dbline 16
; #include <iom16v.h>
;
; #define led1_off (PORTA|=(1<<4))
; #define led1_on (PORTA&=~(1<<4))
;
; #define usb_txrdy ((PINC&0x04)>>2)
; #define usb_rxrdy ((PINC&0x08)>>3)
; #define set_usb_read (PORTC|=(1<<0))
; #define clr_usb_read (PORTC&=~(1<<0))
; #define set_usb_write (PORTC|=(1<<1))
; #define clr_usb_write (PORTC&=~(1<<1))
;
;
; /***********USB_FT245讀數據******************/
; unsigned char usb_read(void)
; {
xjmp L3
L2:
.dbline 19
.dbline 20
cbi 0x1b,4
.dbline 21
L3:
.dbline 18
; unsigned char usb_data;
; while (usb_rxrdy)
in R24,0x13
andi R24,8
lsr R24
lsr R24
lsr R24
tst R24
brne L2
.dbline 22
; {
; led1_on; /*空則循環*/
; }
; led1_off;
sbi 0x1b,4
.dbline 23
; clr_usb_read;
cbi 0x15,0
.dbline 24
; set_usb_read;
sbi 0x15,0
.dbline 25
; usb_data=PIND;
in R16,0x10
.dbline 26
; return (usb_data);
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbsym r usb_data 16 c
.dbend
.dbfunc e usb_write _usb_write fV
; usb_data -> R20
.even
_usb_write::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 31
; }
; /***********USB_FT245寫數據******************/
; void usb_write(unsigned char usb_data);
; void usb_write(unsigned char usb_data)
; {
xjmp L7
L6:
.dbline 33
.dbline 34
cbi 0x1b,4
.dbline 35
ldi R16,1000
ldi R17,3
xcall _delay_ms
.dbline 36
L7:
.dbline 32
; while (usb_txrdy)
in R24,0x13
andi R24,4
lsr R24
lsr R24
tst R24
brne L6
.dbline 37
; {
; led1_on; /*忙則循環*/
; delay_ms(1000);
; }
; led1_off;
sbi 0x1b,4
.dbline 38
; DDRD =0b11111111; /*1=output */
ldi R24,255
out 0x11,R24
.dbline 39
; PORTD=usb_data;
out 0x12,R20
.dbline 40
; set_usb_write;
sbi 0x15,1
.dbline 41
; clr_usb_write;
cbi 0x15,1
.dbline 42
; DDRD =0b00000000; /*0=input */
clr R2
out 0x11,R2
.dbline 43
; PORTD=0b00000000; /*三態高阻*/
out 0x12,R2
.dbline -2
.dbline 44
; }
L5:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r usb_data 20 c
.dbend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -