Programming 68HC11.

Slides:



Advertisements
Similar presentations
Microprocessors.
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.
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.
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
The 68HC11 Microcontroller Minnesota State University, Mankato
H. Huang Transparency No.1-1 The 68HC11 Microcontroller Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
Instruction Set Architecture & Design
TK 2633 Microprocessor & Interfacing
LC-3 Computer LC-3 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
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chap 4 & 5 LC-3 Computer LC-3 Instructions Chap 4 Homework – due Monday October 27 Chap 5 Homework – due Wednesday October 29 Project 2 Designs (Working.
Basic Computer Organization, CPU L1 Prof. Sin-Min Lee Department of Computer Science.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
UNDERSTANDING ASSEMBLY LANGUAGE.
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Lecture 3. Diff b/w RAM and Registers Registers are used to hold data immediately applicable to the operation at hand Registers are used to hold data.
Computer Architecture and the Fetch-Execute Cycle
Vintage Computer Hardware 101 Featuring the MITS Altair 680b Bill Degnan.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Computer Architecture and Organization
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Dale & Lewis Chapter 5 Computing components
1 Microcontroller Fundamentals & Programming Addressing Modes.
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Elements of Datapath for the fetch and increment The first element we need: a memory unit to store the instructions of a program and supply instructions.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Embedded Systems Lecture 5 January 25 th, 2016.
27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final.
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
1 What we want: execute High Level Language (HLL) programs What we have: computer hardware (a glorified calculator)
The Little man computer
Addressing Modes in Microprocessors
Control Unit Lecture 6.
Assembly Language (continue)
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Chapter 4 The Von Neumann Model
ECE 3430 – Intro to Microcomputer Systems
Introduction of microprocessor
Microcomputer Programming
Computer Science 210 Computer Organization
Chapter 5 The LC-3.
The Processor and Machine Language
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Computer Science 210 Computer Organization
Computer Programming Machine and Assembly.
Design of the Control Unit for One-cycle Instruction Execution
Introduction to Micro Controllers & Embedded System Design
Sequencing, Selection, and Loops in Machine Language
Physics 413 Chapter 2.
Mastering Memory Modes
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Program Execution.
The Von Neumann Machine
The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005
CS 111 – Sept. 16 Machine language examples Instruction execution
Little Man Computer.
Presentation transcript:

Programming 68HC11

Steps in programming MPU START FETCH TO CODE DECODE OP CODE FETCH OPERAND ADDRESS IF ANY EXECUTE THE INSTRUCTION

Programming Language machine Machine Language Hex Machine language 10110110 B6 11000011 C3 00000000 00 10111011 BB 11100000 E0 11111111 FF 11000111 B7 11010100 C4 10101010 AA

$ indicate that the address is in hex LDAA load accumulator A B6 STAA store accumulator A B7 ADDA add to accumulator A BB SUBA subtract to accumulator A B0 WAI halt 3E JMP jump 7E BEQ branch if equal to zero 27

Jump branch instruction Memory Address hex Memory word hex Mnemonic Description C100 48 ASLA Shift A left 1 bit C101 7E JMP JUMP to C15F for the next instruction C102 C1 ADDRESS OF THE NEXT INSTRUCTION C103 5F C104 C105 … C15F B7 STAA STORE IN MEMORY LOCATION C300 C160 C3 ADDRESS OF THE LOCATION WHERE THE CONTENTS OF A WILL B STORED C161 00

Branch Equal to Zero (BEQ) instruction Memory Address hex Memory word hex Mnemonic Description C200 BO SUBA Shift A left 1 bit C201 C2 JUMP to C15F for the next instruction C202 9B ADDRESS OF THE NEXT INSTRUCTION C203 27 BEQ RESULT OF THE LAST OPERATION IS ZERO BRANCH TO C219 C204 14 IF NOT GO TO C205 OFSET = 1416 C205 … ?? ? PC = C205 + OFSET 14 C219 B7 STAA STORE IN ADDRESS C127 C21A C1 C21B

Terms Offset determines MPU’s next instruction C1, 00 address of operand X C1, 01 address of operand Y C1, 02 address where the contents of the accumulator A will be stored C1, 5F address of next instruction C3, 00 address of location where the contents of A will be stored

Assembly language source program Memory address Instruction mnemonic Comments C200 LDAA $D0FF Get first the data word C203 ADDA $D500 Add second data word C206 STAA $D700 Store sum in memory

LDAA code Source Code Object Code B6 D0 FF LDAA $D0FF

Assembly process typical steps The online assembler program is loaded into the computer’s internal RAM’s (unless it is already in ROM) The programmer loads the assembly language source program into the computer’s RAM, either from the keyboard or an external memory unit (like when using ASCII code for the characters)

Continuation The computer then is commanded to execute the one-line assembler program The computer executes the one-line assembler program which converts source code instruction such as LDAA $D0FF into object code that I places into RAM Once instruction is placed in RAM the program then can be stored in disk for later use

Continuation The object program can now be executed since it is in the executable machine.

High level languages BASIC FORTRAN TURBO C++

Flowchart no yes Start Initialize COUNT=7 Initialize RESULT=0 Read data byte from sensor Add to RESULT Decrement COUNT Is count =0 ? no yes Store result in memory stop

Problems How many consecutive location does an 8 bit microcomputer store a 48 bit word? Answer 48 bit / 8 bit 6 consecutive memory location

A certain 32 bit computer has the following instruction word format: Op code Operands address 8 bits 16 bits How many different instructions can this instruction word specify? How many different memory addresses can it specify? What internal memory capacity would this computer require to operate at full capacity? Answer a) 256 bits b) 65536 c) 65536

During the LDAA instruction data are taken from__________ and transferred to ___________ Memory location STAA