>\-----------------------------\ > cblock >twobytename:0, msbname, lsbname > endc >\-----------------------------\ This isn't the assembler I use, so I may give you syntactical problems. Basic idea is correct, though. The code below is for CCS C, which lacks a 16-bit printf. If you're a s/w eng, you should be able to translate it to your particular assembler/compiler easy enough. Hope this helps. It was based on the Microchip (I think) code from long ago. I have also extended this code to support up to 32 bit numbers without any problem (another program). Andy char[6] Decimal; void Bin2BCD (WORD Binary) { BYTE temp4, temp5; #asm bcf C // clear carry bit first movlw 16 // number of bits to work movwf temp4 clrf &Decimal[0] clrf &Decimal[1] clrf &Decimal[2] clrf &Decimal[3] clrf &Decimal[4] clrf &Decimal[5] loop16: rlf Binary,F rlf &Binary+1,F rlf &Decimal[5],F rlf &Decimal[4],F rlf &Decimal[3],F decfsz temp4,F goto AdjustDEC goto Done AdjustDEC: movlw &Decimal[5] movwf FSR call AdjustBCD movlw &Decimal[4] movwf FSR call AdjustBCD movlw &Decimal[3] movwf FSR call AdjustBCD goto loop16 AdjustBCD: movlw 3 // enter with FSR pointing addwf INDIRECT,W // to the BCD digit being shifted movwf temp5 btfsc temp5,3 movwf INDIRECT movlw 0x30 addwf INDIRECT,W movwf temp5 btfsc temp5,7 movwf INDIRECT return Done: movf &Decimal[3],W andlw 0x0f iorlw 0x30 movwf &Decimal[0] swapf &Decimal[4],W andlw 0x0f iorlw 0x30 movwf &Decimal[1] movf &Decimal[4],W andlw 0x0f iorlw 0x30 movwf &Decimal[2] swapf &Decimal[5],W andlw 0x0f iorlw 0x30 movwf &Decimal[3] movf &Decimal[5],W andlw 0x0f iorlw 0x30 movwf &Decimal[4] clrf &Decimal[5] // Marks end of C string #endasm temp5 = 1; temp4 = 0; while (temp5) if (Decimal[temp4] == '0') Decimal[temp4++] = ' '; else temp5 = 0; } void ShowDecimal (void) { BYTE i; for (i=0; i!= 5; i++) // Blank leading zeros if (Decimal[i] == 0) lcd_putc (' '); else lcd_putc (Decimal[i]); for (i=0; i!=3; i++) lcd_putc (" uS"); } ================================================================== Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865 Hardware & Software for Industry & R/C Hobbies "Go fast, turn right, and keep the wet side down!" ==================================================================