EmbeddedRelated.com
Forums

Generating menu for MSP430 and LCD

Started by TA_Schlebusch November 4, 2005
Hi,
which way is best for generating a menu to control my msp430-application?

I've thought about using a statemachine. Each state would be one case
in a switch-case-statement in C++.

Is that a good way or do you prefer a better one for a LCD-Userinterface?


My hardware consists of a rotary pulse encoder, the lcd display and a
selfmade msp430 board. For the software I use Code Composer Essentials
from TI.


Thanks for your help (I didn't find anything useful on google)

Regards,
Thomas.







Beginning Microcontrollers with the MSP430

What is the application, how many levels deep is the menu, is the rotary 
encoder your only input device, what type of data entry might be needed?

These are just a few of the parameters that I use to determine the best 
menuing method for my applications. For any degree of complexity at all, 
ie anything but a flat single level of menu I can't think of a worse 
method than a switch statement.

Al

TA_Schlebusch wrote:

>Hi,
>which way is best for generating a menu to control my msp430-application?
>
>I've thought about using a statemachine. Each state would be one case
>in a switch-case-statement in C++.
>
>Is that a good way or do you prefer a better one for a LCD-Userinterface?
>
>
>My hardware consists of a rotary pulse encoder, the lcd display and a
>selfmade msp430 board. For the software I use Code Composer Essentials
>from TI.
>
>
>Thanks for your help (I didn't find anything useful on google)
>
>Regards,
>Thomas.
>
>
>
>
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>


I implemented a switch statement menu for 3 levels deep pretty easily 
as part of my main line. It lets me process global characters, does a 
tree structure, a lot of common data is shared anyway, and best of 
all, my stack is tiny (which was the main reason). Not to mention 
implementing a command line interface is another couple of lines... 
The drawback is the decoding function that takes the tree array and 
gives me back a predefined constant. Of course, I process interrupts 
for everything and I have only one small loop I use for timing, but 
it's driven by the sleep modes and the watchdog timer.

You're right however, this is one of those things where the 
application will dictate the method. Schlebusch: if you use buttons 
hooked up to interrupts to trigger menu items on the LCD, you will 
want to do consider separate functions for displaying menu items and 
having a mainline that can go into the appropriate functions instead. 
That way you can return from the interrupt.

--- In msp430@msp4..., Onestone <onestone@b...> wrote:
>
> What is the application, how many levels deep is the menu, is the 
rotary 
> encoder your only input device, what type of data
entry might be 
needed?
> 
> These are just a few of the parameters that I use to determine the 
best 
> menuing method for my applications. For any degree
of complexity at 
all, 
> ie anything but a flat single level of menu I
can't think of a 
worse 
> method than a switch statement.
> 
> Al
> 
> TA_Schlebusch wrote:
> 
> >Hi,
> >which way is best for generating a menu to control my msp430-
application?
> >
> >I've thought about using a statemachine. Each state would be one 
case
> >in a switch-case-statement in C++.
> >
> >Is that a good way or do you prefer a better one for a LCD-
Userinterface?
> >
> >
> >My hardware consists of a rotary pulse encoder, the lcd display 
and a
> >selfmade msp430 board. For the software I use
Code Composer 
Essentials
> >from TI.
> >
> >
> >Thanks for your help (I didn't find anything useful on google)
> >
> >Regards,
> >Thomas.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >.
> >
> > 
> >Yahoo! Groups Links
> >
> >
> >
> > 
> >
> >
> >
> >
> >  
> >
>






Hi,
 
the renesas tiny familie has some nice example code that use menus through the
RS232 interface.
eu.renesas.com and than try H8 serie.
 
enjoy martijn

newworld64 <newworld64@neww...> wrote:
I implemented a switch statement menu for 3 levels deep pretty easily 
as part of my main line. It lets me process global characters, does a 
tree structure, a lot of common data is shared anyway, and best of 
all, my stack is tiny (which was the main reason). Not to mention 
implementing a command line interface is another couple of lines... 
The drawback is the decoding function that takes the tree array and 
gives me back a predefined constant. Of course, I process interrupts 
for everything and I have only one small loop I use for timing, but 
it's driven by the sleep modes and the watchdog timer.

You're right however, this is one of those things where the 
application will dictate the method. Schlebusch: if you use buttons 
hooked up to interrupts to trigger menu items on the LCD, you will 
want to do consider separate functions for displaying menu items and 
having a mainline that can go into the appropriate functions instead. 
That way you can return from the interrupt.

--- In msp430@msp4..., Onestone <onestone@b...> wrote:
>
> What is the application, how many levels deep is the menu, is the 
rotary 
> encoder your only input device, what type of data
entry might be 
needed?
> 
> These are just a few of the parameters that I use to determine the 
best 
> menuing method for my applications. For any degree
of complexity at 
all, 
> ie anything but a flat single level of menu I
can't think of a 
worse 
> method than a switch statement.
> 
> Al
> 
> TA_Schlebusch wrote:
> 
> >Hi,
> >which way is best for generating a menu to control my msp430-
application?
> >
> >I've thought about using a statemachine. Each state would be one 
case
> >in a switch-case-statement in C++.
> >
> >Is that a good way or do you prefer a better one for a LCD-
Userinterface?
> >
> >
> >My hardware consists of a rotary pulse encoder, the lcd display 
and a
> >selfmade msp430 board. For the software I use
Code Composer 
Essentials
> >from TI.
> >
> >
> >Thanks for your help (I didn't find anything useful on google)
> >
> >Regards,
> >Thomas.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >.
> >
> > 
> >. 


---------------------------------



		
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo!
Security Centre.




Hi Onestone,

I need a very dynamic menu, so that I can easily add menu levels and
entries.

1)Welcome-Message
2)Acceleration-Setup
2.1)set shock power
2.1.1) Rotate CW->lower, rotate CCW->higher, push button->save
2.2)set frequency
2.2.1) Rotate CW->lower, rotate CCW->higher, push button->save
3)Impedance-Setup
3.1)Rotate CW->lower, rotate CCW->higher, push button->save
4)Simulation-Mode
4.1)Enable Manual Mode, push button->enable
4.2)Load Preset: Patient 1, push button->enable
4.2)Load Preset: Patient 2, push button->enable
4.2)Load Preset: Patient 3, push button->enable
4.2)Load Preset: Patient 4, push button->enable


This menu structure is my first version, when everything is running,
my project will get much more options and functionalities.


Do you have a code example for a menu realisation idea?

My very only idea is the state machine, because it is able to
implement a tree structure. I've also thought about an array-based
menu, but then I would need more input devices than the rotary knob
with its bush button in it (CW, CCW, push).



Thanks for your help in advance,

Thomas Schlebusch


--- In msp430@msp4..., Onestone <onestone@b...> wrote:
>
> What is the application, how many levels deep is the menu, is the
rotary 
> encoder your only input device, what type of data
entry might be needed?

[...]

> TA_Schlebusch wrote:
[...]
> >I've thought about using a statemachine.
Each state would be one case
> >in a switch-case-statement in C++.
> >
> >Is that a good way or do you prefer a better one for a
LCD-Userinterface?
[...]




 

Try http://www.segger.com/emwin_sample.html#widgetdropdown

Colin,
 
-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf
Of TA_Schlebusch
Sent: 18 November 2005 13:32
To: msp430@msp4...
Subject: [msp430] Re: Generating menu for MSP430 and LCD

Hi Onestone,

I need a very dynamic menu, so that I can easily add menu levels and
entries.

1)Welcome-Message
2)Acceleration-Setup
2.1)set shock power
2.1.1) Rotate CW->lower, rotate CCW->higher, push button->save 2.2)set
frequency
2.2.1) Rotate CW->lower, rotate CCW->higher, push button->save
3)Impedance-Setup 3.1)Rotate CW->lower, rotate CCW->higher, push
button->save 4)Simulation-Mode 4.1)Enable Manual Mode, push
button->enable 4.2)Load Preset: Patient 1, push button->enable 4.2)Load
Preset: Patient 2, push button->enable 4.2)Load Preset: Patient 3, push
button->enable 4.2)Load Preset: Patient 4, push button->enable


This menu structure is my first version, when everything is running, my
project will get much more options and functionalities.


Do you have a code example for a menu realisation idea?

My very only idea is the state machine, because it is able to implement
a tree structure. I've also thought about an array-based menu, but then
I would need more input devices than the rotary knob with its bush
button in it (CW, CCW, push).



Thanks for your help in advance,

Thomas Schlebusch


--- In msp430@msp4..., Onestone <onestone@b...> wrote:
>
> What is the application, how many levels deep is the menu, is the
rotary 
> encoder your only input device, what type of data
entry might be
needed?

[...]

> TA_Schlebusch wrote:
[...]
> >I've thought about using a statemachine.
Each state would be one case

> >in a switch-case-statement in C++.
> >
> >Is that a good way or do you prefer a better one for a
LCD-Userinterface?
[...]





------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home
page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/CFFolB/TM
--------------------------------~-> 

.

 
Yahoo! Groups Links



 



Hi,

i would use flags for the menus and sub-menus
and would continue looping inside the mainloop.

I have seen much bad code without flags, which loops inside
single menu functions with infinite loops (and break) and which
needs all CPU time. 
That should only be used for bad examples because that kills
all other not completely interrupt driven things like RS232
communication.

Regards,

Rolf


msp430@msp4... schrieb am 18.11.05 14:33:39:
> 
> Hi Onestone,
> 
> I need a very dynamic menu, so that I can easily add menu levels and
> entries.
> 
> 1)Welcome-Message
> 2)Acceleration-Setup
> 2.1)set shock power
> 2.1.1) Rotate CW->lower, rotate CCW->higher, push button->save
> 2.2)set frequency
> 2.2.1) Rotate CW->lower, rotate CCW->higher, push button->save
> 3)Impedance-Setup
> 3.1)Rotate CW->lower, rotate CCW->higher, push button->save
> 4)Simulation-Mode
> 4.1)Enable Manual Mode, push button->enable
> 4.2)Load Preset: Patient 1, push button->enable
> 4.2)Load Preset: Patient 2, push button->enable
> 4.2)Load Preset: Patient 3, push button->enable
> 4.2)Load Preset: Patient 4, push button->enable
> 
> 
> This menu structure is my first version, when everything is running,
> my project will get much more options and functionalities.
> 
> 
> Do you have a code example for a menu realisation idea?
> 
> My very only idea is the state machine, because it is able to
> implement a tree structure. I've also thought about an array-based
> menu, but then I would need more input devices than the rotary knob
> with its bush button in it (CW, CCW, push).
> 
> 
> 
> Thanks for your help in advance,
> 
> Thomas Schlebusch
> 
> 
> --- In msp430@msp4..., Onestone <onestone@b...> wrote:
> >
> > What is the application, how many levels deep is the menu, is the
> rotary 
> > encoder your only input device, what type of data entry might be
needed?
> 
> [...]
> 
> > TA_Schlebusch wrote:
> [...]
> > >I've thought about using a statemachine. Each state would be
one case
> > >in a switch-case-statement in C++.
> > >
> > >Is that a good way or do you prefer a better one for a
> LCD-Userinterface?
> [...]
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 



TA_Schlebusch wrote:

>Hi Onestone,
>
>I need a very dynamic menu, so that I can easily add menu levels and
>entries.
>
>1)Welcome-Message
>2)Acceleration-Setup
>2.1)set shock power
>2.1.1) Rotate CW->lower, rotate CCW->higher, push button->save
>2.2)set frequency
>2.2.1) Rotate CW->lower, rotate CCW->higher, push button->save
>3)Impedance-Setup
>3.1)Rotate CW->lower, rotate CCW->higher, push button->save
>  
>
This is counter intuitive. In nearly every system I can think of CW
increase CCW = decrease. In addition your interface has no 'reset' 
feature, you cannot move from one setting operation after making a 
change in value without saving the changed data. If you wanted to 
restore the original you would have to remember the value on entry. This 
may seem simple to you, but to future users it will not be. The least I 
would do is time the button press, short = action 1 long = action 2.

You say that you plan to increase the complexity of this menu. It is 
already at the point of possible tedium to users. here is what I would 
do with this structure, if it is to be grown in the future:-

Display welcome message
if time expires power down else if button pressed enter operational mode

Display main list 1
                   ACCELERATION SETUP
                   SIMULATION MODE
                   FUTURE OPTIONS FIT HERE
On CW increment displayed option, else on CCW decrement displayed option
On slow press select option, on fast press return to prior level

Display sub list opt-1 (assuming option was 1-acceleration)
                   SET SHOCK POWER
                   SET FREQUENCY
                   SET IMPEDANCE
                   FUTURE OPTIONS HERE
On CW increment displayed option, else on CCW decrement displayed option
On slow press select option, on fast press return to prior level

Display sub list set-2      (assume frequency (setting -2) was selected
                   DISPLAY CURRENT FREQUENCY
On slow CW increment value by 1
On  medium CW increment value by 10
On fast CW increment value by 100
On slow CCW decrement value by 1
On medium CCW decrement value by 10
On fast CCW decrement value by 100
On fast button revert to prior menu, do not save changes
On slow button save changes and revert to prior menu level


As for off the shelf menu code, I don't have anything pre-packaged

Cheers

Al


>4)Simulation-Mode
>4.1)Enable Manual Mode, push button->enable
>4.2)Load Preset: Patient 1, push button->enable
>4.2)Load Preset: Patient 2, push button->enable
>4.2)Load Preset: Patient 3, push button->enable
>4.2)Load Preset: Patient 4, push button->enable
>
>
>This menu structure is my first version, when everything is running,
>my project will get much more options and functionalities.
>
>
>Do you have a code example for a menu realisation idea?
>
>My very only idea is the state machine, because it is able to
>implement a tree structure. I've also thought about an array-based
>menu, but then I would need more input devices than the rotary knob
>with its bush button in it (CW, CCW, push).
>
>
>
>Thanks for your help in advance,
>
>Thomas Schlebusch
>
>
>--- In msp430@msp4..., Onestone <onestone@b...> wrote:
>  
>
>>What is the application, how many levels deep is the menu, is the
>>    
>>
>rotary 
>  
>
>>encoder your only input device, what type of data entry might be needed?
>>    
>>
>
>[...]
>
>  
>
>>TA_Schlebusch wrote:
>>    
>>
>[...]
>  
>
>>>I've thought about using a statemachine. Each state would be
one case
>>>in a switch-case-statement in C++.
>>>
>>>Is that a good way or do you prefer a better one for a
>>>      
>>>
>LCD-Userinterface?
>[...]
>
>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>