Upload
soorajss1989
View
256
Download
0
Embed Size (px)
Citation preview
8/10/2019 Microprocessor Ece Lab Manual
1/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
Vi INSTITUTE OF TECHNOLOGY
SIRUNKUNDRAM-60310
D!"#$%&!'% () E*!+%$('i+, #' C(&&.'i+#%i(' E'/i'!!$i'/
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
EC230- MICROPROCESSORS AND MICROCONTROLLERS LAB
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
2/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
E4PERIMENTS IN SYLLABUS
06 PROGRAMING
1. Programs for 16 bit arithmetic Operations2. Programs for Sorting and searching
3. Programs for String Manipulation
4. Programs for Digital clock
INTERFACING E4PERIMENTS
1. nterfacing !D" and D!"
2. nterfacing #ith $2%&'$2(&'$2(3.
3. nterfacing #ith stepper Motor and D" motor
COMMUNICATION BETEEN TO MP KIT
1. Serial "ommunication )et#een *#o MP kit using $2(1.
2. Parallel "ommunication )et#een *#o Mp kit using Mode 1 and mode 2 of $2((.
051 PROGRAMMING
1. Programming using !rithmetic'+ogical'bit Manipulation
2. Programing in *imer'nterrupt',!-*3. "ommunication b# $/(1 and P".
B$#'+ E*!+%$('i+, #' C(&&.'i+#%i(' E'/i'!!$i'/
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
3/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
CONTENTS
Sl.0o Date periment Page
0o
Signature
1
2
3
4
(
6
%
$
&
1/
11
12
13
14
1(
16
1%
1$
E4 NO STUDY OF 06 KIT
DATE
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
4/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
AIM
*o stud about the $/$6 microprocessor kit.
HARDARE SPECIFICATIONS
1 CPU PROCESSOR AND CLOCK FRE8UENCY
ntel $/$6$/$$ "P, at (4.%% M5 clock rate Optionall $ M57
2 MEMORY
MO0*O- P-OM8 9///8//// : 3999 for 16 ;
P-OM
8/10/2019 Microprocessor Ece Lab Manual
5/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
POER SUPPLY SPECIFICATIONS
Model8 SMPS:/1
Mains8 23/ >olts !" at (/ 5
nput8 23/> !" at (/
Output8 1A ( >olts' 3 amps regulated
2A 12 >olts' 2(/ m! regulated
3A : 12 >olts' 2(/ m! regulated
4A 3/ >olts' 2(/ m! unregulated
: PHYSICAL CHARACTERISTICS
M : $6$$ +"D trainer P")8 $3/ mm 6$/ mm
10 BUS E4PANSION
! ne# concept of >
8/10/2019 Microprocessor Ece Lab Manual
6/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
COMMAND LINE EDITOR FEATURES
iA Single line editor can process upto 4/ characters.
ii V#*i ;!< ).'+%i(', #$!
1 ASSEMBLER COMMAND
FUNCTION
*his command is used to enter the mnemonics of $/$6 and it gi@es the opcode for theMnemonics.
SYNTA4
F! G"-H
! : +ine !ssembler "ommand.
PROCEDURE
1. !fter entering the I!I command' the kit is displaed as follo#s
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
7/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
2. *hen' it asks the starting address
0o#' ou entered the user -!M address and programs' for e@er mnemonics for $/$6
entered'
it gi@es the opcode.
2 DIS-ASSEMBLER COMMAND
FUNCTION
*his command gi@es the mnemonics and corresponding opcode in the gi@en address.
SYNTA4
F, G"-H
, : Dis !ssembler "ommand.
PROCEDURE
1. !fter entering the I,I command' the kit is displaed as follo#s.
2. *hen' if ou enter the starting address
3 SUBSTITUTE MEMORY COMMAND
FUNCTION
*his command is used to eamine the contains of selected memor location and modif the
-!M contents if desired.
SYNTA4
iA FS) G!DD-H G"-H
S) : Substitute bte command #ord
G!DD-H : ,ser can enter the address either in segment8
offset form or onl offset form
G"-H : keboard -eturn
iiA FSJ G!DD-H G"-H
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
8/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
SJ : Substitute #ord command #ord.
G!DD-H : !ddress either segment8
Offset or onl.
G"-H : ;eboard return.
PROCEDURE
1A !fter entering a substitute command' the contents of that address are displaed as
9ollo#s.
2A ,se enter to eamine the net location or to increment the memor location and the =--=
ke to @ie# pre@ious locations. ie. to decrement the memor location.
3A *o modif the contents' enter the ne# data and press enter ke.
4A *o terminate this command press a dot BA
9 REGISTER COMMAND
FUNCTION
*o eamine and modif the register contents of the "P,.
SYNTA4
F- G-H
- : -egister @ie# modif command #ord.
PROCEDURE
iA nter register command #hen prompted for entr.
iiA nitiall K!
8/10/2019 Microprocessor Ece Lab Manual
9/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
i@A "hange data to an register if desired and press carriage return
@A *he seLuence is circular and there fore apressing enter ke after the last register order'
Jill again displa the first one.
@iA *o terminater this command press dot B.A
5 GO > E4EC COMMAND
FUNCTION
*he O command us used to -un a program. *his command transfers control of the $/$6!
"P, from the monitor program to user programs.
SYNTA4
F O G!DD-H G"-H
O : O "ommand.
G!DD-H : 16 bit address. either segment 8 offset or offset onlA
G"-H : "arriage return.
PROCEDURE
iA *pe O command #ith address from #here eecution should start.
iiA 0o#' the control is transferred to the address entered b ou and the displa #ill be as
sho#n belo#.
iiiA *o eit from the eecution and to return control to the monitor' press reset ke or
nterrupt ke in the kit.
i@A ) using 0*:2 instruction #ith opcodes "D/1' ou can transfer control to monitor
#ithout sa@ing an registers. "D' /2 should be placed at the end of the program
6 TRACE COMMAND
FUNCTION
*his command helps the user to eecute programs in steps i.e instruction. *his command #illbe @er helpful #hile debugging programs.
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
10/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
SYNTA4
F*- G!ddrH G"-H
*- : *race command #ord.
G!ddrH : Program starting !ddress. Bsegment 8 offset of offset onlA
G"-H : "arriage -eturn.
PROCEDURE
iA nter the *race command #ith the abo@e snta.
iiA 0o# the first instruction is eecuted an the registers are updated.
iiiA *he net instruction to be eecuted and the memor location are displaed.
i@A Since' registers are updated after each indi@idual instruction' ou can @ie# the register
contents after an eecution of indi@idual instruction.
@A Press dot B.A to return to monitor and @ie# registers or memor locations are desired.
@iA "ontinue single stepping after @ie#ing register contents b again eecuting trace
command
7BLOCK MOVE COMMAND
FUNCTION
*his command mo@es the contents of a specified block of memor to another block #hose
starting address is specified to -!M7.SYNTA4
iA FM) GStart !ddrH Gnd !ddrH GDest !ddrH G"-H
M) : )lock mo@e bte command #ord.
GStart !ddrH : )lock starting address.Bsegment 8 offset or offset onlA
Gnd !ddrH : )lock nding !ddress.Boffset onlA
GDest !ddrH : Destination !ddress.Bsegment 8 offset or offset onlA
G"-H : "arriage return.
iiA FM) GStart !ddrH Gnd !ddrH GDest !ddrH G"-H
M) : )lock mo@e #ord command .
GStart !ddrH : )lock starting address.Bsegment 8 offset or offset onlA
Gnd !ddrH : )lock nding !ddress.Boffset onlA
GDest !ddrH : Destination !ddress.Bsegment 8 offset or offset onlA
G"-H : "arriage return.
PROCEDURE
iA nter th )lock Mo@e "ommand #ith the abo@e snta.
iiA 0o#' the data is mo@ed from source block to destination block and the control is
transferred to monitor program.
iiiA !ddress can be monitored in the displa throughout the mo@e block function
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
11/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
INPUT COMMAND
FUNCTION
*his command inputs data from the desired port.SYNTA4
iA F) GPort !ddressH G"-H
) : nput )te command #ord.
GPort !ddrH : >alid nput !ddress. Bi.e //// to 9999A.
G"-H : "arriage return.
iiA FSJ GPort !ddrH G"-H
J : nput #ord command
PROCEDURE
iA nter ) command in the abo@e stated snta.iiA 0o#' the data #ould be read and displaed as sho#n belo#.
:SERIAL MONITOR COMMAND
FUNCTION
,sing these serial monitor command ou can operate our trainer through computer. before
that
ou #ill connect -S232" cable Bproper configurationA to the computer to an one of the
serial
port.
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
12/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
10SERIAL INPUT COMMAND
FUNCTION
*his command inputs data from the $2(1 port of M : $6$$ +"D trainer asnchronousl.SYNTA4
FS GStart !ddrH G"-H
S : Serial input command #ord.
GStart !ddrH : !ddress to store the serial input data.
G"-H : "arriage return.
PROCEDURE
iA nter the serial input command in the abo@e said format.
iiA 0o#' transmit data from the host sstem.BPls refer to I0ote :2I for further discussion
contact D!*! *-!0SMSSO0 9-OM OS* S=S*MSA
iiiA *he M : $6$$ +"D trainer recei@ed data and stores it from the gi@en starting address and
returns to the command prompt on recei@ing the O9 M!-;.B-ef 0ote:2Ai@A ,sing substitute memor command check for the data from the starting address specified.
11SERIAL OUTPUT COMMAND
FUNCTION
*his command outputs data seriall through the $2(1 of the M : $6$$ +"D trainer
asnchronousl.
SYNTA4
FSO GStart !ddrH Gnd !ddrH G"-H
SO : Serial output command #ord.
GStart !ddrH : Start address of the transmit data block.BSegment 8 offset or offset
onlA.
Gnd !ddrH : nd !ddress of the transmit data block Boffset onlA
G"-H : "arriage return.
PROCEDURE
iA nter the serial output command in the abo@e said format.
iiA nsure that the const sstem is set in the recei@e mode.
iiiA 0o#' data #ill be transmitted seriall. M : $6$$ +"D trainer returns to commandprompt after data transmission is o@er.
RESULT
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
13/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
16 BIT ARITHMETIC OPERATION
E4 NO 2
DATE
AIM*o perform 16 bit !rithmetic operation such as addition' subtraction' Multiplication'
di@ision using $/$6 Microprocessor ;it.
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
THEORY
*he KaddK instruction reLuires either the addend or the augend to be in a register'
unless the source operand is immediate since the addressing modes permitted for the source
and destination are register:register' memor:register' register :memor' register:immediate'
and finall memorimmediate. Our obNecti@e is to obtain the sum of t#o numbers in
memor.ence one of the operands is initiall mo@ed to !
8/10/2019 Microprocessor Ece Lab Manual
14/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
FLO CHART
ALGORITHM
BiA 16-@i% #i%i(' et the first number.
!dd the second number to the first number.
Store +S)s of sum.
Store MS)s of sum
PROGRAM FOR ADDITION
M!&($< #$!,, O"+(!, M'!&('i+, C(&&!'%,
MO> ! 12//7' ! D " 12/27' DS)
instruction
ii. *o fill the locations 11// to 1199 in memor #ith the bte 34 using S*OS)
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
THEORY
Since the $/$6 includes the string primiti@es' #hich reLuire initialisation of the inde
registers'the S and D registers are initialised to start of the source and start of the
destination arra respecti@el. *he direction flag is cleared to facilitate auto incrementing of
the inde registers. *he "< register is used to perform the operation repeatedl. *he string
primiti@e used in MO>S. n the case of MO> operation' the status of the direction flag is
ho#e@er immaterial. *he function S*OS #ill store the bte in !+ or the #ord in ! " D'21//
MO> !
8/10/2019 Microprocessor Ece Lab Manual
23/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
E4 NO SORTING AND SEARCHING
DATE
AIM
Jrite an !ssembl +anguage Program to arrange a gi@en series of headecimal btes in
ascending order Jrite an !+P to find out the number of e@en and odd numbers from a gi@en series of 16 bit
headecimal number.
THEORY
*he simplest logic to decide #heather a binar number is e@en or odd is to check the least significant bit
of a number.if it is / 'the number is e@en else it is odd."heck +S) b rotaing the number through carr
flag and ncrement e@en and odd number.
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
ALGORITHM
i S!#$+i'/ E!' #' ( '.&@!$, i' #' #$$# S'12//
MO> !
8/10/2019 Microprocessor Ece Lab Manual
25/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
ASCENDING ORDER DESCENDING ORDER
ASCENDING ORDER OF AN ARRAY
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
S*!-*
0*!+Q PO0*-
"O,0* "O,0* T 1
9+! /
S
PO0*-
PO0*-
1
*MP PO0*-
PO0*- PO0*- 1
PO0*- 1 *MP
PO0*- PO0*- 1
"O,0* "O,0* 1
S
"O,0*
/
S
9+!
/
S*OP
=S
=S
0O
0O
0O
=S
S*!-*
0*!+Q PO0*-
"O,0* "O,0* T 1
9+! /
S
PO0*-
PO0*-
1
*MP PO0*-
PO0*- PO0*- 1
PO0*- 1 *MP
PO0*- PO0*- 1"O,0* "O,0* 1
S
"O,0*
/
S
9+!
/
S*OP
=S
0O
0O
=S
=S
8/10/2019 Microprocessor Ece Lab Manual
26/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
ALGORITHM
ii S($%i'/ i' #,+!'i'/ ($!$
e. +oad the arra count
f. "ompare the numbers and echange if necessar so that the t#o numbers are in
ascending order.
g. Decrement count.
h. et the third number from the arra and repeat the process until count is /.
PROGRAM
M!&($)M) //1 1
THEORY
*he ntel $2%& is responsible for debouncing of the kes' coding of the kepad matri and
refreshing of the displa elements in a Microprocessor based de@elopment sstem. ts main
features are8
1A Simultaneous ;eboard and Displa operation.
2 A3 nput modes such as Scanned ;eboard Mode' Scanned Sensor Mode and Strobed nput
ntr Mode.
3A 2 Output modes such as $ or 16 character multipleed displas' right entr or left entr
displa formats.
4A "lock Prescaler.
(A Programmable Scan *iming.6A 2 ;e lockout or 0:ke -oll:o@er #ith contact debounce.%A !uto ncrement facilit for
eas programming.
1 Di,"*#< M(! S!%." C('%$(* ($-10 H
0 0 0 1 0 0 0 0
0 0 0 D D K K K
DD
//: $)it character displa left entr
/1: 16)it character displa left entr 1/: $)it character displa right entr
11: 16)it character displa right entr
;;;: ;e )oard Mode
///:2;e lockout.
2C*!#$ Di,"*#1-FIFO S%#%., i, +*!#$!
1-C*!#$ #** @i%,
C(&@i'! !))!+% () CD
8/10/2019 Microprocessor Ece Lab Manual
36/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
11 A0-3 B0-3 FF
3 $i%! Di,"*#
8/10/2019 Microprocessor Ece Lab Manual
37/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROGRAM
MEMORY
ADDRESS
OPCODES MNEMONICS COMMENTS
S*!-*8MO>
S'12//
MO> "
8/10/2019 Microprocessor Ece Lab Manual
38/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
LOOK UP TABLE
ADDRESS DATA
SEGMENT DEFINITION
DATA BUS D7 D6 D5 D9 D3 D2 D1 D0
SEGMENTS + @ # " / ) !
PROCEDURE
i. nter the program from location 1///.
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
39/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
ii. "onnect the $2%& interface kit to $/$6 Processor.
iii. ecute the Program
i@. *he name #ill be displaed in the % segment
RESULT
E4 NO INTERFACING ADC ITH 06
DATE
AIM
*o #rite a program to con@ert the anolog into digital @oltage
PROBLEM STATEMENT
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
40/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
*he program is eecuted for @arious @alues of analog @oltage #hich are set #ith the
help of a potentiometer. *he +D displa is @erified #ith the digital @alue that is stored in a
memor location.
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
4 !0O+O *O D*!+
"O0>-*-
>)M) //3 1
THEORY
Microprocessors are Digital logic de@ices that can process onl digital signals that are in
binar form logic le@els Beither / or 1 or / @olts or ( @oltsA' )ut most industrial applications
in@ol@e phsical @ariables such as temperature' pressure etc' #hich are continuousl B@aring
@oltageA #hen con@erted to analog signal b transducers C signal condition' unlike digital
signals ha@ing either a lo# or high state. n most cases #e #ant to control these signals
electronicall. *his automatic control can be achie@ed using a microprocessor. )ut
microprocessor can understand onl digital language. *hen ho# can it control these
parametersV So there should be some translater #ho can translate these analog signals to a
digital form #hich the Microprocessor considers formal. *his is the place #here an !nalog to
Digital "on@erter B!D"A comes into the picture. *hus an !nalog to Digital "on@erter is anelectronic circuit that con@erts the analog or continuous signal to digital or discrete.
HARDARE ADDRESS
ALGORITHM
BiA Select the channel and latch the address.BiiA Send the start con@ersion pulse.
BiiiA -ead O" signal.
Bi@A f O" 1 continue else go to step BiiiA
B@A -ead the digital output.
B@iA Store it in a memor location
FLO CHART FOR ADC
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
S*!-*
S+"* * "!00+ !0D +!*"
!DD-SS
8/10/2019 Microprocessor Ece Lab Manual
41/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROGRAM
MEMORY
ADDRESS
OPCODES MNEMONICS COMMENTS
MO> !+'1/
O,* "$'!+
MO> !+'1$
O,* "$'!+
+*
"hannel selection and !+ lo#
!+ high
*erminate the Program
PROCEDURE
i. nter the program from location 1///.ii. "onnect the !D" interface kit to $/$6 Processor
iii. >ar the analog input using trimpot and gi@e SO" b pressing the s#itch
i@. See the corresponding digital @alue in the led displa
OBSERVATION
ANALOG
VOLTAGE
DIGITAL DATA ON LED
DISPLAY
HE4 CODE IN MEMORY
LOCATION
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
S0D * S*!-* "O0>-SO0 P,+S
-!D * D*!+O,*P,*
S*O- * D*!+ >!+, 0 *
MMO-= +O"!*O0 SP"9D
S O"
1V
S*OP
0O
=S
8/10/2019 Microprocessor Ece Lab Manual
42/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
RESULT
E4 NO INTERFACING DAC ITH 06
DATE
AIM
*o #rite a program to
i. generate sLuare #a@eform in dac2 output
ii. generate />in th D!" 1 output.
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
43/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
4 D*!+ *O !0!+O
"O0>-*-
>)M) //3 1
PROBLEM STATEMENT
*he program is eecuted for @arious digital @alues and eLui@alent analog @oltages are
measured and also the #a@eforms are measured at the output ports using "-O.
ALGORITHM
SLuare Ja@eform8
BiA Send lo# @alue B//A to the D!".
BiiA ntroduce suitable dela.
BiiiA Send high @alue to D!".
Bi@A ntroduce dela.
B@A -epeat the abo@e procedure.
HARDARE ADDRESS
FLOCHART
MEASUREMENT OF ANALOG VOLTAGE S8UARE AVE FORM
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
S*!-*
S0D *
D*!+>!+, *O!"",M,+!*O-
0*!+S * !"",M,+!*O-
S0D !"" "O0*0* *O D!"
S*!-*
D+!=
8/10/2019 Microprocessor Ece Lab Manual
44/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROGRAM TO GENERATE 0 V IN THE DAC1 OUTPUT
MEMORY
ADDRESS
OPCODES MNEMONICS COMMENTS
MO> !+'%9
O,* "/'!+
+*
%9BheA/@
Out the data in D!"1
*erminate the Program
PROCEDURE
i. nter the program from location 1///.ii. "onnect the D!" interface kit to $/$6 Processor
iii. >ie# the /@ output in the "-O
OBSERVATION
DIGITAL DATA ANALOG VOLTAGE
PROGRAM TO GENERATE S8UARE AVE IN DAC2 OUTPUT
MEMORY
ADDRESS
OPCODES MNEMONICS COMMENTS
S*!-*8MO> !+'//
O,* "$'!+
"!++ D+!=
MO> !+'99
+o# data in D!" 2
Dela
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
*-!0S9- *
!"",M,+!*O- "O0*0*S
*O D!"
-!D * "O--SPO0D0
!0!+O >!+,
S*OP
+O!D * !"" J* M!!+, S0D !"" "O0*0*
*O D!"
D+!=
8/10/2019 Microprocessor Ece Lab Manual
45/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
O,* "$'!+
"!++ D+!=
MP S*!-*
D+!=8MO>
D
8/10/2019 Microprocessor Ece Lab Manual
46/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
1. M"-OP-O"SSO- M"-O $6$$ ;* 1
2. POJ- "O-D (> S,P++= 1
3. ;= )O!-D 1
4 S*PP- MO*O- 1 ;g 1
PROBLEM STATEMENT
Jrite a code for achie@ing a specific angle of rotation in a gi@en time and particular
number of rotations in a specific time.
THEORY
Stepper motor control is a @er popular application of microprocessor in control area. *he
are #idel used in Bsimple position control sstems in the open and closed loop modeA a
@ariet ofapplications such as computer peripherals Bprinters' disk dri@er etc.A and in the areas
of processcontrol machine tools' medicine' numericall controlled machines and -obotics.
ALGORITHM
9or running stepper motor clock#ise and anticlock#ise directions
BiA et the first data from the lookup table.
BiiA nitiali5e the counter and mo@e data into accumulator.BiiiA Dri@e the stepper motor circuitr and introduce dela
Bi@A Decrement the counter is not 5ero repeat from stepBiiiA
B@A -epeat the abo@e procedure both for back#ard and for#ard directions
HARDARE ADDRESS
FLOCHART
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
0*!+Q "O,0*- 9O- +OO; ,P *!)+
* * 9-S* D!*! 9-OM * !"",M,+!*O-
MO> D!*! 0*O * !"",M,+!*O-
S*!-*
8/10/2019 Microprocessor Ece Lab Manual
47/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROGRAM
MEMORY
ADDRESS
OPCODES MNEMONICS COMMENTS
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
D-> * MO*O-
"-",*!-=
D"-M0* "O,0*-
* * D!*! 9-OM +OO; ,P*!)+
S ) / V
D+!=
0O
8/10/2019 Microprocessor Ece Lab Manual
48/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
S*!-*8MO> !+'/&
O,* "/'!+
"!++ D+!=
MO> !+'/(
O,* "/'!+
"!++ D+!=MO> !+'/6
O,* "/'!+
"!++ D+!=
MO> !+'/!
O,* "/'!+
"!++ D+!=
MP S*!-*
D+!=8MO>
D
8/10/2019 Microprocessor Ece Lab Manual
49/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
Jrite an !ssembl +anguage Program to control the speed of the motor
Jrite an !+P to read the count @alue from the timer
THEORY
*his board uses a simple method for measurement and control of the D" motor speed. *his
board uses the principle that the speed of an motor decreases as the input po#er to the motordecreases. ence' b @aring the input @oltage to the motor' the speed can be @aried. *he
speed measurement is based on the principle that the motor rotation is con@erted in to pulses
using optical pickup and these pulses are used to decremented a counter for a kno#n time.
*his count @alue can be calibrated to -PM Brotation per minuteA' #hich is the standard
unit for speed measurement.
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
4. D" MO*O- >)M) 1% 1
SOFARE SPECIFICATION
M!SM SO9*J!-
HARDARE ADDRESS
PROGRAM
T( +('%$(* %! ,"!! () DC &(%($
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
50/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
M!&($ !+'//
O,* /D$'!+
"!++ D+!=
MO> !+'3/
O,* /"'!+
MO> !+'/99
O,* /"$'!+O,* /"$'!+
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
51/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
MO> !+'//
O,* /D/'!+
"!++ D+!=
MO> !+'//
O,* /D$'!+
0 !+'/"$MO> S'1(//h
MO> S7'!+
MO> !+'//
0" S
MO> S7'!+
+*
PROCEDURE
1.nter the mnemonics in the kit b do#n loading using M!SM tool.
2.+oad maimum @alue 99 to !ccumulator
3.ecute the Program
4.*he count @alue #ill be stored in the location 1(//.
OBSERVATION
RESULT
E4 NO 25: INTERFACING
DATE
OBECTIVE
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
52/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
*o initiali5e the $2(& #ith the follo#ing specification
W "J 4 needed.
W Single $2(&.
W nter@al of 4.
W dge triggered mode.
W !% !6 !( ///.W nitiali5e to tpe $ interrupt.
W $/$6 mode.
W 0ormal O.
W 0on:buffered mode BSince #e are not using buffersA.
W 0ot special full:nested mode.
W Mask all interrupts ecept - /.
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
4. $2(& 0*-9!"0 >)M) /% 1
THEORY*he program initiali5esthe $2(& to tpe $. So the interrupt @ector for interrupt -O is
////8 //2/ So at ////8//2/' enter the address////8 12// f the S- is at /812//
n the S-' non specific O command is gi@en. n full nested mode' the interrupt reLuests
are ordered in priorit from / through % B/ highestA. )ut in some applications there are a
number of interrupting de@ices of eLual priorit. n this mode' a de@ice after being ser@iced
recei@es the lo#est priorit' *his is kno#n as -otating priorit
PROGRAM
M!&($ !+'2/
O,* "/'!+
0* 2
INTERRUPT VECTOR
////8 //2/ //
////8 //21 12
////8 //22 //
////8 //23 //
OBSERVATION
RESULT
E4 NO 253 INTERFACING
DATE
OBECTIVE
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
54/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
*o stud the @arious modes in $2(3.
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
4. $2(3 0*-9!"0 >)M) /4 1
THEORY
MODE 0 - INTERRUPT ON TERMINAL COUNT
*he output #ill be initiall lo# after mode set operation. !fter loading the counter' the
output #ill remain lo# #hile counting and on terminal count' the output #ill become high'
MODE 1 - PROGRAMMABLE ONE-SHOT
!fter loading the counter' the output #ill remain lo# follo#ing the rising edge of the gate
input. *he output #ill go high on the terminal count. t is re:triggerable' hence the output #ill
remain lo# for the full count after an rising edge of the gate input.
MODE 2 - RATE GENERATOR
t is a simple di@ide b 0 counter. *he output #ill be lo# for one period of the input clock.*he period from one output pulse to the net eLuals the number of input counts in the count
register. f the count register is reloaded bet#een output pulses the present period #ill not be
affected' but the subseLuent period #ill reflect the ne# @alue.
MODE 3 - S8UARE AVE GENERATOR
t is similar to Mode 2 ecept that the output #ill remain high until one half of count and go
lo# for the other half for e@en number count. f the count is odd' the output #ill be high for
Bcount1A2 counts and lo# for Bcount:1A2 counts. *his mode is used for generating baud
rate for $2(1
MODE 9 - SOFTARE TRIGGERED STROBE
*he output is high after mode is set and also during counting. On terminal count' the output
#ill go lo# for one clock period and becomes high again. *his mode can be used forinterrupt generation.
MODE 5 - HARDARE TRIGGERED STROBE
"ounter starts counting after rising edge of trigger input and output goes lo# for one clock
period #hen terminal count is reached. *he counter is re:triggerable.
PROGRAM
MODE 0 - INTERRUPT ON TERMINAL COUNT
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
55/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
M!&($ !+'%4
O,* "'!+MO> !+'/!
O,* "!'!+
MO> !+'//
O,* "!'!+
+*
NOTE8 Please make sure that "+; 1 is connected to P"+;. n a "-O obser@e the
input clock to channel 1 and the output O,* 1.
MODE 3 - S8UARE AVE GENERATOR
M!&($ S,P++= 1
3. ;= )O!-D 1
4. &:& cable -S232 1
SOFARE SPECIFICATION
M!SM SO9*J!-
THEORY
*he $2(1 is used as a peripheral de@ice for serial communication and is
programmed b the "P, to operate using @irtuall an serial data transmission techniLue.
*he ,S!-* accepts data characters from the "P, in parallel format and then con@erts them
into a continuous serial data stream for transmission. Simultaneousl' it can recei@e serial
data streams and con@ert them into parallel data characters for the "P,. *he "P, can read
the status of the ,S!-* at an time. *hese include data transmission errors and control
signals. *he control signals define the complete functional definition of the $2(1. "ontrol
#ords should be #ritten into the control register of $2(1.*hese control #ords are split intot#o formats8 1A Mode instruction #ord C 2A "ommand instruction #ord. Status #ord format
is used to eamine the error during functional operation.
1...transmit enable
1...data terminal read
1... recei@e enable
1... send break character
1.... reset error flags Bpe'oe'feA
1..... reLuest to send BrtsA
1...... internal reset
1....... enter hunt mode Benable search for snc charactersA
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
62/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
1 ransmitter read
1. recei@er read
1.. transmitter empt
1... parit error BpeA
1.... o@errun error BoeA 1..... framing error BfeA' asnc onl
1...... snc detect' snc onl
1....... data set read BdsrA
ALGORITHM
1. nitiali5e $2(3 and $2(1 to check the transmission and reception of a character
2. nitiali5e$2(3 to gi@e an output of 1(/;h5 at channel / #hich #ill gi@e a &6// baud rate
of $2(1.
3. *he command #ord and mode #ord is #ritten to the $2(1 to set up for subseLuentoperations
4. *he status #ord is read from the $2(1 on completion of a serial O operation' or #hen
the host "P, is checking the status of the de@ice before starting the net O operation
FLO CHART
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
S*!-*
8/10/2019 Microprocessor Ece Lab Manual
63/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROGRAM FOR TRANSMITTER "OD SM0*
!SS,M "S8"OD'DS8"OD
O- 1///
MO> S'1(//
MO> !+'36
O,* 16'!+
MO> !+'4/
O,* 1/'!+
MO> !+'/1
O,* 1/'!+
-+O!D8 MO> "+'/(
"";8 0 !+'/!
!0D !+'/4
Q "";
MO> !+'S7
O,* /$'!+
0" S
"MP !+'39
0Q -+O!D
D" "+
0Q ""; 0* /2
"OD 0DS
0D
PROGRAM FOR RECEIVER
"OD SM0*
!SS,M "S8"OD'DS8"OD
O- 1/// MO> S'1(//
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
"heck *
8/10/2019 Microprocessor Ece Lab Manual
64/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
MO> !+'36
O,* 16'!+
MO> !+'4/
O,* 1/'!+
MO> !+'/1
O,* 1/'!+-+O!D8 MO> "+'/(
"";8 0 !+'/!
!0D !+'/2
Q "";
0 !+'/$
MO> S7'!+
0" S
"MP !+'39
0Q -+O!D
D" "+
0Q ""; 0* /2
0* /2
"OD 0DS
0D
PROCEDURE
1. nter the transmitter program in one kit and recei@er program in another kit
2. "onnect -S232 cable b# t#o kit
3. 0o# the data #ill be recei@ed seriall to the recei@er kit in the location 1(//.
RESULT
E4 NO PARALLEL COMMUNICATION
DATE
OBECTIVE*o implement parallel communication bet#een t#o kit
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
65/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
4. 26 core cable 1
SOFARE SPECIFICATION
M!SM SO9*J!-
PROGRAM FOR TRANSMITER SIDE
code segment
assume cs8code'ds8 code
org 1///h
mo@ al'$2h
O,* 26h'al
mo@ al'3fh
O,* 2/h'a+
loop8 in al'22h sub al'3fh
Nn5 loop
mo@ al'24h
out 2/h'al
call dela
int /2
dela8 mo@ bl'/(h
lion8 mo@ dl'/ffh
l28 dec dl
Nn5 l2
dec bl
Nn5 lion
ret
code ends
end
RECEIVER SIDE
code segment
assume cs8code'ds8code
org 1///h
mo@ al'&/h out 26h'al
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
66/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
check8 in al'2/h
sub al'3fh
Nn5 check
mo@ al'3fh
out 22h'al
mo@ cl'/$h call dela
mo@ si'12//h
l18 in al'2/h
mo@ si7'al
call dela
inc si
dec cl
Nn5 l1
int /2
dela8 mo@ bl'/(h
lion8 mo@ dl'/ffhl28 dec dl
Nn5 l2
dec bl
Nn5 lion
ret
ret
code ends
end
PROCEDURE
1. nter the transmitter program in one kit and recei@er program in another kit
2. "onnect 26 core cable b# t#o kit
3. 0o# the data #ill be recei@ed parallel on the recei@er kit in the location 12//.
RESULT
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
67/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
68/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
E4 NO ARITHMETIC LOGICAL AND BIT MANIPULATION
DATE
OBECTIVE
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
69/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
*o perform !rithmetic operation'logical operation and bit manipulation using $/(1 controller
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% S,P++= 1
3. ;= )O!-D 1
THEORY
!s there is onl one 16:bit -egister in $&"(1' 16:bit addition is performed b using !DD"instruction t#ice' i.e. adding +SD first and MSD net. *he oneIs complement of a number is
obtained b in@erting all the bits in that number ' that isreplacing all 1Is b /Is and all /Is b
1Is. *he t#oIs complement is the negati@e of that number.Setting bits can be done b O-ing
that particular bit b 1.
E4AMPLE
*he program is to add the 16:bit data 1234 #ith the data (6%$ and store the result at the
locations
41(/ and 41(1 using immediate addressing.
-S,+*8 41(/7 !" B+S)AU
41(17 6$ BMS)A.
D!*!+1 : 34U D!*!+2 %$.
D!*!M1 : 12U D!*!M2 (6.
D!*!M1 : MSD O9 D!*!1'
D!*!M2 : MSD O9 D!*!2'
D!*!+1 : +SD O9 D!*!1'
D!*!+2 : +SD O9 D!*!2
ALGORITHM
1. "lear Program Status Jord
2. +oad accumulator ! #ith an desired $:bit data.
3. +oad the register -/#ith the second $: bit data.
4. !dd these t#o $:bit numbers.
(. Store the result.
FLO CHART
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
70/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROGRAM FOR ADDITION
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
71/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
M!&($< XDP*-'!
0" DP*-
MO> !'FD!*!M1
!DD" !'FD!*!M2
MO>< XDP*-'!
+*8 SMP +*
RESULT
OUTPUT
MEMORY LOCATION DATA
9500
PROCEDURE
iA nter the abo@e opcodes from 41// in the trainer.iiA ecute the program.
iiiA "heck for the result at 41(/ !0D 41(1
i@A "hange data and see if the result at 41(/ changes accordingl.
PROGRAM FOR ONES COMPLEMENT
M!&($ DP*-'F42//
MO>< XDP*-'!
0" !
0" DP*-
MO>< XDP*-'!
-8 SMP -
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
72/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
PROCEDURE
i. nter the opcodes and the data in the trainer.
ii. ecute the program and check for results.
iii "hange data and check for the corresponding results.
PROGRAM FOR SETTING BIT
M!&($ S,P++= 1
3. ;= )O!-D 1
4. & *O & "!)+ -S232 1
PROCEDURE
1 *pe sm in the controller kit.
2 0o# open the communication port.
3 *hen it is read to communicate #ith kit to P"
9 9or ample if ou tpe in the communication #indo# the help command #ill be
displaed in the P"
RESULT
E4 NO TIMER IN 051
DATE
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
74/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
OBECTIVE
Jrite a program to generate sLuare #a@e using timer in P1./
APPARATUS RE8UIRED
S'( R!?.i$! C(&"('!'%, ,"!+i)i+#%i(' 8% *1'F:6
MO> S"O0'F(/
S*) *-1
8MO> S),9'[F!Z
80) *'
"+- *
SMMP
DEPT OF ECE Vi INSTITUTE OF TECHNOLOGY A UNIT OF Vi MICROSYSTEMS PVT LTD
8/10/2019 Microprocessor Ece Lab Manual
80/80
EC2257- MICROPROCESSOR AND MICROCONTROLLER LAB
RESULT