Microprocessorlabmanual ee0310

download Microprocessorlabmanual ee0310

If you can't read please download the document

Transcript of Microprocessorlabmanual ee0310

1. EE0310-Microprocessor & Microcontroller Lab 2. LABORATORY MANUALEE0310 MICROPROCESSOR &MICROCONTROLLER LABDEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERINGFACULTY OF ENGINEERING & TECHNOLOGYSRM UNIVERSITY, Kattankulathur 603 2031 3. EE0310-Microprocessor & Microcontroller LabLIST OF EXEPRIMENTSSl.No. Name of the ExperimentsPageNo.1 Induction to 8085 Microprocessor2a)Addition of 2 - 8 bit numbersb)Subtraction of 2 - 8 bit numbers3a)Addition of 2 - 16 bit numbersb)Subtraction of 2 16 bit numbers4a)Multiplication of 2 - 8 numbersb)Division of 2 - 8 bit numbers5a)Ascending orderb)Descending order6a)Fibonaci Seriesb)Sum of finite series7 Factorial of Given Numbers8a)Multiplication of 2 - 16 bit numbersb)Division of 2 - 16 bit numbers9a)Binary to BCD code conversionsb)BCD to Binary code conversions10a)Rolling Displayb)Flashing Display11 Stepper motor rotate forward and reverse direction12 Digital analog conversion 4. 13 Analog digital conversion14 Microcontrollera)Additionb)Subtractionc)Multiplicationd)Division2 5. EE0310-Microprocessor & Microcontroller LabINTRODUCTION TO MICROPROCESSOR 8085AimTo study the microprocessor 8085Architecture of 8085 Microprocessora) General purpose registerIt is an 8 bit register i.e. B,C,D,E,H,L. The combination of 8 bit register is known asregister pair, which can hold 16 bit data. The HL pair is used to act as memory pointer isaccessible to program.b) AccumulatorIt is an 8 bit register which hold one of the data to be processed by ALU and storedthe result of the operation.c) Program counter (PC)It is a 16 bit pointer which maintain the address of a byte entered to line stack.d) Stack pointer (Sp)It is a 16 bit special purpose register which is used to hold line memory address forline next instruction to be executed.e) Arithmetic and logical unitIt carries out arithmetic and logical operation by 8 bit address it uses the accumulatorcontent as input the ALU result is stored back into accumulator.f) Temporary registerIt is an 8 bit register associated with ALU hold data, entering an operation, used bythe microprocessor and not accessible to programs.g) FlagsFlag register is a group of fire, individual flip flops line content of line flag registerwill change after execution of arithmetic and logic operation. The line states flags are1) Carry flag (C)2) Parity flag (P)3) Zero flag (Z)4) Auxiliary carry flag (AC)5) Sign flag (S)h) Timing and control unitSynchronous all microprocessor, operation with the clock and generator and controlsignal from it necessary to communicate between controller and peripherals.i) Instruction register and decoderInstruction is fetched from line memory and stored in line instruction register decoderthe stored information.j) Register ArrayThese are used to store 8 bit data during execution of some instruction.3 6. EE0310-Microprocessor & Microcontroller LabPIN DescriptionAddress Bus1. The pins Ao A15 denote the address bus.2. They are used for most significant bitAddress / Data Bus1. AD0 AD7 constitutes the address / Data bus2. These pins are used for least significant bitALE : (Address Latch Enable)1. The signal goes high during the first clock cycle and enables the lower orderaddress bits.IO / M1. This distinguishes whether the address is for memory or input.2. When this pins go high, the address is for an I/O device.S0 S1S0 and S1 are status signal which provides different status and functions.RD1. This is an active low signal2. This signal is used to control READ operation of the microprocessor.WR1. WR is also an active low signal2. Controls the write operation of the microprocessor.HOLD1. This indicates if any other device is requesting the use of address and data bus.HLDA1. HLDA is the acknowledgement signal for HOLD2. It indicates whether the hold signal is received or not.INTR1. INTE is an interrupt request signal2. IT can be enabled or disabled by using softwareINTA1. Whenever the microprocessor receives interrupt signal2. It has to be acknowledged.RST 5.5, 6.5, 7.51. These are nothing but the restart interrupts2. They insert an internal restart junction automatically.4 7. EE0310-Microprocessor & Microcontroller LabTRAP1. Trap is the only non-maskable interrupt2. It cannot be enabled (or) disabled using program.RESET IN1. This pin resets the program counter to 0 to 1 and results interrupt enable andHLDA flip flops.X1, X2These are the terminals which are connected to external oscillator to produce thenecessary and suitable clock operation.SIDThis pin provides serial input dataSODThis pin provides serial output dataVCC and VSS1. VCC is +5V supply pin2. VSS is ground pinSpecifications1. ProcessorsIntel 8085 at E144 MHz clock2. MemoryMonitor RAM:0000 IFFFEPROMExpansion:20003FFFs0000 FFFSystem RAM:40005FFFMonitor data area41005FFFRAM Expansion6000BFFF3. Input / OutputParallel: A8 TTL input timer with 2 number of 32-55 only input timer available in m-85 EBI.Serial: Only one number RS 232-C, Compatible, crucial interface using 8281ATimer: 3 channel -16 bit programmable units, using 8253 channel 0 used for no band late.Clock generator. Channel 1 is used for single stopping used program.Display: 6 digit 7 segment LED display with filter 4 digit for adder display and 2 digit fordata display.Key board: 21 keys, soft keyboard including common keys and hexa decimal keys.RES: Reset keys allow to terminate any present activity and retain to m - 85 its on initialize 8. state.5 9. EE0310-Microprocessor & Microcontroller LabINT: Maskable interrupt connect to CPUs RST 7.5 interruptDEC: Decrement the adder by 1EXEC: Execute line particular value after selecting address through go command.NEXT: Increment the address by 1 and then display its content.Key Functions:E i. Hex entry key 0ii. Substituting memory content where next key is paused0 immediatelySUB after 1, take used to st cutting address.iii. Register key ERD i) Hex code entry (1)1 ii) Register key DREGi) Hex code entry 2C ii) Retricre data from data memory to data top2 iii) Register key CTNB i) Hex code entry 33 ii) Retricre data from memory to topTR iii) Register key BF i) Hex key entry C4 ii) Block search from byteBLOC iii) Register key FA i) Hex key entry 55 ii) Fill block of RAM memory with desired dataFILL iii) Register key AL i) Hex key entry 66 ii) TN/Tl used for sending (or) receivingSER iii) Register key HH7 i) Hex key entry 7F ii) Register key H 26 10. I8G0PL9SNGAPHF3CSHMOVDCMPBSLBCEINSFDELEE0310-Microprocessor & Microcontroller Lab1) Register key S2) Register key I1) Hex key entry A2) Function key F33) Register key ph1) Hex key entry y2) Signal step program (instruction by instruction)1) Hex key entry c2) Much a block of memory from a linear block3) Register key SH1) Hex key D2) Compare 2 memory block1) Hex key entry B2) Check a block from flame3) Register key SPL1) Hex key E2) Insert by test into memory (RAM)1) Hex key F2) Delete byte from memory RAMPower ConsumptionSystemMicro BSEB2 MICROSSEB+5V @ 1Amp +5V@ 800 mA+12V @ 200 mA- 12V @ 100 mA7 11. EE0310-Microprocessor & Microcontroller LabPower Supply SpecificationMICRO SSEM230V, AC @ 80 Hz+5V @ 600 mAKey Function8 12. EE0310-Microprocessor & Microcontroller Lab 13. ICs Used8085 - 8 bit mp8253 - programmable internal timer8255 - programmable peripheral interface8279 -programmable key boards / displayinterface8251 - programmable communication interface2764 - 8 KV VV EPROM6264 - 8K STATIC PROM7414 - Hex inverter7432 - Quad 21/p OR GATE7409 - Quad 21/p AND GATE7400 - NAND Gate7404 - Dual D-FF74373 - Octal D Latch74139 - Dual 2 to 4 line decoder74138 - 3 to 8 line decoder9 14. EE0310-Microprocessor & Microcontroller LabIn Enter Program into Trainer Kit1. Press RESET key2. Sub (key processor represent address field)3. Enter the address (16 bit) and digit in hex4. Press NEXT key5. Enter the data6. Again press NEXT7. Again after taking the program, are use HLT instructionits Hex code8. Press NEXTHow to executive program1. Press RESET2. Press GO3. Enter the address location in which line program was executed4. Press Execute keyResult:Thus 8085 microprocessor was studied successfully.10 15. EE0310-Microprocessor & Microcontroller LabADDITION OF TWO 8-BIT NUMBERSAim:To write an assembly language for adding two 8 bit numbers by using micro processorkit.Apparatus required:8085 micro processor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 : Intialize the carry as ZeroStep 3 : Load the first 8 bit data into the accumulatorStep 4 :Copy the contents of accumulator into the registerBStep 5 : Load the second 8 bit data into the accumulator.Step 6 : Add the 2 - 8 bit datas and check for carry.Step 7 : Jump on if no carryStep 8 : Increment carry if there isStep 9 : Store the added request in accumulatorStep 10 : More the carry value to accumulatorStep 11 : Store the carry value in accumulatorStep 12 : Stop the program execution.11 16. EE0310-Microprocessor & Microcontroller LabSTARTIntialise the carry as zeroLoad the 1st 8 bit numberTransfer the 1st number to register B 17. Load the 2nd 8 bit numberTransfer and Add the contents of A and BNoCheck forcarry?YesIncrement carry by oneStore the added value in accumulatorMove the contents of carry into accumulatorStore the value of carry in accumulatorEND12 18. EE0310-Microprocessor & Microcontroller LabAddress Label Mnemonics Hex Code Comments4100 MVI C,00 OE, 00 Initialize the carry as zeroLoad the first 8 bit4102 LDA 4300 3A, (00, 43)data4105 MOV, B,A 47 Copy the value of 8 bit datainto register B4106 LDA 4301 3A, (01, 43) Load the second 8 bit datainto the accumulator4109 ADD B 80 Add the hoo values410A JNC D2, 0E, 41 Jump on if no carry410D INR C OC If carry is there increment itbyone410E Loop STA 4302 32 (02, 43) Stone the added value in theaccumulator4111 MOV A,C 79 More the value of carry tothe accumulatorfromregister C4112 STA 4303 32 (03, 43) Store the value of carry inthe accumulator4115 HLT 76 Stop the program executionInputWithoutcarryInputAddress Value4300 044301 02OutputOutput Address Value4302 064303 00 (carry)With carryInputAddress Value4300 FF4301 FFOutput Address Value4302 FE4303 01 (carry)Calculation1111111111111111---------------(1) 1111 1110========= 19. F EResult:The assembly language program for 8 bit addition of two numbers was executedsuccessfully by using 8085 micro processing kit.13 20. EE0310-Microprocessor & Microcontroller LabSUBTRACTION OF TWO 8 BIT NUMBERSAim:To write a assembly language program for subtracting 2 bit (8) numbers by using-8085 micro processor kit.Apparatus required:8085 micro processor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 : Intialize the carry as ZeroStep 3 : Load the first 8 bit data into the accumulatorStep 4 :Copy the contents of contents into the registerBStep 5 :Load the second 8 bit data into theaccumulator.Step 6 : Subtract the 2 8 bit datas and check for borrow.Step 7 : Jump on if no borrowStep 8 : Increment borrow if there isStep 9 : 2s compliment of accumulator is found outStep 10 : Store the result in the accumulatorStep 11 : More the borrow value from c to accumulatorStep 12 : Store the borrow value in the accumulatorStep 13 : Stop program execution14 21. EE0310-Microprocessor & Microcontroller LabSTART 22. Intialise the borrow as zeroLoad the 1st 8 bit numberMove the 1st 8 bit data to register BLoad the 2nd 8 bit numberSubtract the two valuesNoCheck forcarry?YesIncrement carry by one1s compliment of 2nd valueAdd 1 to 1s compliment for 2s complimentStore the value of result in accumulatorMove the carry into the accumulatorStore the value of carry in accumulatorEND15 23. EE0310-Microprocessor & Microcontroller LabAddress Label Mnemonics Hex Code Comments4100 MVI C,00 OE, 00 Initialize the carry as zero4102 LDA 4300 3A, (00, 43) Load the first 8 bit data into theaccumulator4105 MOV, B,A 47 Copy the value into register B4106 LDA 4301 3A, (01, 43) Load the 2nd 8 bit data into theaccumulator4109 SUB B 90 Subtract both the values410A Loop INC D2, 0E, 41 Jump on if no borrow410D INR C OC If borrow is there, increment it byone410E Loop CMA 2F Compliment of 2nd data410F ADI, 01 6, 01 Add one to 1s compliment of 2nddata4111 STA 4302 32,02,43 Store the result in accumulator4114 MOV A,C 79 Moul the value of borrow into theaccumulator4115 STA 4303 32,03,43 Store the result in accumulator4118 HLT 76 Stop Program executionInputWithout borrowInput Address Value4300 054301 07OutputOutput Address Value4302 024303 00 (borrow)With carry borrowInput Address Value4300 074301 05Output Address Value4302 024303 01 (borrow)Calculation 05 0707 0111CMA 1000ADJ 0.1 0001------100105 - 0101------1110 (-2)16 24. EE0310-Microprocessor & Microcontroller LabResult:The assembly language program subtraction of two 8 bit numbers was executedsuccessfully by using 8085 micro processing kit.17 25. EE0310-Microprocessor & Microcontroller LabADDITION OF TWO 16 BIT NUMBERSAim:To write an assembly language program for adding two 16 bit numbers using 8085micro processor kit.Apparatus required:8085 micro processor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 : Get the 1st 8 bit in C register (LSB) and 2nd 8 bit in Hregister (MSB) of 16 bit number.Step 3 : Save the 1st 16 bit in DE register pairStep 4 :Similarly get the 2nd 16 bit number and store it in HLregisterpair.Step 5 : Get the lower byte of 1st number into L registerStep 6 : Add it with lower byte of 2nd numberStep 7 : tore the result in L registerStep 8 : Get the higher byte of 1st number into accumulatorStep 9 :Add it with higher byte of 2nd number and carry of the lowerbitaddition.Step 10 : Store the result in H registerStep 11 : Store 16 bit addition value in HL register pairStep 12 : Stop program execution18 26. EE0310-Microprocessor & Microcontroller LabSTARTC = 00HLoad HL with 1st DataTransfer HL - DELoad HL with 2nd Data 27. DE + HL = HLIfCy =0C = C + 01Store HL in memory (SUM)Transfer C - AStore A in memory (Cy)STOP19 28. EE0310-Microprocessor & Microcontroller LabAddressLabel Mnemonics Hex Code Comments4500 MVI C,00 0E C = 00H4501 004502LHLD 4800 2A HL 1st No.4503 004504 484505XCHG EB HL DE4506LHLD 4802 2A HL 2nd No.4507 024508 484509 DAD D 19 Double addition DE +HL450A JNC Ahead D2 If Cy = 0, G0 to 450E450E450B 0E450C 45450D INR C 0C C = C + 01450E AHEADSHLD 4804 22 HL 4804 (sum)450F 044510 484511 MOV C,A 79 Cy A4512 STA 4806 32 Cy 48064513 064514 484515 HLT 76 Stop excutionInputWithoutInput Address Value4800 01 (addend)4801 044802 02 (augend)4803 03 (augend)OutputOutput Address Value4804 03 (sum)4805 07 (sum)4806 00 (carry)Calculation00000100 00000001 29. 00000011 00000010---------------------------------00001101 000000110 7 0 320 30. EE0310-Microprocessor & Microcontroller LabWithcarryInputAddress Value4800 FF (addend)4801 DE (addend)4802 96 (augend)4803 DF (augend)Output Address Value4804 95 (sum)4805 BE (sum)4806 01 (carry)Calculation 11011110 1111111111011111 10010101---------------------------------11101110 10010101B E 9 5Result:The assembly language program for addition of two 16 bit numbers was executedusing 8085 micro processing kit.21 31. EE0310-Microprocessor & Microcontroller LabSUBTRACTION OF TWO 16 BIT NUMBERSAim:To write an assembly language program for subtracting two 16 bit numbers using8085 microprocessor kit.Apparatus required:8085 microprocessor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 : Get the 1st 16 bit in HL register pairStep 3 : Save the 1st 16 bit in DE register pairStep 4 : Get the 2nd 16 bit number in HL register pairStep 5 : Get the lower byte of 1st numberStep 6 : Get the subtracted value of 2nd number of lower byte bysubtracting it with lower byte of 1st numberStep 7 : Store the result in L registerStep 8 : Get the higher byte of 2nd numberStep 9 :Subtract the higher byte of 1st number from 2nd numberwithborrowStep 10 : Store the result in HL registerStep 11 : Stop the program execution22 32. EE0310-Microprocessor & Microcontroller LabSTARTC = 00HLoad HL with 1st DataTransfer HL - DELoad HL with 2nd DataTransfer E A (LSB) 33. A = A L (LSB)Store A in memory (LSB)Transfer D A (MSB)A A H Borrow (MSB)Store A in memory (MSB)STOP23 34. EE0310-Microprocessor & Microcontroller LabAddress Label Mnemonics Hex Code Comments4500 MVI C,00 0E C = 00H4501 004502 LHLD 4800 2A L 1st No.4503 004504 484505 XLHG EB HL DE4506 LHLD 4802 2A HL 2nd No.4507 024508 484509 MOV A,E 7B LSB of 1 to A450A SUB L 95 A A L450B STA 4804 32 A memory450C 04450D 48450E MOV A,D 7A MSB of 1 to A450F SBB H 9C A- A H4510 STA 4805 32 A memory4511 054512 484513 HLT 76 Stop executionInputWithout borrowInput Address Value4800 074801 084802 054803 06OutputOutput Address Value4804 024805 024807 0024 35. EE0310-Microprocessor & MicrocontrollerLabWith borrowInput Address Value4800 054801 064802 074803 08Output Address Value4804 024805 024806 01Calculation0506- 07 08050601010110 070801111000CMA10101001CMA10000111ADI00000001 ACI00000001-----------------------------10101010100010000506+ 07 081010 10101000 1000---------------(1)0010 001002 02Result:The assembly language program for subtraction of two 16 bit numbers was executed byusing 8085 micro processing kit.25 36. EE0310-Microprocessor & Microcontroller LabMULTIPLICATION OF TWO 8 BIT NUMBERSAim:To write an assembly language for multiplying two 8 bit numbers by using 8085micro processor kit.Apparatus required:8085 microprocessor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 : Get the 1st 8 bit numbersStep 3 : Move the 1st 8it number to register BStep 4 : Get the 2nd 8 bit numberStep 5 : Move the 2nd 8 bit number to register CStep 6 : Intialise the accumulator as zeroStep 7 : Intialise the carry as zeroStep 8 : Add both register B value as accumulatorStep 9 : Jump on if no carryStep 10 : Increment carry by 1 if there isStep 11 :Decrement the 2nd value and repeat from step 8, till the2ndvalue becomes zero.Step 12 : Store the multiplied value in accumulatorStep 13 : Move the carry value to accumulatorStep 14 : Store the carry value in accumulator26 37. EE0310-Microprocessor & Microcontroller LabSTART 38. Get the 1st 8 bit numberMove it to register BGet the 2nd 8 bit numberIntialize the accumulator as zero & carry as zeroAdd the accumulator with 1st numberNoCheck forcarry?YesIncrement carryDecrement 2nd numberNo2ndNumberYesStore the value f carry in accumulatorEND27 39. EE0310-Microprocessor & Microcontroller LabAddressLabel Mnemonics Hex Code Comments4100 LDA 4500 3A, 00, 45 Load the first 8 bit number4103 MOV B,A 47Move the 1st 8 bit datatoregister B4104 LDA 4501 3A, 01, 45 Load the 2nd 16 it number4107 MOV C,A 4F Move the 2nd 8 bit data toregister C4108 MVI A, 00 3E, 00 Intialise the accumulator aszero410A MVI D, 00 16, 00Intialise the carry aszero410C ADD B 80 Add the contents of B andaccumulator410D INC D2 11, 41 Jump if no carry4110 INR D 14 Increment carry if there isDecrement the value4111 DCR C ODC4112 JNZ C2 0C, 41 Jump if number zeroStor4115 STA 4502 32 02, 45ethe result inaccumulator4118 MOV A,D 7AMovethe carryintoaccumulator4119 STA 4503 32,03,45Storethe result inaccumulator411C HLT 76 Stop the program executionInputInput Address Value4500 044501 02OutputOutput Address Value4502 084503 00Result:The assembly language program for multiplication of two 8 bit numbers was executedusing 8085 micro processing kit. 40. 28 41. EE0310-Microprocessor & Microcontroller LabDIVISION OF TWO 8 BIT NUMBERSAim:To write an assembly language program for dividing two 8 bit numbers usingmicroprocessor kit.Apparatus required:8085 microprocessor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 : Intialise the Quotient as zeroStep 3 : Load the 1st 8 bit dataStep 4 :Copy the contents of accumulator into registerBStep 5 : Load the 2nd 8 bit dataStep 6 : Compare both the valuesStep 7 : Jump if divisor is greater than dividendStep 8 : Subtract the dividend value by divisor valueStep 9 : Increment QuotientStep 10 : Jump to step 7, till the dividend becomes zeroStep 11 : Store the result (Quotient) value in accumulatorStep 12 : Move the remainder value to accumulatorStep 13 : Store the result in accumulatorStep 14 : Stop the program execution29 42. EE0310-Microprocessor & Microcontroller Lab 43. STARTGet the dividedIntialise the Quotient as zeroGet the divisorCompare the dividend & divisorAdd the accumulator with 1st numberNoCheck forcarry?Increment carryDecrement 2nd numberDividendYesStore the Quotient in accumulatorMove the remainder to accumulatorStore the remainder in accumulatorEND30 44. EE0310-Microprocessor & Microcontroller LabAddress Label Mnemonics Hex Code Comments4100 MVI C, 00 0E, 00Intialise Quotient aszero4102 LDA, 4500 3A 00, 45Get the 1stdata4105 MOV B,A 47Copythe1st dataintoregister B4106 LDA, 4501 3A 01, 45Get the 2nddata4109 CMP B B8 Compare the 2 values410A JC (LDP) DA 12,41 Jump if dividend lesser thandivisor410D Loop 2 SUB B 90Subtract the 1st value by2ndvalue410E INR C 0C Increment Quotient (410D)410F JMP (LDP, 41) C3, 0D, 41Jump to Loop 1 till thevalueof dividend becomes zero4112 Loop 1 STA 4502 32 02,45Store thevalue inaccumulator4115 MOV A,C 79Move the value ofremaindertoaccumulator4116 STA 4503 32 03,45 Store the remainder value inaccumulator4119 HLT 76 Stop the program executionInputInput Address Value4500 094501 02OutputOutput Address Value4502 04 (quotient)4503 01 (reminder)10010010 I------011100 45. 10 II------01010010III------00110010IV------0001 carryQuotient-04Carry-0131 46. EE0310-Microprocessor & Microcontroller LabResult:The assembly language program for division of two 8 bit numbers was executed using8085 micro processing kit.32 47. EE0310-Microprocessor & Microcontroller LabASCENDING ORDERAim:To write a program to sort given n numbers in ascending orderApparatus required:8085 microprocessor kit(0-5V) DC batteryAlgorithm:Step 1 : Start the microprocessorStep 2 :Accumulator is loaded with number of values to sorted and itissavedStep 3 : Decrement 8 register (N-1) Repetitions)Step 4 : Set HL register pair as data arrayStep 5 : Set C register as counter for (N-1) repetitionsStep 6 : Load a data of the array in accumulatorStep 7 : Compare the data pointed in HL pairStep 8 :If the value of accumulator is smaller than memory, thenjumpto step 10.Step 9 :Otherwise exchange the contents of HL pair andaccumulatorStep 10 : Decrement C register, if the of C is not zero go to step 6Step 11 : Decrement B register, if value of B is not zero, go step 3Step 12 : Stop the program execution33 48. EE0310-Microprocessor & Microcontroller LabSTART 49. Load the count value in accumulator and save it in register BDecrement B register (N-1)Load the starting address of array in HLDecrement C register of array in HLIncrement the data pointerCompare the data pointed by HL with ACompare the datas A lower & save it in BClear the accumulator & move 0A to CLoad the 2nd 8 bit numberTransfer and Add the contents of A and BYesZf = 0 ?Save the product in B registerGet the BCD data in A, move it to E and mark itAdd the unit A and (B-ug) productStore the binary value in MEND62 95. EE0310-Microprocessor & Microcontroller LabMemoryHexCode LabelMnemonics CommentsLocationOpcodeOperand4100 3A,00,42LDA 4200 Get the data in A4103 5EMOV E,A Save in E register4104 E6, F0 ANI F0 Mark the lower nibble4106 07 RLC Rotate the upper4107 07 RLC To lower nibble4108 07 RLC And save in4109 07 RLC Register BMO410A 47V B,A Move it from A toB410B AFXRA A Clear the accumulator410C 0E,0A MVI C,0A Intialise C as 0A410E 08 REP410F 0DDCR C Decrement C register4110 C2,0E,41 JNZ Jump till value C is 0MO4113 47V B,A Move the value A to B4114 7BMOV A,E Get the BCD in A4115 E6, 0F ANI 0F Mark the upper nibbleAD4117 80D B Add A and B4118 32,01,42 STA 4201 Save the binary data411B 76 HLT StoptheprogramexecutionInputInput Address Value4200 68OutputOutputAddress Value4201 4416684-4Result:Thus the BCD to binary conversion was executed successfully 96. 63 97. EE0310-Microprocessor & Microcontroller LabSPEED CONTROL OF STEPPER MOTORAim:To write an assembly program to make the stepper motor run in forward and reversedirection.Apparatus required:Stepper motor8085 microprocessor kit(0-5V) power supplyAlgorithm:Step 1 : Load the HL pair wit value from tableStep 2 : Move it to B register for setting the counterStep 3 : Move the memory value to accumulator and display it bycontrol wordStep 4 :Load DE register pair with FFFF for starting delaysubroutineStep 5 : Run the delay loop control D-register becomes zero.Step 6 : Increment H address for next value from tableStep 7 : Jump on no zeroStep 8 : When B = 0, go to start and restart the program64 98. EE0310-Microprocessor & Microcontroller LabSTART 99. Load HL register pair with dataLoad E with 04 (count)Move memory to accumulatorDisplay the accumulator content (8 bit port)Load the DE pair with FFFFStart delay subroutineDecrement D by one, check OR gatebetween D and ED = 0 ?Increment HL pair by one (count)Decrement B count by oneCy = ?65 100. EE0310-Microprocessor & Microcontroller LabMemoryHexCode Label Mnemonics CommentsLocation Op code Operand4100 Start LXIH,Lookup 21,1A,41 Load the HL withdata4103 MVI B,04 06,04 B = 044105 Repeat MOV A,M 7E Memory value to A4106 OUT C0 D3, C0 Display it4108 LXI D,03,03 11 Load DE with FFFF410B Delay NOP 00 Start delay loop410C DCX D 1B Decrement DE by 1410D MOV A,E 7B Move E to A410E ORA D B2 Check De = 0 or not410F JNZ DELAY C2, 0B,41 Jump on zero4112 INX H 23 Increment HL by 14113 DCR B 05 Decrement B by 14114 JNZ Repeat C2,05,41 Jump on no zero4117 JMP START C3,00,41 Jump to startInputInput Address Value411A0A411B06411C05411D09Reverse DirectionOutputAddress Value411A09411B05411C06411D0AResult:Thus, an assembly language program to control of stepper motor was written using8085 microprocessor kit. 101. 66 102. EE0310-Microprocessor & Microcontroller LabFLASHING DISPLAYAim:To write an assembly language program to obtain the following flashing display of aparticular data.Apparatus required:8085 micro processing kit(0-5V) power supplyAlgorithm:Step 1 :Get the control words in accumulator and output wordsthrough8 bit addressStep 2 : Load HL register pair with memory addressStep 3 : Get the count value in C registerStep 4 :Increment the register pair by one and display the characterandcall for delay.Step 5 : Clear the display and call delay routine to step 7Step 6 : Go to step 7Step 7 : Load DE register pair with memory addressStep 8 : Decrement DE pair with memory addressStep 9 : If the content is not equal to zero, go to step 8Step 10 : Return to main program67 103. EE0310-Microprocessor & Microcontroller Lab 104. STARTLoad the control loads for flashing displayLoad the register pair HL with specified addressTransfer count from memory to C registerIncrement memory addressTransfer memory count in accumulatorOutput accumulator content to a data registerIncrement count in register cNoCheck forcarry?YesCall delayLoad control word for linear screenCall delayLoad DE with memory addressNoIfContent ?YesReturn68 105. EE0310-Microprocessor & Microcontroller LabMemory Hex Code Label MnemonicsCommentsLocationOpcode Operand4300 MVIA,00 3E,00 Intialise A as 004302 OUT 01 DE,01Outthecontrolwordtrough 8 bit4304 MVIA,90 3E,90Intialise a with cwforRAM4306 OUT 01 D3,01 Out the cwA,CA =4308 MVIC 3E,CCCC430A OUT 01 0D,01 Out the cw430C Loop 2 LXI H,5000 21,00,50 Load HL with430F MOV C,M 4E M to CIncrement H4310 Loop 1 INX H 23by4311 MOV A,M 7E Move M to AOut the4312 OUT 00 D3, 00character4314 DCR C 0D Decrement C by 14315 JNZ Loop 1 C2,10,43 Check for zeroDela4318 CALLy C0,00,46 Call subroutine431B MVIA,DC 3E,DCA C4510 Loop 1 INX H 23 Increment HLMove H to4511 MOV A,M 7EA4512 OUT 00 DE, 00Output thecharacter4514 CALLLoop CD,00,46 Call the subroutine4517 DCR C 0DDecrement C byone4518 JNZ Loop 1 C2,10,45Jump on nozero451B JMP Loop 2 C3,0C,45Jump toL24600 Loop LXI D,FFFF 11,FFFF Load DE-FFFF4603 Loop 3 DCX D 1BDecrement DE by14604 MOV A,D 7AMove D toA4605 ORA E B3 (A) = (A) checkJump on no4606 JNZ Loop 3 C2,03,46zero4609 RET C9Return tomainprogramInput 111. Input Address Value5000 065001 985002 685003 7A5004 C85005 1A5006 2COutputHELPUSResult:Thus, an assembly language program to obtain rolling display of a particular valuewritten using 8085 microprocessor kit.72 112. EE0310-Microprocessor & Microcontroller LabSQUARE WAVE GENERATORAim:To write a program and to generate square generator using DAC.Apparatus required:8085 microprocessor kit(0-5V) power supplyAlgorithm:Step 1 :Intialise A as 00 and take data pointer to portC8Step 2 : Call delayStep 3 : Move FF to A and take port C8Step 4 : Call delayStep 5 : Go to step 1DelaySubtroutineStep 1 : Counter 1 = 05Step 2 : Counter 2 = FFStep 3 : Decrement counter 2Step 4 : Check if c= 0, if no jump to step 3Step 5 : Decrement counter 1Step 6 : Check if B = 0, if no jump to step 2Step 7 : Return to main program73 113. EE0310-Microprocessor & Microcontroller LabSTARTLoad the control words as for displaying 114. Call the delay subtroutine programIntialise the accumulator as EEOutput the accumulator contents registerCall the delay subroutine programJump to the start of programIntialise B as 05 and C as FF and decrement c by oneCheck forc = ?NoYesDecrement the value of BNoCheck forB = 0 ?YesReturn74 115. EE0310-Microprocessor & Microcontroller LabMemory Hex Code Label MnemonicsCommentsLocation Op code Operand4100 3E,00 Start MVI A,00 Intialise A with 00Load the control4102 D3,C8 OUT C8words4104 CD,11,41 CALL Delay Call delay sutroutine4107 3E,FF MVI A,FF Intialise A with FF4109 D3,C8 OUT C8 A -> C8410B CD,11,41 CALL Delay Call delay subroutine410E C3,00,41 JMP Start Jump to start4111 06,05 Delay MVI B,05 B -> 05[C] =>4113 0E Loop 1 MVI C,FFFF4115 OD Loop 2 DCR C Decrement C registerJump on no4116 C2,15,41 JNZ Loop 2zero4119 05 DCR B Decrement B register411A C2,13,41 JNZ Loop 1 Jump on n zeromai411D C9 RET Return tonprogramResult:Thus square wave was generated using 8085 microprocessor kit.75 116. EE0310-Microprocessor & Microcontroller LabTRIANGULAR WAVE GENERATORAim:To write an assembly language program for generating triangular wave using DAC.Apparatus required:8085 micro processor kit(0-5V) DC batteryAlgorithm:Step 1 : Move content of C to A where L is intialised to 00Step 2 : Output content of C8Step 3 : Increment L till zf = 0Step 4 : Intialise L register with FFStep 5 : Move content of L to accumulator and output to portDecrement L if not equal to zero jump else go to nextStep 6 :stepStep 7 : Jump on next step76 117. EE0310-Microprocessor & Microcontroller LabDelayIntialise the value of 1 as 00 118. Move the values of 1 to AOutput the control word for control signalIncrement the value of LL = 0 ?No YesSet the value of 1 as FFMove the 1 value to accumulatorOutput the control wordL = 0 ?YesJump tostartNo77 119. EE0310-Microprocessor & Microcontroller LabMemory Hex Code Label Mnemonics CommentsLocation Op code Operand4300 2E,00 Start MVI L,00 Intialise L as 004302 7D Loop 1 MOV A,L [L] -> [A]Load the control4303 D3,C8 OUT C8words4305 2C INR L Increment register L4306 C2,02,43 JNZ Loop 1 Jump on no zero toloop 14309 2E, FF MVI L,FF L = FF430B 70 Loop 2 MOV A,L L -> A430C D3,C8 OUT C8 [C8] -> [A]430E 2D DCR L Decrement L by one430F C2,0B,43 JNZ Loop 2 Jump on no zero to430B4312 C3,00.43 JMP Start Repeat processResult:Thus the triangular wave was generated using 8085 microprocessor kit.78 120. EE0310-Microprocessor & Microcontroller LabSAWTOOTH WAVE GENERATORAim:To write an assembly language program for generating Sawtooth waveform by usingmicroprocessor 8085.Apparatus required:8085 microprocessor kit(0-5V) power supplyAlgorithm:Step1 : Intialise accumulator with 00Step2 : Output current address specifiedStep3 : Increment accumulator by oneStep4 : Jump to step oneDelayIntialise the accumulator as00Display the output port usingcwIncrement the accumulatorJump to loop 1MemoryHexCode Label Mnemonics CommentsLocation Op codeOperand4500 3E,00 Start MVI A,00 Intialise A as 00Loop4502 D3, C81 OUTC8A = [C8]4504 3C INR A Increment A by one4505 C3,02,45 JMP Loop 1 Jump to loop oneTRIANGULAR WAVE 121. 79 122. EE0310-Microprocessor & Microcontroller LabSAW TOOTH WAVESQUARE WAVE 123. Result:Thus the Sawtooth wave was generated using 8085 microprocessor kit.80 124. EE0310-Microprocessor & Microcontroller LabANALOG TO DIGITAL CONVERTERAim:To write an assembly language program to convert analog to digital signal and todisplay it in 7 segment LED displayApparatus required:8085 microprocessor kit(0-5V) power supplyAlgorithm:Step 1 : Access the channel of ADCStep 2 : Intialise the accumulator with start of conversion signal &output it to the ADCStep 3 : Send 0 signal for ending the conversion for ADCStep 4 : Get the analog value converted to display from ADCStep 5 :The digital signal is separated into two nibbles and displayedinhexadecimal from by calling service subroutine.Step 6 : Go to step 181 125. EE0310-Microprocessor & Microcontroller LabSTARTLoad the control word necessary for generation of ALE signal to control register 126. Load the control word necessary to start the conversion to control registerGet the output port specifiedIf the 1stLSB bit=1?Get accumulator output in port specifiedTransfer accumulator content to BMask all MSR & Store memory in locationMask all 4 LSB & store memory in locationLoad accumulator with 03 & with 08Load the pair with address of MSRCall the service subroutine82 127. EE0310-Microprocessor & Microcontroller LabMemory Hex Code Label Mnemonics CommentsLocation Op code Operand5000 3E,10 MVI A,10 Intialise a with 10Output channel5002 D3,C OUT C8through5004 3E,18 MVI A,18 Intialise A with 185006 D3, C8 OUT C8Output channelthrough8 bit port5008 00 NOP No operation5009 00 NOP No operation500A 3E,10 MVI A,10 Intialise A with 2ndsignal500C D3,C8 OUT C8Output channelthrough8 bit port500E 3E,01 L2 MVI A,01 Intialise A with 2nd5010 D3,D0 OUT D0 Output through 8 bit5012 00 NOP5013 00 NOP5014 00 NOP5015 3E,00 MVI A,005017 D3,D0 OUT D05019 DB,D8 L1 IN D8501B E6,01 ANI 01501D CA,19,50 JZ L15020 DB,C0 IN C0 Get input from5022 47 MOV B,A B -> A5023 E6,0F ANI 0F And of with A5025 32,51,51 STA 5151 Store in 51515028 78 MOV A,B B -> A5029 E6,F0 ANI F0 And F0 with A502B 0F RRC Rotate content A502C 0F RRC502E 0F RRC502F 32,50,51 STA 550 Store MSB in 51505032 3E,03 MVI A,03 03 -> A5034 0E,08 MVI C,08 08 -> C5036 21,50,51 LXI H 5150 Load HL pair with51505039 CD,05,00 CALL 0005 Call device subroutine503C C3,0E,50 JMP 500E Jump to 500EResult:Thus the analog to digital conversion was done microprocessor.83 128. EE0310-Microprocessor & Microcontroller LabARTHMETIC OPERATIONS USING 8051Aim:To do the arithmetic operations using 8051 microprocessorApparatus required:8085 microprocessor kitDAC interface kitKeyboardAlgorithm:Addition / SubtractionStep 1 : Move 1H data to memoryStep 2 : Add or subtract 1H data with 2nd dataStep 3 : Initialize data pointer.Move result to memory pointed byStep 4 :DPTR.STARTOut 1H data in memoryAdd or subtract 1H and 1st dataInitialize DPTRMove result to memory preset by DPTRStop84 129. EE0310-Microprocessor & Microcontroller LabProgram: 8-bit Addition:Memory Label Opcode Mnemonics CommentsLocation4100 Start C3 CLR C Clear the carry flatMovdat4101 74DA MOV A, # data 1esa 1toregister A4103 24DA ADD A, # data 2 Add content of A anddata 2 and store inA4105 464500 MOV DPTR, # 4500Movesdata4500toDPTR4108 F0 MOV A @ DPTR, A Moves control of A tolocation pointedDTPR4109 80 FE SJMP 4109Short jump to4109Execution:Addition:ML Input4103 0L4109 03 130. ML Output4500 05Program: 8-bit Subtraction: 131. Memory Label Opcode Mnemonics CommentsLocationClear the carry4100 Start C3 CLR Cflat4101 74DA MOV A, # data 1 Movesdata 1 toregisterA4103 24DA SUB B, # data 2Subtractdata 2fromcontent of A and storeresult in A4105 464500 MOV DPTR, # 4500 Moves 4500 to DPTR4108 F0 MOV X @ DPTR, A Moves result bylocation byDTPR4109 80 FE SJMP 4109 Short jump to 4109Execution:Subtraction:ML41014103 132. ML Output4500 03Result:Thus 8-bit addition,subtraction isperformedusing8051.85 133. EE0310-Microprocessor & Microcontroller LabARTHMETIC OPERATIONS USING 8051Aim:To do the arithmetic operations using 8051 microprocessorApparatus required:8085 microprocessor kitDAC interface kitKeyboardAlgorithm:Multiplication /DivisionGet Step 1 : 1H data and 2nd data to memoryStep 2 : Multiply or divide 1H data with 2nd dataStep 3 : Initialize data pointer.Step 4 :Move result to memory pointed by DPTR (firstport)Step 5 : Increment DPTRStep 6 : Move 2nd part of result to register AStep 7 :Move result to 2nd memory location pointer byDPTRSTARTGet data into the registerComplement the dataMove the data to pointer by DPTRIncrement dataIncrement DPTRMove data into paste locationShort jump to preset locationStop86 134. YesEE0310-Microprocessor & Microcontroller LabProgram: 8-bit Multiplication:Memory Label Opcode Mnemonics CommentsLocation4100 Start 7403 MOV A, # data 1Move immediatedatato accumulator4101 75F003 MOV B, # data 2 Move 2nd data to Bregister4105 A4 MUL A B Get the product in A &B4106 904500 MOV DPTR, # 4500 Load data in 4500location4109 F0 MOV X @DPTR, A Move A t ext RAM410B E5F0 MOV A,B Move 2nd data in A410D F0 MOV A @ DPTR Same the ext RAM410E 80FE SJMP 410E Remain idle in infiniteloopExecution:Multiplication:ML Input4101 0L4103 04Program: 8-bit Division: 135. Output Address Value4500 08Memory Label Opcode Mnemonics CommentsLocation4100 Start 7408 MOV A, # data 1Move immediatedatato accumulator4102 75F002MOV B, @ data 2DIV Move immediate to BAB reg.4105 84 DIV AB Divide content of A &B4106 904500 MOV DPTR, # 4500 Load data pointer with4500 location4109 F0 MOV X @ DPTR, A Move A to ext RAM410A A3 INC DPTR Increment data pointer410B ESF0 MOV A,B Move remainder to A410D F0 MOV @ DPTR, A Move A to ext RAM410E 80FE SJMP 410E Remain idle in infiniteloopExecution:Division:ML Input4101 084103 04 136. Output Address Value4500 02Result : Thus 8-bitmultiplication &division isperformedusing 8051.87