Anda di halaman 1dari 33

Overview

Instructor: ChaoChao-Ching Ho
National Yunlin University of Science and Technology

Robotic Embedded System Lab

Overview






When and where to take class


Who should take the class
Why C language
What is C and C++ language
How to learn C and C++ by steps

When and where to take class




Office Hours



Classroom



EM102 (BC), EM327 (D)


Thursday, 09:10- 12:00 (BCD)

Class web page




10:00 -12 :00, Wednesday


Room EM 317

http://sites.google.com/a/smartrobot.co.cc/robot/courses/programming

Class Forum


http://groups.google.com/group/2009programming?hl=zh-TW

Textbooks


Textbook:


References:





C .
C/C++().
C, , .
A Book on C (Programming in C), 4th Edition, Al
Kelley and Ira Pohl, Addison-Wesley.

Literature

A Book on C:
Programming in C

Reference

4th edition

Al Kelley, Ira Pohl


Addison-Wesley
ISBN: 0-201-18399-4
752 pages
Dezember 1997

C Programming Language
2nd Edition

Reference

Brian Kernighan, Dennis Ritchi


Prentice - Hall
ISBN: 0-131-10362-8
274 pages
Dezember 1998

Grading


Homework (20%)






Four homework assignments, 5% each

Mid-term Exam (30%)


Final project (40%)
Seminar Presentation (10%)

Course Topics
)
)
)

)
)
Mid-term Exam
Storage Class ()
Structure and Union ()
Disk File I/O ()
Laboratory ()
8051 Microcomputer (8051)
Serial Communication ()
8x8 LED Experiment (LED)
System Call and Windows API(Windows API)

Overview

C Environment (C
Data Type and Variable (
Operator and Expression (
Flow Control (
)
Laboratory (
)
Function and Macro (
Pointer and Array (



















Presentation

Who should take the class




If youre interested in the fields of











Image Processing
Animation
Computer Graphics
Automatic Optical Inspection
Robotic
3D Scanning technology
Financial engineering
Control engineering

Computers

Computer Architecture
5661
5662
5663
5664
5665
5666
5667
5668
5669

Address
bus

Main memory

Data bus
Input devices

Central Processing Unit

CPU

Output devices

Secondary memory

Software


01

System Program

Application Program
(Operating System)(Compiler)(Assembler)

(Linker)

Office

How the Program Executes

Programming Language

Generations

Machine Languages
Assembly Languages
High Level Languages
Application-Generation Languages
Query Languages
Logic-Oriented Languages

Machine Language


Machine Language

01
01
01

01

Low Level Language




Low-level Language

01
Assembly
Language
01

INCIncrement

Low Level Language

8051
00000100
10000100

8051
INC
DIV

8051

x86

x86

0000001111001000

ADD CX,AX

101110010011010000010010

MOV CX,1234H

CX1234H

x86

Low Level Language


1.
2.
3.

CPU
0
1

CPU
CPU

High Level Language




High-level Language

10

High Level Language




compilerinterpreter


(machine independent)
portable
AB

B
B


High Level Language




Batch

object file
execute file
CC++gccg++VC++
BCBPascalObject PascalDelphiKylix

ANSI-Cmath

math


11

High Level Language

High Level Language




JavaScriptVBScriptPython

12

C and C++ Language

Why Programming Language




Visual

C/C++
Basic Java Object Pascal C#
C/C++





C/C++
C
C++
C/C++Linux/Windows/MS-DOS/Mac
JavaVirtual Machine
C/C++


8051
C

C/C++

13

C and C++ Language




CC++



C++C
C++


C++C
C++

History of C Language


CDennis Ritchie1972

CC
BKen ThompsonB
Martin RichardsBCPL
CUNIX
1973UNIX
C

14

History of C Language


70Ken ThompsonDennis Ritchie


K & R C
ANSI1983CC
ANSI-CC
CANSI-C
C

C
C

C
C++CC++

History of C Language


CC

BKen ThompsonDennis Ritchie


UNIXBC
C

UNIXC

UNIXCC
CC
CCC

C10

10C

CANSI-C

15

History of C Language

B
C++Java C#
C

31

Structured Programming

16

Modules


Modules

Libraries


Libraries
ToolboxC
C

Information
Hiding

17

Object Programming


Object

Structural Programming Language




(Structural Programming Language)




C
C

forwhilegoto
CgotoC

goto
C

18

Object Programming C++




Bjarne StroustrupC(OOD
Object-Oriented Design)C++C++
Object-Oriented Program LanguageOOPL
C++CC++

Object-Oriented Programming
OOP

(attribute)

(behavior)OOPproperty
methodC++

C and C++


CC++C++
C
C++C
C++

C++OOPC++
CC++
CC
C++C
C

19

Advantages of C Language

Advantages of C Language


C


C
CC

CC
CC

CPreprocessor

20

C (1/4)


interpreter

compiler

C C++FortranPascal

41

C (2/4)


C



BASIC

( )

21

C (3/4)


( )

C (4/4)


( )

22

Advantages of C Language


1.

(portable)

2.

(cross-platform)

3.

4.

(pointer)

5.

C


C++ Java C OOP

Flash ActionScript C/C++

( )

23

Flow Chart and Implementation

( )

24

( )








25

Debugging
If you make a mistake of syntax in your code
(e.g. leaving out a semicolon), the compiler will
always tell you the first line where it sees a
problem often the line after the problem
actually occurred. Dont be discouraged by a
long stream of error messages fix the first one,
and the others often disappear.

semantic
error


syntax error


(de-bug)

bug

http://www.computersciencelab.com
52

26

C/C++


CC++

C/C++


Step1

C/C++
WindowsLinuxVimpico
.c.cppC
.cC++.cpp
Step2
GCCgcc/g++
object file
Step3

Step4

27

Compiler


Compiler (cont.)


28

Compiler (cont.)


(1)(scanner)

(token)
(lexical analysis)
(regular expression)
(finite state machineFSM)

1-3
A~Z
0A~Z0~9

ID == [A-Z][A-Z0-9]*

Compiler (cont.)

29

Compiler (cont.)


(2)(parser)


(syntax analysis)
(grammar)C

compound-statement:
{ declaration-listopt statement-listopt }
declaration-list:
declaration
declaration-list declaration
statement-list:
statement
statement-list statement

Compiler (cont.)


(3) (semantic routine)




(intermediate
representationIR)

Cc=a+b;
CC
a,b,c

30

Compiler (cont.)


(4) (optimization processor)




(5) (code generator)




one-pass

(retargetable compiler)(cross compiler)

compiler

Compiler (cont.)


(Pre-Processor)


31

C Language Coding


C


C++ C
01
02
03
04
05
06
07
08
09
10
11

/* prog1_1,
C
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Hello C!\n");
printf("Hello World!\n");

/*
/*

Hello C! */
Hello World! */

system("pause");
return 0;
}

32

Thanks you.

33

Anda mungkin juga menyukai