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

📄 menupara.s

📁 Atmega64单片机程序(完整工程)
💻 S
字号:
	.module MenuPara.C
	.area text(rom, con, rel)
	.even
_DispMenuParaInit::
	sbiw R28,1
; /*这份代码经源码格式软件格式化过
;      yang_hx@neusoft.com      */
; /******************************************************************************
;  * MenuPara.C - "参数"菜单  菜单函数使用模版
;  ******************************************************************************/
; #include "SYS_Config.h" 
; #include "GUI_Config.h" 
; #include "GUI.H" 
; #include "Menu.H" 
; 
; 
; //参数
; void DispMenuParaInit()
; {
;     //----------------------
;     GUI_Clear();
	xcall _GUI_Clear
;     //--------------------
;     //切换Bar显示内容
;     //---------------------
;     BarMenu=&MenuPara[language];
	lds R2,_language
	ldi R24,5
	mul R24,R2
	movw R2,R0
	ldi R24,<_MenuPara
	ldi R25,>_MenuPara
	add R2,R24
	adc R3,R25
	sts _BarMenu+1,R3
	sts _BarMenu,R2
;     ItemNum=(*BarMenu).TextNum ;
	movw R30,R2
	adiw R30,2
	lpm R30,Z
	sts _ItemNum,R30
;     DispItem=(*BarMenu).Text ;
	movw R30,R2
	lpm R0,Z+
	lpm R1,Z
	movw R30,R0
	sts _DispItem+1,R31
	sts _DispItem,R30
;     
;     //用户的初始化代码请放在这里
;     
; 	//显示按键对应的文字提示,1-->"选择"
;     GUI_DispStringAt(*(Tip[language].Text+1),1,LCD_YSIZE-14);
	ldi R24,54
	std y+0,R24
	ldi R18,1
	lds R2,_language
	ldi R24,5
	mul R24,R2
	movw R30,R0
	ldi R24,<_Tip
	ldi R25,>_Tip
	add R30,R24
	adc R31,R25
	lpm R0,Z+
	lpm R1,Z
	movw R30,R0
	ldd R16,z+2
	ldd R17,z+3
	xcall _GUI_DispStringAt
;     //显示按键对应的文字提示,0-->"退出"
; 	GUI_DispStringAt(*(Tip[language].Text+4),LCD_XSIZE-24,LCD_YSIZE-14);
	ldi R24,54
	std y+0,R24
	ldi R18,73
	lds R2,_language
	ldi R24,5
	mul R24,R2
	movw R30,R0
	ldi R24,<_Tip
	ldi R25,>_Tip
	add R30,R24
	adc R31,R25
	lpm R0,Z+
	lpm R1,Z
	movw R30,R0
	ldd R16,z+8
	ldd R17,z+9
	xcall _GUI_DispStringAt
; 
; 	//公共初始化部分
;     BarMenuInit();
	xcall _BarMenuInit
L1:
	adiw R28,1
	.dbline 0 ; func end
	ret
	.even
_DispMenuParaUp::
	xcall push_gset1
	sbiw R28,1
; }
; 
; /*
; *****************************************************************************
; 菜单使用例程
; 0.Jump2Menu + FlashMode_AutoInit/FlashMode_ManualInit
;   跳转到任意菜单,FlashMode_AutoInit-->在BarMenuInit函数中执行PUSH;
;   FlashMode_ManualInit-->子菜单的Init函数中PUSH,看例子:DispMenuLanguageInit
; 1.PUSH + POP
;   执行一些功能,并使用LCD后,回到原有界面,回到原有界面--包括反显位置都恢复
; 2.Jump2Menu(SelfMenuIndex,FlashMode_ReFlash);
;   执行一些功能,并使用LCD后,执行如上调用,回到原有界面--包括反显位置都恢复
; 3.POP
;   执行一些功能,并使用LCD后,回到上层菜单,恢复上层界面
; 4.Jump2Menu(SelfMenuIndex,FlashMode_NoAction);
;   执行一定功能后,但不占用LCD的话,直接界面不动
; 
; *****************************************************************************
; */
; void DispMenuParaUp()
; {
;     switch(Item)
	lds R20,_Item
	clr R21
	cpi R20,0
	cpc R20,R21
	breq L6
X0:
	cpi R20,1
	ldi R30,0
	cpc R21,R30
	breq L8
	cpi R20,2
	ldi R30,0
	cpc R21,R30
	breq L10
	cpi R20,3
	ldi R30,0
	cpc R21,R30
	brne X2
	xjmp L12
X2:
	cpi R20,4
	ldi R30,0
	cpc R21,R30
	brne X3
	xjmp L14
X3:
	xjmp L3
X1:
;     {
L6:
;         case 0 :
;         {
;             //Jump2Menu
;             GUI_Clear();
	xcall _GUI_Clear
;             GUI_DispStringAt("Do Something \nthen Back to \nTop Menu!",0,0);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,<L7
	ldi R17,>L7
	xcall _GUI_DispStringAt
;             GUI_Delay(5000);
	ldi R16,5000
	ldi R17,19
	xcall _GUI_Delay
;             Jump2Menu(MenuTopIndex,FlashMode_AutoInit);
	ldi R18,1
	clr R16
	xcall _Jump2Menu
;             break ;
	xjmp L4
L8:
;         }
;         case 1 :
;         {
;             //PUSH  -->POP
;             PUSH();
	xcall _PUSH
;             GUI_Clear();
	xcall _GUI_Clear
;             GUI_DispStringAt("Do Something \nthen Back to \nThis Menu!",0,0);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,<L9
	ldi R17,>L9
	xcall _GUI_DispStringAt
;             GUI_Delay(5000);
	ldi R16,5000
	ldi R17,19
	xcall _GUI_Delay
;             POP();
	xcall _POP
;             break ;
	xjmp L4
L10:
;         }
;         case 2 :
;         {
;             //ReFlash = 1
;             GUI_Clear();
	xcall _GUI_Clear
;             GUI_DispStringAt("Do Something \nthen Back to \nThis Menu!",0,0);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,<L9
	ldi R17,>L9
	xcall _GUI_DispStringAt
;             GUI_Delay(5000);
	ldi R16,5000
	ldi R17,19
	xcall _GUI_Delay
;             Jump2Menu(SelfMenuIndex,FlashMode_ReFlash);
	ldi R18,3
	ldi R24,<_FatherIndex-1
	ldi R25,>_FatherIndex-1
	lds R30,_Layer
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	xcall _Jump2Menu
;             break ;
	xjmp L4
L12:
;         }
;         case 3 :
;         {
;             //POP
;             GUI_Clear();
	xcall _GUI_Clear
;             GUI_DispStringAt("Do Something \nthen Back to \nFather Menu!",0,0);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,<L13
	ldi R17,>L13
	xcall _GUI_DispStringAt
;             GUI_Delay(5000);
	ldi R16,5000
	ldi R17,19
	xcall _GUI_Delay
;             POP();
	xcall _POP
;             break ;
	xjmp L4
L14:
;         }
;         case 4 :
;         {
;             //No ReFlash
;             //No Action Here!
;             //Or The Action no need the LCD Disp
;             Jump2Menu(SelfMenuIndex,FlashMode_NoAction);
	clr R18
	ldi R24,<_FatherIndex-1
	ldi R25,>_FatherIndex-1
	lds R30,_Layer
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	xcall _Jump2Menu
;             break ;
	xjmp L4
L3:
;         }
;         default :
;         {
;             Jump2Menu(SelfMenuIndex,FlashMode_NoAction);
	clr R18
	ldi R24,<_FatherIndex-1
	ldi R25,>_FatherIndex-1
	lds R30,_Layer
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	xcall _Jump2Menu
;             return ;
L4:
L2:
	adiw R28,1
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.even
_DispMenuParaDown::
;         }
;     }
; }
; void DispMenuParaDown()
; {
;     POP();
	xcall _POP
L17:
	.dbline 0 ; func end
	ret
	.even
_DispMenuParaLeft::
; }
; 
; void DispMenuParaLeft()
; {
;     BarMenuLeft();
	xcall _BarMenuLeft
L18:
	.dbline 0 ; func end
	ret
	.even
_DispMenuParaRight::
; }
; void DispMenuParaRight()
; {
;     BarMenuRight();
	xcall _BarMenuRight
L19:
	.dbline 0 ; func end
	ret
	.area data(ram, con, rel)
L13:
	.blkb 41
	.area idata
	.byte 'D,'o,32,'S,'o,'m,'e,'t,'h,'i,'n,'g,32,10,'t,'h
	.byte 'e,'n,32,'B,'a,'c,'k,32,'t,'o,32,10,'F,'a,'t,'h
	.byte 'e,'r,32,'M,'e,'n,'u,33,0
	.area data(ram, con, rel)
L9:
	.blkb 39
	.area idata
	.byte 'D,'o,32,'S,'o,'m,'e,'t,'h,'i,'n,'g,32,10,'t,'h
	.byte 'e,'n,32,'B,'a,'c,'k,32,'t,'o,32,10,'T,'h,'i,'s
	.byte 32,'M,'e,'n,'u,33,0
	.area data(ram, con, rel)
L7:
	.blkb 38
	.area idata
	.byte 'D,'o,32,'S,'o,'m,'e,'t,'h,'i,'n,'g,32,10,'t,'h
	.byte 'e,'n,32,'B,'a,'c,'k,32,'t,'o,32,10,'T,'o,'p,32
	.byte 'M,'e,'n,'u,33,0
	.area data(ram, con, rel)

⌨️ 快捷键说明

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