Ask DBMS Expert


Home >> DBMS

Microcontrollers Lab

Lab Objectives

The objective for this lab is to become familiar with the stack. This will be achieved through the simulation of a simple postfix notation (a.k.a., Reverse-Polish Notation or RPN) calculator.

Work Tasks

Step 1

Allocate your stack such that the stack is located in what we defined as the data section of RAM. Remember, we defined our data section with the label "PROG" using the ORG assembler directive. Use the LDS instruction to initialize your stack. Now, load the stack using a loop with the values shown below. After the stack is loaded, use the TSX command to transfer the SP to index register X and then to load accumulator A with $23 and accumulator B with $67 (HINT: take a look at the lecture on stacks).

Figure 3: Stack and its contents.

Step 2

Code the simple postfix notation calculator that performs the operation shown in Figure 4. This calculator will only perform one operation ((35) (5) (-2) + (10)x-(4)+). The infix expression of the operation to be performed is "35 + ((5 + -2) x 10) + 4". Don't worry about saving the operators on the stack. Always push values on the stack. However, when you reach an operator, pull the values off the stack into registers, perform the arithmetic operation, and push the result back on the stack according to Figure 4. Your final result should be 9 ($09) and should be on the top of the stack.

NOTE: the multiply instruction (MUL) multiplies two 8-bit numbers and returns a 16-bit number. In this case, only return the lower 8-bit as the result.

Step 3

Now take the postfix notation calculator a step further. Using a loop, branches, and the stack, create a postfix notation calculator that performs the +, -, x, and / operations, as shown in the example in CALC_IN. Add the variables below to the DATA section of your code. Use these variables to implement your calculator. The operations should be the machine opcode as follows:

+: $8A, -: $8B, x: $8C, and /: $8D. For example, if you want to use ABA to implement +, the value should be $18. Make sure to replace those ??s with what you want to use before you try to use the code. CALC_IN contains the variable with the operation to perform. Use conditional statements and your knowledge of the opcode to determine if there is an opcode, and if so which operation to perform. The values in CALC _IN below are initially 84/2*21+- and the result should be 1. Try another operation of your choosing by changing CALC_IN and discuss it in the methodology section of your report. Keep in mind you won't be able to use any values that are the same as the opcodes you are using, but any other value should work, including negative values.

CALC_IN FCB $08,$04,$8D,$02,$8C,$02,$01,$8A,$8B

HINTS: You will traverse the CALC_IN array in a similar fashion to lab 3. You will jump out of the array when an operator is found, pull two values off the stack, perform that particular operation, push the result onto the stack, and then return to the loop. Otherwise, you will just push the value on the stack.

NOTE: the divide instruction (IDIV) requires two 16-bit registers and returns a 16-bit value.

Only return the lower 8-bit as your result.

What to Turn In (Please read this carefully)

You are to put your code as text and screenshots into the "lab_4_template.docx" in the designated areas. This will be the file that you upload to TITANium as your submission. Provide your code as text, not an image. Points will be deducted if it is an image. You are then to take screenshots of your program in both CodeWarrior and terminal (i.e. on the Dragon board). The screenshot should show the relevant CPU registers and memory locations (NOTE: a convenient way of getting screenshots is to use the "snipping tool"). Do NOT crop the screenshot, for any credit I want a full screen screenshot of your computer screen including the task bar. Also you must answer the questions on the "lab_4_template.docx" file.

Attachment:- Lab_4_Instructions.pdf

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M92013173

Have any Question?


Related Questions in DBMS

Data mining assignment -in this assignment you are asked to

Data Mining Assignment - In this assignment you are asked to explore the use of neural networks for classification and numeric prediction. You are also asked to carry out a data mining investigation on a real-world data ...

Sql query assignment -for this assignment you are to write

SQL Query Assignment - For this assignment you are to write your answers in a word document. This assignment is in three parts: Part A (reporting queries), Part B (query performance), Part C (query design). For this assi ...

The groceries datasetimagine 10000 receipts sitting on your

The groceries Dataset Imagine 10000 receipts sitting on your table. Each receipt represents a transaction with items that were purchased. The receipt is a representation of stuff that went into a customer's basket. That ...

You are in a real estate business renting apartments to

You are in a real estate business renting apartments to customers. Your job is to define an appropriate schema using SQL DDL in MySQL. The relations are Property(Id, Address, NumberOfUnits), Unit(ApartmentNumber, Propert ...

Objectivethe objective of this lab is to be familiar with a

OBJECTIVE: The objective of this lab is to be familiar with a process in big data modeling. You're required to produce three big data models using the MS PowerPoint software. This tool is available on UMUC Virtual Deskto ...

The relation memberstudentid organizationid roleid stores

The relation Member(StudentId, OrganizationId, RoleId) stores the membership information of student joining organization. For example, ('S1', 'O2', 'R3') indicates that student with Id 'S1' joined the organization with i ...

Relational database exerciseyou have been assigned to a new

Relational Database Exercise: You have been assigned to a new development team. A client is requesting a relational database system to manage their present store with the anticipation of adding more stores in the future. ...

Relational database design a given the following business

Relational Database Design A) Given the following business rules, identify entity types, attributes (at least two attributes for each entity, including the primary key) and relationships, and then draw an Entity-Relation ...

We can represent a data set as a collection of object nodes

We can represent a data set as a collection of object nodes and a collection of attribute nodes, where there is a link between each object and each attribute, and where the weight of that link is the value of the object ...

Data model development and implementationpurpose of the

Data model development and implementation Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop data models and map Database System into a standard development environment to gain unde ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As