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

Problems

The document contains several assembly language programs for interfacing various hardware components with microprocessors, including moving strings in memory, programming timers using the 8253, and initializing communication interfaces. It also includes memory mapping for the 8085 microprocessor and details on configuring the 8255 and 8251 for input/output operations. Each program specifies the necessary control words, addresses, and count values for proper operation.

Uploaded by

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

Problems

The document contains several assembly language programs for interfacing various hardware components with microprocessors, including moving strings in memory, programming timers using the 8253, and initializing communication interfaces. It also includes memory mapping for the 8085 microprocessor and details on configuring the 8255 and 8251 for input/output operations. Each program specifies the necessary control words, addresses, and count values for proper operation.

Uploaded by

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

1.

Program: Program to move a string consist of 200 bytes long from the offset address 1000H to
the offset address of 3000H in the segment address 5000H.

start:

; Set up the segment


mov ax, 5000H ; Load the segment value into AX
mov ds, ax ; Set DS register to the data segment (5000H)

; Set SI to the offset of the source (1000H)


lea si, source_string ; Load the effective address of the source string into SI
; SI = 1000H

; Set DI to the destination offset (3000H)


lea di, [5000H:3000H] ; Load the effective address of the destination into DI

; Set CX to the number of bytes to move (200 bytes)


mov cx, 200 ; 200 bytes to move

; Move the string from source to destination


rep movsb ; Repeat moving byte from DS:SI to ES:DI until CX is 0

; Program ends (for real mode we would use a termination interrupt here)
mov ah, 4Ch ; DOS interrupt to terminate program
int 21H
end start

2.Write a Programmable timer using 8253 and 8086. Interface 8253 at an address of 0040H for counter 0
and write the following ALPs. The 8086 and 8253 run at 6 MHz and 1.5 MHz respectively.

(i) To generate a square wave of period 1ms.


(ii) To interrupt the microprocessor after 10ms.
(iii) To derive a monoshot pulse with quasi-stable state duration of 5ms.

3.Design a programmable timer using 8253 and 8086. Interface 8253 at an address of 0040H for
counter 0 and write the following ALPs. The 8086 and 8253 run at 6 MHz and 1.5 MHz
respectively.

(i) To generate a square wave of period 1ms.


(ii) To interrupt the microprocessor after 10ms.

To derive a monoshot pulse with quasi-stable state duration of 5ms.

(i) To generate a square wave of period 1ms:

To generate a square wave with a period of 1ms, the output frequency should be 1 kHz (since period = 1/
frequency). This corresponds to a frequency of 1000 Hz.
Given that the 8253 timer operates at 1.5 MHz, we need to configure the 8253 in mode 2 (rate generator
mode). The frequency is generated based on the 16-bit counter value.

1. Calculate the count value:

The 8253 timer frequency is 1.5 MHz, which means each clock cycle is 1 / 1.5 MHz = 0.6667
microseconds. For a 1 kHz frequency (1 ms period), we need a counter value that produces this
frequency.

The formula for the counter value in mode 2 is:

So, the 16-bit counter value should be 1500 (which is 0x05DC in hexadecimal).

ii) To interrupt the microprocessor after 10ms:

To generate an interrupt after 10ms, we need to calculate the counter value that corresponds to this delay.

1. Calculate the count value:

To achieve a 10ms delay, we want the counter to count down for 10ms. The frequency of the
8253 is 1.5 MHz, and the time between each tick is 0.6667 microseconds. For a 10ms delay, the
number of counts required is:

So, the counter value should be 15000 (which is 0x3AD0 in hexadecimal).

iii) To derive a monoshot pulse with a quasi-stable state duration of 5ms:

In monoshot mode (mode 1), the 8253 timer generates a single pulse with a specified width, and it returns
to a stable state after the pulse duration.

1. Calculate the count value for a 5ms pulse: 15000/5 = 7500

Using the same principle, the count value for a 5ms pulse is:

So, the counter value should be 7500 (which is 0x1D4C in hexadecimal).

2. Write the ALP to generate the monoshot pulse:

To generate a monoshot pulse with a 5ms duration, we need to set the 8253 timer in mode 1
(monoshot mode) and load the counter with the value 0x1D4C.

4.Microprocessor system for the 8085 microprocessor such that it should contain 8 Kbyte of
EPROM and 8 Kbyte of RAM. Use linear addressing technique and give the detailed address map

Memory/Device Start Address End Address Size


EPROM 0000H 1FFFH 8 Kbytes
RAM 2000H 3FFFH 8 Kbytes
I/O Devices 4000H FFFFH
Microprocessor system design uses 8 Kbytes of EPROM and 8 Kbytes of RAM with linear addressing. The
address map is simple and uses the first 16 Kbytes of the 64 Kbyte address space available to the 8085
microprocessor. The memory is mapped contiguously with no gaps, and I/O devices (if required) can occupy the
remaining address space.

5.Write an assembly language program to initialize programmable parallel communication


interface in the configuration given by port A and upper port C considered as input mode and port
B and lower port C considered as output port. Assume address of the control word register as 83H.

start:
Initialize 8255 with control word to configure ports
mov al, 90H ; Control word for 8255: 1001 0000 (Input-Input-Output-Output)
out 83H, al ; Send the control word to control register of 8255 (address 83H)

Port A: Input mode


; Port B: Output mode
; Upper Port C: Input mode
; Lower Port C: Output mode

jmp
end start

6.Interface one 8Kx8 EPROM and two 8Kx8 RAM with 8085 such that the starting address
assigned to each memory chip is 0000H, 4000H and 6000 H respectively using a 3x8 decoder IC.

Decoder Role

The 3-to-8 decoder (74LS138) decodes A13–A15 to select one of 8 memory blocks of 8 KB each.

A15 A14 A13 Block Address Range


0 0 0 0 0000H–1FFFH
0 0 1 1 2000H–3FFFH
0 1 0 2 4000H–5FFFH
0 1 1 3 6000H–7FFFH

7.Interfacing 8251 with 8086 microprocessor. Set the 8251A in asynchronous mode as a transmitter and
receiver with even parity enabled, 2 stop bits, 8 bit character length, frequency 160KHz and baud rate 10K.
Write an ALP to transmit 100 bytes of data string at location 2000:5000H.

start:
; Initialize segments
mov ax, 2000h
mov ds, ax
mov si, 5000h

; Initialize 8251
mov dx, 41h ; Control port
mov al, 0FBh ; Mode word: async, 8-bit, even parity, 2 stop bits, x16
out dx, al

mov al, 0Bh ; Command word: enable Tx/Rx


out dx, al

; Transmit 100 bytes


mov cx, 100 ; Byte count
next_byte:
mov dx, 41h ; Status port
check_tx_ready:
in al, dx
test al, 01h ; Check TxRDY (bit 0)
jz check_tx_ready

mov al, [si] ; Load byte from memory


mov dx, 40h ; Data port
out dx, al

inc si ; Next byte


loop next_byte
hlt ; Halt after sending 100 bytes
end start

8.Write a program to initialize counter 2 in mode 0 with a count of C030H. Assume address for
control register = 0BH, counter 0 = 08H, counter 1 = 09H and counter 2 = 0AH.

start:
; Send control word to control register (port 0Bh)
mov dx, 0Bh ; Control register address
mov al, 0B0h ; Control word: Counter 2, LSB+MSB, Mode 0, Binary
out dx, al

; Load count value C030H to counter 2 (port 0Ah)


; Send LSB first, then MSB
mov dx, 0Ah ; Counter 2 port
mov ax, 0C030h

out dx, al ; Send LSB = 30h


mov al, ah
out dx, al ; Send MSB = C0h
hlt ; Halt program (for simulation)
end start

You might also like