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

    Default

    Ok so if i tried somthing like:
    Code:
    MINSI:
    If Butup=0 then 
    IMINUTES=IMINUTES+1
    IF BUTDWN=0 THEN
    IMINUTES=IMINUTES-1
    IF BUTSTART=0 THEN
    GOTO CONTINUE
    IF BUTRESET=0 THEN
    GOTO HOURSI
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    GOSUB TIMESETUP
    goto minsi
    
    timesetup:
    LCDOUT $FE, 1, "GAME LENGTH"
    LCDOut $FE,$C0,DEC2 IHours,":",DEC2 IMinutes,":00.00"	
    PAUSE 200
    Return
    That should get that working?

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by chrisshortys View Post
    That should get that working?
    Have you tried it yet?

  3. #3
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    I gave it a quick go and it appears to step through on +1 but does not on the -1 or the goto the next section of coding.
    I was going to put it down to being up for 20 hours and not looking forward to the 7:30 start at work tommorow for it not working right now unless you have any ideas?

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by chrisshortys View Post
    I was going to put it down to being up for 20 hours and not looking forward to the 7:30 start at work tommorow for it not working right now unless you have any ideas?
    If you're going to program a PIC, you almost want to think like a PIC.
    Go thru your program in your head, step by step, follow it thru and you'll see why it does what it does.
    Don't assume it'll work because you want it to. A CPU follows instructions in an explicit order. It doesn't go off on it's own because it thinks it's the thing to do at the moment.

  5. #5
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    well i went back to it, i stripped it right back to basics to ensure the buttons were working and tested it a command at a time and got it working!
    It dint like the way i had used the IF and ENDIF commands...
    start:

    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 MINSI
    ENDIF
    pause 50
    GOSUB TIMESETUP
    GOTO HOURSI

    MINSI:
    PAUSE 5000
    MINSI1:
    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 MINSI1


    timesetup:
    pause 50
    LCDOUT $FE, 1, "GAME LENGTH"
    LCDOut $FE,$C0,DEC2 IHours,":",DEC2 IMinutes,":00.00"
    PAUSE 50
    REturn

    'butup and butdwn


    Continue:

    LCDOUT $FE, 1, "Settings Saved"
    LCDOut $FE,$C0,DEC2 IHours,":",DEC2 IMinutes,":00.00"
    pause 6000
    goto continue
    end
    So with that fully working i plonked it back into the other code im working on and now it freezes again doing what the original coding did and getting lost after adding the first hour....
    More time to play around tommorow night i guess.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Well, that's obviously not the full code so we can't help you figure out what's causing the lock-up...

  7. #7
    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?

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 : 0

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