Jinx's post is a completion (separating the 10s from the 1s) of http://www.piclist.com/techref/microchip/math/radix/b2bhp-8b3d.htm by Scott Dattalo which is probably the fastest single byte binary to decimal conversion for the PIC. It doesn't appear, at a glance, to be much larger than the loop methods and it does it in one pass; no loops. BAM! Done! Anyone who can understand how it works is smarter than I. Scotts notes: http://www.piclist.com/techref/method/math/radixs.htm --- James. > -----Original Message----- > From: piclist-bounces@mit.edu > [mailto:piclist-bounces@mit.edu] On Behalf Of Jinx > Sent: 2007 Mar 06, Tue 13:07 > To: Microcontroller discussion list - Public. > Subject: Re: [PIC] seperate num into tens+units > > ;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 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist