LCD menu


Closed Thread
Results 1 to 5 of 5

Thread: LCD menu

  1. #1
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187

    Default LCD menu

    I have 3 buttons and a 2x16 LCD and want to have an LCD menu and navigate with the 3 buttons.
    I want to use 2 of the buttons for UPP/DOWN in the menu and the last one for Enter.

    How do I do that in a smart way.

    I could use a lot of IF THEN ELSE with some GOTOīs but i donīt feel that its the right way to do it.

    So help me, how should I build the code.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Cool

    Quote Originally Posted by Fredrick View Post

    So help me, how should I build the code.
    You could use Select case, you might even get 7 or 8 states out of those 3 switches.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    Whatever you do If-Then will be there....

    I don't like it either but don't see doing it other way.

    Ioannis


    P.S. I do it once with only 2 buttons as i lack the 3rd one. Very awkard...

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Yes, there is always another way...

    One of my products (on an 18F2420) has a 5 level Menu structure, that is 170 items deep! With 3 Button Control and an LCD. It is on a product which sells 1000/month and which competitors can't figure how it's done! So I won't give you the code, because it'll hand them the secret (and I know they read this forum)... but I will generalise...

    The Menu consists of a 8 Byte Table per line... the Table is held in program codespace (see elsewhere on this forum how to do that).

    Byte 1 tell the Menu Subroutine what kind of Data Element we are dealing with... ie, Numeric, Numeric with Fixed Decimals, Alphanumeric, Date, Time etc.

    Byte 2 is the Data Element Byte Length.

    Byte 3 is the Minimum permitted value for any Numeric entry.

    Byte 4 is the Maximum permitted value for any Numeric entry.

    Byte 5 are Flags... these are Bits that Control frills, eg Cursor ON/OFF, Visible or Invisible Entry (like that required for Passwords) , whether Data-Entry is permitted or not, etc etc

    Byte 6 points to the location in EEPROM where the first Byte of Data is to be found.

    Byte 7 points to the Message in Program Codespace which will appear on your LCD prompting your Data-Entry (eg "Enter Time Delay").

    Byte 8 points to a secondarry Message in Program Codespace for additional information (eg "Minutes").

    The Menu Subroutine, sequentially reads the eight control bytes and acts on it accordingly. Once you have built your subroutine, it's a simple matter of adding just eight bytes (plus prompting messages) per Menu item. It's small, it's compact, and everything you need to learn how to do it is on this forum somewhere (though not in a ready cut & paste form). Clue: It does rely very heavilly on reading large Tables of Data from Program Codespace and manipulating Alphanumeric STRINGS (for all the LCD Messages) with PBP. Sort out how to do that first, and the rest is simple!

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    Nice one Mel. I suppose that this part is one ofthe memory hungry ones.

    Ioannis

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  3. Sending menu to PC from PIC16F876A
    By joseph Degorio in forum Serial
    Replies: 2
    Last Post: - 12th November 2007, 07:03
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts