Page 1 of 1
LCD select menu function
Posted: Fri Jun 03, 2011 4:54 pm
by nmindana
Hi Team,
I am working on an embedded project, where the user highlights and selects options displayed on the LCD, wih the help of a rotory switch. I see that there is no read function on the LCD macro in V4. Can I have some ideas please!.
Can't see any previous links to the topic in the forum, will V5 have this function ?.
Thanks in advance.
Regards
Indana
Re: LCD select menu function
Posted: Fri Jun 03, 2011 8:54 pm
by Spanish_dude
No read function has been made because reading back the data
you sent to the LCD is useless

.
Read the position of the rotary switch and do what you need to do when an option is selected

.
Re: LCD select menu function
Posted: Fri Jun 03, 2011 9:16 pm
by nmindana
Honestly it never occurred to me, good idea, but how do you select the menu options ?.
Sorry if I am being daft
regards
Indana
Re: LCD select menu function
Posted: Sat Jun 04, 2011 2:57 am
by Spanish_dude
If you have a menu like this :
> menu 1
option
(The '>' points the selected option in the menu)
I would use 2 pushbuttons to move the cursor ('>') up and down.
Another pushbutton will work as the "enter button".
A rotary switch is just a switch with one (or more) input(s) and X output(s). This will require X I/O from the microcontroller.
And if the number of the outputs of the rotary switch is high, you'll need a lot of I/O and thus a "big" microcontroller.
Re: LCD select menu function
Posted: Sat Jun 04, 2011 9:29 am
by medelec35
Spanish_dude wrote:
A rotary switch is just a switch with one (or more) input(s) and X output(s). This will require X I/O from the microcontroller.
And if the number of the outputs of the rotary switch is high, you'll need a lot of I/O and thus a "big" microcontroller.
Although that is true, I had a rotary switch with different values of resistors connected to each terminal of the switch.
So when you turned the switch it was acting like a variable resistor, with set resistances.
I used just one pin of microcontroller, with a pull up value of 470K.
Switch was connected between one of microcontroller ADC i/p's and GND
As you rotate switch the resistance will change, hence changing the voltage at the ADC pin.
You can then use decision branches starting off with higher value and working its way down.
E.g If ADC>230 then display menu1
If ADC>200 then display menu2
If ADC>170 then display menu3
If ADC>140 then display menu4
etc.
But you need to place each decision as in picture below

- Right way
- Menu Select.jpg (231.8 KiB) Viewed 8361 times
Not like this:

- Wrong way
- Menu Select2.jpg (121.51 KiB) Viewed 8361 times
Re: LCD select menu function
Posted: Sat Jun 04, 2011 1:12 pm
by nmindana
Brilliant
Thanks again Martin.
How do I highlight each menu option, with the help of a rotary switch?
I don't like the ">" symbol. Is there any other way, so that the whole menu option is highlighted
regards
Indana
Re: LCD select menu function
Posted: Sat Jun 04, 2011 1:20 pm
by medelec35
What about if all the lines of menu are in lower case, then as you turn the switch one the selected menu line, changes from lower to upper case?
Or the selected menu line, right shifts by a place or 2?
Or the selected menu line can flash, whist rest of the menu lines are solid?
The idea Spanish_dude had of > is a very good one. Or use a # next to the selected menu line.
Martin
Re: LCD select menu function
Posted: Sat Jun 04, 2011 2:52 pm
by nmindana
Posted a useful menu function as advised by Martin.
Helpful for others.
regards
Indana
Re: LCD select menu function
Posted: Sat Jun 04, 2011 3:14 pm
by medelec35
That's Very good Indana!
I'm sure that routine will come in handy
Thanks for sharing.
I have just added some delays.
See what what you think?
Re: LCD select menu function
Posted: Sat Jun 04, 2011 6:14 pm
by nmindana
Works much better.
Thanks
