This preview shows page 1-2-3-4-5-6 out of 17 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1BR 6/00Binary Representation• The basis of all digital data is binary representation.• Binary - means ‘two’– 1, 0– True, False– Hot, Cold– On, Off• We must be able to handle more than just values for real world problems– 1, 0, 56– True, False, Maybe– Hot, Cold, LukeWarm, Cool– On, Off, LeakyBR 6/00Number Systems• To talk about binary data, we must first talk about number systems• The decimal number system (base 10) you should be familiar with!– A digit in base 10 ranges from 0 to 9.– A digit in base 2 ranges from 0 to 1 (binary number system). A digit in base 2 is also called a ‘bit’.– A digit in base R can range from 0 to R-1– A digit in Base 16 can range from 0 to 16-1 (0,1,2,3,4,5,5,6,7,8,9,A,B,C,D,E,F). Use letters A-F to represent values 10 to 15. Base 16 is also called Hexadecimal or just ‘Hex’.BR 6/00Positional NotationValue of number is determined by multiplying each digit by a weight and then summing. The weight of each digit is a POWER of the BASE and is determined by position.953.78 = 9 x 102+ 5 x 101+ 3 x 100+ 7 x 10-1+ 8 x 10-2= 900 + 50 + 3 + .7 + .08 = 953.78% 1011.11 = 1x23+ 0x22+ 1x21+ 1x20+ 1x2-1+ 1x2-2= 8 + 0 + 2 + 1 + 0.5 + 0.25 = 11.75$ A2F = 10x162+ 2x161+ 15x160= 10 x 256 + 2 x 16 + 15 x 1 = 2560 + 32 + 15 = 26072BR 6/00Base 10, Base 2, Base 16The textbook uses subscripts to represent different bases (ie. A2F16 , 953.7810, 1011.112)I will use special symbols to represent the different bases.The default base will be decimal, no special symbol for base 10.The ‘$’ will be used for base 16 ( $A2F)Will also use ‘h’ at end of number (A2Fh)The ‘%’ will be used for base 2 (%10101111)If ALL numbers on a page are the same base (ie, all in base 16 or base 2 or whatever) then no symbols will be used and a statement will be present that will state the base (ie, all numbers on this page are in base 16).BR 6/00Common Powers2-3= 0.1252-2= 0.252-1= 0.520= 121= 222= 423= 824 = 1625=3226= 6427= 12828= 25629= 512210 = 1024211= 2048212= 4096160= 1 = 20161= 16 = 24162= 256 = 28163= 4096 = 212210= 1024 = 1 K220= 1048576 = 1 M (1 Megabits) = 1024 K = 210x 210230= 1073741824 = 1 G (1 Gigabits) BR 6/00Conversion of Any Base to DecimalConverting from ANY base to decimal is done by multiplying each digit by its weight and summing.% 1011.11 = 1x23+ 0x22+ 1x21+ 1x20+ 1x2-1+ 1x2-2= 8 + 0 + 2 + 1 + 0.5 + 0.25 = 11.75Binary to DecimalHex to DecimalA2Fh = 10x162+ 2x161+ 15x160= 10 x 256 + 2 x 16 + 15 x 1 = 2560 + 32 + 15 = 26073BR 6/00Conversion of Decimal Integer To ANY BaseDivide Number N by base R until quotient is 0. Remainder at EACH step is a digit in base R, from Least Significant digit to Most significant digit.Convert 53 to binary53/2 = 26, rem = 126/2 = 13, rem = 013/2 = 6 , rem = 16 /2 = 3, rem = 03/2 = 1, rem = 11/2 = 0, rem = 1 53 = % 110101= 1x25+ 1x24+ 0x23+ 1x22+ 0x21+ 1x20= 32 + 16 + 0 + 4 + 0 + 1 = 53 Least Significant DigitMost Significant DigitBR 6/00Least Significant DigitMost Significant Digit53 = % 110101Most Significant Digit (has weight of 25or 32). For base 2, also called Most Significant Bit (MSB). Always LEFTMOST digit.Least Significant Digit (has weight of 20or 1). For base 2, also called Least Significant Bit (LSB). Always RIGHTMOST digit.BR 6/00More ConversionsConvert 53 to Hex53/16 = 3, rem = 53 /16 = 0 , rem = 353 = 35h= 3 x 161+ 5 x 160= 48 + 5 = 534BR 6/00Hex (base 16) to Binary ConversionEach Hex digit represents 4 bits. To convert a Hex number to Binary, simply convert each Hex digit to its four bit value.Hex Digits to binary:$ 0 = % 0000$ 1 = % 0001$2 = % 0010$3 = % 0011$4 = % 0100$5 = % 0101$6 = % 0110$7 = % 0111$8 = % 1000Hex Digits to binary (cont):$ 9 = % 1001$ A = % 1010$ B = % 1011$ C = % 1100$ D = % 1101$ E = % 1110$ F = % 1111BR 6/00Hex to Binary, Binary to HexA2Fh = % 1010 0010 1111345h = % 0011 0100 0101Binary to Hex is just the opposite, create groups of 4 bits starting with least significant bits. If last group does not have 4 bits, then pad with zeros for unsigned numbers.% 1010001 = % 0101 0001 = 51hPadded with a zeroBR 6/00A Trick!If faced with a large binary number that has to be converted to decimal, I first convert the binary number to HEX, then convert the HEX to decimal. Less work!% 110111110011 = % 1101 1111 0011 = D F 3= 13 x 162+ 15 x 161+ 3x160= 13 x 256 + 15 x 16 + 3 x 1= 3328 + 240 + 3= 3571Of course, you can also use the binary, hex conversion feature on your calculator. Too bad calculators won’t be allowed on the first test, though…...5BR 6/00Binary Numbers AgainRecall than N binary digits (N bits) can represent unsigned integers from 0 to 2N-1. 4 bits = 0 to 158 bits = 0 to 25516 bits = 0 to 65535Besides simply representation, we would like to also do arithmetic operations on numbers in binary form. Principle operations are addition and subtraction.BR 6/00Binary Arithmetic, SubtractionThe rules for binary arithmetic are: 0 + 0 = 0, carry = 01 + 0 = 1, carry = 00 + 1 = 1, carry = 01 + 1 = 0, carry = 1The rules for binary subtraction are: 0 - 0 = 0, borrow = 01 - 0 = 1, borrow = 00 - 1 = 1, borrow = 11 - 1 = 0, borrow = 0Borrows, Carries from digits to left of current of digit.Binary subtraction, addition works just the same as decimal addition, subtraction. BR 6/00Binary, Decimal addition34+ 17------51from LSD to MSD:7+4 = 1; with carry out of 1 to next column1 (carry) + 3 + 1 = 5.answer = 51.Decimal% 101011+ % 000001---------------101100From LSB to MSB:1+1 = 0, carry of 11 (carry)+1+0 = 0, carry of 11 (carry)+0 + 0 = 1, no carry1 +0 = 10 + 0 = 01 + 0 = 1answer = % 101100Binary6BR 6/00SubtractionDecimal900- 001-------8990-1 = 9; with borrow of 1 from next column0 -1 (borrow) - 0 = 9, with borrow of 1 9 - 1 (borrow) - 0 = 8.Answer = 899.Binary% 100- % 001-------0110-1 = 1; with borrow of 1 from next column0 -1 (borrow) - 0 = 1, with borrow of 1 1 - 1 (borrow) - 0 = 0.Answer = % 011.BR 6/00Hex Addition3Ah+ 28h--------62hA+8 = 2; with carry out of 1 to next column1 (carry) + 3 + 2 = 6.answer = $ 62.3Ah = 3 x 16 + 10= …


View Full Document

MSU ECE 3724 - Binary Representation

Documents in this Course
Timers

Timers

38 pages

TEST 4

TEST 4

9 pages

Flags

Flags

6 pages

Timers

Timers

6 pages

Timers

Timers

54 pages

TEST2

TEST2

8 pages

Load more
Download Binary Representation
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Binary Representation and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Binary Representation 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?