Laboratory 4: Minimum and Maximum Program - Spring 2008 | ECE 3120, Lab Reports of Microcomputers

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

Typology: Lab Reports

Pre 2010

Uploaded on 07/31/2009

koofers-user-tup
koofers-user-tup 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE-3120
Spring 2008
LAB 4 – Min/Max Program
2/27/08 Page 1 of 3 Lab 4
The purpose of this lab is to reinforce your basic programming skills with the 68HSC12
using program loops, arrays, comparisons, and arithmetic instructions.
PRE-LAB:
Prepare pseudocode and the first draft of the program and calculate the expected results
by hand (both decimal and hex). This must be completed before coming to the lab and
shown to the lab instructor at the start of the lab session. Note: The Pre-Lab must be
typed into a proper *.ASM source file, following our standard Program Format
requirements.
Approved: Lab TA _____________________ Date ____________
PROGRAMMING ASSIGNMENT:
Write a fully-commented program for the HC12 board, following our standard Program
Format requirements (http://iweb.tntech.edu/rhaggard/3120s08/Program_Format.htm),
including appropriate directives and labels for memory operands and constants, called
Minmax.asm. It must use a program loop and comparisons for most of the work. The
program should do the following:
Be able to process any array of 1 to 255 signed data words as follows. Each
data word can have a value between -32768 and +32767. This means that the
program should be able to handle any size array in this range, with any set of
values, by changing ONLY the directive that creates the array values, without
modifying any instructions or other directives.
The size of the array cannot be stored as a pre-defined constant. A zero value
in the array is a delimiter (special flag value) that means that you have
reached the end of the array, so stop all processing at this point. This is
another way to terminate a loop, without using a fixed number inside your
program (or in a directive). The program must not include the delimiter of
zero in calculating any of the numerical results.
Count the number of array elements that are exact multiples of 5.
Search through the array, looking for the maximum (most positive) and
minimum (most negative) numbers. Also give the array index of the
maximum number.
The code must start at $1000.
pf3

Partial preview of the text

Download Laboratory 4: Minimum and Maximum Program - Spring 2008 | ECE 3120 and more Lab Reports Microcomputers in PDF only on Docsity!

Spring 2008

LAB 4 – Min/Max Program

The purpose of this lab is to reinforce your basic programming skills with the 68HSC using program loops, arrays, comparisons, and arithmetic instructions.

P R E - L A B :

Prepare pseudocode and the first draft of the program and calculate the expected results by hand (both decimal and hex). This must be completed before coming to the lab and shown to the lab instructor at the start of the lab session. Note: The Pre-Lab must be typed into a proper *.ASM source file, following our standard Program Format requirements.

_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, following our standard Program Format requirements (http://iweb.tntech.edu/rhaggard/3120s08/Program_Format.htm), including appropriate directives and labels for memory operands and constants, called Minmax.asm. It must use a program loop and comparisons for most of the work. The program should do the following:

  • Be able to process any array of 1 to 255 signed data words as follows. Each data word can have a value between -32768 and +32767. This means that the program should be able to handle any size array in this range, with any set of values, by changing ONLY the directive that creates the array values, without modifying any instructions or other directives.
  • The size of the array cannot be stored as a pre-defined constant. A zero value in the array is a delimiter (special flag value) that means that you have reached the end of the array, so stop all processing at this point. This is another way to terminate a loop, without using a fixed number inside your program (or in a directive). The program must not include the delimiter of zero in calculating any of the numerical results.
  • Count the number of array elements that are exact multiples of 5.
  • Search through the array, looking for the maximum (most positive) and minimum (most negative) numbers. Also give the array index of the maximum number.
  • The code must start at $1000.

Spring 2008

LAB 4 – Min/Max Program

The program directives should initialize the following signed decimal data word array in the data space (starting at $1200): 105, -32768, 2100, -1450, 5, 24542, -128, -32760, -1, 1, -81, 32767, -24444, 256, 0 in this order.

The program should store in memory:

  • The signed minimum value in memory location $1300:$
  • The signed maximum value in memory location $1302:$
  • The index of the maximum value in memory location $
  • The count of values that are multiples of 5 in memory location $

Procedure : First, use D-Bug12 to fill memory locations $1000 through $14FF with zeros. Then assemble, download, and debug/execute the program as follows. a. Set a breakpoint to stop execution at the end of each loop and run through the program to the end, pausing at each breakpoint to display the important values. Verify that each value is correct at the end of each loop and that all final results are correct at the end of the program. Use the listing file to determine the breakpoint address. Remember that the instruction at the breakpoint address is NOT executed when the break occurs; it is only executed when you resume execution after the break. b. Then reset the processor (which removes the breakpoint), download the program again, run it at full speed until it stops, and verify that the four final values are still correct. c. When finished debugging and executing, copy the entire terminal window output and paste it into a Notepad or Word document for inclusion in the report. You should edit out mistakes and unnecessary repetitions before submission.

_Approved: Lab TA _____________________ Date _____________