You are on page 1of 55

PRIST UNIVERSITY

U/s 3 of UGC Act 1956


THANJAVUR - 613 403 v TAMILNADU
Faculty of Engineering and Technology
Department of Electronics and Communication Engineering

MICROPROCESSORS LAB

PREPARED BY VERIFIED BY

1
LIST OF EXPERIMENTS:

1. PROGRAMMING USING 8085 – ARITHMETIC OPERATIONS.


2. PROGRAMMING USING 8085-SORTING AND SEARCHING.
3. PROGRAMMING USING 8086 – ARITHMETIC OPERATIONS.
4. PROGRAMMING USING 8086 –STRING MANIPULATION.
5. INTERFACING ADC AND DAC.
6. PARALLEL COMMUNICATION BETWEEN TWO 8085
MP KITS USING 8255.
7. KEY BOARD DISPLAY CONTROLLER INTERFACING (8279).
8. PROGRAMMABLE INTERVAL TIMER INTERFACE (8253).
9. SERIAL COMMUNICATION BETWEEN TWO 8085 MP KITS
USING 8251.
10. STEPPER MOTOR INTERFACING USING 8085.

2
1.1FLOW CHART- ADDITION:

START

Get the 1st operand


in B register

Get the 2nd


operand in
Accumulator

A=A+ B

Store result

Stop

Test Data: Output:


[4150] - [4152] -

3
[4151-

Ex no: 1 Date:

PROGRAMMING USING 8085 – ARITHMETIC OPERATIONS


AIM:
To study the arithmetic operations of Intel’s 8085 processor such as addition, subtraction,
division and multiplication.

APPARATUS REQUIRED:
8085 Microprocessor Trainer – 1

1. 8-BIT ADDITION:
ALGORITHM
1. Start
2. Get the two numbers, which are to be added in any two of the 8085 registers.
3. Add the two numbers and store the result in the corresponding memory
location using ADD instruction.
4. Stop the execution

PROGRAM

Label Memory Op.Code Mnemonics COMMENTS


Address
START 4100 3A 50 41 LDA 4150 Load accumulator with the
content of 4150
4103 47 MOV B, A Move the content of A register
to B register
4104 3A 51 41 LDA 4151 Load accumulator with the
content of 4151
4107 80 ADD B Add the B register content with
accumulator content
4108 32 52 41 STA 4152 Store the result in 4152
410B 76 HLT Stop the execution

4
1.2 FLOW CHART- SUBTRACTION

START

Get the 1st operand


in B register

Get the 2nd


operand in
Accumulator

A=A- B

Store result

Stop

Test Data:
Output:
[4150] - [4152] -
[4151] -

5
2. 8-BIT SUBTRACTION

ALGORITHM
1. Start
2. Get the two numbers, which are to be subtracted in any two of the 8085 registers.
3. Subtract the two numbers and store the result in the corresponding memory
location using SUB instruction.
4. Stop the execution

PROGRAM

Label Memory Op.Code Mnemonics COMMENTS


Address
START 4100 3A 50 41 LDA 4150 Load accumulator with the
content of 4150
4103 47 MOV B, A Move the content of A
register to B register
4104 3A 51 41 LDA 4151 Load accumulator with the
content of 4151
4107 80 SUB B Subtract the B register
content with accumulator
content
4108 32 52 41 STA 4152 Store the result in 4152
410B 76 HLT Stop the execution

6
1.3FLOW CHART- MULTIPLICATION

START

Get Multiplier and


Multiplicand

Register =0000

Reg. = Reg. +Multiplicand

Multiplier = Multiplier - 1

Is mul. = 0?

Store Register

STOP

Test Data:

[4150] = [4152] =
[4151] = [4153] =

Output:
[4154] =
[4155] =

7
3. 8-BIT MULTIPLICATION

ALGORITHM

1. Start
2. Get the multiplier and multiplicand
3. Initialize DE register pair as 0000
4. Add the multiplicand with DE register and store it DE register.
5. Decrement the multiplier by one and repeat until the multiplier becomes zero
6. Store the result in memory location
7. Stop the execution

Program:

Label Memory Op.Code Mnemonics COMMENTS


Address
START LDA 4152 Load multiplier in A from
4150
MOV B, A Get the multiplier in B
register
LXI D, 0000 Clear the DE pair register
LHLD 4150 Load multiplicand in DE
XCHG register
LOOP DAD D
DCR B
JNZ LOOP If not zero loop again
SHLD 4154 Else store result
HLT Store the result

8
1.4 FLOW CHART- DIVISION

START

Load divisor and dividend

Dividend = Dividend - Divisor

Quotient = 0

Is Divid.
< Divir.

Store quotient and


Remainder = Dividend

STOP

Test Data:
[4150] = - Divisor
[4151] = - Dividend
Result:
[4152] = - Remainder
[4153] = - Quotient

9
4. 8-BIT DIVISION

ALGORITHM
1. Start
2. Load the divisor and dividend
3. Initialize quotient = 0 and compare with divisor.
4. Calculate dividend = dividend – divisor
5. Quotient = Quotient + 1
6. If dividend is less than divisor then store the quotient and remainder
(dividend)
7. Stop the execution

PROGRAM:

Label Memory Op.Code Mnemonics COMMENTS


Address
START LDA 4150
MOV B, A Load divisor to B
LDA 4151 Load dividend to A
MVI C, 00 Initialize quotient = 0
CMP B
JC LOOP
LOOP1 SUB B Dividend – Divisor
INR C Quotient = Quotient + 1
CMP B Is dividend < divisor
JNC LOOP1 If not repeat again
LOOP STA 4152 Yes, then store accumulator
MOV A, C
STA 4153 Store Quotient
HLT Stop execution

RESULT:
Arithmetic Operations such as addition, subtraction, multiplication and division using Intel’s
8085 processor have been studied and tested for different data.

10
2.1 FLOW CHART-SMALLEST
START

Initialize count, pointer, max


=0

Pointer = Pointer + 1

Is min≤
pointer?

Min = pointer

Count = Count - 1

Is Count
= 0?

Store Minimum

STOP

Test Data:
Output:
(4150) = (4140) =
(4151) =
(4152) =
(4153) =
(4154) =
(4155) =

11
Ex no: 2 Date:

PROGRAMMING USING 8085-SORTING AND SEARCHING

AIM:
To write and execute programs using Intel’s 8085 processor for finding the
smallest number in an array, largest number in an array and arranging the given set of
numbers in ascending order, descending order
APPARTAUS REQUIRED:
8085 Microprocessor Trainer – 1
1.TO FIND THE SMALLEST NUMBER IN AN ARRAY OF 8 BIT NUMBERS.
ALGORITHM
1. Start
2. Initialize count, pointer and max = 0
3. Assign pointer = pointer + 1 and check for min≤ pointer, if yes then decrease the
count by one, otherwise set min = pointer
4. Check for count becomes zero, if no repeats the step 3 and 4, otherwise store the
maximum in memory.
5. Stop the execution
Program

Label Memory Op.Code Mnemonics COMMENTS


Address
START LXI H, 4150 Point to data start
MOV B, M Get count to B
XRA A Clear accumulator content
LOOP INX H Point to next data
CMP M Is next number < minimum?
JC LOOP1 Is carry = 1?do not replace min
MOV A, M If no, replace minimum
LOOP1 DCR B Check length of array
JNZ LOOP If B is not zero then repeat
INX H Point to the next data
MOV M, A Save minimum number
HLT Stop execution

RESULT:
Program for finding the smallest number in an array of 8 bit numbers given the length of
array has been written and executed.

12
2.2FLOW CHART-LARGEST
START

Initialize count, pointer, max


=0

Pointer = Pointer + 1

Is max 
pointer?

Max = pointer

Count = Count - 1

Is Count
= 0?

Store Maximum

STOP

Test Data:
Output:
(4150) = Count (4140) =
(4151) =
(4152) =
(4153) =
(4154) =
(4155) =

13
2.TO FIND THE LARGEST NUMBER IN AN ARRAY OF 8 BIT NUMBERS.

ALGORITHM
1. Start
2. Initialize count, pointer and max = 0
3. Assign pointer = pointer + 1 and check for max  pointer, if yes then
decrease the count by one, otherwise set max = pointer
4. Check for count becomes zero, if no repeats the step 3 and 4, otherwise store
the maximum in memory.
5. Stop the execution

Program

Label Memory Op.Code Mnemonics COMMENTS


Addres
s
START LXI H, 4150 Point to data start
MOV B, M Get count to B
XRA A Clear accumulator content
LOOP INX H Point to next data
CMP M Is next number >
maximum?
JNC LOOP1 Is carry = 0?
MOV A, M Yes replace maximum
LOOP1 DCR B Check length of array
JNZ LOOP If B is not zero then repeat
INX H Point to the next data
MOV M, A Save maximum number
HLT Stop execution

RESULT:
Program for finding the largest number in an array of 8 bit numbers given the
length of array has been written and executed.

14
2.3.FLOW CHART-ASCENDING
START

Initialize Pointer
Count = Count – 1
Flag=0

Is pointer

pointer+1?

Temp = Pointer
Pointer = Pointer + 1
Pointer+1=Temp

Pointer = Pointer + 1
Count = Count - 1

Is
count =
0?

Is Flag
= 0?

STOP
Test Data: Output:
(4150) = Count (4151)=
(4151) = (4152)=
(4152) = (4153)=
(4153) = (4154)=

15
3.TO ARRANGE THE GIVEN SET OF NUMBERS IN ASCENDING ORDER.

ALGORITHM
1. Start
2. Initialize the pointer and assign flag = 0.
3. Check for pointer is less than or equal to pointer+1, if yes then assign pointer= pointer+1,
decrement the count by one, else assign temp=pointer, pointer=pointer+1 and
pointer+1=temp.
4. Check for count is zero if yes then check flag is zero if no repeat the step 2 to 3, else stop
the execution. If count is not zero then repeat the step 3.
5. Stop the execution
Program
Label Memory Op.Code Mnemonics COMMENTS
Address
START MVI B, 00 Clear the B register content
LXI H, 4150 Count = Length of array
MOV C, M
DCR C Number of pairs = count – 1
INX H Point to start of array
LOOP MOV A, M Get K element
INX H
CMP M Compare to (k + 1) element
JC LOOP1 No interchange if K <= (K +
1)
MOV D, M Interchange if out of order
MOV M, A
DCX H
MOV M, D
INX H
MVI B, 01 B=1
LOOP1 DCR C Count down
JNZ LOOP
DCR B Is flag = 1
JZ START Do another sort, if any
HLT Stop execution

RESULT:
Program for arranging an array of 8bit numbers in ascending order has been written and
executed using 8085 trainers.

16
2.4FLOW CHART-DECENDING
START

Initialize Pointer
Count = Count – 1
Flag=0

Is pointer

pointer+1?

Temp = Pointer
Pointer = Pointer + 1
Pointer+1=Temp

Pointer = Pointer + 1
Count = Count - 1

Is
count =
0?

Is Flag
= 0?

STOP
Test Data: Output:
(4150) = Count (4151)=
(4151) = (4152)=
(4152) = (4153)=
(4153) = (4154)=
(4154) =

17
4.TO ARRANGE THE GIVEN SET OF NUMBERS IN DESCENDING ORDER.
ALGORITHM
1. Start
2. Initialize the pointer and assign flag = 0.
3. Check for pointer is greater than or equal to pointer+1, if yes then assign pointer=
pointer+1, decrement the count by one, else assign temp=pointer,
pointer=pointer+1 and pointer+1=temp.
4. Check for count is zero if yes then check flag is zero if no repeat the step 2 to 3,
else stop the execution. If count is not zero then repeat the step 3.
5. Stop the execution

Program
Label Memory Op.Code Mnemonics COMMENTS
Addres
s
START MVI B, 00 Clear the B register content
LXI H, 4150 Count = Length of array
MOV C, M
DCR C Number of pairs = count –
1
INX H Point to start of array
LOOP MOV A, M Get K element
INX H
CMP M Compare to (k + 1) element
JNC LOOP1 No interchange if K >= (K
+ 1)
MOV D, M Interchange if out of order
MOV M, A
DCX H
MOV M, D
INX H
MVI B, 01 B=1
LOOP1 DCR C Count down
JNZ LOOP
DCR B Is flag = 1
JZ START Do another sort, if any
HLT Stop execution

RESULT:
Program for arranging an array of 8bit numbers in descending order has been written and
executed using 8085 trainers.

18
3.1 FLOW CHART-ADDITION

START

(AX)=(1100)
(1102) =

ADD
(AX)=(AX)+1102

Store Result
(1200) =

STOP

Test Data:

Input: Output:
[1100] = [1200]=
[1102] =

Ex no: 3 Date:

19
PROGRAMMING USING 8086 – ARITHMETIC OPERATIONS

AIM:
To study the arithmetic operations of Intel’s 8086 processor such as addition,
subtraction, division and multiplication.

APPARATUS REQUIRED:
8086 Microprocessor Trainer – 1

1.16 Bit Addition:


ALGORITHM

1. Start
2. Load one 16bit number in AX register from memory.
3. Add the content of AX register with another 16bit number stored in another
memory location using ADD instruction.
4. Store the result in memory location
5. Stop the execution

PROGRAM:

Label Memory Op.Code Mnemonics COMMENTS


Address
START MOV AX, [1100] Addend in AX
ADD AX, [1102] Add
MOV [1200], AX Result
HLT Stop the execution

20
3.2 FLOW CHART- SUBTRACTION

START

(AX)=(1100)
(1102) =

Subtract
(AX)=(AX)+1102

Store Result
(1200) =

STOP

Test Data: Result:


[1100] = - Minuend [1200] =
[1102] = - Subtrahend

2. 16-Bit SUBTRACTION:

21
ALGORITHM
1. Start
2. Load one 16bit number in AX register from memory.
3. Subtract the content of AX register with another 16bit number stored in another
memory location using SUB instruction.
4. Store the result in memory location
5.Stop the execution

PROGRAM

Label Memory Op.Code Mnemonics COMMENTS


Address
START MOV AX, [1100] Minuend in AX
SUB AX, [1102] Subtract
MOV [1200], AX Result
HLT Stop the execution

3.3 FLOW CHART-MULTIPLICATION:

22
START

[1100]
=
[1102]
=

Move
AX=FEDC

Multiply
using MUL

MSW of Prod in DX
LSW of Prod in AX

STOP

Test Data: Output:


[1100] = [1200] =
[1102] = [1202] =

3. 16 Bit Multiplication

23
ALGORITHM

1. Start
2. Load one 16 bit number from memory to AX register
3. Multiply another 16-bit number stored in memory with AX register using
MUL instruction.
4. Store the result in memory location
5. Stop the execution

PROGRAM

Label Memory Op.Code Mnemonics COMMENTS


Address
START MOV AX, [1100] Multiplicand in AX
MUL [1102] Multiply the content of AX
with the content of [1102]
MOV [1200], DX Moving DX since it has the
higher order Word of the
resultant product
MOV [1202], AX
HLT Stop the execution

24
3.4 FLOW CHART- DIVISION:

START

(AX) =
(DX) =

Divide
DX: AX/Divisor

Store the results

STOP

Test Data:

Output:
[1100] = [1200] = Quotient
[1102] = Dividend [1202] = Remainder
[1104]= Divisor

4.32-Bit DIVISION:

25
ALGORITHM

1. Start
2. Load the dividend and divisor in memory locations
3. Divide the dividend by divisor using DIV instruction and store the quotient and
remainder in successive memory locations
4. Stop the execution

PROGRAM:

Label Memory Op.Code Mnemonics COMMENTS


Address
START MOV DX, [1100] Dividend in DX
MOV AX, [1102] Dividend in AX
DIV [1104]
MOV [1200], AX Div gives quotient in AX and
remainder in DX
MOV [1202], DX
HLT Stop the execution

RESULT:
Program for studying the arithmetic operations of Intel’s 8086 processor such as
addition, subtraction, multiplication and division have written and executed.
4.1 FLOW CHART: STRING MANIPULATION:

26
START

Array length Start


address,End adress

CX=length
SI Start
DI End
DF=0(clear)

Move 1byte
MOVSB

Dec CX

Is Flag
= 0?

Stop

Ex no: 4 Date:

27
PROGRAMMING USING 8086 –STRING MANIPULATION

AIM:

To move a byte string of length FF from a source to a destination

APPARATUS REQUIRED:
8086 Microprocessor Trainer - 1

ALGORITHM
1. Start
2. Intialize the array Length,Start address,End address
3. Move one byte
4. Decrement the length
5. Check whether length is 0.
6. Stop.
PROGRAM:

LABEL ADDRESS OP.CODE MNEMONICS COMMENTS


START 1000 MOV SI,OFFSET S_ARRAY

MOV DI,OFFSET D_ARRAY

MOV CX,0FFH

CLD
MOVE
MOVSB

LOOP MOVE
HLT

RESULT:
Thus a byte string of length FF is moved from a source to a destination
5.1 FLOW CHART: INTERFACING ADC:

28
START

Initialize ports A&C


as inputs ,B as output

Select the channel 3& Make ALE1 is high &give


Some delay.Make ALE1 is low

Check theEOC pin of ADC for


completing the conversion process

No Check
zero

Yes

Get the input analog datas


and stored in the memory.
4150.

STOP

Ex no: 5 Date:

29
INTERFACING ADC AND DAC

1. INTERFACING ADC
AIM:
To write a program for converting the analog data into a digital data.

APPARATUS REQUIRED:

8085 Microprocessor Trainer - 1


ADC (VLIM-003A) - 1
50-core cable - 1

ALGORITHM
1. Start.
2. Make port A &C as input and port B as output.
3. Select channel-3.
4. Make ALE1 high.
5. Make ALE1 low.
6. Check for EOC.
7. Display the result in the trainer.

30
PROGRAM:

31
LABE ADDRESS OP.CODE MNEMONICS COMMENTS
L
STAR 4100 MVI A,91H Make port A&C
T as input and port
B as output
OUT CNTRL

REPE MVI A,80H Select channel 3


AT
OUT PORTB
MVI A,90H Make ALE1 low
OUT PORTB
NOP
NOP

NOP
NOP

NOP

MVI A,80H Make ALE 1 low

OUT PORTB

LOOP IN PORTC Check for EOC


ANI 01H
JZ LOOP
IN PORTA
STA 4150H
HLT
END

RESULT:
Thus the program for converting the given analog voltage (using trim pot) into digital
data is executed.

5.2 FLOW CHART: INTERFACING DAC:

32
START

Initialize ports A&B


as inputs ,C as output

Move LSB count &increament up to FF

No
Yes Check
zero flag

Jump to
Start

5.2. INTERFACING DAC


AIM:

33
To create a saw tooth wave at the output of DAC1.
APPARATUS REQUIRED:
8085 Microprocessor Trainer - 1
DAC (VLIM-002A) - 1
50-core cable - 1
ALGORITHM
1. Start.
2. Make port A &B as input and port C as output.
3. Initialize the amplitude of saw tooth wave

PROGRAM:
LABEL ADDRESS OP.CODE MNEMONICS COMMENTS
START 4100 MVI A,80H Make port A &B
as input and port C
as output
OUT CNTRL(0F)
L2 MVI A,00H
L1 OUT POTRA
INR A
CPI FF
JNZ L1
JMP L2
END

RESULT:
Thus the program for saw tooth wave form is written and the wave is generated.

34
Ex no: 6 Date:

35
PARALLEL COMMUNICATION BETWEEN TWO 8085 MP KITS
USING 8255

AIM:
To write an assembly language program for parallel communication between two
8085 microprocessor kits.

APPARATUS REQUIRED :
8085 microprocessor trainer - 2
Parallel cable - 1

ALGORITHM
Transmitter

1. Initialize the parallel port for data transmission.


2. Set the baud rate.
3. Initialize the memory pointer of the data to be transmitted.
4. Set the counter for verification of EOF and get the data from
consecutive memory and transmit it.
5. Reset the system.

Receiver

1. Initialize the parallel port for data reception.


2. Set the baud rate.
3. Initialize the memory pointer for data to be stored.
4. Receive the data and store it
5. Reset the system.

6.1 FLOW CHART FOR TRANSMITTER

36
START

Initialize the parallel port for


transmission

Set the baud rate

Initialize the memory location of


data to be transmitted

Set the counter for EOF

Stop

6.1PROGRAM FOR TRANSMITTER

37
Label Memory Op.Code Mnemonics COMMENTS
Address
START MVI A,82 Initialize pointer
OUT 0F Set timer in mode 3
MVI A,3F Out the 0B content
OUT 0C Set the baud rate as 300
LOOP IN 0D Out the 08 content
SUI 3F
JNZ LOOP
MVI C,08
LXI H,4500
Trans MOV A,M
OUT 0C
CALL Delay
INX H
DCR C
JNZ Trans
RST1
MVI B,05
MVI E,FF
JNZ Delay2
DCR B
JNZ Delay1
RET

6.2FLOW CHART FOR RECEIVER

START
38
Initialize the parallel port for
Reception

Set the baud rate

Initialize the memory location for


data to be stored

Receive the data and store in


consecutive memory location

Stop

6.2PROGRAM FOR RECEIVER

39
Label Memory Op.Code Mnemonics COMMENTS
Address
START MVI A,90 Initialize pointer
OUT 0F Set timer in mode 3
Check IN 0C Out the 0B content
SUI 3F Set the baud rate as 300
JNZ Check Out the 08 content
MVI A,3F
OUT 0D
MVI C,08
CALL Delay
LXI H,4500
Rec IN 0C
MOV M,A
CALL Delay
INX H
DCR C
JNZ Rec
RST1
Delay MVI B,05
Delay1 MVI E,FF
Delay2 DCR E
JNZ Delay2
DCR B
JNZ Delay1
RET

RESULT:
Thus the program for parallel communication between 2 8085
microprocessor kits have been written and executed.

7.1 FLOW CHART- DISPLAY DATA

40
START

Initialize 8279-control register

Output the data to be displayed


and FF for blank display

STOP

Ex no: 7 Date:

KEY BOARD DISPLAY CONTROLLER INTERFACING (8279)

41
AIM:
To write programs using Intel’s 8085 processor
1. To display data “A”
2. Rolling Display

APPARATUS REQUIRED:
8085 microprocessor trainer,8279
7.1.DISPLAY DATA “A”
ALGORITHM
1. Start
2. Initialize 8279 and clear the seven segment displays by sending appropriate
control word
3. Out the data for display data “A” and send FF for blank display
4. Stop the execution
Program

Label Memory Op.Code Mnemonics COMMENTS


Address
START MVI A, 00 Mode and Display Set
OUT CNT
MVI A, CC Clear Display
OUT CNT
MVI A, 90 Write display RAM
OUT CNT
MVI A, 88 Display “A”
OUT CO
MVI A, FF Blank the rest of the
OUT CO display
OUT CO
OUT CO
OUT CO
OUT CO
HLT
7.2 FLOW CHART- ROLLING DISPLAY

42
START

Initialize 8279

Set count

Output data to be displayed and


wait for milliseconds

Output the next data and decrement


the count

Yes Is count No
= 0?

7.2.ROLLING DISPLAY
ALGORITHM:
1. Start
2. Initialize 8279 by choosing appropriate control word and initialize a counter
3. Read the first data from memory and out it and introduce a delay routine

43
4. Then read next data until the counter value becomes zero
5. Repeat steps 1 to 4 for rolling display
Program
Label Memory Op.Code Mnemonics COMMENTS
Address
START LXI H, Pointer Set pointer = (address)
MVI D, 0FH Initialize counter
MVI A, 10H Set Mode display
OUT CNT (CNT = c2)
MVI A, CC Clear Display
OUT CNT
MVI A, 90 Write Display
OUT CNT
LOP MVI A, M
OUT DAT
CALL DELAY
INX H Increment the pointer
DCR D Decrement the counter
JNZ LOOP Jump if non zero to
display the next char.
JMP START Jump to start
DELAY MVI B, A0
LOP1 MVI C, FF
LOP2 DCR C
JNZ LOP2
DCR B
JNZ LOP1
RET

RESULT:
Programs for displaying a data “A” and rolling a message “HELP US” have been
written and executed.
8.1 FLOW CHART-8253

START

44
Initialize 8253-control register

Store the amplitude of square


wave in the accumulator

Display the square wave in


CRO

STOP

Ex no: 8 Date:

PROGRAMMABLE INTERVAL TIMER INTERFACE (8253)

AIM:

45
To interface the 8253 timer IC with 8085 to get a programmed interval time
period.

APPARATUS REQUIRED:
8085 microprocessor trainer, 8253 ,CRO

ALGORITHM
1. Start
2. Initialize the control word and store it in the accumulator.
3. Out the control word by specifying the port address.
4. Store the amplitude of square wave in the accumulator and out it.
5. Stop the execution.

Program

Label Memory Op.Code Mnemonics COMMENTS


Address
START MVI A,36 Initialize control register to
OUT CE select channel 0,mode 3
MVI A,0A Load LSB of count
OUT C8
MVI A,00 Load MSB of count
OUT C8
HLT

RESULT:
Thus the program for interfacing the timer 8253 with 8085 to get a
programmed interval time period have been written and executed.
Ex no: 9 Date:
SERIAL COMMUNICATION BETWEEN TWO 8085 MP KITS
USING 8251
AIM:

46
To write an assembly language program for serial communication between two
8085 microprocessor kits.

APPARATUS REQUIRED:
8085 microprocessor trainer - 2
Serial cable - 1

ALGORITHM

Transmitter
1. Initialize the serial port for data transmission.
2. Set the baud rate as 300.
3. Initialize the memory pointer of the data to be transmitted.
4. Set the counter for verification of EOF and get the data from
consecutive memory and transmit it.
5. Reset the system.

Receiver
1. Initialize the serial port for data transmission.
2. Set the baud rate as 300.
3. Initialize the memory pointer of the data to be received.
4. Set the counter for verification of EOF , receive the data and store it in
memory location.
5. Reset the system.

9.1 PROGRAM FOR TRANSMITTER

47
Label Memory Op.Code Mnemonics COMMENTS
Address
START LXI H, Pointer Initialize pointer
MVI A,30 Set timer in mode 3
OUT 0B Out the 0B content
MVI A,40 Set the baud rate as 300
OUT 08 Out the 08 content
MVI A,01
OUT 08
Reload MVI C,05
CHECK IN 05
ANI 04
JZ CHECK
MOV A,M
OUT 04
INX H
CPI 3F
JNZ Reload
DCR C
JNZ CHECK
RST

9.2 PROGRAM FOR RECEIVER

Label Memory Op.Code Mnemonics COMMENTS


Address

48
START LXI H, Pointer Initialize pointer
MVI A,36 Set timer 0 in mode 3
OUT 0B Out the 0B content
MVI A,40 Set the baud rate as 300
OUT 08 Out the 08 content
MVI A,01
OUT 08
Reload MVI C,05
CHECK IN 05
ANI 02
JZ CHECK
IN 04
MOV M,A
INX H
CPI 3F
JNZ Reload
DCR C
JNZ CHECK
RST

49
RESULT:
Thus the program for serial communication between 2 8085
microprocessor kits have been written and executed.

Ex no: 10 Date:

STEPPER MOTOR INTERFACING USING 8085

AIM:
To write programs for rotating the given stepper motor at different Speed and
required angle using Intel’s 8085 processor

APPARATUS REQUIRED :
8085 Microprocessor Trainer - 1
Stepper Motor interfacing card (VBMB-13A) - 1
Stepper Motor - 1
50-core cable - 1
AT DIFFERENT SPEED
ALGORITHM
1. Start
2. Get the data derived for rotating the stepper motor from memory and
out it through port
3. Introduce a measurable delay between two successive steps by writing
delay routine
4. Repeat the steps through 2 to 3 for continuous rotation and vary the
delay for varying the speed of the motor
5. Stop the execution

50
Delay Calculation:
Required Time Delay = 1msec
Clock frequency = 3MHz
Total time delay = Delay (Inside) + Delay (Outside)
1 msec = 24 x count x 0.33sec + 20 x 0.33sec
Count = 124 = 0303H
Step angle for single step is 1.8o
No. Of steps for one rotation = 360/1.8 = 200 steps
AT DIFFERENT SPEED

10.1 FLOW CHART


START

Initialize ports

Set count for 4 stepping sequence

Output data for a stepping sequence


and wait for milliseconds and then
decrement the count

Yes Is No
count
= 0?

51
10.2 PROGRAM

LABEL ADDRESS OP.CODE MNEMONICS COMMENTS


START LXI H, LOOK UP Initialize HL reg. Pair with
look up table address
MVI B, 04 (B) = 04
REPT MOV A, M Move memory content to
accumulator
OUT C0 Output accumulator content
at C0 port
LXI D, 0303H Load DE pair register with
count
DELAY NOP No operation
DCX D Decrement the HL pair
register content
MOV A, E (A)  (E)
ORA D OR the content of
accumulator with D register
JNZ DELAY Jump on no zero to delay
INX H Increment HL pair
DCR B Decrement count
JNZ REPT Jump on non zero to REPT
JMP START Jump to start
LOOK UP 09 05 06 0A

52
10.2 AT REQUIRED ANGLE

FLOW CHART

START

Initialize ports and count

Set count for 4 stepping sequence

Output data for a stepping sequence


and wait for milliseconds and then
decrement the count

No Is
count
DE =
0?
Yes

Go to the next data and


decrement B by one
53
Is count
B =0?

No

STOP

10.2 PROGRAM FOR REQUIRED ANGLE

LABEL ADDRESS OP.CODE MNEMONICS COMMENTS


MVI C, HEXDATA Move hex data to C register
START LXI H, LOOK UP Initialize HL reg. Pair with
look up table address
MVI B, 04 (B) = 04
REPT MOV A, M Move memory content to
accumulator
OUT C0 Output accumulator content
at C0 port
DCR C Decrement C register
JZ END Jump on zero to end
LXI D, COUNT Load DE pair register with
count
DELAY NOP No operation
DCX D Decrement the HL pair
register content
MOV A, E (A)  (E)
ORA D OR the content of
accumulator with D register
JNZ DELAY Jump on no zero to delay
INX H Increment HL pair
DCR B Decrement count
JNZ REPT Jump on non zero to REPT
JMP START Jump to start
LOOKUP 09 05 06 0A
END HLT

54
RESULT:
Programs for rotating the given stepper motor at different speed and required
angle have been written and executed.

55

You might also like