You are on page 1of 12

Microprocessor Applications Laboratory Department of Mechanical Engineering lIT Kharagpur

Microprocessor Experiment #1

Familiarisation with 8085 based microprocessor kit and programming exercise.

Objectives:

Understanding the use of the 8085 based microprocessor kit.

1) Basic entry: Selection of memory, editing memory, running programs.

2) Locating and editing registers.

Programming the kit for simple data processing applications.

1) Add-up a series ofn integers and store the result.

2) Multiply 2 integers and store the result.

Exercise # 1

Add a set of on' integers. Write the program from address location COOOH onwards. 'n ' is stored in location CIOOHonwards. ]:h~ numbers (8 bit) are stored from location CIOIH onwards. The result is to be stored in location CIOOH+n+1. Following is the assembly language code. Code it into the 8085 instructions and execute the program.

Level

Mnemonic

Address

COOOH

LXI H, CIOO MOYB,M MYIA,OO INXH ADDM INXH DCRB

JNZ, Loop MOVM, A RST 5.5

Loop

Exercise # 2

Remarks

Initialise Mem. Pntr.

No. of integers in B

Initialise sum=OO.

Increment Mem. Pntr.

Add from M to A.

Increment Mem. Pntr. Decrement count of integers. If count> 0 repeat.

Store result in Mem.

Return to monitor program.

Extend this program to multiply two integers X (stored in ClOOH) and Y (stored in CIOIH) and save the result Z in CI02H, CI03H (16 bit result).

First write the program in similar mnemonic form and then code it using the table provided.

Question/or discussion:

1) What is meant by compilation of the program? How.do this programs differ from the programs written in high level languages?

2) On 8085 what is the largest size of program you can have? How much data you can use? Hence if you use both data and programs how would you apportion them?

3) Write a program to convert a set of integer readings of temp. in Fahrenheit to reading in Celcius. Assume integer display of readings - hence you can afford trunction of the result.

Microprocessor Experiment # 2:

Use of microprocessor for control of stepper motor.

Objectives:

Understand the basic principle of control of stepper motor through a microprocessor.

1) Functioning of a stepper motor.

2) Digital control of a stepper motor using 8255(PPI) and 8085 microprocessor.

Programming the kit for simple motion application:

1) Rotate motor through a fixed angle

2) Forward and reverse motor

Exercise:

Use the program provided ( Stepper Motor FS & Stepper Motor HS Code_ Sheet) and code the application in the kit with appropriate 8085 instructions.

Modify the program for the three objectives stated and observe the results.

Question for discussion:

1) What are the advantages of the stepper motor over DC motor?

2) How can we increase the resolution of stepping of the stepper motor?

3) List a few applications of stepper motor.

4) What are the disadvantages of using a stepper motor?

Program Stepper Motor (Full Step)

Coding Sheet

Date

r

Address Label Instruction Mnemonic Remarks
9000 4 MVIA,88 3E 88 ; Configure Port (A=OUT, 8&C=IN)
9002 OUT CSR D3F3
9004 START MVIA, F8 3E F8 ; Data for Step 1
9006 OUT PA 03 FO ; Output data for Step 1
9008 CALL DELAY CD 00 F7 ; Delay between Steps
9008 MVIA, F4 3E F4 ; Data for Step 2
9000 OUT PA 03 FO ; Output data for Step 2
900F CALL DELAY CDOO F7 ; Delay between Steps ..
9012 MVIA, F2 3E F2 ; Data for Step 3
9014 OUT PA 03 FO ; Output data for Step 3
9016 CALL DELAY CD 00 F7 ; Delay between Steps
9019 MVIA, F1 3E F1 ; Data for Step 4
9018 OUT PA 03 FO ; Output data for Step 4
9010 CALL DELAY CD 00 F7 ; Delay between Steps
9020 JUMP SRART C3 04 90 ; Repeat



********* ************** ** Delay Sub Routine** *************** **************************'*****************************
.
F700 LXI 0 TIME 11 FF FF ; Delay Amount
CALL UTILITY DELAY CD BE 04 ; Call Delay
RET C9 ; Return from subroutine
/ Program Stepper Motor (Half Step)

Coding Sheet

Date

Address Label Instruction Mnemonic Remarks
9000 MVI A, 8B 3E 8B ; Configure Port (A=OUT, B&C=IN)
9002 OUT CSR D3 F3
9004 START MVI A, F8 3E F8 ; Data for Step 1
9006 OUT PA D3 FO ; Output data for Step 1
9008 CALL DELAY CD 00 F7 ; Delay between Steps
900B MVI A, FC 3EFC ; Data for Step 2
900D OUT PA D3 FO ; Output data for Step 2
900F CALL DELAY CD 00 F7 ; Delay between Steps
9012 MVI A, F4 3E F4 ; Data for Step 3
9014 OUT PA D3 FO ; Output data for Step 3
9016 CALL DELAY CD 00 F7 ; Delay between Steps
9019 MVI A, F6 3E F6 ; Data for Step 4
901B OUT PA D3 FO ; Output data for Step 4
9010 CALL DELAY CD 00 F7 ; Delay between Steps
9020- MVI A, F2 3E F2 ; Data for Step 5
9022 OUT PA D3 FO ; Output data for Step 5
9024 CALL DELAY CD 00 F7 ; Delay between Steps
9027 MVI A, F3 3E F3 ; Data for Step 6
9029 OUT PA D3 FO ; Output data for Step 6
902B CALL DELAY CD 00 F7 ; Delay between Steps
902F MVI A, F1 3E F1 ; Data for Step 7
9031 OUT PA D3 FO ; Output data for Step 7
9033 CALL DELAY CD 00 F7 ; Delay between Steps
9036 MVI A, F9 3E F9 ; Data for Step 8
9038 OUT PA D3 FO ; Output data for Step 8
903A CALL DELAY CD 00 F7 ; Delay between Steps
903D JUMP START C3 04 90 ; Repeat

********* .*********.** **OeJay Sub Routine** *************** ************.**************************************.
.--
F700 LXI D TIME 11 FF FF ; Delay Amount
CALL UTILITY DELAY CD BE 04 ; Call Delay
RET C9 ; Return from subroutine Microprocessor Experiment # 3:

Use of microprocessor for Digital to Analog Conversion.

Objectives:

Understanding the basic principle of digital to analog conversion using a microprocessor.

1) Basic techniques of digital to analog conversion: Ladder networks.

2) Digital to analog conversion using 8255 and 8085 microprocessor and the DAC 0800 chip.

Programming the kit for simple applications:

1) Generate a ramp and trianf}_ular waveforms.

2) Generate an exponential(2 n) waveforms.

Exercises:

Use the program provided (Ramp wave, Tri wave & Exp wave Code_Sheet )and code the application in the kit with appropriate 8085 instructions.

Modify the program for the three objectives stated and observe the results.

Question for discussion:

1) What arethe advantages of an R-2R ladder network over that of R-R ladder network.

2) What are the possible sources of error in the DAC process?

3) List and describe a few applications of DAC in laboratory use.

4) How would you generate a SINE wave using the 8085 and DAC?

Program: Ramp Wave

Coding Sheet

Date

Address Label Instruction Mnemonic Remarks
8000 MVIA,8B 3E 8B ; CSR Control Word A - Out, B&C = IN
8002 OUTCSR D3 F3 ; Load CSR
8004 MVI A, 00 3E 00 ; Load A = 00
8006 OUT PORTA D3 FO ; Data Out to Port A
8008 LOOP INRA 3C ;A=A+ 1
8009 OUT PORT A D3 FO ; Data Out to Port A
800B JMP LOOP C3 08 80 ; Repeat Program : Triangular Wave

Coding Sheet

Oate

- - -- ~ .. ~
Address Label Instruction Mnemonic Remarks
8030 MVIA,88 3E 88 ; CSR Control Word A = OUT 8&C = IN
8032 OUT CONT.REG. 03 F3 ; Load CSR
8034 MVI A, 00 3E 00 ;A= 00
8036 OUT PORTA 03 Fa ; Data Out to Port A
8038 LOOP 1 INRA 3C ;A=A+1
8039 OUT PORTA 03 FO ; Oata Oufto PortA
803B CPI FF FE FF ; Compare with FF
803D JNZ LOOP 1 C2 38 80 ; jump for not zero to loop 1
8040 LOOP2 DCRA 3D ;A=A-1
8041 OUT PORTA D3 FO ; Data Out to Port A
8043 CPIOO FE 00 ; Compare with 00
8045 JNZ LOOP 2 C2 40 80 ; jump for not zero to lop 2
8048 JMP LOOP 1 C3 38 80 ; Repeat Program Exp DA

Coding Sheet

Date

Address Label Instruction Mnemonic Remarks
8060 MVIA,88 3E 88 ; CSR Control Word A = Out, 8&C = IN
8062 OUTCSR D3 F3 ; Load CSR
8064 MVI A, 00 3E 00 ; Init Acc=OOH
8066 NSTEP 1 RAL 17 ; Shift Left Acc Data
8067 OUT PA 03 FO ; Output Acc Data to Port A
8069 CPI 40H FE 40 ; Comp Acc with 40H
806B JNZ NSTEP 1 C26680 ; Repeat if not Zero -
806F NSTEP 2 RAR 1F ; Shift Right Acc Data
8070 OUT PA 03 FO ; Output Acc Data to Port A
8072 CPI 01H FE 01 ; Comp Acc with 01 H
i 8074 JNZ NSTEP 2 C2 6F 80 ; Repeat if not Zero
"
. 8075 JMP NSTEP 1 C3 66 80 ; Do again ---------------------------~

Microprocessor Experiment # 4

Use of microprocessor for Analog to Digital Conversion.

Objectives:

Understanding the basic principle of analog to digital conversion using a microprocessor.

1) Basic techniques of analog to digital conversion: Counter Stepper method and Successive approximation method.

2) Analog to digital conversion using 8255 and 8085 microprocessor and the DAC 0800 chip.

Programming the kit for simple applications:

1) Convert a sequence of voltages generate from a variable voltage DC power source to digital and compare the same with a multi-meter reading

2) Measure any arbitrary DC voltage.

Exercises:

Use the program provided ( Count DA & Sue DA Code_ Sheet )and code the application in the kit with appropriate 8085 instructions.

Modify the program for the three objectives stated and observe the results.

Question for discussion:

3) What are the advantages of successive approximation method over that of the counter stepper method

4) What are the possible sources of error in the ADC process?

5) List and describe a few applications of ADC in laboratory use.

6) What is flash conversion?

Program Count AD

Coding Sheet

Date. :". "'"

Address Label Instruction Mnemonic Remarks
F040 MVI A, 8B 3E 8B ; CSR Control Word A = Out, B&C = IN
F042 OUTCSR D3'F3 ; Load CSR
F044 START MVI B, 00 0600 ; Init B = 00
F046 INRB 04 ; B = B+1
F047 MOVA, B 78 ; Transfer data B to A
F048 OUTPA 03 FO ; Output data from A to Port A
F04A NOP*3 000000 ; No operation
F04D IN PB DB F1 ; Input data from Port 8 to A
F04F ANI,01 E601 ; Mask data A7 to Al
F051 JZ CONV CA46 FO ; Loop until Port Bo = 1
F054 MOVA, B 78 ; Transfer Re~ult to A
F05S STA ADR 32 F9 FF ; Store Result in Memory FFF9
F058 MVI B, 00 0600 ; 8=00
FOOA CALL UPDDT CD 03 06 ; Display Result in IJP Kit Data field
FOOD CALL DELAY CD 00 F7 ; Delay
F010 JUMP START C344 FO ; Repeat





•• *'****** ************** ** Delay Sub Routine- *************** *******************************************************

F700 LXI 0 TIME 11 FF FF ; Delay Amount
CALL UTILITY DELAY CD BE 04 ; Call Delay
RET C9 ; Return from subroutine ------------ --------------

Program Successive AD

Coding Sheet

Date

Address Label Instruction Mnemonic Remarks
FOOO MVIA,8B 3E 8B ; Configure Port (A=OUT, B&C=IN)
F002 OUTCSR D3 F3
F004 STARTCON MVI B, 80 0680 ; B=80H
F006 MVI C, 00 OE 00 ; C=OOH
F008 CONV MOVA, B 78 ; B=A
F009 ORAC B1 ; ORC&A
FOOA MOVD, A 57 ;A=D
FOOS OUT PA D3 FO ; Output Acc to Port A
FOOD NOP 00 ; No operation
FOOE NOP 00 ; No operation
FOOF NOP 00 ; No operation
F010 NOP 00 ; No operation
F011 INPB DB F1 ; Input Port B in Acc
F013 ANI,01 E601 ; Mask D7 - D1 in Acc
F015 JNZ SKIP1 C2 19 FO ; Skip if Do = 1
F018 MOVC, D 4A ; C=D
F019 SKIP1 MOVA, B 78 ;A=B
F01A RRC OF ; Shift Acc Right
F01S MOVB,A 47 ; Store Ace in B
F01C JNC CONV D2 08 FO ; Skip if Carry = 0
F01F MOV A. C 79 ;C=A
F020 STA ADR 32 F9 FF ; Store Result in Memory FFF9
F023 MVI B, 00 0600 ;B=O
F025 CALL UPDDT CD D3 06 ; Display Result in pp Kit data field
F028 CALL DELAY CD 00 F7 ; insert delay
F02S JMP STARTCON C3 04 FO ; Repeat



********* *************. * Delay Sub Routine** *************** *******************************************************

F70a LXI D TIME 11 FF FF ; Delay Amount
~LL UTILITY DELAY CD BE 04 ; Call Delay
RET C9 ; Return from subroutine ;0 o c.... 0 ""0 ""0 :::I en r- ~ 0 Z s :::I X 0 »0 -(") en en »» s: :::I
0 0 e ~ ~ Q x ! ~ ~ Z(") Zs: O)e 00 s !
o (")(") :::I ""0 en ! 0 »;0 ;0""0 0)0) (")0
0 o 0 Q. :J:
::J ::J ::J !
Q. Q.Q. ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J ::J
o (")(") z »0) »W WOJ <0<0 (»(» W »
0 .I>oN N o ~~ 00 00 "-.,,j -."jO (")" "-.,,j "-.,,j m
o to (00) w ...... OJ
...... 01
o (")(") N »0) »0 00) <0<0 (»(» g OJ
(» ("»> (»O 001 .I>o(» (»O (»O
0 00 Z 00 0 »0) »0 00) <0<0 (»(» 0 o
0 ...... 01 ............ ...... ...... ...... ...... C <0 ...... ......0 (")<0 <0 ...... <0 ...... m
0 .I>oN N» (00) W ......
5:Rl » ...... (»(»
0 00 ...... OJ <0<0 ...... 0
ce ("»> 0 N01 .1>0» »N »N 0>
mm :J: »OJ » ...... ...... OJ <0<0 (»(» ......
...... 01 m
mm m "tI I I NN NN :J: OJW wO (")OJ OJW OJW m
0 -"'N 0 I <0 OJ W ......

mm ~ "tI »0) »N NOJ <0<0 (»(» N :J:
(").1>0 .1>001 .1>0(") (").1>0 (").1>0 0>
(»(") m "tI
"" en
...... 01 ::E I I WW ww en »0) »N NOJ <0<0 (»(» N r
"" "'T1 "tI (00) W ...... "tI 001 Ol0 (")0 OOl OOl m
0-'" N
"" ~ 3: »0) »W wOJ <0<0 (»(» ~ 3:
(»(") en mo> o>Ol .I>om mo> mo>
............ ;0 .... en
_DI ~S'
en ON I:S' -."j -."j 00> 0> ...... en
............ o::!£ 1/1 0 I:S' ~~ .I>o:e: :e:.I>o .1>0.1>0 ~~ ;:::!;oS'
~~ 1/1 ~ ...... o~ ~~ ...... --
0><0 ~."CD 0 o I: CD
1/1 1/1
'TI 'TI
." iii iii ~ ~~ 'TI
iii CC CC iii
CC ZZ 1/1 ZZ ZZ Z 1/1 Q (")(") ~~ CC
ZZ Z III o 0 » o 0 o o 0 0 » -<-< »~ 1/1
o 0 0 > ::J ::J ;: ::J ::J -< ::J ::J ::J ;: II II II eTeT ~~ ~~ »
(J) (J) C C
::J ::J ::J if (J) (J) (J) (J) (J) 0 00 .......... =::J ;:
(J) (J) (J) 0 0 »» »(") o (J)
n S' S' 0
CD Q. (")(") (")-< -< -
C. Q. II II II CD
00 ...... Q. s: s: s: ~I~ s: s: s: ::J
~ ~ ~ 00 0 ~ 0 !
« < <
s: _r :J: .m;.o .(") .0) }>
::J ::J ::J ::J ::J ::J ::J ::J
-."j(J) (J)Ol tl1 -"'-'" -."j >
-."j" -."j" -."j " -."j"'T1
-."j(J) o>Ol (.J1 .1>0-'" -."j OJ
o co o co 0 (» 0 co
-."j (J) o>Ol Ol.1>o .I>o-."j 0
...... <0 ...... <0 ...... <0 ...... <0
-."j (J) Rl~ 01 ~~ -."j C
N» N »
-."j(J) (J)01 01-'" -"'-."j m
WOJ WOJ WOJ WOJ
-."j(J) o>Ol ~ .1:>.1:> -."j :J:
.1>0(") .1:>(") (").1:> o
N (J) 0>01 (.J1.1>o .I:>-."j r
Ol0 Ol0 010 Ol0
-."j(J) o>Ol 01.1:> .I:>-."j 3:
(J)m o>m (J)m (J)m
en
.1>0.1:> .1:>.1:> .1:>.1:> .1:>.1:> ;0 ....
_DI
~~ ~~ ~~ ~~ ~;t
VI
"
iii
CC
zz ZZ ZZ ZZ VI
0 0 0 0 0 000 »
::J ::J ::J ::J ::J ::J ::J ::J ~
C1l C1l C1l C1l C1l C1l C1l (J)
0
....
CD
Q. m CD CO co (XI CO s:
-s::s:: •• -0 1')1,)1,,,,, N ee
N N -..J (}o (Joe)oeJl eng
-mal C/) CO ..... W0101 (f) (f)
.-10 m w •• "" ~ ~ o _.
/'\?"o ~ ..... '6i @55~§~ @ 0
•• ..... N
(}o O'J 0 C/)Cii (/);0 ..........
=rmo en 0
•• c o~m-o-o _,}> s:
~::Jm cc "tI Qj:3 ::J"
ru (C 0 •• ::J" s CiiO i/i_,;03!3! :::: 2')s: -0;0 (J)
-0 0 3
(Ctp •• -l II 0- A ru 0
"0 0 (/) -0 'TI Q.s: 0
•• 0 Ol ;0 ~~ s: -<
£;m-< "0 S:O DI
-...J"O (/) •• ~ !!!.- (}o II "C "'m ." 0 s:
Nru-l •• C1l => w ggQtl~ "'0 ." 0
C1l 3: 00 0> 0 III
...... ;:::).m s (")~ (/)6 00 ~ 0 "C
(.U3S: •• m "I I I : I I II I I
O(J)(/) •• 0 CD fl N 0(")(").,,0 I : I
N::J ::J - ~ ............ [DwOJ
•• ::J ."." ." W
.... ~ C1l ."." -rt -n
N •• N & ~ 000 ." -n
~ (}o 0> I -0-0-0-0 ~O ." ."
..... O'II\J~W II I I Z
-I "
m
r
co
0
co
(It
o
""0
e
Z I (,I
en
-l
;C
c:
o
-I
(5
Z
en
m
-l Z -l m r co o co (It

o "tI e

Z en -l ;0 e o -I

(5

Z en m -l

'1,1

. "

" ,

, ,.,:

',,~ . .

....., '

Label TriSifUctIOn

Coding' Sheet

Date

Remarks

' .. II'." '''''"'''

;,;; ~.;.:+:~"".;:.\.:; ...

I~ ... /':.'

.• ..;,

J I; "

'1t.,:.;,

.. ~.,~----~------~----~-------+--------+---------------------------~

.1

~--~----~~-------------+--------+---------------------------~

---I

I ,

r----t---t------+----+------.~-------.--.-;

--~---.---

You might also like