gazzanet
Joined: 19 Feb 2009 Posts: 3
|
LCD Menu With 2 Buttons |
Posted: Fri Feb 20, 2009 11:29 am |
|
|
This might sound odd but...
Basically i have tried if statements and while statements none to which work.
I have 3 variables v1, v2, v3
I have 2 buttons right and left
Originally i want v1 to be sent to lcd this is no problem.
I then want with right button pressed to then show v2
when v2 is shown left will show v1 and right will show v3
Ive tried using another variable as a flag to let me no what the original state is but this doesn't help.
In my while or if loops i do have a warning saying assingment inside relational expression, im thinking this is to due with the flag beeing in the if statement when the if statement is determined from the flag maybe ?
here is come code i have tried.....
Code: |
DATA(0XC0); // DISPLAY 1st COLUM 2nd ROW
OUTPUT_A(1); //Turn r/s on
character_in(q1a1);
OUTPUT_A(0); // Turn r/s LOW
q1sel=1; //q1sel is the flag
while (!input (GP4)) // check enter button ignor this
{
while(input (GP3)) // check left button
{
while(q1sel=1)
{
DATA(0XC0); // DISPLAY 1st COLUM 2nd ROW
OUTPUT_A(1); //Turn r/s on
character_in(q1a1);
OUTPUT_A(0); // Turn r/s LOW
}
while(q1sel=2)
{
DATA(0XC0); // DISPLAY 1st COLUM 2nd ROW
OUTPUT_A(1); //Turn r/s on
character_in(q1a2);
OUTPUT_A(0); // Turn r/s LOW
}
while(q1sel=3)
{
DATA(0XC0); // DISPLAY 1st COLUM 2nd ROW
OUTPUT_A(1); //Turn r/s on
character_in(q1a3);
OUTPUT_A(0); // Turn r/s LOW
}
q1sel++;
}
}
|
|
|