Okay, the following 2 examples provide different answers. Why?
'correct according to the book, (^^ = XOR) but wrong answer
' it results in rb_change being $ff always
rb_change = rb_read ^^ rb_save
' wrong according to the book, (^ = nothing) but right answer, rb_change becomes an xor of the two variables
rb_change = rb_read ^ rb_save
Here is the acutal code:
while 1 ; continue forever
rb_read = portb >> 4 ' get the 4 inputs into the right nibble
rb_channel_change = rb_read ^ rb_save ' if one changed, get it into rb_channel_change
rb_save = rb_read ' save the data for the next time around
if rb_channel_change then
gosub test_change ' a channel changed
endif
wend
What am I missing?
Bookmarks