Convert BIN to DEC (by Tomas Vanagas)
Hello,
I want to convert binary code (101001) to decimal number (0..9,10...). Is it possible to make this? If you can please help me, it will be very great.
Best Regards
Tomas
(no subject) (by Jonathan Westhues)
I'm assuming that the binary values are coming in on digital inputs; so that for your six-bit binary value, you have six microprocessor pins.
See the attachment. We just have to sum up the inputs according to their place value. The least significant bit is worth 1, and then 2, 4, 8, 16 and so on. The resulting integer can be used with the math operations, and printed as decimal ASCII using the "formatted string" op.
It's possible to do BCD (or any other place value) input too. In that case, the place value is not 1, 2, 4, 8, 16, ..., but instead would be 1, 2, 4, 8, 10, 20, 40, 80, 100, ....