H. Huang Transparency No.1-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning HCS12 Instruction Examples The LOAD and STORE Instructions.

Slides:



Advertisements
Similar presentations
CPU Structure and Function
Advertisements

Floyd, Digital Fundamentals, 10 th ed EET 2261 Unit 7 Indexed Addressing Mode Read Mazidi, Chapter 6. Homework #7 and Lab #7 due next week. Quiz next week.
Chapter 2: Data Manipulation
Processor Data Path and Control Diana Palsetia UPenn
8086 Ahad.
Microprocessors and Interfacing
Registers of the 8086/ /2002 JNM.
H. Huang Transparency No.2-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Program Loops Types of program loops: finite and.
Microprocessors.
INSTRUCTION SET ARCHITECTURES
Programming 68HC11.
9/20/6Lecture 3 - Instruction Set - Al Instruction Set.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
Computer Organization and Architecture
Revised: Aug 1, EE4390 Microprocessors Lesson 6,7 Instruction Set, Branch Instructions, Assembler Directives.
Addressing Modes & Instruction Set By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41 URL:
The 68HC11 Microcontroller Minnesota State University, Mankato
H. Huang Transparency No.1-1 The 68HC11 Microcontroller Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
TK 2633 Microprocessor & Interfacing
Computer Systems. Computer System Components Computer Networks.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Computer Organization and Architecture Tutorial 2 Kenneth Lee.
Chapter 1 Introduction to HCS12/MC9S12. Computer Hardware Organization What is a Computer? Software Hardware.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
EET 2261 Unit 2 HCS12 Architecture
Computer Architecture
ECE 265 – LECTURE 4 The M68HC11 Address Modes 8/14/ ECE265.
© 2010 Kettering University, All rights reserved..
INSTRUCTION SET OF MICROPROCESSOR 8085
Lecture 18 Last Lecture Today’s Topic Instruction formats
The M68HC11 Basic Instruction Set Basic Arithmetic Instructions
SAP1 (Simple-As-Possible) Computer
Physics 413 Chapter 1: Introduction to the HCS 12 Microcontroller.
9/20/6Lecture 3 - Instruction Set - Al Instruction Set (2)
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
Computer Systems Week 7: Looping and Input/Output with 3-bit Alma Whitfield.
ECE 447: Lecture 12 Logic, Arithmetic, Data Test and Control Instructions of MC68HC11.
Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development.
Computer Architecture Lecture 03 Fasih ur Rehman.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name of Unit : Instruction cycle.
1 Microcontroller Fundamentals & Programming Addressing Modes.
Microcontroller Fundamentals & Programming Arithmetic Instructions.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Central Processing Unit Decode Cycle. Central Processing Unit Current Instruction Register (CIR) I1 The fetch cycle has transferred an instruction from.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 ECE 372 – Microcontroller Design Basic Assembly Programming for(j=0; j
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
8085 Microprocessor Architecture
The HCS12 Microcontroller Minnesota State University, Mankato
Addressing Modes in Microprocessors
ECE 3430 – Intro to Microcomputer Systems
Microprocessor T. Y. B. Sc..
ECE 3430 – Intro to Microcomputer Systems
Introduction to 8085 Instructions
Microcomputer Programming
Lecture 3 - Instruction Set - Al
Additional data transfer and 16 bit arithmetic instruction Lecture 1
Arithmetic operations Programming
ME4447/6405 Microprocessor Control of Manufacturing Systems and
ECE 3430 – Intro to Microcomputer Systems
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Computer Architecture
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Information Representation: Machine Instructions
Instruction execution and ALU
Computer Operation 6/22/2019.
Presentation transcript:

H. Huang Transparency No.1-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning HCS12 Instruction Examples The LOAD and STORE Instructions -The LOAD instruction copies the contents of a memory location or places an immediate value into an accumulator or a CPU register. -STORE instructions save the contents of a CPU register into a memory location. -N and Z flags of the CCR register are automatically updated and the V flag is cleared. - All except for the relative mode can be used to select the memory location or value to be loaded into an accumulator or CPU register. -All except for the relative and immediate modes can be used to select memory location to store contents of the CPU register. For example, ldaa 0,X staa $20 stx $8000 ldd #100

H. Huang Transparency No.1-2 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning

H. Huang Transparency No.1-3 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Transfer and Exchange Instructions -Transfer instructions copy the contents of a CPU register or accumulator into another CPU register or accumulator. -TFR is the universal transfer instruction, but other mnemonics are accepted for compatibility with the 68HC11. -The TAB and TBA instructions affect the N, Z, and V condition code bits. -The TFR instruction does not affect any condition code bits. For example, TFR D,X; [D]  X TFR A,B; [A]  B TFR A,X; sign-extended of[A]  X ; A is signed extended to 16-bit and assigned to X TFR X,A; X[7:0]  A; lower 8 bits copied to A

H. Huang Transparency No.1-4 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning -The EXG instruction exchanges the contents of a pair of registers or accumulators. For example, exg A, B exg D,X exgA,X; A  X[7:0], X  $00:[A] exgX,B; X  $00:[B], B  X[7:0] -The SEX instruction sign-extend an 8-bit two’s complement number into a 16-bit number so that it can be used in 16-bit signed operations. For example, SEXA,X

H. Huang Transparency No.1-5 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Move Instructions -These instructions move data bytes or words from a source to a destination in memory. -Six combinations of immediate, extended, and index addressing modes are allowed to specify the source and destination addresses: IMM  EXT, IMM  IDX, EXT  EXT, EXT  IDX,IDX  EXT,IDX  IDX -For example, movb$100,$800 movw0,X, 0,Y

H. Huang Transparency No.1-6 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Add and Subtract Instructions -These instructions perform fundamental arithmetic operations. -The destinations of these instructions are always a CPU register or accumulator. -There are two-operand and three-operand versions of these instructions. -Three-operand ADD or SUB instructions always include the C flag as one of the operand. -Three-operand ADD or SUB instructions are used to perform multi-precision addition or subtraction. -For example, adda $1000; A  [A] + [$1000] adca $1000; A  [A] + [$1000] + C suba $1002; A  [A] - [$1002] sbca $1000; A  [A] - [$1000] - C

H. Huang Transparency No.1-7 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning

H. Huang Transparency No.1-8 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Example Write an instruction sequence to add 3 to the memory locations at $10 and $15FA. Solution: We have to load the contents of the memory locations to registers, add 3, and write back the results to the memory locations. (A memory location can’t be a destination of an ADD instruction) ldaa $10; [A]  [$10] adda #3; A  [A]+3 staa $10;[$10]  [A] ldaa $15FA; [A]  [$15FA] adda #3; A  [A]+3 staa $15FA;[$15FA]  [A] *

H. Huang Transparency No.1-9 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning Instruction Execution Cycle -One or more read cycles to fetch instruction opcode bytes and addressing information. -One or more read cycles to fetch the memory operand(s) (optional). -Perform the operation specified by the opcode. - One or more write cycles to write back the result to either a register or a memory location (optional). Instruction Queue -The HCS12 executes one instruction at a time and many instructions take several clock cycles to complete. -When the CPU is performing the operation, it does not need to access memory. -The HCS12 pre-fetches instructions when the CPU is not accessing memory to speedup the instruction execution process. -There are two 16-bit queue stages and one 16-bit buffer. Unless buffering is required, program information is first queued in stage 1, and then advanced to stage 2 for execution.