You are on page 1of 2

EEEB373 / EEEB2044 Microprocessor Systems

Semester 1, 2020/21

Individual Programming Assignment

Using MPLAB IDE

This is an individual assignment focusing on the use of MPLAB IDE to solve problem related
to Topic 3. Submit all the deliverables to designated submission portal by 11:59 pm, Monday,
16th November 2020.

Instructions:

1) Download from Moodle a comma-separated value file (**.csv) with your student ID
(SID) as the file name – for example, if your SID is EE0100106 then the file you should
download is EE0100106.csv. The file contains a unique dataset that you will be using
for the assignment. You can use Notepad or any text editor to open the file and copy
the dataset.
2) Using proper assembler directives, define a data section at the program memory
starting at address 0x03000. The data section should be named MyData and consists of
the dataset that you’ve downloaded in part (1). The dataset should be defined as 8-bit
(1 byte) unsigned numbers. The values in the dataset is given as decimal numbers.
3) Write an assembly program to:
a. Count the number of elements in the dataset MyData until you encounter a zero
in your dataset. The element with value of zero should not be counted. Save the
answer to file register 0x00 at data memory.
b. Sum all the elements in your dataset, from the first element until the element
with zero, and save the result as a two-byte sum to file registers 0x01 and 0x02
using the little-endian format.
c. Find the largest elements in the dataset (from the first element until the element
with zero), and save the answer to file register 0x10 at data memory.
d. Find the smallest non-zero elements in the dataset (from the first element until
the element with zero), and save the answer to file register 0x11 at data memory.
e. Lastly, calculate the average between the largest (found in Part (c)) and the
smallest non-zero (found in Part (d)) elements, and save the answer to file
register 0x12 at data memory.
4) Your program must start at address 0x00100. Make sure you include sufficient
comments to make your program readable and understandable.
5) Assemble and build your assembly program using the MPLAB IDE based on the
PIC18F458. Debug your program and show that it is functionally correct.
EEEB373 / EEEB2044 Microprocessor Systems
Semester 1, 2020/21

6) Compile all the deliverables into a report which should include the following:
a. Pseudo-codes or flow-chart
b. The assembly program from ASM file (*.asm)
c. The MPLAB Output Window showing the result of the final successful build
process
d. The listing file (*.lst) generated after the successful build
e. The contents of the program memory (displayed as Opcode Hex) for data
section (starting at 0x03000)
f. The contents of the program memory (displayed as Symbolic) for main program
(starting at 0x00100)
g. The final contents of data memory block starting from 0x00 till 0x1F.
h. The final contents of watch window with the following registers: WREG,
STATUS, TABLAT, TBLPTR

DO NOT COPY FROM OTHER STUDENTS


WHENEVER A STUDENT WAS FOUND TO COPY FROM ANOTHER STUDENT
BOTH STUDENTS WILL GET ZERO MARK!

You might also like