CS6412-Microprocessor And Microcontroller Laboratory









Microprocessors and Microcontrollers lab LIST OF EXPERIMENTS S

29 janv. 2020 (d) Division of 2 - 8 bit numbers using microcontroller 8051 ... an assembly language program for 16 bit division in 8085 microprocessor.
MPMC lab manual


TSCR8051 8051 RISC Microcontroller High-Speed 8051

8 juin 2010 priority levels o 15-bit programmable watchdog timer o Core 8-bit arithmetic logic unit and 16-bit multiplication division unit.
tscr


Cast C8051 Core Data Sheet

8-bit Arithmetic-Logic Unit with. 8-bit multiplication and division. Instruction decoder. C8051. Four 8-bit Input / Output ports. Two 16-bit Timer/Counters.
cast c


SEMESTER -VI EC334 MICROCONTROLLER LAB

Addition / subtraction / multiplication / division of 8/16 bit data. 8051 microcontroller has an internal program of 4K size and if needed an external.
EC Microcontrollers Lab manual final





Programs for 16 bit arithmetic operations of 8086 (using various

D. WORD BY BYTE DIVISION. AX= 390F & SI=0003 ; D 0000 0004 44 04 45 0F 39. PROGRAMS (using indirect register addressing mode):. E. 16 BIT ADDITION.
mp and mc lab manual eee


Exp No.1: Programs for 16 bit arithmetic operations for 8086

d) Division: I) 16 bit division: AIM: - To write an assembly language program for multiplication of two 16-bit numbers. APPARATUS: 1. 8086 microprocessor 
mpmc ECE manual


MICROCONTROLLERS LAB – 18ECL47 MANUAL

MICROCONTROLLER LAB MANUAL. (18ECL47) 1.3 LARGEST/SMALLEST ELEMENT IN AN ARRAY USING 8051 . ... 3 WRITE AN ALP TO PERFORM DIVISION (16-bit by 16-bit) .
mc


Digital Core DP8051XP Data Sheet

DP8051XP. Pipelined High Performance. 8-bit Microcontroller ver 3.10. OVERVIEW data and program buses are separated and ... Division - 16bit / 16bit.
dp xp ds





CS6412-Microprocessor And Microcontroller Laboratory

A/D and D/A interface and Waveform Generation 8051. Experiments using kits and MASM To write an assembly language program to perform division two 16 bit.
CS MICROPROCESSOR AND MICROCONTROLLER LABORATORY


CS6412-Microprocessor And Microcontroller Laboratory

A/D and D/A interface and Waveform Generation 8051. Experiments using kits and MASM To write an assembly language program to perform division two 16 bit.
CS MICROPROCESSOR AND MICROCONTROLLER LABORATORY


213085 CS6412-Microprocessor And Microcontroller Laboratory

Dharmapuri-636 703ICAL EN

LAB MANUAL

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY2 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ANNA UNIVERSITY CHENNAIRegulation 2013CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORYSYLLABUSLIST OF EXPERIMENTS:8086 Programs using kits and MASM1.Basic arithmetic andLogical operations2.Move a data block without overlap3.Code conversion, decimal arithmetic and Matrix operations.4.Floating point operations, string manipulations, sorting and searching5.Password checking, Print RAM size and system date6.Counters and Time DelayPeripherals and Interfacing Experiments7.Traffic light control8.Stepper motor control9.Digital clock10.Key board and Display11.Printer status12.Serial interface and Parallel interface13.A/D and D/A interface and Waveform Generation 8051.Experiments usingkits and MASM14. Basic arithmetic and Logical operations15. Square and Cube program, Find 2"s complement of a number16. Unpacked BCD to ASCIITOTAL: 45 PERIODS

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY3 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INTRODUCTION TO MICROPROCESSORS& MICROCONTROLLERS:Microprocessor and controller is digital and programmable device with highlyreliable and secured modern architecture. Building blocks of the Digital computerCPU functions Memory types Input / Output Devices Stored programconcept Historyof Microprocessors.Intel 8085 microprocessor:Internal architecture, Hardware description, Interrupts and interrupts servicingand Interfacing the memory. Assembly Language Programming: 8085-Addressingmodes & Instruction set,Flow charts, Assembly language programming andassembler directives, Linker and its operation, Programming examples.Interfacing the input / output devices:8255 Programmable Peripheral Interface, i8253 Programmable Interval Timer,8251 Universal Synchronous /Asynchronous Receiver Transmitter, 8259Programmable Interrupt Controller and i8279 Programmable Keyboard / Displayinterface device.Interfacing the data converters:Digital-to-Analog Converters, Interfacing DAC with 8086microprocessor,Analog-to-Digital ConvertersInterfacing ADC with 8086.Microprocessors:Intel 8086 family microprocessors, Programming model, Memory paging,Virtual memory concept, advanced features of 80386/486/Pentium Processors.Microcontroller:Introduction to Microcontrollers, Intel-8051: Architecture, Hardwaredescription, Memory organization, Addressing Modes.Programming the i8051:Instruction set, Assembly language programming, Interrupt structure andinterrupt priorities, Interfacing with external devices and Programming.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY4 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INDEXEX.NODATENAME OF THE EXPERIMENTSTAFFSIGNREMARKS1BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086 MICROPROCESSOR16 BIT ADDITION2BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086MICROPROCESSOR16 BIT SUBTRACTION3BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086 MICROPROCESSOR16 BITMULTIPLICATION4BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086 MICROPROCESSOR16 BIT DIVISION:5MOVE A DATA BLOCK WITHOUT OVERLAP6CODE CONVERSION, DECIMAL ARITHMETICAND MATRIX OPERATIONS.CODECONVERSIONS-DECIMAL TOHEXADECIMAL7CODE CONVERSION-HEXADECIMAL TO DECIMAL8FLOATING POINT OPERATIONS-STRING MANIPULATIONS,SORTING ANDSEARCHING,COPYING A STRING9ASCENDING & DESCENDING10LARGEST& SMALLEST11PASSWORD CHECKING, PRINT RAM SIZE ANDSYSTEM12COUNTERS AND TIME DELAY13TRAFFIC LIGHT CONTROL14STEPPER MOTOR INTERFACING15DIGITAL CLOCK

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY5 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NODATENAME OF THE EXPERIMENTSTAFFSIGNREMARKS16INTERFACING PRGRAMMABLEKEYBOARD ANDDISPLAY CONTROLLER-827917PRINTER STATUS18A/D AND D/A INTERFACE AND WAVEFORMGENERATION-ADC19INTERFACING DIGITAL-TO-ANALOGCONVERTE20BASIC ARITHMETIC AND LOGICALOPERATIONS 8 BIT ADDITION8 BIT SUBTRACTION8 BIT MULTIPLICATION8 BIT DIVISIONSQUARE AND CUBE PROGRAM, FIND 2"SCOMPLEMENT OF A NUMBERUNPACKED BCD TO ASCII

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY6 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO:01DATE:BASIC ARITHMETIC AND LOGICAL OPERATIONS USING 8086MICROPROCESSOR-16 BIT ADDITIONAIM:To write an assembly language program to performaddition two 16 bit numbersby an 8 bit number using 8086.S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1Get the first number is specificaddress.Add the second number to the first number.Add the two values.Store the sum and carry.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY7 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY8 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV CX,0000HInitialize counter CXMOVAX,[1200]Get the first data in AXregister.MOV BX, [1202]Get the second data in BXregister.ADD AX,BXAdd the contents of boththe registerAX & BXJNC L1Check for carryINC CXIf carry exists, incrementthe CXL1 : MOV[1206],CXStore the carryMOV [1204], AXStore the sumHLTStop the programThusassembly languageprograms to perform addition two 16 bit numbers by an 8bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY9 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

16 BIT SUBTRACTIONsubtractionS.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1SUBTRACTION:Initialize the MSBs of difference to 0Get the first numberSubtract the second number from the first number.If thereis any borrow, increment MSBs of difference by 1.Store LSBs of difference.Store MSBs of difference.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY10 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

SUBTRACTION:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY11 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

SUBTRACTION:MOV CX,0000HInitialize counter CXMOV AX,[1300]Get the first data in AXregisterMOV BX, [1302]Get the second data in BXregister.SUB AX,BXSubtract the contents of boththe registerAX & BXJNC ACheck the Borrow.INC CXIf carry exists, increment theCXMOV [1306],CXStore the Borrow.MOV [1304], AXStore the difference.HLTStop the programThusassembly language programs toperformsubtractiontwo 16 bitnumbers by an 8 bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY12 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO:03DATE:BASIC ARITHMETIC AND LOGICAL OPERATIONS USING8086 MICROPROCESSOR-16 BIT MULTIPLICATIONAIM:To write an assembly language program to performMultiplicationtwo 16 bitnumbers by an 8 bit number using 8086.APPARATUSREQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1ALGORITHM:16-bitMULTIPLICATIONMultiplication of 16-bit numbers:Get the multiplier.Get the multiplicandInitialize the productto 0.Product = product + multiplicandDecrement the multiplier by 1.If multiplicand is not equal to 0, repeat from step (d) otherwise store theproduct.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY13 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MULTIPLICATION:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY14 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MULTIPLICATION:MOV AX,1234HGet the first data in AXregister.MOV BX,[1300]Get the second data in BXregister.MUL BXMultiply AX & BX dataINT 3Break point.MULTIPLICATION OUTPUT:INPUTOUTPUT

RESULT:Thusassembly language programs to performmultiplicationtwo 16 bitnumbers by an 8 bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY15 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 04DATE:BASIC ARITHMETIC AND LOGICAL OPERATIONS USING8086MICROPROCESSOR-16BIT DIVISION:AIM:To write an assembly language program to performdivisiontwo 16 bitnumbers by an 8 bit number using 8086.APPARATUSREQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIT8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1ALGORITHM:16-bitdivisionDivision of 16-bit numbers:Get thedividend and divisor.Initialize the quotient to 0.Dividend = dividend-divisorIf the divisor is greater, store the quotientGo to step 3If dividend is greater, quotient = quotient+ repeat from step 4.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY16 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

DIVISION:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY17 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

DIVISION:MOV AX,[1200]Get the first data in AXregister,MOVDX,[1202]Get the second data inDXregister.MOV BX,[1204]MOV [1206],AXDIV DXDivide the dividend bydivisorMOV AX,BXCopy the lower order dataMOV [1208],AXStore the higher order data.INT 3Stop the program.OUTPUT FOR DIVISION:INPUTAX=DX=OUTPUTAX=DX=RESULT:Thusassembly language programs to performdivisiontwo 16 bit numbers byan 8 bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY18 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 05DATE:MOVE A DATA BLOCK WITHOUT OVERLAPAIM:To move adata block without overlapAPPARATUS REQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1ALGORITHM:Initialize the memory location to the data pointer.Increment B register.Increment accumulator by 1 and adjust it to decimal every time.Compare the given decimal number with accumulator value.When both match, the equivalent hexadecimal value is in B register.Store the resultant in memory location.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY19 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV CL, 05Get the Data rangeMOV SI, 1400Get the first data.MOV DI, 1450Get the second data.LD DSBStore the lower orderproductMOV [DI], ALStore the resultINC DIIncrementthe pointer.DEC 1008Counter 0INT 3Break pointOUTPUT:INPUTOUTPUT1400145014011451140214521403145314041454

RESULT:Thus the output for the Move a data block without overlap was executedsuccessfully. CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY20 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 06DATE:CODE CONVERSION, DECIMAL ARITHMETICAND MATRIX OPERATIONS.Code Conversions-Decimal toHexadecimal:AIM:To convert a given decimal number to hexadecimal.ALGORITHM:Initialize the memory location to the data pointer.Increment Bregister.Increment accumulator by 1 and adjust it to decimal every time.Compare the given decimal number with accumulator value.When both match, the equivalent hexadecimal value is in B register.Store the resultant in memory location.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY21 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOWCHART:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY22 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM:ADDRESSOPCODELABELMNEMONICSCOMMENDS1000MOV AL, [1100]Move data block AL1003MOV AH, ALMove data lower to higher1005MOV AH, OFMove data OF into AH1008MOV BL, AHMove data BL intoAH100AAND AL, FOAND the data AL to FO100CMOV CL, 04Move data 04 to CLblock100EROR AL, CLRotate functions CL and AL1010MOV BH, OAMove data OA into BH1012MUL BHMultiply BH1014ADD AL, BLADD the data AL And BL1016MOV[2000], ALMove the store data1019INT-3Halt programTOHEXADECIMAL]DATAADRESSDATAINPUTOUTPUTRESULT:Thus the output for thecode conversions-decimal to hexwas executedsuccessfully.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY23 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO:07DATE:CODE CONVERSION-HEXADECIMAL TO DECIMALAIM:To convert a given hexadecimal number to decimal.ALGORITHM:Initialize the memory location to the data pointer.Increment B register.Increment accumulator by 1 and adjust it to decimal every time.Comparethe given hexadecimal number with B register value.When both match, the equivalent decimal value is in A register.Store the resultant in memory location.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY24 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM;ADDRESSOPCODELABELMNEMONICSCOMMENTS1000MOV AL,[1100]Move date to AL REG1003MOV DX, ALMove data AL TO DX1006HUNDMOV AL, 64Move data to AX REG1008JC TENJump carry100ASUB AL, 64Subtract data100CINC DLIncrement DL100EJUP HUNDJUMP label data1010TENCMP AL, OACompare register1012JC UNITJump carry1014SUB AL,OASubtract data1016INC DHIncrement DH1018JC TENJUMP carry101AUNITMOV [200],DLMove data to DL101EMOV [200],DHMove data to DH1022MOV [200],ALMove data to AL1025MOV[200],AHMove data to AH1027HLTStop the program

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY25 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

OUTPUT:[HEXADECIMAL NUMBER TO DECIMAL]:

RESULT:Thus the output for the additioncode conversions-decimal to hexwasexecuted successfully.

INPUTOUTPUTMEMORYDATA

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY26 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO: 08DATE:FLOATING POINT OPERATIONS-STRING MANIPULATIONS,SORTING AND SEARCHINGCopyingaString:AIM:To move a string of length FF from source to destination.ALGORITHM:Initialize the data segment .(DS)Initialize the extra data segment .(ES)Initialize the start of string in the DS. (SI)Initialize the start of string in the ES. (DI)Move the length of the string (FF) in CX register.Move the byte from DS TO ES, till CX=0.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY27 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY28 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM:1000MOV SI,1200HInitialize destination address1003MOV DI,1300HInitialize starting address.1006MOV CX,0006HInitialize array size1008CLDClear direction flag100AREP MOVSBCopy the contents ofsource intodestination until count reaches zero100CHLTStopOUTPUT : [COPYING A STRING]:INPUTOUTPUT1400145014011451140214521403145314041454

RESULT:Thus a string of a particular length is moved from sourcesegment todestination segment. CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY29 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 09DATE:ASCENDING & DESCENDINGAIM:To write an Assembly LanguageProgram(ALP)tosort a given array inascending and descending order.APPARATUS REQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1PROBLEM STATEMENT:An array of length 10 is given from the location. Sort it into descending andascending order and store the result.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY30 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Load the array count in two registers C1and C2.Get the first two numbers.Compare the numbers and exchange if necessary so that the two numbers are inascending order.Decrement C2.Get the third number from thearray and repeat the process until C2is 0.Decrement C1and repeat the process until C1is 0.Sorting in descending order:Load the array count in two registers C1and C2.Get the first two numbers.Compare the numbers and exchange if necessary so thatthe two numbers are indescending order.Decrement C2.Get the third number from the array and repeat the process until C2is 0.Decrement C1and repeat the process until C1is 0.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY31 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:[ASCENDING]:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY32 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOWCHART:[DECENDING]:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY33 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

1000MOV SI,1200HInitialize memory location forarray size1002MOV CL,[SI]Number of comparisons in CL1004L4 : MOVSI,1200HInitialize memory location forarray size1006MOV DL,[SI]Get thecount in DL1007INC SIGo to next memory location1009MOV AL,[SI]Get the first data in AL100BL3 : INC SIGo to next memory location100EMOV BL,[SI]Get the second data in BL1010CMP AL,BLCompare two data"s1012JNB L1If AL < BL go toL11014DEC SIElse, Decrement the memorylocation1016MOV [SI],ALStore the smallest data1018MOV AL,BLGet the next data AL1019JMP L2Jump to L2101AL1 : DEC SIDecrement the memory location101CMOV [SI],BLStore the greatest data inmemorylocation101EL2 : INC SIGo to next memory location1020DEC DLDecrement the count1022JNZ L3Jump to L3, if the count is notreached1024MOV [SI],ALStore data in memory location1026DEC CLDecrement the count1028JNZ L4Jump toL4, if the count is notreachedzero1029HLTStop

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY34 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

1000MOV SI,1200HInitialize memory locationfor array size1002MOV CL,[SI]Number of comparisons inCL1004L4 :MOVSI,1200HInitialize memory locationfor array size1006MOV DL,[SI]Get the count in DL1007INC SIGo to next memorylocation1009MOV AL,[SI]Get the first data in AL100BL3 : INC SIGo to next memorylocation

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY35 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

OUTPUT FOR ASCENDING:

RESULT:Thus given array of numbers are sorted in ascending & descending order.

DATAINPUTOUTPUTDATAINPUTOUTPUT

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY36 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 10DATE :LARGEST& SMALLESTAIM:To write an Assembly Language Program(ALP) to find the largest andsmallest number in a given array.APPARATUS REQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWERSUPPLY+ 5 V DC13.KEY BOARD-1PROBLEM STATEMENT:An arrayoflength5is given from the location. Find the largest and smallestnumber and store the result.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY37 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ALGORITHM:(i)Finding largest number:Load the array count in a register C1.Getthe first two numbers.Compare the numbers and exchange if the number is small.Get the third number from the array and repeat the process until C1is 0.(ii)Finding smallest number:Load the array count in a register C1.Get the first two numbers.Comparethe numbers and exchange if the number is large.Get the third number from the array and repeat the process until C1 is 0.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY38 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:[LARGEST]

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY39 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:[SMALLEST]

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY40 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM FOR FINDING LARGEST NUMBER:ADDRESSOPCODESPROGRAMCOMMENDS1000MOV SI,1200HInitialize array size1002MOV CL,[SI]Initialize the count1004INC SIGo to next memory location1006MOV AL,[SI]Move the first data in AL1007DEC CLReduce the count1009L2 : INC SIMove the SI pointerto next data100BCMP AL,[SI]Compare two data"s100EJNB L1If AL > [SI] then go to L1 ( no swap)1010MOV AL,[SI]Else move the large number to AL1012L1 : DEC CLDecrement the count1014JNZ L2If count is not zero go to L21016MOVDI,1300HInitialize DI with 1300H1018MOV [DI],ALElse store the biggest number in 1300location1010HLTStop

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY41 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM FOR FINDING SMALLEST NUMBER:ADDRESSOPCODESPROGRAMCOMMENDS1000MOV SI,1200HInitialize array size1002MOV CL,[SI]Initialize the count1004INC SIGo to next memory location1006MOV AL,[SI]Move the first data in AL1007DEC CLReduce the count1009L2 : INC SIMove the SI pointer to next data100BCMP AL,[SI]Compare two data"s100EJB L1If AL < [SI]then go to L1 ( no swap)1010MOV AL,[SI]Else move the large number to AL1012L1 : DEC CLDecrement the count1014JNZ L2If count is not zero go to L21016MOV DI,1300HInitialize DI with 1300H1018MOV [DI],ALElse store the biggest number in1300 location1010HLTStop

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY42 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING RESULT:Thus largest and smallest number is found in a given array.

DATAINPUTOUTPUTDATAINPUTOUTPUT

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY43 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 11DATE:PASSWORD CHECKINGAIM:To write an Assembly Language Program (ALP) for performing theArithmetic operation of two byte numbersAPPARATUS REQUIRED:SL.NoITEMSPECIFICATIONQUANTITY1.Microprocessor kit8086 kit12.Power Supply+5 V dc1; PASSWORD IS MASM1234DATA SEGMENTPASSWORD DB 'MASM1234'LEN EQU ($-PASSWORD)MSG1 DB 10, 13,'ENTER YOUR PASSWORD: $'MSG2 DB 10, 13,'WELCOME TOELECTRONICS WORLD!!$'MSG3 DB 10, 13,'INCORRECT PASSWORD!$'NEW DB 10, 13,'$'INST DB 10 DUP (0)DATA ENDSCODE SEGMENT

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY44 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ASSUME CS: CODE, DS: DATASTART:MOV AX, DATAMOV DS, AXLEA DX, MSG1MOV AH, 09HINT 21HMOV SI, 00UP1:MOV AH, 08HINT 21HCMPAL, 0DHJE DOWNMOV [INST+SI], ALMOV DL,'*'MOV AH, 02HINT 21HINC SIJMP UP1DOWN:MOV BX, 00MOV CX, LENCHECK:MOV AL,[INST+BX]MOV DL,[PASSWORD+BX]CMP AL, DLJNE FAIL

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY45 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INC BXLOOP CHECKLEA DX, MSG2MOV AH, 09HINT 21HJMP FINISHFAIL:LEA DX, MSG3MOV AH, 009HINT 21HFINISH:INT 3CODE ENDSEND STARTEND

RESULT:Thus the output for the Password checking, Print RAM size and system datewas executed successfully

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY46 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO: 12DATE:COUNTERS AND TIME DELAYAIM:To write an assemblylanguage program in 8086 to Counters and Time DelayAPPARATUS REQUIRED:SL.NoITEMSPECIFICATIONQUANTITY1.Microprocessor kit8086 kit12.Power Supply+5 V dc1.MODEL SMALL.DATAMSGIN DB 'Enter delay duration (0-50): $'MSG1 DB'This is Microprocessor! $'DELAYTIME DW 0000H.CODEMOV DX,@DATAMOV DS, DXLEA DX, MSGINMOV AH, 09HINT 21HIN1:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY47 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV AH, 01HINT 21HCMP AL, 0DH;JE NXTSUB AL, 30HMOV DL, ALMOV AX, BXMOV CL, 0AHMUL CLMOV BX, AXAND DX, 00FFHADD BX, DXMOVDELAYTIME, BXLOOP IN1NXT:MOV CX, DELAYTIMEMOV DL, 10MOV AH, 02HINT 21HLEA SI, MSG1LP:PUSH DXMOV DL,[SI]CMP DL,'$'JE NXT2MOV AH, 02HINT 21HADD SI, 1POP DXMOV DI, DELAYTIMEMOV AH, 0INT 1AhMOV BX, DXDelay:MOV AH, 0INT 1Ah

Dharmapuri-636 703ICAL EN

LAB MANUAL

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY2 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ANNA UNIVERSITY CHENNAIRegulation 2013CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORYSYLLABUSLIST OF EXPERIMENTS:8086 Programs using kits and MASM1.Basic arithmetic andLogical operations2.Move a data block without overlap3.Code conversion, decimal arithmetic and Matrix operations.4.Floating point operations, string manipulations, sorting and searching5.Password checking, Print RAM size and system date6.Counters and Time DelayPeripherals and Interfacing Experiments7.Traffic light control8.Stepper motor control9.Digital clock10.Key board and Display11.Printer status12.Serial interface and Parallel interface13.A/D and D/A interface and Waveform Generation 8051.Experiments usingkits and MASM14. Basic arithmetic and Logical operations15. Square and Cube program, Find 2"s complement of a number16. Unpacked BCD to ASCIITOTAL: 45 PERIODS

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY3 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INTRODUCTION TO MICROPROCESSORS& MICROCONTROLLERS:Microprocessor and controller is digital and programmable device with highlyreliable and secured modern architecture. Building blocks of the Digital computerCPU functions Memory types Input / Output Devices Stored programconcept Historyof Microprocessors.Intel 8085 microprocessor:Internal architecture, Hardware description, Interrupts and interrupts servicingand Interfacing the memory. Assembly Language Programming: 8085-Addressingmodes & Instruction set,Flow charts, Assembly language programming andassembler directives, Linker and its operation, Programming examples.Interfacing the input / output devices:8255 Programmable Peripheral Interface, i8253 Programmable Interval Timer,8251 Universal Synchronous /Asynchronous Receiver Transmitter, 8259Programmable Interrupt Controller and i8279 Programmable Keyboard / Displayinterface device.Interfacing the data converters:Digital-to-Analog Converters, Interfacing DAC with 8086microprocessor,Analog-to-Digital ConvertersInterfacing ADC with 8086.Microprocessors:Intel 8086 family microprocessors, Programming model, Memory paging,Virtual memory concept, advanced features of 80386/486/Pentium Processors.Microcontroller:Introduction to Microcontrollers, Intel-8051: Architecture, Hardwaredescription, Memory organization, Addressing Modes.Programming the i8051:Instruction set, Assembly language programming, Interrupt structure andinterrupt priorities, Interfacing with external devices and Programming.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY4 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INDEXEX.NODATENAME OF THE EXPERIMENTSTAFFSIGNREMARKS1BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086 MICROPROCESSOR16 BIT ADDITION2BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086MICROPROCESSOR16 BIT SUBTRACTION3BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086 MICROPROCESSOR16 BITMULTIPLICATION4BASIC ARITHMETIC AND LOGICAL OPERATIONSUSING 8086 MICROPROCESSOR16 BIT DIVISION:5MOVE A DATA BLOCK WITHOUT OVERLAP6CODE CONVERSION, DECIMAL ARITHMETICAND MATRIX OPERATIONS.CODECONVERSIONS-DECIMAL TOHEXADECIMAL7CODE CONVERSION-HEXADECIMAL TO DECIMAL8FLOATING POINT OPERATIONS-STRING MANIPULATIONS,SORTING ANDSEARCHING,COPYING A STRING9ASCENDING & DESCENDING10LARGEST& SMALLEST11PASSWORD CHECKING, PRINT RAM SIZE ANDSYSTEM12COUNTERS AND TIME DELAY13TRAFFIC LIGHT CONTROL14STEPPER MOTOR INTERFACING15DIGITAL CLOCK

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY5 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NODATENAME OF THE EXPERIMENTSTAFFSIGNREMARKS16INTERFACING PRGRAMMABLEKEYBOARD ANDDISPLAY CONTROLLER-827917PRINTER STATUS18A/D AND D/A INTERFACE AND WAVEFORMGENERATION-ADC19INTERFACING DIGITAL-TO-ANALOGCONVERTE20BASIC ARITHMETIC AND LOGICALOPERATIONS 8 BIT ADDITION8 BIT SUBTRACTION8 BIT MULTIPLICATION8 BIT DIVISIONSQUARE AND CUBE PROGRAM, FIND 2"SCOMPLEMENT OF A NUMBERUNPACKED BCD TO ASCII

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY6 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO:01DATE:BASIC ARITHMETIC AND LOGICAL OPERATIONS USING 8086MICROPROCESSOR-16 BIT ADDITIONAIM:To write an assembly language program to performaddition two 16 bit numbersby an 8 bit number using 8086.S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1Get the first number is specificaddress.Add the second number to the first number.Add the two values.Store the sum and carry.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY7 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY8 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV CX,0000HInitialize counter CXMOVAX,[1200]Get the first data in AXregister.MOV BX, [1202]Get the second data in BXregister.ADD AX,BXAdd the contents of boththe registerAX & BXJNC L1Check for carryINC CXIf carry exists, incrementthe CXL1 : MOV[1206],CXStore the carryMOV [1204], AXStore the sumHLTStop the programThusassembly languageprograms to perform addition two 16 bit numbers by an 8bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY9 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

16 BIT SUBTRACTIONsubtractionS.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1SUBTRACTION:Initialize the MSBs of difference to 0Get the first numberSubtract the second number from the first number.If thereis any borrow, increment MSBs of difference by 1.Store LSBs of difference.Store MSBs of difference.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY10 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

SUBTRACTION:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY11 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

SUBTRACTION:MOV CX,0000HInitialize counter CXMOV AX,[1300]Get the first data in AXregisterMOV BX, [1302]Get the second data in BXregister.SUB AX,BXSubtract the contents of boththe registerAX & BXJNC ACheck the Borrow.INC CXIf carry exists, increment theCXMOV [1306],CXStore the Borrow.MOV [1304], AXStore the difference.HLTStop the programThusassembly language programs toperformsubtractiontwo 16 bitnumbers by an 8 bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY12 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO:03DATE:BASIC ARITHMETIC AND LOGICAL OPERATIONS USING8086 MICROPROCESSOR-16 BIT MULTIPLICATIONAIM:To write an assembly language program to performMultiplicationtwo 16 bitnumbers by an 8 bit number using 8086.APPARATUSREQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1ALGORITHM:16-bitMULTIPLICATIONMultiplication of 16-bit numbers:Get the multiplier.Get the multiplicandInitialize the productto 0.Product = product + multiplicandDecrement the multiplier by 1.If multiplicand is not equal to 0, repeat from step (d) otherwise store theproduct.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY13 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MULTIPLICATION:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY14 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MULTIPLICATION:MOV AX,1234HGet the first data in AXregister.MOV BX,[1300]Get the second data in BXregister.MUL BXMultiply AX & BX dataINT 3Break point.MULTIPLICATION OUTPUT:INPUTOUTPUT

RESULT:Thusassembly language programs to performmultiplicationtwo 16 bitnumbers by an 8 bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY15 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 04DATE:BASIC ARITHMETIC AND LOGICAL OPERATIONS USING8086MICROPROCESSOR-16BIT DIVISION:AIM:To write an assembly language program to performdivisiontwo 16 bitnumbers by an 8 bit number using 8086.APPARATUSREQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIT8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1ALGORITHM:16-bitdivisionDivision of 16-bit numbers:Get thedividend and divisor.Initialize the quotient to 0.Dividend = dividend-divisorIf the divisor is greater, store the quotientGo to step 3If dividend is greater, quotient = quotient+ repeat from step 4.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY16 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

DIVISION:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY17 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

DIVISION:MOV AX,[1200]Get the first data in AXregister,MOVDX,[1202]Get the second data inDXregister.MOV BX,[1204]MOV [1206],AXDIV DXDivide the dividend bydivisorMOV AX,BXCopy the lower order dataMOV [1208],AXStore the higher order data.INT 3Stop the program.OUTPUT FOR DIVISION:INPUTAX=DX=OUTPUTAX=DX=RESULT:Thusassembly language programs to performdivisiontwo 16 bit numbers byan 8 bit number using 8086Performed and the result is stored.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY18 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 05DATE:MOVE A DATA BLOCK WITHOUT OVERLAPAIM:To move adata block without overlapAPPARATUS REQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1ALGORITHM:Initialize the memory location to the data pointer.Increment B register.Increment accumulator by 1 and adjust it to decimal every time.Compare the given decimal number with accumulator value.When both match, the equivalent hexadecimal value is in B register.Store the resultant in memory location.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY19 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV CL, 05Get the Data rangeMOV SI, 1400Get the first data.MOV DI, 1450Get the second data.LD DSBStore the lower orderproductMOV [DI], ALStore the resultINC DIIncrementthe pointer.DEC 1008Counter 0INT 3Break pointOUTPUT:INPUTOUTPUT1400145014011451140214521403145314041454

RESULT:Thus the output for the Move a data block without overlap was executedsuccessfully. CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY20 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 06DATE:CODE CONVERSION, DECIMAL ARITHMETICAND MATRIX OPERATIONS.Code Conversions-Decimal toHexadecimal:AIM:To convert a given decimal number to hexadecimal.ALGORITHM:Initialize the memory location to the data pointer.Increment Bregister.Increment accumulator by 1 and adjust it to decimal every time.Compare the given decimal number with accumulator value.When both match, the equivalent hexadecimal value is in B register.Store the resultant in memory location.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY21 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOWCHART:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY22 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM:ADDRESSOPCODELABELMNEMONICSCOMMENDS1000MOV AL, [1100]Move data block AL1003MOV AH, ALMove data lower to higher1005MOV AH, OFMove data OF into AH1008MOV BL, AHMove data BL intoAH100AAND AL, FOAND the data AL to FO100CMOV CL, 04Move data 04 to CLblock100EROR AL, CLRotate functions CL and AL1010MOV BH, OAMove data OA into BH1012MUL BHMultiply BH1014ADD AL, BLADD the data AL And BL1016MOV[2000], ALMove the store data1019INT-3Halt programTOHEXADECIMAL]DATAADRESSDATAINPUTOUTPUTRESULT:Thus the output for thecode conversions-decimal to hexwas executedsuccessfully.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY23 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO:07DATE:CODE CONVERSION-HEXADECIMAL TO DECIMALAIM:To convert a given hexadecimal number to decimal.ALGORITHM:Initialize the memory location to the data pointer.Increment B register.Increment accumulator by 1 and adjust it to decimal every time.Comparethe given hexadecimal number with B register value.When both match, the equivalent decimal value is in A register.Store the resultant in memory location.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY24 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM;ADDRESSOPCODELABELMNEMONICSCOMMENTS1000MOV AL,[1100]Move date to AL REG1003MOV DX, ALMove data AL TO DX1006HUNDMOV AL, 64Move data to AX REG1008JC TENJump carry100ASUB AL, 64Subtract data100CINC DLIncrement DL100EJUP HUNDJUMP label data1010TENCMP AL, OACompare register1012JC UNITJump carry1014SUB AL,OASubtract data1016INC DHIncrement DH1018JC TENJUMP carry101AUNITMOV [200],DLMove data to DL101EMOV [200],DHMove data to DH1022MOV [200],ALMove data to AL1025MOV[200],AHMove data to AH1027HLTStop the program

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY25 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

OUTPUT:[HEXADECIMAL NUMBER TO DECIMAL]:

RESULT:Thus the output for the additioncode conversions-decimal to hexwasexecuted successfully.

INPUTOUTPUTMEMORYDATA

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY26 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO: 08DATE:FLOATING POINT OPERATIONS-STRING MANIPULATIONS,SORTING AND SEARCHINGCopyingaString:AIM:To move a string of length FF from source to destination.ALGORITHM:Initialize the data segment .(DS)Initialize the extra data segment .(ES)Initialize the start of string in the DS. (SI)Initialize the start of string in the ES. (DI)Move the length of the string (FF) in CX register.Move the byte from DS TO ES, till CX=0.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY27 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY28 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM:1000MOV SI,1200HInitialize destination address1003MOV DI,1300HInitialize starting address.1006MOV CX,0006HInitialize array size1008CLDClear direction flag100AREP MOVSBCopy the contents ofsource intodestination until count reaches zero100CHLTStopOUTPUT : [COPYING A STRING]:INPUTOUTPUT1400145014011451140214521403145314041454

RESULT:Thus a string of a particular length is moved from sourcesegment todestination segment. CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY29 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 09DATE:ASCENDING & DESCENDINGAIM:To write an Assembly LanguageProgram(ALP)tosort a given array inascending and descending order.APPARATUS REQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWER SUPPLY+ 5 V DC13.KEY BOARD-1PROBLEM STATEMENT:An array of length 10 is given from the location. Sort it into descending andascending order and store the result.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY30 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Load the array count in two registers C1and C2.Get the first two numbers.Compare the numbers and exchange if necessary so that the two numbers are inascending order.Decrement C2.Get the third number from thearray and repeat the process until C2is 0.Decrement C1and repeat the process until C1is 0.Sorting in descending order:Load the array count in two registers C1and C2.Get the first two numbers.Compare the numbers and exchange if necessary so thatthe two numbers are indescending order.Decrement C2.Get the third number from the array and repeat the process until C2is 0.Decrement C1and repeat the process until C1is 0.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY31 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:[ASCENDING]:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY32 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOWCHART:[DECENDING]:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY33 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

1000MOV SI,1200HInitialize memory location forarray size1002MOV CL,[SI]Number of comparisons in CL1004L4 : MOVSI,1200HInitialize memory location forarray size1006MOV DL,[SI]Get thecount in DL1007INC SIGo to next memory location1009MOV AL,[SI]Get the first data in AL100BL3 : INC SIGo to next memory location100EMOV BL,[SI]Get the second data in BL1010CMP AL,BLCompare two data"s1012JNB L1If AL < BL go toL11014DEC SIElse, Decrement the memorylocation1016MOV [SI],ALStore the smallest data1018MOV AL,BLGet the next data AL1019JMP L2Jump to L2101AL1 : DEC SIDecrement the memory location101CMOV [SI],BLStore the greatest data inmemorylocation101EL2 : INC SIGo to next memory location1020DEC DLDecrement the count1022JNZ L3Jump to L3, if the count is notreached1024MOV [SI],ALStore data in memory location1026DEC CLDecrement the count1028JNZ L4Jump toL4, if the count is notreachedzero1029HLTStop

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY34 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

1000MOV SI,1200HInitialize memory locationfor array size1002MOV CL,[SI]Number of comparisons inCL1004L4 :MOVSI,1200HInitialize memory locationfor array size1006MOV DL,[SI]Get the count in DL1007INC SIGo to next memorylocation1009MOV AL,[SI]Get the first data in AL100BL3 : INC SIGo to next memorylocation

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY35 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

OUTPUT FOR ASCENDING:

RESULT:Thus given array of numbers are sorted in ascending & descending order.

DATAINPUTOUTPUTDATAINPUTOUTPUT

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY36 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 10DATE :LARGEST& SMALLESTAIM:To write an Assembly Language Program(ALP) to find the largest andsmallest number in a given array.APPARATUS REQUIRED:S.NOITEMSPECIFICATIONQUANTITY1.MICROPROCESSOR KIR8086 KIT12.POWERSUPPLY+ 5 V DC13.KEY BOARD-1PROBLEM STATEMENT:An arrayoflength5is given from the location. Find the largest and smallestnumber and store the result.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY37 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ALGORITHM:(i)Finding largest number:Load the array count in a register C1.Getthe first two numbers.Compare the numbers and exchange if the number is small.Get the third number from the array and repeat the process until C1is 0.(ii)Finding smallest number:Load the array count in a register C1.Get the first two numbers.Comparethe numbers and exchange if the number is large.Get the third number from the array and repeat the process until C1 is 0.

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY38 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:[LARGEST]

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY39 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

FLOECHART:[SMALLEST]

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY40 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM FOR FINDING LARGEST NUMBER:ADDRESSOPCODESPROGRAMCOMMENDS1000MOV SI,1200HInitialize array size1002MOV CL,[SI]Initialize the count1004INC SIGo to next memory location1006MOV AL,[SI]Move the first data in AL1007DEC CLReduce the count1009L2 : INC SIMove the SI pointerto next data100BCMP AL,[SI]Compare two data"s100EJNB L1If AL > [SI] then go to L1 ( no swap)1010MOV AL,[SI]Else move the large number to AL1012L1 : DEC CLDecrement the count1014JNZ L2If count is not zero go to L21016MOVDI,1300HInitialize DI with 1300H1018MOV [DI],ALElse store the biggest number in 1300location1010HLTStop

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY41 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

PROGRAM FOR FINDING SMALLEST NUMBER:ADDRESSOPCODESPROGRAMCOMMENDS1000MOV SI,1200HInitialize array size1002MOV CL,[SI]Initialize the count1004INC SIGo to next memory location1006MOV AL,[SI]Move the first data in AL1007DEC CLReduce the count1009L2 : INC SIMove the SI pointer to next data100BCMP AL,[SI]Compare two data"s100EJB L1If AL < [SI]then go to L1 ( no swap)1010MOV AL,[SI]Else move the large number to AL1012L1 : DEC CLDecrement the count1014JNZ L2If count is not zero go to L21016MOV DI,1300HInitialize DI with 1300H1018MOV [DI],ALElse store the biggest number in1300 location1010HLTStop

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY42 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING RESULT:Thus largest and smallest number is found in a given array.

DATAINPUTOUTPUTDATAINPUTOUTPUT

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY43 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX. NO: 11DATE:PASSWORD CHECKINGAIM:To write an Assembly Language Program (ALP) for performing theArithmetic operation of two byte numbersAPPARATUS REQUIRED:SL.NoITEMSPECIFICATIONQUANTITY1.Microprocessor kit8086 kit12.Power Supply+5 V dc1; PASSWORD IS MASM1234DATA SEGMENTPASSWORD DB 'MASM1234'LEN EQU ($-PASSWORD)MSG1 DB 10, 13,'ENTER YOUR PASSWORD: $'MSG2 DB 10, 13,'WELCOME TOELECTRONICS WORLD!!$'MSG3 DB 10, 13,'INCORRECT PASSWORD!$'NEW DB 10, 13,'$'INST DB 10 DUP (0)DATA ENDSCODE SEGMENT

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY44 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ASSUME CS: CODE, DS: DATASTART:MOV AX, DATAMOV DS, AXLEA DX, MSG1MOV AH, 09HINT 21HMOV SI, 00UP1:MOV AH, 08HINT 21HCMPAL, 0DHJE DOWNMOV [INST+SI], ALMOV DL,'*'MOV AH, 02HINT 21HINC SIJMP UP1DOWN:MOV BX, 00MOV CX, LENCHECK:MOV AL,[INST+BX]MOV DL,[PASSWORD+BX]CMP AL, DLJNE FAIL

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY45 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INC BXLOOP CHECKLEA DX, MSG2MOV AH, 09HINT 21HJMP FINISHFAIL:LEA DX, MSG3MOV AH, 009HINT 21HFINISH:INT 3CODE ENDSEND STARTEND

RESULT:Thus the output for the Password checking, Print RAM size and system datewas executed successfully

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY46 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

EX.NO: 12DATE:COUNTERS AND TIME DELAYAIM:To write an assemblylanguage program in 8086 to Counters and Time DelayAPPARATUS REQUIRED:SL.NoITEMSPECIFICATIONQUANTITY1.Microprocessor kit8086 kit12.Power Supply+5 V dc1.MODEL SMALL.DATAMSGIN DB 'Enter delay duration (0-50): $'MSG1 DB'This is Microprocessor! $'DELAYTIME DW 0000H.CODEMOV DX,@DATAMOV DS, DXLEA DX, MSGINMOV AH, 09HINT 21HIN1:

CS6412-MICROPROCESSOR AND MICROCONTROLLER LABORATORY47 VVITDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV AH, 01HINT 21HCMP AL, 0DH;JE NXTSUB AL, 30HMOV DL, ALMOV AX, BXMOV CL, 0AHMUL CLMOV BX, AXAND DX, 00FFHADD BX, DXMOVDELAYTIME, BXLOOP IN1NXT:MOV CX, DELAYTIMEMOV DL, 10MOV AH, 02HINT 21HLEA SI, MSG1LP:PUSH DXMOV DL,[SI]CMP DL,'$'JE NXT2MOV AH, 02HINT 21HADD SI, 1POP DXMOV DI, DELAYTIMEMOV AH, 0INT 1AhMOV BX, DXDelay:MOV AH, 0INT 1Ah