Programmeren (2.9)

20
Hogeschool van Utrecht / Institute for Computer, Communicati on and Media Technology 2.1 Inleiding computersystemen en netwerken Programmeren (2.9) assembler, hogere programmeertaal compiler, interpreter line-oriented, structured, OO

description

Programmeren (2.9). assembler, hogere programmeertaal compiler, interpreter line-oriented, structured, OO. Getalrepresentaties. Tientallige stelsel (decimaal). Bijvoorbeeld: 1523 (cijfers 0 t/m 9 ). Achttallig stelsel (octaal). Bijvoorbeeld: 2763 (cijfers 0 t/m 7 ). - PowerPoint PPT Presentation

Transcript of Programmeren (2.9)

Page 1: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.1Inleiding computersystemen en netwerken

Programmeren (2.9)

assembler, hogere programmeertaal

compiler, interpreter

line-oriented, structured, OO

Page 2: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.2Inleiding computersystemen en netwerken

Page 3: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.3Inleiding computersystemen en netwerken

Tientallige stelsel (decimaal)

103 102 101 100

1000 100 10 1

1 5 2 3

Bijvoorbeeld: 1523 (cijfers 0 t/m 9)

Page 4: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.4Inleiding computersystemen en netwerken

Achttallig stelsel (octaal)

83 82 81 80

512 64 8 1

2 7 6 3

Bijvoorbeeld: 2763 (cijfers 0 t/m 7)

Page 5: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.5Inleiding computersystemen en netwerken

Tweetallig stelsel (binair)

210 29 28 27 26 25 24 23 22 21 20

1024 512 256 128 64 32 16 8 4 2 1

1 0 1 1 1 1 1 0 0 1 1

Bijvoorbeeld: 10111110011 (cijfers 0 en 1)

Page 6: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.6Inleiding computersystemen en netwerken

Zestientallig stelsel (hexadecimaal)

162 161 160

256 16 1

5 F 3

Bijvoorbeeld: 5F3 (cijfers 0 t/m 9 en letters A t/m F)

Page 7: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.7Inleiding computersystemen en netwerken

Omrekenen van dec naar hex

1523 dec

1523 delen door 16 -> gaat 95 keer; rest 3

1520 delen door 256 -> gaat 5 keer; rest 240

1280 delen door 4096 -> gaat 0 keer; rest 1280

256 16 1

1280/256=5 240/16=F 3/1=3

Page 8: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.8Inleiding computersystemen en netwerken

Bits, nibbels, bytes en words

31 16 15 8 7 4 3 0

nibblebit

byte

32 bits word

16 bits Word

MSB LSB

Page 9: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.9Inleiding computersystemen en netwerken

Binaire waarden weergeven

01001110001010001010110001100011

4 E 2 8 A C 6 3

bin

hex

Bepaal zelf de octale waarde

Page 10: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.10Inleiding computersystemen en netwerken

voorvoegsel tweemacht waarde

Kilo 210 1024

Mega 220 1048576

Giga 230 1073741824

Tera 240 1099511627776

Peta 250 1125899906842624

Exa 260 1152921504606846976

Zeta 270 1180591620717411303424

Let op verschil met bv kΩ

Page 11: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.11Inleiding computersystemen en netwerken

Binair optellen

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 10

Page 12: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.12Inleiding computersystemen en netwerken

Binair vermenigvuldigen0 x 0 = 00 x 1 = 01 x 0 = 01 x 1 = 1

Zeer eenvoudige tafel:

Page 13: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.13Inleiding computersystemen en netwerken

Binaire deling

Page 14: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.14Inleiding computersystemen en netwerken

Negatieve getallen : sign-magnitude-127

…..

-3

-2

-1

-0

+0

+1

+2

+3

…..

+127

11111111

……

10000011

10000010

10000001

10000000

00000000

00000001

00000010

00000011

……

01111111

DEC BIN

Page 15: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.15Inleiding computersystemen en netwerken

Complement5000

…..

9996

9997

9998

9999

0000

0001

0002

0003

…..

4999

Welke waarde krijgt - 45 ?

N – 10000 = - 45N = 10000 - 45 = 9955

9955 is het 10-complement van 45

Page 16: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.16Inleiding computersystemen en netwerken

2-complement methode

-128

….

-3

-2

-1

+0

+1

+2

+3

….

+127

10000000

……

11111101

11111110

11111111

00000000

00000001

00000010

00000011

……

01111111

DEC BIN

Page 17: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.17Inleiding computersystemen en netwerken

Veranderen van teken bij 2-complement

+3 = 00000011

1-complement = 11111100 (inverse)Tel er 1 bij op 1

+-3 = 11111101

Page 18: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.18Inleiding computersystemen en netwerken

Niet gehele getallen

3,14 kan geschreven worden als 0,314 x 101

Wanneer afgesproken wordt dat de komma altijd op de zelfde plek staat hoef alleen 314 (mantisse) en 1 (exponent) te worden opgeslagen.

Voor binaire waarden geldt dit ook.

Fixed point

Page 19: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.19Inleiding computersystemen en netwerken

ANSI-IEEE 754-1985

1 8-bits 23-bits

1 11-bits 52-bits

float

double

sign exponent fraction

Institute of Electrical and Electronics Engineers

Page 20: Programmeren (2.9)

Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology

2.20Inleiding computersystemen en netwerken

Opdracht

• Bestudeer paragraaf 3.1 en 3.2

• Opgaven 1 t/m 5 (pag 35)

• Practicum …