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

📄 system.asm

📁 本文以举例的方式从硬件和软件原理上阐述了如何运用SPBA01B对MCU进行IO扩展、总线扩展和级联使用.
💻 ASM
字号:
//////////////////////////////////////////////////////////////////
// Function: System commander   
// By Arthur Shieh                  
// Service for H/W, keyboard scan(A8~A15)
// Input: None
// Output: None

// Functions:
//	(In Assembly view)
// 	call F_System_Initial; 
//	(In C language view)
// 	System_Initial(); 
//////////////////////////////////////////////////////////////////

.include resource.inc;
.include hardware.inc;
.include key.inc;

.TEXT
.public _System_Initial;
.public	F_System_Initial;
_System_Initial: .PROC
F_System_Initial:
		call	F_Key_Scan_Initial;			// 键盘初始化
		call	F_User_Init_IO;				//	
		R1=C_IRQ5_2Hz						// 开2hz中断来清看门狗
		[R_InterruptStatus] = R1			//
		[P_INT_Ctrl] = R1					//
		INT IRQ
		retf;
		.ENDP;

//****************************************************************
// Function: Main Loop of system                     
// Input: None
// Output: None
// Using:
// call F_System_ServiceLoop; (in assembly domain)
// System_ServiceLoop(); (in C domain) 	
//****************************************************************
.public _System_ServiceLoop;
.public	F_System_ServiceLoop;
_System_ServiceLoop: .PROC                  
F_System_ServiceLoop:
		call	F_Key_DebounceCnt_Down;		// calling debounce subroutine for key scan subroutine
		call    F_Key_Scan_ServiceLoop;		// calling key scan subroutine 
		// Add other general service functions here	
		R1=0x0001;                      	// Clear watch dog
		[P_Watchdog_Clear]=R1;       		//	
        retf;
        .ENDP;
        
    
F_User_Init_IO:
		R1 = 0x00F0;
        [P_IOA_Dir] = R1;                    // Port A15- A8: input(PL)/output(OL)
        [P_IOA_Data] = R1;                   // Port A7 - A4: output(OL)
        R1 = 0x00F0;                         // Port A3 - A0: input_PL
        [P_IOA_Attrib] = R1;                 //      

   		R1 = 0xFFFF;                         //
 	    [P_IOB_Dir] = R1;                    // Port B output/OL
        [P_IOB_Data] = R1;                   //
        [P_IOB_Attrib] = R1;                 //
                

 		R1 = 0x0060;                         //
        [P_IOA_Buffer] = R1;                 
        retf;   
 

⌨️ 快捷键说明

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