;number 0-255 to extract is in temp ;result in d100:d010:d011, add 0x30 to each to make ASCII bin2bcd clrf d100 swapf temp,w addwf temp,w andlw b'00001111' skpndc addlw 0x16 skpndc addlw 0x06 addlw 0x06 skpdc addlw -0x06 btfsc temp,4 addlw 0x16 - 1 + 0x6 skpdc addlw -0x06 btfsc temp,5 addlw 0x30 btfsc temp,6 addlw 0x60 btfsc temp,7 addlw 0x20 addlw 0x60 rlf d100,f btfss d100,w addlw -0x60 movwf d011 btfsc temp,7 incf d100,f movf d100,w movwf d100 swapf d011,w ;separate 10s andlw 0x0f movwf d010 movlw 0x0f ;separate 1s andwf d011,w movwf d011 -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist