mp and mc record

Upload: jostin-punnassery

Post on 14-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 MP and MC Record

    1/102

    Exp no: 1

    Date :

    PROGRAMMING WITH 80858 BIT ARITHMETIC OPERATION

    AIM:To write an assembly language program for arithmetic operations of two 8 bit numbers

    using 8085 microprocessor kit for the following operations.

    A. AdditionB. SubtractionC. MultiplicationD. Division

    APPARATUS REQUIRED:

    S.No Apparatus Required Quantity1. 8085 Microprocessor kit 1

    2. Power supply -

    3. Opcode sheet 1

    A. ALGORITHM FOR 8-BIT ADDITION:

    1. Start the program.2. Load first data in accumulator and move the content from register A to register B.3. Load the second data in accumulator. Initialize the carry value as 00.4. Add the content of A register with B register. If a carry doesnt exist, directly store the

    value.5. If carry exists, then increment the carry value and then store the sum in the address

    location mentioned.6. Stop the program.

  • 7/30/2019 MP and MC Record

    2/102

    FLOW CHART FOR 8 BIT ADDTION:

    Start

    Clear the C register

    IFther

    e

    Load the contents of memory into accumulator

    Move the contents of accumulator to B register

    Load the contents of memory to accumulator

    Add the contents of B-register with accumulator

    Increment the C register

    Store the contents of accumulator to memory

    Move the contents of C register to accumulator

    Store the contents of accumulator to memory

    Stop

    No

  • 7/30/2019 MP and MC Record

    3/102

    PROGRAM FOR 8-BIT ADDITION:

    MEMORY LABEL MNEMONICS OPCODE COMMENTS

    4500 START MVI C,00H 0E Move the value to

    register C immediately4501 004502 LDA 4200H 3A Load accumulator from

    address 4200H4503 00

    4504 42

    4505 MOV B,A 47 Move the content to the

    B register

    4506 LDA 4201H 3A Load accumulator from

    address 4201H4507 01

    4508 42

    4509 ADD B 80 Add contents of B with

    A

    450A JNC LOOP1 D2 Jump of control to givenaddress when no carryis found

    450B 0E

    450C 41

    450D INR C 0C Increment register C

    450E LOOP1 STA 4202H 32 Store accumulator withcontents of 4202H450F 02

    4510 42

    4511 MOV A,C 79 Move content of C to A

    4512 STA 4203H 32 Store accumulator withcontents of 4203H4513 03

    4514 42

    4515 STOP HLT 76 Stop the program

    B. ALGORITHM FOR 8 BIT SUBTRACTION:

    1. Load the first data in accumulator and move the content from accumulator to B register.2. Load the second data in accumulator. Initialize the carry value.3. Subtract the content of accumulator with register B.4. Check whether carry is present or not.5. If present, increment the carry.6. Complement the accumulator content.7. Add immediate by incrementing A register.8. If no carry is present, store the data in accumulator.9. The content present in C register is moved to accumulator.10.Store the result in memory location mentioned.11.Stop the program.

  • 7/30/2019 MP and MC Record

    4/102

    FLOW CHART FOR 8 BIT SUBTRACTION:

  • 7/30/2019 MP and MC Record

    5/102

    PROGRAM FOR 8 BIT SUBTRACTION:

    MEMORY LABEL MNEMONICS OPCODE COMMENTS

    4600 START MVI C,00 0E Move the value toregister C

    immediately4601 00

    4602 LDA 4200H 3A Load accumulator

    from address 4200H4603 00

    4604 42

    4605 MOV B,A 47 Move content of A to

    B

    4606 LDA 4201H 3A Load accumulatorfrom address 4201H4607 01

    4608 42

    4609 SUB B 90 Subtract contents of Bwith A

    460A JNC LOOP1 D2 Jump of control to

    given address when

    no carry is found460B 10

    460C 46

    460D INR C 0C Increment register C

    460E CMA 2F Complement occurs

    460F INR A 3C Increment of A

    4610 LOOP1 STA 4202H 32 Store the content ofgiven address to

    accumulator4611 02

    4612 42

    4613 MOV A,C 79 Move contents of C toA

    4614 STA 4203H 32 Store the content of

    given address to

    accumulator4615 03

    4616 42

    4617 STOP HLT 76 Stop the program

    ALGORITHM FOR 8-BIT MULTIPLICATION:

    1. Start the program.2. Load the first data into the accumulator.

    3. Move the content of accumulator to the B register.4. Load the second data into the accumulator.5. Move the content of accumulator to the C register.6. Decrement the content of B register by one.7. Add the C register content with accumulator.8. Decrement the content of B register & then repeat the steps 7 & 8.9. Else store the result in the memory location mentioned.10.Stop the program.

  • 7/30/2019 MP and MC Record

    6/102

    FLOW CHART FOR 8 BIT MULTIPLICATION:

  • 7/30/2019 MP and MC Record

    7/102

    PROGRAM FOR 8 BIT MULTIPLICATION:

    MEMORY LABEL MNEMONICS OPCODE COMMENTS

    4100 START MVI C,00H 0E Move the content

    immediately to reg C4101 004102 LDA 4200H 0A Load accumulator fromaddress 4200H4103 00

    4104 41

    4105 MOV B,A 47 Move content of A to B

    4106 LDA 4201H 0A Load accumulator from

    address 4201H4107 01

    4108 41

    4109 MOV C,A 4F Move content of A to C

    410A DCR B 05 Decrement register B

    410B LOOP ADD C 81 Add content of C with A

    410C DCR B 05 Decrement register B410D JNZ LOOP C2 Jump of control to given

    address when no zero is

    found410E 0B

    410F 41

    4110 STA 4202H 32 Store the content of given

    address to accumulator4111 02

    4112 42

    4113 HLT 76 Stop the program

    ALGORITHM FOR 8 BIT DIVISION:

    1. Start the program.2. Load the first data in the accumulator.3. Move the content from memory address to A register and increment the HL pair.4. Move the content from memory address to B register & initialize the C register.5. Compare the 8 bit instructions in A and B registers. Subtract B register from accumulator

    & increment the value in C register.

    6. Increment the HL pair and move the content in accumulator to memory.7. Stop the program

  • 7/30/2019 MP and MC Record

    8/102

    FLOW CHART FOR 8 BIT DIVISION:

  • 7/30/2019 MP and MC Record

    9/102

  • 7/30/2019 MP and MC Record

    10/102

    Exp no: 2

    Date :

    PROGRAM WITH 8085 CONTROL INSTRUCTIONS-

    ASCENDING/DESCENDING ORDER

    AIM:

    To write an assembly language program for the ascending and descending order of 8-bitnumbers using 8085 microprocessor kit.

    APPRATUS REQUIRED:

    S.NO NAME OF ITEMS QUANTITY

    1.

    2.

    8085-Microprocessor kit

    Power supply

    1

    A. ALGORITHM FOR ASCENDING ORDER:

    1. Start the program2. Load the data in memory whose address in C3. Move the memory into C-register then decrement the C-register by 1 and increment H by

    1.

    4. Load the data in the memory to A.5. Compare the memory with A.

    6. Jump on the carry when M is greater A, go to Step 9.7. Move the memory M to D register8. Decrement the address of HL pair and move the D register content to M and increment

    the value by H by 1.

    9. Move B register and decrement the C-register.10.Jump on Zero to the address 4108,if zero goes to decrement B and go to step1.11. Stop the program.

  • 7/30/2019 MP and MC Record

    11/102

    FLOW CHART FOR ASCENDING ORDER:

  • 7/30/2019 MP and MC Record

    12/102

    PROGRAM FOR ASCENDING ORDER:

    ADDRESS OPCODE LABEL MNEMONICS COMMENTS

    4100 06 START MVI B,05H Move the contentimmediately to reg B4101 05

    4102 05 DCR B Decrement the reg B

    4103 0E LOOP1 MVI C,05H Move the content

    immediately to reg c4104 05

    4105 0D DCR C Decrement the reg C

    4106 21 LXI H,4200Load the content

    immediately to HL pair4107 00

    4108 42

    4109 7E LOOP2 MOV A,M Move the content to A410A 23 INX H Increment the HL pair

    410B BE CMP M Compare the contents

    410C DA JC LOOP3

    Jump carry to loop3410D 14

    410E 41

    410F 56 MOV D,M Move the content to D

    4110 77 MOV M,A Move the content to memory

    4111 2B DCX H Decrement the HL pair

    4112 72 MOV M,D Move the content to memory

    4113 23 INX H Increment the HL pair4114 0D LOOP3 DCR C Decrement the reg C

    4115 C2 JNZ LOOP2

    Jump non zero to loop24116 09

    4117 41

    4118 05 DCR B Decrement the reg B

    4119 C2 JNC LOOP1

    Jump no carry to loop1411A 03

    411B 41

    411C 76 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    13/102

    B. ALGORITHM FOR DESCENDING ORDER:

    1. Start the program2. Load the data in memory whose address in C3. Move the memory into C-register then decrement the C-register by 1 and increment H by

    1.4. Load the data in the memory to A.5. Compare the memory with A.6. Jump on no carry when M is greater A, go to Step 9.7. Move the memory M to D register8. Decrement the value of HL pair and move the D register content to M and increment the

    value by H by 1.

    9. Move B register and decrement the C-register.

    10.Jump on Zero to the address 4108,if zero goes to decrement B and go to step1.11.Stop the program.

  • 7/30/2019 MP and MC Record

    14/102

    FLOW CHART FOR DESCENDING ORDER:

  • 7/30/2019 MP and MC Record

    15/102

    PROGRAM FOR DESCENDING ORDER:

    ADDRESS OPCODE LABEL MNEMONICS COMMENTS4100 06 START MVI B,05H Move the content

    immediately to reg B4101 05

    4102 05 DCR B Decrement the reg B

    4103 0E LOOP1 MVI C,05H Move the content

    immediately to reg c4104 05

    4105 0D DCR C Decrement the reg C

    4106 21 LXI H,4200Load the content

    immediately to HL pair4107 00

    4108 424109 7E LOOP2 MOV A,M Move the content to A

    410A 23 INX H Increment the HL pair

    410B BE CMP M Compare the contents

    410C D2 JNC LOOP3

    Jump non carry to loop3410D 14

    410E 41

    410F 56 MOV D,M Move the content to D

    4110 77 MOV M,A Move the content to memory

    4111 2B DCX H Decrement the HL pair4112 72 MOV M,D Move the content to memory

    4113 23 INX H Increment the HL pair

    4114 0D LOOP3 DCR C Decrement the reg C

    4115 C2 JNZ LOOP2

    Jump non zero to loop24116 09

    4117 41

    4118 05 DCR B Decrement the reg B

    4119 C2 JNC LOOP1

    Jump no carry to loop1411A 03411B 41

    411C 76 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    16/102

    Exp no: 3

    Date :

    PROGRAM WITH 8085 CONTROL INSTRUCTIONS

    AIM:To write an assembly language program for the Maximum/Minimum instructions using

    8085 microprocessor kit.

    APPRATUS REQUIRED:

    S.NO NAME OF ITEMS QUANTITY

    1.

    2.

    8085-Microprocessor kit

    Power supply

    1

    A. ALGORITHM FOR SEARCHING MINIMUM NUMBER:

    1. Start the program2. Load the address of the first element of the array in the HL register fair(pointer).3. Move the count to B register.4. Increment the pointer.5. Get the first data in accumulator.6. Decrement the count.

    7. Increment the pointer.8. Compare the content of memory address by HL pair with that of accumulator.9. If carry=1 go to step 2 or If carry=0 go to step 10.10.Move the content of memory addressed by HL to accumulator.11.Decrement the count.12.Check whether ZF=0 go to step 7 or If ZF=1 go to next step.13.Store the smallest data in memory.14.Stop the program.

  • 7/30/2019 MP and MC Record

    17/102

    FLOW CHART FOR SEARCH THE MINIMUM NUMBER:

  • 7/30/2019 MP and MC Record

    18/102

    PROGRAM FOR SEARCHING MINIMUM NUMBER

    ADDRESS OPCODE LABEL MNEMONICS COMMENTS

    4100 21 START LXI H,4500

    Load the contentimmediately to HL pair

    4101 00

    4102 45

    4103 46 MOV B,M Move the content to reg B

    4104 23 INX H Increment the HL pair

    4105 7E MOV A,M Move the content to A

    4106 05 DCR B Decrement the reg B

    4107 23 L2 INX H Increment the HL pair

    4108 BE CMP M Compare the memory to A

    4109 DA JC L1

    Jump carry to L1410A 0D410B 41

    410C 7E MOV A,M Move the content to reg A

    410D 05 L1 DCR B Decrement the reg B

    410E C2 JNZ L2

    Jump non zero to L2410F 07

    4110 41

    4111 32 STA 4504

    Store the value to A4112 04

    4113 45

    4114 76 STOP HLT Halt the process

    B. ALGORITHM FOR SEARCHING MAXIMUM NUMBER:

    1. Start the program2. Load the address of the first element of the array in the HL register fair (pointer).3. Move the count to B register.4. Increment the pointer.5. Get the first data in accumulator.6. Decrement the count.7. Increment the pointer.8. Compare the content of memory address by HL pair with that of accumulator.9. If carry=0 go to step 2 or If carry=0 go to step 10.10.Move the content of memory addressed by HL to accumulator.11.Decrement the count.12.Check whether ZF=0 go to step 7 or If ZF=1 go to next step.13.Store the smallest data in memory.14.Stop the program.

  • 7/30/2019 MP and MC Record

    19/102

    FLOW CHART FOR SEARCH THE MAXIMUM NUMBER

  • 7/30/2019 MP and MC Record

    20/102

    PROGRAM FOR SEARCHING MAXIMUM NUMBER:

    ADDRESS OPCODE LABEL MNEMONICS COMMENTS

    4100 21 START LXI H,4500Load the content

    immediately to HL pair4101 00

    4102 45

    4103 46 MOV B,M Move the content to reg B

    4104 23 INX H Increment the HL pair

    4105 7E MOV A,M Move the content to A

    4106 05 DCR B Decrement the reg B

    4107 23 L2 INX H Increment the HL pair

    4108 BE CMP M Compare the memory to A

    4109 D2 JNC L1Jump non carry to L1410A 0D

    410B 41

    410C 7E MOV A,M Move the content to reg A

    410D 05 L1 DCR B Decrement the reg B

    410E C2 JNZ L2

    Jump non zero to L2410F 07

    4110 41

    4111 32 STA 4504

    Store the value to A4112 04

    4113 45

    4114 76 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    21/102

    Exp no: 4

    Date :

    PROGRAM WITH 8085 CONTROL INSTRUCTIONS

    AIM:To write an assembly language program for the Code conversion using 8085

    microprocessor kit.

    APPRATUS REQUIRED:

    S.NO NAME OF ITEMS QUANTITY

    1.

    2.

    8085-Microprocessor kit

    Power supply

    1

    a. ALGORITHM FOR BCD TO BINARY:

    1. Start the program.2. Get the BCD data in A register and move to B register.3. Mask the lower nibble of BCD data in A register.4. Rotate the upper nibble to lower nibble position and save in B register.5. Clear the accumulator.6. Move 0AH to C register.

    7. Add B register to A register.8. Decrement C register If ZF=0 go to step 7 If ZF=1 go to next step.9. Save the product in B register.10.Get the BCD data in A register.11.Add the units (A reg) to product (B reg).12.Store the binary value in memory.13.Stop the program.

  • 7/30/2019 MP and MC Record

    22/102

    FLOW CHART FOR CODE CONVERSION: (BCD TO BINARY)

  • 7/30/2019 MP and MC Record

    23/102

    PROGRAM FOR BCD TO BINARY:

    ADDRESS OPCODE LABEL MNEMONICS COMMENTS

    4100 3A START LDA 4500

    Load the content to A4101 00

    4102 45

    4103 47 MOV B,A Move content to reg B

    4104 E6 ANI OF And the content immediatelywith accumulator4105 0F

    4106 5F MOV E,A Move content to reg E

    4107 78 MOV A,B Move content to reg A

    4108 E6 ANI FO And the content immediately

    with accumulator4109 F0410A 0F RRC Rotate A to right with carry

    410B 0F RRC Rotate A to right with carry

    410C 0F RRC Rotate A to right with carry

    410D 0F RRC Rotate A to right with carry

    410E 57 MOV D,A Move content to reg D

    410F A7 XRA A XOR function with A

    4110 26 MVI H,OAMove immediately to reg H

    4111 0A

    4112 84 L1 ADD H Add the reg H

    4113 15 DCR D Decrement the reg D

    4114 C2 JNZ L1

    Jmp non zero to L14115 12

    4116 41

    4117 83 ADD E Add to reg E

    4118 82 STA 4501

    Store the content to A4119 01

    411A 45

    411B 76 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    24/102

    b. ALGORITHM FOR BINARY TO BCD

    1. Start the program.2. Clear D &E register to account for hundreds and tens.3. Load the BINARY data in A register4. Compare A register with 64H If carry flag set go to step 8 otherwise go to next step.5. Subtract 64H from A register.6. Increment E register.7. Go to step 4.8. Compare A register with 0AH If carry flag set go to step 11 otherwise go to next step.9. Subtract 0AH from A register.10.Increment D register11.Go to step 8.

    12.Combine the units and tens to form 8 bit result.13.Save the units, hundreds and tens in memory.14.Stop the program.

  • 7/30/2019 MP and MC Record

    25/102

  • 7/30/2019 MP and MC Record

    26/102

    PROGRAM FOR BINARY TO BCD:

    ADDRESS OPCODE LABEL MNEMONICS COMMENTS

    4100 31 START LXI SP,4700Load the data to stack

    pointer4101 004102 47

    4103 21 LXI H,4500

    Load the data to HL4104 00

    4105 45

    4106 7E MOV A,M Move the data to A

    4107 CD CALL SUB R1Call the sub function SUBR1

    4108 0B

    4109 41

    410A 76 HLT Halt the process410B 21 SUB R1 LXI H,4600

    Load the data to HL410C 00

    410D 46

    410E 06 MVI B,64HMove the data to regB

    410F 64

    4110 CD CALL SUB R2Call the sub function SUB

    R24111 1A

    4112 41

    4113 06 MVI B,0AHMove the data to regB

    4114 0A

    4115 CD CALL SUB R2Call the sub function SUB

    R24116 1A

    4117 41

    4118 77 MOV M,A Move the data to M

    4119 C9 RET Return

    411A 36 SUB R2 MVI M,FFHMove the data to M

    411B FF

    411C 34 L1 INR M Increment memory register

    411D 90 SUB B Subtract reg B from A

    411E D2 JNC L1 Jump no carry to L1411F 1C

    4120 41

    4121 80 ADD B Add A to B

    4122 23 INX H Increment reg H

    4123 C9 RET Return

  • 7/30/2019 MP and MC Record

    27/102

    Exp no: 5Date :

    PROGRAMMING WITH 808516 BIT ARITHMETIC OPERATION

    AIM:

    To write an assembly language program for arithmetic operations of two 16 bit numbers

    using 8085 microprocessor kit for the following operations.

    A. AdditionB. SubtractionC. MultiplicationD. Division

    APPARATUS REQUIRED:

    S.No

    Apparatus Required Quantity

    1. 8085 Microprocessor kit 1

    2. Power supply -

    3. Opcode sheet 1

    A. ALGORITHM FOR 16-BIT ADDITION:

    1. Start the program

    2. Load the first 16-bit data from memory into HL register pair3. Move the first 16-bit data from HL register pair to DE register pair4. Load the second 16-bit data from memory into HL register pair5. Initialize the C register as 00H6. Move content of L register into accumulator7. Add the content of E register to content of accumulator8. Move content of accumulator(result of lower 8-bit addition) into L register9. Move content of H register into accumulator10.Add the content of D register to content of accumulator with carry11.If carry zero means go to step 1312.Increment C register

    13.Move content of accumulator(result of higher 8-bit addition) into H register14.Store the output from HL register pair to memory15.Move content of C register into accumulator16.Store the carry result in another memory location17.Stop the program

  • 7/30/2019 MP and MC Record

    28/102

  • 7/30/2019 MP and MC Record

    29/102

    PROGRAM FOR 16 BIT ADDITION:

    ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

    8500 LHLD 90008503 XCHG

    8504 LHLD 9002

    8507 MVI C,00

    8509 MOV A,L

    850A ADD E

    850B MOV L,A

    850C MOV A,M

    850D ADC D

    850E JNC STEP1

    8511 INR C

    8512 STEP1 MOV H,A

    8513 SHLD 9100

    8516 MOV A,C

    8517 STA 9102

    851A HLT

    B. ALGORITHM FOR 16-BIT SUBTRACTION:

    1. Start the program

    2. Load the first 16-bit data from memory into HL register pair3. Move the first 16-bit data from HL register pair to DE register pair4. Load the second 16-bit data from memory into HL register pair5. Initialize the C register as 00H6. Move content of L register into accumulator7. Subtract the content of E register from content of accumulator8. Move content of accumulator(result of lower 8-bit subtraction) into L register9. Move content of H register into accumulator10.Subtract the content of D register from content of accumulator with borrow11.If carry zero means go to step 1312.Increment C register

    13.Move content of accumulator(result of higher 8-bit subtract) into H register14.Store the output from HL register pair to memory15.Move content of C register into accumulator16.Store the carry result in another memory location17.Stop the program

  • 7/30/2019 MP and MC Record

    30/102

    FLOW CHART FOR 16-BIT SUBTRACTION:

    Get the lower byte of first number

    Get the lower byte of second number

    Subtract lower byte of second number

    from lower byte of first number

    Get the higher byte of first number

    Get the higher byte of second number

    Subtract higher byte of second number

    and borrow from previous subtraction

    Store the result

    Stop

  • 7/30/2019 MP and MC Record

    31/102

    PROGRAM FOR 16 BIT SUBTRACTION:

    ADDRESS LABEL MNEMONICS OPCODE OPERAND COMMENTS

    8500 LHLD 9000

    8503 XCHG

    8504 LHLD 9002

    8507 MVI C,00

    8509 MOV A,L

    850A SUB E

    850B MOV L,A

    850C MOV A,M

    850D SBB D

    850E JNC STEP18511 INR C

    8512 STEP1 MOV H,A

    8513 SHLD 9100

    8516 MOV A,C

    8517 STA 9102

    851A HLT

    C. ALGORITHM FOR 16- BIT MULTIPLICATION:

    1. Start the program.2. Move the content of accumulator to the B register.3. Load the HL register into the accumulator.4. Exchange the content of accumulator to the C register.5. Load the HL register to the next accumulator.6. Load the register pair immediately to the H register.7. Multiply the register with SP.8. Increment B register.9. Move the HL register to memory.

    10.Compare the OR register pair with E.11.Store the HL register to memory.12.Move the content of the memory to register B.13.Move the content of all memory.14.Stop the program.

  • 7/30/2019 MP and MC Record

    32/102

    FLOW CHART16 BIT MULTIPLICATION:

    PROGRAM FOR 16 BIT MULTIPLICATION:

    Get the lower byte of first number

    Get the lower byte of second number

    Subtract lower byte of second number

    from lower byte of first number

    Get the higher byte of first number

    Get the higher byte of second number

    Subtract higher byte of second number

    and borrow from previous subtraction

    Store the result

    Stop

  • 7/30/2019 MP and MC Record

    33/102

    MEMORY LABEL MNEMONICS OPCODE COMMENTS

    4100 LXI D,0000

    4101

    4102

    4103 LXI SP,FFFF4104

    4105

    4106 LXI B,2222

    4107

    4108

    4109 LXI H,0000

    410A

    410B

    410C L2 DAD SP

    410D JNC L1

    410E410F

    4110 INX D

    4111 L1 DCX B

    4112 MOV A,C

    4113 ORA B

    4114 JNZ L1

    4115

    4116

    4117 SHLD 4500

    4118

    4119

    411A XCHG

    411B SHLD 4502

    411C

    411D

    411E HLT

    ALGORITHM FOR 16 BIT DIVISION:1. Start the program.2. Initialize BC to store quotient.

    3. Load the dividend.4. Transfer the content to the register pair DE.5. Load the divisor.6. Move the content of H to accumulator.7. If dividend is less than the divisor then store the result.8. Store quotient in 16 bit address.9. Stop the program.

  • 7/30/2019 MP and MC Record

    34/102

    FLOW CHART16 BIT DIVISION:

    Start St

    PROGRAM FOR 16 BIT DIVISION:

    Get the divisor in A reg, move to B reg and get the dividend in A reg

    Clear C register for Quotient

    Compare B register and A register

    If

    Subtract the content of B

    register from a register

    Stop

    No

    Yes

    Increment the Quotient (C register)

    Store the reminder (A

    register) in memory

    Move the content of C

    register to A register and

    store it in memory

    Start

  • 7/30/2019 MP and MC Record

    35/102

    MEMORY LABEL MNEMONICS OPCODE COMMENTS

    4100 START LXI H, 4500H

    4101

    4102

    4103 LXI B, 4502H

    41044105

    4106 LXI D, 4504H

    4107

    4108

    4109 L1 MOV A, L

    410A SUB C

    410B MOV L, A

    410C MOV A, H

    410D SBB B

    410E MOV H, A

    410F JC L24110

    4111

    4112 INX D

    4113 JMP L1

    4114

    4115

    4116 L2 DAD B

    4117 SHLD 4506

    4118

    4119

    411A XCHG

    411B SHLD 4508H

    411C

    411D

    411E HLT

    Exp no: 6

    Date :

  • 7/30/2019 MP and MC Record

    36/102

    PROGRAMMING FOR ARITHMETIC OPERATIONS USING 8086

    ARITHMETIC OPERATION

    AIM:

    To perform arithmetic operations like addition, subtraction, multiplication and division

    using 8086.

    1. ADDITION:2. SUBTRACTION.3. MULTIPLICATION.4. DIVISION

    APPARATUS REQUIRED:

    S.No Apparatus Required Quantity

    1. 8085 Microprocessor kit 1

    2. Power supply -

    3. Opcode sheet 1

    A. ALGORITHM FOR 16 BIT ADDITIONS;

    1. Start the program.2. Load the first data in AX register.3. Load the second data in BX register.

    4. Clear CL register.5. Add the two data and get sum in AX register.6. Store sum in memory.7. Check for carry.8. Increment CL register.9. Stores carry in memory.10.Stop.

  • 7/30/2019 MP and MC Record

    37/102

    FLOWCHART:

    Load the first data in AXregister

    Load the second data in

    Bx register

    Clear CL register

    Is

    CF=

    Store carry in memory

    Increment CL

    YES

    NO

    Start

    Sto

  • 7/30/2019 MP and MC Record

    38/102

    PROGRAM FOR 16 BIT ADDITIONS IN 8086:

    Memory

    Address

    Hex.

    Code

    Mnemonic Instruction Comments

    Label Opcode Operand

    1000 C7 START MOV AX ,#1234 Load the data in AX reg

    1001 C0

    1002 34

    1003 12

    1004 C7 MOV BX,#5678 Load the data in BX reg

    1005 C3

    1006 78

    1007 56

    1008 01 ADD AX,BX Add two data and get sum inAX reg1009 D8

    100A 89 MOV [1200],AX Move the sum value to memory

    100B 06

    100C 02

    100D 11

    100E F4 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    39/102

    B. ALGORITHM FOR 16 BIT SUBTRACTIONS:

    1. Start the program.2. Load the minuend in AX register.3. Get the subtrahend in BX register.4. Clear CL register to account for sign.5. Subtract the content of BX from AX.6. Check for carry. If cy=1 go to next step.7. Increment CL register.8. Store the sign bit in memory.9. Stop.

  • 7/30/2019 MP and MC Record

    40/102

    FLOWCHART:

    Get minuend in AXregister

    Get subtrahend in BX

    register

    Clear CL register

    Is

    CF=

    Store difference in

    memory

    Increment CL

    YES

    NO Complement AX

    Add 01 to AX

    Store

    Start

    Sto

  • 7/30/2019 MP and MC Record

    41/102

    PROGRAM FOR 16 BIT SUBTRACTIONS IN 8086:

    Memory

    Address

    Hex.

    Code

    Mnemonic Instruction Comments

    Label Opcode Operand

    1000 C7 START MOV AX ,#1234 Load the data in AX reg

    1001 C0

    1002 34

    1003 12

    1004 C7 MOV BX,#5678 Load the data in BX reg

    1005 C3

    1006 78

    1007 56

    1008 01 ADD AX,BX Add two data and get sum in

    AX reg1009 D8

    100A 89 MOV [1200],AX Move the sum value to

    memory100B 06

    100C 02

    100D 11

    100E F4 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    42/102

    C. ALGORITHM FOR 32 BIT MULTIPLICATIONS:

    1. Load address of data in BX register2. Clear CX register to account for carry3. Get D1LW in AX & D2 LW in BP4. Multiply MX&BP to get product1 in AX&BX5. Save P1UW in SI register6. Get D1UW in AX register7. Multiply AX&BP to get product2 in AX&DX8. Check for array9. Increment CX10.Save P2UW in DI register11.Multiply AX&BP12.Add P3LW to SI register13.Add CX & P3LW14.Clear CX register15.Check for carry16.Increment CX register17.Save third & fourth word of product in memory18.Stop

  • 7/30/2019 MP and MC Record

    43/102

    FLOWCHART:

    Save P1LW in SI

    Get P1UW in

    Add D2 LW to SI

    `

    Multiply AX & BP

    Load the address of data

    in BX register

    Get D1 LW in AX

    register

    Start

    Get D2 LW in

    BP

    Save AX

    A

  • 7/30/2019 MP and MC Record

    44/102

    Is

    Increment CX

    Save P2

    in DI

    Get D2UW in

    Add P3LW to SI

    Is

    CF=1

    Increment CX

    Add CX & P3UW

    Clear CX

    Save SI as

    Multiply AX & BX

  • 7/30/2019 MP and MC Record

    45/102

    Multiply AX & BP to get

    Add DI & AX to get third

    Add CX previous carry to get fourth

    product of final product

    Get D1UW in

    Stop

    Save the data

  • 7/30/2019 MP and MC Record

    46/102

    PROGRAM FOR 32 BIT MULTIPLICATION IN 8086

    Memory

    Address

    Hex.code Mnemonic Instruction Comments

    Label Opcode

    1000 C7 START MOV AX,#0004H Move the data in reg AX

    1001 C01002 04

    1003 00

    1004 C7 MOV BX,#0005H Move the data in reg BX

    1005 C3

    1006 05

    1007 00

    1008 F7 MUL BX Multiply AX and BX

    1009 E3

    100A 89 MOV [1102],AX Load the data from AX reg

    to address100B 06

    100C 02100D 11

    100E 89 MOV [1104],BX Load the data from BX reg

    to address100F 16

    1010 04

    1011 11

    1012 F4 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    47/102

    D. ALGORITHM FORDIVISION OF 32 BIT DATA BY 16 BIT DATA :

    1. Load the address of data in SI register.2. Get lower word of dividend in AX register.3. Get upper word of dividend in DX register.4. Get divisor in BX register.5. Perform division to get quotient in AX and divider in DX.6. Save quotient and remainder.7. Stop.

    FLOWCHART

    Get lower word of

    dividend in AX register

    Get upper word of

    dividend in DX register

    Divide AX and DX with BX

    Save quotient in

    Save remainder in

    memory

    Start

    Sto

  • 7/30/2019 MP and MC Record

    48/102

    PROGRAM FOR DIVISION OF 32 BIT BY 16 BIT DATA :

    Exp no: 7

    Date :

    MemoryAddress

    Hex.code Mnemonic Instruction CommentsLabel Instruction

    1000 C7 START MOV AX,#0004H Move the data in reg AX

    1001 C0

    1002 04

    1003 00

    1004 C7 MOV BX,#0005H Move the data in reg BX

    1005 C3

    1006 05

    1007 00

    1008 F7 MUL BX Multiply AX and BX

    1009 E3

    100A 89 MOV [1102],AX Load the data from AX reg

    to address100B 06

    100C 02

    100D 11

    100E 89 MOV [1104],BX Load the data from BX reg

    to address100F 16

    1010 04

    1011 11

    1012 F4 STOP HLT Halt the process

  • 7/30/2019 MP and MC Record

    49/102

    PROGRAM WITH 8086 CONTROL INSTRUCTIONS

    AIM:To write an assembly language program for the below given instructions using 8086

    microprocessor kit.

    A. Maximum/MinimumB. Code conversion

    APPRATUS REQUIRED:

    S.NO NAME OF ITEMS QUANTITY

    1.

    2.

    8086-Microprocessor kit

    Power supply

    1

    A. ALGORITHM FOR MINIMUM NUMBERS IN AN ARRAY:

    1. Start2. Load starting address of array in SI register3. Load number of byte in array in CL register4. Increment array pointer5. Get first byte of array in AL register6. Decrement byte count

    7. Increment array pointer8. Get next byte in BL register9. Compare AL and BL10.Checks carry flag11.Move BL and AL12.Check zero flag13.Save smallest data14.Stop

  • 7/30/2019 MP and MC Record

    50/102

    FLOWCHART:

    Start

    Load address of array inSI register

    Load address of result

    in DI register

    Set CL as byte count

    Increment array pointer

    Decrement byte count

    Increment array pointer

    Get byte in BL register

    Get first byte of array in AL

    register

    Compare al and BL register

    Is

    A

    B

    C

    YES

    NO

  • 7/30/2019 MP and MC Record

    51/102

    A

    Move BL and AL

    Decrement CL

    IS

    Store AL in memory

    Stop

    B

    C

    NO

    YES

  • 7/30/2019 MP and MC Record

    52/102

    PROGRAM FOR SEARCHING OF MINIMUM NUMBER IN AN ARRAY

    Memory

    Address

    Hex.

    Code

    Mnemonic InstructionComments

    Label Opcode Operand

    1000 BE MOV SI,1100 set SI register as

    1001 11 pointer

    1002 00

    1003 BF MOV DI,1200 set DI register as

    1004 12 pointer for result

    1005 00

    1006 8A MOV CL,[SI]

    1007 0C

    1008 46 INC SI increment address

    1009 84 MOV AL,[SI] pointer

    100A 04

    100B FE DEC CL

    100C C9

    100D 46 AGAIN INC SI makes SI to point to

    100E 8A MOV BL,[SI] next data

    100F 1C get next data in BL

    1010 3A CMP AL,BL register

    1011 C3

    1012 72 JC AHEAD if cy=1 then AL is

    1013 02 less than BL

    1014 8A MOV AL,BL

    1015 C3

    1016 FE AHEAD DEC CL decrement count

    1017 C9

    1018 75 JNC AGAIN if count is not zero

    1019 F3 repeat search101A 88 MOV [DI],A store smallest data

    101B 05 in memory

    101C F4 HLT

  • 7/30/2019 MP and MC Record

    53/102

    B. ALGORITHM FOR MAXIMUM NUMBER IN AN ARRAY

    1. Start2. Load the starting address of array in SI register3. Load the address of result in DI register4. Load number of bytes in the array in CL register5. Increment array pointer6. Get first byte of array in AL register7. Get next byte of array in BL register8. Checks carry flag9. Move BL and AL10.Decrement byte count11.Check zero flag12.Store largest data13.Stop

  • 7/30/2019 MP and MC Record

    54/102

    FLOW CHART:

    Start

    Set CL as byte count

    Increment array pointer

    Set SI register as array pointer

    Set DI register as result pointer

    Decrement byte count

    B

    Get the first byte of

    array in AL register

    Decrement the byte count

    Get the next byte of array in

    BL

    Compare AL AND BL register

    iscf=0

    YES

    NO

    A

    C

  • 7/30/2019 MP and MC Record

    55/102

    IS

    STORE AL IN MEMORY

    STOP

    B

    NO

    YES

    DECREMENT BYTE COUNT

    MOVE BL AD AL

    A

    C

  • 7/30/2019 MP and MC Record

    56/102

    PROGRAM FOR SEARCHING OF MAXIMUM NUMBER IN AN ARRAY

    Memory

    Address

    Hex.

    Code

    Mnemonic InstructionComments

    Label Opcode Operand

    1000 BE START MOV SI,1100 set SI register as

    1001 11 pointer

    1002 00

    1003 BF MOV DI,1200 set DI register as

    1004 12 pointer for result

    1005 00

    1006 8A MOV CL,[SI] set CL as count for

    1007 0C element

    1008 46 INC SI increment address

    1009 84 MOV AL,[SI] pointer

    100A 04

    100B FE DEC CL

    100C C9

    100D 46 AGAIN INC SI makes SI to point to

    100E 8A MOV BL,[SI] next data

    100F 1C get next data in BL

    1010 3A CMP AL,BL register

    1011 C3

    1012 72 JNC AHEAD if cy=1 then BL as

    1013 02 current largest

    1014 8A MOV AL,BL

    1015 C3

    1016 FE AHEAD DEC CL decrement count

    1017 C9

    1018 75 JNC AGAIN if count is not zero

    1019 F3 repeat search101A 88 MOV [DI],AL store largest data

    101B 05 in memory

    101C F4 HLT

  • 7/30/2019 MP and MC Record

    57/102

    Exp no:8 STRING MANIPULATION

    AIM:To write and execute a program to perform the string manipulation multibyte addition using

    8086 microprocessor.

    APPARATUS REQUIRED:

    S. NO Apparatus required Quantity

    1. 8086 microprocessor kit 1

    2. Power supply 1

    ALGORITHM:

    1. XOR the BX register with AX register.

    2. XOR the BX register with BX register.

    3. Move the data 05 to CL register.

    4. Move the content of 1200 to SI register.

    5. Move the content of SI register to BL register.

    6. Add the content of BX register with AX register and the result is stored in AX register.

    7. Execute the loop1 instruction.8. Move the AX register to SI register.

    9. Stop the program.

  • 7/30/2019 MP and MC Record

    58/102

    FLOW CHART:

    YES

    NO

    XOR the content of BX register

    with BX register

    Move the 05 value to CL

    Move the content of 1200 to SI

    register

    Move the content of SI to BLregister

    Increment the SI value

    LOOP

    START

    XOR the content of BX register

    with AX register

    A

  • 7/30/2019 MP and MC Record

    59/102

  • 7/30/2019 MP and MC Record

    60/102

    PROGRAM:

    ADDRESS OPCODE LABEL INSTRUCTION OPERAND COMMENTS

    1000 31,CD XOR AX,BX XOR the content of AXregister with BX register

    1002 31,0B XOR BX,BX XOR the content of BXregister with BX register

    1004 C6,C1,05 MOV CL,05 Move the data 05 to CL

    register

    1007 C7,C6,00,12 MOV SI,1200 Move the content of1200 to SI register

    100B 8A,1C LOOP 1 MOV BL,[SI] Move the content of SI

    register to BL register100D 01,08 ADD AX,BX Add the content of BX

    register with AX

    register

    100F 46 INC SI Increment SI register

    1010 F2,F9 LOOP LOOP 1 Go to loop 1

    1012 89,04 MOV [SI],AX Move the content of AX

    register to SI register

    1014 F4 HLT Stop the program

  • 7/30/2019 MP and MC Record

    61/102

    Exp no:9 EVEN OR ODD

    AIM:

    To write and execute an assembly language for finding whether the given number is even or

    odd.

    APPARATUS REQUIRED:

    S.NO APPARATUS REQUIRED QUANTITY

    1 8086 Microprocessor kit 1

    2 Power supply 1

    ALGORITHM:

    1. Start the program.

    2. Clear the CX register.

    3. Clear the D register.

    4. Move the content 06 to CL register.

    5. Move the content 1300 to SI register.

    6. Move the SI value to AL register.

    7. Shift AL register by one.

    8. Jump if carry to LI.

    9. Increments BL register value.

    10. Jump to loop 2.

    11. Increment DL value.12. Increment SI value.

    13. Go to loop 3.

    14. Move the content from DL to SI and BL to SI.

    15. Increment SI value.

    16. Stop the program.

  • 7/30/2019 MP and MC Record

    62/102

    FLOW CHART:

    Start

    Clear the CX register

    Clear the DL register

    Clear the BL register

    Move the data 06 to CL

    Move the content of 1300 to

    SI register

    Move the SI value to AL

    register

    B

    A

  • 7/30/2019 MP and MC Record

    63/102

    YES

    NO

    YES

    NO

    Increment the BL register

    Increment the DL value

    Increment the SI value

    Jump

    carr

    Jump if

    carr

    A

    D

    D

    Loop

    C

    B

  • 7/30/2019 MP and MC Record

    64/102

    Increment the SI value

    Move the content of DL to (SI)

    Move the content of BL to (SI)

    Stop

    C

  • 7/30/2019 MP and MC Record

    65/102

    PROGRAM:

    ADDRESS OPCODE LABEL INSTRUCTION OPERAND COMMENT

    1000 C7,C1,00,00 MOV CX,00 Clear the CX register

    1004 C6,C2,00 MOV DL,00 Clear the DL register

    1007 C6,C3,00 MOV CL,06 Move the data 06 to CLregister

    100A C6,C1,06 MOV SI,1300 Move the content of 1300 SI register

    100E C7,C6,06,13 L3 MOV AL,[SI] Move the content of SI to

    AL register

    1010 D2,EB SHR AL Shift AL register by one

    1012 72,05 JC 101C Jump if carry to L2

    1014 FE,C3 INC BL Increment BL register by o

    1016 E9,1E,10 JMP 101B Jump to L11019 FF,C2 INC DL Increment DL by one

    101B 46 L1 INC SI Increment SI value

    101C E2,FO L2 LOOP 100E Go to loop 3

    101E 88,14 MOV [SI],DL Move the content DL to SI

    1020 46 INC SI Increment SI value

    1021 88,1C MOV [SI],DL Move the content DI to SI

    1023 F4 HLT Stop the program

  • 7/30/2019 MP and MC Record

    66/102

    Exp no: 10

    Date :

    PROGRAMMING FOR 8 BIT ARITHMETIC OPERATION USING 8051

    AIM:

    To write an assembly language program for 8- bit addition, subtraction, multiplication and

    division using 8051.

    APPARATUS REQUIRED:

    1. 8051 microcontroller2. Power supply

    ALGORITHM FOR 8 BIT ADDITIONS:

    1. Start the program2. Get the 1st operand in accumulator3. Add 2nd operand with 1st operand in accumulator4. Move data from accumulator to data pointer5. Store the result in memory6. Stop

    FLOW CHART:

    Get the 1st operand

    in A

    Add the immediate data with content of A

    register

    Store the result in memory

    Sto

    Start

  • 7/30/2019 MP and MC Record

    67/102

    PROGRAM FOR 8-BIT ADDITION OF 8051

    Memory

    AddressHex. Code

    Mnemonic InstructionComments

    Label Opcode Operand

    4100 74 MOV A,#34 Get 1st operand in A register

    4101 34

    4102 24 ADD A,#62 Add operand in A register

    4103 62

    4104 90 MOV DPTR,#4500

    4105 45

    4106 004107 F0 MOV X@DPTR,A Store the result in memory

    4108 80 SJMP 4108

    4109 FE

  • 7/30/2019 MP and MC Record

    68/102

    ALGORITHM 8 BIT SUBTRACTION IN 8051:

    1. Start the program2. Get the 1st operand in accumulator3. Subtract 2nd operand from 1st operand in accumulator4. Move data from accumulator to data pointer5. Store the result in memory6. Stop

    FLOWCHART:

    Get the 1st operand in A

    re ister

    Subtract 2nd operand from A

    Store the result in memory

    Start

    Stop

  • 7/30/2019 MP and MC Record

    69/102

    PROGRAM FOR 8-BIT SUBTRACTION OF 8051:

    Memory

    Address Hex. Code

    Mnemonic Instruction

    CommentsLabel Opcode Operand

    4100 74 MOV A,#12 Get 1st operand in A register

    4101 12

    4102 94 SUBB A,#08 Subtract 2nd

    operand from

    4103 68 accumulator

    4104 90 MOV DPTR,#4500 Move to data pointer

    4105 45

    4106 00

    4107 F0 MOV X@DPTR,A Store the result in memory

    4108 80 SJMP 4108

    4109 FE

    ALGORITHM FOR MULTIPLICATION:

    1. Start the program2. Get the two numbers3. Multiply two numbers4. Store the result5. Stop the program

  • 7/30/2019 MP and MC Record

    70/102

    FLOW CHART FOR MULTIPLICATION

    PROGRAM FOR MULTIPLICATION:

    ADDRESS LABEL MNEMONICS OPCODE

    4100 START MOV A,#04 74,04

    4102 MOV B,# 02 75, F0,02

    4105 MUL A,B A4

    4106 MOV DPTR,#4500 90,45,00

    4109 MOVX @ DPTR,A F0

    410A INC DPTR A3

    410B MOV A ,B E5,F0

    410D MOV X,@DPTR,A F0

    410E HERE SJMP HERE 80, FE

    Start

    Get the

    Multiply two numbers

    Store the

    Sto

  • 7/30/2019 MP and MC Record

    71/102

    ALGORITHM FOR DIVISION:

    1. Start the program2. Get the two numbers3. Divide two numbers4. Store the result5. Stop the program

    FLOW CHART FOR DIVISION:

    Start

    Get two inputs

    Divide

    two

    Store the

    results

    Sto

  • 7/30/2019 MP and MC Record

    72/102

  • 7/30/2019 MP and MC Record

    73/102

    Exp no :11

    Date:

    1S AND 2S COMPLEMENT USING 8051

    AIM:

    To write an assembly language program for 1s and 2s complement using 8051.

    ALGORITHM:

    1. Start the program.

    2. Move the value to a register.

    3. Compliment the value of a register.

    4. The result is stored in the address of 4500.

    5. Move the content of a to DPTR.

    6. Increment the a value.

    7. Increment the DPTR value.

    8. Move the content of a to DPTR.

    9. Jump to the next process.

  • 7/30/2019 MP and MC Record

    74/102

    PROGRAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENTS

    4100 MOVE A, #DPTR Move the content of

    DPTR value to A4101

    4102CPL A Compliment the value of

    A

    4103MOV DPTR, #4200 Move the value from

    4200 to DPTR4104

    4105

    4106MOV X @DPTR, A Move the A value to

    DPTR

    4107INC A Increment the A Value

    4108INC DPTR Increment the DPTR

    Value

    4109MOV X @DPTR, A Move the content of A

    value to DPTR

    410ASJMP 410A Short jump

    410B

  • 7/30/2019 MP and MC Record

    75/102

    FLOW CHART:

    Start

    Get divide in A

    Get divide in B

    Divide by B

    Store result in memory

    Stop

  • 7/30/2019 MP and MC Record

    76/102

    PROGRAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENTS

    4100 MOV A, #08 Move the

    content to A

    register4101

    4102 MOV B, #02 Move the

    content to B

    register4103

    4104

    4105 DIV A,B Divide thecontent of B

    from A

  • 7/30/2019 MP and MC Record

    77/102

    Exp no: 12

    Date :

    INTERFACING AND PROGRAMMING OF STEPPER MOTOR

    CONTROL USING 8085

    AIM:To interface stepper motor with 8085.

    APPARATUS REQUIRED:

    1. 8085 microcontroller kit2. Stepper motor control kit3. Power supply

    ALGORITHM:

    1. Start the program2. Set count for four stepping sequence.3. Set control word.4. Set output data for a sequence.5. Wait for one millisecond.6. Decrement count value.7. Stop.

  • 7/30/2019 MP and MC Record

    78/102

    FLOW CHART:

    Start

    Initialize ports

    Set count for 4 stepping

    sequence

    Output data for a

    Wait for 1 millisecond

    Is

    Count=0?

    Yes

    No

  • 7/30/2019 MP and MC Record

    79/102

    PROGRAM FOR INTERFACING OF STEPPER MOTOR WITH 8085:

    Memory

    Address

    Hex.

    Code

    Mnemonic InstructionComments

    Label Opcode Operand

    4100 21 START LXI H,LOOK UP

    4101 1A

    4102 41

    4103 06 MVI B,04

    4104 04

    4105 7E REPT MOV A,M

    4106 D3 OUT 0C0H Out data

    4107 C0

    4108 11 LXI D,0303H Move immediate data4109 03

    410A 03

    410B 00 DELAY NOP

    410C 1B DCX D Decrement DE pair

    410D 7B MOV A,E

    410E B2 ORA D

    410F C2 JNZ DELAY If non zero jump to delay

    4110 0B

    4111 41

    4112 23 INX H Increment HL pair

    4113 05 DCR B Decrement B

    4114 C2 JNZ REPT If it is non zero jump to Rept

    4115 05

    4116 41

    4117 C3 JMP START Jump to start

    4118 00

    4119 41

    411A DB LOOKUP

    411B 09 To rotate in forward direction

    411C 05411D 06

    411E 0A

  • 7/30/2019 MP and MC Record

    80/102

    Exp no:13

    Date: INTERFACING 8253 TIMER WITH 8085

    AIM:

    To interface 8253 interface board to 8085 p and verify the operation of 8253 in six

    different modes.

    APPARATUS REQUIRED:

    8085 p kit, 8253 interface board, DC regulated power supply, VXT parallel bus, CRO.

    FLOW CHART:

    Stop

    Move immediately 00 to

    accumulator

    Out the (A) port

    Move immediately CC to A

    register

    Out the A port value

    Move immediately 90 to A

    Out the A port value

    Move immediately 88 to A

    re ister

    Out the A value to DAT register

    Out the A port value

    Start

  • 7/30/2019 MP and MC Record

    81/102

    PROGRAM:

    Address Opcodes Label Mnemonic Operands Comments

    4100 3E 36 START: MVI A,36 Channel 0 in mode 3

    4102 D3 CE OUT CE Send Mode control word

    4104 3E 0A MVI A,0A LSB of count

    4106 D3 C8 OUT C8 Write count to register

    4108 3E 00 MVI A,00 MSB of count

    410A D3 C8 OUT C8 Write count to register

    410C 76 HLT Stop the program

  • 7/30/2019 MP and MC Record

    82/102

    Exp no:14

    Date :

    PROGRAMMING FOR INTERFACE EXPERIMENTS

    AIM:

    To study the value of analog to digital conversion and digital to analog conversion.

    A. ADC INTERFACING WITH 8085B. DAC INTERFACING WITH 8085

    APPARATUS REQUIRED:

    1. 8085 microprocessor kit2. ADC, DAC interface card

    A. ALGORITHM FOR ADC INTERFACE:

    1. Start the program2. Initialize the count value3. Move the data immediately to the accumulator4. Store the data in specified address5. Display the data with LED glowing ON/OFF6. Stop the program

  • 7/30/2019 MP and MC Record

    83/102

    FLOWCHART:

    Start

    Initialize the value

    Set the mode for count

    Transfer the data to output address

    Check it with LED

    Stop

    Display

  • 7/30/2019 MP and MC Record

    84/102

    PROGRAM FOR ADC INTERFACE:

    Memory

    address

    Label Mnemonics Hexade

    cimal

    code

    Comments

    Op code Operand

    4100 Start MVI A,10 3E Move the data immediately to the

    accumulator

    4101 10

    4102 OUT E0 D3 Display to port

    4103 E0

    4104 MVI A,18 3E Move the data immediately to the

    accumulator

    4105 18

    4106 OUT E0 D3 Display to port

    4107 E0

    4108 MVI A,01 3E Move the data 00 immediately to

    the accumulator

    4109 01

    410A OUT D0 D3 Display to port

    410B D0

    410C XRA A AF Clear the accumulator content

    410D XRA A AF Clear the accumulator content

    410E XRA A AF Clear the accumulator content

    410F MVI A,00 3E Move the data 00 immediately to

    the accumulator4110 00

    4111 OUT D0 D3 Display to port

    4112 D0

    4113 HLT 76 Halt the program

  • 7/30/2019 MP and MC Record

    85/102

    B. ALGORITHM FOR DAC INTERFACE:

    A. SQUARE WAVE GENERATOR:B. SAW TOOTH WAVEFORMC. TRIANGULAR WAVEFORM

    A. ALGORITHM FOR SQUARE WAVE GENERATOR:

    1. Start the program2. Clear the accumulator3. Load minimum value to the accumulator

    4. Display data in output port address5. Call subroutine SQR6. Delay program SQR7. Assign first count to C register8. Assign second count to B register9. Decrement the second count10. If count is zero, decrement the count else go to step 911. If carry is zero go to step 812.Return to main program

  • 7/30/2019 MP and MC Record

    86/102

    Clear the accumulator content

    Load the data in output port

    Display the output

    Call the subroutine

    Load the maximum value in acc

    Display the data in the output

    Call the subroutine

    Delay the SQR

    Assign I count to C reg

    Assign II count to B reg

    Decrement II count

    Count=

    Decrement I count

    Count=

    Stop

    Start

  • 7/30/2019 MP and MC Record

    87/102

    PROGRAM FORSQUARE WAVE GENERATOR:

    Memory

    address

    Label Mnemonics Hexade

    cimal

    code

    Comments

    Op code Operand

    4101 MVI A,00 3E Move the data immediately to theaccumulator

    4102 00

    4103 OUT C0 D3 Display to port

    4104 C0

    4105 CALL SQR CD Call the subroutine

    4106 12

    4107 41

    4108 MVI A,FF 3E Move the data immediately to theaccumulator

    4109 FF

    410A OUT C0 D3 Display to port410B C0

    410C CALL SQR CD Call the subroutine

    410D 12

    410E 41

    410F JMP LOOP1 C3 Jump to specified location

    4110 01

    4111 41

    4112 MVI C,03 0E Move the data immediately to theaccumulator

    4113 03

    4114 MVI B,FF 06 Move the data immediately to theaccumulator

    4115 FF

    4116 DCR B 05 Decrement the B register4117 JNZ LOOP4 C2 Jump to specified location if no

    zero exists

    4118 16

    4119 41

    411A DCR C 0D Decrement the B register

    411B JNZ LOOP3 C2 Jump to specified location if nozero exists

    411C 14

    411D 41411E RET 76 Return to main program

  • 7/30/2019 MP and MC Record

    88/102

    B. ALGORITHM FOR SAW TOOTH WAVEFORM:

    1. Start the program

    2. Load initial data as accumulator3. Display the first data in output port address4. Decrement the content of accumulator5. If the data is zero jump to loop1

    FLOWCHART:

    Load the initial value in the acc

    Display the data in accumulator to output port address

    Increment the content of accumulator

    Checkthe

    data is

    Start

  • 7/30/2019 MP and MC Record

    89/102

    PROGRAM FOR SAW TOOTH WAVEFORM:

    C. ALGORITHM FOR TRIANGULAR WAVEFORM:

    1.Start the program2.Load the initial data in the accumulator3.Write the data from the accumulator to the output port address4.Increment the content of accumulator5.If zero flag is reset, jump to loop16.Move the data FF to accumulator7.Write the data from the accumulator to the output port address8.Decrement the content of accumulator9.Jump to loop3 if no zero exist

    Memory

    address

    Label Mnemonics Hexade

    cimalcode

    Comments

    Op code Operand

    4050 LOOP1 MVI A,00 3E Move the data immediatelyto the accumulator

    4051 00

    4052 LOOP2 OUT C0 D3 Write the data from A to portaddress

    4053 C0

    4054 INR A 3C Increment the Accumulator

    4055 JNZ LOOP2 C2 Jump to specified location if

    no zero occurs

    4056 52

    4057 40

    4058 JMP LOOP1 C3 Jump to specified location

    4059 50

    405A 40

  • 7/30/2019 MP and MC Record

    90/102

    FLOW CHART:

    Load the initial data to accumulator

    Dis la 1st content in out ut ort

    Initialize the 2nd content of accumulator

    If

    Dis la accumulator content in o/ ort

    Decrement 1st value

    If

    Yes

    Yes

    No

    No

    Start

  • 7/30/2019 MP and MC Record

    91/102

    PROGRAM FOR TRIANGULAR WAVEFORM:

    .

    Memory

    address

    Label Mnemonics Hexade

    cimal

    code

    Comments

    Op code Operand

    4060 LOOP3 MVI A,00 3E Move the data immediately to theaccumulator

    4061 00

    4062 LOOP1 OUT C0 D3 Write the data from A to portaddress

    4063 C0

    4064 INR A 3C Increment the Accumulator

    4065 JNZ LOOP1 C2 Jump to specified location if nozero occurs

    4066 62

    4067 40

    4068 MVI A,FF 3E Move the data immediately to theaccumulator

    4069 FF

    406A LOOP2 OUT C0 D3 Write the data from A to portaddress

    406B C0

    406C DCR A 3D Decrement the Accumulator

    406D JNZ LOOP2 C2 Jump to specified location if nozero occurs

    406E 6A

    406F 40

    4070 JMP LOOP1 C3 Jump to specified location

    4071 50

    4072 40

  • 7/30/2019 MP and MC Record

    92/102

    Exp no:15

    Date :

    PROGRAMMING FOR INTERFACE EXPERIMENTS

    AIM:To control the traffic light using 8085 microprocessor and interface of 8279

    APPARATUS REQUIRED:8085 trainer kit, 8279 interface board, DC power supply.

    B. ALGORITHM FOR INTERFACING 8279 WITH 8085 TO DISPLAY THECHARACTER C

    1. Start the program2. Get mode and display set3. By immediate address mode get value in A-register4. Count value in display5. Write content in display RAM6. Out the character7. Stop

  • 7/30/2019 MP and MC Record

    93/102

    FLOW CHART:

    Start

    Move the value in

    Clear the dis la

    Get the values of

    Out the counter value

    Stop

    Display the character

  • 7/30/2019 MP and MC Record

    94/102

    PROGRAM FOR INTERFACING OF 8279 WITH 8085:

    Memory

    AddressHex. Code

    Mnemonic InstructionComments

    Label Opcode Operand

    4100 3E MVI A,00 Mode & Display set

    4101 004102 D3 OUT C2 Out control word C2

    4103 C2

    4104 3E MVI A,CC Clear display RAM

    4105 CC

    4106 D3 OUT C2

    4107 C2

    4108 3E MVI A,90 Write display RAM

    4109 CC

    410A D3 OUT C2

    410B C2

    410C 3E MVI A,6C Display C

    410D 6C

    410E D3 OUT C0

    410F C0

    4110 3E MVI A,FF

    4111 FF

    4112 D3 OUT C0 Out the content

    4113 C0

    4114 D3 OUT C0

    4115 C0

    4116 D3 OUT C0

    4117 C0

    4118 D3 OUT C0

    4119 C0

    411A D3 OUT C0

    411B C0

    411C 76 HLT

  • 7/30/2019 MP and MC Record

    95/102

    Exp no:16

    Date: Interfacing 8251 with 8085

    AIM:

    To interface 8251 with 8085

    APPARATUS REQUIRED:

    8085 p kit, 8251 interface board, DC regulated power supply, VXT parallel bus.

    B (1).ALGORITHM FOR INTERFACING OF 8251 WITH 8085:

    1. Start the program.2. At transmitter side move the data to accumulator.3. Out the data to port CE.4. Move the data from port to A.5. AND 04 with the content of accumulator.6. If it is non zero jump on to LOP.7. REST 1.

    8. For reception move the data to accumulator.9. out data to various port.10.Input data from port.11.If it is non zero jump on to LOP1.12.AND data with accumulator.13.Store the result in 4150.14.RESET 1.

  • 7/30/2019 MP and MC Record

    96/102

    Start

    Out the data to port CE

    Out data to various Port

    RESET 1

    If

    AND 04 with the content of

    N

    In transmitter sidemove the data to

    Move the data fromport to A

    Yes

    In receiver side move

    data to accumulator

    Out data to port

    AND 02 with A

    If

    N

    Yes

    FLOW CHART:

    Store result

    Stop

  • 7/30/2019 MP and MC Record

    97/102

    PROGRAM FOR INTERFACING OF 8251 WITH 8085

    TRANSMITTER PROGRAM:

    Memory

    Address

    Hex.

    Code

    Mnemonic InstructionComments

    Label Opcode Operand

    4100 3E START MVI A,36 Move data to accumulator.

    4101 364102 D3 OUT OCE H Out the data

    4103 CE

    4104 3E MVI A,0A

    4105 0A

    4106 D3 OUT OC8 H Out the data to port

    4107 C8

    4108 3E MVI A,00 Clear accumulator

    4109 00

    410A D3 OUT OC8 H

    410B C8410C 3E MVI A,4E

    410D 4E

    410E D3 OUT OC2 H Out the data to port

    410F C2

    4110 3E MVI A,37

    4111 37

    4112 D3 OUT OC2 H

    4113 C2

    4114 DB

    4115 C2 LOP IN OC2 H Cut the data from port

    4116 E6 ANI 04 And immediate data 04 with A

    4117 04

    4118 CA JZ LOP Jump on zero to LOP

    4119 14

    411A 41

    411B 3E MVI A,41 H

    411C 41

    411D D3 OUT OC0 H

    411E CO

    411F CF RST 1 Reset

  • 7/30/2019 MP and MC Record

    98/102

    RECEIVER PROGRAM:

    Memory

    Address

    Hex.

    Code

    Mnemonic InstructionComments

    Label Opcode Operand

    4200 3E MVI A,36 Move 36 to accumulator

    4201 36

    4202 D3 OUT OCE H

    4203 CE

    4204 3E MVI A,0A

    4205 0A

    4206 D3 OUT C8 H

    4207 C8

    4208 3E MVI A,00

    4209 00

    420A D3 OUT OC8 H

    420B C8

    420C 3E MVI A,4E

    420D 4E

    420E D3 OUT OC2 H

    420F C2

    4210 3E MVI A,374211 37

    4212 D3 OUT OC2 H

    4213 C2

    4214 DB

    4215 C2 LOP1: IN OC2 H

    4216 E6 ANI 02 AND 02 with accumulator

    4217 02

    4218 CA JZ LOP1 Jump on zero to LOP 1

    4219 14

    421A 42

    421B DB IN OC0 H

  • 7/30/2019 MP and MC Record

    99/102

    Memory

    Address

    Hex.

    Code

    Mnemonic InstructionComments

    Label Opcode Operand

    421C CO

    421D 32 STA 4150 Store in 4150

    421E 50

    421F 41

    4220 CF RST 1

  • 7/30/2019 MP and MC Record

    100/102

    Exp no:17

    Date:

    INTERFACING 8255 WITH 8085

    AIM:

    To interface programmable peripheral interface 8255 with 8085 and study its

    characteristics in mode 0, mode 1 and BSR mode.

    APPARATUS REQUIRED:

    8085 p kit, 8255 interface board, DC regulated power supply, VXT parallel bus.

    I/O MODES:

    MODE 0SIMPLE I/O MODE:

    PROGRAM:

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS

    4100 START: MVI A,90 Initialize port A as

    input

    and port B as output4101

    4102 OUT C6 Send Mode Control

    Word4103

    4104 IN C0 Read from port A

    4105

    4106 OUT C2 Display the data in port

    B4107

    4108 STA 4200 Store the data readfrom port A in 4200

    4109

    410A

    410B STOP: HLT Stop the program

  • 7/30/2019 MP and MC Record

    101/102

  • 7/30/2019 MP and MC Record

    102/102

    Sub program:

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTTS

    450E JMP 4200 Go to 4200

    450F4560

    BSR MODE(Bit Set Reset mode)

    PROGRAM:

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS

    4100 START: MVI A,01 Set PC0

    4101

    4102 OUT C6 Send Mode

    Control Word41034104 MVI A,07 Set PC3

    4105

    4106 OUT C6 Send ModeControl Word4107

    4108 STOP: HLT Stop the

    program