making menus, menuing, menu systems for LCD

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

here is some info for those writing a menuing system for an LCD...not sure if this is of much help, but has worked well in my past

About 15 years ago I wrote a menu "language" in assembler that worked quite well for menus. It essentially let you "draw" state machines using nothing more than ASCII. It was very quick to change & add options, actions, sublevels, etc to your hearts content. the "secret" was a parser that would continually parse tables encoded in the "menu language". I opted to restrict my menus to uppercase & thus was able to use lowercase to control the program (menu) flow. Some things I remember:

nxx is next state (xx) to go to (if no key pressed)
,mxx means go to state xx if key m pressed.....different keys can go to different next states IF M IS NOT USED, A SCROLL KNOB STEPS THROUGH THE OPTIONS RATHER THAN THE DIFFERENT KEYS & PRESSING ANY KEY GOES TO NEXT STATE XX
c means clear LCD display
wxx means wait/delay xx*10 ms (for display slowdown)
rxx means recall option value (such as selection of 1 of several settings
300/1200/2400= baud) the register value is updated when the display state is left, unless the k option is used
k means keep old option (rxx is not updated [used in "cancel" selections])
= means end of option list
/ means option separator
f means force message to be displayed (overrides message buffer)
stxx means dfinition of display state xx
NOTE other states called action states (which are code routines) can be called using the same syntax
NOTE THAT ANY rxx ,xx nxx STATE OR REGISTER "xx" is defined as a default for a whole state unless overridden by a specific instance within a state

So some examples might be

st00:cn01WELCOME TO THE FUTURE
st01:cn01,05SET THE=BAUD,02/VOLUME,03/VOLTAGE/CURRENT/POWER= VALUE
st02:cn02,07r01BAUD RATE=100/200/600/1200/kREDO,01= BAUD"
st03cn03,03SET =LEFT,04/RIGHT,05 =VOLUME

state 1 lets you select setting baud volume voltage, etc. selecting baud goes to state2 volume to 3 & the others to the default ,05

the baud setting is stored in r01 (0.1...2...3..etc) & is used to display the proper selection (300 600 etc). scrolling & leaving the state (they all go to state 07) stores the update into r02 for use elswhere inthe program. Note that the redo selection uses the k (no update) option & also goes to a different state (back to state 01)

By not using the clear "c" command various states will concatenate messages together such as:

"st55:r11n56 EAT A =BURGER/SHOE/ONION/LEMON= WHEN YOU"
"st56:r12n77 HAVE A =LIFE/CHANCE/HAIR CUTn40/PHONECALL= DUDE

These two form a concatenated pure display message based on r11 & r12 & have no reaction to any keys. Note all messages go to state 77, except the haircut goes to state 40. These states can be software action states (ex state 40 turns on a haircutting motor)

The displayed states are also buffered, so that several pure message states can be queued. The w option slows things down to give the user time to read. Here is an example of an alternating message waiting for a key press

"st00:n01cw11,521PRESS THE START OR
"st01:n00cw11,433ABORT KEY NOW !!"

The message will flash back and forth, until key 4 or 5 is pushed. Key 4 goes to state 33 & key 5 to 21

that's all!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's innovative and interesting, however I think some people might want to see the parser code so they can make their own parser. :wink:

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am also a bit confused. Are You planning to share also some code with us or do You want us to do the code after Your design idea? I think the idea is quite neat ...

Frank :lol:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

good idea,

BUT I'm not 100% sure how it should work!

You writes your script lines, they are translated with a kind of compiler to tables and the chip then encodes this tables and does the actions?

regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wulfinator83 wrote:
Hi,

good idea,

BUT I'm not 100% sure how it should work!

You writes your script lines, they are translated with a kind of compiler to tables and the chip then encodes this tables and does the actions?

regards

They are written as strings in the code. The compiler encodes them hte same as any other string. You have to write code to parse the string, and convert the various special symbos into commands. This is similar to how printf works, thouhg on a much simpler level.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would suggest also taking a look at the Atmel Butterfly's menu system for it's demo program,
it seems to do what your system does and it is easy to modify to do other things. There is also
a LCD menu system in John Peatman's EE textbook on the 18F452 PIC.