Making a menu


Closed Thread
Results 1 to 37 of 37

Thread: Making a menu

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Exclamation New error code!

    Well i didn't post it for a reason you see. I wanted to try and solve the problem myself. It's all well and good me using the forums for help but if i dont try and dont some on my own im never going to progress!
    This was one thing i was majorly criticised over by a previous line manager, not knowing when to ask for help and trying to do it all myself so now im trying to find a happy medium.

    Anyway now back to the project!
    I got the code working by going through line by line and rebuilding it in the main project thats all good but.... i now have a new error off MPLAB when i try and compile the coding:

    "Operand contains unresolvable labels or is too complex"

    Any idea on what this means guys?

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by chrisshortys View Post
    Well i didn't post it for a reason you see. I wanted to try and solve the problem myself. It's all well and good me using the forums for help but if i dont try and dont some on my own im never going to progress!
    Somebody should 'sticky' that statement and make it required reading for newbies...
    This was one thing i was majorly criticised over by a previous line manager, not knowing when to ask for help and trying to do it all myself so now im trying to find a happy medium.
    Anyway now back to the project!
    I got the code working by going through line by line and rebuilding it in the main project thats all good but.... i now have a new error off MPLAB when i try and compile the coding:
    "Operand contains unresolvable labels or is too complex"
    Any idea on what this means guys?
    Is that the FULL error or are there extra numbers that go with it? If there are numbers, they may point to either a line in the original source code, or, if using MPASM, the assembly listing as to where the error has occured. I think in this case, it might be simply a misplaced space or extra ' or " somewhere in there, a punctuation thing.
    Otherwise, post the code

  3. #3
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    Its the error code from the compillier from asm to hex in mplabs. This is the full error code

    Code:
     Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F688 "OLYMPICS.ASM" /l"OLYMPICS.lst" /e"OLYMPICS.err" /o"OLYMPICS.o"
    Warning[215] C:\PBP\16F876A.INC 20 : Processor superseded by command line.  Verify processor symbol.
    Message[301] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F876A.INC 36 : MESSAGE: (Processor-header file mismatch.  Verify selected processor.)
    Error[151]   C:\PBP\PBPPIC14.LIB 7421 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 571 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 587 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 604 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 607 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 613 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 571 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 587 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 604 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 607 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 613 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 637 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 643 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 659 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 676 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 679 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 685 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 571 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 587 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 604 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 607 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 613 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 637 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 643 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 659 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 676 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 679 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 685 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 517 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 522 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 529 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 571 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 587 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 604 : Operand contains unresolvable labels or is too complex
    Error[151]   C:\PBP\OLYMPICS.ASM 607 : Operand contains unresolvable labels or is too complex
    
    BUILD FAILED: Mon Oct 20 18:03:13 2008
    So from what you said its proberly just a coding error somwhere, I shall go and have a look in the coding again!
    Was just making sure that the error didn't mean i had used up all of the memory on the chip, its getting a bit long now at 468 lines! Ive never had such a large projet so i dont know what happens when you fill the chip up to the brim!

    Breaking the forum too now! got The text that you have entered is too long (174172 characters). Please shorten it to 10000 characters long.
    come up when i tried to post so had to chop the code but you get the idea!

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Looks to me like you've got one PIC selected for compiling/assembling, but have the code written for another PIC.

    Code:
    Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F688 "OLYMPICS.ASM" /l"OLYMPICS.lst" /e"OLYMPICS.err" /o"OLYMPICS.o"
    Warning[215] C:\PBP\16F876A.INC 20 : Processor superseded by command line.  Verify processor symbol.
    Message[301] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F876A.INC 36 : MESSAGE: (Processor-header file mismatch.  Verify selected processor.)
    Was just making sure that the error didn't mean i had used up all of the memory on the chip, its getting a bit long now at 468 lines! Ive never had such a large projet so i dont know what happens when you fill the chip up to the brim!
    My latest project is up to 5,600 lines now. I'd guess another 4,000 or so to go. MCS and/or PBP and/or MPLAB will let you know when it gets too long.
    Last edited by skimask; - 20th October 2008 at 18:40.

  5. #5
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    ok now thats just weird!

    I hadnt changed anything for that to happen......

    I just went through the programe and commented out all the code i added and removed the comments one by one and it compilied fine........

    I must be being haunted or somthing :s

    But thanks alot for your time!

    It's good to know im not runnign out of space just yet! I had a look at those youtube vids of your latest project the other day and they realy are scary the amount of work and knowledge in them!
    Last edited by chrisshortys; - 20th October 2008 at 18:45.

  6. #6
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    Well i ran out of memory at around 700 lines
    Now the code i have at the moment isn't that far but im getting close!
    so i'm after any advice on the code i have on ways of doing the same thing without using as much memory!
    Would using tables on menus help reduce space as i still have ALOT of coding to do!
    I know the code is quite fragmented and not well ordered but I had planned to rewrite it its just me making a beta of it at the moment!

    cheers!

    Code:
    ' ' Olympic Timer
    ' =============
    ' Melanie Newman
    ' 05/Aug/2004
    ' Modified by Chris Hammersley
    ' For Spec-ops.nl
    ' Oct 2008
    ' Topical Program demonstrates use of Interrupt
    ' Driven Background TIMER, to time events down to
    ' one one-hundredth of a Second (1/100 Sec).
    '
    ' Bonus CALIBRATION Feature allows simple adjustments
    ' in 360mS steps per hour. This calibration adjustment
    ' range is limited to +/- 36 seconds per Hour.
    '
    ' This program is for 4MHz clock (1uS Timer Ticks).
    
    'Original programe includes a calibratable stop clock counting upwards. 
    
    'MODIFICATIONS
    '-------------
    'V1.1 23rd october 2008
    'Working menu selecting game length with 2 presets and a customisable
    'Count down clock.
    'Programe knows when time is up and goto new instructions.
    ' PIC Defines
    '
    '
    'V1.2 Ongoing
    'GAME TYPES MENU INCLUDED
    'INCLUDED THE CODING FOR BOTH COUNT-DOWN AND COUNT-UP CLOCKS
    '
    'V1.3 FUTURE
    'INCLUDE RF OPERATIONS
    '
    ' ===========
    '
    ' Change these defines to suit your chosen PIC
    '
    '@ DEVICE pic16F876a, WDT_ON ' Watchdog Timer
    '@ DEVICE pic16F876a, PWRT_ON ' Power-On Timer
    '@ DEVICE pic16F876a, BOD_ON ' Brown-Out Detect
    '@ DEVICE pic16F876a, LVP_OFF ' Low-Voltage Programming
    '@ DEVICE pic16F876a, CPD_OFF ' Data Memory Code Protect
    '@ DEVICE pic16F876a, PROTECT_OFF
    ' Program Code Protection
    '@ DEVICE pic16F876a, WRT_OFF ' Flash Memory Word Enable
    
    '
    ' Hardware Defines
    ' ================
    
    CMCON=%00000111
    CVRCON=%00000000 
    '
    ' LCD Display
    ' -----------
    ' Adjust these to suit your chosen LCD pinout
    '
    DEFINE LCD_DREG PORTB 			'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT 4 			'Define first pin of portb connected to LCD DB4
    DEFINE LCD_RSREG PORTB 			'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 3 			'Define Portb pin used for RS connection
    DEFINE LCD_EREG PORTB 			'Define PIC prot used for E line of LCD
    DEFINE LCD_EBIT 0 			'Define PortB pin used for E connection
    DEFINE LCD_BITS 4 			'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2 			'Define using a 2 line LCD
    DEFINE LCD_COMMANDUS 2000 		'Define delay between sending LCD commands
    DEFINE LCD_DATAUS 50 			'Define delay time between data sent.
    
    ' Control Buttons/Lines
    ' ---------------------
    ButStart var Portc.0 	' Take this pin low momentarily to START timing
    ButStop var Portc.1 	' Take this pin low momentarily to STOP timing
    ButReset var Portc.2 	' Take this pin low momentarily to RESET clock
    Butup var portc.3	' Take this pin low momentarily to increase clock time
    Butdwn var portc.4	' Take this pin low momentarily to decrease clock time
    '
    ' Hold the RESET Button pressed for at least FIVE seconds
    ' to jump into CALIBRATION Mode
    '
    ' Software Defines
    ' ----------------
    BannerOffset var BYTE ' Variable holding start address of Banner Display
    CounterA var BYTE ' Just a Counter
    CounterB var BYTE ' Just a Counter
    CounterC var BYTE
    DataA var BYTE
    Hours var BYTE
    Hundredths var BYTE
    Minutes var BYTE
    OverflowError var BIT
    RunningFlag var BIT
    Seconds var BYTE
    SetupTimeOut var WORD ' Timeout counter for Calibration/Set-Up Mode
    TMR1Cal var BYTE ' Calibration Value
    IHOURS VAR BYTE
    IMINUTES VAR BYTE
    TIMER VAR BYTE
    
    TMR1CalAR var Byte ' Calibration 0=ADVANCE, 1=RETARD
    TMR1RunOn var WORD ' variable holding TMR1 Run-On value
    '
    ' EEPROM Presets
    ' --------------
    Data @0,0 ' Advance/Retard Indicator
    Data 0 ' Calibration Value
    Data "Spec-ops.nl Tactical Game Aid - Enter Game Length"
    '
    ' Software Constants
    ' ------------------
    TMR1CalMax con 100 ' Maximum adjustment (+/-100uS per 10mS interrupt)
    TMR1Preset con $D910 ' 10mS Timer Reload value, offset by 20uS
    ' to allow for TMR1 Setting Calculations
    '
    ' Start Program
    ' =============
    '
    ' Initialise Processor
    ' --------------------
    TRISA=%00000000
    TRISB=%00000000
    TRISC=%00011111
    ADCON0=%11000000
    ADCON1=%00000111
    OPTION_REG.7=0 ' Enable Pull-Up's
    RunningFlag=0 ' Disable actual Interrupt Time-Keeping
    Pause 1000 ' Pause for LCD to initialise
    '
    ' Silly Intro Banner just for Fun
    ' -------------------------------
    LCDOut $FE,1 ' Clear LCD
    BannerOffset=2:Gosub DisplayBanner
    Pause 2000
    For CounterA=0 to 33
    BannerOffset=2+CounterA
    Gosub DisplayBanner
    Pause 350		'pause between change of characters
    Next CounterA
    Pause 4000
    '----------------
    'Menu and Presets
    '----------------
    '
    'MAIN MENU
    '---------
    MAINMENU:
    PAUSE 1000
    
    MAINMENUA:
    LCDOUT $FE, 1, "   SELECT MENU"
    LCDOut $FE,$C0,"COUNTDOWN"
    PAUSE 100
    IF BUTSTART=0 THEN
    GOTO MENUA
    ENDIF
    IF BUTUP=0 THEN
    GOTO MAINMENUB
    ENDIF
    GOTO MAINMENUA
    
    MAINMENUB:
    LCDOUT $FE, 1, "   SELECT MENU:"
    LCDOut $FE,$C0,"   COUNT UP"
    PAUSE 100
    IF BUTDWN=0 THEN
    GOTO MAINMENU
    ENDIF
    IF BUTSTART=0 THEN
    TIMER=1
    PAUSE 20
    IF BUTSTART=0 THEN
    GOTO BEGINNING
    ENDIF
    ENDIF
    PAUSE 50
    GOTO MAINMENUB

  7. #7
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    Second half of code

    Code:
    'COUNTDOWN MENU
    '--------------
    
    MenuA:
    PAUSE 1000
    TIMER=0
    
    MENUCD:
    LCDOUT $FE, 1, "    Preset 1"
    LCDOut $FE,$C0,"00:30:00.00"
    pause 100
    IF BUTSTART=0 THEN
    GOTO preset1
    ENDIF
    IF BUTDWN=0 THEN
    GOTO CUSTOMA
    ENDIF
    IF BUTUP=0 THEN
    GOTO PRESET2
    ENDIF
    IF BUTRESET=0 THEN
    GOTO MAINMENU
    ENDIF
    GOTO MENUCD
    
    CUSTOMA:
    PAUSE 1000
    CUSTOMB:
    LCDOUT $FE, 1, "CUSTOM TIME"
    LCDOut $FE,$C0,"ENTER A CUSTOM TIME"
    PAUSE 100
    IF BUTSTART=0 THEN
    GOTO CUSTOM
    ENDIF
    IF BUTDWN=0 THEN
    GOTO PRESET2
    ENDIF
    IF BUTUP=0 THEN
    GOTO MENUCD
    ENDIF
    IF BUTRESET=0 THEN
    GOTO MAINMENU
    ENDIF
    PAUSE 50
    GOTO CUSTOMB
    '----------------------------
    PRESET1:
    PAUSE 1000
    PRESET1A
    LCDOUT $FE, 1, "Accept Preset 1?"
    LCDOut $FE,$C0,"00:30:00.00"
    PAUSE 100
    
    IF BUTSTART=0 THEN
    GOTO PRESET1set
    ENDIF
    IF BUTRESET=0 THEN
    GOTO MENUCD
    ENDIF
    GOTO PRESET1A
    
    PRESET1SET:
    IHOURS=0
    IMINUTES=30
    PAUSE 50
    GOTO CONTINUE
    '---------------------------
    PRESET2:
    PAUSE 1000
    PRESET2A
    LCDOUT $FE, 1, "    Preset 2"
    LCDOut $FE,$C0,"00:45:00.00"
    PAUSE 100
    IF BUTSTART=0 THEN
    GOTO PRESET2A
    ENDIF
    IF BUTUP=0 THEN
    GOTO CUSTOMA
    ENDIF
    IF BUTDWN=0 THEN
    GOTO menuCD
    ENDIF
    IF BUTRESET=0 THEN
    GOTO MAINMENU
    ENDIF
    GOTO PRESET2A
    
    PRESET2B:
    PAUSE 1000
    PRESET2C
    LCDOUT $FE, 1, "Accept Preset 2?"
    LCDOut $FE,$C0,"00:45:00.00"
    PAUSE 100
    
    IF BUTSTART=0 THEN
    GOTO PRESET2SET
    ENDIF
    IF BUTRESET=0 THEN
    GOTO MENUCD
    ENDIF
    GOTO PRESET2C
    
    PRESET2SET:
    IHOURS=0
    IMINUTES=45
    PAUSE 50
    GOTO CONTINUE
    
    '
    ' Custom Time Setup
    '----------------------------
    CUSTOM:
    PAUSE 1000
    
    IHOURS=0
    IMINUTES=3
    
    HOURSI:
    If Butup=0 then 
    IHOURS=IHOURS+1
    endif
    If BUTDWN=0 THEN
    IHOURS=IHOURS-1
    ENDIF
    IF BUTSTART=0 THEN
    GOTO MINSA
    ENDIF
    IF BUTRESET=0 THEN
    GOTO MENUA
    ENDIF
    pause 50
    GOSUB TIMESETUP
    GOTO HOURSI
    
    MINSA:
    PAUSE 1000
    
    MINSI:
    IF BUTUP=0 THEN
    IMINUTES=IMINUTES+1
    ENDIF
    IF BUTDWN=0 THEN
    IMINUTES=IMINUTES-1
    ENDIF
    IF BUTRESET=0 THEN
    GOTO HOURSI
    ENDIF
    IF BUTSTART=0 THEN
    GOTO CONTINUE
    ENDIF
    PAUSE 50
    GOSUB TIMESETUP
    GOTO MINSI
    
    
    timesetup:
    pause 50
    LCDOUT $FE, 1, "GAME LENGTH"
    LCDOut $FE,$C0,DEC2 IHours,":",DEC2 IMinutes,":00.00"	
    PAUSE 50
    REturn
    
    
    Continue:
    
    LCDOUT $FE, 1, "Settings Saved"
    LCDOut $FE,$C0,DEC2 IHours,":",DEC2 IMinutes,":00.00"
    pause 6000
    
    
    BEGINNING
    '
    ' Initialise TMR1 Interrupts*******************************************************************************************
    ' --------------------------
    Gosub SetTimer ' Set the Timer for next 10mS Interrupt
    IF TIMER=1 THEN
    On Interrupt goto TickCountUP
    ELSE
    On Interrupt goto TickCount
    ENDIF
    PIE1.0=1 ' Enable TMR1 Interrupts
    INTCON.6=1 ' Enable all unmasked Interrupts
    INTCON.7=1 ' Enable Global Interrupts
    '
    ' -----------------------------------------------------
    ' Following the above "On Interrupt", no Basic Command
    ' is allowed that takes more than 10mS to execute
    ' otherwise the 10mS Interrupt interval is compromised.
    ' -----------------------------------------------------
    '
    ' Reset Timer Variables for Start
    ' -------------------------------
    DisplayReset:
    LCDOut $FE,1 ' Clear LCD
    Read 0,TMR1CalAR ' Read Calibration Advance/Retard Indicator
    Read 1,TMR1Cal ' Read Calibration Value
    Hundredths=0 ' Reset Timer Counter variables
    Seconds=0
    Minutes=IMINUTES
    Hours=IHOURS
    OverflowError=0
    '
    ' Main Program Loop
    ' =================
    Enable
    DisplayLoop:
    If ButStart=0 then RunningFlag=1
    If ButStop=0 then RunningFlag=0
    LCDOut $FE,$80,DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds,".",DEC2 Hundredths
    
    If OverflowError=1 then
    If Seconds.0=1 then
    LCDOut $FE,$8C,"ERR"
    else
    LCDOut $FE,$8C," "
    endif
    endif
    If RunningFlag=1 then goto DisplayLoop
    If ButReset=1 then goto DisplayLoop
    Disable
    '
    ' Reset Clock
    ' ===========
    ' Momentarily Press the Reset Button for RESET action.
    ' Continue holding the Reset Button for MORE than 5 seconds
    ' to jump into Calibration/Set-Up Mode
    '
    ResetClock:
    LCDOut $FE,1,"Reset OK"
    Pause 1000
    Seconds=1
    While Seconds < 5
    Pause 1000
    If ButReset=1 then goto DisplayReset
    Seconds=Seconds+1
    Wend
    '
    ' Calibration Adjustment
    ' ======================
    ' If No Button is Pressed for 20 Seconds, then the program
    ' will automatically exit Calibration/Set-Up Mode WITHOUT saving
    ' any new values.
    '
    SetUpTimeout=0
    Calibration:
    LCDOut $FE,1,"Calibrate: "
    While ButReset=0:Wend ' Wait for User to release finger
    CalibrationLoop:
    LCDOut $FE,$8B
    If TMR1Cal=0 then
    LCDOut " "
    else
    If TMR1CalAR=0 then
    LCDOut "+"
    else
    LCDOut "-"
    endif
    endif
    LCDOut #TMR1Cal," "
    ' ----------------------------------------------------------
    ' Press Start Button to ADVANCE (speed-up) Clock
    ' Press STOP Button to RETARD (slow-down) Clock
    ' Press RESET Button to SAVE new Calibration Setting
    ' ----------------------------------------------------------
    ' Remember each Calibration 'tick' will advance or
    ' retard the Timing by 1uS in every 10mS period - that's
    ' 360mS/Hour per setting. Example: A setting of +8 will
    ' SPEED-UP the Timer by 2.88 Seconds (8 x 360mS) in an Hour.
    ' ----------------------------------------------------------
    If TMR1CalAR=0 then
    If ButStart=0 then Gosub CalAdvance
    If ButStop=0 then Gosub CalRetard
    else
    If ButStart=0 then Gosub CalRetard
    If ButStop=0 then Gosub CalAdvance
    endif
    If ButReset=0 then
    Write 0,TMR1CalAR
    Write 1,TMR1Cal
    LCDOut $FE,1,"Have a Nice Day"
    Pause 1000
    Goto DisplayReset
    endif
    SetupTimeout=SetupTimeout+1
    If SetupTimeout>200 then goto DisplayReset
    Pause 100
    Goto CalibrationLoop
    
    '
    ' Subroutine Increments Calibration Value
    ' ---------------------------------------
    CalAdvance:
    SetupTimeout=0
    If TMR1Cal=>TMR1CalMax then
    TMR1Cal=TMR1cALmAX
    TMR1CalAR=TMR1CalAR^1
    else
    TMR1Cal=TMR1Cal+1
    endif
    Return
    '
    ' Subroutine Decrements Calibration Value
    ' ---------------------------------------
    CalRetard:
    SetupTimeout=0
    If TMR1Cal=0 then
    TMR1Cal=1
    TMR1CalAR=TMR1CalAR^1
    else
    TMR1Cal=TMR1Cal-1
    endif
    Return
    '
    ' Subroutine Displays Banner Intro
    ' --------------------------------
    DisplayBanner:
    CounterC=BannerOffset+15
    LCDOut $FE,$80
    For CounterB=BannerOffset to CounterC
    Read CounterB,DataA
    LCDOut DataA
    Next CounterB
    Return
    '
    ' Subroutine Loads TMR1 values
    ' ============================
    SetTimer:
    T1CON.0=0 ' Stop the Clock
    TMR1RunOn.Highbyte=TMR1H ' Load the Run-On (Over-Run) value (if any)
    TMR1RunOn.Lowbyte=TMR1L
    TMR1RunOn=TMR1Preset+TMR1RunOn
    ' Calculate the New (adjusted) value for TMR1
    If TMR1CalAR=0 then ' Calibration ADVANCE (add) or RETARD (subtract)
    TMR1RunOn=TMR1RunOn+TMR1Cal
    else
    TMR1RunOn=TMR1RunOn-TMR1Cal
    endif
    TMR1H=TMR1RunOn.Highbyte ' Save new values to TMR1
    TMR1L=TMR1RunOn.Lowbyte
    T1CON.0=1 ' Restart the Clock
    PIR1.0=0 ' Reset TMR1's Interupt Flag
    Return
    '
    ' Timer Interrupt Handler
    ' =======================
    TickCount:
    Gosub SetTimer ' Set the Timer for next 10mS Interrupt
    If RunningFlag=1 then ' If timing actually enabled... then...
    
    IF HUNDREDTHS=0 THEN
    IF SECONDS=0 THEN
    IF MINUTES=0 THEN
    IF HOURS=0 THEN
    GOTO TIMEUP
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    
    
    If seconds=0 then
    hundredths=0
    'goSUB timeup
    else
    Hundredths=Hundredths-1
    ' Increment 10mS Seconds Counter
    If Hundredths=0 then
    Hundredths=99
    seconds=seconds-1
    endif
    endif
    
    ' Increment the Seconds
    
    If minutes>0 then
    
    If Seconds=0 then
    Seconds=59
    minutes=minutes-1
    endif
    endif
    
    
    If hours>0 then
    
    If Minutes=0 then
    Minutes=59
    hours=hours-1
    endif
    endif
    
    If Hours>99 then
    ' Handle any Overflow
    Hours=0
    OverFlowError=1
    endif
    endif
    Resume
    
    timeup: 
    	LCDOUT $FE,$C0 
    	LCDOUT "Time is up"
    	GOTO timeup
    
    TickCountUP:
    Gosub SetTimer ' Set the Timer for next 10mS Interrupt
    If RunningFlag=1 then ' If timing actually enabled... then...
    Hundredths=Hundredths+1
    ' Increment 10mS Seconds Counter
    If Hundredths>99 then
    Hundredths=0
    Seconds=Seconds+1
    ' Increment the Seconds
    If Seconds>59 then
    Seconds=0
    Minutes=Minutes+1
    ' Increment the Minutes
    If Minutes>59 then
    Minutes=0
    Hours=Hours+1
    ' Increment the Hours
    If Hours>99 then
    ' Handle any Overflow
    Hours=0
    OverFlowError=1
    endif
    endif
    endif
    endif
    endif
    Resume
    End

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    If you have a load of Text screen/Menus, you have few choices

    1. using a bigger PIC
    2. using an external EEPROM to store your Text
    3. use the following method --- http://www.pbpgroup.com/modules/wfse...p?articleid=10

    HTH
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by chrisshortys View Post
    Well i ran out of memory at around 700 lines
    When you say you ran out of memory, do you mean you ran out of code space or variable space?

Similar Threads

  1. interactive menu with hyperterminal
    By jamied in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 5th January 2009, 11:13
  2. Sending menu to PC from PIC16F876A
    By joseph Degorio in forum Serial
    Replies: 2
    Last Post: - 12th November 2007, 07:03
  3. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 22:05
  4. Interrupt Menu System Example and Help Needed
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 1st April 2005, 17:05
  5. Lcd Menu
    By eliecer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th February 2005, 19:29

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