

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Lab 3 for ece-3120 spring 2008 course, focusing on programming loops, branching, and arithmetic instructions using the hc12 microcontroller. Students are required to write a fully-commented program, calculate sums and counts of positive, negative, and zero numbers in an array, and debug the program using d-bug12. The document also includes instructions on how to prepare for the lab, assemble, and turn in the assignment.
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!


The purpose of this lab is to introduce you to basic programming on the 68HCS12 using program loops, branching, and arithmetic instructions. You will NEED to study about the arithmetic and branching instructions in Huang chapter 2 before attempting this program.
Prepare pseudocode and the first draft of the program and calculate the expected results by hand. 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 _____________
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 Loop.asm. It must use a single program loop for most of the work. The program should do the following:
The program directives should initialize the following signed decimal data byte array in the data space (starting at $1200): 100, 127, -127, 22, 0, -8, -1, 0, 1, 120, 77, -45, 0, -99, in this order.
The program should store in memory:
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. Single-step through the program until it completes the first loop iteration and is ready to branch back to the start of the loop. Verify that each change is correct. b. Then set a breakpoint to stop execution at the end of each loop and run through the rest of the program to the end, pausing at each breakpoint to display the important results. Verify that each result is correct at the end of each loop and that all four 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. c. 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. d. 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 _____________