Microprocessor/Microcontroller. Introduction



Similar documents
Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

MICROPROCESSOR AND MICROCOMPUTER BASICS

Microprocessor & Assembly Language

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

MACHINE ARCHITECTURE & LANGUAGE

Programmer s Model = model of µc useful to view hardware during execution of software instructions

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

PART B QUESTIONS AND ANSWERS UNIT I

Notes on Assembly Language

Central Processing Unit (CPU)

(Refer Slide Time: 00:01:16 min)

Z80 Instruction Set. Z80 Assembly Language

CPU Organization and Assembly Language

M6800. Assembly Language Programming

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

Introduction to Microcontrollers

Chapter 2 Logic Gates and Introduction to Computer Architecture

1 Classical Universal Computer 3

Decimal Number (base 10) Binary Number (base 2)

8085 INSTRUCTION SET

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

HC12 Assembly Language Programming

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Computer Science 281 Binary and Hexadecimal Review

EC 362 Problem Set #2

Chapter 5 Instructor's Manual

Base Conversion written by Cathy Saxton

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

Faculty of Engineering Student Number:

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Computer organization

LSN 2 Computer Processors

Instruction Set. Microcontroller Instruction Set. Instructions that Affect Flag Settings (1) The Instruction Set and Addressing Modes

High level code and machine code

Lesson-16: Real time clock DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

PROBLEMS (Cap. 4 - Istruzioni macchina)

Chapter 7D The Java Virtual Machine

Chapter 2 Assemblers

CHAPTER 7: The CPU and Memory

TIMING DIAGRAM O 8085

Instruction Set Architecture (ISA)

The 104 Duke_ACC Machine

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Z80 Family. CPU User Manual

An Introduction to the ARM 7 Architecture

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

Intel 8086 architecture

CHAPTER 4 MARIE: An Introduction to a Simple Computer

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

The string of digits in the binary number system represents the quantity

Traditional IBM Mainframe Operating Principles

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

8051 hardware summary

CSE 141L Computer Architecture Lab Fall Lecture 2

Computer Organization and Architecture

COMPUTER ORGANIZATION AND ARCHITECTURE. Slides Courtesy of Carl Hamacher, Computer Organization, Fifth edition,mcgrawhill

DATA ITEM DESCRIPTION

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Here is a diagram of a simple computer system: (this diagram will be the one needed for exams) CPU. cache

Instruction Set Design

Summary of the MARIE Assembly Language

Programming the Motorola MC68HC11 Microcontroller

İSTANBUL AYDIN UNIVERSITY

CSE2102 Digital Design II - Topics CSE Digital Design II

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

Instruction Set Architecture

Chapter 9 Computer Design Basics!

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

CPU Organisation and Operation

Subnetting Examples. There are three types of subnetting examples I will show in this document:

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Counters. Present State Next State A B A B

ARM Cortex-M3 Assembly Language

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

================================================================

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

BASIC COMPUTER ORGANIZATION AND DESIGN

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Systems I: Computer Organization and Architecture

2011, The McGraw-Hill Companies, Inc. Chapter 3

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z)

CS201: Architecture and Assembly Language

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

We will use the accumulator machine architecture to demonstrate pass1 and pass2.

CS352H: Computer Systems Architecture

CSI 333 Lecture 1 Number Systems

Transcription:

Microprocessor/Microcontroller Introduction

Microprocessor/Microcontroller microprocessor - also known as a CU or central processing unit - is a complete computation engine that is fabricated on a single chip. The first microprocessor was the Intel 4004, introduced in 1971. The 4004 was not very powerful - all it could do was add and subtract, and it could only do that 4 bits at a time. But it was amazing that everything was on one chip. rior to the 4004, engineers built computers either from collections of chips or from discrete components (Transistors and such). The 4004 powered one of the first portable electronic calculators. (excerpts from How Microprocessors Work by Marshall Brain)

Microprocessor/Microcontroller The first microprocessor to make it into a home computer was the Intel 8080, a complete 8-bit computer on one chip, introduced in 1974. The first microprocessor to make a real splash in the market was the Intel 8088, introduced in 1979 and incorporated into the IBM C (which first appeared around 1982). If you are familiar with the C market and its history, you know that the C market moved from the 8088 to the 80286 to the 80386 to the 80486 to the entium to the entium II to the entium III to the entium 4. ll of these microprocessors are made by Intel and all of them are improvements on the basic design of the 8088. The entium 4 can execute any piece of code that ran on the original 8088, but it does it about 5,000 times faster! (excerpts from How Microprocessors Work by Marshall Brain)

Microprocessor/Microcontroller :

Microprocessor/Microcontroller This is about as simple as a microprocessor gets. This microprocessor has: n address bus (that may be 8, 16 or 32 bits wide) that sends an address to memory data bus (that may be 8, 16 or 32 bits wide) that can send data to memory or receive data from memory n RD (read) and WR (write) line to tell the memory whether it wants to set or get the addressed location clock line that lets a clock pulse sequence the processor reset line that resets the program counter to zero (or whatever) and restarts execution Let's assume that both the address and data buses are 8 bits wide in this example.

Microprocessor/Microcontroller Here are the components of this simple microprocessor: Registers, B and C are simply latches made out of flip-flops. The address latch is just like registers, B and C. The program counter is a latch with the extra ability to increment by 1 when told to do so, and also to reset to zero when told to do so.

Microprocessor/Microcontroller Microprocessor Instructions Even the incredibly simple microprocessor shown in the previous example will have a fairly large set of instructions that it can perform. The collection of instructions is implemented as bit patterns, each one of which has a different meaning when loaded into the instruction register. Humans are not particularly good at remembering bit patterns, so a set of short words are defined to represent the different bit patterns. This collection of words is called the assembly language of the processor. n assembler can translate the words into their bit patterns very easily, and then the output of the assembler is placed in memory for the microprocessor to execute.

Microprocessor/Microcontroller Here's the set of assembly language instructions that the designer might create for the simple microprocessor in our example: LOD mem - Load register from memory address LODB mem - Load register B from memory address CONB con - Load a constant value into register B SVEB mem - Save register B to memory address SVEC mem - Save register C to memory address DD - dd and B and store the result in C SUB - Subtract and B and store the result in C MUL - Multiply and B and store the result in C DIV - Divide and B and store the result in C

Microprocessor/Microcontroller COM - Compare and B and store the result in test JUM addr - Jump to an address JEQ addr - Jump, if equal, to address JNEQ addr - Jump, if not equal, to address JG addr - Jump, if greater than, to address JGE addr - Jump, if greater than or equal, to address JL addr - Jump, if less than, to address JLE addr - Jump, if less than or equal, to address STO - Stop execution

Microprocessor/Microcontroller n opcode (operation code) is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question (which may be a general CU or a more specialized processing unit). part from the opcode itself, an instruction normally also has one or more specifiers for operands (i.e. data) on which the operation should act, although some operations may have implicit operands, or none at all.

Microprocessor/Microcontroller ssembly language, or just assembly, is a lowlevel programming language, which uses mnemonics, instructions and operands to represent machine code. This enhances the readability while still giving precise control over the machine instructions.

DT DIRECTION ROM-8KB RM-256 bytes EEROM-512 bytes ULSE CCUMULT OR ERIODIC INTERRUT CO WT CHDOG O C 1 I OC2 OC3 OC4 OC5 IC1 IC2 IC3 ORT 7 6 5 4 3 2 1 0 E7 E6 E5 E4 E3 E2 E1 E0 ORT E /D CONVERTER SI SCI SS SCK MOSI MISO TxD RxD ORT D D5 D4 D3 D2 D1 D0 V REFH V REFL M68HC11 CU RESET DDRESS DT BUS XIRQ INTERRUTS IRQ (V BULK ) HNDSHKE I/O XTL EXTL OSCILLTOR ORT B DT DIRECTION C ORT C RLLEL I/O E MOD LIR MODB (V STBY ) MODE SELECT B 7 B 6 B 5 B 4 B 3 B 2 B 1 B 0 C 7 C 6 C 5 C 4 C 3 C 2 C 1 C 0 S T R B S T R SINGLE CHI V DD OWER 1 5 1 4 1 3 1 2 1 1 1 0 9 8 D 7 D 6 D 5 D 4 D 3 D 2 D 1 D 0 R/W S EXND V SS Figure 1.2 68HC118 block diagram (redrawn with permis sion of Motorola)

7 ccumulator 0 7 ccumulator B 0 15 Double ccumulator D 0 15 Index Register IX 0 15 Index Register IY 0 15 Stack pointer 0 15 rogram Counter 0 :B D IX IY S C S X H I N Z V C CCR Carry Overflow Zero Negative I interrupt mask Half-Carry (from bit 3) X Interrupt Mask Stop Disable Figure 1.3 MC68HC11 rogrammer's model

Microprocessor/Microcontroller Memory ddressing Memory consists of addressable locations memory location has 2 components: address and contents address contents Data transfer between CU and memory involves address bus and data bus address bus lines CU memory data bus lines Figure 1.5 Data transfer between CU and memory

DDRESSING MODES Operands needed in an instruction are specified by one of the 6 addressing modes Immediate mode Direct mode Extended mode Indexed mode Inherent mode Relative mode Microprocessor/Microcontroller

68HC11 addressing modes Table 1.1 refix for number representation Base binary octal decimal hexadecimal refix % @ nothing* $ *Note: Some assemblers use & Microprocessor/Microcontroller

Immediate mode The actual operand is contained in the byte or bytes immediately following the instruction opcode LD #22 DD #@32 LDD #1000 Note that the (#) is a critical assembler directive! Microprocessor/Microcontroller

Direct mode one-byte value is used as the address of a memory operand (located in on-chip SRM) DD $10 SUB $20 LDD $30 Extended mode two-byte value is used as the address of a memory operand LD $1000 LDX $1000 DDD $1030 Indexed mode The sum of one of the index registers and an 8-bit value is used as the address of a memory operand DD 10,X LD 3,Y

Inherent mode - Operands are implied by the instruction - No address information is needed B INCB INX Relative mode - Used in branch instructions to specify the branch target - Specified using either a 16-bit value or a label (preferred)... BEQ there DD #10... there DECB

Sample of 68HC11 Instructions The LOD instructions group of instructions that place a value or copy the contents of a memory location (or locations) into a register LD LDB LDD LDX LDY LDS <opr> Load ccumulator <opr> Load ccumulator B <opr> Load Double ccumulator D <opr> Load Index Register X <opr> Load Index Register Y <opr> Load Stack ointer <opr> can be immediate, direct, extended, or index mode Examples LD $10 LDX #$1000

The DD instruction group of instructions perform addition operation B BX BY DD <opr> DDB <opr> DDD <opr> DC <opr> DCB <opr> <opr> is specified using immediate, direct, extended, or index mode Examples. DD #10 DD $20 DDD $30

The SUB instruction group of instructions that perform the subtract operation SB SUB <opr> SUBB <opr> SUBD <opr> SBC <opr> ; [] - <opr> - C flag SBCB <opr> ; [B] - <opr> - C flag <opr> can be immediate, direct, extended, or index mode Examples SUB #10 SUB $10 SUB 0,X SUBD 10,X

The STORE instruction group of instructions that store the contents of a register into a memory location or memory locations ST STB STD STX STY STS <addr> <addr> <addr> <addr> <addr> <addr> <addr> can be direct, extended, or index mode Examples: ST $20 ST 10,X STD $10 STD $1000 STD 0,X

The 68HC11 Machine Code 68HC11 instruction consists of 1 to 2 bytes of opcode and 0 to 3 bytes of operand information Examples ssembly instruction Machine instructions (in hex format) LD #29 86 1D ST $00 97 00 DD $02 9B 02 ST $01 97 01 INY 18 08 Microprocessor/Microcontroller

Microprocessor/Microcontroller machine code assembly instruction format 01 NO 86 LD IMM 96 LD DIR C6 LDB IMM D6 LDB DIR CC LDD IMM DC LDD DIR 8B DD IMM 9B DD DIR CB DDB IMM DB DDB DIR C3 DDD IMM D3 DDD DIR 97 ST DIR D7 STB DIR DD STD DIR

Microprocessor/Microcontroller The 68HC11 Instruction Execution Cycle - erform a sequence of read cycles to fetch instruction opcode byte and address information. - Optionally perform read cycle(s) required to fetch the memory operand. - erform the operation specified by the opcode. - Optionally write back the result to a register or a memory location. - Consider the following 3 instructions ssembly instruction Memory location Opcode LD $2000 $C000 B6 20 00 D $3000 $C003 BB 30 00 ST $2000 $C006 B7 20 00

Instruction LD $2000 Step 1. lace the value in C on the address bus with a request to read the contents of that location. Step 2. The opcode byte $B6 at $C000 is returned to the CU and C is incremented by 1. ddress bus $C000 Memory contents $B6 ddres s $C000 CU $20 $00 $BB $30 $00 $C001 $C002 $C003 $C004 $C005 $B6 Data bus $B7 $20 $00 $C006 $C007 $C008 Before fter $C000 $C001 C C Figure 1.10 Ins truction 1--Opcode read cycle

Step 3. CU performs two read cycles to obtain the extended address $2000 from locations $C001 and $C002. t the end the value of C is incremented to $C003 Memory contents ddress Memory contents ddress bus $C001 CU $20 Data bus $B6 $20 $00 $BB $30 $00 $B7 $20 $00 $C000 $C001 $C002 $C003 $C004 $C005 $C006 $C007 $C008 ddress bus $C002 CU $00 Data bus $B6 $20 $00 $BB $30 $00 $B7 $20 $00 Before fter first read fter second read $C001 $C002 $C003 C C C Figure 1.11 Instruction 1--address byte read cycles ddress $C000 $C001 $C002 $C003 $C004 $C005 $C006 $C007 $C008

Step 4. The CU performs another read to get the contents of the memory location at $2000, which is $19. The value $19 will be loaded into accumulator. ddress bus $2000 Memory contents $19 CU... ddress $2000 $19 Data bus $37 $3000 Figure 1.12 Instruction 1--execution read cycle

The End Microprocessor/Microcontroller