> Hi, just want to get a quick check of my code. I think it will work, but > I want to be sure. Basically I want to take the lower 6 bits from PortA, > the 2 upper bits from PortB, and mask them together into one byte. Will > this work? > > movf PORTA, W > andlw b'11111100' > movwf TEMP > movf PORTB, W > andlw b'00000011' > iorwf TEMP, F This merges the upper 6 bits of port A with the lower 2 bits of port B, which is opposite of your description. It also leaves the final value in TEMP, not W, although that may be what you wanted. Otherwise this is correct assuming TEMP is in the same bank as PORTA and PORTB, and that the bank is set correctly before this code segment. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.