Lab 2 - Basic Arithmetic Programming - Spring 2004 | ECE 3120, Lab Reports of Microcomputers

Material Type: Lab; Class: Microcomputer Systems; Subject: ECE Elect & Computer Engr; University: Tennessee Tech University; Term: Spring 2004;

Typology: Lab Reports

Pre 2010

Uploaded on 07/30/2009

koofers-user-xov
koofers-user-xov 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE-3120
Spring 2004
LAB 2 – Basic Arithmetic Programming
The purpose of this lab is to introduce you to basic programming with the 68HC12 using
assembler directives and arithmetic instructions. You will NEED to study the directives
and arithmetic operation instructions in Huang chapter 2 before attempting any
programming. The code is fairly simple to write since it is very similar to what you did in
Lab1.
PRE-LAB:
Prepare pseudocode and the first draft of the program and calculate the expected results.
This must be completed before coming to the lab and shown to the lab instructor at the
start of the lab session.
Approved: Lab TA _____________________ Date ____________
PROGRAMMING ASSIGNMENT:
Write a fully-commented program for the HC12 board, including appropriate directives
and labels for memory operands and constants, called Arith.asm. The program should do
the following:
Have an array of five unsigned byte values: 61, 200, 47, 188, and 26 initially
stored in memory starting at location $900.
Calculate the average of the 5 numbers and store this byte in memory location
$908.
Calculate the sum of the first 4 numbers and store this word in memory location
$90A:90B.
Subtract the average value from the sum and store the difference (word) in
memory location $90C:90D.
Assemble, download, and then single-step through the program to debug it. Write an
execution trace list, showing each instruction and recording every change in value of all
registers (including CCR) and/or memory after each instruction. Verify that each change
is correct and that the final values of average, sum, and difference are correct. Then reset
the processor, download the program again, run it at full speed until it stops, and verify
that the final values are still correct.
Approved: Lab TA _____________________ Date ____________
2/13/04 Page 1 of 2 Lab 2
pf2

Partial preview of the text

Download Lab 2 - Basic Arithmetic Programming - Spring 2004 | ECE 3120 and more Lab Reports Microcomputers in PDF only on Docsity!

ECE-

Spring 2004

LAB 2 – Basic Arithmetic Programming

The purpose of this lab is to introduce you to basic programming with the 68HC12 using assembler directives and arithmetic instructions. You will NEED to study the directives and arithmetic operation instructions in Huang chapter 2 before attempting any programming. The code is fairly simple to write since it is very similar to what you did in Lab1.

P R E - L A B :

Prepare pseudocode and the first draft of the program and calculate the expected results. This must be completed before coming to the lab and shown to the lab instructor at the start of the lab session.

_Approved: Lab TA _____________________ Date _____________

P R O G R A M M I N G A S S I G N M E N T :

Write a fully-commented program for the HC12 board, including appropriate directives and labels for memory operands and constants, called Arith.asm. The program should do the following:

  • Have an array of five unsigned byte values: 61, 200, 47, 188, and 26 initially stored in memory starting at location $900.
  • Calculate the average of the 5 numbers and store this byte in memory location $908.
  • Calculate the sum of the first 4 numbers and store this word in memory location $90A:90B.
  • Subtract the average value from the sum and store the difference (word) in memory location $90C:90D.

Assemble, download, and then single-step through the program to debug it. Write an execution trace list, showing each instruction and recording every change in value of all registers (including CCR) and/or memory after each instruction. Verify that each change is correct and that the final values of average, sum, and difference are correct. Then reset the processor, download the program again, run it at full speed until it stops, and verify that the final values are still correct.

_Approved: Lab TA _____________________ Date _____________

2/13/04 Page 1 of 2 Lab 2

ECE-

Spring 2004

T H I N G S T O T U R N I N

  1. This Lab 2 assignment sheet, with approval signatures.
  2. Your corrected (if necessary) pre-lab documents.
  3. Printouts of Arith.asm and Arith.lst. As always, use PFE to print the listing in landscape.
  4. Your execution trace list.

2/13/04 Page 2 of 2 Lab 2