Vous êtes sur la page 1sur 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

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 Microcontroller Features 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.

Syllabus 2011


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


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, sevensegment 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 Outcome
At 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

Automatic room light controller with visitor counter (2009) A Queuing Display System using 8051-family microcontroller (2008)

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 resources 2. 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

CHAPTER-1

PRELIMINARIES
Bit: Byte: Nibble: The basic unit of information in a computer, which stands for binary digit, with the values 0 or 1 (low or high) only. A group of 8 bits. 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
MSB

0
2 LSB

Review of Number Systems: - Decimal (010, 110, 210,.., 910) - Binary (02, 12) - Hexadecimal (016, 116, 216,E16, F16) - Octal (08, 18, 28,..78)
position

digit v base position


base

0 1 0 12
digit

! 0 v 23  1v 2 2  0 v 21  1v 2 0 ! 510

Conversion between different number systems Decimal

Binary
Hexa decimal

Octal

Exercises 1
Convert the following numbers:

0011 10102 to decimal 2610 to binary 0011 10102 to octal 0011 10102 to hexadecimal 378 to binary If convert octal and 3F16 to binary

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 (X6X0) Alphanumeric Codes E.g. A 100 00012 41H alphabets,

110 00012

61H

characters & numbers are represented by a unique binary code

BCD code: Binary-Coded Decimal


Each decimal digit is represented by its' 4-bit binary equivalent. E.g. 9810 0110 00102 1001 1000BCD

1s and 2s Complement number:  For a negative number, -A:


1's complement = A' 2s complement = A' + 1 Eg. Find the 2s complement number for a 4-bit system X = 710 = 01112 MSB = 1 represents negative number X=10002 2s complement X+ 1 = 10012 = -710  Range of an N-bit 2s complement number (signed number), X: -2N-1 X 2N-1-1
Exercise: What is the negative counterpart of 0011 10102?

Logic Circuit
The output is decided by the current input only Basic logic gates: inverter, AND, OR, NAND, NOR, XOR E.g. Adder, decoder, multiplexer and etc.
OR AND NOR NAND

Combinational Vs Sequential

XOR

A 0 0 1 1

B 0 1 0 1

A 0 0 1 1

B 0 1 0 1

A 0 0 1 1

B 0 1 0 1

A 0 0 1 1

B 0 1 0 1

A 0 0 1 1

B 0 1 0 1

Arithmetic Operation Addition:


- The sum of a binary number and its 2s complement will be zero - E.g. Consider 4510 is added to its 2s complement
counterpart in an 8-bit system:

auxiliary carry

1 0 carry out + 1 1 0

1 0 1 0

1 1 0 0

1 0 1 0

1 1 0 0

1 1 0 0

1 0 1 [45] 1 1 [-45] 0 0

8-bit results

Subtraction:
Borrow 1 1

0 1 0 0 - 0 1 1 0 1 1 1 0

1 1 0 1 [77] 0 1 0 0 [100] 1 0 0 1 [-23]

Results in 8-bit 2's complement

Multiplication:
1 0 1 0 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0
ultiplic n ultiplier rti l pro uct ro uct

[13] [ ]

0 1 1 0 0 0 0 1 0 0

0 0 1

Division:
[4] Divisor 0 1 0 0 0 0 1 0 0 1 0 0 Partial 0 remainder 1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1
Quotient Dividend

[11] [45]

Remainder

Overflow:
- Consider the addition of two 8-bit signed numbers
0 + 0 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 [77] 0 [100] 1 [-79!?] 1 [-79!?]

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


-128 X 127

 Range of an N-bit 2s complement number, X: -2N-1 X 2N-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

Even parity 0 Odd parity 1

0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 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 2s complement representation iii. Find the decimal value obtained from (ii)

Pass Year Exam Question 2