Single Button Menus and 4 Line LCDs


Closed Thread
Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2010
    Posts
    6

    Default Single Button Menus and 4 Line LCDs

    Hi all

    Been helped a lot here over the years so time to hopefully do a bit.

    A Menu on one display and only one button to select.

    I build Audio Tube Amps. The latest effort has over a grand of 300B tubes so wanted to make sure all

    stays OK and allows turn off before any damage. A 16F886 at 20mHZ does that job well. The PIC first

    runs a setup sequence of filament heating followed by switching B+ after tests. The 4x20 LCD display

    then monitors vitals in a loop. And warns/shuts down if not within set limits. You can set these to

    suit and save. Or reset the safe defaults for display pause, B+ voltage and current, two internal

    temperatures and whatever else you want to monitor.

    Yes it's simple and not elegant. But as usual the most important thing is it does the job.

    The complete code is only 500 lines and well within the words limit for any expansion.
    Code:
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    SETUP: 'DISPLAY MENU CHOICES
    ' FOR SIMPLE CASES ALL THAT IS REQUIRED
    GOSUB CLEARALL  ' ALL 4X20 LINES
    PAUSE 1000 ' IMP. TO SETTLE BUTTON AFTER PRESS TO HERE FROM MAIN DISPLAY LOOP
    LCDOut $FE, $80+2, "++ Setup Menu ++"
    LCDOut $FE, $C0, "1:Defaults 2:Spare"
    LCDOut $FE, $94, "3:Max Values 4:Exit"
    X=0
    do Until MENU_BTN = 0 'PRESSED. HIGH IN H'WARE
        X=X+1
        LCDOut $FE, $D4, REP " "\20  'CLEAR LINE4 or USE A GOSUB CLEAR4
        LCDOut $FE, $D4+1, "Button to select:",DEC X
        PAUSE 2000
        IF X=4 THEN  X=0
    LOOP
    '
    GOSUB BEEP 'SO USER KNOWS BUTTON ACCEPTED
    '
    SELECT CASE X
        CASE 1
            PAUSE 2000   'TO SETTLE PRIOR NEXT
            GOTO DEFAULTS
        CASE 2
            PAUSE 2000
            GOSUB CLEARALL
            gosub BEEP
            LCDOut $FE, $C0+1, "Spare. Future Adds"
            PAUSE 3000
            GOTO MAIN       
        CASE 3
            PAUSE 2000 
            GOTO SETVALUES
        CASE 4
            PAUSE 2000  
            GOSUB CLEAR4
            gosub BEEP
            LCDOut $FE, $C0+2, "No changes made"
            PAUSE 3000
            GOTO MAIN
        CASE ELSE
            GOTO MAIN
    END SELECT
    '
    '+++++++++++++++++++++++++++++++++++++++++++++++++++
    Last edited by Archangel; - 14th February 2015 at 11:05. Reason: code tags

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 19:33
  2. LCDs
    By Demon in forum Adverts
    Replies: 1
    Last Post: - 21st April 2012, 03:14
  3. Replies: 3
    Last Post: - 17th April 2007, 15:45
  4. Graphic LCDs
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th April 2004, 11:04
  5. 2 Line Chars on a 2 Line LCD
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th November 2003, 01:44

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