ee2356 lab manual (1).doc

204
SYLLA B US EE2356 - MICROPROCESSOR AND MICRO CONTROLLER LABORATORY AIM 1. To understand programming using instruction sets of processors. 2. To study various digital & linear 8-bit Microprocessor 1. Simple arithmetic operations: Multi precision addition / subtraction / multiplication / division. 2. Programming with control instructions: Increment / Decrement, Ascending / Descending order, Maximum / Minimum of numbers, Rotate instructions - Hex / ASCII / BCD code conversions. 3. Interface Experiments: • A/D Interfacing. • D/A Interfacing. • Traffic light controller. 4. Interface Experiments: Simple experiments using 8251, 8279, 8254. 8-bit Microcontroller 5. Demonstration of basic instructions with 8051 Micro controller execution, including: • Conditional jumps, looping • Calling subroutines. • Stack parameter testing 6. Parallel port programming with 8051 using port 1 facility: - Stepper motor and D / A converter. 7. Study of Basic Digital IC’s (Verification of truth table for AND, OR, EXOR, NOT, NOR, NAND, JK FF, RS FF,D FF) 8. Implementation of Boolean Functions, Adder / Subtractor circuits. 9. Combination Logic; Adder, Subtractor, Code converters, Encoder and Decoder 10. Sequential Logic; Study of Flip- Flop,Counters(synchronous and asynchronous),Shift Registers

Upload: saravanaeee2004

Post on 01-Oct-2015

25 views

Category:

Documents


0 download

TRANSCRIPT

SYLLABUSEE2356 - MICROPROCESSOR AND MICRO CONTROLLER LABORATORYAIM1. To understand programming using instruction sets of processors.

2. To study various digital & linear

8-bit Microprocessor1. Simple arithmetic operations:

Multi precision addition / subtraction / multiplication / division.

2. Programming with control instructions:

Increment / Decrement, Ascending / Descending order, Maximum / Minimum of numbers, Rotate instructions - Hex / ASCII / BCD code conversions.

3. Interface Experiments:

A/D Interfacing.

D/A Interfacing.

Traffic light controller.

4. Interface Experiments: Simple experiments using 8251, 8279, 8254.

8-bit Microcontroller5. Demonstration of basic instructions with 8051 Micro controller execution, including:

Conditional jumps, looping

Calling subroutines.

Stack parameter testing

6. Parallel port programming with 8051 using port 1 facility:

- Stepper motor and D / A converter.

7. Study of Basic Digital ICs

(Verification of truth table for AND, OR, EXOR, NOT, NOR, NAND, JK FF, RS FF,D FF)

8. Implementation of Boolean Functions, Adder / Subtractor circuits.

9. Combination Logic; Adder, Subtractor, Code converters, Encoder and Decoder

10. Sequential Logic; Study of Flip-Flop,Counters(synchronous and asynchronous),Shift

Registers

LIST OF EXPERIMENTSEx. NoPage No.

8 BIT MICROPROCESSOR (8085)

11(a) 8- bit Addition

1(b) 8 bit Subtraction

1(c) 8- bit Multiplication

1(d) 8- bit Division

22(a) Ascending order

2(b) Descending order

2( c) Largest of a given numbers

2(d) Smallest of a given numbers

33(a) Code Conversion: ASCII to Hexadecimal

3(b) Code Conversion: Hexadecimal to ASCII

3(c) Code Conversion: Hexadecimal to Binary

3(d) Code Conversion: Hexadecimal to BCD

44(a) Interfacing: ADC with 8085

4(b)Interfacing: DAC with 8085

5Interfacing: Traffic Light Controller with 8085

66(a)Interfacing: 8251 with 8085

6(b) Interfacing: 8279 with 8085

6(c) Interfacing: 8253 with 8085

MICROCONTROLLER(8051)

77(a) Sum of elements in an array

7(b) Sum using Stack

7( c) Sum using call option

88(a) Interfacing: Stepper Motor with 8051

8(b) Interfacing: DAC with 8051

STUDY OF BASIC DIGITAL ICS

9Verification of truth table for AND, OR, EXOR,

NOT, NOR, NAND, JK FF, RS FF,D FF

10Implementation of Boolean Functions, Adder /

Subtractor circuits

11Code converters, Encoder and Decoder

12Study of Flipflops

13Counters(synchronous and asynchronous), Shift registers

14Differentiator, Integrator

15Timer IC applications

8085 MICROPROCESSOR1Ex.No: 1 SIMPLE ARITHMETIC OPERATIONSAIM:To write an assembly language program to add, subtract, multiply and divide the given data stored at two consecutive locations using 8085 microprocessor.

A. 8 BIT DATA ADDITION:ALGORITHM:1. Initialize memory pointer to data location.

2. Get the first number from memory in accumulator.

3. Get the second number and add it to the accumulator.

4. Store the answer at another memory location.2FLOW CHART:

START

[C] 00H[HL] 4500H[A] [M][HL] [HL]+1[A] [A]+[M]Is there a NOCarry ?

YES[C] [C]+1[HL] [HL]+1[M] [A][HL] [HL]+1[M] [C]STOP3

PROGRAM:ADDRESSOPCODELABELMNEMONICSOPERANDCOMMENT

4100STARTMVIC, 00Clear C reg.

4101

4102LXIH, 4500Initialize HL reg. to

4500

4103

4104

4105MOVA, MTransfer first data to

accumulator

4106INXHIncrement HL reg. to

point next memory

Location.

4107ADDMAdd first number to

acc. Content.

4108JNCL1Jump to location if result does not yield

carry.

4109

410A

410BINRCIncrement C reg.

410CL1INXHIncrement HL reg. to

point next memory

Location.

410DMOVM, ATransfer the result from

acc. to memory.

410EINXHIncrement HL reg. to

point next memory

Location.

410FMOVM, CMove carry to memory

4110HLTStop the program

4

B. 8 BIT DATA SUBTRACTIONALGORITHM:1. Initialize memory pointer to data location.

2. Get the first number from memory in accumulator.

3. Get the second number and subtract from the accumulator.

4. If the result yields a borrow, the content of the acc. is complemented and 01H is added

to it (2s complement). A register is cleared and the content of that reg. is incremented

in case there is a borrow. If there is no borrow the content of the acc. is directly taken as the result.

5. Store the answer at next memory location.5FLOW CHART:

START

[C] 00H[HL] 4500H[A] [M][HL] [HL]+1[A] [A]-[M]NOIs there a

Borrow ?YESComplement [A] Add 01H to [A]

[C] [C]+1[HL] [HL]+1[M] [A][HL] [HL]+1[M] [C]STOP6

PROGRAM:ADDRESSOPCODELABELMNEMONICSOPERANDCOMMENT

4100STARTMVIC, 00Clear C reg.

4101

4102LXIH, 4500Initialize HL reg. to

4500

4103

4104

4105MOVA, MTransfer first data to

accumulator

4106INXHIncrement HL reg. to

point next mem. Location.

4107SUBMSubtract first number

from acc. Content.

4108JNCL1Jump to location if result does not yield

borrow.

4109

410A

410BINRCIncrement C reg.

410CCMAComplement the Acc.

content

410DADI01HAdd 01H to content of

acc.

410E

410FL1INXHIncrement HL reg. to

point next mem. Location.

4110MOVM, ATransfer the result from

acc. to memory.

4111INXHIncrement HL reg. to

point next mem. Location.

4112MOVM, CMove carry to mem.

4113HLTStop the program

7

C. 8 BIT DATA MULTIPLICATION:ALGORITHM:LOGIC: Multiplication can be done by repeated addition.

1. Initialize memory pointer to data location.

2. Move multiplicand to a register.

3. Move the multiplier to another register.

4. Clear the accumulator.

5. Add multiplicand to accumulator

6. Decrement multiplier

7. Repeat step 5 till multiplier comes to zero.

8. The result, which is in the accumulator, is stored in a memory location.8FLOW CHART:

START

[HL] 4500B M[HL] [HL]+1A 00C 00[A] [A] +[M]Is there NOany carryYESC C+1B B-1NOIS B=0YESA9

A[HL] [HL]+1[M] [A][HL] [HL]+1[M] [C]STOP10

ADDRESSOPCODELABELMNEMONICSOPERANDCOMMENT

4100STARTLXIH, 4500Initialize HL reg. to

4500

4101

4102

4103MOVB, MTransfer first data to

reg. B

4104INXHIncrement HL reg. to

point next mem. Location.

4105MVIA, 00HClear the acc.

4106

4107MVIC, 00HClear C reg for carry

4108

4109L1ADDMAdd multiplicand

multiplier times.

410AJNCNEXTJump to NEXT if there

is no carry

410B

410C

410DINRCIncrement C reg

410ENEXTDCRBDecrement B reg

410FJNZL1Jump to L1 if B is not

zero.

4110

4111

4112INXHIncrement HL reg. to

point next mem. Location.

4113MOVM, ATransfer the result from

acc. to memory.

4114INXHIncrement HL reg. to

point next mem. Location.

4115MOVM, CTransfer the result from

C reg. to memory.

4116HLTStop the program

PROGRAM:11

D. 8 BIT DIVISION:ALGORITHM:LOGIC: Division is done using the method Repeated subtraction.

1. Load Divisor and Dividend

2. Subtract divisor from dividend

3. Count the number of times of subtraction which equals the quotient

4. Stop subtraction when the dividend is less than the divisor .The dividend now becomes the remainder. Otherwise go to step 2.

5. stop the program execution.12FLOWCHART:

START

B 00[HL] 4500A M[HL] [HL]+1M A-M[B] [B] +1NO IS A