"building" a menu on an LCD - pointers/ideas?

stocky

Senior Member
Hi all - I'm just about to embark on an addition to a fairly major project I'm working and nearly have core functions completed.

The last thing to decide on it the provision of a method to allow users to set certain (limited!) parameters. Currently I have 3 trimpots being read by ADC, scaled and displayed on the LCD (in a special "setup" mode entered by key sequence). That works just fine but I am limited to 3 parameters using that method (4th ADC reading a voltage).

I'm using a 28x1 and my "main" code currently uses about 2k - so I have 2k of program space to play with (and can add an i2c eeprom for parameter storage easily as I have an i2c bus implemented in the design for i/o expansion).

What i'm looking for (and I have searched without finding anything - but maybe my search terms where not "optimal" - so no flames please!) is some ideas (read: IDEAS not complete code done for me!) on implementing a simple menu system on an LCD.

The concept is 3 buttons - ENTER/SAVE + UP & DOWN.
1 )UP & DOWN to scroll options, ENTER/SAVE to select
2) UP & DOWN to change value, ENTER/SAVE to save and exit back to main list

Anyone implemented something similar in a PICAXE?

I have spare "native" inputs and I *think* I can use the ADC inputs as digital inputs for buttons if they are not being used as ADCs - or I can "make" more i/o on my i2c bus for buttons - or I can port to a 40x1 if need be - that part of the project is still variable if required (*checks junk box for 40x1*)

Project concept is to have a fixed hardware setup (with i2c expansion capabilities) and have a "pluggable" firmware module (ie PICAXE in a DB37 backshell) that allows "major" upgrades to be done by the end user. We can then supply an expansion module (i2c) and a new firmware "plug".

Another option may be to build in an SD card and use a non-picaxe (shh) PIC chip with bootloader that pulls the upgraded FW off the SD card.....but thats down the track a bit.....

Cheers

Stocky
 

Brietech

Senior Member
That video was a pretty good example, but you can handle just about anything you can think of. I've done the extremely simple types (i.e. "press 0 for option one, press 1 for option 2, etc.") to far more complicated (I implemented a full text editor on a 24x8 character display, complete with automatic line numbering and an i2c file-system to handle opening/saving files!). Picaxe chips can handle just about anything that is limited by human interaction speed.
 

moxhamj

New Member
Mobile phones might provide some generic solutions. Some are easy to browse the menus and some are hard. In a general sense, one button selects a menu item, then a sub menu item etc, and another button goes back up the menu items till you get to the root. And then there is a the menu selection (up/down, or really fancy - a pot/wheel etc), and a button to select.

Hmm - 5 buttons. Or 3 buttons and a pot. Certainly possible in picaxe.
 

kevrus

New Member
If I have understood your post correctly, I have done something similiar, using button number 1 to increment a variable which referenced to the 'branch' command which in turn allows a jump to the relevant menu item via button number 2. Other buttons could then be used to change settings, although in my case, I re-used the same two buttons...
 

wilf_nv

Senior Member
A minimal but intuitive menu includes a Menu button and 4 Cursor arrow buttons. Since normally only one key is depressed at a time, a single ADC input can easily encode these 5 buttons.

Consider the following possible method:

I assume the LCD normally displays some real-time status of inputs, status and timers, etc.

Pressing the Menu button once changes the live display to the stored parameter display e.g. analog setpoints, time intervals. Pressing Menu again or no buttons pressed for some time restores the live display.

Pressing the left/right cursor buttons select and highlight a parameter to be changed.

Pressing the up/down cursor buttons increments or decrements the numerical parameter value or selects a new state eg on /off for that parameter.

The last field of the parameter display is the Save,Cancel and Exit field, selected and changed by the cursor buttons, allowing the parameter changes to be reviewed before storing as the new parameter value.

Multiple menu levels can be implimented this way as long as the functionality of the button use is consistent.

My favourite low power 5 button ADC priority encoder circuit, generates 1 of 6 analog values (including no button) regardless of the number of buttons pressed.

This is simply done by using four 10K resistors connected in series to ground. The ADC input is pulled up with another 10K resistor to Vcc.

One side of all buttons is commoned and connected to the ADC input.

The other side of each button is connected to each resistor tap with the Menu button connected between the ADC input and ground.

Since the Menu button controls the Saving of parameters, it should be the highest priority.

The ADC input values will be 0V,1V,2V,3V,4V and 5V respectively for Menu, Up, Down, Left, Right and no key pressed.

These analog values should be debounced before using.

regards

wilf
 
Last edited:

hippy

Ex-Staff (retired)
I've usually designed LCD menus similar to how wilf_nv describes with four buttons, Up, Down, Select and Back. Up and Down allow a menu option to be selected, Select moves to a sub-menu or a 'variable' to be edited, Back aborts out ( up a level, hold 1.5 seconds to jump to Menu Start ). When editing a 'variable' Up/Down cycles through the values that variable can be and Select stores it. Hold Up and Down and goes to first menu item, or a variable goes to its default value.

This has worked in real commercial product and I have tried other schemes but this seems to be the easiest for people to use. You can have just one Next button instead of Up and Down if you don't mind cycling through all menu/variable options but that can annoy people if they miss what they wanted. Auto-repeat on held buttons helps a lot.

I've always prototyped in VB6 first as there's a lot of tweaking which needs to be done to make it look good; minimal abrvations and making what's shown meaningful with limited characters. A 2 x 16 display I've found good, that way for variables you can describe on the top line what's being altered and the current setting on the bottom line. 4 x 16/20 is even better, have an arrow on the left which shows selected item and move the arrow up/down until at top or bottom then start scrolling the display with the arrow stating static.

It can take a lot of work to get an LCD menu working well and intuitive to use. Always assume that whoever is using it understands what the thing is but has never read a manual. If they can configure it without any instructions then you've cracked it :)
 

Jeremy Leach

Senior Member
Just some more ideas to throw in:

For an advanced system (I've never tried this) - ideally make the menu system present the most commonly used options first, so the user doesn't have to cycle through unlikely options. Could even have it 'learn' the most commonly used options !

Can do a lot with just one button - timing of button presses etc.

Also I keep wondering how the predictive text idea of mobile phones could be used in picaxe systems - to keep button presses to a minimum. Can't at the moment see how it could be used for menu systems though ! (although maybe just learning most common options is the same thing really).

Also, to get really nerdy about it ... it could be interesting to compare average number of button pushes to navigate relatively flat menu tree structures compared to deep tree structures. There's probably some optimum !
 
Last edited:

BrendanP

Senior Member
I saw a flat donut shapped device on spark fun the other day. Depending on where you press on the donut resistance changes on the output. Should be easy to picaxe via readadc.
If its for a commerical product maybe look at getting membrane switches made that incorporate something like that along with a clear window for the LCD screen. They're not the exspensive to get done.
 

nickpatts

Member
Hi, a newbie myself in picaxe and menu's but just a sample for those playing around with menu idea's, there is probably a better way of doing this but this is what I've tryed so far, minus the lcd as of yet just uses leds for the selected menu item, and a led executing the items tasks when entered, just using a two button system one for select and one for enter.

menu led items on outpins 0 to 6, 7 being used to menu's task, so enter button on menu item 5 will flash led(7), 5 times to indicate its executing that menu task, select button on inputpin7 and enter on inputpin 6 using an picaxe 18

Code:
Init:
	b0=0			'inital menu set to item 1
	b3=%00000001	'inital menu led var to menu 1 
	let outpins=b3	'inital menu led on

Menu:

	Do
		gosub checkbutton  'check buttons state
	Loop While pin6=0        'check menu enter button state
	gosub DoMenuItem			 'Do current menu items task.
	
	
DoMenuItem:
	for b1=0 to b0	
	high 7
	pause 500
	low 7 pause 500
	next b1
	gosub init  ' start all over again at menu 1
	return



checkbutton:
		Do
			if pin6=1 then goto DoMenuItem  'Do current menu items task if enter button pressed
		Loop while pin7=0				  ' if select button presses increment next menu item and led
		inc b0
		b3=b3 * 2
		
		if b0 > 6 then     'if we go over out set menu items of 7 then reset back to menu item 1
		b0=0 
		b3=%00000001 
		endif
		
		let outpins=b3  'update current menu led item
		
		pause 200
		Return

Regards

Nick
 
Last edited:
Top