Unit 1 PowerPoint Slides

Report
EET 2261
Microprocessors
Professor Nick Reeder
Reminders



Please turn off cell phones.
No food or soft drinks in the
classroom.
Stow water bottles at floor level.
EET 2261 Unit 1
Introduction and HCS12 Overview



Read Almy, Chapters 1 & 2.
Homework #1 and Lab #1 due next
week.
Quiz next week.
Figure 13.1 Basic computer block diagram.
Digital Fundamentals, Tenth Edition
Thomas L. Floyd
Copyright ©2009 by Pearson Higher Education, Inc.
Upper Saddle River, New Jersey 07458
All rights reserved.
Roles of the Microprocessor
•The microprocessor is the heart of a computer
system. It performs the following functions:
•Fetches instructions from memory.
•Decodes and executes the instructions. This
typically involves:
• Transferring data to/from memory or I/O devices.
•Performing arithmetic or logical operations on data.
•Provides timing and control signals for all other
elements in the computer.
•Responds to interrupts (requests from I/O devices).
Some Popular Microprocessors
•Dozens of companies design and manufacture
microprocessors. Two of the most successful:
•Intel
•4004, 8008, 8086, 80286, 80386, Pentium,
Celeron, Itanium, Xeon, Core 2, …
•Freescale (formerly Motorola)
•6800, 68000, PowerPC, …
Microcontroller
•A microcontroller is a specialized
microprocessor with less computational power
than general microprocessors.
•Contains ROM, RAM, I/O ports on the same
chip as the processor.
•Widely used in embedded applications, where
it is dedicated to a specific, unchanging control
task.
•Examples: inside cars, smartphones,
dishwashers, microwave ovens, toys, ….
Some Popular Microcontrollers
•Dozens of companies design and manufacture
microcontrollers. Some of the most successful:
•Intel
•8051
•Freescale (formerly Motorola)
•68HC11, 68HC12, HCS12, …
•Microchip Technology
•PIC16, PIC18, PIC32, …
•Atmel
•8-bit AVR, 32-bit AVR, …
Three Big Topics
• In this course you'll learn a lot about
the following three topics:
1. HCS12 microcontroller
2. Dragon12 trainer
3. CodeWarrior software
Big Topic #1: HCS12 Microcontroller
• The HCS12, manufactured by
Freescale (formerly Motorola)
is a popular microcontroller.
• Freescale makes many variations of
this chip. The one we’ll work with is
in the HCS12D “family,” and it’s called
the MC9S12DG256.
• It’s a 112-pin chip, and it’s far more
complicated than any chip you’ve
studied in previous courses.
Big Topic #2: Dragon12 Trainer
• Our HCS12 chip is mounted on a
trainer board called the Dragon12Plus2, manufactured by EVBplus.
• The HCS12 chip on this board is
already connected to many peripheral
devices:
•
•
•
•
•
•
•
Switches
LEDs
Keypad
7-segment displays
Temperature sensor
Speaker
and more.
Big Topic #3: CodeWarrior
• To program the HCS12 chip, we’ll use
Freescale’s CodeWarrior IDE, which
runs on a personal computer.
•
This is very powerful,
complex software.
•
The professional edition
is expensive, but you can
download a free “special
edition,” intended for
students, from Freescale’s
website.
What’s an IDE?
•People who program microcontrollers need to
use several computer applications:
•One to type their program
•Another to check for errors and translate
their program to machine code
•Another to download the machine code to
the chip
•An integrated development environment (IDE),
such as CodeWarrior, combines all of these
tasks into a single program.
Reference Documents
•Datasheets for the HCS12 microcontroller,
manufactured by Freescale Semiconductor.
•User’s manual and schematic diagram for the
Dragon12-Plus2 board, manufactured by
EVBplus.
•Users Guide for CodeWarrior, manufactured
by Freescale Semiconductor.
Review: Binary & Hex
•Recall that any positive integer can be written
in decimal notation, binary notation, or
hexadecimal notation.
• Example: 1510 = 11112 = F16
•You must memorize the binary and hex
notation for numbers from 0 to 15.
•Use my games page for practice.
•You must also know how to convert between
decimal and binary (or vice versa) for larger
numbers.
Binary & Hex Prefixes
•Instead of subscripts, we’ll use prefixes to
specify whether a number is in decimal, binary,
or hex notation:
•No prefix means decimal
•% prefix means binary
•$ prefix means hex
•Example: 15 = %1111 = $F
Terms for Units of Data
•Bit: The smallest unit of digital data, a single 1
or 0.
•Byte: A group of 8 bits.
•Nibble: A “half-byte”: a group of 4 bits.
•Word: 2 bytes (or 16 bits).
Review: ASCII Codes
•Recall that ASCII is a code for representing
text using binary numbers. Each character is
represented by a 7-bit code:
•Example: The ASCII code for A is %100 0001.
•The ASCII code arises often in computer
programming.
•For a table of the ASCII codes, refer to one of
the following:
•Appendix J in your textbook (p. 375)
•Wikipedia’s article on ASCII
Review: Signed Versus Unsigned
Binary Representation
•
As a programmer, you will often have to
decide whether to use signed or unsigned
binary representation in a program.
•
We use unsigned binary representation
when we know that the range of numbers
we’re dealing with does not include negative
numbers.
•
We use signed binary representation when
the numbers we’re dealing with may be
positive or negative. Negative numbers are
represented in two’s-complement form.
Review: Two’s-Complement Form
•
In two’s-complement form, the leftmost
bit (MSB) is the sign bit.
• Sign bit = 0 for positive numbers or 0.
• Sign bit = 1 for negative numbers.
•
Examples:
• %0000 0011 = 3
• %1000 0011 = 125
Review: Kilo-, Mega-, Giga•In engineering notation,
•Kilo means 1,000 (the same as 103)
•Mega means 1,000,000 (same as 106)
•Giga means 1,000,000,000 (same as 109)
•When talking about computer memories, these
terms have slightly different meanings:
•Kilo means 1,024 (the same as 210)
•Mega means 1,048,576 (same as 220)
•Giga means 1,073,741,824 (same as 230)
Bytes, Kilobytes, Megabytes,
Gigabytes
•There are 1024 bytes in a kilobyte:
1 KB = 1024 bytes
•There are 1024 kilobytes in a megabyte:
1 MB = 1024 KB
•There are 1024 megabytes in a gigabyte:
1 GB = 1024 MB
Making Sense of Windows File
Sizes
•Have you ever noticed that when you use
Windows to look at a file’s size, it gives two
numbers that don’t seem to match each other?
•Example: “Size on disk: 624 KB (638,976 bytes)”
•That’s because 624 x 1024 = 638,976.
Computer Busses
•A computer system’s
data bus carries data
and instructions from
one part of the system
to another.
•Its address bus
carries addresses of
memory locations or
external devices.
•In the HCS12, both of these busses are 16 bits wide.
•When people say a “16-bit system” or a “32-bit
system,” they’re talking about the width of the data bus.
Memory Units
The location of a unit of data in a memory is called the
address. Usually a byte is the smallest unit of data that can
be addressed.
For example the blue byte is located in address 6.
Floyd, Digital Fundamentals, 10th ed
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Write Operations
The two main memory operations are called read and
write. A simplified write operation is shown in which new
data overwrites the original data. Data moves to the
Address register
Data register
memory.
1 0 1
1 0 0 0 1 1 0
Address decoder
1
Address bus
1. The address is placed on the
address bus.
2. Data is placed on the data
bus.
3. A write command is issued.
Floyd, Digital Fundamentals, 10th ed
1
Byte organized memory array
0
1
0
1
0
1
1
1
1
1
0
0
1
0
1
0
0
1
2
1
0
0
0
0
0
0
1
3
1
1
1
1
1
1
0
0
4
0
0
0
0
0
1
1
0
5
1
0
0
0
1
1
0
1
6
1
1
1
1
1
1
1
1
7
0
0
0
0
1
1
1
1
2
Data bus
3
Write
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Read Operations
The read operation is actually a “copy” operation, as the
original data is not changed. The data bus is a “two-way”
path; data moves from the memory during a read operation.
Address register
Data register
0 1 1
1 1 0 0 0 0 0 1
Address decoder
1
Address bus
1. The address is placed on the
address bus.
2. A read command is issued.
3. A copy of the data is placed
in the data bus and shifted
into the data register.
Floyd, Digital Fundamentals, 10th ed
Byte organized memory array
0
1
0
1
0
1
1
1
1
1
0
0
1
0
1
0
0
1
2
1
0
0
0
0
0
0
1
3
1
1
0
0
0
0
0
1
4
0
0
0
0
0
1
1
0
5
1
0
0
0
1
1
0
1
6
1
1
1
1
1
1
1
1
7
0
0
0
0
1
1
1
1
3
Data bus
2
Read
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Some Common Address Bus
Widths
•An address bus’s width (in bits) determines the
number of locations it can address:
Width of Address Bus
Number of locations
8 bits
256
10 bits
1K
16 bits
64 K
20 bits
1M
24 bits
16 M
32 bits
4G
Powers of 2
•Here’s a handy table showing the powers of 2
up to 240.
•You can use a table like this to answer the
following questions:
1. How many addressable locations are
there in a memory with n address bits?
2. How many rows are there in a truth table
with n input variables?
3. What is the MOD of an n-bit counter?
Review: Memory Technologies
•Most memory chips fall into one of the following
two categories (which have many subcategories).
1. RAM (Random Access Memory)
•Read/write
•Volatile (Loses data when power is removed.)
2. ROM (Read-Only Memory)
•Impossible or difficult to write to
•Non-volatile
Random Access Memory (RAM)
•RAM is for temporary data storage. It is read/write memory
and can store data only when power is applied, hence it is
volatile. Two major categories are static RAM (SRAM) and
dynamic RAM (DRAM).
•The memory cells in SRAM are latches or flip-flops.
•The memory cells in Dynamic RAMs (DRAMs) are
capacitors. Since the capacitors lose charge, they must be
refreshed many times each second.
Floyd, Digital Fundamentals, 10th ed
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Types of RAM
Latch or flip-flop
storage cell.
Capacitor storage cell.
Must be refreshed.
Fast but lowdensity. Used for
cache memory.
High-density but
slow. Used for
main memory.
Floyd, Digital Fundamentals, 10th ed
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Read-Only Memory (ROM)
•Members of the ROM family are all considered nonvolatile, because they retain data with power removed.
•Various members can be either permanent memory (truly
read-only) or erasable (not truly read-only, but they are
more difficult to write to than RAM).
•ROMs are used to store data that is never (or rarely)
changed, such as system initialization files.
Floyd, Digital Fundamentals, 10th ed
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Types of ROM
Data written by the
user, and can be
changed with some
difficulty.
Data written by
the manufacturer,
and can never be
changed.
Data written by the
user, and can never
be changed.
Floyd, Digital Fundamentals, 10th ed
© 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved
Memory in the HCS12
•The HCS12 chip contains some Flash
memory, some RAM, and some EEPROM.
•In a final product, typically:
•Flash holds the program that the chip
executes.
•RAM holds temporary data.
•EEPROM holds permanent data.
•But in this course we’ll use RAM for everything
(program as well as data).
HCS12 Memory Map
•See page 26 of
Device User
Guide.
HCS12 Block Diagram
•See page 6 of
textbook or
page 23 of
Device User
Guide.
Comparing Our Chip to Its
Relatives
HCS12 Pin Diagram
•See page 52 of
Device User
Guide.
•Most pins serve
more than one
function; we’ll
learn later how
to specify which
function we want
them to perform.

similar documents