lcdmenu1 is a simple and small lcd menu builder for AVR Atmega.
It works with only 4 buttons (up, down, right, left), additional buttons can be added.
It can also store values to eeprom
User can use button up and down to list menu categories, right and left to browse child and parent.
If an item is selected, the right button makes the menu enter in edit-mode.
In this mode button up and down changes the item value, left exit without save to eeprom, right exit and save to eeprom.
The menu costructor is based upon Dean Camera micro-menu. It works on 2x16 lcd using the Peter Fleury lcd library for HD44780, but it can also be change to fit other lcd resolution.
It is test on 2x16 HD44780 device, sample code is provided.
The main function is the builder function:
lcdmenu1_makemenu(name, next, prev, parent, sibling, selectfunc, enterfunc, exitfunc, text);
name is the name of the menuitem
next is the pointer to next menuitem
prev is the pointer to the prev menuitem
parent is the parent of the menuitem
sibling is the child of the menuitem
enterfunc is the function to be called when user enter this menuitem
exitfunc is the function to be called when user exit this menuitem
text is the text view on lcd for the menuitem
The sample code provided build menu item, menu folder, menu subfoder.
This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 8MHz.
Code
- avr_lib_lcdmenu1_02.zip: add helper functions on select button pressed
avr_lib_lcdmenu1_01.zip
Notes
- read risk disclaimer
- excuse my bad english
Hello Gironi, does this code work for Atmega32 as well or I need to port the code along with the port pins I am using in my project?
ReplyDeleteyou have to change some pin but it should compile and works.
DeleteHi Davide
ReplyDeleteThanks for your help. But when I compile the code. There is one error: variable 'micromenu_nullitem' must be const in order to be put into read-only section by means of '__attribute__((progmem))'.
how I can fix this error?
Thank you very much
Hello, i've just recompile this as a new project and i can not encounter this error. Are you using avrgcc? I tell you this because IAR and other commercial compilers have the __flash keyword, this means you can have const variables in ram.
DeleteI am running into the same error as ZHOU JACK, I am using the avrgcc compiler. Any Ideas?
DeleteAre you using avrgcc?
Deleteyes in AtmelStudio7
DeleteTry with Eclipse with the AVR plugin and win-avr (if you are on windows).
DeleteWorks now! thank you Davide
DeleteYou're welcome. Happy to help you ;)
DeleteHi Davide, Can you please port into atmel studio or microchip studio, i am also facing similar error..!
Deletereally very helpful thankyou
ReplyDeleteThank you for your feedback!
DeleteGood day Great program works well just want to know were and how I can enter my own code and then select your menu ,edit it and then go back to my application to display temperature or adc value etc.
ReplyDeleteThanks Werner
Hello, thank you for your feedback. You can take a look at the /* built menu */ region of the main.c sample. Also, the main.c sample could be a good starting point for your menu.
DeleteHi Davide, Can you please port into atmel studio or microchip studio, i am also facing similar error..!
ReplyDeleteHello, I'm sorry but I've no time for porting. You can do it by yourself, that's will not be so difficult.
Delete