Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

REgarding USer interactive menu flow Help

Status
Not open for further replies.

cnandha19

Member level 3
Joined
Aug 28, 2015
Messages
59
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
604
menu.jpg


Here i attached the model of menu flow i had the menu flow with 1 press means it goes to 1 st Menu 1.Company name and again '1' pressed means it goes to company address but i wanna to change it 1 pressed means it goes to company address after the enter pressed means it has to goto company address and if i am in company address if Esca pressed means it goes back to companyname i want logic please help me


Code:
    while(1)
	{
		
	key =READ_SWITCHES();
		
		
 
   case '1' :                        

         ///SET KEY
					{
					
					
						switch(mode)
						{
							
								 
							case mCompanyname:
							{
								
								key = companyname_function();
								

								if(key)
								{
							        lcdClear();
							        lcdMoveCursor(0,0);
							        lcdPrintStr("1.Company details");
							        lcdMoveCursor(1,0);
							        lcdPrintStr("2.Calibration off");
							        lcdMoveCursor(2,0);
							        lcdPrintStr("3.Set date time");
							        lcdMoveCursor(3,0);
							        lcdPrintStr("4.Manage userpass");
							        
								menu = mpassword;
								mode = mCompanyAddress;    //mcalibration
										
								}
								
								
								else
								{
									
									menu = mpassword;
								    
							             		
								}
								
							
						}
							
							
							break;
							
							
							case mCompanyAddress:
							{
								
								
								key = company_address();
								
								
							
								
								if(key)
								{
									
									lcdClear();
									lcdMoveCursor(0,0);
									lcdPrintStr("1.Company details");
									lcdMoveCursor(1,0);
									lcdPrintStr("2.Calibration off");
									lcdMoveCursor(2,0);
									lcdPrintStr("3.Set date time");
									lcdMoveCursor(3,0);
									lcdPrintStr("4.Manage userpass");
									
									menu = mpassword;
									mode = mcalibration;    //mcalibration
								}
													        
								else
								{
									
									menu =mpassword;
									
								}
								
								
                                     
								
							}
							break;
 

I normaly do something like this
typedef struct { u8 MenuID, bool EnterFlag, bool ** Handler (bool EnterFlag)} MenuTypeDef;

than we just loop it
while (1) Menu.EnterFlag = Handler[Menu.MenuID].Handler (Menu.EnterFlag);
when it goes to handler, it resets EnterFlag and update screen
when it goes to another handler, it sets EnterFlag and let another handler update the screen data
So, basicaly, only one string are used.
 

while (1) Menu.EnterFlag = Menu.Handler[Menu.MenuID].Handler (Menu.EnterFlag);
sorry, small mistake. Handler is also part of menu structure.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top