Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Standard Way of Making Menu in C

Status
Not open for further replies.

tahir4awan

Full Member level 4
Full Member level 4
Joined
Nov 29, 2010
Messages
213
Helped
16
Reputation
32
Reaction score
17
Trophy points
1,308
Location
Germany
Activity points
3,116
As we know that C is structured language.So what is the standard way of making menu in C like in mobile phones.
 

Unfortunately, there are no standard menus in C. A better question to ask is has someone built a portable menu library that has drivers for a variety of LCDs on many different processors?

I've created menu code that is fairly portable. I can't post it due to my employer's copyright but can give you the gist of what you need:

  1. Ideally you'll need some sort of interface to the LCD that supports different fonts and methods of managing different screen windows. Hopefully, you have something like this already. If not, this will be your first task.
  2. The easiest menu solution is simply to display an array of strings. The hard part will be in writing the code to traverse the menu and select items and then to execute specific commands or display sub-menus.
  3. The menu management gets a bit more complicated if you need to have multiple nested menus because you need to display other menus over top of the existing -- hence the requirement for a simple windowing system (text-based is fine).
  4. You'll probably also need some way of navigating through the menus which implies some sort of push button or navigation input device which you'll also need to write a driver for.
  5. Finally, you may want to consider a real-time tasking OS to manage the different tasks that are displaying menus, reading user inputs, and performing the menu functions. Without an RTOS, these tasks can quickly become very complex.
I would also recommend that, if this is for an embedded application, you avoid any code that uses C's memory management (i.e., malloc and friends). You will be guaranteed a run-time crash every time if you don't manage all your memory properly. I suggest, instead, that all structures be created statically and linked together statically. This is what I used and never had any problems.

I hope you realize now that, although they may appear simple, menus can quickly become very complicated.
 
Last edited:
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top