No Subject
I have routine that cycles through the Menu on a 4x20LCD (parallax). There is a 'X' that moves up and down so that the user can select an option from the menu. The problem is when the input is triggered the 'X' moves two lines. This happen in up direction and down direction.. Appreciate it if anyone can tell me what i am doing wrong...


Comments
Try it with moving the menustat outside of all the if-statements. Put it to the end of the repeat instead and add a repeat which waits for menustat to be <> 0.
repeat 'Repeat main Program [color=green]repeat while MenuStat==0[/color] if MenuStat ==7 'Displays Main screen outa[noparse][[/noparse]19]:=1 if currentdisp <> 1 displaymain CurrentDisp:=1 [color=red][s]menustat:=0[/s][/color] waitcnt(clkfreq+cnt) outa[noparse][[/noparse]19]:=0 if MenuStat ==6 'Displays menues outa[noparse][[/noparse]18]:=1 if currentdisp <> 2 displayMenu CurrentDisp:=2 [color=orange][s]menustat:=0[/s][/color] lcd.gotoxy(19,0) lcd.str (string("X",13)) ' Places a X in the upper right hand waitcnt(clkfreq+cnt) outa[noparse][[/noparse]18]:=0 if MenuStat == 5 ' If down button is pressed, then move the X down outa[noparse][[/noparse]17]:=1 ''displaymain [color=red][s]menustat:=0[/s][/color] if Currentdisp>1 MenuCnt++ ' Increment location of X MenuCnt <#= 12 ' Not to Exceed 12 (only 12 items in the menu) clearx ' clear X from Previous line lcd.gotoxy(19,menucnt//4) ' cycles the X from position line 0 to 3 lcd.str (string("X",13)) ' print right-justified decimal value waitcnt(clkfreq/2+cnt) ' pause outa[noparse][[/noparse]17]:=0 ' Turn LED off if MenuStat == 4 ' If up button is pressed, then move the X Up outa[noparse][[/noparse]16]:=1 [color=orange][s]menustat:=0[/s][/color] if Currentdisp>1 if menucnt>0 MenuCnt-- Menucnt #>=0 clearX ' clear X from Previous line lcd.gotoxy(19,menucnt//4) ' cycles the X from position line 0 to 3 lcd.str(string("X",13)) ' print right-justified decimal value waitcnt(clkfreq/2 +cnt) ' pause outa[noparse][[/noparse]16]:=0 [color=green]MenuStat := 0[/color]