Simon Nield wrote: > the problem: > i need to biphase code a byte for serial transmission over an rf link. > in other words each '1' becomes '10' and each '0' becomes '01'. > if it makes the code easier then '1' becoming '01' and '0' becoming '10= ' is ok too. > = > this _could_ be done with a lookup table, which would be fast, but that= 's not the point of a tiny > code challenge now is it ? Is there any particular requirement that the bits be sent in their origin= al order? If not, send every other bit on each pass - that way, you don't have to shift them as far from their original location. movf byte_to_send,w ;abcdefgh andlw b'01010101' ;0b0d0f0h movwf temp clrc rlf temp,w ;b0d0f0h0 iorwf temp,w ;bbddffhh xorlw b'10101010' ;BbDdFfHh call send_byte movf byte_to_send,w andlw b'10101010' movwf temp clrc rrf temp,w iorwf temp,w xorlw b'10101010' ;AaCcEeGg call send_byte -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads