21
Agenda • Last class: Software and extensions • Today: Memory – How computers store data – Number systems – Digitization

Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Embed Size (px)

Citation preview

Page 1: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Agenda

• Last class: Software and extensions

• Today: Memory– How computers store data– Number systems– Digitization

Page 2: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Memory

• Recall: Storage Devices– How does it save info?– What form is the info?

Page 3: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Magnetic Tape

• In cassettes, VCR tapes,records, floppy disks

• Iron (II) oxide (red) can bemagnetized to “save” info

• Invented: 1933

• Physics 12: Electromagnetism!

Page 4: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Laser Discs, CD’s, DVD’s

• CD = Compact Disc– ~1980’s

• DVD = Digital Video Disc– ~1995

• Uses a laser to read and write data

• A thin track goes inside to outside– 0.0000005 m thick– 5000 m long

Page 5: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Laser Discs, CD’s, DVD’s

• The track has bumps– CD players use lasers to read

the bumps– That’s why it has shiny colours!

• Physics 11 topic

Page 6: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

What form is the info?

• How do bumps change to music or video?

???

Page 7: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Digitization

• Change into numbers

• Computers store info as numbers

• The number can only be a 0 or 1– 1 bit is a 0 or 1– 1 byte = 8 bits

Page 8: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Digitization

• How can 0 or 1 become– Numbers? 123456789 (Today)– Letters? abcdABCD!@#$– Colours?– Pictures?– Movies?– Sounds (music, voice)?

Page 9: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Digitizing Numbers

• We use a decimal number system (base 10)– A digit can be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

• Computers use a binary system (base 2) (1 bit)– A digit can be 0, 1– How do you write 2? 3? 4?

Page 10: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Converting Numbers

• Write the number as powers of the base.Eg: 2468 = 2000 + 400 + 60 + 8or 2 x 103 + 4 x 102 + 6 x 101 + 8 x 100

• Bing “ decimal to binary” • Or go to • http://www.wikihow.com/Convert-from-

Decimal-to-Binary• http://acc6.its.brooklyn.cuny.edu/~gurwitz/

core5/nav2tool.html

Page 11: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Converting Numbers

• Write the number as powers of the base.Eg: 2468 = 2000 + 400 + 60 + 8or 2 x 103 + 4 x 102 + 6 x 101 + 8 x 100

• Change to binary?2468 = ? x 2? + ? x 2? + …

Can only be 0 or 1

Page 12: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Converting Numbers

Change to binary?2468 = ? x 2? + ? x 2? + …

• Find the biggest power of 2less than 2468

• Subtract 2468 – 2048 = 420• Find the biggest power of 2

less than 420• Repeat…

20 1

21 2

22 4

23 8

24 16

25 32

26 64

27 128

28 256

29 512

210 1024

211 2048

212 4096

Page 13: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Converting Numbers

• Change 101001 to decimal?

• _1_ + _0_ + _1_ + _0_ + _0_ + _1_ 25 24 23 22 21 20

• 1 x 25 + 1 x 23 + 1 x 20 =

• 32 + 8 + 1 =

• 41

Page 14: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Octal: Base 8

• Binary is very long (10011010111011010), so many programs use– Octal (Base 8: 01234567)

2468 = ?x8? + ?x8? + …

– 2468 = __ x 83 + __ x 82 + __ x 81 + __ x 80

80 1

81 8

82 64

83 512

84 4096Can be 0, 1, 2, 3, 4, 5, 6, 7

Page 15: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Hexadecimal: Base 16

• Binary is very long (10011010111011010), so many programs use– Hexadecimal (Base 16: 0123456789ABCDEF)

2468 = ?x16? + ?x16? + …• Hex Editor

http://www.easycalculation.com/decimal-converter.php?

160 1

161 16

162 256

163 4096

Can be 0123456789ABCDEF

Page 16: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Decimal Binary Octal Hexadecimal

0

2

8

10

16

99

Biggest number using 1 byte of memory?Biggest number using 2 bytes of memory?

Page 17: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Decimal Binary Octal Hexadecimal

0 0 0 0

2 10 2 2

8 1000 10 8

10 1010 12 A

16 10000 20 10

99 1100011 143 63

Biggest number using 1 byte of memory? 11111111 = ?Biggest number using 2 bytes of memory? 1111111111111111 = ?

Page 18: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

• Biggest number using 1 byte of memory? 11111111 =1x20 + 1x21 + 1x22 + 1x23 + 1x24 + 1x25 + 1x26 + 1x27 + 1x28

• 1 + 2 + 4 + 8 + 16 + 32 + 64 +128 = 255– In hexadecimal this takes 2 bits:

FF = 15 x 160 + 15x161 = 15 + 240 = 255

• Using 2 bytes = 16 bits of memory?• 1+2+4+8+16+32+64+128+256+512+1024+… =

65535– In hexadecimal this takes 4 bits:

FFFF = 15x160 + 15x161 + 15x162 + 15x163 = 15 + 240 + 3840 + 61440 = 65535

Page 19: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Adding

• You can change to decimal and then add, or just add them

• Binary: 10110 + 1101 = ?

• Octal: 1357 + 246 = ?

• Hexadecimal: 7A + C4 = ?

Page 20: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Adding

• You can change to decimal and then add, or just add them

• Binary: 10110 + 1101 = 100011– 22 + 13 = 35

• Octal: 1357 + 246 = 1625– 751 + 166 = 917

• Hexadecimal: 7A + C4 = 13E– 122 + 196 = 318

Page 21: Agenda Last class: Software and extensions Today: Memory –How computers store data –Number systems –Digitization

Homework

• Worksheet on binary / octal / hexadecimal numbers

• Lab 2 mark is in HEXADECIMAL– So it looks like a bad mark, but really…