0% found this document useful (0 votes)
111 views

CPE 325: Embedded Systems Laboratory Laboratory Assignment #4

The document outlines a laboratory assignment involving 3 questions - the first asks students to write an assembly program to count symbols in a string and display the count, the second asks students to perform multiplication by repeated addition, and the third is an optional bonus to increment numerals in a string; the document provides hints and specifies deliverables including a lab report with screenshots and flowcharts along with the source code files.

Uploaded by

Sheeraz Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views

CPE 325: Embedded Systems Laboratory Laboratory Assignment #4

The document outlines a laboratory assignment involving 3 questions - the first asks students to write an assembly program to count symbols in a string and display the count, the second asks students to perform multiplication by repeated addition, and the third is an optional bonus to increment numerals in a string; the document provides hints and specifies deliverables including a lab report with screenshots and flowcharts along with the source code files.

Uploaded by

Sheeraz Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CPE 325: Embedded Systems Laboratory

Laboratory Assignment #4

Assignment [100 pts]


1. For this lab assignment, please implement an assembly program that counts the number of
symbols in a string (characters other than uppercase/lowercase letters and numerals). The
string can be hard-coded in the program as a cstring type.
Your implementation should be in an assembly program. Please store the count value in a
variable (defined using .data in your code). You should display this value using the memory
browser.
Hint: Create an assembly project as mentioned in the tutorial for Lab 4. You do not need to
print the result in the console window.
Hint: You need to declare your variable in data segment (.data) of the code to make them
readable and writable as shown in the example below:
.data
symb_count: .int 0 ; [50 pts]
Please include a flowchart for your implementation.

2. Write an assembly program that performs multiplication by addition:


a. First, you should define a variable which is a string in the format of “a*b” where a and b
represent numbers from 0 to 9. If the string is not in the correct format, you should send
0xFF to P2OUT.
b. The smaller number will determine the number of iterations, and the greater number
will be added to itself until the multiplication result is found. For example, whether the
string is “3*5” or “5*3”, 5 gets added to itself 3 times to produce the result 15.
c. The final value needs to be an integer number and not a string
d. Send the final result to P2OUT. [50 pts]

3. (Bonus: up to 15pts): Write an assembly program where you would declare a string as
shown below. You will then increment the value of any numerals to 1 more than their
current value (wrapping to 0 if the digit is 9). This means you need to change the value in
their original location in memory. For demonstration, you must present the updated values
in the memory browser.

Hint: You need to declare your variable in the data segment (.data) of the code to make them
readable and writable as shown below.
.data
myString: .cstring “I enjoy learning msp430” ;

Hint: Results for the string given above would be: “I enjoy learning msp541”

Questions To Be Addressed:
Please make sure that you have addressed following questions in your demonstration:
1. Describe briefly how you solve Q1.
2. In your memory browser window, show where the values are stored for Q1.
3. In the registers window, show the value of P2OUT at the end of Q2.
4. What is register indirect addressing with auto increment? Do you use it anywhere in your
code? How and Where?

Topics For Theory:


1. Assembler Directives
2. Different Addressing Modes
a. Format and description of the following modes
i. register
ii. indexed
iii. symbolic
iv. absolute
v. indirect
vi. immediate
b. Also, give an example of indirect addressing with auto increment.

Deliverables
1. Lab report which includes:
a. Screenshots of the memory browser and registers
b. Flowchart for question 1
2. Source files (.asm files) or as directed

You might also like