On 02/05/2011 13:58, Olin Lathrop wrote: > Michael Watterson wrote: >> > Vasile can you or someone else explain >> > http://www.piclist.com/techref/piclist/jal/bin2bcd3.htm >> > >> > Is result only up to 999 (three digits)? >> > >> > Unsigned up to 65535 would be good as five unpacked bytes each 0 .. 9 >> > for now, but later 9 digits from 32 bit number is useful. > It sounds like you are trying to convert a 16 bit unsigned integer to > decimal. That is what the attached code does. Yes, but it's not my code and I don't understand it. It seems to do 3=20 digits and thus to do more digits I need to understand it. compared to display[4]=3D byte( unsign_value/10_000) unsign_value =3D unsign_value % 10_000 display[3] =3D byte( unsign_value/1_000) unsign_value =3D unsign_value % 1_000 display[2] =3D byte( unsign_value/100) unsign_value =3D unsign_value % 100 display[1] =3D byte( unsign_value/10) unsign_value =3D unsign_value % 10 display[0] =3D byte( unsign_value) It looks much smarter. Divisions and Mod are bad idea on PIC, Maybe I=20 need more coffee or something, but I don't understand the code in the link. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .