2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์...

23
1 2 nd Semester 2004 Module1 Module1 Introduction to Introduction to Computer and Programming Computer and Programming ออออออออ อออออออออออ Aphirak Jansang [email protected] http://www.cpe.ku.ac.th/~aphirak Computer Engineering Department Kasetsart University, Bangkok THAILAND

description

1 st Semester Do you know? THAILAND  How many computers in THAILAND? *http://www.nso.go.th/eng/indicators/core_e.htm

Transcript of 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์...

Page 1: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

12nd Semester 2004

Module1Module1Introduction to Introduction to

Computer and ProgrammingComputer and Programming

อภิรกัษ์ จนัทรส์รา้งAphirak Jansang

[email protected]://www.cpe.ku.ac.th/~aphirak

Computer Engineering DepartmentKasetsart University, Bangkok THAILAND

Page 2: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

21st Semester 2005

Outline

Introduction to Computer How to run program? Programming Languages

Page 3: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

31st Semester 2005

Do you know? How many computers in THAILANDTHAILAND?

*http://www.nso.go.th/eng/indicators/core_e.htm*http://www.nso.go.th/eng/indicators/core_e.htm

1998 1999 2000 2001 2002

Page 4: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

41st Semester 2005

How can we classify computers?

Personal Computer Desktop Computer Notebook PDA – Personal Digital Assistant

Supercomputer Mainframe High Computation Power

Page 5: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

51st Semester 2005

Computer Components

Input Devices Output Devices Computing & Processing Unit

Page 6: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

61st Semester 2005

CPU

MainMemory

Input Devices

HD

Secondary Memory

Output Devices

Computer Components

Page 7: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

71st Semester 2005

Computer Memory

1.Main Memory 2.Secondary Memory

Page 8: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

81st Semester 2005

1. Main Memory

Can be devided into 2 Categories RAM (Random Access Memory) ROM (Read Only Memory)

Memory Cell -> Byte -> Bit 1 Byte = 8 bits

Page 9: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

91st Semester 2005

2. Secondary Memory

Floppy disk Hard disk CDROM DVDROMEtc…

1 Kbyte = 210 = 1024 bytes1 Mbyte = 220 = 1,048,576 bytes

1 Gbyte = 230 = 1,073,741,824 bytes

Page 10: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

101st Semester 2005

Main Memory VS Secondary Memory

Main MemoryMuch fasterMore

expensiveVolatile

Secondary MemorySlowerLess expensivePermanent

Page 11: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

111st Semester 2005

Do you know ASIMO?

*http://world.honda.com/ASIMO/*http://world.honda.com/ASIMO/

Page 12: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

121st Semester 2005

Outline

Introduction to Computer How to run program? Programming Languages Introduction to Pascal Language

Page 13: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

131st Semester 2005

How to run program? After boot Process

May be Windows XP (Operating System: OS) has been loaded into Main Memory

User tell OS to load program P1 OS Load program P1 from Secondary

Memory into Main Memory OS run program from Main Memory

Page 14: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

141st Semester 2005

Outline

Introduction to Computer How to run program? Programming Languages

Page 15: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

151st Semester 2005

Programming Languages

Machine Language Assembly Language High-Level Language

Page 16: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

161st Semester 2005

High-level VS Assembly VS Machine Language

High-level LanguageSUM := A * 2 + ALPHA/3;

Assembly LanguageMULL3 A, #2, R6

DIVL3 #3, ALPHA, R7ADDL3 R6, R7, SUM

Machine Language0001100001100011001111 10011000111

Page 17: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

171st Semester 2005

High-Level Languages Procedural Language

Fortran Cobol Basic C Pascal

Object-Oriented Language C++ Java C#C#

Functional Language Lisp

Logic Language Prolog

Page 18: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

181st Semester 2005

How to execute program from non-machine language?

Interpretation Method Translation Method

Page 19: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

191st Semester 2005

Interpretation Method Process

InterpreterInterpreter(on computer)(on computer)

OutputSource ProgramSource ProgramSource Program

Input

Page 20: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

201st Semester 2005

Translation Method Process

TranslatorTranslator(on computer)(on computer)

File *.exe

Source ProgramSource ProgramSource Program

Input

Page 21: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

211st Semester 2005

Translators

Assembler (assembly) Compiler (High-level language)

Page 22: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

221st Semester 2005

Quiz1 Quiz1 What will happen What will happen

to you when to you when our world have our world have no computers?no computers?

Page 23: 2 nd Semester 2004 1 Module1 Introduction to Computer and Programming อภิรักษ์ จันทร์สร้าง Aphirak Jansang

231st Semester 2005

Summary

Computer Basic Programming Language

Interpreter Method Translator Method