Ch-1_1

Preview:

Citation preview

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

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.

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.

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.

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

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.

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.

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).

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%

Assessment 2011 (proposed)

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

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

20% (Hardware based, group project)

• Final Exam: 50%

Previous Assignment

Intelligent Car (2003)

Previous Assignment

Calculator (2004)LED Dot Matrix Display

(2005)

Previous Assignment

(2007)

Previous Assignment

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

Automatic room light controller with visitor

counter (2009)

Previous Assignment

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

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)

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

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

Decimal

Binary

OctalHexa

decimal

Conversion between different number systems

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?

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

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?

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

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 ]

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 ]

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!?]

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

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)

Pass Year Exam Question 2