You are on page 1of 3

A) Programs for 8085

1) Write an ALP to copy/transfer a block of data of size N from the address F100H to
F105H. N is stored at F0FFH. Note: The memory addresses may overlap.
2) Write an ALP to find the square of a number stored in D000H and store the answer in
D001H. Use lookup table for the same.
3) Write a subroutine to swap two numbers. The addresses of the numbers to be swapped are
stored in HL pair and DE pair.
Details of the subroutine:
Input: HL and DE store addresses
Output: Swapping of two numbers
Registers affected: None
Flags affected: None
4) Write an ALP to sort N numbers in ascending order.
Details:
N is stored in 1FFF(H)
The N numbers are stored 2000H onwards
5) Write a subroutine to multiply two numbers.
Details of the subroutine:
Inputs: two numbers in ACC and B
Output: Store answer in DE pair

B) Assembly Programs for 8051 (Keil Simulation)


1) Add two 8-bit numbers from IRAM 30H and 31H and store the 8-bit result in 32H
2) Add two 8-bit numbers from IRAM 30H and 31H and store the 16-bit result in
32H(MSB) and 33H(LSB)
3) Add two 8-bit numbers from Code Memory 1000H and 1001H and store the 8-bit result
in External Memory 0000H
4) Add two 8-bit numbers from External Memory 0000H and 0001H and store the 16-bit
result in External Memory 0002H and 0003H

C) C Programs for 8051


1) Write a C program to toggle a LED every 500ms using software delay.
2) Write a C program to create different LED patterns listed below every 500ms using
software delay
a. LEDs lighting up from D0 to D7 one at a time
b. LEDs lighting up from D0 to D7 while the ones already lit staying ON
c. Repeat (a) and (b) for the reverse order
3)

Write a C program to toggle a LED every 500ms using timer interrupts and round robin
scheduling.

4) Write a C program to implement keyscan() to toggle a LED on PRESS and RELEASE of


a key. Use timer interrupts and round robin scheduling.
5) Write a C program to do the following:
- Obtain a 20% duty ratio at 100Hz on P1.0
- When the UP key (P3.2) is pressed, increase the duty ratio by 10%
- When the DOWN key (P3.5) is pressed, decrease the duty ratio by 10%
Duty ratio must stay within 10% and 90% always
Seven Segment related programs
Instructions:
Port 0 (0..7) is connected to a,b,..,g,dp of Seven Segments
The seven segment displays are connected in common anode
There are 4 displays named D1, D2, D3 and D4 from left to right
The cathodes of the 4 displays are connected P1 (0-3) respectively.
When P1.0 is high and remaining are low D1 is selected
When P1.1 is high and remaining are low D2 is selected
When P1.2 is high and remaining are low D3 is selected
When P1.3 is high and remaining are low D4 is selected
6) Write a program to display a single digit on the 4digit 7-segment display on the kit.
Create a function display for task 1 with the following details.
Inputs: a) Position (1- 4) b) Value (0 9)
Outputs: void
Purpose: To display the value entered at the position mentioned.
7) Write a program to display a 4-digit number on the 7-segment display on the kit.
- Create one task for round-robin called every 5ms by a timer interrupt
- The task has to display the number in a multiplexed fashion using the display function
created in Task 1.
8) Write a program to implement a 4-digit up and down counter.
- Create four tasks for round-robin
1. Display refresh called every 5 ms (like Task 2)
2. Keyscan() to determine up or down keypress (press and release) called every
25ms
3. Action to be taken when UP key is received
4. Action to be taken when DOWN key is received
- Set the timer to interrupt every 5ms for 1. and count 5 interrupts for 2.
- keyscan() is to be implemented for up and down keys and the task of increasing or
decreasing the counter to be done in respective task codes in while loop.
Serial Related Programs
9) Write a program to output a single character 5 times via the UART. Use crystal frequency
as 11.0592MHz and a baud rate of 4800. Create a function send_char() which sends a
character by continuously polling for the TI flag.

10) Write a program to send a string via the UART. Use the same specifications as (8) and
create a function send() which makes use of the send_char() function.
11) Write a program to receive a small case character from the UART port and return capital
case. Use polling for receiving the character.
12) Repeat program (10) for interrupt based receiving of characters from UART.

You might also like