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

📄 task.s

📁 AVR单片机C语言程序设计实例精粹
💻 S
字号:
	.module Task.c
	.area lit(rom, con, rel)
_LcdWindowFunc::
	.byte 0
	.word PL_LCD_Window0_Process
	.byte 1
	.word PL_LCD_Window1_Process
	.byte 2
	.word PL_LCD_Window2_Process
	.byte 3
	.word PL_LCD_Window3_Process
	.byte 4
	.word PL_LCD_Window4_Process
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
	.dbsym e LcdWindowFunc _LcdWindowFunc A[15:5]kX
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
_bWindowIndex::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
	.dbsym e bWindowIndex _bWindowIndex c
_bWindowIndexPre::
	.blkb 1
	.area idata
	.byte 255
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
	.dbsym e bWindowIndexPre _bWindowIndexPre c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
	.dbfunc e LCD_Task_Init _LCD_Task_Init fV
	.even
_LCD_Task_Init::
	.dbline -1
	.dbline 41
; //***************************************************************
; // File Name : Task.c
; // Author    : Steaven
; // Created   : 2008-06-09
; // Modified  : 
; // Revision  : V0.0
; //***************************************************************
; 
; #include "app.h"
; 
; //constant definition
; #define cLcdWindowMax 5       //Max of Display Page
; 
; //LCD Display Window List
; const struct lcdwindowfunc      
; {
; 	INT8U bLcdWindowIndex;
; 	void (*WinExe)();
; }LcdWindowFunc[cLcdWindowMax]=    
; {
; 	0,LCD_Window0_Process,
; 	1,LCD_Window1_Process,
; 	2,LCD_Window2_Process,
; 	3,LCD_Window3_Process,
; 	4,LCD_Window4_Process,
; };
; 
; //globla variables
; INT16U wLCD_Event;            //Event for LCD Task
; INT16U wGEN_Event;            //Event for GEN Task
; INT8U bWindowIndex = 0;       //Current Window Index
; INT8U bWindowIndexPre = 0xFF; //Last Window Index
; 
; //***************************************************************
; // Function    : LCD_Task_Init
; // Input       : none
; // Output      : none
; // Description : LCD Task Initialization
; //***************************************************************
; void LCD_Task_Init(void)
; {
	.dbline 43
; 	//LCD Display Initialization
; 	LCD_Init();
	xcall _LCD_Init
	.dbline 45
; 	//Get Database Length
; 	wDataBaseLength = Initial_DataBaseLength();
	xcall _Initial_DataBaseLength
	sts _wDataBaseLength+1,R17
	sts _wDataBaseLength,R16
	.dbline -2
	.dbline 46
; }
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e GEN_Task_Init _GEN_Task_Init fV
	.even
_GEN_Task_Init::
	.dbline -1
	.dbline 55
; 
; //***************************************************************
; // Function    : GEN_Task_Init
; // Input       : none
; // Output      : none
; // Description : GEN Task Initialization
; //***************************************************************
; void GEN_Task_Init(void)
; {
	.dbline 57
; 	//Set Initial Time
; 	sInit_Calendar();
	.dbline -2
	.dbline 58
; }
L2:
	.dbline 0 ; func end
	xjmp _sInit_Calendar
	.dbend
	.dbfunc e LCD_Task _LCD_Task fV
	.even
_LCD_Task::
	.dbline -1
	.dbline 67
; 
; //***************************************************************
; // Function    : LCD_Task
; // Input       : none
; // Output      : none
; // Description : LCD Task Process
; //***************************************************************
; void LCD_Task(void)
; {
	.dbline 68
; 	LcdWindowFunc[bWindowIndex].WinExe();
	lds R2,_bWindowIndex
	ldi R24,3
	mul R24,R2
	movw R30,R0
	ldi R24,<_LcdWindowFunc+1
	ldi R25,>_LcdWindowFunc+1
	add R30,R24
	adc R31,R25
	lpm R0,Z+
	lpm R1,Z
	movw R30,R0
	xcall xicall
	.dbline -2
	.dbline 69
; }
L3:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
L6:
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
	.dbfunc e GEN_Task _GEN_Task fV
	.dbsym s bCount0 L6 c
	.even
_GEN_Task::
	.dbline -1
	.dbline 78
; 
; //***************************************************************
; // Function    : GEN_Task
; // Input       : none
; // Output      : none
; // Description : GEN Task Process
; //***************************************************************
; void GEN_Task(void)
; {
	xjmp L8
L7:
	.dbline 81
; 	static INT8U bCount0 = 0;
; 	while(1)   
; 	{
	.dbline 82
; 		if(OS_Task_Switch(cPrioGEN) == true) 
	ldi R16,1
	xcall _OS_Task_Switch
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L10
	.dbline 83
; 		{
	.dbline 84
; 			return;                            
	xjmp L5
L10:
	.dbline 86
; 		}
; 		wGEN_Event = OS_Event_Pend(cPrioGEN);
	ldi R16,1
	xcall _OS_Event_Pend
	sts _wGEN_Event+1,R17
	sts _wGEN_Event,R16
	.dbline 87
; 		if(wGEN_Event == 0)                    
	cpi R16,0
	cpc R16,R17
	brne L12
X0:
	.dbline 88
; 		{
	.dbline 89
; 			return;                          
	xjmp L5
L12:
	.dbline 91
; 		}
; 		if(wGEN_Event & (1 << eGENTimer))
	lds R2,_wGEN_Event
	lds R3,_wGEN_Event+1
	sbrs R2,0
	rjmp L14
	.dbline 92
; 		{
	.dbline 94
; 			//Key Detection
; 			Key_Detection(); 
	xcall _Key_Detection
	.dbline 96
; 			//Calendar Update
; 			if(bCount0++ >= 50)
	lds R2,L6
	clr R3
	mov R24,R2
	subi R24,255    ; addi 1
	sts L6,R24
	mov R24,R2
	cpi R24,50
	brlo L16
	.dbline 97
; 			{
	.dbline 98
; 				bCount0 = 0;
	clr R2
	sts L6,R2
	.dbline 99
; 				Calendar_Update();
	xcall _Calendar_Update
	.dbline 100
; 			}     
L16:
	.dbline 101
; 		}
L14:
	.dbline 102
L8:
	.dbline 80
	xjmp L7
X1:
	.dbline -2
	.dbline 103
; 	}
; }
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Task_Init _Task_Init fV
	.even
_Task_Init::
	.dbline -1
	.dbline 112
; 
; //******************************************************************************
; // Function    : Task_Init
; // Input       : none
; // Output      : none
; // Description : Standard function format,put all tasks Initialization here
; //******************************************************************************
; void Task_Init(void)
; {
	.dbline 113
; 	LCD_Task_Init();
	xcall _LCD_Task_Init
	.dbline 114
; 	GEN_Task_Init();
	.dbline -2
	.dbline 115
; }
L18:
	.dbline 0 ; func end
	xjmp _GEN_Task_Init
	.dbend
	.dbfunc e Task_Start _Task_Start fV
	.even
_Task_Start::
	.dbline -1
	.dbline 124
; 
; //******************************************************************************
; // Function    : Task_Start
; // Input       : none
; // Output      : none
; // Description : Standard function format,put all tasks into while(1)
; //******************************************************************************
; void Task_Start(void)
; {
	xjmp L21
L20:
	.dbline 126
	.dbline 127
	xcall _LCD_Task
	.dbline 128
	xcall _GEN_Task
	.dbline 129
L21:
	.dbline 125
	xjmp L20
X2:
	.dbline -2
	.dbline 130
; 	while(1)
; 	{
; 	    LCD_Task();
; 	    GEN_Task();
; 	}
; }
L19:
	.dbline 0 ; func end
	ret
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\Task.c
_wGEN_Event::
	.blkb 2
	.dbsym e wGEN_Event _wGEN_Event i
_wLCD_Event::
	.blkb 2
	.dbsym e wLCD_Event _wLCD_Event i
	.area func_lit
PL_LCD_Window4_Process:	.word `_LCD_Window4_Process
PL_LCD_Window3_Process:	.word `_LCD_Window3_Process
PL_LCD_Window2_Process:	.word `_LCD_Window2_Process
PL_LCD_Window1_Process:	.word `_LCD_Window1_Process
PL_LCD_Window0_Process:	.word `_LCD_Window0_Process

⌨️ 快捷键说明

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