Conversion Between Binary And Decimal

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Conversion Between Binary And Decimal as PDF for free.

More details

  • Words: 421
  • Pages: 3
Conversion between Binary and Decimal Generally logical 0 represents a potential difference of 0V In the same manner logical 1 represents 5V Logical 0 occurs when current cannot flow (e.g. through an open switch) Logical 1 occurs when current can flow (e.g. through a closed switch) and there is some current being supplied (e.g. from the Vcc pin on Integrated Circuits)

Binary Notation Binary numbers are in base 2. This is because each digit can only be one of 2 numbers, i.e. 0 or 1. Decimal numbers (the ones we most commonly use) are in base 10. Each digit can be either 0,1,2,3,4,5,6,7,8, or 9. Binary numbers are represented with a % prefix or a 2 subscripted suffix. Decimal numbers can have a 10 subscripted suffix. (This means that there is a little 10 after the number!)

Conversion from Binary to Decimal If you want to make life easy for yourself get a calculator which can work in different bases! In Decimal we are used to thinking about numbers as a combination of Units, Tens, Hundreds, etc. 107 1000000 0

106 100000 0

105 10000 0

104 103 102 1000 1000 100 0

101

100

10

1

For Example: 1652 (base 10) = 1 Thousand + 6 Hundreds +5 Tens + 2 Units. 1

In Binary we can think of numbers as a combination of Ones, Twos, Fours, Eights, Sixteen's, etc. 27 128

26 64

25 32

24 16

23 8

22 4

21 2

20 1

Similarly: %10110 (base 2) = 1 sixteen + 1 four + 1 two = 22 (in base 10) Or: %1100101 = 1 sixty-four + 1 Thirty-two + 1 four + 1 one = 10110 27 128

26 64 1 64

25 32 1 +32

24 16 0 +0

23 8 0 +0

22 4 1 +4

21 2 0 +0

20 1 1 +1

=10110

So: 11001012 = 10110 Conversion from Decimal to Binary Divide the number repeatedly by 2 (Answer being a whole number and a remainder, The same as Modula-2 Div and Mod commands) The First remainder is the LSB (Least Significant Bit or Digit, the digit on the right of the number) of the Binary number. The next remainder is the next digit, and so on until the value is 0. For Example: Convert 145 into base 2. 145/2= 72 r 1 72/2= 36 r 0 36/2= 18 r 0 18/2= 9 r0 9/2= 4 r1 4/2= 2 r0 2/2= 1 r0 2

1/2= 0 So: 14510 = %10010001

r1

3

Related Documents