0% found this document useful (0 votes)
95 views3 pages

Up Assignment#1 - Fall 2017

This document contains an assignment for a microprocessor programming and interfacing course. It includes 6 questions related to dry running and writing assembly language code to perform tasks like number conversion, arithmetic operations, and output timing. Students are asked to write code to calculate powers, square roots, binary-coded decimal conversion, and output pulses at a specific pin with a timed delay. The assignment is due on September 25th or 26th, 2017 depending on the student's class section.

Uploaded by

Umair Hameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views3 pages

Up Assignment#1 - Fall 2017

This document contains an assignment for a microprocessor programming and interfacing course. It includes 6 questions related to dry running and writing assembly language code to perform tasks like number conversion, arithmetic operations, and output timing. Students are asked to write code to calculate powers, square roots, binary-coded decimal conversion, and output pulses at a specific pin with a timed delay. The assignment is due on September 25th or 26th, 2017 depending on the student's class section.

Uploaded by

Umair Hameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

National University of Computer & Emerging Sciences, Lahore

Department of Electrical Engineering (Fall 2017)

EE303 – Microprocessor Programming & Interfacing


Assignment#1
Due Date (EE-2): September 25, 2017
Due Date (EE-1 & EE-3): September 26, 2017

CLO-01 & CLO-02

Question#1:
a) Dry run the code given below and explain the complete working of the code.
b) If the subroutine “complement” is called using ACALL command then explain
whether the code will execute in the same manner or not. Give your answer with
proper reasoning.

org 0x000F
mov A,#0AH
acall double
here:
mov P1,A
sjmp here
double:
add A,0E0H
lcall complement
ret
org 0x2FFF
complement:
cpl A
mov P1,A
ret
end

Question#2:

a) Dry run the code if A=3H and find out the relative address for each jump.
b) Dry run the code if A=2H and find out the relative address for each jump.
National University of Computer & Emerging Sciences, Lahore
Department of Electrical Engineering (Fall 2017)

LOCATION CODE
org 0x0
0000 again:
0000 mov p1,a
0002 jnb acc.0,mul_2 //check 0th bit of accumulator is high
0005 mov b,#2
0008 mul ab
0009 mov b,#3
000C div ab
000D mov p2,a
000F sjmp again
0011 mul_2:
0011 mov b,#3
0014 mul ab
0015 mov b,#2
0018 div ab
0019 mov p2,b
End

Question#3:

Write a program that calculates the result of the number in register R0 raised to the power
the number stored in R1 register. For example, if R0=3 and R1=4, then your result will be
34 = 81. Show the 16-bit result in A (Lower Byte) and B (Upper Byte).

Note: R0 range is 1-8 and range for R1 is 0-6.

Question#4:

Write a program that finds a 2-byte square root of a number in A [0H - FH]. The first byte
is the integer value of the root, and the second byte is the fractional value of the root. Your
program should show the integer value (in decimal) in R5 and the fractional value (in
decimal) in R6. For example, square root of 2 is 1.41 approximately then your code should
show ‘01’ in R5 and ‘41’ decimal in R6.

Use lookup tables to store the corresponding integer and fractional value of square root of
a number.

Question#5:

Write an assembly language program that converts the hex number in accumulator A to an
equivalent BCD number in registers R6 (MSB digit) and R7 (LSB digit).
National University of Computer & Emerging Sciences, Lahore
Department of Electrical Engineering (Fall 2017)

Note: The hex number in accumulator ranges from 00 H – 63 H

Question#6:

Write a program that sets the P1.3 pin for 20msec every 100msec continuously. Assume
crystal frequency to be 24MHz.

Output at P1.3 will be:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy