26
1 1 st Semester 2006 Introduction to Introduction to Computer and Programming Computer and Programming Computer Engineering Department Computer Engineering Department Kasetsart University, Bangkok, Kasetsart University, Bangkok, THAILAND THAILAND

1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

Embed Size (px)

Citation preview

Page 1: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

11st Semester 2006

Introduction to Introduction to Computer and ProgrammingComputer and Programming

Computer Engineering DepartmentComputer Engineering DepartmentKasetsart University, Bangkok, Kasetsart University, Bangkok,

THAILANDTHAILAND

Page 2: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

21st Semester 2006

Instructor InformationInstructor Information

Instructor: Instructor: สิ�ทธิ�ชั�ย ศรี�อ่ อ่น สิ�ทธิ�ชั�ย ศรี�อ่ อ่น (Sitichai (Sitichai Srioon)Srioon)

Email Address: Email Address: [email protected]@ku.ac.th Website: Website: http://www.cpe.ku.ac.th/~scshttp://www.cpe.ku.ac.th/~scs Office: Building 15 (Computer Office: Building 15 (Computer

Engineering Building) Room 414Engineering Building) Room 414 TA (Teaching Assistant): Will be TA (Teaching Assistant): Will be

announcedannounced

Page 3: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

31st Semester 2006

OutlineOutline

Introduction to ComputerIntroduction to Computer Programming LanguagesProgramming Languages How to Run a ProgramHow to Run a Program

Page 4: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

41st Semester 2006

Computer CategoriesComputer Categories

Personal Computer (PC)Personal Computer (PC) Desktop ComputerDesktop Computer Notebook (Laptop)Notebook (Laptop) PDA – Personal Digital Assistant PDA – Personal Digital Assistant

(Palmtop) (Palmtop)

High Computation Power ComputerHigh Computation Power Computer WorkstationWorkstation Supercomputer Supercomputer Mainframe Mainframe

Page 5: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

51st Semester 2006

What is a Computer?What is a Computer?

Computer is a device with Computer is a device with sophisticated electronic parts thatsophisticated electronic parts that operates under the control of operates under the control of

instructions (software) that is stored in instructions (software) that is stored in its own memory,its own memory,

accepts data (input),accepts data (input), manipulates data (process),manipulates data (process), and then produces information (output) and then produces information (output)

from the processing unitfrom the processing unit

Page 6: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

61st Semester 2006

Computer ComponentsComputer Components Input DevicesInput Devices Output DevicesOutput Devices Computing & Processing UnitComputing & Processing Unit Storage DevicesStorage Devices

Page 7: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

71st Semester 2006

CPU

MainMemory

Input Devices

HD

Secondary Memory

Output Devices

Computer ComponentsComputer Components

Page 8: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

81st Semester 2006

Computer ComponentsComputer Components

Printer (output)

Scanner

(input)

Mouse (input)Keyboard

(input)

Speaker (output)

Monitor (output)

CD, Hard disk(Storage)

System unit(processor, memory…)

Page 9: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

91st Semester 2006

Application SoftwareApplication Software Consists of programs that tell a Consists of programs that tell a

computer how to produce computer how to produce informationinformation

Some examples:Some examples: Word processing Word processing Electronic spreadsheetElectronic spreadsheet Database Database Presentation graphicsPresentation graphics

Page 10: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

101st Semester 2006

Other ApplicationsOther Applications

Computer-Aided DesignFinite Element Analysis

Graphing Tool

Page 11: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

111st Semester 2006

Computer MemoryComputer Memory

I - Main MemoryI - Main Memory II - Secondary II - Secondary

MemoryMemory

CPU

MainMemory

Page 12: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

121st Semester 2006

I - Main MemoryI - Main Memory

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

Memory Cell -> Byte -> BitMemory Cell -> Byte -> Bit 1 byte = 8 bits1 byte = 8 bits

Page 13: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

131st Semester 2006

II - Secondary MemoryII - Secondary Memory

Floppy disk (1.44 MB) Floppy disk (1.44 MB) Hard disk (80 GB, 100 GB)Hard disk (80 GB, 100 GB) CD-ROM (700 MB)/DVD-ROM (4.7/8.5 GB)CD-ROM (700 MB)/DVD-ROM (4.7/8.5 GB) Flash Memory (Compact Flash, MMC, SD)Flash Memory (Compact Flash, MMC, SD)

Etc…Etc…

1 KB (KiloBytes) = 21 KB (KiloBytes) = 210 10 = 1024 bytes= 1024 bytes

1 MB (MegaBytes) = 21 MB (MegaBytes) = 22020 = 1,048,576 bytes = 1,048,576 bytes

1 GB (GigaBytes) = 21 GB (GigaBytes) = 23030 = 1,073,741,824 bytes = 1,073,741,824 bytes

Page 14: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

141st Semester 2006

Main MemoryMain MemoryVS Secondary MemoryVS Secondary Memory

Main MemoryMain MemoryMuch fasterMuch fasterMore More

expensiveexpensiveVolatileVolatile

Secondary MemorySecondary MemorySlowerSlowerLess expensiveLess expensivePermanent (Non-Volatile)Permanent (Non-Volatile)

Page 15: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

151st Semester 2006

Computer Components Computer Components (Revisit)(Revisit)

Computer SpecificationComputer Specification IntelIntel®®   Pentium  Pentium®®  D Processors 820 Dual  D Processors 820 Dual

Core Core ((2x1MB L2 cache, 800MHz FSB2x1MB L2 cache, 800MHz FSB)) Genuine Windows Genuine Windows®®  XP Professional  XP Professional Up to 4 Up to 4 GB of GB of 533533 MHz Dual Channel Share MHz Dual Channel Share

dd22 DDR DDR22 SDRAM SDRAM IntelIntel®®  Graphics Media Accelerator  Graphics Media Accelerator 950 950 (G(G

MAMA950)950) Integrated Broadcom Integrated Broadcom®® Gigabit Gigabit44 LOM (LAN LOM (LAN

on Motherboard) on Motherboard)

Page 16: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

161st Semester 2006

OutlineOutline

Introduction to ComputerIntroduction to Computer Programming LanguagesProgramming Languages How to Run a ProgramHow to Run a Program

Page 17: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

171st Semester 2006

Programming LanguagesProgramming Languages

Machine LanguageMachine Language Assembly LanguageAssembly Language High-Level LanguageHigh-Level Language

Page 18: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

181st Semester 2006

High-level vs AssemblyHigh-level vs Assemblyvs Machine Languagevs Machine Language

High-level LanguageHigh-level Language

Assembly LanguageAssembly Language

Machine LanguageMachine Language

SUM = A * 2 + ALPHA/3; SUM = A * 2 + ALPHA/3; SUM = A * 2 + ALPHA/3; SUM = A * 2 + ALPHA/3;

MULL3MULL3 A, #2, AXA, #2, AXDIVL3DIVL3 #3, ALPHA, BX#3, ALPHA, BXADDL3ADDL3 AX, BX, SUMAX, BX, SUM

MULL3MULL3 A, #2, AXA, #2, AXDIVL3DIVL3 #3, ALPHA, BX#3, ALPHA, BXADDL3ADDL3 AX, BX, SUMAX, BX, SUM

000110000110001100001100011001111000110011111001100011110011000111

000110000110001100001100011001111000110011111001100011110011000111

Page 19: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

191st Semester 2006

High-Level LanguagesHigh-Level Languages Procedural LanguageProcedural Language

FortranFortran CobolCobol BasicBasic CC PascalPascal

Object-Oriented Language Object-Oriented Language C++C++ JavaJava C#C#

Functional LanguageFunctional Language LispLisp

Logic LanguageLogic Language PrologProlog

Page 20: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

201st Semester 2006

TranslatorsTranslators

LanguageLanguage TranslatorTranslator

AssemblyAssembly AssemblerAssembler

High-LevelHigh-LevelLanguagesLanguages

CompilersCompilers

Page 21: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

211st Semester 2006

Translation Process Translation Process (C#)(C#)

CompilerCompiler(on computer)(on computer)

InputInput

Output

prog.csSource fileSource file

prog.exeExecutable fileExecutable file

Page 22: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

221st Semester 2006

OutlineOutline

Introduction to ComputerIntroduction to Computer Programming LanguagesProgramming Languages How to Run a ProgramHow to Run a Program

Page 23: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

231st Semester 2006

How to run program?How to run program?

After boot ProcessAfter boot Process May be Windows XP (Operating May be Windows XP (Operating

System) has been loaded into Main System) has been loaded into Main MemoryMemory

User tell OS to load program User tell OS to load program progprog OS Load program OS Load program progprog from the from the

hard disk hard disk into the memoryinto the memory

OS run program from the memoryOS run program from the memory

Page 24: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

241st Semester 2006

SummarySummary

Computer BasicComputer Basic Programming LanguageProgramming Language Running a ProgramRunning a Program

Page 25: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

251st Semester 2006

To DoTo Do

Add yourself on M@xLearnAdd yourself on M@xLearn Go to Go to http://course.ku.ac.thhttp://course.ku.ac.th Section 5Section 5 Instructor: Instructor: Sitichai SrioonSitichai Srioon

Upload your pictureUpload your picture

Page 26: 1 st Semester 2006 1 Introduction to Computer and Programming Computer Engineering Department Kasetsart University, Bangkok, THAILAND

261st Semester 2006

Questions?Questions?