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

📄 misc.s

📁 AVR单片机 C语言程序设计经典实用
💻 S
字号:
	.module misc.c
	.area data(ram, con, rel)
_bLED_Test_Enable::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbsym e bLED_Test_Enable _bLED_Test_Enable c
_bBuzzer_Test_Enable::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbsym e bBuzzer_Test_Enable _bBuzzer_Test_Enable c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbfunc e sSet_LED_Test _sSet_LED_Test fV
;        bEnable -> R16
	.even
_sSet_LED_Test::
	.dbline -1
	.dbline 22
; //******************************************************************************
; // File Name : misc.c
; // Author    : Steaven
; // Created   : 2008-06-09
; // Modified  : 
; // Revision  : V0.0
; //******************************************************************************
; 
; #include "app.h"
; 
; //global variables definition
; INT8U bLED_Test_Enable = 0;     //Enable LED Test
; INT8U bBuzzer_Test_Enable = 0;  //Enable BUZZER Test
; 
; //****************************************************************
; // Function    : sSet_LED_Test
; // Input       : bEnable - whether Enable LED Test or not
; // Output      : none
; // Description : Interface Function-Set LED Test Flag
; //****************************************************************
; void sSet_LED_Test(INT8U bEnable)
; {
	.dbline 23
; 	bLED_Test_Enable = bEnable;
	sts _bLED_Test_Enable,R16
	.dbline -2
	.dbline 24
; }
L1:
	.dbline 0 ; func end
	ret
	.dbsym r bEnable 16 c
	.dbend
	.dbfunc e sbGet_LED_Test _sbGet_LED_Test fc
	.even
_sbGet_LED_Test::
	.dbline -1
	.dbline 33
; 
; //****************************************************************
; // Function    : sbGet_LED_Test
; // Input       : none
; // Output      : none
; // Description : Interface Function-Get LED Test Flag
; //****************************************************************
; INT8U sbGet_LED_Test(void)
; {
	.dbline 34
; 	return(bLED_Test_Enable);
	lds R16,_bLED_Test_Enable
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e sSet_Buzzer_Test _sSet_Buzzer_Test fV
;        bEnable -> R16
	.even
_sSet_Buzzer_Test::
	.dbline -1
	.dbline 44
; }
; 
; //****************************************************************
; // Function    : sSet_Buzzer_Test
; // Input       : bEnable - whether Enable BUZZER Test or not
; // Output      : none
; // Description : Interface Function-Set BUZZER Test Flag
; //****************************************************************
; void sSet_Buzzer_Test(INT8U bEnable)
; {
	.dbline 45
; 	bBuzzer_Test_Enable = bEnable;
	sts _bBuzzer_Test_Enable,R16
	.dbline -2
	.dbline 46
; }
L3:
	.dbline 0 ; func end
	ret
	.dbsym r bEnable 16 c
	.dbend
	.dbfunc e sbGet_Buzzer_Test _sbGet_Buzzer_Test fc
	.even
_sbGet_Buzzer_Test::
	.dbline -1
	.dbline 55
; 
; //****************************************************************
; // Function    : sbGet_Buzzer_Test
; // Input       : none
; // Output      : none
; // Description : Interface Function-Get BUZZER Test Flag
; //****************************************************************
; INT8U sbGet_Buzzer_Test(void)
; {
	.dbline 56
; 	return(bBuzzer_Test_Enable);
	lds R16,_bBuzzer_Test_Enable
	.dbline -2
L4:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e LED_ON_ALL _LED_ON_ALL fV
	.even
_LED_ON_ALL::
	.dbline -1
	.dbline 66
; }
; 
; //****************************************************************
; // Function    : LED_ON_ALL
; // Input       : none
; // Output      : none
; // Description : LED Control-ON LED
; //****************************************************************
; void LED_ON_ALL(void)
; {
	.dbline 67
; 	PORTD |= 0xF0;
	in R24,0x12
	ori R24,240
	out 0x12,R24
	.dbline -2
	.dbline 68
; }
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e LED_OFF_ALL _LED_OFF_ALL fV
	.even
_LED_OFF_ALL::
	.dbline -1
	.dbline 77
; 
; //****************************************************************
; // Function    : LED_OFF_ALL
; // Input       : none
; // Output      : none
; // Description : LED Control-OFF LED
; //****************************************************************
; void LED_OFF_ALL(void)
; {
	.dbline 78
; 	PORTD &= 0x0F;
	in R24,0x12
	andi R24,15
	out 0x12,R24
	.dbline -2
	.dbline 79
; }
L6:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e BUZZER_ON _BUZZER_ON fV
	.even
_BUZZER_ON::
	.dbline -1
	.dbline 88
; 
; //****************************************************************
; // Function    : BUZZER_ON
; // Input       : none
; // Output      : none
; // Description : BUZZER Control-ON BUZZER
; //****************************************************************
; void BUZZER_ON(void)
; {
	.dbline 89
; 	PORTB |= 0x08;
	sbi 0x18,3
	.dbline -2
	.dbline 90
; }
L7:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e BUZZER_OFF _BUZZER_OFF fV
	.even
_BUZZER_OFF::
	.dbline -1
	.dbline 99
; 
; //****************************************************************
; // Function    : BUZZER_OFF
; // Input       : none
; // Output      : none
; // Description : BUZZER Control-OFF BUZZER
; //****************************************************************
; void BUZZER_OFF(void)
; {
	.dbline 100
; 	PORTB &= ~0x08;
	cbi 0x18,3
	.dbline -2
	.dbline 101
; }
L8:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
L10:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbfunc e swGet_KEY_ESC _swGet_KEY_ESC fi
	.dbsym s wKeyStatus L10 i
	.even
_swGet_KEY_ESC::
	.dbline -1
	.dbline 110
; 
; //****************************************************************
; // Function    : swGet_Key1
; // Input       : none
; // Output      : true - Key1 active; false - Key1 - passitive
; // Description : Key1 Detection,rising edge active
; //****************************************************************
; INT16U swGet_KEY_ESC(void)
; {
	.dbline 112
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L10
	lds R25,L10+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L11
	.dbline 113
; 	{
	.dbline 114
; 		if((PINB & (1 << cKey1)) == 0) //Key Pressed
	sbic 0x16,4
	rjmp L12
	.dbline 115
; 		{
	.dbline 116
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L10+1,R3
	sts L10,R2
	.dbline 117
; 		}
	.dbline 118
; 	}
	xjmp L12
L11:
	.dbline 119
; 	else if(wKeyStatus == 0)
	lds R2,L10
	lds R3,L10+1
	tst R2
	brne L15
	tst R3
	brne L15
X0:
	.dbline 120
; 	{
	.dbline 121
; 		if(PINB & (1 << cKey1))       //Key Released
	sbis 0x16,4
	rjmp L17
	.dbline 122
; 		{
	.dbline 123
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L10+1,R25
	sts L10,R24
	.dbline 124
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L9
L17:
	.dbline 126
; 		}
; 	}
L15:
L12:
	.dbline 127
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L9:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
L20:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbfunc e swGet_KEY_UP _swGet_KEY_UP fi
	.dbsym s wKeyStatus L20 i
	.even
_swGet_KEY_UP::
	.dbline -1
	.dbline 137
; }
; 
; //******************************************************************************
; // Function    : swGet_Key2
; // Input       : none
; // Output      : true - Key2 active; false - Key2 - passitive
; // Description : Key1 Detection,rising edge active
; //******************************************************************************
; INT16U swGet_KEY_UP(void)
; {
	.dbline 139
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L20
	lds R25,L20+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L21
	.dbline 140
; 	{
	.dbline 141
; 		if((PINB & (1 << cKey2)) == 0) //Key Pressed
	sbic 0x16,5
	rjmp L22
	.dbline 142
; 		{
	.dbline 143
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L20+1,R3
	sts L20,R2
	.dbline 144
; 		}
	.dbline 145
; 	}
	xjmp L22
L21:
	.dbline 146
; 	else if(wKeyStatus == 0)
	lds R2,L20
	lds R3,L20+1
	tst R2
	brne L25
	tst R3
	brne L25
X1:
	.dbline 147
; 	{
	.dbline 148
; 		if(PINB & (1 << cKey2))       //Key Released
	sbis 0x16,5
	rjmp L27
	.dbline 149
; 		{
	.dbline 150
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L20+1,R25
	sts L20,R24
	.dbline 151
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L19
L27:
	.dbline 153
; 		}
; 	}
L25:
L22:
	.dbline 154
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L19:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
L30:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbfunc e swGet_KEY_DOWN _swGet_KEY_DOWN fi
	.dbsym s wKeyStatus L30 i
	.even
_swGet_KEY_DOWN::
	.dbline -1
	.dbline 164
; }
; 
; //******************************************************************************
; // Function    : swGet_Key3
; // Input       : none
; // Output      : true - Key3 active; false - Key3 - passitive
; // Description : Key3 Detection,rising edge active
; //******************************************************************************
; INT16U swGet_KEY_DOWN(void)
; {
	.dbline 166
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L30
	lds R25,L30+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L31
	.dbline 167
; 	{
	.dbline 168
; 		if((PINB & (1 << cKey3)) == 0) //Key Pressed
	sbic 0x16,6
	rjmp L32
	.dbline 169
; 		{
	.dbline 170
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L30+1,R3
	sts L30,R2
	.dbline 171
; 		}
	.dbline 172
; 	}
	xjmp L32
L31:
	.dbline 173
; 	else if(wKeyStatus == 0)
	lds R2,L30
	lds R3,L30+1
	tst R2
	brne L35
	tst R3
	brne L35
X2:
	.dbline 174
; 	{
	.dbline 175
; 		if(PINB & (1 << cKey3))       //Key Released
	sbis 0x16,6
	rjmp L37
	.dbline 176
; 		{
	.dbline 177
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L30+1,R25
	sts L30,R24
	.dbline 178
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L29
L37:
	.dbline 180
; 		}
; 	}
L35:
L32:
	.dbline 181
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L29:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
L40:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LCD菜单系统设计\misc.c
	.dbfunc e swGet_KEY_ENTER _swGet_KEY_ENTER fi
	.dbsym s wKeyStatus L40 i
	.even
_swGet_KEY_ENTER::
	.dbline -1
	.dbline 191
; }
; 
; //******************************************************************************
; // Function    : swGet_Key4
; // Input       : none
; // Output      : true - Key4 active; false - Key4 - passitive
; // Description : Key4 Detection,rising edge active
; //******************************************************************************
; INT16U swGet_KEY_ENTER(void)
; {
	.dbline 193
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L40
	lds R25,L40+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L41
	.dbline 194
; 	{
	.dbline 195
; 		if((PINB & (1 << cKey4)) == 0) //Key Pressed
	sbic 0x16,7
	rjmp L42
	.dbline 196
; 		{
	.dbline 197
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L40+1,R3
	sts L40,R2
	.dbline 198
; 		}
	.dbline 199
; 	}
	xjmp L42
L41:
	.dbline 200
; 	else if(wKeyStatus == 0)
	lds R2,L40
	lds R3,L40+1
	tst R2
	brne L45
	tst R3
	brne L45
X3:
	.dbline 201
; 	{
	.dbline 202
; 		if(PINB & (1 << cKey4))       //Key Released
	sbis 0x16,7
	rjmp L47
	.dbline 203
; 		{
	.dbline 204
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L40+1,R25
	sts L40,R24
	.dbline 205
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L39
L47:
	.dbline 207
; 		}
; 	}
L45:
L42:
	.dbline 208
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L39:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Key_Detection _Key_Detection fV
	.even
_Key_Detection::
	.dbline -1
	.dbline 218
; }
; 
; //******************************************************************************
; // Function    : Key_Detection
; // Input       : none
; // Output      : none
; // Description : Keys Detection.if active,send Key Event to task
; //******************************************************************************
; void Key_Detection(void)
; {
	.dbline 219
; 	if(swGet_KEY_ESC()==true)
	xcall _swGet_KEY_ESC
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L50
	.dbline 220
; 	{
	.dbline 221
; 		OS_Event_Post(cPrioLCD,eLCDKeyEsc);
	ldi R18,1
	ldi R19,0
	clr R16
	xcall _OS_Event_Post
	.dbline 222
; 	}
L50:
	.dbline 223
; 	if(swGet_KEY_UP()==true)
	xcall _swGet_KEY_UP
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L52
	.dbline 224
; 	{
	.dbline 225
; 		OS_Event_Post(cPrioLCD,eLCDKeyUp);
	ldi R18,2
	ldi R19,0
	clr R16
	xcall _OS_Event_Post
	.dbline 226
; 	}
L52:
	.dbline 227
; 	if(swGet_KEY_DOWN()==true)
	xcall _swGet_KEY_DOWN
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L54
	.dbline 228
; 	{
	.dbline 229
; 		OS_Event_Post(cPrioLCD,eLCDKeyDown);
	ldi R18,3
	ldi R19,0
	clr R16
	xcall _OS_Event_Post
	.dbline 230
; 	}
L54:
	.dbline 231
	xcall _swGet_KEY_ENTER
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L56
	.dbline 232
	.dbline 233
	ldi R18,4
	ldi R19,0
	clr R16
	xcall _OS_Event_Post
	.dbline 234
L56:
	.dbline -2
	.dbline 235
; 	if(swGet_KEY_ENTER()==true)
; 	{
; 		OS_Event_Post(cPrioLCD,eLCDKeyEnter);
; 	}
; }
L49:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

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