Ch-1_1

29
ECP2216 - Microcontroller And Microprocessor Systems 2011 Objective: Microprocessor and microcontroller Software - Assembly language programming (8051) Hardware - Interface design Credit Hours: 3 credit hours 3 hours of lecture per week 1 hour of tutorial per week (except Week 1) 2 lab sessions

Transcript of Ch-1_1

Page 1: Ch-1_1

ECP2216 - Microcontroller And Microprocessor

Systems 2011

Objective:• Microprocessor and microcontroller• Software - Assembly language programming

(8051)• Hardware - Interface design

Credit Hours:• 3 credit hours• 3 hours of lecture per week• 1 hour of tutorial per week (except Week 1)• 2 lab sessions

Page 2: Ch-1_1

ECP2216 - Microcontroller And Microprocessor

Systems 2011

Pre-requisite:• EEN1036 :Digital Logic Design

Textbook/Reference: Koo Voon Chet et al., “The 8051 Cookbook: A

Complete Guide to Architecture, Programming and Interfacing”, 2nd Edition, Prentice Hall, Malaysia, 2006.

Walter A. Triebel and Avtar Singh, “The 8088 and 8086 Microprocessors, The: Programming, Interfacing, Software, Hardware, and Applications”, 4th Edition, Prentice Hall, US, 2003.

Page 3: Ch-1_1

Syllabus 2011 Chapter 1 Microprocessor Basics

A basic microprocessor system: the CPU, memory, I/O, and buses subsystems

Basic operation of a microprocessor system: fetch and execute cycle, the architecture of microprocessors and microcontrollers, some typical 8-bit microcontrollers and their features, memory read and write operations.

Page 4: Ch-1_1

Syllabus 2011

Chapter 2 The 8051 MicrocontrollerFeatures of the 8051 family, block diagram and definitions of the pin of the 8051, I/O port structure, memory organization: general purpose RAM, bit addressable RAM, register bank, special function registers, external memory, memory space mapping and decoding, bus control signals timing, a typical 8051 micro-controller based system.

Page 5: Ch-1_1

Chapter 3 Instruction Set and Assembly Language Programming

Addressing modes, the 8051 instruction set and typical examples, assembler operation, assembly language format, assembler directives, operation of assemblers and linkers, programming examples.

Syllabus 2011

Page 6: Ch-1_1

Syllabus 2011 Chapter 4 On-chip Peripheral Devices and

Interrupt System

I/O ports: Operations and uses of port 0, port 1, port 2, port 3, timers: their operations, programming, and applications, serial port: operations and programming, typical applications.

Interrupt System: Organization of the interrupt system, interrupt vectors, interrupt timings, serial port interrupts, and external interrupts, implementation of single and multiple interrupts.

Page 7: Ch-1_1

Syllabus 2011

Chapter 5 Interfacing Examples

Interfacing to external memory, keypad, seven-segment LED display, ADC and DAC chips, and input / output port expansion, description and uses of hardware development tools.

Page 8: Ch-1_1

Syllabus 2011

Chapter 6 Contemporary Microprocessors

Overview of different generations of microprocessor, highlights of architectural and technological advancement of IA-32 processors (80386, 80486 and Pentium), 64-bit processors (e.g. Intel Itanium, AMD AMD64), multi-core processors (e.g. Intel Core2Duo, AMD X2).

Page 9: Ch-1_1

Learning OutcomeAt the completion of the subject, students should be able to perform the following tasks:

LO1 – Describe the fundamental features and operation of contemporary microcontroller and microprocessor. (cognitive – remembering, level 1) - 20%

LO2 – Explain the pin configuration and memory organization of a typical 8051 microcontroller. (cognitive - understanding, level 2) - 13%

LO3 – Illustrate the 8051 microcontroller memory expansion capability. (cognitive - understanding, level 2) - 9%

LO4 – Analyze the MCS-51 Instruction Set. (cognitive - analyzing, level 4) - 23%

LO5 – Develop assembly language source code for applications that use I/O ports, timer and single/multiple interrupts. (cognitive - creating, level 6) - 24%

LO6 - Produce interfacing examples using 8051 microcontroller. (cognitive - applying, level3) - 11%

Page 10: Ch-1_1

Assessment 2011 (proposed)

• Lab Experiments: 10% (Assessment) • Midterm Test:

10% (Chapter 1 – 3)• Assignment:• 10% (Assessment)

20% (Hardware based, group project)

• Final Exam: 50%

Page 11: Ch-1_1

Previous Assignment

Intelligent Car (2003)

Page 12: Ch-1_1

Previous Assignment

Calculator (2004)LED Dot Matrix Display

(2005)

Page 13: Ch-1_1

Previous Assignment

(2007)

Page 14: Ch-1_1

Previous Assignment

A Queuing Display System using 8051-family microcontroller(2008)

Automatic room light controller with visitor

counter (2009)

Page 15: Ch-1_1

Previous Assignment

An electronic lock with keypad and LCD display.(2010)

Page 16: Ch-1_1

Useful URLs and software

URL:1. www.8052.com - with tutorial and links to

various useful resources2. www.atmel.com - the producer of the

popular 8951 microcontroller (an 8051 variant)

3. developer.intel.com - the developer site from the mother of 8051 microcontroller

Software:1. 8052 Simulator – for simulating and debugging

programs written for an 8052-compatible microcontroller within the Windows environment (http://www.vaultbbs.com/sim8052/)

2. Fet89c5x IDE V2.7 (http://www.eee.com.my or MMLS)

Page 17: Ch-1_1

ECP2216 Microcontroller and Microprocessor Systems

Bit: The basic unit of information in a computer, which stands for “binary digit,” with the values 0 or 1 (low or high) only.

Byte: A group of 8 bits.Nibble: A group of 4 bits (half a byte)

Processor word length- The size of the group of bits a processor is designed to

use as a single unit or word- E.g. 8-bit, 16-bit, or 32-bit computer.

Most Significant Bit (MSB) & Least Significant Bit (LSB):- E.g. For an 8-bit binary number

1 0 0 1 0 1 1 02

MSB LSB

PRELIMINARIES

CHAPTER-1

Page 18: Ch-1_1

Review of Number Systems:

- Decimal (010, 110, 210,…….., 910)- Binary (02, 12)- Hexadecimal (016, 116, 216,………E16, F16)- Octal (08, 18, 28,…..78)

0 1 0 12 base

position

digit10

0123

5

21202120

positionbasedigit

Page 19: Ch-1_1

Decimal

Binary

OctalHexa

decimal

Conversion between different number systems

Page 20: Ch-1_1

Exercises 1

Convert the following numbers:• 0011 10102 to decimal• 2610 to binary• 0011 10102 to octal• 0011 10102 to hexadecimal• 378 to binary• 3F16 to binary

If convert octal and hexadecimal numbers to decimal or vice versa?

Page 21: Ch-1_1

ASCII code:(American Standard Code for Information Interchange)

A character is represented by a 7 bit binary number (X6…X0)

E.g. A 100 00012 41H

a 110 00012 61H

BCD code: Binary-Coded Decimal

Each decimal digit is represented by its' 4-bit binary equivalent.

E.g. 9810 0110 00102 1001 1000BCD

Alphanumeric Codes -

alphabets, characters & numbers are

represented by a unique binary

code

Page 22: Ch-1_1

1’s and 2’s Complement number: For a negative number, -A: 1's complement = A'2’s complement = A' + 1Eg. Find the 2’s complement number for a 4-

bit system

X = 710 = 01112

X’=10002

2’s complement X’+ 1 = 10012 = -710

Range of an N-bit 2’s complement number (signed number), X: -2N-1 ≤ X ≤ 2N-1-1

MSB = 1 represents negative number

Exercise: What is the negative counterpart of 0011 10102?

Page 23: Ch-1_1

Logic CircuitThe output is decided by the current input onlyBasic logic gates: inverter, AND, OR,

NAND, NOR, XORE.g. Adder, decoder, multiplexer and etc.

A B Y0101

0011

OR

A B Y0101

0011

AND

A B Y0101

0011

NOR

A B Y0101

0011

NAND

A B Y0101

0011

XOR

Combinational

Vs

Sequential

Page 24: Ch-1_1

Arithmetic OperationAddition:- The sum of a binary number and its 2’s complement will be

zero

- E.g. Consider 4510 is added to its 2’s complement counterpart in an 8-bit system:

1+

01111000000

1

8-b it results

010010110000

111111

1carry out

auxiliary carry

[45 ][-45 ]

Page 25: Ch-1_1

Subtraction:

Multiplication:

- 00101001

01100111

1011001011

Borrow

R esults in 8-b it 2 'scom plem ent

[77 ][100][-23 ]

10101011

10110000

10110000

x

0001 1000

M ultip licand

M ultip lier

Partia lproduct

P roduct

[13 ][5 ]

[65 ]

Page 26: Ch-1_1

Division:

Overflow:- Consider the addition of two 8-bit signed numbers

- An error has occurred as the results is outside the range

-128 ≤ X ≤ 127

Range of an N-bit 2’s complement number, X: -2N-1 ≤ X ≤2N-

1-1

1011001000100110+10001101

[77][100]

[-79 !? ]

1011010000101

00101 01

00101 1

0011

0 1 1D ivisor D ividend

Q uotient

R em ainder

00

00

Partia lrem ainder

[4 ][11 ][45 ]

1 0 1 1 0 0 0 1 [-79!?]

Page 27: Ch-1_1

Parity: number of ‘1’Even parity:

Set the parity bit to 1 or 0 to make the number of ‘1’ is even

Odd parity:

Set the parity bit to 1 or 0 to make the number of ‘1’ is odd

10110010Even parity 0

O dd parity 101100101

Page 28: Ch-1_1

Pass Year Exam Question 1

Carry out the following for this number 168 :i. Expand it into 8-bit binary number

ii. Find the counterpart of this number using 2’s complement representation

iii. Find the decimal value obtained from (ii)

Page 29: Ch-1_1

Pass Year Exam Question 2