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

📄 main.s.bak.bak

📁 AVR16源代码 ICC编译器
💻 BAK
📖 第 1 页 / 共 2 页
字号:
	std y+3,R3
	std y+2,R2
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _PC_Send_Ok
	.dbline 189
; 	
; 	return 0x00;
	clr R16
	.dbline -2
L17:
	adiw R28,6
	xcall pop_gset5
	.dbline 0 ; func end
	ret
	.dbsym r CRC_Value 10 s
	.dbsym r Wrong_Cnt 12 c
	.dbsym r Rec_Len 14 c
	.dbsym l bPiont 4 I
	.dbend
	.dbfunc e Setting_Param _Setting_Param fc
;     ReceiveBuf -> R20,R21
	.even
_Setting_Param::
	xcall push_gset1
	movw R20,R16
	sbiw R28,4
	.dbline -1
	.dbline 203
; }
; 
; //============================================================
; //函	数:void Setting_Param(unsigned char *ReceiveBuf)
; //功	能:设置参数
; //入口参数:接收到的数据
; //返 回 值:执行结果
; //设 计 者:陈祖安 
; //创作时间:2006-03-16
; //修改时间:
; //修改目的:
; //============================================================
; unsigned char Setting_Param(unsigned char *ReceiveBuf)
; {
	.dbline 204
; 	Write_EEPROM(&ReceiveBuf[5],2,EE_WT_ID);//设置节点地址
	ldi R24,1
	ldi R25,0
	std y+1,R25
	std y+0,R24
	ldi R18,2
	movw R16,R20
	subi R16,251  ; offset = 5
	sbci R17,255
	xcall _Write_EEPROM
	.dbline 206
; 	
; 	Write_EEPROM(&ReceiveBuf[7],1,EE_WT_GD);//设置组地址
	ldi R24,3
	ldi R25,0
	std y+1,R25
	std y+0,R24
	ldi R18,1
	movw R16,R20
	subi R16,249  ; offset = 7
	sbci R17,255
	xcall _Write_EEPROM
	.dbline 208
; 	
; 	if(Write_Time_Data(&ReceiveBuf[8],Time_Address,7))//设置系统时钟
	ldi R24,7
	std y+0,R24
	clr R18
	movw R16,R20
	subi R16,248  ; offset = 8
	sbci R17,255
	xcall _Write_Time_Data
	tst R16
	breq L48
	.dbline 209
; 		PC_Send_Err(ERR_SETTING,SendBuf);
	ldi R18,<_SendBuf
	ldi R19,>_SendBuf
	ldi R16,21
	xcall _PC_Send_Err
	xjmp L49
L48:
	.dbline 211
; 	else
; 		PC_Send_Ok(SendData,0x00,SendBuf,0);	//向上位机发送设置表具信息结果
	clr R2
	clr R3
	std y+3,R3
	std y+2,R2
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _PC_Send_Ok
L49:
	.dbline 213
; 	
; 	return 0;
	clr R16
	.dbline -2
L47:
	adiw R28,4
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r ReceiveBuf 20 pc
	.dbend
	.dbfunc e Read_Param _Read_Param fc
;       SendData -> R20,R21
	.even
_Read_Param::
	xcall push_gset1
	movw R20,R16
	sbiw R28,4
	.dbline -1
	.dbline 227
; }
; 
; //============================================================
; //函	数:unsigned char Read_Param(unsigned char *SendData)
; //功	能:读取参数
; //入口参数:读取存放的地址
; //返 回 值:执行结果
; //设 计 者:陈祖安 
; //创作时间:2006-03-16
; //修改时间:
; //修改目的:
; //============================================================
; unsigned char Read_Param(unsigned char *SendData)
; {
	.dbline 228
; 	Read_EEPROM(SendData,2,EE_WT_ID);	//读取节点地址
	ldi R24,1
	ldi R25,0
	std y+1,R25
	std y+0,R24
	ldi R18,2
	movw R16,R20
	xcall _Read_EEPROM
	.dbline 230
; 	
; 	Read_EEPROM(&SendData[2],1,EE_WT_GD);	//读取组地址
	ldi R24,3
	ldi R25,0
	std y+1,R25
	std y+0,R24
	ldi R18,1
	movw R16,R20
	subi R16,254  ; offset = 2
	sbci R17,255
	xcall _Read_EEPROM
	.dbline 232
; 	
; 	PC_Send_Ok(SendData,0,SendBuf,3);	//向上位机发送读取表具信息结果
	ldi R24,3
	ldi R25,0
	std y+3,R25
	std y+2,R24
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	movw R16,R20
	xcall _PC_Send_Ok
	.dbline 234
; 	
; 	return 0;
	clr R16
	.dbline -2
L50:
	adiw R28,4
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r SendData 20 pc
	.dbend
	.dbfunc e Read_SystemTime _Read_SystemTime fc
;       SendData -> R20,R21
	.even
_Read_SystemTime::
	xcall push_gset1
	movw R20,R16
	sbiw R28,4
	.dbline -1
	.dbline 248
; }
; 
; //============================================================
; //函	数:unsigned char Read_SystemTime(unsigned char *SendData)
; //功	能:读取参数
; //入口参数:读取存放的地址
; //返 回 值:执行结果
; //设 计 者:陈祖安 
; //创作时间:2006-03-16
; //修改时间:
; //修改目的:
; //============================================================
; unsigned char Read_SystemTime(unsigned char *SendData)
; {
	.dbline 249
; 	if(Read_Time_Data(SendData,Time_Address,7))
	ldi R24,7
	std y+0,R24
	clr R18
	movw R16,R20
	xcall _Read_Time_Data
	tst R16
	breq L52
	.dbline 250
; 		PC_Send_Err(ERR_READTIME,SendBuf);
	ldi R18,<_SendBuf
	ldi R19,>_SendBuf
	ldi R16,22
	xcall _PC_Send_Err
	xjmp L53
L52:
	.dbline 252
; 	else
; 		PC_Send_Ok(SendData,0,SendBuf,7);	//向上位机发送读取表具信息结果
	ldi R24,7
	ldi R25,0
	std y+3,R25
	std y+2,R24
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	movw R16,R20
	xcall _PC_Send_Ok
L53:
	.dbline 254
; 	
; 	return 0;
	clr R16
	.dbline -2
L51:
	adiw R28,4
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r SendData 20 pc
	.dbend
	.dbfunc e main _main fV
;      Crc_Value -> <dead>
;      Ret_Value -> R22
;        Rec_Len -> R20,R21
	.even
_main::
	sbiw R28,4
	.dbline -1
	.dbline 268
; }
; 
; //============================================================
; //函	数:void main(void)
; //功	能:主函数
; //入口参数:无
; //返 回 值:无
; //设 计 者:陈祖安 
; //创作时间:2006-03-16
; //修改时间:
; //修改目的:
; //============================================================
; void main(void)
; {
	.dbline 269
; 	int		Rec_Len = 0;
	clr R20
	clr R21
	.dbline 270
; 	unsigned char 	Ret_Value = 0;
	clr R22
	.dbline 273
; 	unsigned short 	Crc_Value;
; 
; 	Init_Com();
	xcall _Init_Com
	.dbline 274
; 	Reset_R8025();
	xcall _Reset_R8025
	.dbline 276
; 	
; 	PC_Send_Ok(SendData,0x00,SendBuf,1);				//向PC 发送接收握手信号
	ldi R24,1
	ldi R25,0
	std y+3,R25
	std y+2,R24
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _PC_Send_Ok
	.dbline 278
; 
; 	Rec_Len = Uart_Receive_Frame(ReceiveBuf, 100);	//等待接收握手信号
	ldi R18,100
	ldi R19,0
	ldi R16,<_ReceiveBuf
	ldi R17,>_ReceiveBuf
	xcall _Uart_Receive_Frame
	mov R20,R16
	clr R21
	.dbline 279
; 	if(Rec_Len)  					//如果没收到数据,跳到0x00处运行程序
	cpi R20,0
	cpc R20,R21
	breq L55
X8:
	.dbline 280
;   	{
	.dbline 281
;    		if(Verify_Command(ReceiveBuf,Rec_Len))
	movw R18,R20
	ldi R16,<_ReceiveBuf
	ldi R17,>_ReceiveBuf
	xcall _Verify_Command
	tst R16
	breq L57
	.dbline 282
; 	 	{
	.dbline 283
; 	 		PC_Send_Err(ERR_COMMANDCRC,SendBuf);	//命令CRC校验错误
	ldi R18,<_SendBuf
	ldi R19,>_SendBuf
	ldi R16,17
	xcall _PC_Send_Err
	.dbline 284
; 	  		quit();
	xcall _quit
	.dbline 285
; 	  	} 	
L57:
	.dbline 286
; 		if((ReceiveBuf[2] != 0x00))		//不是联机命令
	lds R2,_ReceiveBuf+2
	tst R2
	brne X12
	xjmp L63
X12:
	.dbline 287
; 		{		
	.dbline 288
; 			PC_Send_Err(ERR_CONNECT,SendBuf);					
	ldi R18,<_SendBuf
	ldi R19,>_SendBuf
	ldi R16,16
	xcall _PC_Send_Err
	.dbline 289
; 			quit();  	    		//验证错误		
	xcall _quit
	.dbline 290
; 		}
	.dbline 291
; 	}
	xjmp L63
L55:
	.dbline 293
; 	else
; 		quit(); 
	xcall _quit
	xjmp L63
L62:
	.dbline 296
; 
; 	while(1) 
;      	{
	.dbline 297
;      		Rec_Len = 0;
	clr R20
	clr R21
	.dbline 298
;      		Rec_Len = Uart_Receive_Frame(ReceiveBuf,10);
	ldi R18,10
	ldi R19,0
	ldi R16,<_ReceiveBuf
	ldi R17,>_ReceiveBuf
	xcall _Uart_Receive_Frame
	mov R20,R16
	clr R21
	.dbline 299
;         	if(Rec_Len)//接收命令信号
	cpi R20,0
	cpc R20,R21
	brne X13
	xjmp L65
X13:
X9:
	.dbline 300
; 		{
	.dbline 301
; 		    	if(Verify_Command(ReceiveBuf,Rec_Len))
	movw R18,R20
	ldi R16,<_ReceiveBuf
	ldi R17,>_ReceiveBuf
	xcall _Verify_Command
	tst R16
	breq L67
	.dbline 302
; 	            		Ret_Value = ERR_COMMANDCRC;				
	ldi R22,17
	xjmp L68
L67:
	.dbline 304
; 	        	else
; 			{
	.dbline 305
; 			   	switch(ReceiveBuf[2])	//根据不同指令执行不同的操作
	lds R10,_ReceiveBuf+2
	clr R11
	movw R24,R10
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	breq L73
	cpi R24,2
	ldi R30,0
	cpc R25,R30
	breq L74
	cpi R24,3
	ldi R30,0
	cpc R25,R30
	breq L75
	cpi R24,4
	ldi R30,0
	cpc R25,R30
	breq L76
	cpi R24,5
	ldi R30,0
	cpc R25,R30
	breq L81
	cpi R24,6
	ldi R30,0
	cpc R25,R30
	brne X14
	xjmp L82
X14:
	xjmp L69
X10:
	.dbline 306
; 	                 	{
L73:
	.dbline 308
; 		              		case 0x01:	//程序下载
; 			              		Ret_Value = Flow_Control(); 
	xcall _Flow_Control
	mov R22,R16
	.dbline 309
; 						break;
	xjmp L70
L74:
	.dbline 311
;                     			case 0x02:  	//设置组地址,接点地址					     	//Read_Eeprom(POINT,data,14);
; 						Ret_Value = Setting_Param(ReceiveBuf);
	ldi R16,<_ReceiveBuf
	ldi R17,>_ReceiveBuf
	xcall _Setting_Param
	mov R22,R16
	.dbline 312
; 						break;
	xjmp L70
L75:
	.dbline 314
;                       			case 0x03:	//上传表具信息
; 					     	Ret_Value = Read_Param(SendData);
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _Read_Param
	mov R22,R16
	.dbline 315
; 						break;
	xjmp L70
L76:
	.dbline 317
; 					case 0x04: 	//硬件检测
; 						SendData[0] = 'R';
	ldi R24,82
	sts _SendData,R24
	.dbline 318
; 						SendData[1] = 'T';
	ldi R24,84
	sts _SendData+1,R24
	.dbline 319
; 						SendData[2] = 'C';
	ldi R24,67
	sts _SendData+2,R24
	.dbline 320
; 						SendData[3] = 'O';
	ldi R24,79
	sts _SendData+3,R24
	.dbline 321
; 						SendData[4] = 'K';
	ldi R24,75
	sts _SendData+4,R24
	.dbline 322
; 						PC_Send_Ok(SendData,0x00,SendBuf,5);	//向上位机发送硬件检测情况       
	ldi R24,5
	ldi R25,0
	std y+3,R25
	std y+2,R24
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _PC_Send_Ok
	.dbline 323
; 					        break;	
	xjmp L70
L81:
	.dbline 325
;                       			case 0x05: 	//复位命令   
;                       				PC_Send_Ok(SendData,0x00,SendBuf,0);	//向上位机发送复位成功命令 
	clr R2
	clr R3
	std y+3,R3
	std y+2,R2
	ldi R24,<_SendBuf
	ldi R25,>_SendBuf
	std y+1,R25
	std y+0,R24
	clr R18
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _PC_Send_Ok
	.dbline 326
; 					        quit();      
	xcall _quit
	.dbline 327
; 					        break;
	xjmp L70
L82:
	.dbline 329
; 					case 0x06:	//读取系统时钟
; 						Ret_Value = Read_SystemTime(SendData);
	ldi R16,<_SendData
	ldi R17,>_SendData
	xcall _Read_SystemTime
	mov R22,R16
	.dbline 330
; 						break;   
	xjmp L70
L69:
	.dbline 332
;                       			default:	//没有找到相应的指令,返回指令错误
; 					        Ret_Value = ERR_NOCOMMAND;
	ldi R22,20
	.dbline 333
; 			               	        break;
L70:
	.dbline 335
; 				}
; 			}
L68:
	.dbline 336
; 	        	if(Ret_Value)			//执行的子程返回0时表示,成功执行命令
	tst R22
	breq L83
	.dbline 337
; 		        	PC_Send_Err(Ret_Value,SendBuf); 
	ldi R18,<_SendBuf
	ldi R19,>_SendBuf
	mov R16,R22
	xcall _PC_Send_Err
L83:
	.dbline 338
; 		}
L65:
	.dbline 339
L63:
	.dbline 295
	xjmp L62
X11:
	.dbline -2
L54:
	adiw R28,4
	.dbline 0 ; func end
	ret
	.dbsym l Crc_Value 5 s
	.dbsym r Ret_Value 22 c
	.dbsym r Rec_Len 20 I
	.dbend
	.area bss(ram, con, rel)
	.dbfile F:\AVR_Modem\Boot_TEST\BOOTLoadICC\main.c
_data::
	.blkb 256
	.dbsym e data _data A[256:256]c
_ReceiveBuf::
	.blkb 150
	.dbsym e ReceiveBuf _ReceiveBuf A[150:150]c
_SendBuf::
	.blkb 100
	.dbsym e SendBuf _SendBuf A[100:100]c
_SendData::
	.blkb 100
	.dbsym e SendData _SendData A[100:100]c

⌨️ 快捷键说明

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