Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/12/03 10:02
Read: times


 
#43309 - RE: How to make a menu for on a lcd in c?
Responding to: ???'s previous message
This is code from a simple menu system I wrote for a grinding machine.
it uses only an UP button ,that loops (you could easily add a down button to the code).

The menu_count variable provides an automatic exit if no buttons are pressed,and is incremented by a timer interrupt.

The menu selected is put to a LCD by the show_message(ch,1,2) routine (via an enumerated string),but I'm sure you can write that bit for yourself.

<html>
do {Kick_the_Watchdog();}while(!Enter);//wait button release!
	ch=1;
	menu_count=0;
	check_menu=1;
	for(;;){
		delay_ms(300);
		if(!Up){ch++;menu_count=0;if(ch>7)ch=1;show_message(ch,1,2);}
		if(!Enter){break;}
		if(menu_count>300){ch=0x0a;break;}
	}
	check_menu=0;
	switch(ch){
		case 0x01	:	menus1();break;
		case 0x02	:	menus2();break;
		case 0x03	:	menus3();break;
		case 0x04	:	menus4();break;
		case 0x05	:	menus5();break;
		case 0x06	: 	menus6();break;
		case 0x07	: 	menus7();break;
		case 0x0a	: 	break;
			
	}

</html>

List of 6 messages in thread
TopicAuthorDate
How to make a menu for on a lcd in c?            01/01/70 00:00      
   RE: How to make a menu for on a lcd in c?            01/01/70 00:00      
   RE: language            01/01/70 00:00      
      RE: language            01/01/70 00:00      
         RE: language            01/01/70 00:00      
   RE: How to make a menu for on a lcd in c?            01/01/70 00:00      

Back to Subject List