On Mon, 15 Feb 2010, sergio masci wrote: > Now to clear up the confusing bits. > > decimal 359 is binary 01 0110 0111 > decimal 100 is binary 00 0110 0100 > decimal 10 is binary 00 0000 1010 > decimal 1 is binary 00 0000 0001 > > decimal 300 is binary 01 0010 1100 > decimal 50 is binary 00 0011 0010 > > When we take the 3 from the 100s (hundreds) column we are trying to > convert > binary 0100101100 to binary 0000000011. > > When we take the 5 from the 10s (tens) column we are trying to convert > binary 0000110010 to binary 0000000101. > > so the easiest way to do this is to repeatedly take binary 0100101100 from > binary 0101100111 (359) and count in units (binary 0000000001). > > 0101100111 (359) - 0001100100 (100) = 0100000011 (259) ; count = 1 > 0100000011 (259) - 0001100100 (100) = 0010011111 (159) ; count = 2 > 0010011111 (159) - 0001100100 (100) = 0000111011 (59) ; count = 3 > > so at this point we have converted 'value' from 0101100111 (359) to > 0000111011 (59) and 'count' to 0000000011 (3) > Sorry got a bit side tracked here. One of the things I was trying to EMPHASIS here is the way DECIMAL digits are spread over the BINARY equivalent of the same value. In decimal it is easy to see how to take the digit out of the hundreds column but when we look at the binary equivalent we cant just take a a group of bits - we have to do a conversion so that the hundreds get converted to units (units and digits are the same thing for this discussion) Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist