picnoob wrote: > hi, i need a way to seperate a number, say 54. and put 5 in a > register called tens, and 4 in another called units. Here. This routine separates the number into three digits; if you know your original number won't ever be larger than 99 decimal, you can remove all the lines marked with a "*****" comment and it'll just separate the number into two digits: LIST R=DEC UNITS EQU .... ;A FILE REGISTER. TENS EQU .... ;ANOTHER FILE REGISTER. HUNDREDS EQU .... ;ANOTHER FILE REGISTER. ***** ; ENTER WITH ORIGINAL 8-BIT VALUE IN "UNITS". EXITS WITH ONES' ; DIGIT IN "UNITS", TENS' DIGIT IN "TENS", AND HUNDREDS' DIGIT ; IN "HUNDREDS". CONVERT CLRF TENS CLRF HUNDREDS ; ***** DO100S MOVLW 100 ; ***** SUBWF UNITS,W ; ***** BNC DO10S ; ***** MOVWF UNITS ; ***** INCF HUNDREDS ; ***** GOTO DO100S ; ***** DO10S MOVLW 10 SUBWF UNITS,W BNC ADJUST MOVWF UNITS INCF TENS GOTO DO10S DONE -Andy === Andrew Warren - fastfwd@ix.netcom.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist