Вы находитесь на странице: 1из 40

Microcontroller Based Design

Muhammad Usman Rafique

Week 1 - Introduction

M. Usman Rafique

Air University, Spring 2015

Course Introduction

Microcontroller Based Design MT 253

4 Credit Hours

Theory 2
Lab 2

Instructor

M. Usman Rafique

Lab

Control Instrumentation Lab, Mini Block


Lab Engineer: Ahmad Abdullah

M. Usman Rafique

Air University, Spring 2015

Course Introduction
Course Website

sites.google.com/site/mtsengg/courses/micro
Microcontroller Based Design

Lecture Notes, Assignments and Grading will be uploaded


on the course web

M. Usman Rafique

Air University, Spring 2015

Course Outline
Week
1

Introduction

8051Microcontroller
Architecture and Hardware

Assembly Language

Assembly Language Contd.

Timers and Counters

Serial Port

Interrupt

8, 9

Design and Interface Examples

10

Midterm Exam

11

PIC 18 F Microcontroller
Introduction, Architecture, I/O Pins

12

Programming in C

13

Timers / Counters

14

Using Internal ADC of PIC

15, 16

Peripherals of PIC 18F Microcontrollers

17

Topic

Revision

M. Usman Rafique

Air University, Spring 2015

Grading Criteria
Module

Percentage

Quizzes

Assignments

Midterm Exam

15

Projects

30

Final Exam

45

Note: Assignments will be similar to the projects


6

M. Usman Rafique

Air University, Spring 2015

Books
8051 Microcontroller
I. Scott Mackenzie and R.C. Phan, The 8051 Microcontroller,
Fourth Edition, Pearson Education 2007
Muhammad Ali Mazidi and J. G. Mazidi, The 8051
Microcontroller and Embedded Systems, Pearson Education
2006

PIC 18F Microcontroller


M. Ali Mazidi, R. D. Mickinlay and D. Causey, PIC
Microcontrollers and Embedded Systems, Pearson Education
2008
7

M. Usman Rafique

Air University, Spring 2015

Projects
Projects

Projects will be individual


Only PCBs are acceptable.
Hardware sharing is NOT allowed
Documentation is compulsory

Final project

Can be done in groups of up to 3 students

Assignments

Individual

In case of copying Zero Points will be awarded to all parties


involved
8

M. Usman Rafique

Air University, Spring 2015

Projects

8051

PIC

Final Project
9

No.

Description

Deadline

Percentage

Generic Board

Week 02

05

LEDs

Week 04

05

Serial Communication

Week 07

07

Interface Project

Week 09

08

T1

Lab Test

Week 11

15

Generic Board

Week 12

05

Interface Project 2

Week 15

10

T2

Lab Test

Week 16

15

[Submit Proposals]

Week 17

30

M. Usman Rafique

Air University, Spring 2015

Labs

2 Labs per week

Experiments as well as problem solving

Students are welcome to discuss queries

10

M. Usman Rafique

Air University, Spring 2015

Prerequisites

Number Systems

Electronics

Basic concepts

DLD

Binary
Decimal
Hexadecimal

Logic Gates
Multiplexer, De-multiplexer
Encoder, Decoder
Basic Concepts

Computer Programming

C
Basic Concepts

Clear and practice these topics before this course


11

M. Usman Rafique

Air University, Spring 2015

Introduction
What is a Computer?

12

M. Usman Rafique

Air University, Spring 2015

Introduction
What is a Computer?

Computer

Device capable of

13

Performing computations
Making Logical Decisions

Works billions of times faster than human beings

M. Usman Rafique

Air University, Spring 2015

Introduction
What is a Computer?

Programs

Set of instructions that process data


Guide computer through orderly sets of actions specified by
Programmer

Computer System

Consists of various hardware devices

14

Keyboard
Screen
Disks
Memory
Processing Units
M. Usman Rafique

Air University, Spring 2015

Introduction
Computer
RAM
Inputs
ALU

Central Processing
Unit

Outputs

ROM

15

M. Usman Rafique

Air University, Spring 2015

Introduction
Every computer consists of
Input Unit

1.

Receiving section of computer


Gets data from input devices e.g. Keyboard, Mouse etc

Output Unit

2.

Puts information on various output devices

16

Monitors
Printouts
Speakers

M. Usman Rafique

Air University, Spring 2015

Introduction
Every computer consists of
Central Processing Unit (CPU)

3.

Arithmetic Logic Unit (ALU)

4.

17

Administrative section of computer


Supervises other sections

Performs calculations (addition, subtraction, multiplication and


division)
Can make decisions and comparisons

M. Usman Rafique

Air University, Spring 2015

Introduction
Every computer consists of
Memory Unit

5.

Secondary Storage Units

6.

18

Rapid access, Fast


Temporarily retains information; lost when powered off
Also called Memory, Primary Memory or Random Access Memory
(RAM)

Long-term high capacity storage


Stores programs Or data not currently being used
Hard drives, Disks, CDs etc
Slower than primary memory
M. Usman Rafique

Air University, Spring 2015

Introduction

Computer Architecture

Von Neumann Vs Harvard

RISC Vs CISC

19

Instruction = Program / Code


Data = Information being used

Instruction Set = Set of Instructions (low level) that CPU can process

M. Usman Rafique

Air University, Spring 2015

Von Neumann Vs Harvard


Von Neumann Architecture

A single memory has

A single Bus connects CPU with the memory


At a time, either Instruction can be read OR data can be read
or written
2 cycles complete an
instruction

20

DATA: the information being used


Instructions: Program to be executed

1st : Read instruction


2nd : Read/Write Data

Image courtesy Dr. Javaid

M. Usman Rafique

Air University, Spring 2015

Von Neumann Vs Harvard


Harvard Architecture

Separate Memories for

21

DATA: the information being used


Instructions: Program to be executed

Separate Buses connects CPU with the memory


When an instruction is being executed, data for next
instruction is fetched,
known as Pipelining.

Image courtesy Dr. Javaid

M. Usman Rafique

Air University, Spring 2015

Von Neumann Vs Harvard


Von Neumann

Harvard

Same memory keeps Data


and Instructions

Separate memories for data


and instructions

A single bus connects CPU


with memory

Two buses between memory


and CPU

At a time, either reading


an instruction OR reading
/ writing data

Reading / Writing memory


and reading an Instruction
can be done simultaneously

22

M. Usman Rafique

Air University, Spring 2015

RISC Vs CISC
CISC
Complex Instruction Set Computer

Instruction Set is set of all Instructions (low level Commands)


that CPU can execute

Primary goal of CISC Architecture is to complete task in as few


lines of assembly as possible

Processor that understands and performs series of actions for


each assembly command

Instructions may be variable in length


23

M. Usman Rafique

Air University, Spring 2015

RISC Vs CISC
RISC
Reduced Instruction Set Computer

Compact Uniform instructions

Reduces chip complexity by using simpler instructions

Few types of instructions to operate at high speed

Requires more RAM

Has become more popular due to decreasing RAM cost


24

M. Usman Rafique

Air University, Spring 2015

RISC Vs CISC
CISC

RISC

Large Instruction set

Small and Compact


Instruction set

Less lines of code

More lines of Code

Variable length of
instructions

Uniform length of
instructions

Complex architecture

Simple architecture

25

M. Usman Rafique

Air University, Spring 2015

Programming Languages

Programming Language: A set of rules, symbols and


special words used to construct a computer program

High Level Language

Low Level (Assembly Language)

In which a mnemonic is used to represent each machine language


instruction

Machine Language

26

A computer language that is more intuitive to the humans. Closer to


plain English

The binary representation of instructions a computer can perform


M. Usman Rafique

Air University, Spring 2015

Programming Languages

High Level Languages

Single statements accomplish substantial tasks

Translated to machine language

Instructions comprehensible to humans

27

Compilers convert to machine language


Conversion takes much time

Looks mostly like general English


Contains common mathematical notations

M. Usman Rafique

Air University, Spring 2015

Programming Languages

Low Level (Assembly Language)

English-like abbreviations

Translated to machine language

Assemblers convert to machine language


High speed conversion

Easier for human interpretation as compared to Machine


language

28

Represent basic operations of computer

Still tedious and difficult


Many instructions for simple tasks
These problems led to High Level languages
M. Usman Rafique

Air University, Spring 2015

Programming Languages

Machine Language

Only language understood directly by computer

Defined by computers hardware design

Difficult to understand for human readers

Ultimately reduced binary code i.e. 0s and 1s

Slow, tedious and error prone

29

Machine-dependent

Led to assembly language


M. Usman Rafique

Air University, Spring 2015

Programming Languages
Assembly is a Low Level Language

High Level

FORTRAN
Pascal
COBOL
BASIC

Middle Level

C++
C

Low Level

Assembly

30

M. Usman Rafique

Air University, Spring 2015

Programmers Model of Computer

It does not matter whether the machine is


microprocessor / microcontroller based or a larger
machine

Programmers see the computer as having 3


characteristics

31

Address Space
Registers
Instruction Set

M. Usman Rafique

Air University, Spring 2015

Address Space

Address Space is set of storage locations, each of which


has an Address

The size of Address Space is defined by number of bits the


computer uses to form an address

A machine that uses 8 bits for address can access at most


28 = 256 locations

32

M. Usman Rafique

Air University, Spring 2015

Registers

Registers serve many important functions, including


temporary storage of data

The register set of a computer is fundamental to its


operation

Registers may be:

33

General Purpose
Special Function

M. Usman Rafique

Air University, Spring 2015

Instruction Set

Set of commands that computer can obey

Machine codes are generated from instruction set

Very simple commands

Instruction set specifies set of operations e.g. ADD,


SUBTRACT, JUMP and Addressing Modes etc

34

M. Usman Rafique

Air University, Spring 2015

Buses

Bus Collection of wires through which data is


transmitted from one part of computer to another

Buses can be thought of as highways of computer on


which data travels

Types of Buses
1. Data Bus
2. Address Bus
3. Control Bus

35

M. Usman Rafique

Air University, Spring 2015

Data Bus

Data is shared among various components inside a


computer using wires known as Data Lines

Group of data lines is called Data Bus

Each data line carries a bit i.e. it can be Off or On

Data bus is Bi-Directional

36

M. Usman Rafique

Air University, Spring 2015

Address Bus

Addresses are accessed in a computer using wires known


as Address Lines

Group of address lines is call Address Bus

Address bus is Uni-directional

37

It only specifies the address of the target location

M. Usman Rafique

Air University, Spring 2015

Control Bus

These lines control the operation of a computer

For example, CPU uses these lines to specify whether a


read or write is required

This is done by different Control Lines

38

M. Usman Rafique

Air University, Spring 2015

Next Lecture

What is a microprocessor?

What is a microcontroller?

What are the differences between both?

Which one is better?

39

M. Usman Rafique

Air University, Spring 2015

Acknowledgement
Material used with permission of

Dr. Javaid Iqbal

Head of Department, Mechatronics Engineering


College of EME, NUST

I am extremely thankful to Dr. Javaid who has been a great


teacher and still helps and supports me

40

M. Usman Rafique

Air University, Spring 2015

Вам также может понравиться