Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 99

EC2308: MICROPROCESSORS & MICROCONTROLLERS LAB MANUAL V SEM ECE

ECE DEPARTMENT

MP&MC LAB MANUAL

1. INTRODUCTION TO 8085
INTEL 8085 is one of the most popula 8!"it mi# op o#esso #apa"le of a$$ essin% &' (B of memo ) an$ its a #hite#tu e is simple* The $e+i#e has '0 pins, e-ui es .5 / po0e suppl) an$ #an ope ate 0ith 1M23 sin%le phase #lo#4* ALU (Arith !ti" L#$i" U%it&: The 8085A has a simple 8!"it ALU an$ it 0o 4s in #oo $ination 0ith the a##umulato , tempo a ) e%iste s, 5 fla%s an$ a ithmeti# an$ lo%i# #i #uits* ALU has the #apa"ilit) of pe fo min% se+e al mathemati#al an$ lo%i#al ope ations* The tempo a ) e%iste s a e use$ to hol$ the $ata $u in% an a ithmeti# an$ lo%i# ope ation* The esult is sto e$ in the a##umulato an$ the fla%s a e set o eset a##o $in% to the esult of the ope ation* The fla%s a e affe#te$ ") the a ithmeti# an$ lo%i# ope ation* The) a e as follo0s5 6i%n fla% Afte the e7e#ution of the a ithmeti# ! lo%i# ope ation if the "it D8 of the esult is 9, the si%n fla% is set* This fla% is use$ 0ith si%ne$ num"e s* If it is 9, it is a ne%ati+e num"e an$ if it is 0, it is a positi+e num"e * :e o fla% The 3e o fla% is set if the ALU ope ation esults in 3e o* This fla% is mo$ifie$ ") the esult in the a##umulato as 0ell as in othe e%iste s* Au7illa ) #a ) fla% In an a ithmeti# ope ation 0hen a #a ) is %ene ate$ ") $i%it D1 an$ passe$ on to D', the au7illa ) fla% is set* Pa it) fla% Afte a ithmeti# ; lo%i# ope ation, if the esult has an e+en num"e of 9<s the fla% is set* If it has o$$ num"e of 9<s it is eset* Ca ) fla% If an a ithmeti# ope ation esults in a #a ), the #a ) fla% is set* The #a ) fla% also se +es as a "o o0 fla% fo su"t a#tion*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

ECE DEPARTMENT

MP&MC LAB MANUAL

Ti i%$ '%( "#%tr#) *%it This unit s)n#h oni3es all the mi# op o#esso ope ation 0ith a #lo#4 an$ %ene ates the #ont ol si%nals ne#essa ) fo #ommuni#ation "et0een the mi# op o#esso an$ pe iphe als* The #ont ol si%nals RD B ea$C an$ DR B0 iteC in$i#ate the a+aila"ilit) of $ata on the $ata "us* I%+tr*"ti#% r!$i+t!r '%( (!"#(!r The inst u#tion e%iste an$ $e#o$e a e pa t of the ALU* Dhen an inst u#tion is fet#he$ f om memo ) it is loa$e$ in the inst u#tion e%iste * The $e#o$e $e#o$es the inst u#tion an$ esta"lishes the se-uen#e of e+ents to follo0* R!$i+t!r 'rr', The 8085 has si7 %ene al pu pose e%iste s to sto e 8!"it $ata $u in% p o% am e7e#ution* These e%iste s a e i$entifie$ as B, C, D, E, 2 an$ L* the) #an "e #om"ine$ as BC, DE an$ 2L to pe fo m 9&!"it ope ation* A""* *)'t#r A##umulato is an 8!"it e%iste that is pa t of the ALU* This e%iste is use$ to sto e 8!"it $ata an$ to pe fo m a ithmeti# an$ lo%i# ope ation* The esult of an ope ation is sto e$ in the a##umulato * Pr#$r' "#*%t!r

The p o% am #ounte is a 9&!"it e%iste use$ to point to the memo ) a$$ ess of the ne7t inst u#tion to "e e7e#ute$* St'"- .#i%t!r It is a 9&!"it e%iste 0hi#h points to the memo ) lo#ation in RED memo ), #alle$ the 6ta#4*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

ECE DEPARTMENT

MP&MC LAB MANUAL

C#

*%i"'ti#% )i%!+

8085 mi# op o#esso pe fo ms $ata t ansfe ope ations usin% th ee #ommuni#ation lines #alle$ "uses* The) a e a$$ ess "us, $ata "us an$ #ont ol "us* A$$ ess "us ; it is a % oup of 9&!"it lines %ene all) i$entifie$ as A0 ; A95* The a$$ ess "us is uni$i e#tional i*e*, the "its flo0 in one $i e#tion f om mi# op o#esso to the pe iphe al $e+i#es* It is #apa"le of a$$ essin% A 9& memo ) lo#ations* Data "us ; it is a % oup of 8 lines use$ fo $ata flo0 an$ it is "i$i e#tional* The $ata an%es f om 00 ; >>* Cont ol "us ; it #onsist of +a ious sin%le lines that #a ) s)n#h oni3in% si%nals* The mi# op o#esso uses su#h si%nals fo timin% pu pose*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'

ECE DEPARTMENT

MP&MC LAB MANUAL

2(A&.8 BIT DATA ADDITION


AIM: To a$$ t0o 8 "it num"e s sto e$ at #onse#uti+e memo ) lo#ations* AL/ORIT0M: 9* A* 1* '* Initiali3e memo ) pointe to $ata lo#ation* ?et the fi st num"e f om memo ) in a##umulato * ?et the se#on$ num"e an$ a$$ it to the a##umulato * 6to e the ans0e at anothe memo ) lo#ation*

RESULT: Thus the 8 "it num"e s sto e$ at '500 &'509 a e a$$e$ an$ the esult sto e$ at '50A & '501*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

ECE DEPARTMENT

MP&MC LAB MANUAL

1LO2 C0ART:
6TART

FCG

002

F2LG

'5002

FAG

FMG

F2LGF2LG.9

FAGFAG.FMG

N=
Is the e a Ca ) H@E6

FCGFCG.9

F2LGF2LG.9

FMG

FAG

F2LGF2LG.9

FMG

FCG

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: ADDRESS OPCODE LABEL '900 6TART '909 '90A '901 '90' '905 '90& '908 '908 '90K '90A '90B '90C '90D '90E '90> '990 OBSERVATION: INPUT '500 '509 '50A '501 =UTPUT L9 MNEMONICS OPERAND M/I C, 00 LII M=/ INI ADD JNC 2, '500 A, M 2 M L9 COMMENT Clea C e%* Initiali3e 2L e%* to '500 T ansfe fi st $ata to a##umulato In# ement 2L e%* to point ne7t memo ) Lo#ation* A$$ fi st num"e to a##* Content* Jump to lo#ation if esult $oes not )iel$ #a )* In# ement C e%* In# ement 2L e%* to point ne7t memo ) Lo#ation* T ansfe the esult f om a##* to memo )* In# ement 2L e%* to point ne7t memo ) Lo#ation* Mo+e #a ) to memo ) 6top the p o% am

INR INI M=/ INI M=/ 2LT

C 2 M, A 2 M, C

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

ECE DEPARTMENT

MP&MC LAB MANUAL

2(B&.8 BIT DATA SUBTRACTION


AIM: To 6u"t a#t t0o 8 "it num"e s sto e$ at #onse#uti+e memo ) lo#ations* AL/ORIT0M: 9* A* 1* '* Initiali3e memo ) pointe to $ata lo#ation* ?et the fi st num"e f om memo ) in a##umulato * ?et the se#on$ num"e an$ su"t a#t f om the a##umulato * If the esult )iel$s a "o o0, the #ontent of the a##* is #omplemente$ an$ 092 is a$$e$ to it BA<s #omplementC* A e%iste is #lea e$ an$ the #ontent of that e%* is in# emente$ in #ase the e is a "o o0* If the e is no "o o0 the #ontent of the a##* is $i e#tl) ta4en as the esult* 5* 6to e the ans0e at ne7t memo ) lo#ation* RESULT: Thus the 8 "it num"e s sto e$ at '500 &'509 a e su"t a#te$ an$ the esult sto e$ at '50A & '501*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

ECE DEPARTMENT

MP&MC LAB MANUAL

1LO2 C0ART:
6TART

FCG

002

F2LG '5002

FAG

FMG

F2LGF2LG.9

FAGFAG!FMG

Is the e a Bo o0 H

N=

@E6
Complement FAG A$$ 092 to FAG FCGFCG.9

F2LGF2LG.9

FMG

FAG

F2LGF2LG.9

FMG

FCG

6T=P 6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: ADDRESS OPCODE LABEL '900 6TART '90A '90A '901 '90' '905 '90& '908 '908 '90K '90A '90B '90C '90D '90E '90> '990 '999 '99A '991 OBSERVATION: INPUT '500 '509 '50A '501 =UTPUT MNEMONICS OPERAND M/I C, 00 LII M=/ INI 6UB JNC 2, '500 A, M 2 M L9 COMMENT Clea C e%* Initiali3e 2L e%* to '500 T ansfe fi st $ata to a##umulato In# ement 2L e%* to point ne7t mem* Lo#ation* 6u"t a#t fi st num"e f om a##* Content* Jump to lo#ation if esult $oes not )iel$ "o o0* In# ement C e%* Complement the A##* #ontent A$$ 092 to #ontent of a##* In# ement 2L e%* to point ne7t mem* Lo#ation* T ansfe the esult f om a##* to memo )* In# ement 2L e%* to point ne7t mem* Lo#ation* Mo+e #a ) to mem* 6top the p o% am

INR CMA ADI L9 INI M=/ INI M=/ 2LT

C 092 2 M, A 2 M, C

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

90

ECE DEPARTMENT

MP&MC LAB MANUAL

3(A&.8 BIT DATA MULTIPLICATION


AIM: To multipl) t0o 8 "it num"e s sto e$ at #onse#uti+e memo ) lo#ations an$ sto e the esult in memo )* AL/ORIT0M: LO/IC: Multipli#ation #an "e $one ") epeate$ a$$ition* 9* A* 1* '* 5* &* 8* 8* Initiali3e memo ) pointe to $ata lo#ation* Mo+e multipli#an$ to a e%iste * Mo+e the multiplie to anothe e%iste * Clea the a##umulato * A$$ multipli#an$ to a##umulato De# ement multiplie Repeat step 5 till multiplie #omes to 3e o* The esult, 0hi#h is in the a##umulato , is sto e$ in a memo ) lo#ation*

RESULT: Thus the 8!"it multipli#ation 0as $one in 8085p usin% epeate$ a$$ition metho$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

99

ECE DEPARTMENT 1LO2 C0ART:


6TART

MP&MC LAB MANUAL

F2LG '500 B M F2LG F2LG.9

A 00

C 00 FAG FAG .FMG

Is the e an) #a ) @E6 C C.9 B B!9

N=

N=

I6 BL0 @E6 A

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

9A

ECE DEPARTMENT A
F2LGF2LG.9

MP&MC LAB MANUAL

FMG

FAG

F2LGF2LG.9

FMG

FCG

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

91

ECE DEPARTMENT PRO/RAM: ADDRESS OPCODE LABEL '900 6TART '909 '90A '901 '90' '905 '90& '908 '908 '90K '90A '90B '90C '90D '90E '90> '990 '999 '99A '991 '99' '995 '99& OBSERVATION: INPUT '500 '509 '50A '501 =UTPUT L9 MNEMONICS LII M=/ INI M/I M/I ADD JNC

MP&MC LAB MANUAL

OPERAND 2, '500 B, M 2 A, 002 C, 002 M NEIT

COMMENT Initiali3e 2L e%* to '500 T ansfe fi st $ata to e%* B In# ement 2L e%* to point ne7t mem* Lo#ation* Clea the a##* Clea C e% fo #a ) A$$ multipli#an$ multiplie times* Jump to NEIT if the e is no #a ) In# ement C e% De# ement B e% Jump to L9 if B is not 3e o* In# ement 2L e%* to point ne7t mem* Lo#ation* T ansfe the esult f om a##* to memo )* In# ement 2L e%* to point ne7t mem* Lo#ation* T ansfe the esult f om C e%* to memo )* 6top the p o% am

NEIT

INR DCR JN: INI M=/ INI M=/ 2LT

C B L9 2 M, A 2 M, C

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

9'

ECE DEPARTMENT

MP&MC LAB MANUAL

3(B&.8 BIT DIVISION


AIM: To $i+i$e t0o 8!"it num"e s an$ sto e the esult in memo )* AL/ORIT0M: LO/IC: Di+ision is $one usin% the metho$ Repeate$ su"t a#tion* 9* Loa$ Di+iso an$ Di+i$en$ A* 6u"t a#t $i+iso f om $i+i$en$ 1* Count the num"e of times of su"t a#tion 0hi#h e-uals the -uotient '* 6top su"t a#tion 0hen the $i+i$en$ is less than the $i+iso *The $i+i$en$ no0 "e#omes the emain$e * =the 0ise %o to step A* 5* stop the p o% am e7e#ution* RESULT: Thus an ALP 0as 0 itten fo 8!"it $i+ision usin% epeate$ su"t a#tion metho$ an$ e7e#ute$ usin% 8085 p 4its

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

95

ECE DEPARTMENT 1LO2C0ART:


6TART

MP&MC LAB MANUAL

B 00 F2LG '500 A M F2LG F2LG.9 M A!M

FBG FBG .9 N=

I6 AM0 @E6 A A. M

B B!9

F2LGF2LG.9

FMG

FAG

F2LGF2LG.9

FMG

FBG

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

9&

ECE DEPARTMENT PRO/RAM: ADDRESS '900 '909 '90A '901 '90' '905 '90& '908 '908 '90K '90A '90B '90C '90D '90E '90> '990 '999 '99A OBSERVATION: S.NO 9 A ADDRE66 '500 '509 '500 '509 INPUT DATA L==P OPCODE LABEL MNEMO NICS M/I LII M=/ INI 6UB INR JNC ADD DCR INI M=/ INI M=/ 2LT OPERA ND B,00 2,'500 A,M 2 M B L==P M B 2 M,A 2 M,B

MP&MC LAB MANUAL

COMMENTS Clea B e% fo -uotient Initiali3e 2L e%* to '5002 T ansfe $i+i$en$ to a##* In# ement 2L e%* to point ne7t mem Lo#ation* 6u"t a#t $i+iso f om $i+i$en$ In# ement B e% Jump to L==P if esult $oes not )iel$ "o o0 A$$ $i+iso to a##* De# ement B e% In# ement 2L e%* to point ne7t mem Lo#ation* T ansfe the emain$e f om a## to memo )* In# ement 2L e%* to point ne7t mem Lo#ation* T ansfe the -uotient f om B e% to memo )* 6top the p o% am

ADDRE66 '50A '501 '50A '501

OUTPUT DATA

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

98

ECE DEPARTMENT

MP&MC LAB MANUAL

3(A&.14 BIT DATA ADDITION


AIM: To a$$ t0o 9&!"it num"e s sto e$ at #onse#uti+e memo ) lo#ations* AL/ORIT0M: 9* A* 1* '* Initiali3e memo ) pointe to $ata lo#ation* ?et the fi st num"e f om memo ) an$ sto e in Re%iste pai * ?et the se#on$ num"e in memo ) an$ a$$ it to the Re%iste pai * 6to e the sum & #a ) in sepa ate memo ) lo#ations*

RESULT: Thus an ALP p o% am fo 9&!"it a$$ition 0as 0 itten an$ e7e#ute$ in 8085p usin% spe#ial inst u#tions*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

98

ECE DEPARTMENT 1LO2 C0ART:


6TART

MP&MC LAB MANUAL

FLG F2G FDEG

F8050 2G F8059 2G F2LG

FLG F2G

F805A2G F80512G

FAG002

F2LGF2LG.FDEG

Is the e a Ca )H

N=

@E6
FAGFAG.9

F805'GF LG

F8055G F2G

F805&G

FAG

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

9K

ECE DEPARTMENT PRO/RAM: ADDRESS OPCODE LABEL 8000 6TART 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' L==P

MP&MC LAB MANUAL

MNEMONICS OPERAND L2LD 80502 IC2? L2LD M/I DAD JNC INR 62LD 6TA 2LT

COMMENT Loa$ the au%en$ in DE pai th ou%h 2L pai *

805A2 A, 002 D L==P A 805'2 805&2

Loa$ the a$$en$ in 2L pai * Initiali3e e%* A fo #a ) A$$ the #ontents of 2L Pai 0ith that of DE pai * If the e is no #a ), %o to the inst u#tion la"ele$ L==P* =the 0ise in# ement e%* A 6to e the #ontent of 2L Pai in 805'2BL6B of sumC 6to e the #a ) in 805&2 th ou%h A##* BM6B of sumC* 6top the p o% am*

OBSERVATION: INPUT DATA =UTPUT DATA

ADDRE66 80502 80592 805A2 80512

ADDRE66 805'2 80552 805&2

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A0

ECE DEPARTMENT

MP&MC LAB MANUAL

3(B&.14 BIT DATA SUBTRACTION


AIM: To su"t a#t t0o 9&!"it num"e s sto e$ at #onse#uti+e memo ) lo#ations* AL/ORIT0M: 9* A* 1* '* 5* RESULT: Thus an ALP p o% am fo su"t a#tin% t0o 9&!"it num"e s 0as 0 itten an$ e7e#ute$* Initiali3e memo ) pointe to $ata lo#ation* ?et the su"t ahen$ f om memo ) an$ t ansfe it to e%iste pai * ?et the minuen$ f om memo ) an$ sto e it in anothe e%iste pai * 6u"t a#t su"t ahen$ f om minuen$* 6to e the $iffe en#e an$ "o o0 in $iffe ent memo ) lo#ations*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A9

ECE DEPARTMENT

MP&MC LAB MANUAL

1LO2 C0ART:
6TART

FLG F2G FDEG

F8050 2G F8059 2G F2LG

FLG F2G

F805A2G F80512G

F2LGF2LG!FDEG

Is the e a "o o0H

N=

@E6
FCGFCG.9

F805'GF LG

F8055G F2G

F805&G

FCG

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

AA

ECE DEPARTMENT PRO/RAM: ADDRESS OPCODE LABEL 8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' 8095 809& 8098 8098 809K 809A OBSERVATION: ADDRE66 80502 80592 805A2 80512 INPUT DATA ADDRE66 805'2 80552 805&2 6TART

MP&MC LAB MANUAL

MNEMO NICS M/I L2LD IC2? L2LD M=/ 6UB M=/ M=/ 6BB M=/ 62LD JNC INR M=/ 6TA 2LT

OPER COMMENTS AND C, 00 Initiali3e C e%* 80502 Loa$ the su"t ahen$ in DE e%* Pai th ou%h 2L e%* pai * Loa$ the minuen$ in 2L e%* Pai * Mo+e the #ontent of e%* L to A##* 6u"t a#t the #ontent of e%* E f om that of a##* Mo+e the #ontent of A##* to e%* L Mo+e the #ontent of e%* 2 to A##* 6u"t a#t #ontent of e%* D 0ith that of A##* T ansfe #ontent of a##* to e%* 2 6to e the #ontent of 2L pai in memo ) lo#ation 850'2* If the e is "o o0, %o to the inst u#tion la"ele$ NEIT* In# ement e%* C T ansfe the #ontent of e%* C to A##* 6to e the #ontent of a##* to the memo ) lo#ation 850&2 6top the p o% am e7e#ution* =UTPUT DATA

805A2 A, L E L, A A, 2 D 2, A 805'2 NEIT C A, C 805&2

NEIT

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A1

ECE DEPARTMENT

MP&MC LAB MANUAL

5(A&.14 BIT MULTIPLICATION


AIM: To multipl) t0o 9&!"it num"e s an$ sto e the esult in memo )* AL/ORIT0M: 9* A* 1* '* ?et the multiplie an$ multipli#an$* Initiali3e a e%iste to sto e pa tial p o$u#t* A$$ multipli#an$, multiplie times* 6to e the esult in #onse#uti+e memo ) lo#ations*

RESULT: Thus the 9&!"it multipli#ation 0as $one in 8085p usin% epeate$ a$$ition metho$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A'

ECE DEPARTMENT 1LO2C0ART: 6TART L 2 F8050G F8059G

MP&MC LAB MANUAL

6P 2L

L 2

F805AG F8051G

DE

2L

2L0000 BC0000

2L2L.6P

NO

Is Ca ) fla% setH

BCBC.9

DEDE.9

Is :e o fla% setH

A 6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A5

ECE DEPARTMENT

MP&MC LAB MANUAL

5ES

NO 5ES A

F805'G F8055G

L 2

F805&G F8058G

C B

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A&

ECE DEPARTMENT ADDRESS OPCODE LABEL MNEM

MP&MC LAB MANUAL OPERAN COMMENTS O D N I C S L2LD 8050 Loa$ the fi st No* in sta#4 pointe th ou%h 2L e% pai 6P2L L2LD IC2? LII LII L==P DAD JNC INI DCI M=/ =RA JN: 62LD M=/ 6TA M=/ 6TA 2LT
=UTPUT

8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' 8095 809& 8098 8098 809K 809A 809B 809C 809D 809E 809> 80A0 80A9 80AA 80A1 80A' OBSERVATION:
INPUT

6TART

805A

Loa$ the se#on$ No* in 2L e%* pai & E7#han%e 0ith DE e% pai *

2, 00002 Clea 2L & DE e% pai s* B, 00002 6P NEIT B D A,E D L==P 805' A, C 805& A, B 8058 A$$ 6P 0ith 2L pai * If the e is no #a ), %o to the inst u#tion la"ele$ NEIT In# ement BC e% pai De# ement DE e% pai * Mo+e the #ontent of e% E to A##* =R A## 0ith D e%* If the e is no 3e o, %o to inst u#tion la"ele$ L==P 6to e the #ontent of 2L pai in memo ) lo#ations 805' & 8055* Mo+e the #ontent of e%* C to A##* 6to e the #ontent of A##* in memo ) lo#ation 805&* Mo+e the #ontent of e%* B to A##* 6to e the #ontent of A##* in memo ) lo#ation 805&* 6top p o% am e7e#ution

NEIT

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A8

ECE DEPARTMENT
ADDRE66 DATA ADDRE66 DATA

MP&MC LAB MANUAL

8050 8059 805A


8051

805' 8055 805&


8058

5(B&.146 BIT DIVISION


AIM: To $i+i$e t0o 9&!"it num"e s an$ sto e the esult in memo ) usin% 8085 mnemoni#s* AL/ORIT0M: 9* A* 1* '* 5* ?et the $i+i$en$ an$ $i+iso * Initiali3e the e%iste fo -uotient* Repeate$l) su"t a#t $i+iso f om $i+i$en$ till $i+i$en$ "e#omes less than $i+iso * Count the num"e of su"t a#tion 0hi#h e-uals the -uotient* 6to e the esult in memo )*

RESULT: Thus the 9&!"it Di+ision 0as $one in 8085p usin% epeate$ su"t a#tion metho$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

A8

ECE DEPARTMENT 1LO2C0ART:


6TART L F8059G 2 F805AG

MP&MC LAB MANUAL

2L

DE

L F8050G 2 F8059G

BC 00002

LN AA! E LA

A2 AA! 2! Bo o0 2A

BCBC. 9

Is Ca ) fla% set H

N=

@E6
A

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

AK

ECE DEPARTMENT
A

MP&MC LAB MANUAL

BCBC! 9 2L2L.DE

LF805'G 2F8055G

AC

F805&G A

AB

F8058G A

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

10

ECE DEPARTMENT PRO/RAM: ADDRESS OPCODE LABEL 8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' 8095 809& 8098 8098 809K 809A 809B 809C 809D 809E 809> 80A0 80A9 OBSERVATION: INPUT ADDRE66 DATA 8050 8059 805A 8051 6TART

MP&MC LAB MANUAL

MNEM ONICS L2LD IC2? L2LD LII

OPERA ND 805A

COMMENTS Loa$ the fi st No* in sta#4 pointe th ou%h 2L e%* pai

8050 B, 00002

Loa$ the se#on$ No* in 2L e%* pai & E7#han%e 0ith DE e%* pai * Clea BC e%* pai *

L==P

M=/ 6UB M=/ M=/ 6BB M=/ INI JNC DCI DAD 62LD M=/ 6TA M=/ 6TA 2LT

A, L E L, A A, 2 D 2, A B L==P B D 805' A, C 805& A, B 8058

Mo+e the #ontent of e%* L to A##* 6u"t a#t e%* E f om that of A##* Mo+e the #ontent of A## to L* Mo+e the #ontent of e%* 2 A##* 6u"t a#t e%* D f om that of A##* Mo+e the #ontent of A## to 2* In# ement e%* Pai BC If the e is no #a ), %o to the lo#ation la"ele$ L==P* De# ement BC e%* pai * A$$ #ontent of 2L an$ DE e%* pai s* 6to e the #ontent of 2L pai in 805' & 8055* Mo+e the #ontent of e%* C to A##* 6to e the #ontent of A##* in memo ) 805& Mo+e the #ontent of e%* B to A##* 6to e the #ontent of A##* in memo ) 8058* 6top the p o% am e7e#ution*

=UTPUT ADDRE66 DATA 805' 8055 805& 8058

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

19

ECE DEPARTMENT

MP&MC LAB MANUAL

4(A&.LAR/EST ELEMENT IN AN ARRA5


AIM: To fin$ the la %est element in an a a)* AL/ORIT0M: 9* Pla#e all the elements of an a a) in the #onse#uti+e memo ) lo#ations* A* >et#h the fi st element f om the memo ) lo#ation an$ loa$ it in the a##umulato * 1* Initiali3e a #ounte B e%iste C 0ith the total num"e of elements in an a a)* '* De# ement the #ounte ") 9* 5* In# ement the memo ) pointe to point to the ne7t element* &* Compa e the a##umulato #ontent 0ith the memo ) #ontent Bne7t elementC* 8* If the a##umulato #ontent is smalle , then mo+e the memo ) #ontent Bla %est elementC to the a##umulato * Else #ontinue* 8* De# ement the #ounte ") 9* K* Repeat steps 5 to 8 until the #ounte ea#hes 3e o 90* 6to e the esult Ba##umulato #ontentC in the spe#ifie$ memo ) lo#ation* RESULT: Thus the la %est num"e in the %i+en a a) is foun$ out*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

1A

ECE DEPARTMENT 1LO2 C0ART: 6TART F2LG F89002G

MP&MC LAB MANUAL

FBG 0'2 FAG F2LG F2L F2LG . 9

N=

I6 FAG M F2LGH

@E6

FAG F2LG FBG FBG!9

I6 FBG L 0H

N= @E6

F8905G FAG 6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

11

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: ADDRE SS 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' OBSERVATION: INPUT ADDRE66 DATA 8900 8909 890A 8901 890' =UTPUT ADDRE66 DATA 8905 OPCO DE LABEL MNEM ONICS LII M/I L==P9 M=/ INI CMP JNC M=/ DCR JN: 6TA 2LT OPER AND 2,8900 B,0' A,M 2 M L==P A,M B L==P9 8905 COMMENTS Initiali3e 2L e%* to 89002 Initiali3e B e% 0ith no* of #ompa isonsBn!9C T ansfe fi st $ata to a##* In# ement 2L e%* to point ne7t memo ) lo#ation Compa e M & A If A is % eate than M then %o to loop T ansfe $ata f om M to A e% De# ement B e% If B is not :e o %o to loop9 6to e the esult in a memo ) lo#ation* 6top the p o% am

L==P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

1'

ECE DEPARTMENT

MP&MC LAB MANUAL

4(B&.SMALLEST ELEMENT IN AN ARRA5


AIM: To fin$ the smallest element in an a a)* AL/ORIT0M: 9* Pla#e all the elements of an a a) in the #onse#uti+e memo ) lo#ations* A* >et#h the fi st element f om the memo ) lo#ation an$ loa$ it in the a##umulato * 1* Initiali3e a #ounte B e%iste C 0ith the total num"e of elements in an a a)* '* De# ement the #ounte ") 9* 5* In# ement the memo ) pointe to point to the ne7t element* &* Compa e the a##umulato #ontent 0ith the memo ) #ontent Bne7t elementC* 8* If the a##umulato #ontent is smalle , then mo+e the memo ) #ontent Bla %est elementC to the a##umulato * Else #ontinue* 8* De# ement the #ounte ") 9* K* Repeat steps 5 to 8 until the #ounte ea#hes 3e o 90* 6to e the esult Ba##umulato #ontentC in the spe#ifie$ memo ) lo#ation* RESULT: Thus the smallest num"e in the %i+en a a) is foun$ out*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

15

ECE DEPARTMENT 1LO2 C0ART: 6TART F2LG F89002G

MP&MC LAB MANUAL

FBG 0'2 FAG F2LG F2L F2LG . 9

@E6

I6 FAG M F2LGH

N=

FAG F2LG FBG FBG!9

I6 FBG L 0H

N= @E6

F8905G FAG 6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

1&

ECE DEPARTMENT PRO/RAM: ADDRE SS 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' OBSERVATION: INPUT ADDRE66 DATA 8900 8909 890A 8901 890' =UTPUT ADDRE66 DATA 8905 OPCO DE LABEL MNEM ONICS LII M/I L==P9 M=/ INI CMP JC M=/ DCR JN: 6TA 2LT OPER AND 2,8900 B,0' A,M 2 M L==P A,M B L==P9 8905

MP&MC LAB MANUAL

COMMENTS Initiali3e 2L e%* to 89002 Initiali3e B e% 0ith no* of #ompa isonsBn!9C T ansfe fi st $ata to a##* In# ement 2L e%* to point ne7t memo ) lo#ation Compa e M & A If A is lesse than M then %o to loop T ansfe $ata f om M to A e% De# ement B e% If B is not :e o %o to loop9 6to e the esult in a memo ) lo#ation* 6top the p o% am

L==P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

18

ECE DEPARTMENT

MP&MC LAB MANUAL

7(A&.ASCENDIN/ ORDER
AIM: To so t the %i+en num"e in the as#en$in% o $e usin% 8085 mi# op o#esso * AL/ORIT0M: 9* ?et the num"e s to "e so te$ f om the memo ) lo#ations* A* Compa e the fi st t0o num"e s an$ if the fi st num"e is la %e than se#on$ then I inte #han%e the num"e * 1* If the fi st num"e is smalle , %o to step ' '* Repeat steps A an$ 1 until the num"e s a e in e-ui e$ o $e RESULT: Thus the as#en$in% o $e p o% am is e7e#ute$ an$ thus the num"e s a e a an%e$ in as#en$in% o $e *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

18

ECE DEPARTMENT 1LO2C0ART:

MP&MC LAB MANUAL

6TART FBG 0'2 F2LG F89002G

FCG 0'2 FAG F2LG F2L F2LG . 9

@E6

I6 FAG M F2LGH N= FDG F2LG

F2LG FAG

F2LG F2LG ! 9

F2LG FDG F2LG F2LG . 9 FCG FCG ; 09 2

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

1K

ECE DEPARTMENT

MP&MC LAB MANUAL

I6 FCG L 0H

N= @E6

FBG FBG!9

I6 FBG L 0H

N= @E6

6T=P

PRO/RAM:

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'0

ECE DEPARTMENT

MP&MC LAB MANUAL

ADDR E SS 8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' 8095 809& 8098 8098 809K 809A

OPCO DE

LABEL

MNEM ONICS M/I

OPER AND B,0' 2,8900 C,0' A,M 2 M L==P9 D,M M,A 2 M,D 2 C L==PA B L==P1

COMMENTS Initiali3e B e% 0ith num"e of #ompa isons Bn!9C Initiali3e 2L e%* to 89002 Initiali3e C e% 0ith no* of #ompa isonsBn!9C T ansfe fi st $ata to a##* In# ement 2L e%* to point ne7t memo ) lo#ation Compa e M & A If A is less than M then %o to loop9 T ansfe $ata f om M to D e% T ansfe $ata f om a## to M De# ement 2L pai T ansfe $ata f om D to M In# ement 2L pai De# ement C e% If C is not 3e o %o to loopA De# ement B e% If B is not :e o %o to loop1 6top the p o% am

L==P 1

LII M/I

L==PA

M=/ INI CMP JC M=/ M=/ DCI M=/ INI DCR JN: DCR JN: 2LT

L==P9

OBSERVATION: INPUT MEM=R@ L=CATI=N 8900 8909 890A 8901 890' DATA MEM=R@ L=CATI=N 8900 8909 890A 8901 890' =UTPUT DATA

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'9

ECE DEPARTMENT

MP&MC LAB MANUAL

7(B&.DESCENDIN/ ORDER
AIM: To so t the %i+en num"e in the $es#en$in% o $e usin% 8085 mi# op o#esso * AL/ORIT0M: 9* ?et the num"e s to "e so te$ f om the memo ) lo#ations* A* Compa e the fi st t0o num"e s an$ if the fi st num"e is smalle than se#on$ then I inte #han%e the num"e * 1* If the fi st num"e is la %e , %o to step ' '* Repeat steps A an$ 1 until the num"e s a e in e-ui e$ o $e RESULT: Thus the $es#en$in% o $e p o% am is e7e#ute$ an$ thus the num"e s a e a an%e$ in $es#en$in% o $e *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'A

ECE DEPARTMENT 1LO2C0ART:

MP&MC LAB MANUAL

6TART FBG 0'2 F2LG F89002G

FCG 0'2 FAG F2LG F2L F2LG . 9

N=

I6 FAG M F2LGH @E6 FDG F2LG

F2LG FAG

F2LG F2LG ! 9

F2LG FDG F2LG F2LG . 9 FCG FCG ; 09 2

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'1

ECE DEPARTMENT

MP&MC LAB MANUAL

I6 FCG L 0H

N= @E6

FBG FBG!9

I6 FBG L 0H

N= @E6

6T=P

PRO/RAM:

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

''

ECE DEPARTMENT

MP&MC LAB MANUAL

ADDRE SS 8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' 8095 809& 8098 8098 809K 809A

OPCO DE

LABEL

MNEM ONICS M/I LII M/I

OPER AND B,0' 2,8900 C,0' A,M 2 M L==P9 D,M M,A 2 M,D 2 C L==PA B L==P1

COMMENTS Initiali3e B e% 0ith num"e of #ompa isons Bn!9C Initiali3e 2L e%* to 89002 Initiali3e C e% 0ith no* of #ompa isonsBn!9C T ansfe fi st $ata to a##* In# ement 2L e%* to point ne7t memo ) lo#ation Compa e M & A If A is % eate than M then %o to loop9 T ansfe $ata f om M to D e% T ansfe $ata f om a## to M De# ement 2L pai T ansfe $ata f om D to M In# ement 2L pai De# ement C e% If C is not 3e o %o to loopA De# ement B e% If B is not :e o %o to loop1 6top the p o% am

L==P 1

L==PA

M=/ INI CMP JNC M=/ M=/ DCI M=/ INI DCR JN: DCR JN: 2LT

L==P9

OBSERVATION: INPUT MEM=R@ L=CATI=N 8900 8909 890A 8901 890' DATA MEM=R@ L=CATI=N 8900 8909 890A 8901 890' =UTPUT DATA

8(A&.CODE CONVERSION 8DECIMAL TO 0E9

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'5

ECE DEPARTMENT AIM: To #on+e t a %i+en $e#imal num"e to he7a$e#imal* AL/ORIT0M: 9* A* 1* '* 5* &*

MP&MC LAB MANUAL

Initiali3e the memo ) lo#ation to the $ata pointe * In# ement B e%iste * In# ement a##umulato ") 9 an$ a$Oust it to $e#imal e+e ) time* Compa e the %i+en $e#imal num"e 0ith a##umulato +alue* Dhen "oth mat#hes,the e-ui+alent he7a$e#imal +alue is in B e%iste * 6to e the esultant in memo ) lo#ation*

RESULT: Thus an ALP p o% am fo #on+e sion of $e#imal to he7a$e#imal 0as 0 itten an$ e7e#ute$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'&

ECE DEPARTMENT 1LO2C0ART:

MP&MC LAB MANUAL

6TART 2L '5002

A 00

B B

002 B.9

A .9

De#imal a$Oust a##umulato

N=

Is ALMH

@E6
A B

8909

6top

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'8

ECE DEPARTMENT PRO/RAM: ADDRE SS 8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 RESULT: INPUT ADDRE66 DATA 8900 =UTPUT ADDRE66 DATA 8909 OPCO DE LABEL MNEM ONICS LII M/I M/I L==P INR ADI DAA CMP JN: M=/ 6TA 2LT OPER AND 2,8900 A,00 B,00 B 09 M L==P A,B 8909

MP&MC LAB MANUAL

COMMENTS Initiali3e 2L e%* to 89002 Initiali3e A e%iste * Initiali3e B e%iste ** In# ement B e%* In# ement A e% De#imal A$Oust A##umulato Compa e M & A If a## an$ %i+en num"e a e not e-ual, then %o to L==P T ansfe B e% to a##* 6to e the esult in a memo ) lo#ation* 6top the p o% am

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'8

ECE DEPARTMENT

MP&MC LAB MANUAL

8(B&. CODE CONVERSION 80E9ADECIMAL TO DECIMAL


AIM: To #on+e t a %i+en he7a$e#imal num"e to $e#imal* AL/ORIT0M: 9* A* 1* '* 5* &* Initiali3e the memo ) lo#ation to the $ata pointe * In# ement B e%iste * In# ement a##umulato ") 9 an$ a$Oust it to $e#imal e+e ) time* Compa e the %i+en he7a$e#imal num"e 0ith B e%iste +alue* Dhen "oth mat#h, the e-ui+alent $e#imal +alue is in A e%iste * 6to e the esultant in memo ) lo#ation*

RESULT: Thus an ALP p o% am fo #on+e sion of he7a$e#imal to $e#imal 0as 0 itten an$ e7e#ute$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

'K

ECE DEPARTMENT 1LO2C0ART:


2L 6TART 89002

MP&MC LAB MANUAL

A 00

B C B

002 002 B.9

A .9

De#imal a$Oust a##umulato

Is the e #a )H C C.9 D A, A B,

Is ALMH

N= 8909 890A A, A C @E6 A


6top

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

50

ECE DEPARTMENT PRO/RAM: ADDRE SS 8000 8009 800A 8001 800' 8005 800& 8008 8008 800K 800A 800B 800C 800D 800E 800> 8090 8099 809A 8091 809' 8095 809& 8098 8098 809K 809A 809B 809C 809D 809E 809> RESULT: INPUT ADDRE66 8900 DATA OPCO DE LABEL MNEM ONICS LII M/I M/I M/I L==P INR ADI DAA JNC INR M=/ M=/ CMP M=/ JN: 6TA M=/ 6TA 2LT OPER AND 2,8900 A,00 B,00 C,00 B 09 NEIT C D,A A,B M A,D L==P 8909 A,C 890A

MP&MC LAB MANUAL

COMMENTS Initiali3e 2L e%* to 89002 Initiali3e A e%iste * Initiali3e B e%iste * Initiali3e C e%iste fo #a )* In# ement B e%* In# ement A e% De#imal A$Oust A##umulato If the e is no #a ) %o to NEIT* In# ement # e%iste * T ansfe A to D T ansfe B to A Compa e M & A T ansfe D to A If a## an$ %i+en num"e a e not e-ual, then %o to L==P 6to e the esult in a memo ) lo#ation* T ansfe C to A 6to e the #a ) in anothe memo ) lo#ation* 6top the p o% am

NEIT

=UTPUT ADDRE66 8909 890A

DATA

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

59

ECE DEPARTMENT

MP&MC LAB MANUAL

:(A&.BCD ADDITION
AIM: To a$$ t0o 8 "it BCD num"e s sto e$ at #onse#uti+e memo ) lo#ations* AL/ORIT0M: 9* A* 1* '* 5* Initiali3e memo ) pointe to $ata lo#ation* ?et the fi st num"e f om memo ) in a##umulato * ?et the se#on$ num"e an$ a$$ it to the a##umulato A$Oust the a##umulato +alue to the p ope BCD +alue usin% DAA inst u#tion* 6to e the ans0e at anothe memo ) lo#ation*

RESULT: Thus the 8 "it BCD num"e s sto e$ at '500 &'509 a e a$$e$ an$ the esult sto e$ at '50A & '501*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

5A

ECE DEPARTMENT

MP&MC LAB MANUAL

1LO2 C0ART:
6TART

FCG

002

F2LG

'5002

FAG

FMG

F2LGF2LG.9

FAGFAG.FMG De#imal A$Oust A##umulato N=

@E6 Is the e a Ca )H

FCGFCG.9

F2LGF2LG.9

FMG

FAG

F2LGF2LG.9

FMG

FCG

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

51

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: ADDRESS OPCODE LABEL '900 6TART '901 '90A '901 '90' '905 '90& '908 '908 '90K '90A '90B '90C '90D '90E '90> '990 '999 OBSERVATION: INPUT '500 '509 '50A '501 =UTPUT L9 MNEMONICS OPERAND M/I C, 00 LII M=/ INI ADD DAA JNC L9 2, '500 A, M 2 M COMMENT Clea C e%* Initiali3e 2L e%* to '500 T ansfe fi st $ata to a##umulato In# ement 2L e%* to point ne7t memo ) Lo#ation* A$$ fi st num"e to a##* Content* De#imal a$Oust a##umulato Jump to lo#ation if esult $oes not )iel$ #a )* In# ement C e%* In# ement 2L e%* to point ne7t memo ) Lo#ation* T ansfe the esult f om a##* to memo )* In# ement 2L e%* to point ne7t memo ) Lo#ation* Mo+e #a ) to memo ) 6top the p o% am

INR INI M=/ INI M=/ 2LT

C 2 M, A 2 M, C

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

5'

ECE DEPARTMENT

MP&MC LAB MANUAL

:(B&.BCD SUBTRACTION
AIM: To 6u"t a#t t0o 8 "it BCD num"e s sto e$ at #onse#uti+e memo ) lo#ations* AL/ORIT0M: 9* A* 1* '* 5* Loa$ the minuen$ an$ su"t ahen$ in t0o e%iste s* Initiali3e Bo o0 e%iste to 0* Ta4e the 900<s #omplement of the su"t ahen$* A$$ the esult 0ith the minuen$ 0hi#h )iel$s the esult* A$Oust the a##umulato +alue to the p ope BCD +alue usin% DAA inst u#tion* If the e is a #a ) i%no e it* &* If the e is no #a ), in# ement the #a ) e%iste ") 9 8* 6to e the #ontent of the a##umulato B esultCan$ "o o0 e%iste in the spe#ifie$ memo ) lo#ation RESULT: Thus the 8 "it BCD num"e s sto e$ at '500 &'509 a e su"t a#te$ an$ the esult sto e$ at '50A & '501*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

55

ECE DEPARTMENT 1LO2 C0ART:


6TART

MP&MC LAB MANUAL

FDG 002 2L '500 B M 2L 2L. 9 C M A KK FAG FAG ; FCG FAG FAG.9 FAGFAG.FBG DAA

Is the e a Ca ) H

@E6

N= FDGFDG.9

F2LGF2LG.9

F'50AG A F'501G D

6T=P

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

5&

ECE DEPARTMENT PRO/RAM: ADDRESS OPCODE LABEL '900 6TART '909 '90A '901 '90' '905 '90& '908 '908 '90K '90A '90B '90C '90D '90E '90> '990 '999 '99A '991 '99' '995 '99& OBSERVATION: INPUT '500 '509 '50A '501 =UTPUT L==P INR INI M=/ INI M=/ 2LT D 2 M,A 2 M, D

MP&MC LAB MANUAL

MNEMONICS OPERAND COMMENT M/I D, 00 Clea D e%* LII M=/ INI M=/ M/I 6UB INR ADD DAA JC 2, '500 B, M 2 C, M A, KK C A B L==P Initiali3e 2L e%* to '500 T ansfe fi st $ata to a##umulato In# ement 2L e%* to point ne7t mem* Lo#ation* Mo+e se#on$ no* to B e%* Mo+e KK to the A##umulato 6u"t a#t FCG f om a##* Content* In# ement A e%iste A$$ FBG 0ith FAG A$Oust A##umulato +alue fo De#imal $i%its Jump on #a ) to loop

In# ement D e%* In# ement 2L e%iste pai Mo+e the A##*#ontent to the memo ) lo#ation In# ement 2L e%* to point ne7t mem* Lo#ation* T ansfe D e%iste #ontent to memo )* 6top the p o% am

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

58

ECE DEPARTMENT

MP&MC LAB MANUAL

10. 2 9 2 MATRI9 MULTIPLICATION


AIM: To pe fo m the A 7 A mat i7 multipli#ation* AL/ORIT0M: 9* Loa$ the A input mat i#es in the sepa ate a$$ ess an$ initiali3e the 2L an$ the DE e%iste pai 0ith the sta tin% a$$ ess espe#ti+el)* A* Call a su" outine fo pe fo min% the multipli#ation of one element of a mat i7 0ith the othe element of the othe mat i7* 1* Call a su" outine to sto e the esultant +alues in a sepa ate mat i7* RESULT: Thus the A 7 A mat i7 multipli#ation is pe fo me$ an$ the esult is sto e$ at '800,'809 , '80A & '801*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

58

ECE DEPARTMENT 1LO2 C0ART:


6TART C 2L 002 85002

MP&MC LAB MANUAL

A
2L 2L.9 DE DE.9N DE DE.9 Call su" outine MUL A A.B

DE

8&002

Call su" outine MUL

Call su" outine 6T=RE A C

2L 2L.9 DE DE.9N DE DE.9 Call su" outine MUL A A.B

Is AL0'2 H N= In# ement 2L e%* pai

@E6

Call su" outine 6T=RE 2L 2L!9 DE DE!9N Call su" outine MUL B A

6T=P

B A

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ Call su" outine MUL

5K

ECE DEPARTMENT

MP&MC LAB MANUAL

MUL

6T=RE

FAG FFDEGG D A 2 M 2 2! 9

B 88

FAGFFBCGG

C C. 9 Is 2L0 H

@E6
RET

N=
FDGFDG.9

2 2! 9

N=

Is 2L0 H

@E6 F2G85N FDG8&

RET

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&0

ECE DEPARTMENT PRO/RAM: ADDRESS OPCOD LABEL E 8900 8909 890A 8901 890' 8905 L==PA 890& 8908 8908 890K 890A 890B 890C 890D 890E 890> 8990 8999 899A 8991 899' 8995 899& 8998 8998 899K 899A 899B 899C 899D 899E 899> 89A0 89A9 89AA 89A1 89A' 89A5 89A& M=/ INI INI INI CALL ADD CALL M=/ B,A 2 D D MUL B 6T=RE A,C MNEM ONICS M/I LII LII CALL M=/ INI INI INI CALL ADD CALL DCI DCI CALL OPERAN D C, 00 2, 8500 D, 8&00 MUL B,A 2 D D MUL B 6T=RE 2 D MUL

MP&MC LAB MANUAL

COMMENT Clea C e%* Initiali3e 2L e%* to '500 Loa$ DE e%iste pai Call su" outine MUL Mo+e A to B e%* In# ement 2L e%iste pai * In# ement DE e%iste pai In# ement DE e%iste pai Call su" outine MUL A$$ FBG 0ith FAG Call su" outine 6T=RE De# ement 2L e%iste pai De# ement DE e%iste pai Call su" outine MUL

T ansfe A e% #ontent to B e%* In# ement 2L e%iste pai In# ement DE e%iste pai In# ement DE e%iste pai Call su" outine MUL A$$ A 0ith B Call su" outine MUL T ansfe C e%iste #ontent to A##*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&9

ECE DEPARTMENT 89A8 89A8 89AK 89AA 89AB 89AC 89AD 89AE 89A> 8910 8919 891A 8911 891' 8915 891& 8918 8918 891K 891A 891B 891C 891D 891E 891> 89'0 89'9 89'A 89'1 89'' 89'5 89'& CPI J: INI JMP L==P9 MUL 2LT LDAI M=/ M=/ DCR J: L==P' ADD DCR JN: M/I M/I 6T=RE RET M/I 6TAI INR RET 0' L==P9 2 L==PA

MP&MC LAB MANUAL Compa e 0ith 0' to #he#4 0hethe all elements a e multiplie$* If #omplete$, %o to loop9 In# ement 2L e%iste Pai * Jump to L==PA* 6top the p o% am* Loa$ a## f om the memo ) lo#ation pointe$ ") DE pai * T ansfe a## #ontent to D e%iste * T ansfe f om memo ) to 2 e%iste * De# ement 2 e%iste * If 2 is 3e o %o to L==P1* A$$ A## 0ith D e% De# ement 2 e%iste * If 2 is not 3e o %o to L==P'* T ansfe 85 T= 2 e%iste * T ansfe 8& to D e%iste * Retu n to main p o% am* T ansfe 88 to B e%iste * Loa$ A f om memo ) lo#ation pointe$ ") BC pai * In# ement C e%iste * Retu n to main p o% am*

D D,A 2,M 2 L==P1 D 2 L==P' 2,85 D,8& B,88 B C

L==P1

OBSERVATION: '500 '509 '50A '501 INPUT '&00 '&09 '&0A '&01 =UTPUT '800 '809 '80A '801

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&A

ECE DEPARTMENT

MP&MC LAB MANUAL

11. BIOS;DOS CALLS 8 DISPLA5


AIM: To $ispla) a messa%e on the CRT s# een of a mi# o#ompute usin% D=6 #alls* AL/ORIT0M: 9* Initiali3e the $ata se%ment an$ the messa%e to "e $ispla)e$* A* 6et fun#tion +alue fo $ispla)* 1* Point to the messa%e an$ un the inte upt to $ispla) the messa%e in the CRT* PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT M6? DB 0D2, 0A2, P?==D M=RNIN?Q , =D2, =A2, PRQ DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ A2, 0K2 M=/ DI, =>>6ET M6? INT A92 M=/ A2, 'C2 INT A92 C=DE END6 END 6TART RESULT: A messa%e is $ispla)e$ on the CRT s# een of a mi# o#ompute usin% D=6 #alls

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&1

ECE DEPARTMENT

MP&MC LAB MANUAL

12. BIOS;DOS CALLS 8 1ILE MANIPULATION


AIM: To open a file usin% D=6 #alls* AL/ORIT0M: 9* Initiali3e the $ata se%ment, file name an$ the messa%e to "e $ispla)e$* A* 6et the file att i"ute to # eate a file usin% a D=6 #all* 1* If the file is una"le t o # eate a file $ispla) the messa%e PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT >ILENAME DB P6AMPLE*DATQ, PRQ M6? DB 0D2, 0A2, P>ILE N=T CREATEDQ, =D2, =A2, PRQ DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ DI, =>>6ET >ILENAME M=/ CI, 002 M=/ A2, 1C2 INT A92 JNC L==P9 M=/ AI, DATA M=/ D6, AI M=/ DI, =>>6ET M6? M=/ A2, 0K2 INT A92 L==P9 C=DE END6 END 6TART RESULT: A file is opene$ usin% D=6 #alls* M=/ A2, 'C2 INT A92

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&'

ECE DEPARTMENT

MP&MC LAB MANUAL

13. BIOS;DOS CALLS 8 DIS< IN1ORMATION


AIM: To $ispla) the $is4 info mation* AL/ORIT0M: 9* Initiali3e the $ata se%ment an$ the messa%e to "e $ispla)e$* A* 6et fun#tion +alue fo $is4 info mation* 1* Point to the messa%e an$ un the inte upt to $ispla) the messa%e in the CRT* PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT M6? DB 0D2, 0A2, P?==D M=RNIN?Q , =D2, =A2, PRQ DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ A2, 1&2 M=/ DI, =>>6ET M6? INT A92 M=/ A2, 'C2 INT A92 C=DE END6 END 6TART RESULT: The $is4 info mation is $ispla)e$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&5

ECE DEPARTMENT

MP&MC LAB MANUAL

1.8084 STRIN/ MANIPULATION 8 SEARC0 A 2ORD


AIM: To sea #h a 0o $ f om a st in%* AL/ORIT0M: 9* Loa$ the sou #e an$ $estination in$e7 e%iste 0ith sta tin% an$ the en$in% a$$ ess espe#ti+el)* A* Initiali3e the #ounte 0ith the total num"e of 0o $s to "e #opie$* 1* Clea the $i e#tion fla% fo auto in# ementin% mo$e of t ansfe * '* Use the st in% manipulation inst u#tion 6CA6D 0ith the p efi7 REP to sea #h a 0o $ f om st in%* 5* If a mat#h is foun$ B3L9C, $ispla) 09 in $estination a$$ ess* =the 0ise, $ispla) 00 in $estination a$$ ess* RESULT: A 0o $ is sea #he$ an$ the #ount of num"e of appea an#es is $ispla)e$*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&&

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT LI6T DD 512, 952, 9K2, 0A2 DE6T ESU 10002 C=UNT ESU 052 DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ AI, 952 M=/ 6I, =>>6ET LI6T M=/ DI, DE6T M=/ CI, C=UNT M=/ AI, 00 CLD REP 6CA6D J: L==P M=/ AI, 09 L==P M=/ FDIG, AI M=/ A2, 'C2 INT A92 C=DE END6 END 6TART INPUT: LI6T5 512, 952, 9K2, 0A2

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&8

ECE DEPARTMENT OUTPUT: 1000 09

MP&MC LAB MANUAL

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&8

ECE DEPARTMENT

MP&MC LAB MANUAL

2.8084 STRIN/ MANIPULATION 81IND AND REPLACE A 2ORD


AIM: To fin$ an$ epla#e a 0o $ f om a st in%* AL/ORIT0M: 9* Loa$ the sou #e an$ $estination in$e7 e%iste 0ith sta tin% an$ the en$in% a$$ ess espe#ti+el)* A* Initiali3e the #ounte 0ith the total num"e of 0o $s to "e #opie$* 1* Clea the $i e#tion fla% fo auto in# ementin% mo$e of t ansfe * '* Use the st in% manipulation inst u#tion 6CA6D 0ith the p efi7 REP to sea #h a 0o $ f om st in%* 5* If a mat#h is foun$ B3L9C, epla#e the ol$ 0o $ 0ith the #u ent 0o $ in $estination a$$ ess* =the 0ise, stop* RESULT: A 0o $ is foun$ an$ epla#e$ f om a st in%*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

&K

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT LI6T DD 512, 952, 9K2, 0A2 REPLACE ESU 102 C=UNT ESU 052 DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ AI, 952 M=/ 6I, =>>6ET LI6T M=/ CI, C=UNT M=/ AI, 00 CLD REP 6CA6D JN: L==P M=/ DI, LABEL LI6T M=/ FDIG, REPLACE L==P C=DE END6 END 6TART INPUT: LI6T5 512, 952, 9K2, 0A2 M=/ A2, 'C2 INT A92

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

80

ECE DEPARTMENT OUTPUT: LI6T5 512, 102, 9K2, 0A2

MP&MC LAB MANUAL

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

89

ECE DEPARTMENT

MP&MC LAB MANUAL

3. 8084 STRIN/ MANIPULATION 8 COP5 A STRIN/


AIM: To #op) a st in% of $ata 0o $s f om one lo#ation to the othe * AL/ORIT0M: &* Loa$ the sou #e an$ $estination in$e7 e%iste 0ith sta tin% an$ the en$in% a$$ ess espe#ti+el)* 8* Initiali3e the #ounte 0ith the total num"e of 0o $s to "e #opie$* 8* Clea the $i e#tion fla% fo auto in# ementin% mo$e of t ansfe * K* Use the st in% manipulation inst u#tion M=/6D 0ith the p efi7 REP to #op) a st in% f om sou #e to $estination* RESULT: A st in% of $ata 0o $s is #opie$ f om one lo#ation to othe *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8A

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT 6=URCE ESU A0002 DE6T ESU 10002 C=UNT ESU 052 DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ E6, AI M=/ 6I, 6=URCE M=/ DI, DE6T M=/ CI, C=UNT CLD REP M=/6D M=/ A2, 'C2 INT A92 C=DE END6 END 6TART INPUT: A000 A009 A00A A001 A00' '8 8' &8 K0 A9 OUTPUT: 1000 1009 100A 1001 100' '8 8' &8 K0 A9

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

81

ECE DEPARTMENT

MP&MC LAB MANUAL

3.8084 STRIN/ MANIPULATION 8 SORTIN/


AIM: To so t a % oup of $ata ")tes* AL/ORIT0M: Pla#e all the elements of an a a) name$ list Bin the #onse#uti+e memo ) lo#ationsC* Initiali3e t0o #ounte s DI & CI 0ith the total num"e of elements in the a a)* Do the follo0in% steps until the #ounte B ea#hes 0* o Loa$ the fi st element in the a##umulato o Do the follo0in% steps until the #ounte C ea#hes 0* 9* Compa e the a##umulato #ontent 0ith the ne7t element p esent in the ne7t memo ) lo#ation* If the a##umulato #ontent is smalle %o to ne7t stepN othe 0ise, s0ap the #ontent of a##umulato 0ith the #ontent of memo ) lo#ation* A* In# ement the memo ) pointe to point to the ne7t element* 1* De# ement the #ounte C ") 9* 6top the e7e#ution*

RESULT:

A % oup of $ata ")tes a e a an%e$ in as#en$in% o $e *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8'

ECE DEPARTMENT PRO/RAM: A66UME C65 C=DE, D65 DATA DATA 6E?MENT LI6T DD 512, A52, 9K2, 0A2 C=UNT ESU 0'2 DATA END6 C=DE 6E?MENT 6TART5 M=/ AI, DATA M=/ D6, AI M=/ DI, C=UNT!9 L==PA5 A?AIN5 M=/ CI, DI M=/ 6I, =>>6ET LI6T M=/ AI, F6IG CMP AI, F6I.AG JC L==P9 IC2? F6I .AG, AI IC2? F6IG, AI L==P95 ADD 6I, 0A L==P A?AIN DEC DI JN: L==PA M=/ A2, 'C2 INT A92 C=DE END6 END 6TART INPUT: LI6T5 512, A52, 9K2, 0A2 OUTPUT: LI6T5 0A2, 9K2, A52, 512

MP&MC LAB MANUAL

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

85

ECE DEPARTMENT

MP&MC LAB MANUAL

3. INTER1ACIN/ 8255 2IT0 8085 AIM:


To inte fa#e p o% amma"le pe iphe al inte fa#e 8A55 0ith 8085 an$ stu$) its #ha a#te isti#s in mo$e0,mo$e9 an$ B6R mo$e* APPARATUS RE=UIRED: 8085 p 4it, 8A55Inte fa#e "oa $, DC e%ulate$ po0e suppl), /IT pa allel "us I;O MODES: C#%tr#) 2#r(:

MODE 0 8 SIMPLE I;O MODE: This mo$e p o+i$es simple IE= ope ations fo ea#h of the th ee po ts an$ is suita"le fo s)n#h onous $ata t ansfe * In this mo$e all the po ts #an "e #onfi%u e$ eithe as input o output po t* Let us initiali3e po t A as input po t an$ po t B as output po t

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8&

ECE DEPARTMENT

MP&MC LAB MANUAL

PRO/RAM: ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS '900 6TART5 M/I A, K0 Initiali3e po t A as Input an$ Po t '909 B as output* '90A =UT C& 6en$ Mo$e Cont ol 0o $ '901 '90' IN C0 Rea$ f om Po t A '905 '90& =UT CA Displa) the $ata in po t B '908 '908 6TA 'A00 6to e the $ata ea$ f om Po t A '90K in 'A00 '90A '90B 2LT 6top the p o% am* MODE1 STROBED I;O MODE: In this mo$e, po t A an$ po t B a e use$ as $ata po ts an$ po t C is use$ as #ont ol si%nals fo st o"e$ IE= $ata t ansfe * Let us initiali3e po t A as input po t in mo$e9 MAIN PRO/RAM: ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS '900 6TART5 M/I A, B' Initiali3e po t A as Input po t in '909 mo$e 9* '90A =UT C& 6en$ Mo$e Cont ol 0o $ '901 '90' M/I A,0K 6et the PC' "it fo INTE A '905 '90& =UT C& Displa) the $ata in po t B '908 EI '908 M/I A,08 Ena"le R6T5*5 '90K '90A 6IM

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

88

ECE DEPARTMENT EI 2LT

MP&MC LAB MANUAL

'90B ISR (I%t!rr*.t S!r>i"! R#*ti%!&

6top the p o% am*

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS 'A00 6TART5 IN C0 Rea$ f om po t A 'A09 'A0A 6TA '500 6to e in '500* 'A01 'A0' 'A05 2LT 6top the p o% am* S*? .r#$r' : ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS '05E JMP 'A00 ?o to 'A00 '05> '0&0 BSR MODE (Bit S!t R!+!t #(!&

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

88

ECE DEPARTMENT

MP&MC LAB MANUAL

An) lines of po t # #an "e set o eset in$i+i$uall) 0ithout affe#tin% othe lines usin% this mo$e* Let us set PC0 an$ PC1 "its usin% this mo$e* PRO/RAM: ADDRESS OPCODES LABEL MNEMONICS '900 6TART5 M/I '909 '90A =UT '901 '90' M/I '905 '90& =UT '908 OPERAND COMMENTS A, 09 6et PC0 C& A,08 C& 6en$ Mo$e Cont ol 0o $ 6et PC1 6en$ Mo$e Cont ol 0o $

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8K

ECE DEPARTMENT '90K RESULT: 2LT

MP&MC LAB MANUAL 6top the p o% am*

Thus 8A55 is inte fa#e$ an$ its #ha a#te isti#s in mo$e0,mo$e9 an$ B6R mo$e is stu$ie$*

4. INTER1ACIN/ 8253 TIMER 2IT0 8085 I%t!r@'"i%$ 8253 Pr#$r' '?)! I%t!r>') Ti !r Aith 8085 .

AIM5 To inte fa#e 8A51 Inte fa#e "oa $ to 8085 p an$ +e if) the ope ation of 8A51in si7 $iffe ent mo$es*

APPARATUS RE=UIRED5 8085 p 4it, 8A51 Inte fa#e "oa $, DC e%ulate$ po0e suppl), /IT pa allel "us, CR=*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

80

ECE DEPARTMENT

MP&MC LAB MANUAL

M#(! 0 8 I%t!rr*.t #% t!r i%') "#*%t5 The output 0ill "e initiall) lo0 afte mo$e set ope ations* Afte loa$in% the #ounte , the output 0ill "e emainin% lo0 0hile #ountin% an$ on te minal #ountN the output 0ill "e#ome hi%h, until eloa$e$ a%ain*

Let us set the #hannel 0 in mo$e 0* Conne#t the CL( 0 to the $e"oun#e #i #uit ") #han%in% the Oumpe J1 an$ then e7e#ute the follo0in% p o% am* Pr#$r' : A((r!++ O."#(!+ '900 '90A '90' '90& '908 '90A '90C L'?!) M%! #%i" O.!r'%(+ 6TART5 M/I A, 10 =UT CE M/I A, 05 =UT C8 M/I A, 00 =UT C8 2LT C# !%t+ Channel 0 in mo$e 0 6en$ Mo$e Cont ol 0o $ L6B of #ount D ite #ount to e%iste M6B of #ount D ite #ount to e%iste

It is o"se +e$ in CR= that the output of Channel 0 is initiall) L=D* Afte %i+in% si7 #lo#4 pulses, the output %oes 2I?2* M#(! 1 8 Pr#$r' '?)! ONE6S0OT: Afte loa$in% the #ounte , the output 0ill emain lo0 follo0in% the isin% e$%e of the %ate input* The output 0ill %o hi%h on the te minal #ount* It is et i%%e a"leN hen#e the output 0ill emain lo0 fo the full #ount, afte an) isin% e$%e of the %ate input* EB' .)!: The follo0in% p o% am initiali3es #hannel 0 of 8A51 in Mo$e 9 an$ also initiates t i%%e in% of ?ate 0* =UT 0 %oes lo0, as #lo#4 pulse afte t i%%e in% the %oes "a#4 to hi%h le+el afte 5 #lo#4 pulses* E7e#ute the p o% am, %i+e #lo#4 pulses th ou%h the $e"oun#e lo%i# an$ +e if) usin% CR=* A((r!++ O."#(!+ '900 '90A '90' '90& '908 '90A '90C '900 L'?!) M%! #%i" O.!r'%(+ 6TART5 M/I A, 1A =UT CE M/I A, 05 =UT C8 M/I A, 00 =UT C8 =UT D0 2LT C# !%t+ Channel 0 in mo$e 9 6en$ Mo$e Cont ol 0o $ L6B of #ount D ite #ount to e%iste M6B of #ount D ite #ount to e%iste T i%%e ?ate0

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

89

ECE DEPARTMENT

MP&MC LAB MANUAL

M#(! 2 8 R't! /!%!r't#r: It is a simple $i+i$e ") N #ounte * The output 0ill "e lo0 fo one pe io$ of the input #lo#4* The pe io$ f om one output pulse to the ne7t e-uals the num"e of input #ounts in the #ount e%iste * If the #ount e%iste is eloa$e$ "et0een output pulses the p esent pe io$ 0ill not "e affe#te$ "ut the su"se-uent pe io$ 0ill efle#t the ne0 +alue*

EB' .)!5 Usin% Mo$e A, Let us $i+i$e the #lo#4 p esent at Channel 9 ") 90* Conne#t the CL(9 to PCL(* A((r!++ O."#(!+ L'?!) M%! #%i" O.!r'%(+ C# !%t+ '900 1E 8' 6TART5 M/I A, 8' Channel 9 in mo$e A '90A D1 CE =UT CE 6en$ Mo$e Cont ol 0o $ '90' 1E 0A M/I A, 0A L6B of #ount '90& D1 CA =UT CA D ite #ount to e%iste '908 1E 00 M/I A, 00 M6B of #ount '90A D1 CA =UT CA D ite #ount to e%iste '90C 8& 2LT In CR= o"se +e simultaneousl) the input #lo#4 to #hannel 9 an$ the output at =ut9* M#(! 3 SC*'r! A'>! $!%!r't#r5 It is simila to Mo$e A e7#ept that the output 0ill emain hi%h until one half of #ount an$ %o lo0 fo the othe half fo e+en num"e #ount* If the #ount is o$$, the output 0ill "e hi%h fo B#ount . 9CEA #ounts* This mo$e is use$ of %ene atin% Bau$ ate fo 8A59A BU6ARTC*

EB' .)!: De utili3e Mo$e 0 to %ene ate a s-ua e 0a+e of f e-uen#) 950 (23 at #hannel 0* A((r!++ O."#(!+ L'?!) M%! #%i" O.!r'%(+ C# !%t+ '900 1E 1& 6TART5 M/I A, 1& Channel 0 in mo$e 1 '90A D1 CE =UT CE 6en$ Mo$e Cont ol 0o $ '90' 1E 0A M/I A, 0A L6B of #ount '90& D1 C8 =UT C8 D ite #ount to e%iste

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8A

ECE DEPARTMENT

MP&MC LAB MANUAL

'908 1E 00 M/I A, 00 M6B of #ount '90A D1 C8 =UT C8 D ite #ount to e%iste '90C 8& 2LT 6et the Oumpe , so that the #lo#4 0 of 8A51 is %i+en a s-ua e 0a+e of f e-uen#) 9*5 M23* This p o% am $i+i$es this PCL( ") 90 an$ thus the output at #hannel 0 is 950 (23* /a ) the f e-uen#) ") +a )in% the #ount* 2e e the ma7imum #ount is >>>> 2* 6o, the s-ua e 0a+e 0ill emain hi%h fo 8>>> 2 #ounts an$ emain lo0 fo 8>>> 2 #ounts* Thus 0ith the input #lo#4 f e-uen#) of 9*5 M23, 0hi#h #o espon$s to a pe io$ of 0*0&8 mi# ose#on$s, the esultin% s-ua e 0a+e has an =N time of 0*0A98' mi# ose#on$s an$ an =>> time of 0*0A98' mi# ose#on$s* To in# ease the time pe io$ of s-ua e 0a+e, set the Oumpe s su#h that CL(A of 8A51 is #onne#te$ to =UT 0* Usin% the a"o+e!mentione$ p o% am, output a s-ua e 0a+e of f e-uen#) 950 (23 at #hannel 0* No0 this is the #lo#4 to #hannel A* M#(! 3: S#@tA'r! Tri$$!r!( Str#?!: The output is hi%h afte mo$e is set an$ also $u in% #ountin%* =n te minal #ount, the output 0ill %o lo0 fo one #lo#4 pe io$ an$ "e#omes hi%h a%ain* This mo$e #an "e use$ fo inte upt %ene ation* The follo0in% p o% am initiali3es #hannel A of 8A51 in mo$e '* EB' .)!: Conne#t =UT 0 to CL( A BOumpe J9C* E7e#ute the p o% am an$ o"se +e the output =UT A* Counte A 0ill %ene ate a pulse afte 9 se#on$* A((r!++ O."#(!+ '900 '90A '90' '90& '908 '90A '90C '90E '990 '99A '99' '99& '998 L'?!) M%! #%i" O.!r'%(+ 6TART5 M/I A, 1& =UT CE M/I A, 0A =UT C8 M/I A, 00 =UT C8 M/I A, B8 =UT CE M/I A, K8 =UT CC M/I A, 1A =UT CC 2LT C# !%t+ Channel 0 in mo$e 0 6en$ Mo$e Cont ol 0o $ L6B of #ount D ite #ount to e%iste M6B of #ount D ite #ount to e%iste Channel A in Mo$e ' 6en$ Mo$e #ont ol Do $ L6B of Count D ite Count to e%iste M6B of Count D ite Count to e%iste

M#(! 5 0'r(A'r! tri$$!r!( +tr#?!: Counte sta ts #ountin% afte isin% e$%e of t i%%e input an$ output %oes lo0 fo one #lo#4 pe io$ 0hen te minal #ount is ea#he$* The #ounte is et i%%e a"le*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

81

ECE DEPARTMENT

MP&MC LAB MANUAL

E7ample5 The p o% am that follo0s initiali3es #hannel 0 in mo$e 5 an$ also t i%%e s ?ate 0* Conne#t CL( 0 to $e"oun#e #i #uit* E7e#ute the p o% am* Afte %i+in% 6i7 #lo#4 pulses, )ou #an see usin% CR=, the initiall) 2I?2 output %oes L=D* The output B =UT 0 pinC %oes hi%h on the ne7t #lo#4 pulse* A((r!++ O."#(!+ '900 '90A '90' '90& '908 '90A '90C L'?!) M%! #%i" O.!r'%(+ 6TART5 M/I A, 9A =UT CE M/I A, 05 =UT C8 M/I A, 00 =UT D0 2LT C# !%t+ Channel 0 in mo$e 5 6en$ Mo$e Cont ol 0o $ L6B of #ount D ite #ount to e%iste M6B of #ount T i%%e ?ate 0

R!+*)t: Thus the 8A51 has "een inte fa#e$ to 8085 p an$ si7 $iffe ent mo$es of 8A51 ha+e "een stu$ie$*

:. 8051 6 SUM O1 ELEMENTS IN AN ARRA5


AIM: To fin$ the sum of elements in an a a)* AL/ORIT0M: 9* A* 1* Loa$ the a a) in the #onse#uti+e memo ) lo#ation an$ initiali3e the memo ) pointe 0ith the sta tin% a$$ ess* Loa$ the total num"e of elements in a sepa ate e%iste as a #ounte * Clea the a##umulato *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8'

ECE DEPARTMENT '* pointe * 5* &* 8* RESULT: The sum of elements in an a a) is #al#ulate$* A$$ the e%iste 0ith the a##umulato *

MP&MC LAB MANUAL Loa$ the othe e%iste 0ith the +alue of the memo )

Che#4 fo #a ), if e7ist, in# ement the #a ) e%iste ") 9* othe 0ise, #ontinue De# ement the #ounte an$ if it ea#hes 0, stop* =the 0ise in# ement the memo ) pointe ") 9 an$ %o to step '*

PRO/RAM: M=/ DPTR, T'A00 M=/I A, UDPTR M=/ R0, A M=/ B, T00 M=/ R9, B INC DPTR L==PA5 CLR C M=/I A, UDPTR

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

85

ECE DEPARTMENT ADD A, B M=/ B, A JNC L==P INC R9 L==P5 INC DPTR DJN: R0, L==PA M=/ DPTR, T'500 M=/ A, R9 M=/I UDPTR, A INC DPTR M=/ A, B M=/I UDPTR, A 2LT5 6JMP 2LT

MP&MC LAB MANUAL

INPUT 'A00 'A09 'A09 'A0A 'A01 0' 05 0& 01 0A

OUTPUT: '500 '509 0> 00

10(A&.8051 6 0E9ADECIMAL TO DECIMAL CONVERSION


AIM: To pe fo m he7a$e#imal to $e#imal #on+e sion* AL/ORIT0M: 9* A* Loa$ the num"e to "e #on+e te$ into the a##umulato * If the num"e is less than 900 B&'2C, %o to ne7t stepN

othe 0ise, su"t a#t 900 B&'2C epeate$l) until the emain$e is less than 900 B&'2C* 2a+e the #ountB900<s +alueC in sepa ate e%iste 0hi#h is the #a )*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8&

ECE DEPARTMENT 1*

MP&MC LAB MANUAL If the num"e is less than 90 B0A2C, %o to ne7t stepN

othe 0ise, su"t a#t 90 B0A2C epeate$l) until the emain$e is less than 90 B0A2C* 2a+e the #ountBten<s +alueC in sepa ate e%iste * '* 5* &* RESULT The %i+en he7a$e#imal num"e is #on+e te$ into $e#imal num"e * The a##umulato no0 has the units* Multipl) the ten<s +alue ") 90 an$ a$$ it 0ith the units* 6to e the esult an$ #a ) in the spe#ifie$ memo ) lo#ation*

PRO/RAM: M=/ DPTR, T'500 M=/I A, UDPTR M=/ B, T&' DI/ A, B M=/ DPTR, T'509 M=/I UDPTR, A

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

88

ECE DEPARTMENT M=/ A, B M=/ B, T0A DI/ A, B INC DPTR M=/I UDPTR, A INC DPTR M=/ A, B M=/I UDPTR, A 2LT5 INPUT '500 D8 6JMP 2LT OUTPUT: '509 '50A 95 0A

MP&MC LAB MANUAL

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

88

ECE DEPARTMENT

MP&MC LAB MANUAL

10(B&.8051 6 DECIMAL TO 0E9ADECIMAL CONVERSION


AIM: To pe fo m $e#imal to he7a$e#imal #on+e sion AL/ORIT0M: 9* A* 1* '* RESULT: The %i+en $e#imal num"e is #on+e te$ to he7a$e#imal num"e * PRO/RAM: M=/ DPTR, T'500 M=/I A, UDPTR M=/ B, T0A MUL A, B M=/ B, A INC DPTR M=/I A, UDPTR ADD A, B INC DPTR M=/I UDPTR, A 2LT5 INPUT '500 A1 6JMP 2LT OUTPUT '509 98 Loa$ the num"e to "e #on+e te$ in the a##umulato * 6epa ate the hi%he o $e $i%it f om lo0e o $e * Multipl) the hi%he o $e $i%it ") 90 an$ a$$ it 0ith the lo0e o $e $i%it* 6to e the esult in the spe#ifie$ memo ) lo#ation*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

8K

ECE DEPARTMENT

MP&MC LAB MANUAL

13. STEPPER MOTOR INTER1ACIN/ 2IT0 8051


AIM: To inte fa#e a steppe moto 0ith 8059 mi# o#ont olle an$ ope ate it* T0EOR5: A moto in 0hi#h the oto is a"le to assume onl) $is# ete stationa ) an%ula position is a steppe moto * The ota ) motion o##u s in a step!0ise manne f om one e-uili" ium position to the ne7t* 6teppe Moto s a e use$ +e ) 0isel) in position #ont ol s)stems li4e p inte s, $is4 $ i+es, p o#ess #ont ol ma#hine tools, et#* The "asi# t0o!phase steppe moto #onsists of t0o pai s of stato poles* Ea#h of the fou poles has its o0n 0in$in%* The e7#itation of an) one 0in$in% %ene ates a No th Pole* A 6outh Pole %ets in$u#e$ at the $iamet i#all) opposite si$e* The oto ma%neti# s)stem has t0o en$ fa#es* It is a pe manent ma%net 0ith one fa#e as 6outh Pole an$ the othe as No th Pole* The 6teppe Moto 0in$in%s A9, AA, B9, BA a e #)#li#all) e7#ite$ 0ith a DC #u ent to un the moto in #lo#40ise $i e#tion* B) e+e sin% the phase se-uen#e as A9, BA, AA, B9, anti#lo#40ise steppin% #an "e o"taine$* A!P2A6E 6DITC2IN? 6C2EME5 In this s#heme, an) t0o a$Oa#ent stato 0in$in%s a e ene %i3e$* The s0it#hin% s#heme is sho0n in the ta"le %i+en "elo0* This s#heme p o$u#es mo e to -ue*
ANTICLOC<2ISE STEP A1 A2 B1 CLOC<2ISE STEP A1 A2

B2

DATA

B1

B2

DATA

9 A 1 '

9 0 0 9

0 9 9 0

0 0 9 9

9 9 0 0

Kh 5h &h Ah

9 A 1 '

9 0 0 9

0 9 9 0

9 9 0 0

0 0 9 9

Ah &h 5h Kh

ADDRE66 DEC=DIN? L=?IC5 The 8'918 #hip is use$ fo %ene atin% the a$$ ess $e#o$in% lo%i# to %ene ate the $e+i#e sele#t pulses,C69 & C6A fo sele#tin% the IC 8'985*The 8'985 lat#hes the $ata "us to the steppe moto $ i+in% #i #uit )* 6teppe Moto e-ui es lo%i# si%nals of elati+el) hi%h po0e * The efo e, the inte fa#e #i #uit ) that %ene ates the $ i+in% pulses use sili#on $a lin%ton pai t ansisto s* The inputs fo the inte fa#e #i #uit a e TTL pulses %ene ate$ un$e soft0a e #ont ol usin% the Mi# o#ont olle (it* The TTL le+els of pulse se-uen#e f om the $ata "us is t anslate$ to hi%h +olta%e output pulses usin% a "uffe 8'08 0ith open #olle#to *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K0

ECE DEPARTMENT PRO/RAM : A((r!++


OPCODES

MP&MC LAB MANUAL

Label

Comments =R? '900h DPTR, TTABLE Loa$ the sta t a$$ ess of s0it#hin% s#heme $ata TABLE into Data Pointe BDPTRC Loa$ the #ount in R0 Loa$ the num"e in TABLE into A Push DPTR +alue to 6ta#4 Loa$ the Moto po t a$$ ess into DPTR 6en$ the +alue in A to steppe Moto po t a$$ ess Dela) loop to #ause a spe#ifi# amount of time $ela) "efo e ne7t $ata item is sent to the Moto P=P "a#4 DPTR +alue f om 6ta#4 In# ement DPTR to point to ne7t item in the ta"le De# ement R0, if not 3e o epeat the loop 6ho t Oump to 6ta t of the p o% am to ma4e the moto otate #ontinuousl) /alues as pe t0o! phase s0it#hin% s#heme

'900

6TART5

M=/

'901 '905 '90& '908 '90A '90D '90E '990 '99A '99' '99& '998 '99A '99B '99D

L==P5

M=/ M=/I PU62 PU62 M=/ M=/I M=/ M=/ DJN: DJN: P=P P=P INC DJN: 6JMP

R0, T0' A, UDPTR DP2 DPL DPTR, T0>>C0h UDPTR, A R', T0>>h R5, T0>>h R5, DELA@9 R', DELA@ DPL DP2 DPTR R0, L==P 6TART

DELA@ 5 DELA@ 95

'99>

TABLE5

DB

0K 05 0& 0Ah

PROCEDURE: Ente the a"o+e p o% am sta tin% f om lo#ation '900*an$ e7e#ute the same* The steppe moto otates* /a )in% the #ount at R' an$ R5 #an +a ) the spee$* Ente in% the $ata in the loo4!up TABLE in the e+e se o $e #an +a ) $i e#tion of otation*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K9

ECE DEPARTMENT

MP&MC LAB MANUAL

RESULT: Thus a steppe moto 0as inte fa#e$ 0ith 8059 an$ un in fo 0a $ an$ e+e se $i e#tions at +a ious spee$s*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

KA

ECE DEPARTMENT

MP&MC LAB MANUAL

8059
8051
9* Rea$in% an$ 0 itin% on a pa allel po t*
9* D itin% to a po t pin

6ETB P1*5N set pin 5 of po t 1 M=/ P9, T'A2N sen$in% $ata 'A2 to po t 9 ! the "ina ) patte n on the po t 0ill "e 0900 9090 M=/ PA, AN sen$ 0hate+e $ata is in the a##umulato to po t A
A* Rea$in% a po t pin

6ETB P9*0 N initiali3e pin 0 of po t 9 as an input pin M=/ PA, T>>2 N set all pins of po t A as inputs M=/ C, P9*0 N mo+e +alue on pin 0 of po t 9 to the #a ) M=/ R1, PA N mo+e $ata on po t A into R1 2. Timer in Different Modes The "asi# 8059 has t0o on!#hip time s that #an "e use$ fo timin% $u ations o fo #ountin% e7te nal e+ents Inte +al timin% allo0s the p o% amme to pe fo m ope ations at spe#ifi# instants in time* >o e7ample, in ou LED flashin% p o% am the LED 0as tu ne$ on fo a spe#ifi# len%th of time an$ then tu ne$ off fo a spe#ifi# len%th of time* De a#hie+e$ this th ou%h the use of time $ela)s* 6in#e the mi# o#ont olle ope ates at a spe#ifi# f e-uen#), 0e #oul$ 0o 4 out e7a#tl) ho0 man) ite ations of the time $ela) 0as nee$e$ to %i+e us the $esi e$ $ela)* 2o0e+e , this is #um"e some an$ p one to e o * An$ the e is anothe $isa$+anta%eN the CPU is o##upie$, steppin% th ou%h the loops* If 0e use the on!#hip time s, the CPU #oul$ "e off $oin% somethin% mo e useful 0hile the time s ta4e on the menial tas4 of 4eepin% t a#4 of time*
The Time sV 6>Rs

The 8059 has t0o 9&!"it time s* The hi%h ")te fo time 9 BT29C is at a$$ ess 8D2 0hile the lo0 ")te BTL9C is at 8B2 The hi%h ")te fo time 0 BT20C is at 8C2 0hile the lo0 ")te BTL0C is at 8A2*Both time s #an "e use$ in a num"e of $iffe ent mo$es* The p o% amme sets the time s to a spe#ifi# mo$e ") loa$in% the app op iate 8!"it num"e into the Time Mo$e Re%iste BTM=DC 0hi#h is at a$$ ess 8K2*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K1

ECE DEPARTMENT

MP&MC LAB MANUAL

Time Mo$e Re%iste

The fun#tions of the 8!"its of TM=D a e $es# i"e$ in the a"o+e ta"le* The top fou "its a e fo time 9 an$ the "ottom fou "its ha+e the e7a#t same fun#tion "ut fo time 0* The ?ate "its a e use$ in #onOun#tion 0ith inte upts an$ 0ill "e $ealt 0ith at a late sta%e* >o the moment 0e #an ta4e it that "its 8 an$ 1 a e al0a)s #lea e$* As mentione$ a"o+e, the time s #an "e use$ fo #ountin% e7te nal e+ents o fo timin% inte +als* If )ou 0ish the time to "e an e+ent #ounte )ou set the #o espon$in% CET!"a "it* 6imila l), if )ou 0ish it to "e an inte +al time )ou eset the #o espon$in% CET!"a "it* The e a e t0o mo$e "its BM9 an$ M0C fo ea#h time * The ta"le "elo0 $es# i"es thei fun#tion

The e a e fou time mo$es, set ") the "its M9 an$ M0* Mo$e 0 is not #ommonl) use$* Mo$e 9 ! 9&!"it mo$e

The hi%h ")te BT27C is #as#a$e$ 0ith the lo0 ")te BTL7C to p o$u#e a 9&!"it time * This time #ounts f om 00002 to >>>>2 ! it has A9& B&5,51&C states* An o+e flo0 o##u s $u in% the >>>>2 to 00002 t ansition, settin% the o+e flo0 fla% Bto "e $ealt 0ith sho tl)C*

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K'

ECE DEPARTMENT
Mo$e A! 8!"it auto! eloa$ mo$e

MP&MC LAB MANUAL

The time lo0 ")te BTL7C ope ates as an 8!"it time B#ountin% to >>2C 0hile the hi%h! ")te hol$s a eloa$ +alue* Dhen the time o+e flo0s f om >>2, athe than sta tin% a%ain f om 002, the +alue in T27 is loa$e$ into TL7 an$ the #ount #ontinues f om the e*

A* 6e ial #ommuni#ation implementation


All #ommuni#ation 0e a e $ealin% 0ith #an "e se ial o pa allel* In Pa allel #ommuni#ation, $ata "ein% t ansfe e$ "et0een one lo#ation an$ anothe BR0 to the a##umulato , fo e7ampleC t a+el alon% the 8!"it $ata "us* Be#ause of this $ata "us, $ata ")tes #an "e mo+e$ a"out the mi# o#ont olle at hi%h spee$* 2o0e+e , pa allel #ommuni#ation has the $isa$+anta%e of e-ui in% at least ei%ht sepa ate lines Bin an 8!"it s)stemC an$ in most #ases e7t a lines to s)n#h oni3e the $ata t ansfe Bin the #ase of the mi# o#ont olle , the #ont ol "usC* 6e ial #ommuni#ation has the a$+anta%e of e-ui in% onl) one line fo the $ata, a se#on$ line fo % oun$ an$ possi"l) a thi $ line fo the #lo#4* The efo e, "e#ause se ial #ommuni#ation e-ui es less ph)si#al 0i es, it is mo e suita"le fo t ansmittin% $ata o+e lon%e $istan#es* The o"+ious $isa$+anta%e of se ial #ommuni#ation, #ompa e$ 0ith pa allel, is the e$u#tion in 0e #oul$ sa) it ta4es 9us to t ansfe a $ata ")te usin% pa allel #ommuni#ation* If 0e ima%ine the same timef ame fo $ata "its settlin% on the se ial line, it 0oul$ ta4e 8us to t ansfe a $ata ")te usin% se ial #ommuni#ation B9us fo ea#h "itC* S,%"hr#%#*+ S!ri') C# *%i"'ti#%

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K5

ECE DEPARTMENT

MP&MC LAB MANUAL

6)n#h onous se ial #ommuni#ation e-ui es an e7t a line fo the #lo#4 si%nal* >o se ial #ommuni#ation, the 8!"it pa allel $ata ")te must "e shifte$ $o0n the se ial line Bin t ansmissionC* The efo e, one "it is follo0e$ ") anothe * 6ome 4in$ of s)stem must "e use$ to $ete mine ho0
lon% ea#h "it is on the line* >o e7ample, the se ial s)stem $esi%ne ma) $e#i$e ea#h "it 0ill "e on the line fo 9us an$, as e7plaine$ a"o+e, t ansmission of the full ei%ht "its 0oul$ ta4e 8us* Dith s)n#h onous #ommuni#ation, the #lo#4 si%nal is t ansmitte$ on a sepa ate line, as sho0n in the $ia% am "elo0

In this 0a), the e#ei+e is s)n#h oni3e$ 0ith the t ansmitte * As 0e shall see, the 8059 se ial po t in mo$e 0 is an e7ample of s)n#h onous se ial #ommuni#ation* As)n#h onous 6e ial Communi#ation A %oo$ e7ample of as)n#h onous se ial #ommuni#ation is the inte fa#e "et0een a 4e)"oa $ an$ a #ompute * In this #ase, the 4e)"oa $ is the t ansmitte an$ the #ompute is the e#ei+e * Dith as)n#h onous #ommuni#ation, a #lo#4 si%nal is not sent 0ith the $ata* The e a e a num"e of easons 0h) this fo m of #ommuni#ation mi%ht "e $esi a"le o+e s)n#h onous #ommuni#ation* =ne a$+anta%e is the fa#t that the ph)si#al line fo the #lo#4 is not nee$e$* Also, as)n#h onous #ommuni#ation is "ette o+e lon% $istan#es* If 0e t ) to s)n#h oni3e a emote e#ei+e ") sen$in% the #lo#4 si%nal, $ue to p opa%ation $ela)s an$ inte fe en#e, the +ali$it) of the #lo#4 is

lost*
Anothe eason fo not t ansmittin% the #lo#4 a ises 0hen the $ata ate is e ati#* >o e7ample, $ata ate f om a 4e)"oa $ to a #ompute is $epen$ent upon the t)pist* The use ma) t)pe at a ate of si7t) 0o $s pe minute, "ut at othe times heEshe ma) t)pe a lot less* An$ fo lon% pe io$s the e ma) "e no $ata sent at all* Be#ause of this e ati# $ata ate an as)n#h onous #ommuni#ation s)stem is suita"le* 6e ial Communi#ation P oto#ol In an) #ommuni#ation s)stem, the e#ei+e must 4no0 0hat 4in$ of $ata to e7pe#t an$ at 0hat ate the $ata 0ill a i+e* In "oth s)n#h onous an$ as)n#h onous se ial #ommuni#ation, the e#ei+e nee$s to 4no0 0ith 0hi#h "it the t ansmitte "e%ins* In most s)stems the L6B is the fi st "it t ansmitte$* >o an as)n#h onous s)stem, the num"e of "its t ansmitte$ pe se#on$ must "e 4no0n ") the e#ei+e * 6in#e the #lo#4 si%nal is not t ansmitte$, the e#ei+e nee$s to 4no0 0hat #lo#4 f e-uen#) the t ansmitte is usin% so that it #an use the same* The e#ei+e also nee$s to "ut 0e 0ill see #ases 0he e nine "its a e t ansmitte$ pe 0o $C* An$ the e#ei+e nee$s to 4no0 0he e the $ata "e%ins an$ 0he e the $ata stops* All these pa amete s ma4e up the p oto#ol* If the e#ei+e uses the same p oto#ol as the t ansmitte is shoul$ e#ei+e the $ata #o e#tl) Balthou%h e o s #an o##u an$ 0e 0ill loo4 at ho0 0e #at#h these e o s at a late $ateC* If the e#ei+e uses a p oto#ol othe than the one use$ ") the t ansmitte , then the t0o $e+i#es a e effe#ti+el) spea4in% t0o $iffe ent lan%ua%es an$ the $ata e#ei+e$ 0ill "e %a "a%e* 6ta t Bits an$ 6top Bits In as)n#h onous #ommuni#ation, at least t0o e7t a "its a e t ansmitte$ 0ith the $ata 0o $N a sta t "it an$ a stop "it* The efo e, if the t ansmitte is usin% an 8!"it s)stem, the a#tual num"e of "its The efo e, 0hen no $ata is "ein% sent the $ata line is #ontinuousl) 2I?2* The e#ei+e 0aits fo

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K&

ECE DEPARTMENT

MP&MC LAB MANUAL

a 9 to 0 t ansition* In othe 0o $s, it a0aits a t ansition f om the stop "it Bno $ataC to the sta t "it Blo%i# 0C* =n#e this t ansition o##u s the e#ei+e 4no0s a $ata ")te 0ill follo0* 6in#e it 4no0s the $ata ate B"e#ause it is $efine$ in the p oto#olC it uses the same #lo#4 as f e-uen#) as that use$ ") the t ansmitte an$ ea$s the #o e#t num"e of "its an$ sto es them in a e%iste * >o e7ample, if the p oto#ol $ete mines the 0o $ si3e as ei%ht "its, on#e the e#ei+e sees a sta t "it it ea$s the ne7t ei%ht "its an$ pla#es them in a "uffe * =n#e the $ata 0o $ has "een ea$ the e#ei+e #he#4s to see if the ne7t "it is a stop "it, si%nif)in% the en$ of the $ata* If the ne7t "it is not lo%i# 9 then somethin% 0ent 0 on% 0ith the t ansmission an$ the e#ei+e $umps the $ata* If the stop "it 0as e#ei+e$ the e#ei+e 0aits fo the ne7t $ata 0o $, ieN it 0aits fo a 9 to 0 t ansition The 8059 6e ial Po t The 8059 in#lu$es an on!#hip se ial po t that #an "e p o% amme$ to ope ate in one of fou $iffe ent mo$es an$ at a an%e of f e-uen#ies* In se ial #ommuni#ation the $ata is ate is 4no0n as the "au$ ate, 0hi#h simpl) means the num"e of "its t ansmitte$ pe se#on$* In the se ial po t mo$es that allo0 +a ia"le "au$ ates, this "au$ ate is set ") time 9* The 8059 se ial po t is full $uple7* In othe 0o $s, it #an t ansmit an$ e#ei+e $ata at the same time* The "lo#4 $ia% am a"o+e sho0s ho0 this is a#hie+e$* If )ou loo4 at the memo ) map )ou 0ill noti#e at lo#ation KK2 the se ial "uffe spe#ial fun#tion e%iste B6BU>C* Unli4e an) othe e%iste in the 8059, 6BU> is in fa#t t0o $istin#t e%iste s ; the 0 ite!onl) e%iste an$ the ea$! onl) e%iste * T ansmitte$ $ata is sent out f om the 0 ite!onl) e%iste 0hile e#ei+e$ $ata is sto e$ in the ea$!onl) e%iste * The e a e t0o sepa ate $ata lines, one fo t ansmission BTIDC an$ one fo e#eption BRIDC* The efo e, the se ial po t #an "e t ansmittin% $ata $o0n the TID line 0hile it is at the same time e#ei+in% $ata on the RID line* The TID line is pin 99 of the mi# o#ont olle BP1*9C 0hile the RID line is on pin 90 BP1*0C* The efo e, e7te nal a##ess to the se ial po t is a#hie+e$ ") #onne#tin% to these pins* >o e7ample, if )ou 0ante$ to #onne#t a 4e)"oa $ to the se ial po t )ou 0oul$ #onne#t the t ansmit line of the 4e)"oa $ to pin 90 of the 8059* If )ou 0ante$ to #onne#t a $ispla) to the se ial po t )ou 0oul$ #onne#t the e#ei+e line of the $ispla) to pin 99 of the 8059* This is $etaile$ in the $ia% am "elo0* T ansmittin% an$ Re#ei+in% Data Essentiall), the Oo" of the se ial po t is to #han%e pa allel $ata into se ial $ata fo t ansmission an$ to #han%e e#ei+e$ se ial $ata into pa allel $ata fo use 0ithin the mi# o#ont olle * !6e ial t ansmission is #han%in% pa allel $ata to se ial $ata* ! 6e ial e#eption is #han%in% se ial $ata into pa allel $ata ! Both a e a#hie+e$ th ou%h the use of shift e%iste s* As $is#usse$ ea lie , s)n#h onous #ommuni#ation e-ui es the #lo#4 si%nal to "e sent alon% 0ith the $ata 0hile as)n#h onous #ommuni#ation e-ui es the use of stop "its an$ sta t "its* 2o0e+e , the p o% amme 0ishin% to use the 8059 nee$ not 0o ) a"out su#h thin%s* To t ansmit $ata alon% the se ial line )ou simpl) 0 ite to the se ial "uffe an$ to a##ess $ata e#ei+e$ on the se ial po t )ou simpl) ea$ $ata f om the se ial "uffe * >o e7ample5 !M=/ 6BU>, T'52 ! this sen$s the ")te '52 $o0n the se ial line !M=/ A, 6BU> ! this ta4es 0hate+e $ata 0as e#ei+e$ ") the se ial po t an$ puts it in the a##umulato *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K8

ECE DEPARTMENT

MP&MC LAB MANUAL

2o0 $o 0e 4no0 0hen the #omplete $ata ")te has "een sentH As mentione$ ea lie , it ta4es a #e tain len%th of time fo a $ata ")te to "e t ansmitte$ $o0n the se ial line B$ete mine$ ") the "au$ ateC* If 0e sen$ $ata to 6BU> an$ then imme$iatel) sen$ mo e $ata to 6BU>, as sho0n "elo0, the initial #ha a#te 0ill "e o+e 0 itten "efo e it As mentione$ ea lie , it ta4es a #e tain len%th of time fo a $ata ")te to "e t ansmitte$ $o0n the se ial line B$ete mine$ ") the "au$ ateC* If 0e sen$ $ata to 6BU> an$ then imme$iatel) sen$ mo e $ata to 6BU>, as sho0n "elo0, the initial #ha a#te 0ill "e o+e 0 itten "efo e it As mentione$ ea lie , it ta4es a #e tain len%th of time fo a $ata ")te to "e t ansmitte$ $o0n the se ial line B$ete mine$ ") the "au$ ateC* If 0e sen$ $ata to 6BU> an$ then imme$iatel) sen$ mo e $ata to 6BU>, as sho0n "elo0, the initial #ha a#te 0ill "e o+e 0 itten "efo e it 0as #ompletel) shifte$ $o0n the line* JNB RI, RN 0ait fo an enti e ")te to "e e#ei+e$ CLR RIN the e#ei+e inte upt fla% is set ") ha $0a e "ut must "e #lea e$ ") soft0a e M=/ A, 6BU>N mo+e the $ata sto e$ in the ea$!onl) "uffe to the a##umulato

!M=/ 6BU>, TA12 !M=/ 6BU>, T5&2 The efo e, 0e must 0ait fo the enti e ")te to "e sent "efo e 0e sen$ anothe * The se ial po t #ont ol e%iste B6C=NC #ontains a "it 0hi#h ale ts us to the fa#t that a ")te has "een t ansmitte$N ieN the t ansmit inte upt fla% BTIC is set ") ha $0a e on#e an enti e ")te has "een t ansmitte$ $o0n the line* 6in#e 6C=N is "it!a$$ essa"le 0e #an test this "it an$ 0ait until it is set, as sho0n "elo05 M=/ 6BU>, TA12N sen$ the fi st ")te $o0n the se ial line JNB TI, RN 0ait fo the enti e ")te to "e sent CLR TIN the t ansmit inte upt fla% is set ") ha $0a e "ut must "e #lea e$ ") soft0a e M=/ 6BU>, T5&2N sen$ the se#on$ ")te $o0n the se ial line 2o0 $o 0e 4no0 0hen $ata has "een e#ei+e$H 6imila l), 0e nee$ to 4no0 0hen an enti e ")te has "een e#ei+e$ ") the se ial po t* Anothe "it in 6C=N, the e#ei+e inte upt fla% BRIC is set ") ha $0a e 0hen an enti e ")te is e#ei+e$ ") the se ial po t* The #o$e "elo0 sho0s ho0 )ou 0oul$ p o% am the #ont olle to 0ait fo $ata to "e e#ei+e$ an$ to then mo+e that $ata into the a##umulato *

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

K8

ECE DEPARTMENT

MP&MC LAB MANUAL

6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

KK

You might also like