Professional Documents
Culture Documents
AIM:
To write an assembly language program to multiply two 8-bit numbers
using 8085 microprocessor.
APPARATUS REQUIRED:
ALGORITHM:
START
A B
2
A B
CHECK
WHETHE NO
R
ZF=1
YES
STOP
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Get the divisor data from memory and store the 2’s complemented value
of divisor in another memory location
Step 2: Clear BC pair register for storing the quotient value
Step 3: Clear the Quotient register (BC)
Step 4: Get the 2’s complemented value of divisor number and store it in DE pair
Step 5: Get the dividend number from one memory location to HL pair and add
this number with DE pair
Step 6: Increment the Quotient register (BC)
Step 7: Store the remainder value in the dividend data location
Step 8: Check whether high byte dividend is equal to high byte of divisor. If yes
go to step 7 otherwise go to next step
Step 9: Check whether high byte dividend is greater than high byte divisor. If yes
go to step 4,otherwise go to next step
Step 10: Store the quotient value in memory location
Step 11: Stop the process
Step 12: Get the lower byte of dividend and divisor to microprocessor and check
whether they are equal or not. If they are equal go to step 4, otherwise
go to next step
Step 13: Check whether lower byte dividend is greater than lower byte divisor or
not. If dividend is greater then go to step 4, otherwise go to next step
Step 14: Store the quotient value from BC register to memory
Step 15: Stop the process
4
START
GET THE DIVISOR DATA FROM 4202 MEMORY AND STORE THE 2’S
COMPLEMENTED VALUE OF DIVISOR IN MEMORY 4206
CHECK
WHETHER
YES
HIGH BYTE
DIVIDEND IS
EQUAL TO HIGH
BYTE OF
DIVISOR
NO
C B D
A
5
`
C D B
C
CHECK
WHETHER HIGH
YES
BYTE DIVIDEND
IS GREATER
THAN HIGH
BYTE OF
DIVISOR
NO
STOP
YES CHEC
K
ZF=1
NO
CHECK
YES LOWER BYTE
DIVIDEND >
LOWER BYTE
DIVISOR
NO
E
6
STOP
AIM:
To write an assembly language program to convert the given binary
number into a BCD number using microprocessor.
APPARATUS REQUIRED:
ALGORITHM:
START
A B
8
B
A
YES
COMPARE THE CONTENT OF A REGISTER WITH
0AH
YES
SAVE THE CONTENT OF A REGISTER IN C REGISTER
C
9
STOP
AIM:
To write an assembly program using 8085 and interfacing with 8279
(keyboard display controller) in order to display a character.
APPARATUS REQUIRED:
THEORY:
The block diagram of 8279 given in Fig(1) consists of
1. Keyboard section
2. Scan section
3. Display section
4. MPU interface
KEYBOARD SECTION:
SCAN SECTION:
The scan section has scan counter and 4 scan lines (S L0-SL3).These four
lines can be decoded using 4 to 16 decoder to generate 16 linesa for
scanning.These lines can be connected to the rows of the matrix display.
DISPLAY SECTION:
The display section has output lines divided into outputs A 0 -A3 and B0
-B3.These lines can be used either as a group of 8 lines or as two groups of four
in conjuction with the scan lines for a multiplex display. This display can be blank
by using BD lines.
Step 1: Initialize the control register to set the keyboard and display mode
Step 2: Clear display
Step 3: Writing a command word format for display RAM
Step 4: Writing a corresponding binary word for letter ‘A’ (To enable the segment,
corresponding binary digit is 0.To disable the segment, corresponding
binary digit is 1)
Step 5: Blank the rest of the display
12
D0 - D7 RD WR CS A0 IRQ
CLK RESET
RETURN
DISPLAY TIMING AND DISPLAY
SCAN
ADDRESS CONTROL CONTROLLER
ADDRESS
REGISTER REGISTER
(Fig. 1)
13
0 0 0 D D K K K
DD – DISPLAY MODE:
CLEAR DISPLAY:
1 1 0 CD CD CD CF CA
CD CD CD – The lower two CD bits specify the blanking code to be sent to the
segments to turn them off while the 8279 is switching from one digit to next.
14
CD CD CD
CF -- Clear All bit has the combined effect of CD and CF.It uses CD clearing
code on Display Ram and clears FIFO status. It also resynchronizes the internal
timing chain.
1 0 0 AI A A A A
START
CLEAR DISPLAY
STOP
16
AIM:
To generate a square wave using 8253 programmable interval timer by
interfacing it with 8085.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. CRO
3. 8253 programmable interval timer
THEORY:
The 8253 programmable interval timer/counter is functionally similar to the
software designed timers and counters. It generates accurate time delays and
can be used for applications such as real time clock, an event counter, a digital
one shot, a square wave generator and a complex waveform generator. To
operate a counter, a 16 bit count is loaded in its register and a command begins
to decrement the count until it reaches zero.
8253 can operate with a clock frequency from DC to 2 MHz.The block
diagram of 8253 includes 3 counters 0,1,2 and a data bus buffer, read/write
control logic and a control register.
The Block diagram of 8253 is given in Fig(1) at its pin configuration is
given in Fig(2).
Fig (1)
PIN CONFIGURATION:
19
D7 1 24 VCC
D6 2 23 WR
D5 RD
3 22
D4 CS
4 21
A1
D3 5 20
A0
D2 6 19
D1 8253 CLK 2
D0 7 18
START OUT 2
CLK 0 8 17
GATE 2
OUT 0 9 16 CLK 1
INITIALISE THE 8253 TO SELECT CHANNEL 0 TO
GATE 0 10OF LSB FIRST, MSB NEXT,15 OUT 1
ENABLE LOAD SELECT
MODE 3 FOR SQUARE WAVE GENERATION GATE 1
GND 11 14
12 13
Fig (2)
LOAD LSB DATA TO ACCUMULATOR
STOP
20
AIM:
To write an 8086 assembly language program to determine the length of
ASCII string. Use PC keyboard to input the string and display itslength on
Personal Computer monitor.
22
APPARATUS REQUIRED:
1. 8086 Microprocessor kit
2. Personal computer
ALGORITHM:
A B
23
B
A
IS
ZF =
1?
24
NO INCREMENT CX
REGISTER
YES
STOP
FLOW CHART FOR PROCEDURE HEX2ASC
START
AIM:
To write an assembly language program to add and subtract two 8-bit
numbers using 8051 microcontroller.
27
APPARATUS REQUIRED:
1. 8051 microcontroller kit
2. Power supply
ALGORITHM:
ADDITION
START
AA
STOP
START
STOP
ASSEMBLY LANGUAGE PROGRAM:
ADDITION
29
SUBTRACTION
AIM:
To write an assembly language program using 8051 microcontroller to find
the largest number from a given 8 bit ten numbers.
30
APPARATUS REQUIRED:
1. Microcontroller kit
2. CRO
ALGORITHM:
Step 1: Initialize the data pointer to memory where numbers are stored.
Step 2: Initialize the counter.
Step 3: Initialize the maximum value as 0.
Step 4: Get the number from memory to accumulator.
Step 5: Compare the number with the maximum value.
Step 6: If both the values are not equal than go to step 8.
Step 7: Otherwise go to step 10.
Step 8: Check for carry flag. If carry comes go to step 10,otherwise go to next
step
Step 9: Maximum value is the number taken from memory.
Step 10: Increment data pointer.
Step 11: Decrement the count value. If count is 0 stop the process otherwise go
to step 4.
MICROCONTROLLER
START
MAXIMUM VALUE=0
CHEC YES
K
ZF=1
NO
YES
NO
DECREMENT COUNT
NO CHEC
K
ZF=1
YES
STOP
AIM:
To run a stepper motor in both clock and anticlockwise direction by
interfacing it with 8051 microcontroller.
APPARATUS REQUIRED:
1.Stepper motor
33
CONSTRUCTIONAL FEATURES:
A Stepper motor could be either of the reluctance type or the permanent
magnet type. A permanent magnet stepper motor consists of multi-phased stator
and two-part permanent magnet rotor.
The basic two-phase stepper motor consists of two pairs of stator poles.
Each of the four poles has its own winding. The excitation of any one winding
generates a North Pole; a south pole gets induced at the diametrically opposite
side.
It can be noted that the step size is =360/N S.Nr
There are three different schemes available for stepping a stepper motor.
They are
i). Wave scheme
ii). Two phase switching scheme
iii). Half stepping or mixed scheme
ALGORITHM:
Step 1: Set the data pointer for the memory location where the energizing pulses
are available.
Step 2: Set the count value as step 4.
Step 3: Move the energizing pulse from memory to accumulator.
Step 4: Save the data pointer value in stack.
Step 5: Set the data pointer for the port address where the energizing pulses
have to be given
34
MICROCONTROLLER
START
ESTABLISH A DELAY
NO