⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb_f245.s

📁 你熟悉QT吗?Linux系统上领先的GUI
💻 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 + -