Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4746

XOR woes

$
0
0
Hi, need some help, guys!

I need to set a port to a certain value, depending on another variable which will have only 1 of 2 possible values, 0 or 255.

For example, if the variable is 0, the port should output 45; if the variable is 255, the port should output its complement, 210.

Now, I expected an XOR'ing of the 2 values to give the following results:

0 XOR 45 = 45
255 XOR 45 = 210

However, what I get are pretty random results.

I have tried both operators (XOR as well as ^), with no luck.

Any idea whats happenning?

Viewing all articles
Browse latest Browse all 4746

Trending Articles