Try using NCD & then Lookup to simplify your code.
per the manual:
4.17.12 NCD returns the priority encoded bit number 1-32 of a value. it is used to find the HIGHEST bit set in a vlaue. it returns 0 if no bit is set.
b0 = NCD %010000100 'set b0 to 7
so
then use
...Code:If PortB <> $FF then lookup PortB,[7,4,1,0,8,...],UserCode[x]
endif
hope that helps
Bookmarks