ram and binary numbers ram and binary numbers what is 0000000101? what is 52 in binary? what is a...

20
RAM and Binary Numbers What is 0000000101? What is 52 in binary? What is a file? Preview Questions:

Upload: cordelia-benson

Post on 24-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

RAM and Binary Numbers RAM and Binary Numbers

What is 0000000101?

What is 52 in binary?

What is a file?

Preview Questions:

CS 105 Fall2009# 2

Random Access Memory (RAM) also called Main Memory or Primary Memory

• Stores program instructions and data needed for processing--the working memory (short-term memory) of a computer (like a human’s memory)

• The primary storage area for programs and data in active use - RAM

• It is volatile.

CS 105 Spring 2010# 3

Analogy for RAM

• Imagine you are sitting at a desk. The size of your work area determines how many projects you can handle at once.

• RAM is somewhat like the that surface – the number of applications that you can run is limited by the size of RAM.

• RAM is good—get lots of it!

CS 105 Spring 2010# 4

MicroprocessorMicroprocessor

• Brain of the computer

• Brain of the cell phone

• Brain of the PDA

See Unit D in your textbook

CS 105 Spring 2010# 5

The Machine Cycle The Machine Cycle

Main MemoryMain MemoryControl Unit

Arithmetic/Logic Unit

1

2

34

Fetch Decode

Execute

Store

RAM

CPU Fetches, Sends back

CS 105 Spring 2010# 6

Main Memory (RAM) Main Memory (RAM)

• Is organized as a sequence of locations

• Each location can contain a sequence of bits, representing data or an instruction

• Locations are numbered with “addresses” from 0 to memory-size

(can be huge, even gigabytes)

CS 105 Spring 2010# 7

Why use binary numbers?

• We can build computers that operate in base-10, but they would be expensive.

• What is easier than having a switch be ON or OFF?

• We use electricity that way—low current or high current.

• High voltages indicate 1 and low voltages indicate 0

CS 105 Spring 2010# 8

Data Representation: Bits Data Representation: Bits

The bit is the smallest unit of data; it is 1 or 0, that is, on or off

000

001

010

011

100

101

110

111

CS 105 Spring 2010# 9

Base Ten Base Ten

Numbers

• In base 10, a decimal integer 587 means:

587 = 5 x 102 + 8 x 101 + 7 x 100

7 x 100

8 x 101

5 x 102

=7

=80

=500

_______

587

CS 105 Spring 2010# 10

Base Two Base Two

• Likewise, in base 2, a binary integer 101 means:

101 = 1 x 22 + 0 x 21 + 1 x 20

1 x 20

0 x 21

1 x 22

=1

=0

=4

----------5

CS 105 Spring 2010# 11

Convert the binary (base two) number 110111 to decimal (base ten).Answer= 55

1 1 0 1 1 1x 32 x 16 x 8 x 4 x 2 x 1

32 + 16 + 0 + 4 + 2 + 1 = 55

CS 105 Spring 2010# 12

Convert the decimal (base ten) number 52 to binary (base two).Answer= 110100

52 x 32 x 16 x 8 x 4 x 2 x 1-32 1 1 0 1 0 020

-164

-40

CS 105 Spring 2010# 13

Characters, marks, and more Characters, marks, and more Letters, numbers, line feeds, and non-printing

characters

ASCII-8. Pronounced “ass-key” ASCII stands for American Standard Code for Information Interchange, has 256 different symbols-all Operating Systems fully understand ASCII.

UNICODE allows for up to 65,536 different characters. It is more complex and not implemented on many Operating Systems, but it is on Windows NT and Windows XP.

CS 105 Spring 2010# 14

Different characters held in RAM

00100001 = ???

CS 105 Spring 2010# 15

Why are these lists in alphabetical order?

CS 105 Spring 2010# 16

ASCII (link)

ASCII-8 represents 256 characters -- the foreign language possibilities are below:

CS 105 Spring 2010# 17

ASCII, Cont.

• 32 is the ASCII code for a space.

• So 32 = 00100000 in binary, and when the computer gets that data, it causes a space to appear.

• Note: all the capital letters finish before the lower case letters appear

• B = 66• b = 98

CS 105 Spring 2010# 18

Digital Cell Phones, converting sound

• Digital phones convert your voice into binary information (1s and 0s) and then compress it

• CDs also convert analog to digital:• Sampling:http://communication.howstuffworks.com/analog-digital3.htm• Making a CDhttp://electronics.howstuffworks.com/cd5.htm

CS 105 Spring 2010# 19

What is a file?

• See page 116 in your Concepts book!!

• A collection of data on a storage medium • Filename conventions • Filename extension

.txt.txt .jpg.jpg .exe.exe .doc.doc

CS 105 Spring 2010# 20

To Summarize:

• What is 0000000101 in decimal?

• What is 8 in binary?

• What is a file?