EX.NO: 1 DATE: STUDY OF 8086 MICROPROCESSOR

72
PERIIT DEPT OF ECE 1 EX.NO: 1 DATE: STUDY OF 8086 MICROPROCESSOR Aim: To study the architecture of 8086 microprocessor Features of 8086: The 8086 is a 16-bit microprocessor the item “16 bit “means that is architecture logic unit. Internal register and most of that is architecture logic unit. Internal register and most of that is arithmetic logic unit. Internal register &most to work with 16-bit binary work. The 8086 has a 16- bit address, data bus. So, it can read data from (or) write to memory and data bus. The 8086 however has on the 8-bit data bus, so it can only read data from write data to memory and parts 8-bits at a time. The 8086 can register 16-bit i/o address hence it can occur 2^10=655236 I/O parts Segment register: Unlike 8085 the 8085 address a segment memory the complete one megabyte memory which the 8086 address is decided into 16 logical segments. each segments there contains 64kb of memory when the byte is to be transferred and the lower line of the bus in memory or I/O operations Address/status CAM/so,a18/s5,A17/s4,A10/s3) During t1 period the bus high there are four most significance line for memory operations A17/s4 A10/s3 Characteristics 0 0 Alternate stack 0 1 stack 1 0 Cycle 1 1 Data BHE/ST (bus higher enable/status); During t1 period the bus high enable signal should be used to enable data on to the most significant half of the data bus (D0+D3) BHE A0 Characteristics 0 0 Whole word 0 1 Upper byte from/to location 1 0 Lower byte from/to location 1 1 none www.vidyarthiplus.com1 of 72. Footer Page 1 of 72.

Transcript of EX.NO: 1 DATE: STUDY OF 8086 MICROPROCESSOR

PERIIT DEPT OF ECE

1

EX.NO: 1 DATE:

STUDY OF 8086 MICROPROCESSOR

Aim:

To study the architecture of 8086 microprocessor

Features of 8086:

The 8086 is a 16-bit microprocessor the item “16 bit “means that is architecture logic unit.

Internal register and most of that is architecture logic unit. Internal register and most of that is

arithmetic logic unit. Internal register &most to work with 16-bit binary work. The 8086 has a 16-

bit address, data bus. So, it can read data from (or) write to memory and data bus. The 8086

however has on the 8-bit data bus, so it can only read data from write data to memory and parts

8-bits at a time.

The 8086 can register 16-bit i/o address hence it can occur 2^10=655236 I/O parts

Segment register:

Unlike 8085 the 8085 address a segment memory the complete one megabyte memory which the

8086 address is decided into 16 logical segments. each segments there contains 64kb of memory

when the byte is to be transferred and the lower line of the bus in memory or I/O operations

Address/status CAM/so,a18/s5,A17/s4,A10/s3)

During t1 period the bus high there are four most significance line for memory operations

A17/s4 A10/s3 Characteristics 0 0 Alternate stack

0 1 stack

1 0 Cycle

1 1 Data

BHE/ST (bus higher enable/status);

During t1 period the bus high enable signal should be used to enable data on to the most

significant half of the data bus (D0+D3)

BHE A0 Characteristics

0 0 Whole word

0 1 Upper byte from/to location

1 0 Lower byte from/to location

1 1 none

www.vidyarthiplus.com1 of 72.

Footer Page 1 of 72.

PERIIT DEPT OF ECE

2

RD(read):

Read state indicates that the processor is performed a memory (or) I/O

read signal.

POINTER AND INDEX REGISTER:

The pointer IP,SP,BP(i.e)instruction base stack. Pointer usually conation

the effects with in the code(IP) and stack (BP&SP) segment. The register s1 is generated

used to store the offset of source data segment while the register.

Flag register:

x x x x O I D T S Z X AC X P X CY

X-NOT USE,T-TRAP FLAG,I-INTERUPT FLAG,D-DIRECTION FLAG,O-OVER,Z-ZERO

FLAG,P-PARITY FLAG,S-SIGN FLAG .

Trap flag:

If this flag is set the processor executes the current instruction and the

control is passed to trap interrupt position. Trap interrupt is generated after exacted of

each instruction.

Interrupt flag:

If this is set the mask able interrupt are recognized by the processor or

there are signal.

Direction flag:

This is set (or) reset during string manipulator.

Overflow flag:

This is set during addition (or) subtraction of integer number.

Pin description of 8086:

Address/data (AD15-AD0):

These lines construed the lines multiplexed with memory & I/Address

during t1 period and time.

www.vidyarthiplus.com2 of 72.

Footer Page 2 of 72.

PERIIT DEPT OF ECE

3

MN/MX:

Minimum & maximum mode. It indicates what mode the operator is to

operate.

MAX/MIN MODE PIN DESCRIPTION:

The signal s2, s1, s2 status signal.

RQ/GT0; RQ/GTI:

REQUEST STATS BAND:

The pins are used by other bus master to force the processer to release the

local bus at the end of the processor current bus cycle.

LOCK:

The output indicates that other sym bus masters are not to gain control of

the system bus with lock is actual.

MINIMUM MODE PIN DESRIPTION:

The Signals S2,S1,S0 status signals

M/I0:

This operation relates to memory (or) I/O devices

WR:

It indicates the write operation.

INTA:

Process Send Acknowledgement For The Interrupt.

ALE:

It enables the address data like to send address on the bus during time of period.

READY:

It is the acknowledge from the address memory (or) devices. That is write

complete data transfer.

www.vidyarthiplus.com3 of 72.

Footer Page 3 of 72.

PERIIT DEPT OF ECE

4

INTR:

It is a level triggered input which is sampled during the cost cycle of each

instruction to determine if the procedure should enter in to the interrupt acknowledge.

TEST INPUTS:

This is used WA1 instruction. If the TEST inputs goes lo, execution will continue. If

the TEST inputs goes low, execution will continue, else the processor remains in an idle

state.

NMI:

This is used to WAIT ins. Non masker interrupt .this is an edge triggered input.

MX/MN:

It is used for whether the processor is to operate is either minimum (or)

maximum mode.

BT/R:

This output is used to decide the direction of data flow through the transceiver.

DEN:

Data enable this serial indicate the availability of valid data over the

address/data lines.

LOCK:

the lock signals is activated by the lock prefix introduced and remains active until

the completion of the next instruction.

QS1,QS0:

Queen states. These lines give information about the states of the code-perfect

quene.

RESULT:

Thus the architecture of 8086 microprocessor was studied successfully.

www.vidyarthiplus.com4 of 72.

Footer Page 4 of 72.

PERIIT DEPT OF ECE

5

EXPT NO: 2 DATE:

16 BIT ADDITIONS USING 8086 MICROPROCESSOR

AIM:

To write a program to perform 16-bit addition using 8086 microprocessor.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 kit 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program

• AX value passes to the address 2000

• BX value passes to the address 2002

• Add the AX and BX register

• Jump on no carry

• Increment the DX register

• Halt the program

www.vidyarthiplus.com5 of 72.

Footer Page 5 of 72.

PERIIT DEPT OF ECE

6

FLOWCHART:

NO YES

PROGRAM:

PROGRAM

START

AX=[2000]

BX=[2002]

DX=0000

ADD AX,BX

IF CY==1

AX=[2004]

BX=[2006]

DX=DX+1

STOP

www.vidyarthiplus.com6 of 72.

Footer Page 6 of 72.

PERIIT DEPT OF ECE

7

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV DX, 0000H Move the value 0000 to register

1004 MOV AX,[2000] Move the value in address 2000 to AX

1008 MOV BX, [2002] Move the value in address 2002 to BX

100C ADD AX,BX Add the value in registers AX and BX

100E JNC L1 If no carry jump the loop L1

1010 INC DX Increment the DX

1011 L1 L1 : MOV [2004],AX Move the values in AX to address 2004

1015 MOV [2006], DX Move the values in DX to address 2006

1019 HLT Stop the process

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

2000 02 2004 03

2001 03 2005 07

2002 01 2006 00

2003 04 2007 00

RESULT: Thus the 16bit addition program is performed using 8086 microprocessor and the

output is executed.

INPUT OUTPUT

www.vidyarthiplus.com7 of 72.

Footer Page 7 of 72.

PERIIT DEPT OF ECE

8

EXPT NO: 2.1

DATE:

16 BIT SUBTRACTIONS USING 8086 MICROPROCESSOR

AIM:

To write a program to perform 16bit subtraction using 8086 microprocessor.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 kit 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program

• AX value passes to the address 2000

• BX value passes to the address 2002

• Sub the AX and BX register

• Jump on no carry

• Increment the DX register

• Halt the program

www.vidyarthiplus.com8 of 72.

Footer Page 8 of 72.

PERIIT DEPT OF ECE

9

FLOW CHART

NO YES

PROGRAM:

START

STOP

AX=[2000]

BX=[2002]

DX=0000

SUB AX,BX

IF CY==1

AX=[2004]

BX=[2006]

DX=DX+1

www.vidyarthiplus.com9 of 72.

Footer Page 9 of 72.

PERIIT DEPT OF ECE

10

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV DX, 0000H Move the value 0000 to DX register

1004 MOV AX,[2000] Move the value in address 2000 to AX

1008 MOV BX, [2002] Move the value in address 2002 to BX

register

100C SUB AX,BX Sub the value in registers AX,BX

100E JNC L1 If no carry jump the loop L1

1010 INC DX Increment the value in DX by 1

1011 L1 L1 : MOV [2004],AX Move the value in AX register to

address 2004

1015 MOV [2006], DX Move the value in DX register to

address 2006

1019 HLT Stop the process

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

2000 06 2004 04

2001 04 2005 03

2002 02 2006 00

2003 01 2007 00

RESULT:

Thus the 16bit subtraction program is performed using 8086 microprocessor and the

output is executed.

INPUT OUTPUT

www.vidyarthiplus.com10 of 72.

Footer Page 10 of 72.

PERIIT DEPT OF ECE

11

EXPT NO: 2.2 DATE:

16 MULTIPLICATIONS USING 8086 MICROPROCESSOR

AIM:

To write a program to perform multiplication of 16bit number using 8086

microprocessor.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program

• AX value passes to the address 1100

• BX value passes to the address 1102

• Multiply the AX and BX register

• Store the output in AX and DX register

• Halt the program

www.vidyarthiplus.com11 of 72.

Footer Page 11 of 72.

PERIIT DEPT OF ECE

12

FLOWCHART

START

AX=1100

BX=1102

MUL BX

[1200]=DX

[1202]=AX

STOP

www.vidyarthiplus.com12 of 72.

Footer Page 12 of 72.

PERIIT DEPT OF ECE

13

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AX,[1100] Move the value 1100 to AX register

1004 MOV BX,[1200] Move the value 1200 to BX register

1008 MUL BX Multiply the BX value with AX register value

100A MOV [1200],DX Move DX value to memory loction 1200

100D MOV[1202],AX Move AX value to memory loction 1202

100F HLT Stop the process

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

1100 02 1200 0c

1101 03 1201 00

1102 01 1202 02

1103 04 1203 0b

RESULT:

Thus the 16bit multiplication program is performed using 8086 microprocessor and the

output is executed.

INPUT OUTPUT

www.vidyarthiplus.com13 of 72.

Footer Page 13 of 72.

PERIIT DEPT OF ECE

14

EXPT NO: 2.3

DATE:

16 BIT DIVISIONS USING 8086 MICROPROCESSOR

AIM:

To write a program to perform division of 16bit number using 8086 microprocessor.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program

• AX value passes to the address 1100

• BX value passes to the address 1102

• Divide the AX and BX register

• Store the output in AX and DX register

• Halt the program

www.vidyarthiplus.com14 of 72.

Footer Page 14 of 72.

PERIIT DEPT OF ECE

15

FLOW CHART

START

AX=1100

BX=1102

DIV BX

[1200]=DX

[1202]=AX

STOP

www.vidyarthiplus.com15 of 72.

Footer Page 15 of 72.

PERIIT DEPT OF ECE

16

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AX,[1100] Move the value 1100 to AX register

1004 MOV BX,[1200] Move the value 1200 to BX register

1008 DIV BX Multiply the BX value with AX register value

100A MOV [1200],DX Move DX value to memory loction 1200

100D MOV[1202],AX Move AX value to memory loction 1202

100F HLT Stop the process

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

1100 66 1200 03

1101 66 1201 03

1102 22 1202 00

1103 22 1203 00

RESULT:

Thus the 16bit division program is performed using 8086 microprocessor and the output is

executed.

INPUT OUTPUT

www.vidyarthiplus.com16 of 72.

Footer Page 16 of 72.

PERIIT DEPT OF ECE

17

EXPT NO: 3 DATE:

ARRANGE THE GIVEN NUMBERS IN ASCENDING ORDER USING 8086

MICROPROCESSOR

AIM:

To write a program to arrange a given data is an ascending order using 8086.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program.

• Move 0000H to AX register.

• Move 0005H to CX and DX register.

• Move the value 2000H to the SI register.

• The address in the SI register has data which is moved to AX register.

• The AX registers value and SI+1register value is compared.

• If false then moved ahead the loop.

• AX and SI+2 are interchanged and then AX and SI.

• Then adds 0002 with the SI register and again compares with AX while looping to

label.

• If condition is true, then the conditional jumps to loop.

• There decrement DX and if jump on no zero go to the start.

• Halt the program.

www.vidyarthiplus.com17 of 72.

Footer Page 17 of 72.

PERIIT DEPT OF ECE

18

FLOWCHART:

START

AX=-0000

CX=0005

DX=0005

SI=2000

AX=SI

AX=[SI+1]

AX=[SI]

SI=SI+0001

DEC CX

IF JNZ

STOP

IF

AX>[SI+1]

YES

YES NO

NO

www.vidyarthiplus.com18 of 72.

Footer Page 18 of 72.

PERIIT DEPT OF ECE

19

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AL,00 Move 0000 value to AX register

1003 START MOV CX,0005H Move 0005 value to CX register

1007 MOV DX,0005H Move 0005 value to DX register

100B MOV SI,2000H Move 2000 to SI register

100F LABEL MOV AL,[SI] Move value in SI to AX register

1011 CMP AL ,[SI+1] Compare AX with [SI+2]

1014 JC LOOP Jump if carry to loop

1016 XCHG AL,[SI+1] Exchange AX and [SI+2]

1019 XCHG AL,[SI] Exchange AX and [SI]

101B LOOP ADD SI,0001 Add the value 0002 to SI

101F LOOP LABEL The loop over here transfers to label

1022 DEC CX At every loop DX value decremented

1023 JNZ START Jump if no zero to start

1025 HLT Stop the process

www.vidyarthiplus.com19 of 72.

Footer Page 19 of 72.

PERIIT DEPT OF ECE

20

EXECUTION TABLE:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

2000 05 2000 01

2001 03 2001 02

2002 01 2002 03

2003 02 2003 04

2004 04 2004 05

RESULT:

Thus the program to arrange the data in ascending order is done successfully.

www.vidyarthiplus.com20 of 72.

Footer Page 20 of 72.

PERIIT DEPT OF ECE

21

EXPT NO: 3.1 DATE:

ARRANGE THE GIVEN NUMBERS IN DESCENDING ORDER USING 8086

MICROPROCESSOR

AIM:

To write a program to arrange the given data in descending order using

8086.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program.

• Assign 0000 to the AX register.

• Move the value 0005 to CX and DX register.

• Pass the value 2000 to SI.

• Pass the value in SI to AX register and do SI+1.

• Compare the AX and SI+1 register values.

• If false then exchange AX and SI+1and the AX and SI register values

then add 0001 with SI.

• If true add 0001 with SI and decrement DX.

• Now again the loop is found and compare the next two value until the

DX value becomes zero.

• If JNZ is true then loop transfers to the start else program stops.

• Halt the program.

www.vidyarthiplus.com21 of 72.

Footer Page 21 of 72.

PERIIT DEPT OF ECE

22

FLOWCHART

START

AX=-0000

CX=0005

DX=0005

SI=2000

AX=SI

AX=[SI+1]

AX=[SI]

SI=SI+0001

DEC CX

IF JNZ

STOP

IF

AX>[SI+1]

NO

YES NO

YES

www.vidyarthiplus.com22 of 72.

Footer Page 22 of 72.

PERIIT DEPT OF ECE

23

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AL,00 Move 0000 to AX register

1003 START MOV DX,0005 Move 0005 to CX register

1007 MOV CX,0005 Move 0005 to DX register

100B MOV SI,2000 Move 2000 to SI register

100F LABEL MOV AL,[SI] Move values in SI to AX register

1011 CMP AL,[SI+1] Compare AX and [SI+2]

1014 JNC LOOP Jump if no carry to loop

1016 XCHG AL,[SI+1] Exchange AX and [SI+2]

1019 XCHG AL,[SI] Exchange AX and [SI]

101B LOOP ADD SI,0001 Add the value 0002 to SI

101F LOOP LABEL The loop over here transfers to label

1022 DEC DX At every loop DX value decremented

1023 JNZ START If jump no zero go to start

1025 HLT Stop the process

EXECUTION TABLE:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA 2000 06 2000 07

2001 07 2001 06

2002 02 2002 05

2003 05 2003 04

2004 04 2004 02

RESULT:

Thus the program for arranging the data in descending order is done successfully.

www.vidyarthiplus.com23 of 72.

Footer Page 23 of 72.

PERIIT DEPT OF ECE

24

EXPT NO: 3.2 DATE:

FINDING THE LARGEST NUMBER USING 8086 MICROPROCESSOR

AIM:

To write a program to find the largest number among the given data using 8086.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program.

• Pass the value 0003 to CX register.

• Move the content of specified memory location to source index.

• Move the content of source index to next location to accumulator.

• Move SI register value to AX register.

• Compare AX and [SI] register values.

• If false move SI+1 to AL.

• If true add 0001 with SI and again compare it.

• Pass the value in 2500 to AL register.

• Halt the program.

www.vidyarthiplus.com24 of 72.

Footer Page 24 of 72.

PERIIT DEPT OF ECE

25

FLOWCHART

YES NO

NO

YES

START

CX=0003H

SI=2000

AX�[SI]

AX<=[SI+1]

SI=SI+001

DEC CX

IF

Z=1

STORE THE LARGEST

VALUE

STOP

IF AX>[SI+1]

www.vidyarthiplus.com25 of 72.

Footer Page 25 of 72.

PERIIT DEPT OF ECE

26

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV CX,0003 Move 0003 to CX register

1004 MOV SI,2000 Move the value 2000 to SI registe

1008 MOV AL,[SI] Move [SI] value to ALregister

100A LABEL CMP AX,[SI+1] Compare AL with [SI+1]

100D JNC L1 Jump if no carry to L1

100F MOV AX,[SI+1] Move [SI+1] value to AX register

1012 L1 ADD SI,0001 Add 0002 to SI register

1013 LOOP LABEL The loop over here transfers to label

1015 MOV [2500],AX Move AX value to the address 2500

1019 HLT Stop the process

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

2000 45 2500 66

2001 33

2002 66

RESULT:

Thus the program to find the largest of given numbers were done successfully.

INPUT OUTPUT

www.vidyarthiplus.com26 of 72.

Footer Page 26 of 72.

PERIIT DEPT OF ECE

27

EXPT NO: 3.3 DATE:

FINDING THE SMALLEST NUMBER USING 8086 MICROPROCESSOR

AIM:

To write a program to find the smallest number among the given data using 8086.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc 1

ALGORITHM:

• Start the program.

• Pass the value 0003 to CX register.

• Move the content of specified memory location to source index.

• Move the content of source index to next location to accumulator.

• Move SI register value to AX register.

• Compare AX and [SI] register values.

• If true move SI+1 to AL.

• If false add 0001 with SI and again compare it.

• Pass the value in 2500 to AL register.

• Halt the program.

www.vidyarthiplus.com27 of 72.

Footer Page 27 of 72.

PERIIT DEPT OF ECE

28

FLOWCHART

YES NO

NO

YES

START

CX=0004H

DEC CX

SI=2000

AX�[SI]

AX<=[SI+2]

SI=SI+0002

DEC CX

IF

Z=1

STORE THE SMALLEST

VALUE

STOP

IF AX>[SI+2]

www.vidyarthiplus.com28 of 72.

Footer Page 28 of 72.

PERIIT DEPT OF ECE

29

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV CX,0003 Move 0003 to CX register

1004 MOV SI,2000 Move the value 2000 to SI registe

1008 MOV AL,[SI] Move [SI] value to ALregister

100A LABEL CMP AX,[SI+1] Compare AL with [SI+1]

100D JC L1 Jump if no carry to L1

100F MOV AX,[SI+1] Move [SI+1] value to AX register

1012 L1 ADD SI,0001 Add 0002 to SI register

1013 LOOP LABEL The loop over here transfers to label

1015 MOV [2500],AX Move AX value to the address 2500

1019 HLT Stop the process

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

2000 33 2500 33

2001 44

2002 55

RESULT:Thus the program to find the smallest of given numbers were done successfully.

INPUT OUTPUT

www.vidyarthiplus.com29 of 72.

Footer Page 29 of 72.

PERIIT DEPT OF ECE

30

EXPT NO: 4 DATE:

STRING MOVE OPERATION

AIM:

To write a program to move the given numbers using string manipulators.

ALGORITHM:

• Start the program.

• Move the memory address of input data to source index.

• Move the memory address of output data to destination index.

• Move the content FF to CX register.

• Clear the direction flag.

• Move the content from source index to destination index and repeat it until

register reaches zero.

• Halt the program.

www.vidyarthiplus.com30 of 72.

Footer Page 30 of 72.

PERIIT DEPT OF ECE

31

FLOWCHART:

SI=2000

CLEAR THE DIRECTION FLAG

IF

CX==FF

START

MOVE THE CONTENT FROM SI TO DI

STOP

YES

NO

DI=2000

MOV CX=FF

www.vidyarthiplus.com31 of 72.

Footer Page 31 of 72.

PERIIT DEPT OF ECE

32

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV SI,2000 Move the value 2000 to SI

1004 MOV DI,2000 Move the value 2000 to DI

1008 MOV CX,0FF Move the value FF to CX register

100D CLD Add the AI value

100E L1 MOVSB Move the content from SI to DI

100F LOOP L1 Store the AX in DI register

1010 HLT Stop the program

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

RESULT

Thus the program to store the numbers using string manipulation is done

successfully.

INPUT OUTPUT

www.vidyarthiplus.com32 of 72.

Footer Page 32 of 72.

PERIIT DEPT OF ECE

33

EXPT NO: 4.1 DATE:

STORE THE STRING USING STRING MANIPULATION

AIM:

T o write a program to store thef numbers using string manipulators.

ALGORITHM:

• Start the program.

• Move the memory address of input data to source index.

• Move the memory address of output data to destination index.

• Move the content 34 to accumulator.

• Clear the direction flag.

• Store the content from accumulator to destination index and repeat it until

register reaches zero.

• Halt the program.

www.vidyarthiplus.com33 of 72.

Footer Page 33 of 72.

PERIIT DEPT OF ECE

34

FLOWCHART:

SI=2000

CLEAR THE DIRECTION FLAG

IF

CX==0

START

STORE THE CONTENT FROM SI TO DI

STOP

YES

NO

DI=2000

MOV AX=34

www.vidyarthiplus.com34 of 72.

Footer Page 34 of 72.

PERIIT DEPT OF ECE

35

PROGRAM:

ADDRESS LABEL PROGRAM COMMENTS

1000 MOV SI,2000 Move the value 2000 to SI register

1004 MOV DX,2200 Move the value 2000 to DI register

1007 MOV AH,0FF Move the value FF to AH register

100B INC DX Increment the DX register

100C MOV AL,[SI] Move the content of SI TO accumulator

100E L1 INC SI Increment the SI register

100F CMP AH,AL Compare AL with AH

1011 JNZ L1 Junp when not equal to zero.

1013 MOVE[1100],DX Move the DX content to memory location 1100.

1017 HLT End the program

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

INPUT OUTPUT

www.vidyarthiplus.com35 of 72.

Footer Page 35 of 72.

PERIIT DEPT OF ECE

36

RESULT

Thus a program to store numbers using string is done successfully.

EXPT NO: 4.2

DATE:

COUNT THE VALUE OF A STRING DATA USING 8086 MICROPROCESSOR

AIM:

To write a program to find the count value of presence of a given number using 8086

microprocessor.

ALGORITHM:

• Start the program.

• Make direction flag as zero.

• Assign the values 0010, 2400, 0000, 3400 to CX, SI, DX and DI.

• Load the Ax value from SI.

• Compare AX and 1111.

• If true, increment DX.

• Then decrement CX value and check z=1.

• If true, move DX values to DI.

• If false, then load AX and compare again.

• If comparison is false do step 7 to 9.

• Halt the program.

www.vidyarthiplus.com36 of 72.

Footer Page 36 of 72.

PERIIT DEPT OF ECE

37

FLOWCHART:

Move the content 1200 to SI

MOVE CONTENT OF SI TO AL

IF

Z #0

LOAD DX VALUE TO 1100

STOP

START

YES

NO

Move the content 1300 to DX

Move the content FF to AH

INCREMENT DX

INCREMENT SI

COMPARE AH & AL

www.vidyarthiplus.com37 of 72.

Footer Page 37 of 72.

PERIIT DEPT OF ECE

38

PROGRAM:

ADDRESS

LABEL MNEMONICS COMMENTS

1000 MOV SI,1200 Move the1200 to SI

1004 MOV Dx,1300 Move the 1300 to DX.

1008 MOV AH,0FF Move the FF value to AH.

100B L1 INC DX Increment the DX register

100C MOV AL,[SI] Move SI TO AL

100E INC SI Increment SI value

100F CMP AH,AL Compare the AX and AL

1011 JNZ L1 Jump to L1 if no zero.

1013 MOV [1100],DX Move the content of DX to 1100.

1017 HLT Stop the process.

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

RESULT:

Thus a program to count the value of presence using 8086 microprocessor was done

successfully.

INPUT OUTPUT

www.vidyarthiplus.com38 of 72.

Footer Page 38 of 72.

PERIIT DEPT OF ECE

39

EXPT NO: 5 DATE:

INTERFACING OF ADC WITH 8086 MICROPROCESSOR

AIM:

To convert the analog signal to digital signal using 8086 microprocessor.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 1

2. Power Supply +5 V dc,+12 V dc 1

3. ADC Interface board - 1

ALGORTIHM:

• Move the content 10 to AL register.

• Assign C8 as output port.

• Move 18 to AL register.

• Assign C8 as output port.

• End the program.

THEORY

The program selects the CH0. Start the analog to digital conversion process by

pressing soc switch. ADC0809 converts the analog input at CH0 to a digital value and

74LS374 latches the data glow the LED’s accordingly.

www.vidyarthiplus.com39 of 72.

Footer Page 39 of 72.

PERIIT DEPT OF ECE

40

PROCEDURE:

1. Place jumper J2 in B position.

2. Place Jumper J5 in A position

3. Enter and execute the program.

4. Vary the analog input and give the soc by pressing soc switch.

5. See the corresponding digital value in the LED display.

6. I/O address for the latch 74LS174.

A7 A6 A5 A4 A3 A2 A1 A0

1 1 0 0 1 X X X

C8� Address of latch.

X�Don’t care condition (either 0 or 1).

FLOWCHART:

START

SELECT CHANNEL

MODE ALE LOW

MODE HIGH HIGH

GET THE DIGITAL

DATA ON DISPLAY

STOP

www.vidyarthiplus.com40 of 72.

Footer Page 40 of 72.

PERIIT DEPT OF ECE

41

PROGRAM:

ADDRESS LABEL PROGRAM OPCODE COMMENTS

1000 MOV AL,10 C6,C0,10 Channel selection

1003 OUT C8,AL E6,C8 ALE(Low)

1005 MOV AL,18 C6,C0,18 ALE(High)

1008 OUT C8,AL Send output to latch

100A HLT F4 Stop the process

EXECUTION TABLE:

ANALOG INPUT DIGITAL VALUE

00 0000 0000

15 1111 1111

RESULT:

Thus the Analog to Digital convertor was designed using 8086 microprocessor and the

output was executed.

www.vidyarthiplus.com41 of 72.

Footer Page 41 of 72.

PERIIT DEPT OF ECE

42

EXPT NO: 5.1 DATE:

INTERFACING OF DAC WITH 8086 MICROPROCESSOR

AIM:

To generate the square and saw tooth wave at the output of DAC 86/88 microprocessor.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY

1. Microprocessor kit 8086 Vi Microsystems 1

2. Power Supply +5 V, dc,+12 V dc 1

3. DAC Interface board - 1

ALGORITHM:

SQUARE WAVE:

• Move the value of 00 to AL register.

• Then AL register is given to the C8 register as output.

• Call the address value as 1013.

• Then move the value of 00FF to AL register.

• The AL register value is given to the C8 as the output.

• Call the address value as 1013.

• Jump to the address 1000.

• Then move the value of 05FF to CX register.

• Use instruction loop to the address 1017.

• Return the value by using RET.

www.vidyarthiplus.com42 of 72.

Footer Page 42 of 72.

PERIIT DEPT OF ECE

43

SAWTOOTH WAVE:

• Move the value 00 to AL register.

• The AL register value is given as output to C0.

• Increment the value of AL register.

• Jump not zero to 1003.

• Jump to the address 1000.

• Stop the program.

SQUARE WAVE GENERATOR

START

MOV AL,00H

OUT 00 DN DAC

CALL DELAY

MOV MAX (FF) ON AL

CALL DELAY

www.vidyarthiplus.com43 of 72.

Footer Page 43 of 72.

PERIIT DEPT OF ECE

44

SAW TOOTH WAVE GENERATOR

START

MOV AX,00H

OUT 00 ON DAC

INC AX

IF Z=1 NO YES

DELAY

MOV THE CONTENT TO

REGISTER

IF

CX=0

NO

YES

www.vidyarthiplus.com44 of 72.

Footer Page 44 of 72.

PERIIT DEPT OF ECE

45

SAWTOOTH WAVE:

ADDRESS LABEL MNEMONICS COMMENTS

1000 L1 MOV AL,00H Move the value 00 to AL register

1003 L2 OUT C0,AL Send output to latch, DAC 1

1005 INC AL Increment the AL value

1007 JNZ L2 Jump to L1 if no zero

1009 JMP LI Jump to L2

SQUARE WAVE:

ADDRESS LABEL MNEMONICS COMMENTS

1000 L2 MOV AL,00 Move 00 to AL register

1003 OUT C8,AL Send output to latch

1005

CALL DELAY Call the delay

1008

MOV AL,0FF Move maximum value FF to AL.

100B

OUT C8,AL Send output to latch of AL.

100D

CALL DELAY Call the delay.

1010

JMP L2 Jump to loop L2.

1013

DELAY MOV CX,05FF Move the count value to CX.

1017

LABEL LOOP LABEL Go to loop L1.

1019 RET Return.

EXECUTION TABLE:

SIGNAL AMPLITUDE TIME PERIOD

SQUARE WAVE

SAW TOOTH

RESET

www.vidyarthiplus.com45 of 72.

Footer Page 45 of 72.

PERIIT DEPT OF ECE

46

RESULT: Thus the square and saw tooth wave is generated at the output of DAC 86/88

microprocessor was done successfully.

EXP.NO: 6 DATE:

INTERFACING OF STILL AND ROLLING DISPLAY USING 8279 WITH 8086

MICROPROCESSOR

AIM:

To write an assembly language program for still display and rolling display

APPARATUS REQUIRED:

8086 Microprocessor kit, Power supply, interfacing board.

ALGORITHM:

STILL DISPLAY:

• Start the program.

• Clear AL register and out it of AL to C@ register.

• Repeat the content.

• Move the 00CC data to AL register.

• Display content of AL register to C2.

• Move the 90 data to AL register.

• Move the 88 data to AL register.

• Display the content of AL register to C0.

• Move the FF data to AL register .

• Display the content of AL register to C0.

www.vidyarthiplus.com46 of 72.

Footer Page 46 of 72.

PERIIT DEPT OF ECE

47

• Stop the program.

ROLLING DISPLAY:

•••• Start the program.

•••• Move the content of 1200 address to SI register.

•••• Clear the register CX and move data to AL register.

•••• Display the content of the AL register and move data 00CC to AL register.

•••• Display the content of the AL register and move data 90 to AL register.

•••• Display the content of the AL register and roll the delay go to step 9.

•••• Increment the content of SI and continue the loop till false.

•••• Move the content 9FFF to DX register.

•••• Decrement DX register content and continue till the ZE becomes 1.

•••• Stop the program.

The write display RAM command word format is

1 0 0 AI A A A A

AI ���� Auto Increment Flag. If AI=1 the row address selected will be incremented after each

following read or write display RAM.

A A A A – Select one of the 16 rows of the display RAM.

The command word format for clear display is

0 0 0 D D K K K

0 0 0 1 0 0 0 0

www.vidyarthiplus.com47 of 72.

Footer Page 47 of 72.

PERIIT DEPT OF ECE

48

�10H

DD-Display Mode

1. 00 – 8 8 bit character display – Left entry

2. 01 – 16 8 bit character display – Left entry

3. 10 – 8 8 bit character display – Right entry

4. 11 – 16 8 bit character display – Right entry

5. C0 - Address of latch (Display Register content) [Address]

6. C2 – Display RAM address [Address]

7. Cc – Clear Display RAM [Command Word]

8. 90 – Write display RAM [Command Word]

9. 88 – Display character A [Data]

10. FF – Blank display [Command Word]

a

f b

g

e c

d

d c b a h g f E

H 1 0 0 1 1 0 0 0 98

E 0 1 1 0 1 0 0 0 68

L 0 1 1 1 1 1 0 0 7C

P 1 1 0 0 1 0 0 0 C8

U 0 0 0 1 1 1 0 0 1C

S 0 0 1 0 1 0 0 1 29

www.vidyarthiplus.com48 of 72.

Footer Page 48 of 72.

PERIIT DEPT OF ECE

49

C0 � Status register address

C2 � Display RAM address

FLOWCHARAT FOR STILL DISPLAY:

Start

Move mode display

and set command word

Blank display character

Move clear display cw to display RAM

Move write display cw to DIR

Move data for character n

Move content of cx and OUT it

If

Cx=0

Stop

www.vidyarthiplus.com49 of 72.

Footer Page 49 of 72.

PERIIT DEPT OF ECE

50

FLOWCHART FO R ROLLING DISPLAY:

Start

Mov SI,1200

Initialise count cx,0001

Move the content of SI in AL and out it

Inc SI

Move mode and display set command word and out it

Decrement DX

Call delay

Move clear display cw to display Ram and out it

Move write display cw to DIR

Move AoFF to Dx

Delay

Return

DEC DX

If

Cx=0

If

z=1

www.vidyarthiplus.com50 of 72.

Footer Page 50 of 72.

PERIIT DEPT OF ECE

51

ROLLING DISPLAY:

ADDRESS LABEL MNEMONICS COMMENTS

1000 START MOV SI,1200H Assign 1200 to SI.

1004 MOV CX,000FH Initialize count

1008 MOV AL,10 Move mode and display.

100B OUT C2,AL Set command word and out it.

100D MOV AL,00CC Move clear display control word.

1010 OUT C2,AL To display RAM and out it.

1012 MOV AL,90 Move write display

1015 OUT C2,AL CW to D/R

1017 NEXT MOV AL,[SI] Move the content SI.

1019 OUT C0,AL To display AL and out it.

101B CALL DELAY Call delay.

101E INC SI Increment SI.

101F LOOP NEXT Loop to next label.

1021 JMP START Jump to start.

1500 DELAY MOV DX,0A0FFH Call the delay.

1504 LOOP 1 DEC DX Decrement DX.

1505 JNZ LOOP1 Jump no zero to loop1.

1507 RET Return.

www.vidyarthiplus.com51 of 72.

Footer Page 51 of 72.

PERIIT DEPT OF ECE

52

STILL DISPLAY:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AL,00 Move mode and display.

1003 OUT C2,AL Set command word

1005 MOV AL,00CC Move clear display

1008 OUT C2,AL Control word to display RAM

100A MOV AL,90 Move write display

100D OUT C2,AL Control word to D/R.

100F MOV AL,88 Move data to AL

1012 OUT C0,AL For character A and out it

1014 MOV AL,FF Blank display character

1017 OUT C0,AL & OUT it

1019 MOV CX,0005 Move count to CX

101D NEXT OUT C0,AL & OUT it

101F LOOP NEXT Loop goes to NEXT

1021 HLT Halt the program

EXECUTION:

STILL DISPLAY:

www.vidyarthiplus.com52 of 72.

Footer Page 52 of 72.

PERIIT DEPT OF ECE

53

ROLLING DISPLAY:

LOOK-UP TABLE:

1200 FF FF FF FF

1204 FF FF FF FF

1208 68 98 C8 7C

120C 1C FF FF 29

RESULT:

www.vidyarthiplus.com53 of 72.

Footer Page 53 of 72.

PERIIT DEPT OF ECE

54

Thus the program of rolling display and still display was written and the output was

executed.

EXP.NO: 7 DATE:

PARALLEL COMMUNICATION INTERFACING WITH TWO 8086

MICROPROCESSOR KIT

AIM:

To write an assembly language program for parallel communication through 8255 PPI.

APPARATUS REQUIRED:

1. 8086 Microprocessor kit.

2. Power supply.

3. 8255 PPI Kit

ALGORITHM FOR RECEIVER:

•••• Move the value 90H to the AL register.

•••• The value of AL is stored in port address 26.

•••• Gets the value from port addresses 20H and store AL.

•••• Subtract the value 3FH and the value of AL register.

•••• Jump if no zero to step 3.

•••• Move the value of 3FH to AL register.

•••• The value of AL is stored in port address 22H.

•••• Move the value of the address 1200H to SI register.

•••• The function delay is called.

•••• Move the value of the address 1200H to SI register.

•••• Get the value from the port address 20H to SI register.

•••• Move the value of AL register to the address 1200.

•••• Function delay is called.

www.vidyarthiplus.com54 of 72.

Footer Page 54 of 72.

PERIIT DEPT OF ECE

55

•••• SI register is incremented.

•••• Decrement the CL register.

•••• Jump on no zero to step 11.

•••• Get the value 02 as integer.

•••• Move the value 05 to BL.

•••• Move the value 0FH to DL register.

•••• Decrement BL register.

•••• Jump on no zero to step 20.

•••• Jump on no zero to step 19.

TRANSMITTER ALGORITHM:

• Start the program.

• Move 22H to AL and AL to port address 26H.

• Move 3F to AL and AL to port addresses 20H.

• Get the input value from 22H to store in AL.

• Subtract 3FH from AL.

• If no zero occurs go to step4.

• Move 24H toAL and AL to port address 20H.

• Call delay and goto step 10.

• Interrupt is executed.

• Move 05H to BL register.

• Move 0FFH to DL register.

• Decrement DL value and if no zero occurs goto step 10.

• Decrement BL value and if no zero occurs goto step 11.

• Stop the program.

www.vidyarthiplus.com55 of 72.

Footer Page 55 of 72.

PERIIT DEPT OF ECE

56

FLOWCHART FOR RECEIVER:

START

MOVE 90H VALUE TO AL REGISTER OUT IT IN PORT 20H

TAKE THE VALUE 20H TO AL SUBTRACT FROM 35

IF Z=1

MOVE DATA 3FH TO AL & OUT IT IN PORT 22H

INITIALISE COUNT VALUE 08 TO CL REGISTER

CALL DELAY

MOVE 1200H TO SI REGISTER

CALL DELAY

TAKE 20H TO AL & OUT IT IN AL

INCREMENT SI,DECREMENT SI

IF Z=1

INT 02

NO

YES

YES

NO

www.vidyarthiplus.com56 of 72.

Footer Page 56 of 72.

PERIIT DEPT OF ECE

57

DELAY

MOVE 05H TO BL

MOVE 0FFH TO DL

DECREMENT BL

IF Z==1

DECREMENT BL

IF Z==1

RETURN

YES

NO

NO

YES

RETURN

DELAY FOR RECEIVER

www.vidyarthiplus.com57 of 72.

Footer Page 57 of 72.

PERIIT DEPT OF ECE

58

FLOWCHART FOR TRANSMITTER

START

MOVE THE CONTROL WORD TO AL

OUT THE CONTROL WORD TO PORT

26H

TAKE IN AL VALUE 22H & SUBTRACT

IT FROM 3FH

MOVE 8FH TO AL & OUT IT PORT

20H

IF Z==1

MOVE 24H TO AL & OUT IT PORT

20H

CALL DELAY

INT 02

YES

NO

www.vidyarthiplus.com58 of 72.

Footer Page 58 of 72.

PERIIT DEPT OF ECE

59

ADDRESSES:

Port A address=20H.

Port B address=22H.

Port C address=24H.

Control word register address=26H.

Control word=82.

CONTROL WORD:

I/O Group A

mode

Port A PCU Group B

mode

Port B PCL

1 0 0 0 0 0 1 0

=82

PCU � Port C upper.

PCL� Port C Lower.

INPUT/OUTPUT PORT:

Port B � used as input.

Port A � used as output.

Port C � also as output.

MODE SELECTED:

Group B � mode 0 is selected.

Group A � mode 0 is selected.

I/O mode is used.

www.vidyarthiplus.com59 of 72.

Footer Page 59 of 72.

PERIIT DEPT OF ECE

60

RECEIVER PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AL,90H Move 90H to AL register.

1003 OUT 26H,AL Out the AL data in 26H port address

1005 CHECK IN AL,20H Take 20H to AL register.

1007 SUB AL,3FH Sub the AL data from 3FH

100A JNZ CHECK Jump on no zero

100C MOV AL,3FH Move 3FH data to AL register.

100E OUT 22H,AL Out the AL data in 22 port address.

1011 MOV CL,08H Move 08H to count CL register.

1014 CALL DELAY Call the delay.

1017 MOV SI,1200H Move 1200H to SI.

101B L1 IN AL,20H Take 20H value AL

101D MOV [SI],AL Move the AL data to SI address

101F CALL DELAY Call delay

1022 INC SI Increment SI

1023 DEC CL Decrement CL value.

1025 JNZ L1 Jump on no zero L2.

1027 INT 02 Interrupt 02

1029 DELAY MOV BL,05H Move 05H value to BL.

102C LION MOV DL,0FFH Move 00FFH value to DL

102F L2 DEC DL Decrement DL.

1031 JNZ L2 Jump on no zero L2.

1033 DEC BL Decrement DL

1035 JNZ LION Jump on no zero lion

1037 RET Return

1038 RET Return

www.vidyarthiplus.com60 of 72.

Footer Page 60 of 72.

PERIIT DEPT OF ECE

61

TRANSMITTER PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

1000 MOV AL,82H Move 82H to AL register.

1003 OUT 26H,AL Out AL data in 26H address

1005 MOV AL,3FH Move 3FHto AL register

1008 OUT 20H,AL Out the AL data in 20H address.

100A LOOP IN AL,22H Take the 22H to AL register.

100C SUB AL,3FH Subtract the AL data from 3FH.

100F JNZ LOOP Jump on no zero.

1011 MOV AL,24H Move 24H to AL register

1014 OUT 20H,AL Out AL data in 20H address

1016 CALL DELAY Call the delay

1019 INT 02 Interrupt 02

101B DELAY MOV BL,05H Move 05H to BL register

101E LION MOV DL,0FFH Move 0ffH to DL register

1021 L2 DEC DL Decrement DL

1023 JNZ L2 Jump on no zero

1025 DEC BL Decrement BL

1027 JNZ LION Jump on no zero to LION

1029 RET Return

www.vidyarthiplus.com61 of 72.

Footer Page 61 of 72.

PERIIT DEPT OF ECE

62

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

RESULT:

Thus the program for parallel communication was written and executed.

INPUT OUTPUT

www.vidyarthiplus.com62 of 72.

Footer Page 62 of 72.

PERIIT DEPT OF ECE

63

EXP.NO: 8 DATE:

Stepper motor program

Refer xerox

EXP.NO: 9 DATE:

dc motor program

Refer xerox

EXP.NO: 10 DATE:

8051 arithmetic operations

Refer xerox

EXP. NO: 11 DATE:

TIMER INTERRUPTS USING 8051 MICROCONTROLLER

AIM:

To perform timer and interrupt on board using 8051 microcontroller.

APPARATUS REQUIRED:

• 8051 microcontroller.

• Power chord.

www.vidyarthiplus.com63 of 72.

Footer Page 63 of 72.

PERIIT DEPT OF ECE

64

ALGORITHM:

• Move the control word to TMOD regiwster.

• Move the control word to DI IE register.

• Enable the interrupt by giving value to TM1 & TL1.

• Start the timer by enabling the timer run bit.

• Check for timer overflow set, clear the timer control bit.

• Halt the program.

ISR (Interrupt Service Routine)

• Move only desired value to A register.

• Add the A register content and any other value.

• Move the address to DPTR.

• Move A value to DPTR.

• Halt the program.

www.vidyarthiplus.com64 of 72.

Footer Page 64 of 72.

PERIIT DEPT OF ECE

65

FLOW CHART:

NO

YES

START INTERRUPT

MOVE THE CONTROL WORD TO

TMOD

MOVE THE CONTROL WORD TO

2E

ENABLE THE INTERRUPT USING

TH1 &TL1(TIMER)

RUN THE TIMER AND SETTING

THE BIT TR1

CHECK FOR

OVERFLOW

FLAG TH1

STOP THE TIMER AND CLEARING

THE TEXT

STOP

MOVE CARRY

DESIRED VALUE

WITH A REGISSTER

ADD ANY DESIRED VALUE WITH

CONTENT AREGISTER

MOVE THE ADDRESS VALUE A TO

DPTR

STORE THE RESULT

RETURN

www.vidyarthiplus.com65 of 72.

Footer Page 65 of 72.

PERIIT DEPT OF ECE

66

PROGRAM:

ADDRESS LABEL MNEMONICS COMMENTS

4100 MOV TMOD,#10 Move value to TMOD

4103 MOV IE,#88 Move 88 to IE

4106 MOV TH1,#00 Move 00 to TH1

4109 MOV TL1,#00 Move 00 to TL1

410C SET (TR1) Set timer 1

410E L1 JNB 8F(TF1),L1 Jump no borrow gate loop 1

4111 CLR 8E(TR1) Clear the timer

4113 L2 SJMP L2 Short jump to L2

5030 MOV A,#12H Mov 12 to A

5032 ADD A,#12H Add A with 12

5034 MOV DPTR,#4500 Move 4500 to DPTR

5037 MOVX @DPTR,A Mov A value to DPTR

5038 L3 SJMP L3 Short jump to L3

ISR:

The vector address for the timer interrupt overflow is 00. In one kit in jump location.

Gate C/T M1 M0 Gate C/T M1 M0

0 0 0 1 0 0 0 0

=10H

IE:

EA - - ES ET1 EX1 ET0 EX0

1 0 0 0 1 0 0 0

=88H

EA � Enable address Access

EN � Enable Timer 1

www.vidyarthiplus.com66 of 72.

Footer Page 66 of 72.

PERIIT DEPT OF ECE

67

EXECUTION TABLE:

ADDRESS DATA ADDRESS DATA

RESULT:Thus the timer and interrupt operation was performed successfully using 8051

microcontroller.

INPUT OUTPUT

www.vidyarthiplus.com67 of 72.

Footer Page 67 of 72.

PERIIT DEPT OF ECE

68

EXP. NO: 12 DATE:

ARITHMETIC OPERATION IN 8051 USING KEIL SOFTWARE

AIM:

To perform arithmetic operation in 8051 using KEIL SOFTWARE.

PROCEDURE:

1. Click Keil µVision# icon in the desktop

2. From Project Menu open New project

3. Select the target device as ATMEL 89C51

4. From file menu open New File

5. Type the program in Text editor

6. Save the file with extension “.asm”

7. In Project window click the tree showing TARGET

8. A source group will be open.

9. Right Click the source group and click “ Add files to Source group”

10. A new window will open. Select our file with extension “.asm”

11. Click Add.

12. Go to project window and click right click Source group gain

13. Click Build Target (F7) .

14. Errors if any will be displayed.

15. From Debug menu, select START/STOP Debug option.

16. In Project window the status of all the registers will be displayed.

17. Click Go from Debug Menu.

18. The results stored in Registers will be displayed in Project Window.

19. Stop the Debug process before closing the application.

www.vidyarthiplus.com68 of 72.

Footer Page 68 of 72.

PERIIT DEPT OF ECE

69

PROGRAM:

ORG 0H

CLR C

MOV A,#05H

MOV B,#02H

DIV AB

END

OBSERVATION:

A: 02

B: 01

Simulation view

RESULT:

www.vidyarthiplus.com69 of 72.

Footer Page 69 of 72.

PERIIT DEPT OF ECE

70

Thus the arithmetic operation for 8051 was done using KEIL SOFTWARE.

EXP. NO: 13 DATE:

PORT OPERATION IN 8051 USING KEIL SOFTWARE

AIM:

To write and simulate C program for PORT operation using KEIL SOFTWARE

PROCEDURE:

1. Click Keil µVision3 icon in the desktop

2. From Project Menu open New project

3. Select the target device as ATMEL 89C51

4. From file menu open New File

5. Type the program in Text editor

6. Save the file with extension “.c”

7. In Project window click the tree showing TARGET

8. A source group will be open.

9. Right Click the source group and click “ Add files to Source group”

10. A new window will open. Select our file with extension “.c”

11. Click Add.

12. Go to project window and click right click Source group gain

13. Click Build Target (F7) .

14. Errors if any will be displayed.

15. From Debug menu, select START/STOP Debug option.

16. Click Go from Debug Menu.

17. In Peripherals Menu “I/O ports” select the required port.

18. Click on Run Icon .

19. The Port operations are observed in the Workspace.

20. Stop the Debug process before closing the application.

www.vidyarthiplus.com70 of 72.

Footer Page 70 of 72.

PERIIT DEPT OF ECE

71

PROGRAM:

#include<reg51.h>

void main()

{

While(1)

{

unsigned int i;

P2=0XAA;

for(i=0;i<255;i++);

P2=0X55;

for(i=0;i<255;i++);

}

}

OBSERVATION:

Variations of port values in regular intervals of time

RESULT:

www.vidyarthiplus.com71 of 72.

Footer Page 71 of 72.

PERIIT DEPT OF ECE

72

Thus the PORT operation was simulated using KEIL SOFTWARE.

zZ

www.vidyarthiplus.com72 of 72.

Footer Page 72 of 72.