The Most Rapid Essay Writing Service For Your Academic Success

Become a better student and get high grades with our professional writers.

Welcome to the #1 paper writing service, where each essay writer knows your needs and saves you from endless tasks!

  • We cover all disciplines and academic styles.
  • We meet your deadlines and formatting requirements.
  • We ask nothing but your “thank you” in return.

Entrust our essay writing service with your homework today—and forget about dull tasks and poor grades forever.

Computer Science

LAB1, 2, and 3 Using Subroutines and Macros

(Part 1, 2, and 3)

Overview

The purpose of this lab is to program the MC8051 to add multi bytes

two signed integers. To simplify our laboratory, we will assume three

bytes long (24 bits) signed integers. Each of the three bytes will be

defined in three consecutive code memory bytes using the DB

assembler directive. The program will store the answer in three

consecutive data memory bytes starting at Ram address 40H. The

program will also display the answer on P0, P1, and P2 staring with

the LS Byte in P0. Port 3 pin 0 (P3.0) will be set if an overflow takes

place, otherwise it will stay cleared. Three versions of the program

will be implemented starting with all code included in one main

program. The second implementation will employ two subroutines to

make advantage of the repeated code blocks. The final

implementation will utilize two Macros to reduce the size of the

source program and improve its readability.

Steps

First, configure your code and data memory. The MAIN: program

starts at code memory location 30H. The first integer uses code

memory locations 100H, 101H, and 102H in the Intel MC8051 little

endian format. The second integer uses code memory locations

105H, 106H, and 107H.

Second, configure parallel port 0, port 1, port 2, and P3.0 for output.

Write and debug the code to add the two integers and store the

answer in data memory locations 40H, 41H, and 42H. Update P0, P1,

and P2 to display the same addition result. Flag an overflow

condition on P3.1 by setting it.

.

Third, rewrite the program utilizing subroutines to make use of the

repeated code blocks. Define the created. Subroutines after the main

program before the program END directive.

Fourth, rewrite the program utilizing Macros to make use of the

repeated code blocks. Define the created. Macros before the main

program code. Unlike labels, the assembler will issue an error if

Macros are not defined before they get referenced. Every Macro must

end with EMAC directive. The Macro starts by its name followed by

the word MACRO. Example of a SUM Macro is the following:

SUM MACRO

——- ———–

——- ———–

EMAC

Type the name of the Macro at desired locations in your

assembly source program as needed for the assembler to

insert the Macro object code in the final object file.

Fifth, check the three programs for different integers and verify the

overall operations. Make sure to test cases producing an overflow.

Also make use of break points in the Keil debugger to enhance and

speed up the checkout.

Document and submit your final report along with the well

documented list file. Also describe the steps and tools used in

debugging your program.

Describe how to modify / redesign your program to perform the

addition of two multi bytes integers up to 16 bytes long; one stored at

code memory starting address of 100H and the other at 110H. The

length of the two integers is input from port 3 (P3). The answer is

stored at data memory starting at address 40H through 4FH.

You can leave a response, or trackback from your own site.
Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes