In SX Microcontrollers, SX/B Compiler and SX-Key Tool, natpie wrote: I'm still not convinced what you are describing is XOR. In you example you stated RB = 00000010. You then expected to see the result 00000010 after you XOR the value 00001111. However 000000010 XOR 00001111 = 00001101. Bits 4 to 7 will remain unchanged. In your original post you stated you want to clear the upper 4 bits. However if RB = 01011111, and you XOR that by 00001111 your result would be 01010000. In your original code you placed a comment 1 to copy bit 0 to clear. That is true for AND it is not true for XOR. For XOR it would be 1 to toggle 0 to copy. I'm sorry if I'm misunderstanding what you are trying to do but what you described sounds like you want to use AND. You also might want to look at your JNB RB.1 Unless you've excluded some code here this only runs once then it will will run your XOR code over and over again. Also the the condition you have listed will wait only if RB.1 = 1. JNB is Jump if bit NOT set. So if RB.1 = 0 it will jump to bp0, and never return. If RB.1 = 1 it will continue to your JMP wait condition. So your code will wait while RB.1 is active. JNB is also really two commands. SB somebit and jmp your address (not important in this discussion) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=367991#m368101 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)