In a message dated 5/3/99 2:19:31 PM Pacific Daylight Time, andreas.m@TELIA.COM writes: << Hello all! I have a problem. I am programming a PIC. In the program I load a value from portb to the register TANKOD. The value from portb tell me wich button that is pressed down on a keypad. If button 3 is pressed, 3 will be the value of portb. My problem is that the keypad use "negative logic" or something like that. A 0 is a 1 and a 1 is a 0. So i want to invert the register. 11111100 => 00000011 Any Idea how I can do this in a easy way. Tnx /Andreas Magnusson >> Hi Andreas, How about: xorlw b'11111111' ;exclusive OR W with all 1's W register should contain the value obtained from port B. when finished, the W reg will be inverted. Dave Duley