From: Octavio Nogueira >void Bin2BCD(unsigned char d) >{ > dig[1]=0; > dig[2]=0; > dig[3]=0; > while (d>=100){ > dig[1]++; > d-=100; > } > while (d>=10){ > dig[2]++; > d-=10; > } > while (d>0){ > dig[3]++; > d--; > } >} The last 5 lines could just be: dig[3] = d; } } regards, Reggie