PDA

View Full Version : Single Button Menus and 4 Line LCDs



davesatu
- 27th August 2014, 05:08
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.



'+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++
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
'
'+++++++++++++++++++++++++++++++++++++++++++++++++ ++