ECE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE

Similar documents
ECE 3120 Fall 2013 Lab 1 Code Entry, Assembly, and Execution

ECE 3120 Lab 1 Code Entry, Assembly, and Execution

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports

Lab 1 MC9S12 Assembler and Monitor

Lab 1 MC9S12 Assembler and Monitor

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

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

CE-320 Microcomputers I Winter 2010 LAB 1: MINIIDE GROUP #: NAME: PARTNER: Lab 1 Page 1

Getting Started with the HCS12 IDE

Introduction to the 9S12 Microcontroller

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Exam I Review February 2017

EE 308 LAB 1 ASSEMBLER, SIMULATOR, AND MONITOR. Introduction and Objectives

ECE3120: Computer Systems Hardware & Software Development Tools

68HC12 Training Lab Student Exercise Book

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

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

1. Memory Mapped Systems 2. Adding Unsigned Numbers

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

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

Lab 7: Change Calculation Engine

MC9S12 Address Space

Homework 12 Solutions

ME 6405 Introduction to Mechatronics

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

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

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

ECE 3610 MICROPROCESSING SYSTEMS

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)

A Simple MC9S12 Program

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

Mark II Aiken Relay Calculator

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

Cross Assembly and Program Development

Lecture 5 Assembly Programming: Arithmetic

LAB #1: The CSM12C32 Module and PBMCUSLK Project Board

Introduction to Programming

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

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)

Introduction to Microcontrollers

HC 11 Instructions! From Alex Hollowayʼs notes with! many thanks!

ECE 331: PC Lab 3 Stack and Subroutines

It translates (converts) assembly language to machine code.

Assembly Language programming (1)

Lab 8: Debugging Embedded Devices and Software

Chapter 3: HCS12 Hardware and Software Development Tools. The HCS12 Microcontroller. Han-Way Huang. Minnesota State University, Mankato

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

Programming the Motorola MC68HC11 Microcontroller

Programming the CME11E9-EVBU, Keypad, and LCD

538 Lecture Notes Week 5

538 Lecture Notes Week 5

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

Programming the CME11E9-EVBU, Keypad, and LCD

Microcontrollers. 2IN60: Real-time Architectures (for automotive systems) Mike Holenderski,

Serial Communication Through an Asynchronous FIFO Buffer

Using the stack and the stack pointer

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

CMPEN 472 Sample EXAM II

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

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.

ECE 367 -Experiment #1 Fall 2012

NEW CEIBO DEBUGGER. Menus and Commands

EE 308 Spring The HCS12 has 6 addressing modes

ELEG3924 Microprocessor

Lecture 6 Assembly Programming: Branch & Iteration

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

ECET Chapter 2, Part 2 of 3

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

HC12 Microprocessor. D-Bug12 Functions: Stepping Through Programs & Performing I/O. Dr. Bradley J. Bazuin

Sample Problem Set #1

EMCH 367 Fundamentals of Microcontrollers Example_Sort EXAMPLE SORT

Lecture 7 Assembly Programming: Shift & Logical

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

Lab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011

ECE 3120 Computer Systems Arithmetic Programming

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

Teaching and Curriculum Development of Microprocessor Classes

538 Lecture Notes Week 3

Lecture 11: Advanced Arithmetic Instructions

Microcontrollers and the Freescale/Motorola HC11

Introduction to Microcontrollers II

HC11 Instruction Set

Coe538 Final Study Guide 2016 (Questions & Answers)

Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE

An Introduction to Komodo

Introduction to CPU architecture using the M6800 microprocessor

ECE372 CodeWarrior Simulator Andreou/Michaelides

68000 Architecture, Data Types and Addressing Modes. 9/20/6 Lecture 2 - Prog Model 1

EE 3170 Microcontroller Applications

POTENTIOMETER. Revision Class. Instructor / Professor LICENSE

Lecture 9 Subroutines

ECE3120: Computer Systems Hardware & Software Development Tools

Introduction to the SX Microcontroller

Computer Organization I. Lecture 28: Architecture of M68HC11

Introduction to Microcontrollers III

Introduction to Embedded Systems. Some Nagging

Lab 7: Asynchronous Serial I/O

Microcontrollers. Microcontroller

Transcription:

L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE The purpose of this lab is to introduce you to the layout and structure of Assembly Language programs and their format. You will write your own programs later on in the semester with similar structure. All code should be capitalized. Comments should not be capitalized. From left to right, you will notice four columns. The first column contains label names. The second column contains instruction/assembler keywords. The third column contains data or operands. The fourth column is used for comments. Your programs should always be in this format. INTRODUCTION TO MiniIDE MiniIDE is a windows based program, which allows assembly programmer to assemble, debug, and download a program onto the 68HCS12 board. This lab familiarizes the student with all the steps involved in loading, running, and debugging assembly language programs using MiniIDE. The student will be required to remember all the steps to load programs in future labs. Please use your U: drive for all your lab work. READ ALL INSTRUCTIONS CAREFULLY!! PROCEDURE: I) USING MINIIDE 1. Start All Programs Engineering ECE CAD Lab MGTEK MiniIDE 2. Click on the File New. This is where you will write your program. Type the following program into the edit window Fall 2008 Page 1

***************************************************************** * LAB1.ASM Student Name* * Introduction * ***************************************************************** DATA EQU $2100 ;label Data equals hex 2100 NUM EQU $AC ;label NUM equals hex AC ORG NUM_ONE DC.B $2100 $8F ;define Constant Byte with label NUM_ONE & ;value hex 8F NUM_TWO RMB ORG 1 $2000 ;reserve ONE Memory Byte ;start at memory location 2000 CLR NUM_TWO ;clear reserved memory location, $2101 LDAA LDX #NUM #DATA ;load the value of label NUM into Accumulator A ;load register X with the value of label DATA LDAB $0,X ;load Accumulator B with content of memory ;location pointed to by register X incremented ;by 0 (2100) STAB NUM_ONE ;store the content of Accumulator B into ;NUM_ONE STAA NUM_TWO ;store the content of Accumulator A into ;NUM_TWO LDAA #$80 ;load Accumulator A with value $80 (immediate ;addressing mode ABA SWI ;add the content of A & B and store result in A ;Software Interrupt Command. Makes ;microcontroller Stop executing till further ;instructions II) RUNNING A PROGRAM 1. First, make sure you can communicate with the 68HCS12 board. Go to Terminal Options. Here you should see a window that has the COM settings. Make sure the COM port that is selected is COM1. Also, make sure the HCS12 board is plugged in! 2. Hit the RESET button on the 68HCS12 board. This is located in the middle of the bottom edge of the board. You should get the following text in the Terminal Window: D-Bug12 4.0.0b29 Copyright 1996-2005 Freescale Semiconductor For Commands type "Help" > 3. In the Terminal Window, at the prompt, type LOAD Enter. The terminal window commands are not case sensitive. 4. Go to Build--> Build Current 5. Click the F8 button. A window will pop up. Select the LAB1.s19 file. Click OPEN. Fall 2008 Page 2

Normally, you would run this program by typing g 2000. However, for this lab, we want to see what will happen as we execute the program step-by-step. To do so follow the following instructions: In the Terminal Window, type PC 2000 Enter. This sets the PC (Program Counter) to the value 2000. Note that all values are hexadecimal values. Type t Enter. T stands for Trace. This command is used to run the program one line at a time on the screen. One may also use t 8 to execute all 8 lines and stop. T will trace singly or through as many lines as specified. Observe the content of Accumulators A & B, Registers X as well as the CCR (Condition Code Register) for each line. Record these values in Table 1. A B X N Z V C Table 1 III) D-BUG12 MONITOR COMMANDS This section will provide a walk-through of important and useful D-BUG12 commands. After steps 3, 4, and 5 copy the terminal window output and paste it into Word as shown by the TA for inclusion in the report. 1. Hit the RESET button on the 68HCS12 board. Make sure the terminal window is still activated. If not, follow the instructions in part 2, step 1. 2. In the Terminal Window type bf 2000 2200 0 and hit Enter. This has block filled all memory locations from $2000 to $2200 with zeroes. To view this change, type md 2000 2200 Enter. The memory contents from $2000 to $2200 are displayed on screen, and all should be filled with zeroes. md stands for memory display. Fall 2008 Page 3

Note: Each memory display line holds the 16 byte block associated with the beginning address. The $2200 block displays $2200 - $220F for example on one line. Using the command md $220A will display the entire 16 byte block associated with it; therefore it will display $2200 - $220F. 3. Now let s look at modifying memory contents from the terminal window. Type mm 2110 Enter. Make the following addresses hold these values by typing in the value corresponding to the memory location and pressing enter (note that the 20xx will be displayed as a prompt): 2110 86 2111 9A 2112 25. At 2113 type the following: 12 / Enter. You will see the results of changing $2113 to 12. Type Enter 55 ^ Enter 44. Enter. Lastly, display the memory contents of $2110 using md 2110 and record the final values below (assume these are hex. values): 2110 2111 2112 2113 4. To modify the registers, type the register name, space, and then the value. Examples below to type are: A: 99 B: EB X: 569A Approved: Lab TA Date What to turn in during the next lab session (in this order please with a cover sheet): 1. A print-out of LAB1.asm and Lab1.lst (*.lst in landscape). Use Programmer s File Editor available in the Engineering portion of the start menu. DO NOT USE MINI_IDE TO PRINT THE LISTING IN LANDSCAPE! IT WILL TRUNCATE THE FILE. 2. A print-out from the terminal screen (highlight, type ctrl+c, and paste into MS Word use Courier New as the font) that includes the following: Fall 2008 Page 4

Results of entering t Results of Section III, Parts 3 and 4 Comment the print-out to indicate what each portion is displaying 3. Answers to the following questions about the code: What was the original content of the memory location 2100? What is the final content of memory locations 2100 & 2101? (use md) When you added Accumulator A and B, what was the answer you got? What was the answer supposed to be? Why didn t you get that answer? Fall 2008 Page 5