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

23-Assembly Programming-02-07-2024

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

23-Assembly Programming-02-07-2024

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

SCHOOL OF ELECTRONICS ENGINEERING

Tutorial (Summer 2023-24)

Programme & Branch: B.Tech & ECE Code: BECE204L Slot: G1+TG1+G2+TG2+
Course: Microprocessors and Microcontrollers A1+TA1+A2+TA2
Faculty: Dr. Subhra Sankha Sarma

Programs related to 8086

1. Write an assembly language program in 8086 to turn ON an LED connected at output


port 199 for 25µs, then turn it OFF for another 25µs, and repeat this cycle.

2. Assume a string of data “VIT UNIVERSITY” is stored at memory location 20015H.


Write an 8086 ALP to display this string of data in reverse order i.e. “YTISREVINU
TIV” using Software Interrupt INT 21H, by inserting a delay of 25 µS between each
character.

3. Write an assembly language program in 8086 microprocessor to display the uppercase


English alphabet from ‘A’ to ‘Z’ with a delay of 25μs between each character using
Software Interrupt INT 21H.

4. Design a programmable timer using 8254 and 8086. Interface 8254 at an address 0040H
for counter 0 and write an ALP to generate a square wave of period 1 ms. The 8086 and
8254 run at 6 MHz and 1.5 MHz respectively.

5. Write an assembly language program in 8086 microprocessor to store the data “VIT
UNIVERSITY” accepted via KEYBOARD to the memory location 2015H using
Software Interrupt INT 21H, by inserting a delay of 25μs between each character.

6. Design an Up-Counter (0-255) by continuously sending data to output port 199 (i.e.
LED) with a delay of 25µs between each count.
Programs related to 8051

1. Examine the addressing modes of the following 8051 instructions.


a. DJNZ Rn, Relative address
b. DIV AB
c. MOV DPTR, #0400H
d. MOV 40H, 60H
e. MOVCA, @A+PC

2. Show the status of the CY, AC, and P flags after the addition of 88H and 93H in the
following instructions.
MOV A,#88H
ADD A,#93H

3. Write an assembly language program in 8051 microcontroller to find the sum of the
values 79H, F5H, and E2H. Put the sum in registers R0 (low byte) and R5 (high byte).

4. Write a program to perform the following:


(a) keep monitoring the P1.2 bit until it becomes high
(b) when P1.2 becomes high, write value 45H to port 0
(c) send a high-to-low (H-to-L) pulse to P2.3

5. Write an assembly language program in 8051 microcontroller to perform the below


mentioned functions, assuming that bit P2.3 is an input and represents the condition of an
oven. If it goes high, it means that the oven is hot. Monitor the bit continuously.
Whenever it goes high, send a high-to-low pulse to port P1.5 to turn on a buzzer.

6. Write a program to send the message “The Earth is but One Country” to serial port.
Assume a SW is connected to pin P1.2. Monitor its status and set the baud rate as
follows: SW = 0, 4800 baud rate SW = 1, 9600 baud rate Assume XTAL = 11.0592
MHz, 8-bit data, and 1 stop bit.

7. Assuming that XTAL = 11.0592 MHz, write a program in 8051 microcontroller to


generate a square wave of 2 kHz frequency on pin P1.5. Also, write the calculations
involved in the program.

8. The baud rate is set at 4800, with 8-bit data, and 1 stop bit. Write a program in 8051
microcontroller to receive bytes of data serially, and put them in P1.
9. Write a program that continuously gets 8-bit data from P0 and sends it to P1 while
simultaneously creating a square wave of 200 μs period on pin P2.1. Timer 0 is used to
create the square wave, assuming that XTAL = 11.0592 MHz.
10. Write a program in which the 8051 reads data from P1 and writes it to P2 continuously
while giving a copy of it to the serial COM port to be transferred serially. Assume that
XTAL = 11.0592 MHz. Set the baud rate at 9600.

11. Write an assembly language program in ARM assembly language to calculate the
expression, 3𝑥2 + 5𝑥 + 7.

12. Write an assembly language program in ARM assembly language to calculate the
addition of two 32 bit numbers.

13. Write an assembly language program in 8051 microcontroller to display “HELLO” on


LCD from line 1 position 6.

14. For an 8051 system of 11.059 MHz, find how long it takes to execute each of the
following instructions.

Instruction Machine cycle

MOV R3,#55 1
DEC R3 1
DJNZ R2,target 2
LJMP 2
SJMP 2

15. State the contents of the RAM locations after the following program:

SETB PSW.4
MOV R0,#99H
MOV R1,#85H
MOV R2,#3FH
MOV R7,#63H
MOV R5,#12H

16. A switch is connected to pin P1.7. Write a program in 8051 to check the status of the
switch and perform the following:
(a) If switch = 0, send letter ‘N’ to P2.
(b) If switch = 1, send letter ‘Y’ to P2.
Use the carry flag to check the switch status.
17. Write a program to toggle all the bits of port P1 after every 200 ms. Assume that the
crystal frequency is 11.0592 MHz, and that the system is using the AT89C51. It is given
that DJNZ takes 2 machine cycles to complete the execution.
18. Assume that XTAL = 11.0592 MHz. What value do we need to load into the timer’s
registers if we want to have a time delay of 5 ms? Show the program for Timer 0 to
create a pulse width of 5 ms on P2.3.

19. Write a program in 8051 microcontroller to create a square wave of 50% duty cycle on
the P1.5 bit. Assume that Timer 0 is used to generate the time delay. Also, write the
calculations involved in the program.

20. Write a program in 8051 microcontroller to transfer the message “YES” serially at 9600
baud rate, 8-bit data, 1 stop bit. Do this continuously.

21. Assume that the INT1 pin is connected to a switch that is normally high. Whenever it
goes low, it should turn on an LED. The LED is connected to P1.3 and is normally off.
When it is turned on it should stay on for a fraction of a second. As long as the switch is
pressed low, the LED should stay on.

22. Write an assembly language program in 8051 microcontroller to display 0 to 9 in 7-


segment display which is connected to Port 1.

You might also like