I'm very confused here. By XOR'ing DATA1 with W - you are putting 0000 0000 into DATA3, is that correct? If DATA0 IN = 1111 1111 and you want after processing DATA0 OUT to = 111 0 AAA, Then why not mask the bottom 4 bits off with b' 1110 000 then use an intermediate register an copy DATA1 into it and again mask that off with b' 1110 0000 Then SWAPF DATA0, OR DATA0 and DATA1_copy together and SWAPF again? If the bottom bits of DATA0 are still needed, then use a DAT0_copy register here as well. I think if you need to RLF you need to use copy registers. It might be easier if you used a circular buffer, and rotated via FSR. Colin :: The data wil be send serial true some MCU pin using a DCC :: TrainControl :: Booster. :: This pattern is generated in the Booster: :: ; 1111111111 0 AAAAAAAA 0 DDDDDDDD 0 EEEEEEEE 1 :: ; DATA0 0 DATA1 0 DATA2 0 DATA3 1 :: :: And the result i need for testing must be: :: ; '1111 0 AAA' 'AAAAA0DD' 'DDDDDD0E' 'EEEEEEE1' :: ; DATA0 DATA1 DATA2 DATA3 :: :: I tryed this code allready but i seem to mis some bts during :: prosessing: :: bsf NEW_PACKET ;*new :: packet :: received :: bcf DCC4BYTE ;*if set :: there is a :: 4 byte packet :: movlw b'11111111' :: movwf DATA0 ;*Set :: preamble :: movlw b'11111111' :: movwf DATA1 ;*Set :: Byte One :: movlw b'11111111' :: movwf DATA2 ;*Set :: Byte Two :: xorwf DATA1, W :: movwf DATA3 ;*Set :: Byte Three :: rlf DATA3, f :: rlf DATA2, f :: rlf DATA1, f :: rlf DATA0, f :: rlf DATA00,f :: rlf DATA2, f :: rlf DATA1, f :: rlf DATA0, f :: rlf DATA00,f :: rlf DATA1, f :: rlf DATA0, f -- cdb, colin@btech-online.co.uk on 10/08/2008 Web presence: www.btech-online.co.uk Hosted by: www.1and1.co.uk/?k_id=7988359 Friendship multiplies the good of life and divides the evil. Baltasar Gracian -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist