Representing information binary hex ascii corresponding reading udc chapter 2
This presentation is the property of its rightful owner.
Sponsored Links
1 / 37

Representing information: binary, hex, ascii Corresponding Reading: UDC Chapter 2 PowerPoint PPT Presentation


  • 59 Views
  • Uploaded on
  • Presentation posted in: General

Representing information: binary, hex, ascii Corresponding Reading: UDC Chapter 2. CMSC 150: Lecture 2 . Controlling Information. Watch Newman on YouTube. Inside the Computer: Gates. AND Gate. 0. 0. Input Wires. 1. Output Wire.

Download Presentation

Representing information: binary, hex, ascii Corresponding Reading: UDC Chapter 2

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Representing information binary hex ascii corresponding reading udc chapter 2

Representing information:binary, hex, asciiCorresponding Reading:UDC Chapter 2

CMSC 150: Lecture 2


Controlling information

Controlling Information

Watch Newman on YouTube


Inside the computer gates

Inside the Computer: Gates

AND Gate

0

0

Input Wires

1

Output Wire

0's & 1's represent low & high voltage, respectively, on the wires


Inside the computer gates1

Inside the Computer: Gates


Representing information

Representing Information

  • We need to understand how the 0's and 1's can be used to "control information"


The decimal number system

The Decimal Number System

  • Deci- (ten)

  • Base is ten

    • first (rightmost) place: ones (i.e., 100)

    • second place: tens (i.e., 101)

    • third place: hundreds (i.e., 102)

  • Digits available: 0, 1, 2, …, 9 (ten total)


Example your favorite number

Example: your favorite number…

8,675,309


The binary number system

The Binary Number System

  • Bi- (two)

    • bicycle, bicentennial, biphenyl

  • Base two

    • first (rightmost) place: ones (i.e., 20)

    • second place: twos (i.e., 21)

    • third place: fours (i.e., 22)

  • Digits available: 0, 1 (two total)


Representing decimal in binary

Representing Decimal in Binary

  • Moving right to left, include a "slot" for every power of two <= your decimal number

  • Moving left to right:

    • Put 1 in the slot if that power of two can be subtracted from your total remaining

    • Put 0 in the slot if not

    • Continue until all slots are filled

      • filling to the right with 0's as necessary


Example

Example

  • 8,675,30910

    =

    1000010001011111111011012

  • Fewer available digits in binary:

    more space required for representation


Converting binary to decimal

Converting Binary to Decimal

  • For each 1, add the corresponding power of two

  • 10100101111012


Converting binary to decimal1

Converting Binary to Decimal

  • For each 1, add the corresponding power of two

  • 10100101111012 = 530910


Now you get the joke

Now You Get The Joke

THERE ARE 10 TYPES OF PEOPLE IN THE WORLD:

THOSE WHO CAN COUNT IN BINARY

AND THOSE WHO CAN'T


Too much information

Too Much Information?


Too much information1

Too Much Information?


Too much information2

Too Much Information?


An alternative to binary

An Alternative to Binary?

  • 1000010001011111111011012 = 8,675,30910

  • 1000001001011111111011012 = 8,544,23710


An alternative to binary1

An Alternative to Binary?

  • 1000010001011111111011012 = 8,675,30910

  • 1000001001011111111011012 = 8,544,23710


An alternative to binary2

An Alternative to Binary?

  • What if this was km to landing?


The hexadecimal number system

The Hexadecimal Number System

  • Hex- (six) Deci- (ten)

  • Base sixteen

    • first (rightmost) place: ones (i.e., 160)

    • second place: sixteens (i.e., 161)

    • third place: two-hundred-fifty-sixes (i.e., 162)

  • Digits available: sixteen total

    0, 1, 2, …, 9, A, B, C, D, E, F


Using hex

Using Hex

  • Can convert decimal to hex and vice-versa

    • process is similar, but using base 16 and 0-9, A-F

  • Most commonly used as a shorthand for binary

  • Avoid this


More about binary

More About Binary

  • How many different things can you represent using binary:

  • with only one slot (i.e., one bit)?

  • with two slots (i.e., two bits)?

  • with three bits?

  • with n bits?


More about binary1

More About Binary

  • How many different things can you represent using binary:

  • with only one slot (i.e., one bit)? 2

  • with two slots (i.e., two bits)? 22 = 4

  • with three bits? 23 = 8

  • with n bits? 2n


Binary vs hex

Binary vs. Hex

  • One slot in hex can be one of 16 values

    0, 1, 2, …, 9, A, B, C, D, E, F

  • How many bits do you need to represent one hex digit?


Binary vs hex1

Binary vs. Hex

  • One slot in hex can be one of 16 values

    0, 1, 2, …, 9, A, B, C, D, E, F

  • How many bits do you need to represent one hex digit?

  • 4 bits can represent 24 = 16 different values


Binary vs hex2

Binary vs. Hex


Converting binary to hex

Converting Binary to Hex

  • Moving right to left, group into bits of four

  • Convert each four-group to corresponding hex digit

  • 1000010001011111111011012


Converting hex to binary

Converting Hex to Binary

  • Simply convert each hex digit to four-bit binary equivalent

  • BEEF16 = 1011 1110 1110 11112


Representing different information

Representing Different Information

  • So far, everything has been a number

  • What about characters? Punctuation?

  • Idea:

    • put all the characters, punctuation in order

    • assign a unique number to each

    • done! (we know how to represent numbers)


Our idea

Our Idea

  • A: 0

  • B: 1

  • C: 2

  • Z: 25

  • a: 26

  • b: 27

  • z: 51

  • , : 52

  • . : 53

  • [space] : 54


Ascii american standard code for information interchange

ASCII: American Standard Code for Information Interchange


Ascii american standard code for information interchange1

ASCII: American Standard Code for Information Interchange

'A' = 6510 = ???2

'q' = 9010 = ???2

'8' = 5610 = ???2


Ascii american standard code for information interchange2

ASCII: American Standard Code for Information Interchange

256 total characters…

How many bits needed?


The problem with ascii

The Problem with ASCII

  • What about Greek characters? Chinese?

  • UNICODE: use 16 bits

  • How many characters can we represent?


The problem with ascii1

The Problem with ASCII

  • What about Greek characters? Chinese?

  • UNICODE: use 16 bits

  • How many characters can we represent?

  • 216 = 65,536


You control the information

You Control The Information

  • What is this? 01001101


You control the information1

You Control The Information

  • What is this? 01001101

  • Depends on how you interpret it:

  • 010011012 = 7710

  • 010011012 = 'M'

  • 0100110110 = one million one thousand one hundred and one

  • You must be clear on representation and interpretation


  • Login