EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

Similar documents
ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

Cross Assembly and Program Development

Exam I Review February 2017

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

Mark II Aiken Relay Calculator

CodeWarrior. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

Introduction to the 9S12 Microcontroller

Programming the Motorola MC68HC11 Microcontroller

Introduction to Programming

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz

Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my...

ECE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE

ELEG3924 Microprocessor

A Simple MC9S12 Program

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

Introduction to Microcontrollers

N bit is set if result of operation in negative (MSB = 1) Z bit is set if result of operation is zero (All bits = 0)

ME 6405 Introduction to Mechatronics

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

8051 Microcontrollers

Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

EE319 K Lecture 3. Introduction to the 9S12 Lab 1 Discussion Using the TExaS simulator. University of Texas ECE

HC11 Instruction Set Architecture

HC11 Instruction Set Architecture

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

EE 3170 Microcontroller Applications

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Homework 12 Solutions

Macro Assembler. Defini3on from h6p://

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access

EE319 K Lecture 7. Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines. University of Texas ECE

Microcomputer Architecture and Programming

CHAPTER 8. Solutions for Exercises

Assembly Language programming (1)

Microcontrollers. Microcontroller

COSC345 Software Engineering. Basic Computer Architecture and The Stack

1. Memory Mapped Systems 2. Adding Unsigned Numbers

MC9S12 Address Space

Introduction to Computers - Chapter 4

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

ECE 3610 MICROPROCESSING SYSTEMS

538 Lecture Notes Week 5

538 Lecture Notes Week 5

ECE 331: PC Lab 3 Stack and Subroutines

It translates (converts) assembly language to machine code.


Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003

the SAP-2 I. Intro cmpt-150-arc Sections 8-8, 8-9, 9-4, 9-5, 9.6, We ll do this in bits and pieces, doing the beginning of each section first.

HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition

538 Lecture Notes Week 2

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

Getting Started with the HCS12 IDE

Lecture 6 Assembly Programming: Branch & Iteration

Total: EEL 3701 Digital Logic & Computer Systems Final Exam Fall Semester 2007 COVER SHEET: Re-Grade Information: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14)

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation

Introduction to Microcontrollers II

2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.

Lecture 9 Subroutines

Chapter. Computer Architecture

Lecture #3 Microcontroller Instruction Set Embedded System Engineering Philip Koopman Wednesday, 20-Jan-2015

Using the stack and the stack pointer

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

COE538 Lecture Notes Week 3 (Week of Sept 17, 2012)

Wed. Sept 6 Announcements

ECE 4510/5530 Microcontroller Applications Chapter 1

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

8051 Microcontroller

Introduction to Microcontrollers II

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports

EE 3170 Microcontroller Applications

What is an Addressing Mode?

Extra-credit QUIZ Pipelining -due next time-

Lecture 5 Assembly Programming: Arithmetic

EE 3170 Microcontroller Applications

The 8051 Microcontroller and Embedded Systems

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions

Microcontrollers and the Freescale/Motorola HC11

CS/ECE 5780/6780: Embedded System Design

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

Roberto Muscedere Images and Text Portions 2003 Prentice Hall 1

Lecture 5. EEE3410 Microcontroller Applications Department of Electrical Engineering Assembly Language Programming (1)

Processor design - MIPS

Lab 8: Debugging Embedded Devices and Software

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

Summer 2003 Lecture 1 06/09/03

Lecture #2 January 30, 2004 The 6502 Architecture

Y = (A + C) (A + B) (B + C)

JUMP, LOOP AND CALL INSTRUCTIONS

HC11 Instruction Set

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6

538 Lecture Notes Week 3

Run time environment of a MIPS program

Introduction to CPU architecture using the M6800 microprocessor

Transcription:

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

What is Assembly Language? Assembly language is a programming language that is specific to every type of processor, i.e. it s machine dependent. Each processor has its own assembly language instruction set. Higher level language is machine independent, i.e. C, Fortran can be run on any machine (DEC, IBM, ) Generally, assembly language does very simple things like load a register with a number or add a number to an accumulator. One high level language instruction often does the equivalent of many assembly language instructions.

Elements of an Assembly Language Program assembler directives: tell the assembler to do certain things, not part of the processor instruction set. assembly language instructions: tell the processor what to do. labels: used for branching, etc. documentation: used to remind us what the program is doing. Effective use of assembly language requires that we know something about the processor architecture.

Motorola 68HC11 Architecture CPU A/D Converter Serial Port Memory Timer Address Bus Data Bus Memory (RAM, ROM, EPROM)

CPU 8-bit accumulators A and B (or 16-bit accumulator D) Program counter (16-bit) Condition Code register 16-bit index registers X and Y Stack pointer (16-bit)

Accumulators A and B Registers which can be used to store 8-bit numbers. We can also add a number to the current contents of an accumulator, which are then replaced by the sum i.e. (A) = 4 contents of A is 4 ADDA #7 adds the number 7 to current contents (A) = 11 contents of A are now 4 + 7 = 11 Data in memory can be transferred to an accumulator using the LDAA or LDAB instructions. Accumulator data can be written to memory via the STAA and STAB instructions.

Memory Model 0000 0001 0002. FFFF $FFFF = 64K 8-bit memory words

OP Codes For every instruction, there corresponds an OP code, a binary number which is stored in program memory. The OP code is what is understood by the processor. The reference manual indicates what OP codes correspond to what instructions. Many instructions have 16-bit (1-word) OP codes. Other instructions have OP code lengths which vary depending on the type of addressing mode used. Addressing modes are the different ways that the processor accesses/writes data from/to memory.

Program Counter (PC) 16-bit Program Counter (PC) contains address of current instruction to be executed. During sequential execution: PC = PC + length of current instruction (LOCI). Branch instruction causes PC to be loaded with 16 bit operand immediately following the branch instruction. During a call to a subroutine, PC+LOCI is pushed on the stack (we ll look at the stack later). And PC is loaded with starting address of subroutine. Return instruction pops the return address from the top of the stack back into the PC. Interrupt, causes PC to be pushed on the stack and PC is loaded with address of interrupt vector (we ll look at interrupts later.

Assembly Language Instruction Fields [label] mnemonic [operand] [comment] labels must begin in column 1, all other fields must be preceded by at least one blank. [ ] = optional each field must be separated by one or more blanks mnemonic can be either an instruction or an assembler directive Comment can also be in column 1 if preceded by a *

Addressing Modes ex) LDAA dat ;load acc A with number dat addressing mode determines how the number dat is fetched addressing modes: Immediate Direct Extended Indexed Relative

Immediate Addressing num EQU 31 ;num is set to 31 LDAA #31 ;load acc A with 31 LDAB #$1Fh ;load acc B with 31 LDAA #num ;load acc A with 31

Direct Addressing Can use direct addressing to get the number 31 in memory: dat RMB 1 reserve 1 memory byte for dat LDAA #31 STAA dat When the assembler encounters the RMB line, it associates the symbol dat with a memory address (usually in data RAM). Direct addressing then references the memory location where the desired operand is stored: LDAB dat load acc B with number ;stored in address dat Only the low address byte goes in program memory! The upper byte is assumed to be $00.

Extended Addressing LDAA dat ;load acc A with number ;stored in address dat Assume dat = $8015, the following OP code is placed in program memory: $B6 $80 $15 so instruction uses up 3 words of program memory.

Indexed Addressing Index registers X and Y are used to point to memory locations by loading them with the address we wish to access. Contents of X or Y can be offset Index registers can be incremented with INX instruction to point to the next byte Ex) LDX dat LDAA 0, X contents of address dat go in ACC A (zero offset)

Condition Code Register S X H I N Z V C C: set if there if a carry was generated V: set if there is a 2 s complement overflow N: set if result is negative Z: set if result is zero

68HC11 Software Development Tools Text Editor: used to create an ASCII text file (*.ASM) containing the assembly language program Assembler: converts the assembly language instructions in *.asm to hex object code file *.s19 Loader and Debugger: used to load object file into memory, allows you to step through the program one instruction at a time to check your code. Let s you view the contents of the processor s memory, registers, and accumulators as your step through the program.

Assembler Directives ORG: start at this address ORG $2000 RMB: reserve memory bytes ORG $2000 dat RMB 1 means that dat * corresponds to $2000 EQU: equate a symbol with a constant const EQU 31 FCB: form constant byte ORG $2000 dat FCB 31 location $2000 contains 31