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

📄 test.s

📁 avr16控制数字电位器x9313的程序
💻 S
字号:
	.module test.c
	.area text(rom, con, rel)
	.dbfile test.c
	.dbfunc e DELAY_1US _DELAY_1US fV
	.even
_DELAY_1US::
	.dbline -1
	.dbline 28
; //********************************************************* 
; //测试功能:测试9313放大n+1倍   现在放大2倍
; //测试方法: 
; //测试结果:?
; //时钟频率:8m   
; //管脚分配:Pd0为使能位,Pd1为时序发生位,Pd2为+或-位
; //          
; //注意事项: 
; //完成时间:2009.03.18
; //************************************************
; 
; //************************************************* 
; //头文件
; //************************************************
; #include <iom16v.h>
; #include <macros.h>
; //************************************************
; 
; 
; //********************************************************** 
; //函数名称:void DELAY_1US(void)
; //参数入口:无
; //参数出口:无
; //函数功能:延时1us
; //注意事项: 
; //********************************************************** 
; void DELAY_1US(void)
; {    
	.dbline 29
; 	NOP();
	nop
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e DELAY_NUS _DELAY_NUS fV
;              n -> R20,R21
	.even
_DELAY_NUS::
	xcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 39
; }
; //********************************************************** 
; //函数名称:void DELAY_NUS(void)
; //参数入口:无
; //参数出口:无
; //函数功能:延时nus
; //注意事项:
; //********************************************************** 
; void DELAY_NUS(unsigned int n)
; {	 
	.dbline 40
; 	 for(;n>0;n--)
	xjmp L6
L3:
	.dbline 41
	xcall _DELAY_1US
L4:
	.dbline 40
	subi R20,1
	sbci R21,0
L6:
	.dbline 40
	cpi R20,0
	cpc R20,R21
	brne L3
X0:
	.dbline -2
L2:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r n 20 i
	.dbend
	.dbfunc e DELAY_1MS _DELAY_1MS fV
;              i -> R16,R17
	.even
_DELAY_1MS::
	.dbline -1
	.dbline 51
; 	      DELAY_1US();
; }
; //********************************************************** 
; //函数名称:void DELAY_1MS(void)
; //参数入口:无
; //参数出口:无
; //函数功能:延时1ms
; //注意事项:i=143*n-2
; //********************************************************** 
; void DELAY_1MS(void)
; {    
	.dbline 53
; 	 unsigned int i;
; 	 for(i=1142;i>0;i--)    
	ldi R16,1142
	ldi R17,4
	xjmp L11
L8:
	.dbline 54
L9:
	.dbline 53
	subi R16,1
	sbci R17,0
L11:
	.dbline 53
	cpi R16,0
	cpc R16,R17
	brne L8
X1:
	.dbline -2
L7:
	.dbline 0 ; func end
	ret
	.dbsym r i 16 i
	.dbend
	.dbfunc e DELAY_NMS _DELAY_NMS fV
;              n -> R20,R21
	.even
_DELAY_NMS::
	xcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 64
;           ;
; }
; //********************************************************** 
; //函数名称:void DELAY_1MS(void)
; //参数入口:无
; //参数出口:无
; //函数功能:延时1ms
; //注意事项:i=143*n-2
; //********************************************************** 
; void DELAY_NMS(unsigned int n)
; {	 
	.dbline 65
; 	 for(;n>0;n--)
	xjmp L16
L13:
	.dbline 66
	xcall _DELAY_1MS
L14:
	.dbline 65
	subi R20,1
	sbci R21,0
L16:
	.dbline 65
	cpi R20,0
	cpc R20,R21
	brne L13
X2:
	.dbline -2
L12:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r n 20 i
	.dbend
	.dbfunc e PORT_INIT _PORT_INIT fV
	.even
_PORT_INIT::
	.dbline -1
	.dbline 76
; 	      DELAY_1MS();
; }
; //********************************************************** 
; //函数名称:void INIT_X9313(void)
; //参数入口:无
; //参数出口:无
; //函数功能:是放大倍数为1
; //注意事项:PD0为使能位,PD1为时序发生位,PD2为+或-位 
; //***************************************************
; void PORT_INIT(void)
; {	 
	.dbline 77
; 	 DDRA|=0X07;
	in R24,0x1a
	ori R24,7
	out 0x1a,R24
	.dbline 78
; 	 PORTA|=0X07;
	in R24,0x1b
	ori R24,7
	out 0x1b,R24
	.dbline -2
L17:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e INIT_X9313 _INIT_X9313 fV
;              n -> R20
	.even
_INIT_X9313::
	xcall push_gset1
	.dbline -1
	.dbline 88
; }
; //********************************************************** 
; //函数名称:void INIT_X9313(void)
; //参数入口:无
; //参数出口:无
; //函数功能:是放大倍数为1
; //注意事项:PD0为使能位,PD1为时序发生位,PD2为+或-位 
; //**********************************************************
; void INIT_X9313(void)
; {	 
	.dbline 91
; 	 unsigned char n;
; 	 
; 	 PORTA|=0X07;
	in R24,0x1b
	ori R24,7
	out 0x1b,R24
	.dbline 94
; 	 
; 	 //PORTD=(1<<2);//方法倍数减操作
; 	 DELAY_NUS(1);
	ldi R16,1
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 96
; 	 
; 	 PORTA&=~(1<<0);//使能操作
	cbi 0x1b,0
	.dbline 97
; 	 DELAY_NUS(1);
	ldi R16,1
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 99
; 	 
; 	 for(n=35;n>0;n--)
	ldi R20,35
	xjmp L22
L19:
	.dbline 100
	.dbline 101
	sbi 0x1b,1
	.dbline 102
	ldi R16,2
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 103
	cbi 0x1b,1
	.dbline 104
	ldi R16,2
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 105
	sbi 0x1b,1
	.dbline 106
	ldi R16,2
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 107
L20:
	.dbline 99
	dec R20
L22:
	.dbline 99
	clr R2
	cp R2,R20
	brlo L19
	.dbline 108
; 	 {    
; 	 	  PORTA|=(1<<1);//+
; 		  DELAY_NUS(2);
; 		  PORTA&=~(1<<1);
; 		  DELAY_NUS(2);
; 		  PORTA|=(1<<1);//+
; 		  DELAY_NUS(2);
; 	 }
; 	 PORTA|=(1<<0);//使能操作
	sbi 0x1b,0
	.dbline 109
; 	 DELAY_NMS(20);
	ldi R16,20
	ldi R17,0
	xcall _DELAY_NMS
	.dbline -2
L18:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r n 20 c
	.dbend
	.dbfunc e X9313_ADD _X9313_ADD fV
;              n -> R20
	.even
_X9313_ADD::
	xcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 120
; 	 
; }
; //********************************************************** 
; //函数名称:void X9313_ADD(unsigned char n)
; //参数入口:无
; //参数出口:无
; //函数功能:放大n倍
; //注意事项:PD0为使能位,PD1为时序发生位,PD2为-时放大
; //**********************************************************
; void X9313_ADD(unsigned char n)
; {	 
	.dbline 121
; 	 PORTA|=0X07;
	in R24,0x1b
	ori R24,7
	out 0x1b,R24
	.dbline 123
; 	 
; 	 PORTA&=~(1<<2);//方法倍数减操作
	cbi 0x1b,2
	.dbline 124
; 	 DELAY_NUS(1);
	ldi R16,1
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 126
; 	 
; 	 PORTA&=~(1<<0);//使能操作
	cbi 0x1b,0
	.dbline 127
; 	 DELAY_NUS(1);
	ldi R16,1
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 129
; 	 
; 	 for(;n>0;n--)
	xjmp L27
L24:
	.dbline 130
	.dbline 131
	sbi 0x1b,1
	.dbline 132
	ldi R16,2
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 133
	cbi 0x1b,1
	.dbline 134
	ldi R16,2
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 135
	sbi 0x1b,1
	.dbline 136
	ldi R16,2
	ldi R17,0
	xcall _DELAY_NUS
	.dbline 137
L25:
	.dbline 129
	dec R20
L27:
	.dbline 129
	clr R2
	cp R2,R20
	brlo L24
	.dbline 138
; 	 {    
; 	 	  PORTA|=(1<<1);//+
; 		  DELAY_NUS(2);
; 		  PORTA&=~(1<<1);
; 		  DELAY_NUS(2);
; 		  PORTA|=(1<<1);//+
; 		  DELAY_NUS(2);
; 	 }
; 	 PORTA|=(1<<0);//使能操作
	sbi 0x1b,0
	.dbline 139
; 	 PORTA|=(1<<2);//方法倍数减操作
	sbi 0x1b,2
	.dbline -2
L23:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r n 20 c
	.dbend
	.dbfunc e main _main fV
	.even
_main::
	.dbline -1
	.dbline 146
; 	 //DELAY_NMS(20);
; }
; //************************************************* 
; //主函数
; //*************************************************
; void  main(void)
; {	  
	.dbline 147
; 	  PORT_INIT();
	xcall _PORT_INIT
	.dbline 148
; 	  INIT_X9313();
	xcall _INIT_X9313
	.dbline 149
; 	  X9313_ADD(1);
	ldi R16,1
	xcall _X9313_ADD
L29:
	.dbline 151
L30:
	.dbline 150
	xjmp L29
X3:
	.dbline -2
L28:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -