Hello,
Trying different ways to make some code more efficient, I found that variables may not be used the same way in IF or WHILE commands.
Code:
btn_x = VAR BYTE
btn_x = PORTB & %00111110
if btn_x = 2 then .... => this works
while PORTB & %00111110 = 2 ... => this works too
while btn_X = 2 ... this won't work (?!)
In the case of IF, btn_x variable will be recognised as in the WHILE, it will not as long as I don't write it as in the code above.
I understand the difference between both commands functionalities; it is about to know why they can't be handled the same way.
Bookmarks