From what is written in the manual:
"LOOKUP B0,[“Hello!”],B1 ' Get character number B0 from string to variable B1"
So if you lookup portA then you will have a value equal to the bit rank of the bits that are set. I only need to find the first bit set when reading the PORTA register from LSB to MSB.
With LOOKUP, if the bits 0 and 2 are set, portA will be = 5, that is not the pin_pressed.
(It will will return the value of the 5th constant).
The only way I found till now is to use redundant code like:
if porta.0 = 0 then
pin = 0
Goto bypass
endif
if porta.1 = 0 the
pin = 1
Goto bypass
endif
...etcetera
That's not nice but it works
Bookmarks