You are on page 1of 34

MAM SCHOOL OF ENGINEERING

MAM SCHOOL OF ENGINEERING M.A.M SCHOOL OF ENGINEERING Siruganur, Trichy-621105 DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

M.A.M SCHOOL OF ENGINEERING

Siruganur, Trichy-621105

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

LAB MANUAL

Subject Code: EC1262 Subject Name: LINEAR AND DIGITAL INTEGRATED CIRCUITS LABORATORY

Year/Sem: II/IV EEE

EC1258 – MICROPROCESSOR LABORATORY LIST OF EXPERIMENTS

1.Programming with 8085:

  • (i) 8-bit Arithmetic operations-add,sub,mul,div

(ii) 16-bit Arithmetic operations-add,sub (iii) ADC and DAC with 8085

  • 2. Programming with 8086:

    • (i) 16-bit Arithmetic operations-Add, sub,mul,div

(ii) Sorting and searching using 8086 (iii) String manipulation operations:(add & sub using string instructions)

(iv)file manipulation using MASM software

  • 3. Interfacing 8085/8086 with 8255,8253:

(i)parallel communication(8255) interface with 8085 (ii)timer(8253) with 8085.(i.e square waveform generator with CRO)

  • 4. Interfacing 8085/8086 with 8279,8251:

    • (i) keyboard and display interface controller (8279) with

8086.

(ii)USART serial communication (8251) with 8086.

  • 5. 8051 Microcontroller based experiments for Control Applications:

    • (i) Arithmetic operations-(8-bit add,sub,mul,div)

(ii) logical operations-(8-bit AND,OR,COMPLEMENT) (iii)Traffic light controller interfacing with 8051. (iv) Stepper motor interfacing with 8051.

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

1. (i).a. 8 BIT DATA ADDITION

AIM:

To add two 8 bit numbers stored at consecutive memory locations.

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.

FLOW CHART:

MAM SCHOOL OF ENGINEERING 1. (i).a. 8 BIT DATA ADDITION AIM: To add two 8 bit

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

PROGRAM:

ADDRES

OPCOD

LABE

MNEMONIC

OPERAN

 

S

E

L

S

D

COMMENT

   

STAR

     

4100

T

C, 00

  • MVI Clear C reg.

4101

       

4102

     

H, 4500

  • LXI Initialize HL

4103

       

reg. to

4104

       

4500

4105

   

MOV

A, M

Transfer first data to accumulato r

4106

   

INX

H

Increment HL reg. to point next memory Location.

         

Add first

number to

4107

ADD

M

acc.

Content.

4108

   

JNC

L1

Jump to

4109

       

location if

         

result does

410A

not yield

carry.

         

Increment

410B

INR

C

C reg.

410C

 

L1

INX

H

Increment HL reg. to point next memory

         

Location.

         

Transfer

the result

410D

MOV

M, A

from acc.

to memory.

410E

   

INX

H

Increment HL reg. to point next memory Location.

410F

   

MOV

M, C

Move carry

to memory

4110

   

HLT

 

Stop the

program

OBSERVATION:

 
   

INPUT

   

OUTPUT

 

4500

 

4502

 

4501

 

4503

 

RESULT:

Thus the 8 bit numbers stored at 4500 &4501 are added and the result stored at 4502 & 4503.

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

1.(i).b. 8 BIT DATA SUBTRACTION

AIM:

FLOW CHART:

To Subtract two 8 bit numbers stored at consecutive memory locations.

ALGORITHM:

  • 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 (2’s 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.

MAM SCHOOL OF ENGINEERING 1.(i).b. 8 BIT DATA SUBTRACTION AIM: FLOW CHART: To Subtract two 8

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

PROGRAM:

 

OP

 

MNEMO

   

ADDRESS

CODE

LABEL

NICS

OPERAND

COMMENT

4100

 

START

 
  • MVI C, 00

Clear C reg.

4102

       

4102

     

H, 4500

  • LXI Initialize HL

4103

       

reg. to

4104

       

4500

4105

   

MOV

A, M

Transfer first data to accumulato r

4106

   

INX

H

Increment HL reg. to point next mem. Location.

         

Subtract

first

4107

SUB

M

number

from acc.

Content.

4108

   

JNC

L1

Jump to

4109

       

location if

         

result does

410A

not yield

borrow.

         

Increment

410B

INR

C

C reg.

410C

   

CMA

 

Compleme nt the Acc. content

410D

   

ADI

01H

Add 01H to

         

content of

410E

acc.

410F

   

L1

INX

H

Increment HL reg. to point next mem. Location.

         

Transfer

the result

  • 4110 MOV

M, A

from acc.

to memory.

   
  • 4111 INX

 

H

Increment HL reg. to point next mem. Location.

   
  • 4112 MOV

 

M, C

Move carry

to mem.

   
  • 4113 HLT

   

Stop the

program

OBSERVATION:

 
   

INPUT

   

OUTPUT

4500

   

4502

 

4501

   

4503

 

RESULT:

Thus the 8 bit numbers stored at 4500 &4501 are subtracted and the result stored at 4502 & 4503.

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

1.(i).c.8 BIT DATA MULTIPLICATION

AIM:

To multiply two 8 bit numbers stored at consecutive memory locations and store the result in memory.

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.

FLOW CHART

MAM SCHOOL OF ENGINEERING 1.(i).c.8 BIT DATA MULTIPLICATION AIM: To multiply two 8 bit numbers stored

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

MAM SCHOOL OF ENGINEERING PROGRAM: ADDRESS OP LABEL MNEM OPERAND COMMENT CODE ONICS 4100 START LXI

PROGRAM:

ADDRESS

OP

LABEL

MNEM

OPERAND

COMMENT

CODE

ONICS

4100

 

START

LXI

H, 4500

Initialize

4101

       

HL reg. to

4102

       

4500

4103

   

MOV

B, M

Transfer first data to reg. B

4104

   

INX

H

Increment HL reg. to point next mem. Location.

4105

   

MVI

A, 00H

Clear the

4106

       

acc.

4107

   

MVI

C, 00H

Clear C reg

4108

       

for carry

4109

 

L1

ADD

M

Add

multiplican

d

multiplier

times.

410A

   

JNC

NEXT

Jump to

410B

       

NEXT if

410C

       

there is no carry

410D

   

INR

C

Increment

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

         

C reg

410E

 

NEXT

DCR

B

Decrement

B reg

410F

   

JNZ

L1

Jump to L1

4110

       

if B is not

4111

       

zero.

4112

   

INX

H

Increment HL reg. to point next mem. Location.

4113

   

MOV

M, A

Transfer

the result

from acc.

to

memory.

4114

   

INX

H

Increment HL reg. to point next mem. Location.

4115

   

MOV

M, C

Transfer the result from C reg. to memory.

4116

   

HLT

 

Stop the

program

OBSERVATION:

 

INPUT

 

OUTPUT

4500

 

4502

 

4501

 

4503

 

RESULT:

Thus the 8-bit multiplication was done in 8085p using repeated addition method.

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

AIM:

1.(i).d. 8 BIT DIVISION

To divide two 8-bit numbers and store the result in memory.

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.

FLOWCHART:

MAM SCHOOL OF ENGINEERING AIM: 1.(i).d. 8 BIT DIVISION To divide two 8-bit numbers and store

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

PROGRAM:

ADDRES

OP

 

MNEMO

 

COMMEN

S

CODE

LABEL

NICS

OPERAND

T

4100

     
  • MVI Clear B

B,00

 

4101

       

reg for

quotient

4102

     

H,4500

  • LXI Initialize

4103

       

HL reg. to

4104

       

4500H

4105

   

MOV

A,M

Transfer

dividend

to acc.

4106

   

INX

H

Increment HL reg. to point next mem. Location.

4107

 

LOOP

SUB

M

Subtract

divisor

from

dividend

4108

   

INR

B

Increment

B reg

4109

   

JNC

LOOP

Jump to

410A

       

LOOP if

410B

       

result

does not

yield

borrow

410C

   

ADD

M

Add

divisor to

acc.

410D

   

DCR

B

Decremen

         

t B reg

410E

   

INX

H

Increment HL reg. to point next mem. Location.

410F

   

MOV

M,A

Transfer

the

remainde

r from

acc. to

memory.

   
  • 4110 INX

 

H

Increment HL reg. to point next mem. Location.

   
  • 4111 MOV

 

M,B

Transfer

the

quotient

from B

reg. to

memory.

   
  • 4112 HLT

   

Stop the

program

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

OBSERVATION:

S.NO

INPUT

OUTPUT

ADDRESS

DATA

ADDRESS

DATA

1

4500

 

4502

 

4501

 

4503

 

2

4500

 

4502

 
 

4501

 

4503

 

1.(ii).a. 16 BIT DATA ADDITION

AIM:

To add two 16-bit numbers stored at consecutive memory

locations.

ALGORITHM:

  • 1. Initialize memory pointer to data location.

  • 2. Get the first number from memory and store in Register pair.

  • 3. Get the second number in memory and add it to the Register pair.

  • 4. Store the sum & carry in separate memory locations.

RESULT:

Thus an ALP was written for 8-bit division using repeated subtraction method and executed using 8085p kits

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

FLOW CHART:

MAM SCHOOL OF ENGINEERING FLOW CHART: PROGRAM: ADDRES OP MNEMO S CODE LABEL NICS OPERAND COMMENT

PROGRAM:

ADDRES

OP

 

MNEMO

   

S

CODE

LABEL

NICS

OPERAND

COMMENT

4100

 

START

LHLD

8050H

Load the

4101

       

augend in

4102

       

DE pair

4103

   

XCHG

 

through HL

pair.

4104

   

LHLD

8052H

Load the

4105

       

addend in

4106

       

HL pair.

4107

   

MVI

A, 00H

Initialize

4108

       

reg. A for carry

4109

   

DAD

D

Add the contents of HL Pair with that of DE pair.

410A

   

JNC

LOOP

If there is no

410B

       

carry, go to

410C

       

the instruction labeled LOOP.

410D

   

INR

A

Otherwise

increment

reg. A

410E

 

LOOP

SHLD

8054H

Store the

410F

       

content of

4110

       

HL Pair in

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

         

8054H(LSB

of sum)

4111

   

STA

8056H

Store the

4112

       

carry in

4113

       

8056H

through

Acc.

(MSB of

sum).

4114

   

HLT

 

Stop the

program.

OBSERVATION:

Input

 

Output

Address

Data

Address

Data

4150H

 

4154H

 

4151H

 

4155H

 

4152H

 

4156H

 

4153H

     

RESULT:

Thus an ALP program for 16-bit addition was written and executed in 8085p using special instructions.

1.(ii).b. 16 BIT DATA SUBTRACTION

AIM:

To subtract two 16-bit numbers stored at consecutive memory locations.

ALGORITHM:

  • 1. Initialize memory pointer to data location.

  • 2. Get the subtrahend from memory and transfer it to register pair.

  • 3. Get the minuend from memory and store it in another register pair.

  • 4. Subtract subtrahend from minuend.

  • 5. Store the difference and borrow in different memory locations.

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

MAM SCHOOL OF ENGINEERING PROGRAM: ADDRES OPCOD LABE MNEMONIC OPERAN COMMEN S E L S D

PROGRAM:

ADDRES

OPCOD

LABE

MNEMONIC

OPERAN

COMMEN

S

E

L

S

D

 

T

4100

 

STAR

MVI

C, 00

Initialize C

T

reg.

4101

         

4102

   

LHLD

8050H

Load the subtrahen d in DE reg. Pair through HL reg. pair.

4103

         

4104

         

4105

   

XCHG

   

4106

   

LHLD

8052H

Load the minuend in HL reg. Pair.

4107

         

4108

         

4109

   

MOV

A, L

Move the content of reg. L to Acc.

410A

   

SUB

E

Subtract

the

content

of

reg. E

from that

of acc.

410B

   

MOV

L, A

Move the

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

4110 4112 4154H 4150H 4111 Data Address Data Address JNC Output Input 8504H. OBSERVATION: . execution
4110
4112
4154H
4150H
4111
Data
Address
Data
Address
JNC
Output
Input
8504H.
OBSERVATION:
.
execution
program
Store the
content
of HL pair
in
memory
location
NEXT
If there is
borrow,
go to the
instructio
n labeled
NEXT.
4151H
4155H
4152H
4156H
4153H
RESULT:
4113
4114
Thus an ALP program for subtracting two 16-bit numbers
was written and executed.
4115
INR
C
Increment
SBB
reg. C
4116
NEXT
MOV
A, C
Transfer
the
content
of reg. C
to Acc.
410C
MOV
A, H
Move the
content
of reg. H
to Acc.
4117
STA
8056H
Store the
content
of acc. to
the
memory
location
410D
content
of Acc. to
reg. L
D
Subtract
content
of reg. D
with that
of Acc.
410E
MOV
H, A
Transfer
content
of acc. to
reg. H
8506H
4118
4119
411A
HLT
Stop the
410F
SHLD
8054H

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

1.(iii).a.INTERFACING ADC WITH 8085

AIM:

To write a program to iniate ADC and to store the digital data in the memory.

MAM SCHOOL OF ENGINEERING 1.(iii).a.INTERFACING ADC WITH 8085 AIM: To write a program to iniate ADC

OBSERVATION:

Compare the data displayed at the LED’s with that stored at location 4150.

RESULT

Thus a program was initiated the ADC and the digital data was stored in memory.

MICROPROCESSSOR LAB

MAM SCHOOL OF ENGINEERING

1.(iii).b.INTERFACING DAC WITH 8085

AIM:

To interface DAC with 8085 to demonstrate the generation of square, saw tooth and triangular wave.

ALGORITHM:

  • (a) Square Wave Generation

    • 1. Load the initial value (00)to Accmulator and move it to DAC.

    • 2. Call the delay program.

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

    • 4. Call the delay program.

    • 5. Repeat Steps 2 to 5.

  • (b) Saw tooth Wave Generation

    • 1. Load the initial value (00) to Accumulator.

    • 2. Move the accumulator content to DAC.

    • 3. Increment the accumulator content by 1.

    • 4. Repeat Steps 3 and 4.

  • (c) Triangular Wave Generation

    • 1. Load the initial value (00)to Accumulator.

    • 2. Move the accumulator content to DAC.

    • 3. Increment the accumulator content by 1.

    • 4. If accumulator content is zero proceed to next step. Else go to step 3.

    • 5. Load value (FF) to Accumulator.

    • 6. Move the accumulator content to DAC.

    • 7. Decrement the accumulator content by 1.

    • 8. If accumulator content is zero go to step 2. Else go to step 7.

  • PROGRAM:

    MAM SCHOOL OF ENGINEERING 1.(iii).b.INTERFACING DAC WITH 8085 AIM: To interface DAC with 8085 to demonstrate
    MAM SCHOOL OF ENGINEERING 1.(iii).b.INTERFACING DAC WITH 8085 AIM: To interface DAC with 8085 to demonstrate

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    MAM SCHOOL OF ENGINEERING RESULT: Thus the square, triangular and saw tooth wave form were generated

    RESULT:

    Thus the square, triangular and saw tooth wave form were generated by interfacing DAC with 8085 trainer kit.

    2.(ii).a.8086 STRING MANIPULATION – SORTING

    AIM:

    To sort a group of data bytes.

    ALGORITHM:

    Place all the elements of an array named list (in the consecutive memory locations).

    Initialize two counters DX & CX with the total number of elements in the array.

    Do the following steps until the counter B reaches 0.

     

    o

    Load

    the

    first

    element

    in

    the

     

    accumulator

     
     

    o

    Do the following steps until the counter C reaches 0.

     
    • 1. Compare the accumulator content with the next element present in the next memory location. If the accumulator content is smaller go to next step; otherwise, swap the content of accumulator with the content of memory location.

    • 2. Increment the memory pointer to point to the next element.

    • 3. Decrement the counter C by 1.

     

    Stop the execution.

     

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    PROGRAM:

    DEC DX

    ASSUME CS: CODE, DS: DATA

    JNZ LOOP2

    DATA SEGMENT

    MOV AH, 4CH

    LIST DW 53H, 25H, 19H, 02H

    INT 21H

    COUNT EQU 04H

    CODE ENDS

    DATA ENDS

    END START

    CODE SEGMENT

    START:

    MOV AX, DATA

    MOV DS, AX

    MOV DX, COUNT-1

    LOOP2:

    MOV CX, DX

    MOV SI, OFFSET LIST

    AGAIN:

    MOV AX, [SI]

    CMP AX, [SI+2]

    JC LOOP1

    XCHG [SI +2], AX

    XCHG [SI], AX

    LOOP1:

    ADD SI, 02

    LOOP AGAIN

    INPUT:

    LIST: 53H, 25H, 19H, 02H

    OUTPUT:

    LIST: 02H, 19H, 25H, 53H

    RESULT:

    A group of data bytes are arranged in ascending order.

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    2.(ii).b.8086 STRING MANIPULATION

    AIM:

    SEARCH A WORD

    To search a word from a string.

    ALGORITHM:

    • 1. Load the source and destination index register with starting and the ending address respectively.

    • 2. Initialize the counter with the total number of words to be copied.

    • 3. Clear the direction flag for auto incrementing mode of transfer.

    • 4. Use the string manipulation instruction SCASW with the prefix REP to search a word from string.

    • 5. If a match is found (z=1), display 01 in destination address. Otherwise, display 00 in destination address.

    PROGRAM:

    ASSUME CS: CODE, DS: DATA

    DATA SEGMENT

    LIST DW 53H, 15H, 19H, 02H

    DEST EQU 3000H

    COUNT EQU 05H

    DATA ENDS

    CODE SEGMENT

    START:

    MOV AX, DATA

    MOV DS, AX

    MOV AX, 15H

    MOV SI, OFFSET LIST

    MOV DI, DEST

    MOV CX, COUNT

    MOV AX, 00

    CLD

    REP

    SCASW

    JZ LOOP

    MOV AX, 01

    LOOP

    MOV [DI], AX

    MOV AH, 4CH

    INT 21H

    CODE ENDS

    END START

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    INPUT:

    LIST: 53H, 15H, 19H, 02H

    OUTPUT:

    3000

    01

    RESULT:

    A word is searched and the count of number of appearances is displayed.

    2.(iv).BIOS/DOS CALLS – FILE MANIPULATION

    AIM:

    To open a file using DOS calls.

    ALGORITHM:

    • 1. Initialize the data segment, file name and the message to be displayed.

    • 2. Set the file attribute to create a file using a DOS call.

    • 3. If the file is unable t o create a file display the message

    PROGRAM:

    ASSUME CS: CODE, DS: DATA

    DATA SEGMENT

    FILENAME DB “SAMPLE.DAT”, “$”

    MSG DB 0DH, 0AH, “FILE NOT CREATED”, ODH, OAH, “$”

    DATA ENDS

    CODE SEGMENT

    START:

    MOV AX, DATA

    MOV DS, AX

    MOV DX, OFFSET FILENAME

    MOV CX, 00H

    MOV AH, 3CH

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    INT 21H

    JNC LOOP1

    MOV AX, DATA

    MOV DS, AX

    MOV DX, OFFSET MSG

    MOV AH, 09H

    INT 21H

    LOOP1 MOV AH, 4CH

    INT 21H

    CODE ENDS

    END START

    RESULT:

    A file is opened using DOS calls.

    3.(i).INTERFACING 8255 WITH 8085

    AIM:

    To interface programmable peripheral interface 8255 with

    • 8085 and study its characteristics in mode0, mode1 and BSR mode.

    PROGRAM:

    MODE 0 – SIMPLE I/O MODE:

    This mode provides simple I/O operations for each of the three ports and is suitable for synchronous data transfer. In this mode all the ports can be configured either as input or output port. Let us initialize port A as input port and port B as output port.

    ADDRES

    OP

    LABEL

    MNEM

    OPERAND

    COMMENT

    S

    CODE

    ONICS

    4100

     

    START:

    MVI

    A, 90

    Initialize

    4101

           

    port A as Input and Port B as output.

    4102

       

    OUT

    C6

    Send Mode

    4103

           

    Control

    word

    4104

       

    IN

    C0

    Read from

    4105

           

    Port A

    4106

       

    OUT

    C2

    Display the

    4107

           

    data in

    port B

    4108

       

    STA

    4200

    Store the

    4109

           

    data read

    410A

           

    from Port A

    MICROPROCESSSOR LAB

    410B HLT MAM SCHOOL OF ENGINEERING Stop the program. in 4200
    410B
    HLT
    MAM SCHOOL OF ENGINEERING
    Stop the
    program.
    in 4200

    MODE1 STROBED I/O MODE:

    In this mode, port A and port B are used as data ports and port C is used as control signals for strobed I/O data transfer. Let us initialize port A as input port in mode1

    MAIN PROGRAM:

     

    OP

     

    MNEM

    OPERAN

     

    ADDRESS

    CODE

    LABEL

    ONICS

    D

    COMMENT

    4100

     

    START:

    MVI

    A, B4

    Initialize

    4101

           

    port A as Input port in mode 1.

    4102

       

    OUT

    C6

    Send Mode

    4103

           

    Control

    word

    4104

       

    MVI

    A,09

    Set the PC4

    4105

           

    bit for INTE A

    4106

       

    OUT

    C6

    Display the

    4107

           

    data in

         

    EI

     

    port B

    4108

       

    MVI

    A,08

    Enable

    4109

           

    RST5.5

    410A

       

    SIM

     
         

    EI

     

    410B

       

    HLT

     

    Stop the

    program.

    ISR (Interrupt Service Routine)

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

    4200

     

    STA

    IN

    C0

    Read

    RT:

    from port

    4201

           

    A

    4202

       

    STA

    4500

    Store in

    4203

           

    4500.

    4204

           

    4205

       

    HLT

     

    Stop the

    program.

    Sub program:

     

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

    405E

       

    JMP

    4200

    Go to

             

    405F

           

    4200

    4060

           

    Any lines of port c can be set or reset individually without

    affecting other lines using this mode. Let us set PC0 and PC3

    bits using this mode.

     

    PROGRAM:

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

    4100

     

    STA

    MVI

    A, 01

    Set PC0

    RT:

    4101

           

    4102

       

    OUT

    C6

    Send

    4103

           

    Mode

    Control

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

             

    word

    4104

       

    MVI

    A,07

    Set PC3

    4105

           

    4106

       

    OUT

    C6

    Send

    4107

           

    Mode

    Control

    word

    4109

       

    HLT

     

    Stop the

    program.

    RESULT:

    Thus 8255 is interfaced and its characteristics in mode0,mode1 and BSR mode is studied.

    3.(ii).INTERFACING 8253 WITH 8085

    AIM:

    To interface 8253 Interface board to 8085 microprocessor and verify the operation of 8253 in six different modes.

    PROGRAM:

    Mode 0 – Interrupt on terminal count:

    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.

     

    OP

     

    MNEM

    OPERAN

     

    ADDRESS

    CODE

    LABEL

    ONICS

    D

    COMMENT

    4100

     

    START

    MVI

    A, 30

    Channel 0 in mode 0

    4102

       

    OUT

    CE

    Send Mode

    Control

    word

    4104

       

    MVI

    A, 05

    LSB of

    count

    4106

       

    OUT

    C8

    Write

    count to

    register

    4108

       

    MVI

    A, 00

    MSB of

    count

    410A

       

    OUT

    C8

    Write

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

             

    count to

    register

    410C

       

    HLT

       

    It is observed in CRO that the output of Channel 0 is initially LOW. After giving six clock pulses, the output goes HIGH.

    Mode 1 – Programmable ONE-SHOT:

    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.

     

    OP

     

    MNEM

     

    COMMEN

    ADDRESS

    CODE

    LABEL

    ONICS

    OPERAND

    T

    4100

     

    START

    MVI

    A, 32

    Channel 0 in mode 1

    4102

       

    OUT

    CE

    Send

    Mode

    Control

    word

    4104

       

    MVI

    A, 05

    LSB of

    count

    4106

       

    OUT

    C8

    Write

    count to

    register

    4108

       

    MVI

    A, 00

    MSB of

    count

    410A

       

    OUT

    C8

    Write

    count to

    register

    410C

       

    OUT

    D0

    Trigger

    Gate0

    4100

       

    HLT

       

    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.

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

    • 4100 3E

    74

    STA

    MVI

    A, 74

    Channel 1

    RT:

    in mode 2

     
    • 4102 OUT

    D3 CE

       

    CE

    Send

    Mode

    Control

    word

    • 4104 3E 0A

       

    MVI

    A, 0A

    LSB of

    count

     
    • 4106 OUT

    D3 CA

       

    CA

    Write

    count to

    register

    • 4108 3E

    00

     

    MVI

    A, 00

    MSB of

    count

    410A

    D3 CA

     

    OUT

    CA

    Write

    count to

    register

    410C

    76

     

    HLT

       

    In CRO observe simultaneously the input clock to channel 1 and the output at Out1.

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    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).

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

    • 4100 3E

    36

    STA

    MVI

    A, 36

    Channel 0

    RT:

    in mode 3

     
    • 4102 OUT

    D3 CE

       

    CE

    Send

    Mode

    Control

    word

    • 4104 3E 0A

       

    MVI

    A, 0A

    LSB of

    count

     
    • 4106 OUT

    D3 C8

       

    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

       

    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.

    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.

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

    4100

     

    STA

    MVI

    A, 36

    Channel 0

    RT:

    in mode 0

    4102

       

    OUT

    CE

    Send

    Mode

    Control

    word

    4104

       

    MVI

    A, 0A

    LSB of

    count

    4106

       

    OUT

    C8

    Write

    count to

    register

    4108

       

    MVI

    A, 00

    MSB of

    count

    410A

       

    OUT

    C8

    Write

    count to

    register

    410C

       

    MVI

    A, B8

    Channel 2 in Mode 4

    410E

       

    OUT

    CE

    Send

    Mode

    control

    Word

    4110

       

    MVI

    A, 98

    LSB of

    Count

    4112

       

    OUT

    CC

    Write

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

             

    Count to

    register

    4114

       

    MVI

    A, 3A

    MSB of

    Count

    4116

       

    OUT

    CC

    Write

    Count to

    register

    4118

       

    HLT

       

    Result:

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

    4. (i). INTEFACING 8279 KEYBOARD/DISPLAY CONTROLLER WITH 8085 MICROPROCESSOR

    AIM:

    To interface 8279 Programmable Keyboard Display Controller to 8085 Microprocessor.

    MAM SCHOOL OF ENGINEERING Count to register 4114 MVI A, 3A MSB of Count 4116 OUT

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    MAM SCHOOL OF ENGINEERING RESULT: Thus 8279 controller interfaced with 8085 and program for rolling display

    RESULT:

    Thus 8279 controller interfaced with 8085 and program for rolling display was executed successfully.

    ADDITION OF TWO 8 BIT NUMBERS

    AIM:

    To perform addition of two 8 bit numbers using 8051 instruction set.

    ALGORITHM:

    • 1. Clear C register for Carry

    • 2. Get the data immediately

    • 3. Add the two data

    • 4. Store the result in memory pointed by DPTR.

    MAM SCHOOL OF ENGINEERING RESULT: Thus 8279 controller interfaced with 8085 and program for rolling display

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    RESULT:

    Thus addition of two 8 bit numbers using 8051 instruction set was made and the output was saved in the address 4500.

    SUBTRACTION OF TWO 8 BIT NUMBERS

    AIM:

    To perform subtration of two 8 bit numbers using 8051 instruction set.

    ALGORITHM:

    • 1. Clear C register for Carry

    • 2. Get the data immediately

    • 3. Subtract the two data

    • 4. Store the result in memory pointed by DPTR.

    MAM SCHOOL OF ENGINEERING RESULT: Thus addition of two 8 bit numbers using 8051 instruction set

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    RESULT:

    Thus Subtraction of two 8 bit numbers using 8051 instruction set was made and the output was saved in the address

    4500.

    MULTIPLICATION OF TWO 8 BIT NUMBERS

    AIM:

    To perform multiplication of two 8 bit numbers using 8051 Instruction set.

    ALGORITHM:

    • 1. Get the data in A reg.

    • 2. Get the value to be multiplied in B reg.

    • 3. Multiply the two data

    • 4. The higher order of the result is in B reg.

    • 5. The lower order of the results is in A reg.

    • 6. Store the results.

    MAM SCHOOL OF ENGINEERING RESULT: Thus Subtraction of two 8 bit numbers using 8051 instruction set

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    MAM SCHOOL OF ENGINEERING RESULT: Thus Multiplication of two 8 bit numbers using 8051 instruction set

    RESULT:

    Thus Multiplication of two 8 bit numbers using 8051

    instruction set was made and the output was saved in the address

    4500.

    DIVISION OF TWO 8 BIT NUMBERS

    AIM:

    To perform division of two 8 bit numbers using 8051 instruction set.

    ALGORITHM:

    • 1. Get the data in A reg.

    • 2. Get the value to be divided in B reg.

    • 3. Divide the two data

    • 4. The quotient is in A reg.

    • 5. The remainder is in B reg.

    • 6. Store the results.

    MAM SCHOOL OF ENGINEERING RESULT: Thus Multiplication of two 8 bit numbers using 8051 instruction set

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    MAM SCHOOL OF ENGINEERING STEPPER MOTOR INTERFACING WITH 8051 AIM: To interface a Stepper Motor with

    STEPPER MOTOR INTERFACING WITH 8051

    AIM:

    To interface a Stepper Motor with 8051 microcontroller and operate it.

    PROCEDURE:

    Enter the above program starting from location 4100.and execute the same. The stepper motor rotates. Varying the count at R4 and R5 can vary the speed. Entering the data in the look-up TABLE in the reverse order can vary direction of rotation.

    PROGRAM:

    ADDRES

    OPCOD

    LABE

    MNEMONIC

    OPERAN

    COMMEN

    S

    E

    L

    S

    D

    T

         

    ORG

    4100h

     
     
    • 4100 MOV

    STAR

     

    DPTR,

    Load the

    T:

    #TABLE

    start

    address

    of

    switching

    scheme

    data

    TABLE

    into Data

    Pointer

    (DPTR)

     
    • 4103 MOV

       

    R0, #04

    Load the

    count in

    R0

     
    • 4105 MOVX

    LOOP

     

    A,

    Load the

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

       

    :

     

    @DPTR

    number in

       
    • 4112 DELA

     

    DJNZ

    R5,

     

    TABLE

    Y1:

    DELAY1

    into A

     
    • 4114 DJNZ

       

    R4,

     

    4106

       

    PUSH

    DPH

    Push

    DELAY

    DPTR

     
    • 4116 POP

       

    DPL

    POP back

    value to

    DPTR

    Stack

    value

    4108

       

    PUSH

    DPL

     

    from

    410A

       

    MOV

    DPTR,

    Load the

    Stack

    #0FFC0h

    Motor

     
    • 4118 POP

       

    DPH

     

    port

    411A

       

    INC

    DPTR

    Increment

    address

    DPTR to

    into DPTR

    point to

    410D

       

    MOVX

    @DPTR,

    Send the

    next item

    A

    value in A

    in the

    to

    table

    stepper Motor port address

    411B

       

    DJNZ

    R0, LOOP

    Decremen t R0, if not zero repeat

    410E

       

    MOV

    R4,

    Delay

    the loop

    #0FFh

    loop to

    411D

       

    SJMP

    START

    Short

    cause a

    jump to

    specific

    Start of

    amount

    the

    of time

    program

    delay

    to make

    before

    the motor

    next data

    rotate

    item is

    continuou

    sent to

    sly

    the Motor

    411F

     

    TABL

    DB

    09

    05

    Values as

    4110

     

    DELA

    MOV

    R5,

     

    E:

    06

    0Ah

    per two-

    Y:

    #0FFh

     

    phase

    MICROPROCESSSOR LAB

    MAM SCHOOL OF ENGINEERING

    switching scheme
    switching
    scheme

    RESULT:

    Thus a stepper motor was interfaced with 8051 and run in forward and reverse directions at various speeds.

    MICROPROCESSSOR LAB