Microprocessors And Applications Laboratory
1.Write a program, which loads Registers, A, B, C, and D with the same constant. Try to optimize t he program in such a way that the smallest numbers of program bytes are used. Test the program in single step mode. After each step, test the register of interest.
a. Assume that 4 bytes of data are stored at consecutive locations of the data-memory starting at (x). Write a program, which loads Registers E with (x), D with (x+l), C with (1+2) and A with (x+3).
b.Assume that l byte of data is stored at data memory location (x). Write a program which tests bit 5 of (X). Write ‘FF’ in (x+1), if bit 5=0 and write ‘00’ at the same location if bit 5=1.
c.Write a program which tests the zero-condition of a data byte specified at data memory location (x). If it is zero ‘00’ should be stored at (x+1) location, if non-zero ‘FF’ should be stored at the same location.
d.A binary number is stored at data-memory location (x) Compute the number of its logical 1’s and store the result at y.
e.Comment on the instructions used in the above three programs and write about the effect of flags with the instructions used.
2.Two unsigned binary numbers are stored at data-memory locations (x) and (x+1).
Compute the sum of the two numbers and store the result at y, ignoring the possible overflow.
3.Write a program to compute (x+1) – (x). The magnitude of the result should be stored at (y) and the sign (00 if positive, 01 if negative) at (y+1). Understand the 2’s compliment Arithmetic.
a) A double precision number is stored at (x) and (x+1) (lower order byte at (x). Add another double precision number stored at (y) and (y+1) (lower order byte at (y)]. Store the result at (w) and (w+1).
b) Same as above: subtract the number (y+1) (y) from (x+1) (x) and store the result at (w) and (w+1).
4) a) Two 2-digit BCD numbers are stored at consecutive memory locations (x) and (x+1). Write a program for computing the sum and store the result at loc. (y)
b) Write a program to compute the difference and store the result at (y).
5) Implement a time-delay loop for the generation of milli seconds. Determine the exact time-delay by adding the states of the instructions executed in the program.
6) a) Write a program for a decimal counter (00-99) with programmable clock frequency [Eg. Frequency specified at data memory locations (x)] and display the count in the data field using the corresponding monitor subroutine.
b) Reset the decimal counter at a predefined number and start the count again.
7) N binary numbers stored at consecutive data memory locations starting at (x) where N is defined at data memory location ‘NUMBER’.
a) Find the largest number and display it in the data field and arrange them in ascending order.
b) Find the smallest number and display it in the data field and arrange them in descending order.
8) Two 8-bit binary numbers are stored at data memory locations (x) and (x+1) compute the product of the two numbers using,
a). Successive addition method.
b). Shifting and adding method store the result in (y) and (y+1).
9) Divide the l6-bit unsigned number in memory location (x) and (x+1) [Most significant byte in (x+1)] by the 8-bit unsigned number in memory location (x+2). Store the quotient in memory location (x+3) and reminder in memory location (x+4). [Choose the data such that the quotient must be contained in 8 bits].
10) a) A 2-digit BCD number is stored at data-memory location (x). Convert the number into binary and display the result in data field.
b) Convert a binary number in memory location (x) to two BCD digits in memory locations (x+1) and (x+2) [most significant digit in (x+1)]. The number in memory location (x) is unsigned and less than (64)H+1.
11) Write a program to do the operation specified at a data memory location (x).
The operations are specified as follows:
00-Test the parity of the data at (x+1) and store DD for odd parity, EE for even parity at (y).
01-To operate a staircase lamp, 02-Test the zero condition of the data and store 00 if zero and FF if not, 03-Test if the data is positive or negative.
12) Hardware experiments:
A/D and D/A Converters.
DPSK Modulator and Demodulator.
Seven Segment Display interface.