Reggie Berdin wrote: > Try: > > unsigned char bcd[5]; > void int2bcd(unsigned int i) > { > bcd[0]=bcd[1]=bcd[2]=bcd[3]='0'; > while (i>=10000) { > i-=10000; > ++bcd[0]; > } > while (i>=1000) { > i-=1000; > ++bcd[1]; > } > while (i>=100) { > i-=100; > ++bcd[2]; > } > bcd[4] = i & 0xFF; > while (bcd[3]>=10) { > bcd[4]-=10; > ++bcd[3]; > } > bcd[4]+='0'; > } Reggie: As written, this code fails; to make it work, change: while (bcd[3]>=10) { to: while (bcd[4]>=10) { -Andy -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics