www.pudn.com > 多命令语音识别范例.rar > System.asm


//.include resource.inc; 
.include hardware.inc; 
.include key.inc; 
 
//.PUBLIC _InitIO 
.PUBLIC _ShowRes 
 
 
//*********************************************************// 
//函数:System_Initial() 
//描述:键盘扫描初始化 
//参数:无 
//返回:无 
//*********************************************************// 
.CODE 
.PUBLIC _System_Initial; 
.PUBLIC	F_System_Initial; 
_System_Initial: .PROC 
F_System_Initial: 
  		//push	BP,BP to [SP];					 
  		//BP = SP + 1; 
		//r1 = [BP+3]; 
		//r2 = [BP+4]; 
		call	F_User_Init_IO;				// 调用键盘扫描 
		call	F_Key_Scan_Initial;			  
		// Add other general initialization here		 
		//r1 =0x0001;						 
		//pop		BP,BP from [SP];		 
		retf; 
	   .ENDP; 
//*********I/O初始化为下拉输入*****************************// 
//*********************************************************// 
F_User_Init_IO: .proc		 
//_InitIO:  
	R1=0xffff 
	[P_IOB_Dir] = R1		//B口设置为同向输出 
	[P_IOB_Attrib] = R1			 
	R1 = 0 
	[P_IOB_Data] = R1        //B口置低电平 
	r1 = 0xfff0; 
    [P_IOA_Dir] = r1;                    //A口为输入口 
    [P_IOA_Attrib] = r1;				  
    [P_IOA_Data] = r1;                   //下拉输入  
    r1 = 0x0000;                         
    retf;  
.endp 
 
//*********************************************************// 
//函数:System_ServiceLoop() 
//描述:键盘去抖和键盘扫描 
//参数:无 
//返回:无 
//*********************************************************// 
.PUBLIC _System_ServiceLoop; 
_System_ServiceLoop: .PROC                   
 
		call	F_Key_DebounceCnt_Down;		//键盘去抖 
		call    F_Key_Scan_ServiceLoop;		//键盘扫描		 
		r1=0x0001;                      	//  
		[P_Watchdog_Clear]=r1;       		// 
        retf; 
        .ENDP; 
//*********************************************************// 
//函数:Clear_WatchDog() 
//描述:看门狗清0 
//参数:无 
//返回:无 
//*********************************************************// 
.PUBLIC _ClearWatchDog; 
_ClearWatchDog: 	.PROC 
 		push R1 to [SP] 
		r1=0x0001;                      	 
		[P_Watchdog_Clear]=r1; 		 
		pop R1 from [SP] 
		retf; 
		.ENDP 
  
_ShowRes: .proc 
	push R1, R5 to [SP] 
	R5 = SP + 5 
	R4 = [R5+3]				 
	[0x7005] = R4 
	pop R1, R5 from [SP] 
	retf 
.endp