I have built a control panel having 2 x 16 char LCD, 16 button numerical keypad controlled by 68HC11. I have a series of menus for entering process settings. The menus are navigated using up, down, left and right arrows - similar to mobile phone menus. Mostly the menus consist of a title on the upper line and editable numerical value on the lower line. The problem: At present I have ten simple menus. Navigation is clunky and the code is becoming spagettilike. I also would like submenus. I am using assembly language and can give about 1K bytes to the menu part of the program. Is there a clever way to do this? I am hoping there may be a standard way to do it, or that I will get suggestions for giving structure to the process. In Hope. J. Casey.
Progrmming menus on 2x16LCD
Sep 15, 2003
1 Replies
Perhaps a tiny menu interpreter? That would seperate the data (menu layout) from the code. Each menu would seem to have text and a list of actions possible depending on the key. Two bytes for key and action type, then 2 bytes for either a code address or address of the next menu depending on the action type. Add code stubs, a little menu stack, toss into assembler, serve...
MENU1: db "Text to be displayed on LCD, yada yada", 0 ; My brain's in Intel mode right now db UPKEY, MENUCHANGE dw MENU0 db DOWNKEY, MENUCHANGE dw MENU10 db NOPKEY, MENU1 db SUBKEY1, CALLMENU dw MENU1-1 db SUBKEY2, CALLMENU dw MENU1-2 db 0 ; Menu terminator
It gets mildly trickier if the text is generated by code rather than constants, but I'm not going to do _all_ your work. :^P
Ron Sharp.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required