EET 2261 Microprocessors Professor Nick Reeder Reminders Please

  • Slides: 40
Download presentation
EET 2261 Microprocessors Professor Nick Reeder

EET 2261 Microprocessors Professor Nick Reeder

Reminders ¡ Please turn off cell phones. ¡ No food or soft drinks in

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 HCS 12 Overview ¡ ¡ ¡ Read Almy,

EET 2261 Unit 1 Introduction and HCS 12 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

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.

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

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 i 7, … • NXP (formerly Freescale, formerly Motorola) • 6800, 68000, Power. PC, …

Microcontroller • A microcontroller is a specialized microprocessor with less computational power than general

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

Some Popular Microcontrollers • Dozens of companies design and manufacture microcontrollers. Some of the most successful: • Intel • 8051 • NXP (formerly Freescale, formerly Motorola) • 68 HC 11, 68 HC 12, HCS 12, … • Microchip Technology • PIC 16, PIC 18, PIC 32, … • Atmel • 8 -bit AVR, 32 -bit AVR, … • ARM Holdings • ARM 2, ARM 8, ARMv 7 -A, …

Three Big Topics • In this course you'll learn a lot about the following

Three Big Topics • In this course you'll learn a lot about the following three topics: 1. HCS 12 microcontroller 2. Dragon 12 trainer 3. Code. Warrior software

Big Topic #1: HCS 12 Microcontroller • The HCS 12, manufactured by NXP (formerly

Big Topic #1: HCS 12 Microcontroller • The HCS 12, manufactured by NXP (formerly Freescale, formerly Motorola) is a popular microcontroller. • NXP makes many variations of this chip. The one we’ll work with is in the HCS 12 D “family, ” and it’s called the MC 9 S 12 DG 256. • It’s a 112 -pin chip, and it’s far more complicated than any chip you’ve studied in previous courses.

Big Topic #2: Dragon 12 Trainer • Our HCS 12 chip is mounted on

Big Topic #2: Dragon 12 Trainer • Our HCS 12 chip is mounted on a trainer board called the Dragon 12 Plus 2, manufactured by EVBplus. • The HCS 12 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: Code. Warrior Software • To program the HCS 12 chip, we’ll

Big Topic #3: Code. Warrior Software • To program the HCS 12 chip, we’ll use NXP’s Code. Warrior 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 NXP’s website.

What’s an IDE? • People who program microcontrollers need to use several computer applications:

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 Code. Warrior, combines all of these tasks into a single program.

Reference Documents • Datasheets for the HCS 12 microcontroller, manufactured by NXP Semiconductors. •

Reference Documents • Datasheets for the HCS 12 microcontroller, manufactured by NXP Semiconductors. • User’s manual and schematic diagram for the Dragon 12 -Plus 2 board, manufactured by EVBplus. • Users Guide for Code. Warrior software, produced by NXP Semiconductors.

Review: Binary & Hex • Recall that any positive integer can be written in

Review: Binary & Hex • Recall that any positive integer can be written in decimal notation, binary notation, or hexadecimal notation. • Example: 1510 = 11112 = F 16 • You must memorize the binary and hex notation for numbers from 0 to 15. • You must also know how to convert between decimal, binary, and hex for larger integers. • Use my games page for practice.

Binary & Hex Prefixes • Instead of subscripts, we’ll use prefixes to specify whether

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

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

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

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

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

Review: Kilo-, Mega-, Giga • In engineering notation, • Kilo means 1, 000 (the same as 103) • Mega means 1, 000 (same as 106) • Giga means 1, 000, 000 (same as 109) • But 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

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 = 1, 048, 576 bytes • There are 1024 megabytes in a gigabyte: 1 GB = 1024 MB = 1, 048, 576 KB = 1, 073, 741, 824 bytes

Making Sense of Windows File Sizes • Have you ever noticed that when you

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

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 HCS 12, 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

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, 10 th 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 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 memory. Address register Address decoder Data register Byte organized memory array 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. Data bus Write Floyd, Digital Fundamentals, 10 th ed © 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

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 Address decoder Data register Byte organized memory array 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, 10 th ed Data bus 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

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 1 K 16 bits 64 K 20 bits 1 M 24 bits 16 M 32 bits 4 G

Powers of 2 • Here’s a handy table showing the powers of 2 up

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

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

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, 10 th 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.

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, 10 th 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

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, 10 th 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

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, 10 th ed © 2009 Pearson Education, Upper Saddle River, NJ 07458. All Rights Reserved

Memory in the HCS 12 • The HCS 12 chip contains some Flash memory,

Memory in the HCS 12 • The HCS 12 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).

HCS 12 Memory Map • See page 26 of Device User Guide. We’ll use

HCS 12 Memory Map • See page 26 of Device User Guide. We’ll use the chip in normal single-chip mode.

HCS 12 Block Diagram • See page 6 of textbook or page 23 of

HCS 12 Block Diagram • See page 6 of textbook or page 23 of Device User Guide.

Comparing Our Chip to Its Relatives

Comparing Our Chip to Its Relatives

HCS 12 Pin Diagram • See page 52 of Device User Guide. • Most

HCS 12 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.

Headers on the Dragon 12 Board • Surrounding the HCS 12 chip on the

Headers on the Dragon 12 Board • Surrounding the HCS 12 chip on the Dragon 12 board are wire sockets that give you access to almost all of the chip’s pins. These sockets are arranged in the same order as the pins on the HCS 12 chip itself.