Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computing CPSC 203 January 24, 2006 Heejin Lim Chapter 1 Chapter 2 (part of)

Similar presentations


Presentation on theme: "Introduction to Computing CPSC 203 January 24, 2006 Heejin Lim Chapter 1 Chapter 2 (part of)"— Presentation transcript:

1 Introduction to Computing CPSC 203 January 24, 2006 Heejin Lim Chapter 1 Chapter 2 (part of)

2 Block diagram of a typical computer Main memory Secondary memory

3

4 Memory in a computer is made up of a lot of switches, each of which can be ON or OFF. Each switch represents one binary digit (bit) A byte is a group of 8 bits, which is used to measure the capacity of a memory e.g.) 256 MB, 40 GB Computers work in Binary, that is "Base 2" arithmetic We normally work in Decimal (Base 10) arithmetic 101 = 1*10 2 + 0*10 1 + 1*10 0 = 100 + 1 = 101 Binary number system

5 1 0 1 1 2 1’s place 2’s place 4’s place 8’s place 2 3 *1 + 2 2 *0 + 2 1 *1 + 1*1 = 8 + 2 + 1 = 11 (decimal)

6 We usually write binary in hexadecimal (hex) or "Base 16“ for simple representation. Each digit is exactly 4 bits. In hexadecimal, we need fifteen numbers to represent any number: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F e.g.) 560, AB, FF => to decimal 560 16 = 5*16 2 + 6*16 1 + 0*16 0 AB 16 = 10*16 + 11*1 = 171 50 => ? 16 50 => ? 2 On a 32 bit computer a cell is typically a word = 4 bytes (unit to represent a number). One byte is always 8 bits. Addresses (memory locations) are typically byte addresses.

7

8 Base 2 => Base 16 1101100101001111 can be written as 1101 1001 0100 1111 which, from the table, equals D94F in hexadecimal (or 55,631 in decimal).

9 PROGRAM test ! Test program Integer:: i, j REAL:: x, y character:: a i = 4 j = 5 x = 4.5 y = 5.5 a = 'G' WRITE(*,*) i+j WRITE(*,*) x+y WRITE(*,*) a STOP END PROGRAM test Declaration Section Execution Section Termination Section


Download ppt "Introduction to Computing CPSC 203 January 24, 2006 Heejin Lim Chapter 1 Chapter 2 (part of)"

Similar presentations


Ads by Google