ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/2015 1 ECE265.

Slides:



Advertisements
Similar presentations
EECC250 - Shaaban #1 Lec # 2 Winter Addressing Modes  Addressing modes are concerned with the way data is accessed  Addressing can be.
Advertisements

CS25410 Memory Machine Code. Common types of non-rotating memory (1) RAMRandom Access Memory In reality, read/write memory This is usually volatile, meaning.
Control Structures in ARM Implementation of Decisions Similar to accumulator instructions One instruction sets the flags, followed by another instruction.
Computer Organization and Architecture
Processor Function Topic 3.
EET 2261 Unit 5 Tables; Decision Trees & Logic Instructions
Addressing Modes & Instruction Set By: Prof. Mahendra B. Salunke Asst. Prof., Department of Computer Engg., SITS, Pune-41 URL:
Assembler Programming Chapter 6. EEL-4746 Best Practices.
TK 2633 Microprocessor & Interfacing
LC-3 Computer LC-3 Instructions
S. Barua – CPSC 240 CHAPTER 5 THE LC-3 Topics Memory organization Registers Instruction set Opcodes.
COMP3221: Microprocessors and Embedded Systems--Lecture 8 1 COMP3221: Microprocessors and Embedded Systems Lecture 8: Program Control Instructions
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
ECE 265 – LECTURE 4 The M68HC11 Address Modes 8/14/ ECE265.
CEG 320/520: Computer Organization and Assembly Language ProgrammingFlow Control 1 Flow Control.
© 2010 Kettering University, All rights reserved..
The M68HC11 Basic Instruction Set Basic Arithmetic Instructions
Module 10 Adapted By and Prepared James Tan © 2001.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
Stacks and Subroutines. Some example stacks Stacks and subroutine usage The stack is a special area of the random access memory in the overall memory.
9/20/6Lecture 3 - Instruction Set - Al Instruction Set (2)
Physics 413 Chapter 4 A Fork in the Road LDAB # $ 13 here :ADDA # $ 24 DEC B BNE here WAI BNE is the new instruction. Branch if not equal to zero.
© 2010 Kettering University, All rights reserved..
Lecture 8. MIPS Instructions #3 – Branch Instructions #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education.
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA = All of the.
ECE 447: Lecture 12 Logic, Arithmetic, Data Test and Control Instructions of MC68HC11.
Today’s Lecture Unconditional branch instruction
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
ECE 265 – LECTURE 5 The M68HC11 Basic Instruction Set 12/8/ ECE265.
Machine Language ELEC 330 Digital Systems Engineering Dr. Ron Hayne.
1 ECE 372 – Microcontroller Design Assembly Programming HCS12 Assembly Programming Addressing Modes Stack Operations Subroutines.
8-1 EE 319K Introduction to Microcontrollers Lecture 8:Fixed Point Numbers, Local Variables, Binding, Allocation, Access, Deallocation.
ECE Lecture 21 Typical Assembly Language Program Bugs.
ECE 447: Lecture 16 Common Errors & Good Programming Style.
Chapter 2 — Instructions: Language of the Computer — 1 Conditional Operations Branch to a labeled instruction if a condition is true – Otherwise, continue.
Advanced Assembly Language Programming
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 11 Conditional Operations.
Subroutines and Stacks. Stack The stack is a special area in memory used by the CPU to store register information or general data information during program.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
1 Stack Advanced Programming. 2 The Stack It is a special area of memory used as temporary storage A stack is a LIFO data structure Putting data into.
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.
5-1 EE 319K Introduction to Microcontrollers Lecture 5: Conditionals, Loops, Modular Programming, Sub- routines, Parameter passing.
Unit 1 Instruction set M.Brindha AP/EIE
Status Register Status = system byte (supervisor only) + user byte = system status + condition code register usually, it is not important to know.
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
ECE 3430 – Intro to Microcomputer Systems
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
ECE 3430 – Intro to Microcomputer Systems
Microprocessor and Assembly Language
Microcomputer Programming
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Write a program to calculate x**y, given x and y.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
COMP3221: Microprocessors and Embedded Systems
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ECE511: Digital System & Microprocessor
An Introduction to the ARM CORTEX M0+ Instructions
Presentation transcript:

ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/ ECE265

Lecture Overview  The M68HC11 Basic Instruction Set  Stack and index register instructions  The remaining instructions classes are for program flow control Branch Instructions Jump Instructions Subroutine Calls No Operation Stop  REF: Chapter 3 and the appendix that details the instructions. 10/20/ ECE265

Stack &Index register instructions  These instructions allow manipulation of the index registers, X and Y, and exchange with the D accumulator. Additionally, they provide the ability to push and pop X and Y to/from the stack.  This class of instructions can be further subdivided into sub-classes of the type of operation. 10/20/2015ECE265 3

Modify value index reg or SP  To modify the value of the index register  Add B accumulator to X or Y: ABX ABY  Decrement the register: DES (stack pointer)  DEX DEY  Increment the register: INS (stack pointer)  INX INY  INX and INY (DEX,DEY) are only ones that affect CC register and then only the Z bit. 10/20/2015ECE265 4

Data manipulation of contents  Add the B accumulator to and index register  ABX ABY  Does not affect the CC register  Data testing of contents of index register  CPX CPY  There are compares to a 16-bit value in memory 10/20/2015ECE265 5

Move the X and Y index registers  Push them on the stack – copy the value in the register to the top of the stack. The register stays the same value. These are 2 byte push and pop operations.  PSHX PSHY  Pull the top 2 bytes from the stack into X or Y  PULX PULY  Store the X or Y index register or the SP  STX STY STS  Load the X or Y index register or the SP  LDX LDY LDS 10/20/2015ECE265 6

Register interchange instructions  Exchanges  D with X: XGDX  D with Y: XGDY  Transfers  Stack pointer to X or Y: TSX TSY  X or Y to the Stack Pointer: TXS TYS  On a transfer what is the value of the register transferred from after the operation?  What values is transfrred? 10/20/2015ECE265 7

Register interchange instructions  Values before execution  SP -- $C100  X -- $000C  Execute a TSX instruction  Values now  SP -- $C100  X -- $C101  X is loaded with 1 plus the contents of the stack pointer so that it points to the last value that was stored on the stack. 10/20/2015ECE265 8

 Ended here on Fri Jan 27, 12 10/20/2015ECE265 9

Program flow control instructions  When a task is sequential simply increment through the steps of tasks will accomplish it.  However, in computer programming for most applications, and especially embedded control applications, the programs typically have actions based on the status of the various inputs or internal counters and timers.  These instructions control what part of the program will execute next. They control the flow of execution and are often referred to as program flow control instructions. 10/20/2015ECE265 10

Conditional Branches  These are instructions to the control the flow of execution based on a value in the condition code register.  Their general execution is:  If the condition tested is false execution continues with the next instruction.  If the condition tested is true then execution continues at the relative location indicated in the argument of the instruction. 10/20/2015ECE265 11

The effect of a branch  A branch controls the flow of execution 10/20/2015ECE265 12

A table of the HC11 branches  The  Instructions  Note the  mode is  relative 10/20/2015ECE265 13

Relative addressing mode  Relative means the address is related to something.  It is related to the current instruction address which is in the program counter (PC). The instruction argument is the offset to be taken if the condition is TRUE.  The offset can be positive of negative. It is an 8 bit quantity that is treated as a 2’s complement value and allows offsets of -128 to /20/2015ECE265 14

An example  This is a timing delay loop  DECB takes 1usec  BNE takes 1.5 usec  LDAB immediate mode takes 1us  Coding  LDAB #$count  DELAY: DECB  BNE DELAY  Time delay = 1us+(1us+1.5us)*count 10/20/2015ECE265 15

More calculation  Most times you will know to time delay that you need and must calculate what count will create a loop with the correct delay.  Time Delay – LDAB time  Count = DECB time + BNE time  Taking into account the MCUs clock frequency which then tells us the time for the instructions.  Count = (Time Delay – 1us) / (2.5 us) 10/20/2015ECE265 16

Simple Branches summary  Branch on Carry Set of Carry Clear  BCS BCC  Branch on Zero  Equal to zero – BEQ Not Equal to zero – BNE  Branch on Minus – BMI  Branch on Plus – BPL  Branch on Overflow clear or set  BVC BVS 10/20/2015ECE265 17

Unsigned Binary Branches  Branch if higher BHI  CMPA $D380 compares A to the contents of $D380  BHI will branch if A > $D380 i.e. A > M  Branch on higher or same BHS  BHI is >  BHS is a  test  Branch if lower BLO <  Branch if lower or equal BLS  10/20/2015ECE265 18

Signed Branches  These branches treat the data as 2’s complement  Branch if greater than BGT  Branch is greater than or equal BGE  Branch is less than BLT  Branch is less than or equal BLE 10/20/2015ECE265 19

Jump and Branch always  Sometimes called unconditional branches  Transfers control to the location specified in the argument of the instruction.  Jump, JMP, uses direct, extended, or indexed addressing for the target address  Branch always – BRA – us a relative transfer 10/20/2015ECE265 20

Subroutines  High level languages and good programming practice use subroutines.  The 68HC11 has two branches to subroutine  and one return from subroutine  The BSR is a relative branch to subroutine 10/20/2015ECE265 21

The effect of the JSR,BSR & RTS  Instruction and their effect  JSR shows the effect of the addressing mode 10/20/2015ECE265 22

Lecture summary 10/20/2015ECE  Have covered the remaining instructions  Now knowing the instruction set, the processor may be used in applications  To do that you need a program.  How do you design a program?  How do you design a well documented, understandable and maintainable program?

Assignment 10/20/2015ECE  Problems Chapter 3 page 87  Problem 28