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

📄 misc.s

📁 AVR单片机 C语言程序设计经典实用
💻 S
📖 第 1 页 / 共 2 页
字号:
	.dbline 130
; 	{
	.dbline 131
; 		if(PINB & (1 << cKey1))       //Key Released
	sbis 0x16,0
	rjmp L39
	.dbline 132
; 		{
	.dbline 133
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L32+1,R25
	sts L32,R24
	.dbline 134
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L31
L39:
	.dbline 136
; 		}
; 	}
L37:
L34:
	.dbline 137
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L31:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
L42:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
	.dbfunc e swGet_Key2 _swGet_Key2 fi
	.dbsym s wKeyStatus L42 i
	.even
_swGet_Key2::
	.dbline -1
	.dbline 147
; }
; 
; //******************************************************************************
; // Function    : swGet_Key2
; // Input       : none
; // Output      : true - Key2 active; false - Key2 - passitive
; // Description : Key1 Detection,rising edge active
; //******************************************************************************
; INT16U swGet_Key2(void)
; {
	.dbline 149
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L42
	lds R25,L42+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L43
	.dbline 150
; 	{
	.dbline 151
; 		if((PINB & (1 << cKey2)) == 0) //Key Pressed
	sbic 0x16,1
	rjmp L44
	.dbline 152
; 		{
	.dbline 153
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L42+1,R3
	sts L42,R2
	.dbline 154
; 		}
	.dbline 155
; 	}
	xjmp L44
L43:
	.dbline 156
; 	else if(wKeyStatus == 0)
	lds R2,L42
	lds R3,L42+1
	tst R2
	brne L47
	tst R3
	brne L47
X4:
	.dbline 157
; 	{
	.dbline 158
; 		if(PINB & (1 << cKey2))       //Key Released
	sbis 0x16,1
	rjmp L49
	.dbline 159
; 		{
	.dbline 160
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L42+1,R25
	sts L42,R24
	.dbline 161
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L41
L49:
	.dbline 163
; 		}
; 	}
L47:
L44:
	.dbline 164
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L41:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
L52:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
	.dbfunc e swGet_Key3 _swGet_Key3 fi
	.dbsym s wKeyStatus L52 i
	.even
_swGet_Key3::
	.dbline -1
	.dbline 174
; }
; 
; //******************************************************************************
; // Function    : swGet_Key3
; // Input       : none
; // Output      : true - Key3 active; false - Key3 - passitive
; // Description : Key3 Detection,rising edge active
; //******************************************************************************
; INT16U swGet_Key3(void)
; {
	.dbline 176
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L52
	lds R25,L52+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L53
	.dbline 177
; 	{
	.dbline 178
; 		if((PINB & (1 << cKey3)) == 0) //Key Pressed
	sbic 0x16,2
	rjmp L54
	.dbline 179
; 		{
	.dbline 180
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L52+1,R3
	sts L52,R2
	.dbline 181
; 		}
	.dbline 182
; 	}
	xjmp L54
L53:
	.dbline 183
; 	else if(wKeyStatus == 0)
	lds R2,L52
	lds R3,L52+1
	tst R2
	brne L57
	tst R3
	brne L57
X5:
	.dbline 184
; 	{
	.dbline 185
; 		if(PINB & (1 << cKey3))       //Key Released
	sbis 0x16,2
	rjmp L59
	.dbline 186
; 		{
	.dbline 187
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L52+1,R25
	sts L52,R24
	.dbline 188
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L51
L59:
	.dbline 190
; 		}
; 	}
L57:
L54:
	.dbline 191
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L51:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
L62:
	.blkb 2
	.area idata
	.word 1
	.area data(ram, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
	.area text(rom, con, rel)
	.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\多任务模拟系统设计\misc.c
	.dbfunc e swGet_Key4 _swGet_Key4 fi
	.dbsym s wKeyStatus L62 i
	.even
_swGet_Key4::
	.dbline -1
	.dbline 201
; }
; 
; //******************************************************************************
; // Function    : swGet_Key4
; // Input       : none
; // Output      : true - Key4 active; false - Key4 - passitive
; // Description : Key4 Detection,rising edge active
; //******************************************************************************
; INT16U swGet_Key4(void)
; {
	.dbline 203
; 	static INT16U wKeyStatus = 1;
; 	if(wKeyStatus == 1)
	lds R24,L62
	lds R25,L62+1
	cpi R24,1
	ldi R30,0
	cpc R25,R30
	brne L63
	.dbline 204
; 	{
	.dbline 205
; 		if((PINB & (1 << cKey4)) == 0) //Key Pressed
	sbic 0x16,3
	rjmp L64
	.dbline 206
; 		{
	.dbline 207
; 			wKeyStatus = 0;
	clr R2
	clr R3
	sts L62+1,R3
	sts L62,R2
	.dbline 208
; 		}
	.dbline 209
; 	}
	xjmp L64
L63:
	.dbline 210
; 	else if(wKeyStatus == 0)
	lds R2,L62
	lds R3,L62+1
	tst R2
	brne L67
	tst R3
	brne L67
X6:
	.dbline 211
; 	{
	.dbline 212
; 		if(PINB & (1 << cKey4))       //Key Released
	sbis 0x16,3
	rjmp L69
	.dbline 213
; 		{
	.dbline 214
; 			wKeyStatus = 1;
	ldi R24,1
	ldi R25,0
	sts L62+1,R25
	sts L62,R24
	.dbline 215
; 			return(true);
	ldi R16,1
	ldi R17,0
	xjmp L61
L69:
	.dbline 217
; 		}
; 	}
L67:
L64:
	.dbline 218
; 	return(false);
	clr R16
	clr R17
	.dbline -2
L61:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Key_Detection _Key_Detection fV
	.even
_Key_Detection::
	.dbline -1
	.dbline 228
; }
; 
; //******************************************************************************
; // Function    : Key_Detection
; // Input       : none
; // Output      : none
; // Description : Keys Detection.if active,send Key Event to task
; //******************************************************************************
; void Key_Detection(void)
; {
	.dbline 229
; 	if(swGet_Key1() == true)
	xcall _swGet_Key1
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L72
	.dbline 230
; 	{
	.dbline 231
; 		OS_Event_Post(cPrioTask1,eTask1_Key);
	ldi R18,1
	ldi R19,0
	clr R16
	xcall _OS_Event_Post
	.dbline 232
; 	}
L72:
	.dbline 233
; 	if(swGet_Key2() == true)
	xcall _swGet_Key2
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L74
	.dbline 234
; 	{
	.dbline 235
; 		OS_Event_Post(cPrioTask2,eTask2_Key);
	ldi R18,1
	ldi R19,0
	ldi R16,1
	xcall _OS_Event_Post
	.dbline 236
; 	}
L74:
	.dbline 237
; 	if(swGet_Key3() == true)
	xcall _swGet_Key3
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L76
	.dbline 238
; 	{
	.dbline 239
; 		OS_Event_Post(cPrioTask3,eTask3_Key);
	ldi R18,1
	ldi R19,0
	ldi R16,2
	xcall _OS_Event_Post
	.dbline 240
; 	}
L76:
	.dbline 241
	xcall _swGet_Key4
	cpi R16,1
	ldi R30,0
	cpc R17,R30
	brne L78
	.dbline 242
	.dbline 243
	ldi R18,1
	ldi R19,0
	ldi R16,3
	xcall _OS_Event_Post
	.dbline 244
L78:
	.dbline -2
	.dbline 245
; 	if(swGet_Key4() == true)
; 	{
; 		OS_Event_Post(cPrioTask4,eTask4_Key);
; 	}
; }
L71:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

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