OK. And in my case, with 10 bits and 1023 as the highest BCD value, one could replace the first loop with an "if" since res[0] can only be 0 or 1, right ? B.t.w, I'm targeting this code to the 18F series, if it does any difference. Thanks all replying so far ! Jan-Erik. >Exactly, something pseudo like: > > res[0]='0'; > res[1]='0'; > res[2]='0'; > res[3]='0'; > > while (i>=1000) { res[0]++; i-=1000;} > while (i>=100) { res[1]++; i-=100; } > while (i>=10) { res[2]++; i-=10; } > res[3]+=i; > >/frax Jan-Erik Svderholm S:t Anna Data -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu