Francesco cembrola
Newbie level 6
I am working with MPLAB C18 compiler.
The code below is not doing what I expected to do!
The variables 'OK' and 'RIGHT' represent two buttons.
When a button is pushed the value changes from 1 to 0.
So I exspect that until OK is not pressed I can keep pushing RIGHT and the value of x increments with every press.
What happens, insted, is that when i push RIGHT the fisrt time x does increment. But only once!!
Also if then I press OK , after I pressed RIGHT, the I cannot exit the loop!!
I am missing something really obvious?
I hope someone can help.
Thanks
Francesco
=====================================
=================================
The code below is not doing what I expected to do!
The variables 'OK' and 'RIGHT' represent two buttons.
When a button is pushed the value changes from 1 to 0.
So I exspect that until OK is not pressed I can keep pushing RIGHT and the value of x increments with every press.
What happens, insted, is that when i push RIGHT the fisrt time x does increment. But only once!!
Also if then I press OK , after I pressed RIGHT, the I cannot exit the loop!!
I am missing something really obvious?
I hope someone can help.
Thanks
Francesco
=====================================
Code:
while (OK==1)
{
if(RIGHT==0)
{
x=x+7;
set_cursor_location(x);
selection=2; //Timer
}
}
Last edited by a moderator: