EE332 Lecture 1 PowerPoint Slides

21
Introduction to Microprocessors Number Systems and Conversions No. 1-1 9/6/00 Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller

Transcript of EE332 Lecture 1 PowerPoint Slides

Page 1: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-1 9/6/00

Chapter 1: Introduction to 68HC11

The 68HC11 Microcontroller

Page 2: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-2 9/6/00

What is a computer?

Software

Hardware

Computer Hardware Organization

Control unit

Arithmetic logic unit

Registers

common bus

memory

program

storage

data

storage

output

unit

input

unit

Figure 1.1 Computer hardware organization

Page 3: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-3 9/6/00

The processor

Registers -- storage locations in the processor

Arithmetic logic unit

Control unit

program counter keeps track of the address of the next instruction to be executed

status register flags the instruction execution result

The microprocessor

A processor implemented on a very large scale integration (VLSI) chip

Peripheral chips are needed to construct a product

The MicrocontrollerThe processor and peripheral functions implemented on one VLSI chip

Page 4: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-4 9/6/00

Features of the 68HC11A8 microcontroller

- 8-bit CPU

- 256 bytes SRAM

- 512 bytes EEPROM

- 8 KB ROM

- 3 input capture channels

- 5 output compare functions

- one 8-bit pulse accumulator

- one serial communication interface (SCI)

- one serial peripheral interface (SPI)

- real-time interrupt (RTI) circuit

- 8-channel 8-bit A/D converter

- computer operate properly (COP) watchdog system

Page 5: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-5 9/6/00

ROM-8KB

RAM-256 bytes

EEPROM-512 bytes

PORTA

PULSE ACCUMULATOR

PERIODIC INTERRUPT

COP WATCHDOG

PAIOC2

OC3OC4OC5

OC1

IC1

IC2IC3

PA7

PA6PA5PA4PA3PA2PA1

PA0

PE7

PE6PE5PE4

PE3

PE2

PE1PE0

PORTE

V REFH

V REFL

A/DCONVERTER

DA

TA

DIR

EC

TIO

N

PORTD

SSSCK

MOSI

MISO

SPI

TxD

RxDSCI

PD5

PD4

PD3

PD2

PD1

PD0

M68HC11 CPU

ADDRESS DATA BUS

INTERRUPTS

RESET

XIRQ

IRQ(V PPBULK ) HANDSHAKE I/O

DATA DIRECTION C

PORT CPORT B

PARALLELI/O

SINGLECHIP

PB7

PB6

PB5

PB4

PB3

PB2

PB1

PB0

PC7

PC6

PC5

PC4

PC3

PC2

PC1

PC0

STRA

STRB

A15

A14

A13

A12

A11

A10

A9

A8

AD7

AD6

AD5

AD4

AD3

AD2

AD1

AD0

R/W ASEXPAND

OSCILLATOR

XTAL

EXTAL

E

MODALIR

MODB(V STBY )

V DD

V SS

MODESELECT

POWER

Figure 1.2 68HC11A8 block diagram (redrawn with permission of Motorola)

Page 6: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-6 9/6/00

Examples of microcontroller applications

- Displays

- Printers

- Keyboards

- Modems

- Charge card phones

- Refrigerators

- Washing machines

- Microwave ovens

- Automobile engine fuel injection

- Fax machines

- Motor speed control

- etc.

Page 7: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-7 9/6/00

Semiconductor memory

Random-access memory (RAM): same amount of timeis required to access any location on the same chip

Read-only memory (ROM): can only be read but notwritten by the processor

-

-

Random-access memory

- Dynamic random-access memory (DRAM): periodic refresh is required to maintain the contents of a DRAM chip

- Static random-access memory (SRAM): no periodic refresh is required

Read-only memory

- Mask-programmed read-only memory (MROM): programmed when being manufactured

- Programmable read-only memory (PROM): the memory chip can be programmed by the end user

Page 8: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-8 9/6/00

- Erasable programmable ROM (EPROM) 1. electrically programmable many times 2. erased by ultraviolet light (through a window) 3. erasable in bulk (whole chip in one erasure operation)

- Electrically erasable programmable ROM (EEPROM)

1. electrically programmable many times 2. electrically erasable many times 3. can be erased one location, one row, or whole chip in one operation

- Flash memory

1. electrically programmable many times 2. electrically erasable many times 3. can only be erased in bulk

Page 9: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-9 9/6/00

Computer software

- Computer programs are known as software- A program is a sequence of instructions

Machine instruction

- A sequence of binary digits which can be executed by the processor- Hard to understand for human being

Assembly language

- Defined by assembly instructions- An assembly instruction is a mnemonic representation of a machine

instruction- Assembly programs must be translated before it can be executed --

translated by an assembler

Page 10: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-10 9/6/00

High-level language

- Syntax of a high-level language is similar to English- A translator is required to translate the program written in a

high-level language -- done by a compiler

Source code

- A program written in assembly or high-level language

Object code

- The output of an assembler or compiler

Page 11: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-11 9/6/00

7 0Accumulator A 7 0Accumulator B

15 0Double Accumulator D

15 0Index Register IX

15 0Index Register IY

15 0Stack pointer

15 0Program Counter

A:B

D

IX

IY

PC

SP

S X H I N Z V C CCR

Carry

Overflow

Negative

Zero

I interrupt mask

Half-Carry (from bit 3)

X Interrupt Mask

Stop Disable

Figure 1.3 MC68HC11 Programmer's model

Page 12: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-12 9/6/00

Memory Addressing

Memory consists of addressable locationsA memory location has 2 components: address and contents

Data transfer between CPU and memory involves addressbus and data bus

CPU memory

address bus lines

data bus lines

Figure 1.5 Data transfer between CPU and memory

address contents

Page 13: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-13 9/6/00

NUMBER SYSTEMS,

CONVERSIONSand

CODES

Page 14: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-14 9/6/00

Goals

Upon Completion

• Understand Positional Number Systems

• Convert from one base to another

• Add, Subtract using Binary Numbers

Page 15: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-15 9/6/00

Chapter Overview

• Binary Number Representation

Sign & Magnitude

Ones Complement

Twos Complement

• Codes

• Binary Addition

Using Ones and Twos Complement

Using BCD Nines and Tens Complement

• Binary Subtraction

Page 16: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-16 9/6/00

Binary Weights

• In Base 10 the weights in positional notation are:a0 is units weighta1 is 10 units weighta2 is 100 units weight or 10 * a1 weight...

• In Base 2 the weights in positional notation are:a0 is units weighta1 is 2 units weighta2 is 4 units weight or 2 * a1 weight...

Page 17: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-17 9/6/00

Positional Notation

BASE 10

953.7810 = 9 x 102 + 5 x 101 + 3 x 100 + 7 x 10-1 + 8 x 10-2

BASE 2

1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2

= 8 + 0 + 2 + 1 + 1/2 + 1/4

= 11 3/4

= 11.75

Page 18: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-18 9/6/00

Conversion

EXAMPLE (repeated division)

Convert 5310 to binary

2 2 53 divided by 2 leaves 26 2’s with 1 leftover which forms least significant bit

2 2 26 remainder = 1 = a0

2 2 13 remainder = 0 = a1

2 2 6 remainder = 1 = a2

2 2 3 remainder = 0 = a3

2 2 1 remainder = 1 = a4

0 remainder = 1 = a5 most significant digit

53 base 10 equals 110101

32 + 16 + 4 + 1 = 53

Page 19: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-19 9/6/00

EXAMPLE (fractional portion requires repeated multiplication)

Convert .62510 to binary

.625 X 2 = 1.250 a-1 = 1 remainder = .250 after 1.0 subtraction ms digit

.250 X 2 = 0.500 a-2 = 0 remainder = .500

.500 x 2 = 1.000 a-3 = 1 remainder = .000

Finished - No further multiplication possible!

.1012 = .5 + 0 + .125 =.62510

Page 20: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-20 9/6/00

• EXAMPLE

Convert 0.710 to binary

.700 X 2 = 1.400 a-1 = 1 remainder = .400

.400 X 2 = 0.800 a-2 = 0 remainder = .800

.800 X 2 = 1.600 a-3 = 1 remainder = .600

.600 X 2 = 1.200 a-4 = 1 remainder = .200

.200 X 2 = 0.400 a-5 = 0 remainder = .400

.400 X 2 = 0.800 a-6 = 0 remainder = .800

Process starts to repeat

0.710 = 0.10110011001100.........(base 2)

Page 21: EE332 Lecture 1 PowerPoint Slides

Introduction to MicroprocessorsNumber Systems and Conversions

No. 1-21 9/6/00

HEXADECIMAL NUMBERS

CodeWRITING one’s and zero’s can be error prone when dealing with large numbers. IBM came up with the following method of dealing with these numbers. BASE 16 with digits 0 - 15 in base 10 are represented by the following notation in Hexadecimal.

016 = 00002 = 010 816 = 10002 = 810

116 = 00012 = 110 916 = 10012 = 910

216 = 00102 = 210 A16 = 10102 = 1010

316 = 00112 = 310 B16 = 10112 = 1110

416 = 01002 = 410 C16 = 11002 = 1210

516 = 01012 = 510 D16 = 11012 = 1310

616 = 01102 = 610 E16 = 11102 = 1410

716 = 01112 = 710 F16 = 11112 = 1510