Harry H. Arends wrote: >> OK by now i am aware to be more specifik. The language is ASM. >> The data to be sendout... Can you better define what "sendout" is ? How will it be sent ? Using what interface ? >> is in four 8 bit variables: >> DATA0 contains all ones >> DATA1 contains a 8 bit address (AAAAAAAA) >> DATA2 contains a 8 bit command (DDDDDDDD) >> DATA3 contains a bitwise exclusif OR from the DATA1 and DATA2 >> >> The result should become >> BYTE0 11110AAA Let's number the bit positions 0-7. Let's also assume that the bits are 76543210. So DATA0.2 = BYTE1.7, DATA0.1 = BYTE1.6 and DATA0.0 = BYTE1.5, right ? That could be done with a few bit-test and bit set/clear instructions. >> BYTE1 AAAAA0DD OK, so rotate DATA1 3 positions to the left and move to BYTE1. Then set BYTE1.1 = DATA2.7 and BYTE1.1 = DATA2.7. >> BYTE2 DDDDDD0E Rotate DATA2 2 positions left and move to BYTE2. Then set BYTE2.0 = DATA3.7. >> BYTE3 EEEEEEE1 Rotate DATA3 1 position to the left and move to BYTE3. Set BYTE3.0 = "1". Then just do that in assembler. *THEN* send BYTE0 to BYTE3 using whatever method you'd like. Jan-Erik. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist