menu selection


Closed Thread
Results 1 to 7 of 7

Thread: menu selection

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Let's try to debug this...
    Your code is running to here?
    Code:
    TEMP:
    'SNIP
        LCDOUT $FE,$C0,dta(0),DTA(1),DTA(2),DTA(3),DTA(4),DTA(5),DTA(6),DTA(7),DTA(8),dta(9),dta(10),dta(11),dta(12),DTA(13),DTA(14),DTA(15)
        RETURN
    Then ends up here
    Code:
    main: 
    'ADD LED TO FLASH TO SEE IF IT IS HERE OR DISPLAY "AT MAIN" TO THE LCD 
        if portB.1=1 then                               'arrow down
            push = push+1 : goto selection : endif
        if portA.1=1 then                               'arrow up
            push = push-1 : goto selection : endif
        pause 5000
        goto main
    Then when you get here
    Code:
    selection:
    "DISPLAY THE VALUE OF "push" TO THE LCD
        pause 200
        if push=1 then screen1
        if push=2 then screen2
        if push=3 then screen3
        if push=4 then screen4
        if push=5 then screen5
        if push=6 then screen6
        if push=7 then screen7
        if push=8 then screen8
        if push=9 then
            push = 1 : goto screen1 : endif  
        if push=0 then
            push = 8 : goto screen8 : endif
        goto main
    I have a sneaky suspicion you will need to use >= in place of =
    Does that make sense?
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jun 2005
    Location
    Surrey, England
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Sorry to say but I have tested the menu selection on a simulator and if you change the pause to 50 it works fine (although I would have used a LOOKUP with BRANCHL), but leaving that aside, I suspect you have been naughty with your syntax - you define a word and then treat it like an array. A simple little test of:
    dta = 513
    dta1 = 514
    extra1 = 515
    extra2 =516

    LCDOUT dec dta(0), " ", dec dta(1), " ", dec DTA(2), " ", dec dta(3), " "

    gives this result:
    513 514 515 516
    indicating that
    dta(0) = dta
    dta(1) = the next defined variable etc
    quite unpredicable results - you must define an array and reference it with "square brackets" or better still with the STR expression. Eg:

    Buffer var byte[16]
    HSERIN 1000, tsync, [str Buffer\5]

    Peter
    Last edited by FinchPJ; - 16th June 2010 at 14:10. Reason: spelling correction

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