Top Banner
87

Lab Manual cs2259

Nov 28, 2015

Download

Documents

This manual contains experiment list and 8085, 86 and 51 experiments
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

LOYOLA ICAM COLLEGE OF ENGINEERING AND TECHNOLOGY (LICET)

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

PREPARED BY Mr. KARTHIK. SMs. Nisha

APPROVED BY Ms. PADMAVATHY JAWAHAR

CS 2259 µPROCESSOR & µCONTROLLER LAB

Page 2: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

ANNAUNIVERSITY, CHENNAI

SYLLABUS – R2008

LIST OF EXPERIMENTS

1. Programming with 8085

2. Programming with 8086-experiments including BIOS/DOS calls: Keyboard

control, Display, File Manipulation.

3. Interfacing 8085/8086 with 8255, 8253.

4. Interfacing 8085/8086 with 8279, 8251.

5. 8051 Microcontroller based experiments for Control Applications.

6. Mini- Project

Page 3: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CONTENTS

CYCLE – I

Exp No Title Page

1 Programs for 8-bit arithmetic operations using 8085

2 Programs for 16-bit arithmetic operations using 8085

3 Programs for sorting and searching operations using

8085

4 Programs for conversion using 8085

5 Programs for 16-bit arithmetic operations using 8086

6 Programs for sorting and searching operations using

8086

7 Programs for string manipulation operations using 8086

CYCLE – II

Exp No Title Page

1 Interfacing ADC and DAC

2 Parallel communication between two microprocessor kits

using Mode 1 and Mode2 of 8255.

3 Interfacing and programming 8279

4 Interfacing and programming 8251 and 8253

5 Programming using arithmetic, logical and bit

manipulation instructions of 8051 microcontroller.

6 Interfacing and programming of stepper motor control

LAB Rules:

Page 4: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

DOs DONTs

Wear the lab coat & ID card Using mobile phones

Come with observation and record note book Bringing the bags inside the laboratory

Maintain silence inside the laboratory Scribbling on the desk

Keep observation valuated and updated Coming late to the laboratory

Page 5: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CYCLE -1

Page 6: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-A

8 – BIT ADDITION USING 8085Date:

Aim:

To Add two 8- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the first data from the memory to accumulator and move into B Register.

Load the second data from memory to accumulator.

Clear C register. Add the content of B register to accumulator.

Check for carry, if carry 1 go to step 1 else if carry 0 go to step 7.

Store the sum to memory.

Move the carry to accumulator and store in memory.

Program:

Address Label Mnemonics Op-code Comments

4100 LDA 4200H 3A 00 42 Get first data in A

4103 MOV B,A 47 Move A to B

4104 LDA 4201H 3A 01 42 Get second data in A

4107 MVI C00H 0E 00 Clear C register to account for carry

4109 ADD B 80 Get Sum in A reg

410A JNC AHEAD D2 0E 41 If CY=0 go to AHEAD

410D INR C 0C If CY=1 increment C reg

410E AHEAD STA 4202H 32 02 42 Store the sum in memory

4111 MOV A,C 79 Move C to A

4112 STA 4203H 32 03 42 Store the carry in memory

4115 HLT 76 Terminate the program

Page 7: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 8 – bit addition was implemented and verified.

Page 8: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-B

8 – BIT ADDITION USING 8085Date:

Aim:

To Subtract two 8- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the subtrahend from the memory to accumulator and move into B Register.

Load the minuend from memory to accumulator.

Clear C register to account for sign of the result.

Subtract the content of B register from the content of accumulator.

Check for carry, if carry 1 go to step 6 else if carry 0 go to step 7.

Increment C register, complement the accumulator and add 01H.

Store the difference to memory.

Move the content of C register to accumulator and store in memory

Program:

Address Label Mnemonics Op-code Comments

4100 LDA 4200H 3A 00 42 Get first data in A

4103 MOV B,A 47 Move A to B

4104 LDA 4201H 3A 01 42 Get second data in A

4107 MVI C00H 0E 00 Clear C register to account for carry

4109 SUB B 80 Get Sum in A reg

410A JNC AHEAD D2 11 41 If CY=0 go to AHEAD

410D INR C 0C If CY=1 increment C reg

410E CMA 2F Get 2’s complement of difference

410F ADI 10H C6 01 Result in A reg

4111 AHEAD STA 4202H 32 02 42 Store the sum in memory

Page 9: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

4114 MOV A,C 79 Move C to A

4115 STA 4203H 32 03 42 Store the carry in memory

4115 HLT 76 Terminate the program

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 8 – bit subtraction was implemented and verified.

Page 10: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-C

8 – BIT MULTIPLICATION USING 8085Date:

Aim:

To Multiply two 8- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the address of the first data in HL pair.

Clear C register for carry.

Clear the accumulator.

Move the first data to B register.

Increment the pointer.

Move the second data to D register.

Add the content of D register to accumulator.

Check for carry, If carry=1 go to step 9 else carry=0 go to step 10.

Increment the C register.

Decrement the B register.

Check whether count has reached zero. If ZF=0, repeat steps7 through 11 or of ZF=1 go to next step.

Program:

Address Label Mnemonics Op-code Comments

4100 LXI 4200H 21 00 42 Set pointer for data

4103 MVI C00H 0E, 00 Clear C to account for overflow

4105 XRA A AF Clear accumulator

4106 MOV B,M 46 Get first data in B reg

4107 INX H 23 Increment Memory pointer

4108 MOV D,M 56 Get second data in D reg

4109 REPT ADD D 82 reg to accumulator

Page 11: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

410A JNC AHEAD D2 0E 41 Jump on no carry

410D INR C 0C If CY=1 increment C reg

410E AHEAD DCR B 05 Store the sum in memory

410F JNZ REPT C2 09 41 Repeat addition until ZF=1

4112 INX H 23 Store the carry in memory

4113 MOV M,A 77 Store lower byte of product in memory

4114 INX H 23

4115 MOV M,C 71 Store higher byte of product in memory

4116 HLT 76 Stop

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 8 – bit multiplication was implemented and verified.

Page 12: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-D

8 – BIT DIVISION USING 8085Date:

Aim:

To Divide two 8- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the divisor in accumulator and move it to B reg. Load the dividend in accumulator. Clear C-Register to account for quotient. Check whether divisor is less than dividend. If divisor is less than dividend, go to step

8 otherwise go to next step. Subtract the content of B reg from accumulator. Increment the content of C reg, go to step 4. Store the content of accumulator in memory. Move the content of C reg to accumulator and store in memory.

Program:

Address Label Mnemonics Op-code Comments

4100 LDA 4200H 3A 00 42 Set pointer for data

4103 MOV B,A 47 Get the divisor in B reg

4104 LDA 4201H 3A 01 42 Get the dividend in A reg

4107 MVI C00H 0E 00 Clear C reg for Quotient

4109 AGAIN CMP B B8 Increment Memory pointer

410A JC STORE DA 12

41

If divisor is less than dividend go to

STORE

410D REPT SUB B 90 Subtract divisor from dividend

410E INR C 0C Increment quotient by 1 for each

subtraction

410F JMP AGAIN C3 09 41

Page 13: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

4112 STORE STA

4203H

32 03 42 Store the remainder in memory

4116 STA 4202H 32 02 42 Store the quotient in memory

4119 HLT 76

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 8 – bit division was implemented and verified.

Page 14: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-E

BCD ADDITION USING 8085Date:

Aim:

To add two BCD numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1Procedure:

Load Data 1 into accumulator. Move Accumulator contents to Register B Load Data 2 into accumulator Add the content of SP pair to HL pair. Clear register C to account for Carry Add Data 2 to Data 1 and store in Accumulator Convert the accumulator value to BCD value If carry==0 , go to step 8 else increment carry. Store Accumulator content (Result) to memory Move contents of Register C to Accumulator Terminate the program.

Program:Address Label Mnemonics Op-code Comments

4100 LDA 4200

4103 MOV B,A

4104 LDA 4201

4107 MVI C, 00

4108 ADD B

410B DAA

410E JNC Ahead

410F INR C

4112 AHEAD STA 4203

4113 MOV A,C

4114 STA 4204

4115 HLT

Page 15: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit Multiplication was implemented and verified successfully.

Page 16: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 2-A

16 – BIT ADDITION USING 8085Date:

Aim:

To add two 16- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the first data in HL register pair. Move the first data to DE reg pair. Load the second data in HL reg pair. Clear A reg for carry. Add the content of DE pair to HL pair. Check for carry. If CARRY=1, go to step 7 or if CARRY=0, go to step 8. Increment A reg to account for carry. Store the sum and carry in memory. Terminate the program.

Program:

Address Label Mnemonics Op-code Comments

4100 LHLD 4200H 2A 00 42 Get first data in HL pair

4103 XCHG EB Save first data in DE pair

4104 LHLD 4202H 2A 02 42 Get second data in HL pair

4107 XRA A AE Clear A reg for carry

4108 DAD D 19 Get the sum in HL pair

4109 JNC AHEAD D2 0D 41 If CY=0, goto AHEAD

410C INR A 3C If CY=1, increment A reg

410D AHEAD SHLD 4202H 22 04 42 Store the sum in memory

4110 STA 4206H 32 06 42 Store the carry in memory

4113 HLT 76 Terminate the program

Output Table:

Page 17: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit Addition was implemented and verified successfully.

Page 18: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 2-B

16 – BIT SUBTRACTION USING 8085Date:

Aim:

To subtract two 16- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the lower byte of subtrahend in accumulator from memory and move it to the B

reg.

Load the lower byte of minuend in accumulator from memory.

Subtract the content of B reg from the content of Accumulator.

Store the lower byte of result in memory.

Load the higher byte of subtrahend in accumulator from memory and move it to B reg.

Load the higher byte of minuend in accumulator from memory.

Subtract the content of B reg and the carry from the content of Accumulator.

Store the higher byte of result in memory.

Terminate the program.

Address Label Mnemonics Op-code Comments

4100 LDA 4202H 3A 02 42 Load the lower byte in accumulator

4103 MOV B,A 47 Move the lower byte to B reg

4104 LDA 4200H 3A 00 42 Get lower byte of minuend in A reg

4107 SUB B 90 Get difference of low bytes in A reg

4108 STA 4204H 32 04 42 Store the result in memory

410B LDA 4203H 3A 03 42 If CY=0, goto AHEAD

410E MOV B,A 47 Get higher byte of subtrahend in B reg

410F LDA 4201H 3A 01 42 Get higher byte of minuend in A reg

4112 SBB B 98 Get difference of high bytes in A reg

4113 STA 4205H 32 05 42 Store the result in memory

4114 HLT 76 Stop

Output Table:

Page 19: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit Subtraction was implemented and verified successfully.

Page 20: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 2-C

16 – BIT MULTIPLICATION USING 8085Date:

Aim:

To multiple two 16- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1Procedure:

Load the first data in HL register pair and move to SP. Load the second data in HL register pair and move to DE. Clear HL pair and clear BC pair for overflow. Add the content of SP pair to HL pair. Check for carry. If CARRY=1, go to step 6 or if CARRY=0, go to step 7. Increment BC pair. Decrement the count. Check whether count has reached zero. To check for zero of the count, move the content of E reg to A reg and logically or

with D reg. Check the zero flag if ZF=0 repeat step 5 through 11 or if ZF=1 goto next step. Store the content of HL in memory. Move the content of C to L and B to H and store HL in memory. Terminate the program.

Program:Address Label Mnemonics Op-code Comments

4100 LHLD

4200H

2A 00 42 Get first data in HL pair

4103 SPHL F9 Save first data in SP pair

4104 LHLD

4202H

2A 02 42 Get second data in HL pair

4107 XCHG EB Save Second data in DE pair

4108 LXIH 0000H 21 00 00 Clear HL pair (initial sum=0)

410B LXIB 0000H 01 00 00 Clear BC pair to account overflow

410E NEXT DAD SP 39 Add the content of SP to sum(HL)

410F JNC AHEAD 02 13 41

4112 INX B 03 If CY=1, increment BC pair.

4113 AHEAD 1B DCX D

Page 21: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

4114 MOV A,E 7B Check for zero in DE pair this is donelogically

4115 ORA D B2 OR D and E

4116 JNZ NEXT C2 0E

41

Repeat addition until count is zero

4119 SHLD 4204H 22 04 42 Store lower 16 bit of product in memory

411C MOV L,C 69

411D MOV H,B 60

411E SHLD 4206H 22 06 42 Store upper 16 bit of product in memory

4121 HLT 76 Stop

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit Multiplication was implemented and verified successfully.

Page 22: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 2-D

16 – BIT DIVISION USING 8085Date:

Aim:

To divide two 16- bit numbers using 8085

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Get the dividend and divisor. Initialize the register for quotient. Repeatedly subtract divisor from dividend till dividend becomes less than divisor. Count the number of subtraction which equals the quotient. Store the result in memory.

Program:

Page 23: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit Multiplication was implemented and verified successfully.

Page 24: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 3-A

ASCENDING ORDER USING 8085Date:

Aim:

To sort an array of data in ascending order

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the count value from memory to A register and save it in B register. Decrement B register. Set HL pair as data array address pointer. Set C register as counter for N-1 comparison. Load the data of the array in accumulator using the data address pointer. Increment the HL pair. Compare the data pointed by HL with accumulator. If carry flag is set then goto step 10 else goto next step Exchange the content of memory pointed by HL and accumulator. Decrement C reg. If zero flag is reset goto step 6 else goto next step. Decrement B reg. If zero flag is reset goto step 3 else goto next step. Terminate the program.

Program:

Address Label Mnemonics Op-

code

Comments

4100 LDA 4200H 3A 00

42

load the count value in A reg

4103 MOV B,A 47 Set count for N-1 repetition

4104 DCR B 05

4105 LOOP2 LXIH

4200H

21 00

42

Set pointer for array

4108 MOV C,M 4E Set count for N-1 comparison

4109 DCR C 0D

410A INX H 23 Increment pointer

410B LOOP1 MOV A,M 7E Get one data of array in A

Page 25: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

410C INX H 23

410D CMP M BE Compare next data with A reg

410E JC AHEAD DA 16

41

If content of A is less than memory thengoto AHEAD

4111 MOV D,M 56 If the content A is greater than the content of memory, then exchange content ofmemory pointed by HL and previouslocation

4112 MOV M,A 77

4113 DCX H 2B

4114 MOV M,D 72

4115 INX H 23

4116 AHEAD DCR C 0D

4117 JNZ LOOP1 C2 0B

41

Repeat comparison until count is zero

411A DCR B 05

411B JNZ LOOP2 C2 05

41

Repeat N-1 comparison until B count is zero.

411E HLT 76 Terminate the program.

Output Table:

Page 26: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for ascending order was implemented and verified successfully.

Page 27: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 3-B

DESCENDING ORDER USING 8085Date:

Aim:

To sort an array of data in ascending order

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the count value from memory to A register and save it in B register. Decrement B register. Set HL pair as data array address pointer. Set C register as counter for N-1 comparison. Load the data of the array in accumulator using the data address pointer. Increment the HL pair. Compare the data pointed by HL with accumulator. If carry flag is reset then goto step 10 else goto next step Exchange the content of memory pointed by HL and accumulator. Decrement C reg. If zero flag is reset goto step 6 else goto next step. Decrement B reg. If zero flag is reset goto step 3 else goto next step. Terminate the program.

Program:

Page 28: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for descending order was implemented and verified successfully.

Page 29: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 3-C

SEARCHING - SMALLEST DATADate:

Aim:

To search the smallest data in an array using 8085 microprocessor

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the address first element of array in HL reg pair Decrement B register. Move the count of B reg. Increment the pointer. Get the first data in A reg. Decrement the count. Increment the pointer. Compare the content of HL pair with A reg, If CY=1, goto step 10 else to step 9 Move the content of memory address by HL to A reg. Decrement the count. 10 If ZF=0, go to step 6 or if ZF=1 go to next step. Store the smallest data in memory. Terminate the program.

Program:

Page 30: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for searching the smallest data was implemented and verified successfully.

Page 31: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 3-C

SEARCHING - LARGEST DATADate:

Aim:

To search the largest data in an array using 8085 microprocessor

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the address first element of array in HL reg pair. Move the count of B reg. Increment the pointer. Get the first data in A reg. Decrement the count. Increment the pointer. Compare the counter of memory address by HL pair carry=0, goto step 10 else to step

9 with that of A move the content of HL to A reg. Decrement the count. If ZF=0, go to step 6 or if ZF=1 go to next step. Go to large data. Terminate the program.

Program:

Page 32: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for searching the largest data was implemented and verified successfully.

Page 33: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 4-A

CONVERSION OF 2-DIGIT BCD TO BINARY NUMBERDate:

Aim:

To convert 2 digit BCD to binary number using 8085 microprocessor

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Get the BCD data in A reg and save in E reg.

Mark the lowest nibble (units) of the BCD data in A reg.

Rotate the upper nibble to lower nibble position and save in B reg.

Clear the accumulator.

Move 0AH to C reg.

Decrement C reg. If ZF=0,go to step 6 else ZF=1, go to next step.

Save the product in B reg.

Get the BCD data in A reg from E reg and mark the upper nibble.

Add the content of A reg to product (B reg).

Store the binary value(A reg).

Terminate the program.

Program:

Page 34: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program to convert 2 digit BCD to binary was implemented and verified successfully.

Page 35: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 4-B

CONVERSION OF 2-DIGIT BCD TO BINARY NUMBERDate:

Aim:

To convert binary number to BCD using 8085 microprocessor

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Clear D and E reg to account for hundreds and tens.

Load the binary data in A reg.

Compare A reg with 64th if carry flag is set go to step 7 else go to next step.

Subtract 64th from A reg.

Increment E reg (hundreds) go to step 3

Compare the A reg with 0AH if carry flag is set go to step 1 else go to next step.

Subtract 0AH from A reg. 8 Increment D reg(tens) go to step 7.

Combine the terms to form 8 bit result.

Save the tens and hundred in memory.

Terminate the program.

Program:

Page 36: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program to convert 2 digit BCD to binary was implemented and verified successfully.

Page 37: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 4-C

CONVERSION OF 8-BIT BINARY NUMBER TO ASCII CODEDate:

Aim:

To convert binary number to ASCII code using 8085 microprocessor

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Load the given data in A reg and move to B reg.

Mark the upper nibble of binary (Hexa) data in A reg.

Call subroutine code to get ASCII code of the lower nibble and store in memory.

Move B reg to A reg and mark the lower nibble.

Rotate the upper nibble position.

Call subroutine code to get the ASCII code of upper nibble and store in memory.

Terminate the program.

Subroutine:

Compare the content of A reg with 0AH.

If CY=1 go to step 4, If CY=0 go to next step.

Add 07H to A reg.

Add 30H to A reg.

Return to main program.

Program:

Page 38: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program to convert binary into ASCII code was implemented and verified

successfully.

Page 39: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 4-D

CONVERSION OF ASCII CODE TO BINARY VALUEDate:

Aim:

To convert ASCII code to binary value using 8085 microprocessor

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 1

Procedure:

Set HL pair as pointer for ASCII array.

Set D reg as counter for number of data in the array.

Set BC pair as pointer for binary(hexa) array.

Increment HL pair and move a data of ASCII array A reg.

Call subroutine BIN to find the binary (hexa) value.

The binary (hexa) value in A reg is stored in memory.

Increment BC pair.

Decrement D reg if ZF=0 then goto step 4, If ZF=1 then stop.

Terminate the program.

Subroutine:

Subtract 30H from A reg.

Compare the content of A reg with 0AH.

If CY=1 go to step 4, If CY=0 go to next step.

Subtract 07H from A reg. 5 Return to main program.

Rough Work & Manual Calculations

Page 40: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Program:

Output Table:

Input Output

Address Data Address Data

Result:

Thus the program to convert ASCII into binary was implemented and verified successfully.

Page 41: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 5-A

16 – BIT ADDITION USING 8086Date:

Aim:

To write an assembly language program to add two 16-bit numbers using 8086.Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Data are brought to 16 bit register. The contents of the register are added and store the carry and sum. Data are added in accumulator. Add data from 1100 to 1102 Result will be stored in address data 1200. Terminate the program.

Program:

Output Table:

Input Output

Address Data Address Data

Page 42: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit addition was implemented using 8086 and verified successfully.

Page 43: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 5-B

16 – BIT SUBTRACTION USING 8086Date:

Aim:

To write an assembly language program to subtract two 16-bit numbers using 8086.Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Data are brought to 16 bit register. Initialize the address register. Data are added in accumulator. Subtract data from 1100 & 1102 Result will be stored in address 1200. Terminate the program.

Program:

Output Table:

Input Output

Address Data Address Data

Page 44: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit subtraction was implemented using 8086 and verified

successfully.

Page 45: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 5-C

16 – BIT MULTIPLICATION USING 8086Date:

Aim:

To write an assembly language program to multiply two 16-bit numbers using 8086.Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Data are brought to 16 bit register. Initialize the address register. The value of AX reg is moved since it is the highest order. Multiply the value of address data. Result will be stored in the given address. Stop the program

Program:

Page 46: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit multiplication was implemented using 8086 and verified

successfully.

Page 47: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 5-D

16 – BIT DIVISION USING 8086Date:

Aim:

To write an assembly language program to divide two 16-bit numbers using 8086.Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Get dividend into accumulator from memory Get divisor into bx register Divide ax by bx Store quotient form accumulator into memory Store remainder from dx into memory Halt

Program:

Address Label Mnemonics Op-code Comments

1000 MOV AX, [2000H]

1004 MOV BX, [2002H]

4108 DIV BX

4109 MOV [3000], AX

410D MOV [3002], DX

4111 HLT

Page 48: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program for 16-bit division was implemented using 8086 and verified successfully.

Page 49: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 6-ASEARCHING FOR A BYTE IN AN ARRAY

USING 8086Date:

Aim:

To write an assembly language program to search a byte in an array using 8086.

Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Load starting address of array in to SI reg. and initialize DI reg for result. Load the byte to be searched in DL reg. & initialize BH reg for position as 01 Get the 1st element into Accumulator AGAIN : Compare Accumulator with DL reg Check zero flag, if set go to AVAIL Update SI and Increment BL Get next element into Accumulator and compare with EOA If not zero, go to AGAIN. Initialize CX reg to zero Store result for Not Available and go to END AVAIL: Get word for available in to BL reg. Store position, address and status of search. END: Halt

Address Label Mnemonics Op-code Comments

1000 MOV SI, 2000H

1004 MOV DI, 3000H

MOV DL, [DI]

MOV BH, 01

MOV AL, [SI]

AGAIN CMP AL, DL

JZ AVAIL

INC SI

Page 50: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INC BL

MOV AL, [SI]

CMP AL, E0

JNZ AGAIN

NOTAVL MOV CX, 0000H

MOV [DI+1], CX

MOV [DI+3], CX

JMP END

AVAIL MOV BL, FF

MOV [DI+1], BX

MOV [DI+3], SI

END HLT

Output Table:

Input Output

Address Data Address Data

Page 51: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the program for searching a byte in an array was implemented using 8086 and verified

successfully.

Page 52: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 6-AASCENDING/DESCENDING ORDER USING 8086

Date:

Aim:

To sort an array of data in ascending/descending order using 8086

Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Load SI reg with pointer to array Load array length to CL & CH for two counters (CL for repetitions & CH for

comparisons) REPEAT : Get an element into accumulator NEXT: Compare with next element Check carry flag, if set go to SKIP Swap elements of array SKIP: Decrement CH and if not zero go to NEXT Decrement CL , if not zero go to REPEAT Halt

Address Label Mnemonics Op-code Comments

1000 MOV SI, 1500H

1004 MOV CL, [SI]

DEC CL

REPEAT MOV SI, 1500H

MOV CH, [SI]

DEC CH

INC SI

NEXT MOV AL, [SI]

Page 53: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

INC SI

CMP AL, [SI]

JC SKIP/JNC SKIP

XCHG AL, [SI]

XCHG AL, [SI - 1]

SKIP DEC CH

JNZ NEXT

DEC CL

JNZ REPEAT

INT 3

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Page 54: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Result:

Thus the program to sort array of data in ascending and descending order was implemented

using 8086 and verified successfully.

Page 55: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 7-A STRING MANIPULATIONBLOCK DATA TRANSFER USING 8086

Date:

Aim:

To write an assembly language program to transfer a block of data using 8086.

Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Initialize DS & ES registers Load source and destination locations to index registers. Load the block size in counter reg. Clear Direction flag for Auto- incrementing mode Copy contents from source to destination address until counter becomes zero. Halt.

Program:Address Label Mnemonics Op-code Comments

1000 MOV AX, 0000H

1004 MOV DS, AX

MOV ES, AX

MOV SI, 2001H

MOV DI, 3000H

MOV CX ,[2000H]

CLD

TRANSFER MOVSB

LOOP TRANSFER

HLT

Page 56: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Result:

Thus the program to transfer a block of data using 8086 was implemented using 8086 and

verified successfully.

Page 57: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 7-B STRING MANIPULATIONCODE CONVERSION USING 8086

Date:

Aim:

To write an assembly language program to convert decimal number to hexadecimal number using 8086.

Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Initialize BX reg with address of translation table Load source and destination address in SI & DI reg. Clear direction flag Load counter with length Get first element into AL , check whether the input is valid If invalid go to end Else translate code from table Store code Loop until counter becomes zero Halt

Program:

Address Label Mnemonics Op-code Comments

1000 MOV BX, 1200H

1004 MOV SI, 2000H

MOV DI, 3000H

CLD

MOV CX , Length

CONVERT LODSB

CMP AL, 09H

Page 58: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

JA INVALID

XLAT

STOSB

LOOP CONVERT

INT 3

INVALID MOV AL, 00

MOV [DI], AL

HLT

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Page 59: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Result:

Thus the program for code conversion using 8086 was implemented using 8086 and verified

successfully.

Page 60: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 7-C STRING MANIPULATIONFIND & REPLACE USING 8086

Date:

Aim:

To write an assembly language program to find and replace a data using 8086.

Components Required:

S. No Component Quantity1 8086 microprocessor training kit 1

Procedure:

Initialize DS & ES registers Load destination index registers. With address of string Load counter reg. Load AL with the string to be found Clear Direction flag for Auto- incrementing mode Scan for the string If found replace with the other string in AH Continue until counter cleared Halt

Program:

Address Label Mnemonics Op-code Comments

1000 MOV AX, 0000H

1004 MOV DS, AX

MOV ES, AX

MOV AL, [2001H]

MOV DI, 3000H

MOV CX ,[2000H]

CLD

LOOP 1 REPNZ SCASB

JNZ DONE

Page 61: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOV AH, [2002H]

MOV [DI – 1], AH

JMP LOOP1

DONE HLT

Output Table:

Input Output

Address Data Address Data

Rough Work & Manual Calculations

Page 62: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Result:

Thus the program to find and replace a data using 8086 was implemented using 8086

and verified successfully.

Page 63: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

END OF CYCLE I

Page 64: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CYCLE -2

Page 65: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-A DAC INTERFACING – SQUARE WAVE GENERATION

Date:

Aim:

To generate the square wave at the DAC output using 8085.

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 12 DAC Interface card 2

Procedure:

Load the initial value (00) to Accumulator and move it to DAC.

Call the delay program.

Load the final value (FF) to accumulator and move it to DAC.

Call the delay program.

Repeat the steps 2 and 4

Terminate the program.

Program:

Page 66: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the program for square wave generation was executed and verified successfully.

Page 67: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-B DAC INTERFACING - SAWTOOTH WAVE GENERATION

Date:

Aim:

To generate saw tooth waveform at the DAC output using 8085.

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 12 DAC interface Card 1

Procedure:

Load the initial value (00) to Accumulator and move it to DAC.

Move the accumulator content of DAC.

Increment the accumulator content by 1.

Repeat the steps 2 and 3

Terminate the program.

Program:

Output:

Page 68: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the program for saw tooth waveform generation was executed and verified successfully.

Page 69: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-C DAC INTERFACING - TRIANGULAR WAVE GENERATION

Date:

Aim:

To generate triangular waveform at the DAC output using 8085.

Components Required:

S. No Component Quantity1 8085 microprocessor training kit 12 DAC interface Card 1

Procedure:

Load the initial value (00) to Accumulator and move it to DAC.

Move the accumulator content of DAC. Increment the accumulator content by 1.

If accumulator content is Zero, proceed to next step else goto step 3.

Load the value (FF) to accumulator.

Move the accumulator content of DAC.

Decrement the accumulator content by 1. If Accumulator content is zero goto to step 2 else goto step 7

Terminate the program.

Program:

Page 70: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output:

Rough Work & Manual Calculations

Result:

Thus the program for triangular waveform generation was executed and verified successfully.

Page 71: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 1-D ADC INTERFACING

Date:

Aim:

To initialize the analog to digital conversion process by means of software and to execute the program which converts the analog input at channel and displays the output through the LED.Components Required:

S. No Component Quantity1 8085 microprocessor training kit 12 DAC interface Card 1

Procedure:

Move immediately the value of accumulator output.

Move immediately as another value of accumulator. EX-OR the value for 3 times.

Initialize A reg as 00.

Get the output at 00.

Terminate the program.

Program:

Output:

Page 72: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the ADC interfacing program was executed and verified successfully.

Page 73: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 2 8255 INTERFACING USING MODE ‘0’ , ‘1’, ‘2’

Date:

Aim:

To initialize port A as the input port A and port B as input in mode 0 to input the data at port A as set by input switches and the output of some data to glow the LED automatically. Components Required:

S. No Component Quantity1 8085 microprocessor training kit 12 8255 interface card 1

MODE ‘0’:

Procedure:

Start the program execution. Initialize the data A as input. Input the data at port A.

Output the data at port B.

Terminate the program.

Program:

Output:

MODE ‘1’:

Procedure:

Start the program execution.

Initialize the data A as input.

Input the data at port A.

Output the data at processor.

Page 74: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Terminate the program.

Program:

Output:

MODE ‘2’:

Procedure:

Start the program execution.

Initialize the input through processor.

Input the data and processor.

Output the data at port C.

Terminate the program.

Program:

Output:

Page 75: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the interfacing 8255 using Mode 0, 1, 2 was executed and verified successfully.

Page 76: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 3 KEYBOARD AND DISPLAY INTERFACING USING 8279

Date:

Aim:

To write an assembly language program to display the rolling message ‘ HELP US’ in the display. Components Required:

S. No Component Quantity1 8085 microprocessor training kit 12 8279 interface card 1

Procedure:

Start the program execution.

Initialize the pointer for array.

Initialize the counter for P register.

Set mode and clear display and increment display counter.

The input data given is displayed.

The data is moved to the memory.

Terminate the program.

Program:

Page 77: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Rough Work & Manual Calculations

Result:

Thus the interfacing of 8279 IC with 8085 was executed and verified successfully.

Page 78: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 4 INTERFACING 8253/8251 WITH 8085

Date:

Aim:

To interface 8253 Interface board to 8085 µp and verify the operation of 8253in six different modes.Components Required:

S. No Component Quantity1 8051 microcontroller training kit 12 8253/8251 interface 1

MODE 0 – SIMPLE I/O MODE:

The output will be initially low after mode set operations. After loading the counter, the output will be remaining low while counting and on terminal count; the output will become high, until reloaded again.

Let us set the channel 0 in mode 0. Connect the CLK 0 to the debounce circuit by changing the jumper J3 and then execute the following program. It is observed in CRO that the output of Channel 0 is initially LOW. After giving six clock pulses, the output goes HIGH.

Address Label Opcode Mnemonics Comments4100 START: MVI A, 90 Initialize port A as Input and Port B as output.4102 OUT C6 Send Mode Control word4104 IN C0 Read from Port A4106 OUT C2 Display the data in port B4108 STA 4200 Store the data read from Port A in 4200410B HLT Stop the program.

MODE1 STROBED I/O MODE:

After loading the counter, the output will remain low following the rising edge of the gate input. The output will go high on the terminal count. It is retriggerable; hence the output will remain low for the full count, after any rising edge of the gate input.

Page 79: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MODE 2 – RATE GENERATOR:

It is a simple divide by N counter. The output will be low for one period of the input clock. The period from one output pulse to the next equals the number of input counts in the count register. If the count register is reloaded between output pulses the present period will not be affected but the subsequent period will reflect the new value.

MODE 3 SQUARE WAVE GENERATOR:

It is similar to Mode 2 except that the output will remain high until one half of count and go low for the other half for even number count. If the count is odd, the output will be high for (count + 1)/2 counts. This mode is used of generating Baud rate for 8251A (USART).

Set the jumper, so that the clock 0 of 8253 is given a square wave of frequency 1.5 MHz. This program divides this PCLK by 10 and thus the output at channel 0 is 150 KHz.

Vary the frequency by varying the count. Here the maximum count is FFFF H. So, the square wave will remain high for 7FFF H counts and remain low for 7FFF H counts. Thus with the input clock frequency of 1.5 MHz, which corresponds to a period of 0.067 microseconds, the resulting square wave has an ON time of 0.02184 microseconds and an OFF time of 0.02184 microseconds.

To increase the time period of square wave, set the jumpers such that CLK2 of 8253 is connected to OUT 0. Using the above-mentioned program, output a square wave of frequency 150 KHz at channel 0. Now this is the clock to channel 2.

Page 80: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MODE 4: SOFTWARE TRIGGERED STROBE:

The output is high after mode is set and also during counting. On terminal count, the output will go low for one clock period and becomes high again. This mode can be used for interrupt generation. The following program initializes channel 2 of 8253 in mode 4.

MODE 5 HARDWARE TRIGGERED STROBE:

Counter starts counting after rising edge of trigger input and output goes low for one clock period when terminal count is reached. The counter is retriggerable.

Example: The program that follows initializes channel 0 in mode 5 and also triggers Gate 0. Connect CLK 0 to debounce circuit. Execute the program. After giving Six clock pulses, you can see using CRO, the initially HIGH output goes LOW. The output ( OUT 0 pin) goes high on the next clock pulse.

Rough Work & Manual Calculations

Page 81: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Result:

Thus the 8253 has been interfaced to 8085 µp and six different modes of 8253 have been

studied.

Page 82: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 5 8 – BIT ARITHMETIC OPERATIONS USING 8051

Date:

Aim:

To write an assembly language program to add two 8-bit numbers using 8051. Components Required:

S. No Component Quantity1 8051 microcontroller training kit 1

A. Addition:

Procedure:

C reg is to be cleared for carry.

Get the data immediately. Add the two data.

Store the result in the memory pointer.

Terminate the program.

Program:

Output:

Page 83: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

B. Subtraction:

Procedure:

C reg is to be cleared for carry.

Get the data immediately.

Subtract the two data.

Store the result in the memory pointer.

Terminate the program.

Program:

Output:

C. Multiplication:

Page 84: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output:

D. Division:

Procedure:

Get the data in A reg. Get the value to be divided in B reg. Divide the data. The Quotient is in A reg and remainder is in B reg. Terminate the program.

Program:

Output:

Result:

Thus the program for 8-bit arithmetic operations using 8051 was executed and verified successfully.

Page 85: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Exp No : 6 STEPPER MOTOR INTERFACING WITH 8051

Date:

Aim:

To write an assembly language program to rotate the motor in forward and reverse direction using 8051. Components Required:

S. No Component Quantity1 8051 microcontroller training kit 12 Stepper motor interface 13 Stepper motor 1

Procedure:

Start the program. The port and 8279 are initiated. Set the count for 4-stepping sequence. Call subroutine wait for 1ms. Decrement the counter. Count zero is checked then set the count for 4-stepping sequence else go to

initializing ports. Terminate the program.

Program:

Page 86: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Output:

Rough Work & Manual Calculations

Page 87: Lab Manual cs2259

LOYOLA – ICAM COLLEGE OF ENGINEERING

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Result:

Thus the stepper motor was rotated in forward and reverse direction using 8051.