EINSTEIN

COLLEGE OF ENGINEERING
Sir.C.V.Raman Nagar, Tirunelveli-12

Department of Electronics and Communication Engineering
Subject Code :EC 58
“Microprocessors and Microcontrollers Lab”

Name Reg No Branch Year & Semester

: …………………………………… : …………………………………… : …………………………………… : ……………………………………

Sub Code: EC 58 Microprocessors and Microcontrollers Lab

INDEX SLNO 1 2 DATE Name of the Experiment MARKS STAFF SIGNATURE

3 4 5 6 7

8 9 10 11

12 13 14 15

16 17

©Einstein College of Engineering Page 2 of 76

Sub Code: EC 58 Microprocessors and Microcontrollers Lab

EX.NO. :1 DATE : 8-BIT ARITHMETIC OPERATIONS
8-BIT ADDITION: AIM To write an ALP to perform 8-bit addition using 8085 microprocessor trainer kit. APPARATUS REQUIRED 1. 8085 microprocessor trainer kit. 2. Power supply ALGORITHM 1. Start the program 2. Get the first data to the accumulator. 3. The second data is given to B register. 4. The content of B register is then added with accumulator contents. 5. The addition for carry is checked and the result is stored in the specified memory location 6. The program is terminated. PROGRAM

ADDRESS LABEL 4100 4102 4104 4105 4108 410A 410D 410E 410F 4112 START

MNEMONICS MVI A, 35 MVI B, 12 ADD B STA 4200 MVI C, 00 JNC L1 INR C MOV A, C STA 4201 HLT

OPCODE 3E,35 06,12 80 32,00,42 0E,00 D2,0E,41 0C 79 32,01,42 76

L1

©Einstein College of Engineering Page 3 of 76

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: 4101-35 4103-12 OUTPUT: 4200-47 4201-00 MANUAL CALCULATION: ©Einstein College of Engineering Page 4 of 76 .

00 JNC L1 INR C MOV A. C STA 4201 HLT OPCODE L1 INPUT: ©Einstein College of Engineering Page 5 of 76 . 35 MVI B. Start the program 2. 6. PROGRAM ADDRESS LABEL 4100 4102 4104 4105 4108 410A 410D 410E 410F 4112 START MNEMONICS MVI A. Get the first data to the accumulator. The content of B register is then subtracted with accumulator contents. 12 SUB B STA 4200 MVI C. APPARATUS REQUIRED 1. 8085 microprocessor trainer kit. 3. The addition for carry is checked and the result is stored in the specified memory location. The second data is given to B register. 5. 4. The program is terminated. 2.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 8-BIT SUBTRACTION AIM To write an ALP to perform 8-bit subtraction using 8085 microprocessor trainer kit. Power supply ALGORITHM 1.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab 4101-35 4103-12 OUTPUT: 4200-23 4201-00 MANUAL CALCULATION: ©Einstein College of Engineering Page 6 of 76 .

45 ADD B DCR C JNZ L1 STA 4200 HLT OPCODE L1 ©Einstein College of Engineering Page 7 of 76 . Get the second data to the register C. 8085 microprocessor trainer kit. PROGRAM ADDRESS LABEL 4100 4102 4104 4106 4107 4108 410B 410E START MNEMONICS MVI A.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 8-BIT MULTIPLICATION AIM To write an ALP to perform 8-bit multiplication using 8085 microprocessor trainer kit. 8. APPARATUS REQUIRED 1. the result was stored in the specified memory location. After performing the addition operation the register C would decremented by 1 7. 4. 00 MVI B. Get the first data to the register B. Power supply ALGORITHM 1. 5. Add the contents of register B is added with the accumulator and stored in accumulator. Clear the accumulator 3. Otherwise the loop of addition operation was continued. 2. Start the program 2. When the zero flag is set. 12 MVI C. 6.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: 4103-12 4105-45 OUTPUT: 4200MANUAL CALCULATION ©Einstein College of Engineering Page 8 of 76 .

9. 14. 12. Store the quotient value in accumulator. Store the remainder in accumulator in specified memory location. 5. 7. Compare ‘B’ register with accumulator. Increment the content of C register. Subtract the B register content from the accumulator. Clear the accumulator and load the accumulator by divisor value to the specified memory location. 8085 microprocessor trainer kit. If carry is generated move to the 11th step. 6. 11. PROGRAM ADDRESS LABEL START MNEMONICS SUB A LDA 4200 MOV B. 4. Start the program 2. End the program.00 CMP B JC L2 SUB B INR C JMP L1 STA 4250 MOV A. Initialize ‘00’ to C register. 10. Load accumulator with dividend value. Jump control to step 6.C STA 4251 HLT OPCODE L1 L2 ©Einstein College of Engineering Page 9 of 76 . 2. Move the content of A to B register. 13. Move the C register content to accumulator. APPARATUS REQUIRED 1. Power supply ALGORITHM 1. 3.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 8-BIT DIVISION AIM To write an ALP to perform 8-bit division using 8085 microprocessor trainer kit. 8.A LDA 4201 MVI C.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: OUTPUT: MANUAL CALCULATION: RESULT: Thus the ALP was written and the 8 bit arithmetic operations were performed successfully using 8085 microprocessor trainer kit.NO. :2 ©Einstein College of Engineering Page 10 of 76 . EX.

2. PROGRAM ©Einstein College of Engineering Page 11 of 76 .Power supply ALGORITHM . 8085 microprocessor trainer kit. APPARATUS REQUIRED 1.Sub Code: EC 58 Microprocessors and Microcontrollers Lab DATE : 16-BIT ARITHMETIC OPERATIONS 16-BIT ADDITION AIM To write an ALP to perform 16-bit addition using 8086 microprocessor trainer kit.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: OUTPUT: MANUAL CALCULATION: ©Einstein College of Engineering Page 12 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 13 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 14 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus the ALP was written and the 16-bit arithmetic operations was performed successfully by using the 8086 microprocessor trainer ©Einstein College of Engineering Page 15 of 76 .

Next. 5. THEORY: A motor in which the rotor is able to assume only discrete stationary angular position is a stepper motor. 6.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX. Move the count value to B register. They are widely used in a variety of applications such as computer peripherals and in the area of process control machine tools.The pole face S1 tries to align itself with the axis of A1(N) and the pole face S2 with B1(N) . with N2 in neutral zone. 2 phase scheme: In this scheme any two adjacent stator windings are energised. A partial but symmetric alignment of the rotor poles is of course possible. A2 and B2 are on. Step(d) illustrates the case when A1 and B2 are on.The north pole N3 of the rotor finds itself in the neutral zone between A1(N) and B1(N) .Only partial alignment is possible and N1 finds itself in the neutral region . Typical equilibrium conditions of the rotor when the windings on 2 successive stator poles are excited. midway between B1(N) and A2(N) (in step (b)). Load the input data. In step(a) A1 and B1 are energised . When B1 and A2 are energised . By changing the delay time we can change the speed. stepper motor. 2. 3. of course again under equilibrium conditions. Send data to the output device through port. Interface board and Interface chord. 4.. S1 and S2 of the rotor position themselves symmetrically with respect to the two stator north pole. respectively. robotics etc…. S2 tends to align with B1(N) and S3 with A2(N). There are two magnetic fields active in quadrature and none of the rotor pole faces can be in direct alignment with the stator poles. In step(c). ALGORITHM: 1. :3 DATE : INTERFACING AND PROGRAMMING OF STEPPER MOTOR AIM: To run a stepper motor at different speed in two directions.NO. ©Einstein College of Engineering Page 16 of 76 . Call the delay program After the delay time load the next data and repeat the same. S3 and S1 tend to algin with A2(N) and B2(N). APPARATUS REQUIRED: 8086 µp kit.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 17 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 18 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab CLOCKWISE ANTICLOCKWISE A1 A2 B1 B2 HEXA STEP A1 A2 B1 B2 HEXA STEP 1 1 0 0 1 09 1 05 2 1 0 0 1 1 1 0 0 A 06 2 0 1 0 1 3 4 0 1 1 0 1 1 0 0 06 0A 3 4 0 1 1 0 0 0 1 1 05 09 PROGRAM:FORWARD DIRECTION ADDRESS LABEL MNEMONICS OPCODE 1018 LOOKUP ©Einstein College of Engineering Page 19 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab REVERSE DIRECTION ADDRESS LABEL MNEMONICS OPCODE RESULT: Thus a program to run a stepper motor at different speeds in two directions was written and executed using 8086 µp ©Einstein College of Engineering Page 20 of 76 .

NO. A particular input channel is selected by using the address decoding. 4. The address lines A3. The buffer 74LS244 which transfers the converted data output to data bus is selected when A7 1 A6 1 A5 0 A4 0 A3 0 A2 X =C0 H A1 X A0 X ©Einstein College of Engineering Page 21 of 76 . 2. and A5 are tied to pin 1. Place jumper J2 in B position. 2. The address lines A6 and A7 are NANDed together and the NAND gate o/p is connected to pin 5 of 74LS 138. Power chord.similarly IOW and IOR signals NANDed together and the NAND gate o/p is connected to pin 6 of 74LS 138. Interface chord. Pin 4 is grounded. Set the corresponding digital value in the LED display. :4 DATE : ANALOG TO DIGITAL CONVERTER AIM: To write an assembly language program to convert analog to digital output APPARATUS REQUIRED: 8085 µp kit. 7. Vary the analog input (using prompt) and give the SOC (by pressing the SOC switch). 3 of 74LS138 respectively. 3. Place jumper J5 in A position. Enter & execute the program.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX. 6. ADC board. ALGORITHM: 1. Load the data 18 H to make the ALE signal low. Load the data 10 H to make the ALE signal low. A4. 5. THEORY: The device contains an 8 channel single ended analog signal multiplexer. I/O decoding A 3:8 decoder 74LS138 is employed to generate I/O decoding logic.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 22 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 23 of 76 .

C and ALE1 and ALE 2.B.10 OUT 0C8 H MVI A. A7 1 A6 1 A5 0 A4 0 A3 1 A2 X =C8 Data to be outputted to port address C8 for channels 0 to 7 S.No Channel No EOC address in Hexa Data in Hex Channel No Channel No ALE High ALE Low OE Low OE High 18 10 19 11 1A 12 1B 13 1C 14 1D 15 1E 16 1F 17 A1 X A0 X 1 2 3 4 5 6 7 8 CHO CH1 CH2 CH3 CH4 CH5 CH6 CH7 D8 D8 D8 D8 D8 D8 D8 D8 PROGRAM: ADDRESS LABEL MNEMONICS MVI A.18 OUT 0C8 H HLT OPCODE ©Einstein College of Engineering Page 24 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab The I/O address for the latch 74LS174 which latches the data bus to address A.

©Einstein College of Engineering Page 25 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab MANUAL CALCULATION RESULT: Thus the assembly language program to convert analog to digital output digital output was executed successfully.

sawtooth. I/O decoding A 3:8 decoder 74LS138 is employed to generate I/O decoding logic. 2. APPARATUS REQUIRED: 8085 µp kit. 3 of 74LS138 respectively. triangular and sine waveforms using DAC.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX.NO. DAC0800. The address lines A6 and A7 are NANDed together and the NAND gate o/p is connected to pin 5 of 74LS 138. Pin 4 is grounded.The DAC interface section comprises of I/O decoding and D/A conversion circuit. and A5 are tied to pin 1. :5 DATE : GENRATION OF SIMPLE WAVEFORMS USING DAC AIM To generate square. and with A7 1 A6 1 A5 0 A4 0 A3 1 A2 X =C8 A1 X A0 X DAC2 is selected ©Einstein College of Engineering Page 26 of 76 . Thus with A7 1 =C0 H A6 1 A5 0 A4 0 A3 0 A2 X A1 X A0 X DAC1 is selected. CRO. DAC and interfacing chords. CIRCUIT IMPLEMENTATION: The basic DAC interface board incorporates two 8 bit digital to analog converters. The address lines A3.similarly IOW and IOR signals NANDed together and the NAND gate o/p is connected to pin 6 of 74LS 138. A4.

.. Call the delay program..04 i/p data in hexa o/p voltage 00 01 02 . 4.Sub Code: EC 58 Microprocessors and Microcontrollers Lab The o/p voltage between -5V and 5V. Clear the accumulator to Display low level of square wave 2.00 -4.96 5. 4.00 SQUARE WAVEFORM AT DAC 2 OUTPUT: ALGORITHM: 1. Send the data to o/p device through port 6. Call the delay program 7..92 .the o/p voltage varies in steps of 10/256=. Send the data to o/p device through port 3. FD FE FF -5. .... 7F .. 0..00 . Continue from step1 PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ©Einstein College of Engineering Page 27 of 76 . . Load the accumulator with FF to Display high level of square wave 5.92 4. .96 -4.

Do the above process until zero flag is set 5. ©Einstein College of Engineering Page 28 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab OUTPUT: SAWTOOTH WAVEFORM AT DAC 1 OUTPUT: ALGORITHM : 1. 2. Continue from step1 PROGRAM: ADDRESS LABEL MNEMONICS OPCODE OUTPUT: TRIANGULAR WAVEFORM AT DAC2OUTPUT: ALGORITHM: 1. Do the above process until zero flag is set 5. 4. Send the data to o/p device through port 3. Incrément the accumulator to display next o/p voltage. Incrément the L register 4. Send the data to o/p device through port 3. Load the accumulator with FF through L register. Clear the accumulator 2. Clear the accumulator through L register.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab 6.00 MOV AL. Do the above process until zero flag is set 9.BL OUT C8.BL OUT C8. Continue from step1 PROGRAM: OPCODE MOV BL. Send the data to o/p device through port 7. Load the next data 5.FF MOV AL. If zero go to the loop or else go to step 1 ©Einstein College of Engineering Page 29 of 76 .AL INC BL JNZ 1003 MOV BL.AL DEC BL JNZ 100E JMP 1000 OUTPUT: SINE WAVEFORM GENERATION AT DAC1 OUTPUT: ALGORITHM: 1. Decrement the count and check if it is zero 6. Send the data to o/p device through port 4. Incrément the L register 8. Load the count as 49 in C register 3. Load 49 input datas to generate sine wave in lookup table 2.

02.04. FF.EF.E2. C0.C0.E8.54.A1.80 OPCODE 1100 LOOKUP ©Einstein College of Engineering Page 30 of 76 .00. 17.80.C9.FF.DA.5F.96 .FE.F4.DA.74.5F. EF.1E.FF.00. F4.11.0C.54.D2.04.2E.49 MOV AL.02.AB.08.FB.B6.25. 4A.25.FE.E8.74.11.6A.Sub Code: EC 58 Microprocessors and Microcontrollers Lab FORMULA USED: 128+128 SINX° WHERE X=0 to 360 with step 5 EXAMPLE: DEGREES DECIMAL HEXA 0 128 80 PROGRAM: ADDRESS LABEL MNEMONICS MOV BX.E2.36.96.AB.A1.FF.08.2E.1E.0C.F8.6A.D2.36.FB. C9.[BX] OUT C0.AL INC BX LOOP 1007 JMP 1000 80. 4A.8B.B6. 00.F8.40. 17.8B.1100 MOV CL.40.

saw tooth. triangular and sine waveforms were generated using 8086 µp.Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus the square. ©Einstein College of Engineering Page 31 of 76 .

The address lines A6 and A7 are NANDed together and the NAND gate o/p is connected to pin 5 of 74LS 138. channel 0.8253 interfacing board.RL0) D2 D1 ---.Select counter(SC1.M1. no read operation of its contents are possible . THEORY: The I/O address of control register.Each counter of 8253 can be individually programmed by writing corresponding control words by simple I/O operation. and A5 are tied to pin 1. CIRCUIT IMPLEMENTATION: I/O decoding A 3:8 decoder 74LS138 is employed to generate I/O decoding logic.NO.6 APPARATUS REQUIRED: 8085 µp kit.SC0) D4 ---. 3 of 74LS138 respectively.Mode(M2. 2.BCD ©Einstein College of Engineering Page 32 of 76 . CONTROL WORD FORMAT: D7 D6 D7 D5 D3 D0 D5 D4 D3 D2 D1 D0 D6 ---. CRO. Pin 4 is grounded. The address lines A3. channel 1 and channel 2.M0) ---.similarly IOW and IOR signals NANDed together and the NAND gate o/p is connected to pin 6 of 74LS 138.Read/Write(RL1. probe. power chord. interfacing chord. :6 DATE : INTERFACING & PROGRAMMING OF 8253 WITH 8086 MICROPROCESSOR AIM: To write the program for interfacing 8253 with 8085 microprocessor in mode 0and mode 3.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX. A4. A7 A6 A5 A4 A3 A2 A1 A0 Hexa Control register 1 1 0 0 1 1 1 0 CE Channal 0 1 1 0 0 1 0 0 0 C8 Channal 1 1 1 0 0 1 0 1 0 CA Channal 2 1 1 0 0 1 1 0 0 CC The chip 8253 has a control register which stores the operational mode of each counter. This register can only be within into.

Move the data to data register ©Einstein College of Engineering Page 33 of 76 . Load the MSB and LSB of count 4.---Mode 3 binary ALGORITHM: 1.30 ---------------------.---Mode 0 binary D7 D6 0 0 -------------Channel 0 D5 D4 1 1 -------------LSB/MSB D3 D2 D1 D0 0 1 1 0 -------. 3. Load the accumulator with control word for channel 0and mode 0 selection.36 ---------------------. 2. Move the data to control register.Sub Code: EC 58 Microprocessors and Microcontrollers Lab SELEST COUNTER D7 D6 0 0 CH0 0 1 CH1 1 0 CH2 1 0 X D3 0 0 0 0 1 1 CONTROL WORD D2 0 0 1 1 0 0 D1 0 1 0 1 0 1 RD/WR D5 0 0 1 1 MODE 0 1 2 3 4 5 D4 0 1 0 1 Latch LSB MSB LSB/MSB D7 D6 0 0 -------------Channel 0 D5 D4 1 1 -------------LSB/MSB D3 D2 D1 D0 0 0 0 0 -------.

5MHZ REQUIRED FREQUENCY=150KHZ COUNT=1.5M/150K=10 (decimal)=0A(hexa) MANUAL CALCULATION: OUTPUT: ©Einstein College of Engineering Page 34 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab OUTPUT: EXAMPLE: CLOCK FREQUENCY=1.

00 OUT C8.AL MOV AL.AL HLT OPCODE ©Einstein College of Engineering Page 35 of 76 . 3 Load the MSB and LSB of count 4 Move the data to data register PROGRAM: MODE 3.30 0UT CE.05 OUT C8.36 0UT CE.SQUARE WAVE GENERATOR ADDRESS LABEL START MNEMONICS MOV AL.SQUARE WAVE GENERATOR 1 Load the accumulator with control word for channel 0and mode 3 selection.AL MOV AL. 2 Move the data to control register.INTERRUPT ON TERMINAL COUNT ADDRESS LABEL START MNEMONICS MOV AL. OUT C8.AL HLT OPCODE ALGORITHM: MODE 3.AL MOV AL.Sub Code: EC 58 Microprocessors and Microcontrollers Lab PROGRAM: MODE 0.AL MOV AL. OUT C8.

©Einstein College of Engineering Page 36 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus the program for 8253 interfacing with 8086 microprocessor was written successfully.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab

EX.NO. :7 DATE : PROGRAMMING & INTERFACING OF 8279 WITH 8085 MICROPROCESSOR
AIM: To write the program for keyboard & Display interfacing using 8279. APPARATUS REQUIRED: 8086 µp kit, 8279 interface board, Interface chord, Power chord. CIRCUIT IMPLEMENTATION: I/O decoding A 3:8 decoder 74LS138 is employed to generate I/O decoding logic. The address lines A3, A4, and A5 are tied to pin 1, 2, 3 of 74LS138 respectively. The address lines A6 and A7 are NANDed together and the NAND gate o/p is connected to pin 5 of 74LS 138.similarly IOW and IOR signals NANDed together and the NAND gate o/p is connected to pin 6 of 74LS 138. Pin 4 is grounded.

I/O Decoding Control /Status Register Data Register Address C2 C0

Segment Definition a b c

d Data D7 bus Segment D D6 C D5 b D4 a D3 dp D2 g D1 f D0 e

©Einstein College of Engineering Page 37 of 76

Sub Code: EC 58 Microprocessors and Microcontrollers Lab

COMMAND WORD FORMAT : Display Mode set up

0

0

0

D

D

K

K

K

DD (Display Mode) 00- 8 bit character display left entry 01- 16 bit character display left entry 10- 8 bit character display right entry 11- 16 bit character display right entry KKK (Keyboard Mode) 000-2 Key lockout 0 0

0

0

0 =00

0

0

0

Clear Display(110) 1 1

0

CD

CD

CD

CF

CA

1

1

0 =CC H

0

1

1

0

0

Write display RAM(100) 1 0 0 AI A A A A

1

0

0

1 =90 H

0

0

0

0

0

Read FIFO RAM(010): 1 0 AI

X

A

A

A

0

1

0

0

0 =40

0

0

0

©Einstein College of Engineering Page 38 of 76

Sub Code: EC 58 Microprocessors and Microcontrollers Lab

DU

Read FIFO Status S/E O

U

F

N

N

N

0

0

0

0

0

1 =07

1

1

1

CLEAR DISPLAY RAM 1 1 1

1 =FF

1

1

1

(A) KEYBOARD INTERFACE ALGORITHM: 1. Load the data count in B register 2. Set display mode 3. Move the data to control register. 4. Clear display. 5. Move the data to control register. 6. Write display RAM 7. Move the data to control register 8. Clear the display RAM 9. Move the data to data register. 10. Decrement the count 11. Repeat the step5 for all the data display 12. Check whether the key is pressed or not 13. If the key is pressed go to next step otherwise repeat step 12. 14. Set to read FIFO RAM. 15. Move the data to control register 16. Get the data from the pressed key & display it

©Einstein College of Engineering Page 39 of 76

Sub Code: EC 58 Microprocessors and Microcontrollers Lab PROGRAM:ACCEPT A KEY AND DISPLAY IT ADDRESS LABEL MNEMONICS OPCODE LOOKUP TABLE 4200 4204 4208 420C 0C 99 08 6C 9F 29 09 1A 4A 28 88 68 0B 8F 38 E8 ©Einstein College of Engineering Page 40 of 76 .

Move the data to control register 6. Get the first data to be displayed 9. Move the data to control register 4. 3.Sub Code: EC 58 Microprocessors and Microcontrollers Lab (B) (ROLLING DISPLAY) ALGORITHM: 1. Move the data to control register 8. set the write display RAM 7. Clear display 5. Initialise the counter 2.10until the count is zero ©Einstein College of Engineering Page 41 of 76 . Set Display mode. Call the delay subroutine 11. Get the next data & repeat the steps 9. Display the data 10.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab PROGRAM ADDRESS LABEL MNEMONICS OPCODE LOOK UP 1200 1204 1208 120C FF FF 98 1C FF FF 68 29 FF FF 7C FF FF FF C8 FF ©Einstein College of Engineering Page 42 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus keyboard & Display were interfaced with 8279 by using 8086microprocessor. ©Einstein College of Engineering Page 43 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX. MINIMUM NUMBER: ALGORITHM: 1. keyboard.AX HLT L2 L1 ©Einstein College of Engineering Page 44 of 76 . Compare the 1st two datas and load the small data in accumulator. Stop the program.NO.1100 MOVAX. PROGRAM: ADDRESS LABEL MNEMONICS OPCODE START MOV DX. Get the COUNT in CX register and inputs in specified memory location.[BX] LOOP L2 MOV [1500]. APPARATUS REQUIRED: 8086 µp kit.2 CMP AX.DX MOV BX. 3.05 DEC DX MOV CX. :8 DATE : MAXIMUM AND MINIMUM OF NUMBERS AIM: To write a program for searching largest and smallest numbers in an array using 8086µp. power chord.[BX] ADD BX.[BX] JB L1 MOV AX. 4. 2. Compare the accumulator with the remaining datas and store the smallest data in accumulator.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab MAXIMUM NUMBER: ALGORITHM: 1. 5. INPUT: OUTPUT: MANUAL CALCULATION: INPUT: OUTPUT: ©Einstein College of Engineering Page 45 of 76 . 2 . 3. Stop the program. Compare the accumulator with the remaining datas and store the largest data in accumulator.Compare the 1st two datas and load the small data in accumulator. Get the COUNT in CX register and inputs in specified memory location.

©Einstein College of Engineering Page 46 of 76 .1100 MOVAX.[BX] JNB L1 MOV AX.05 DEC DX MOV CX.AX HLT RESULT: Thus the ALP for searching largest and smallest numbers from an array of datas was executed using 8086µp.Sub Code: EC 58 Microprocessors and Microcontrollers Lab PROGRAM: ADDRESS LABEL MNEMONICS OPCODE START L2 L1 MOV DX.2 CMP AX.[BX] ADD BX.DX MOV BX.[BX] LOOP L2 MOV [1500].

power chord.AX ADD BX. If there is carry go to step 6.05 MOV DX.DX LOOP L1 HLT ©Einstein College of Engineering Page 47 of 76 . PROGRAM: ADDRESS LABEL MNEMONICS OPCODE START L1 L2 L3 MOV CX. Compare 2nd and 3rd data and repeat the same up to last data. 2. 6. 8. 4. 5. we get the largest number in the last place.NO. Compare the 1st and 2nd data. Load the inputs in memory location 1100.1100 MOV AX. Get the number of inputs. Repeat the steps from 3. APPARATUS REQUIRED: 8086 µp kit. Now.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX.2 LOOP L2 MOV CX.CX MOV BX. 9.[BX+2] JB L3 XCHG [BX+2]. 3.AX MOV [BX].:9 DATE : SORTING AN ARRAY AIM: To write a program to sort an array in ascending and descending order by using 8086 µp.[BX] CMP AX. ASCENDING ORDER: ALGORITHM: 1. 7. keyboard. If no carry exchange two datas. Stop the program.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: OUTPUT: MANUAL CALCULATION: ©Einstein College of Engineering Page 48 of 76 .

8. Load the inputs in memory location 1100. Now.Sub Code: EC 58 Microprocessors and Microcontrollers Lab DESCENDING ORDER : ALGORITHM: 1.AX ADD BX.05 MOV DX.[BX+2] JNB L3 XCHG [BX+2]. Get the number of inputs. Compare the 1st and 2nd data. PROGRAM: ADDRESS LABEL MNEMONICS OPCODE START L1 L2 L3 MOV CX.AX MOV [BX]. 3. 4.CX MOV BX. If there is no carry go to step 6. Stop the program.1100 MOV AX. 9. Repeat the steps from 3. 5. If there is carry exchange two datas. 7. 2.[BX] CMP AX.DX LOOP L1 HLT ©Einstein College of Engineering Page 49 of 76 . 6. we get the smallest number in the last place.2 LOOP L2 MOV CX. Compare 2nd and 3rd data and repeat the same up to last data.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: OUTPUT: MANUAL CALCULATION: RESULT: Thus an ALP for sorting an array in ascending and descending order were executed using 8086 µp. ©Einstein College of Engineering Page 50 of 76 .

2000 MOV DI. Facilitate auto increasing of the index register. 2100 MOV CX. PROGRAM: ADDRESS LABEL MNEMONICS OPCODE L1 MOV SI. Move the string byte up to the last data. 3. 5.NO. 4. Load the source and destination address. Load the no of datas. :10 DATE : STRING MANIPULATIONS AIM: To write an ALP for performing string manipulation using 8086. power chord.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX. a) MOVING AN ARRAY OF DATA FROM SOURCE TO DESTINATION ALGORITHM: 1. APPARATUS REQUIRED: 8086 µp kit. keyboard. 2. 05 CLD MOV SB LOOP L1 HLT ©Einstein College of Engineering Page 51 of 76 . Stop the program.

Load the number of inputs. Load the destination address. ©Einstein College of Engineering Page 52 of 76 . Load the data byte. 5. Stop the program. 2. 3. 4. Store the data in the locations up to the last location. 6. Facilitate auto incrementing of index register.Sub Code: EC 58 Microprocessors and Microcontrollers Lab b) STORING A DATA IN SET OF LOCATIONS: OBJECTIVE: To fill the locations in memory with the byte INPUT: OUTPUT: MANUAL CALCULATION: ALGORITHM: 1.

Clear the count register. 5. 0034 CLD STO SB LOOP L1 HLT c) CALCULATING THE LENGTH OF A STRING: OBJECTIVE: To find the number of character in a string ALGORITHM 1. 0006 MOV DI. 3.Sub Code: EC 58 Microprocessors and Microcontrollers Lab PROGRAM: ADDRESS LABEL MNEMONICS OPCODE L1 MOV CX. store the count in location 1100. Repeat the steps from 4. increment the source address and load the second data. Load the source address. INPUT: OUTPUT: ©Einstein College of Engineering Page 53 of 76 . 7. 8. 1100 MOV AX. 4. 2. Load the assumed last data. If both the datas are not same. Increment the count. Compare the data in source register with last data. If both the datas are same. 6.

[SI] INC SI CMP AH. DX HLT L1 ©Einstein College of Engineering Page 54 of 76 . 1200 MOV DX. FFFF MOV AH. FF INC DX MOV AL. AL JNZ L1 MOV [1100].Sub Code: EC 58 Microprocessors and Microcontrollers Lab MANUAL CALCULATION: PROGRAM: ADDRESS LABEL MNEMONICS OPCODE MOV SI.

©Einstein College of Engineering Page 55 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus the programs for string manipulation operations were performed by using 8086 µp.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX.#09 ADD A. 2. Clear C register for carry Load the addend Add the augend and addend If there is no carry.#05 MOV DPTR. 3. increment the C register and store results Stop the program PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 CLR C MOV A.A INC DPTR MOVX @DPTR. 5.store the result If there is carry. power chord. 8-BIT ADDITION: ALGORITHM: 1.NO. 6. :11 DATE : ARITHMETIC OPERATIONS USING 8051 MICROCONTROLLER AIM: To write the microcontroller programs to perform 8 bit arithmetic operations. 4.A SJMP STOP STOP ©Einstein College of Engineering Page 56 of 76 . APPARATUS REQUIRED : 8051 microcontroller kit.#4150 MOVX @DPTR.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: OUTPUT: MANUAL CALCULATION: ©Einstein College of Engineering Page 57 of 76 .

Load the two datas in A and B registers 2. 6. 4.A SJMP STOP STOP 8-BIT MULTIPLICATION: ALGORITHM: 1. Store the result 4. 3.#30 MOV DPTR.#4150 MOVX @DPTR. 2. Stop the program ©Einstein College of Engineering Page 58 of 76 .#32 SUBB A. Multiply the two datas 3. 5. Clear C register for carry Load the minuend Subtact the subtrahend from minuend If there is no carry.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 8-BIT SUBRACTION: ALGORITHM: 1.store the result If there is carry. increment the C register and store results Stop the program PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 CLR C MOV A.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: OUTPUT: MANUAL CALCULATION: INPUT: OUTPUT: MANUAL CALCULATION: ©Einstein College of Engineering Page 59 of 76 .

A SJMP STOP STOP 8-BIT DIVISION: ALGORITHM: 1. Store the quotient and reminder 4.#12 MUL AB MOV DPTR.A INC DPTR MOV A.Sub Code: EC 58 Microprocessors and Microcontrollers Lab PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 MOV A.B MOVX @DPTR. Store the program PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 MOV A. Divide the dividend by divisor 3.#12 DIV AB MOV DPTR.#12 MOV B.#4500 MOVX @DPTR.B MOVX @DPTR.A INC DPTR MOV A. Load the dividend and divisor 2.#4500 MOVX @DPTR.#12 MOV B.A SJMP STOP STOP ©Einstein College of Engineering Page 60 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus the 8-bit arithmetic operations like addition. multiplication and division by using 8051 microcontroller and cross assembler were performed and executed ©Einstein College of Engineering Page 61 of 76 . subtraction.

A SJMP STOP STOP ©Einstein College of Engineering Page 62 of 76 .NO.#32 ORL A.#32 ANL A. PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 MOV A. Set the bit by ANDing that particular bit by 1 3. Set the bit by ORing that particular bit by 1 3. Store the result and stop the program.#4500 MOVX@DPTR. Load the given data 2.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX.#0F MOV DPTR. :12 DATE : BIT MANIPULATIONS USING 8051 MICROCONTROLLER AIM: To write a program for setting and masking the bits in a b-bit data using 8051. APPARATUS REQUIRED: 8051 microcontroller kit.#F0 MOV DPTR.A SJMP STOP STOP MASKING THE HIGHER ORDER BYTES: ALGORITHM: 1.#4500 MOVX@DPTR. power chord SETTING THE HIGHER ORDER BITS: ALGORITHM: 1. Store the result and stop the program. PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 MOV A. Load the given data 2.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab RESULT: Thus the program for masking and setting the higher order bits by using 8051 microcontroller and cross assembler were performed and executed . ©Einstein College of Engineering Page 63 of 76 .

A SJMP STOP STOP RESULT: Thus a program for performing logical operations using 8051 and cross assemler were executed ©Einstein College of Engineering Page 64 of 76 .#12 CPL A MOV DPTR.Sub Code: EC 58 Microprocessors and Microcontrollers Lab EX.power chord. APPARATUS REQUIRED: 8051 microcontroller kit. :13 DATE : LOGICAL OPERATIONS USING 8051 MICROCONTROLLER AIM: To write a program for finding 1`s and 2`s complement of the given number and for the conversion of binary to gray using logical list. Increment the result by 1 and store 5. 1`S AND 2`S COMPLEMENT: ALGORITHM: 1. Store the complement result 4. Load the given data in accumulator 2. Stop the program PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 MOV A.NO. Complement the accumulator 3.#4200 MOVX@DPTR.A INC A INC DPTR MOVX@DPTR.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 65 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 66 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 67 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 68 of 76 .

What is implied addressing mode? ©Einstein College of Engineering Page 69 of 76 .Sub Code: EC 58 Microprocessors and Microcontrollers Lab FAQ 1. What is register addressing mode? 8. What is direct addressing mode? 7. What is Instruction cycle? 3. What is processor cycle (Machine cycle)? 4. Types of addressing modes? 5. What is indirect addressing mode? 9. What is immediate addressing mode? 6. Define opcode and operand? 2.

What is the function of SBB. What is the function of INX H instruction? 12. What is the function of LXI H. . What is the function of SPHL instruction? ©Einstein College of Engineering Page 70 of 76 . 4000 instruction? 11. 4200 instruction? 14.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 10.B instruction? 18. What is the function of DCX H instruction? 13. What is the function of XCHG instruction? 15. What is the function of LHLD. What is the function of DAD instruction? 16. What is the function of SHLD instruction? 17.

What is the function of RST instruction? 26. What is the function of STA instruction? ©Einstein College of Engineering Page 71 of 76 . What is the function of ORA D instruction? 20. What is the function of OUT & IN instruction? 21.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 19. Define interrupts? 24. What is the function of JNC instruction? 27. What is the function of MVI instruction? 28. What is the function of subroutine? 25. What is the difference between CALL &RET instruction? 23. What is the function of control& data register? 22.

What is the function of DEC DX instruction? 36.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 29. What is the function of LOOP instruction? ©Einstein College of Engineering Page 72 of 76 . What is the function of INR instruction? 31. What is the function of JNZ instruction? 33. C instruction? 30. Why interfacing is needed for I/0 devices? 34. What is the function of MOV A. List some of the features of INTEL 8259(Programmable Interrupt Controller) 35. What is the function of DCR instruction? 32.

What is the function of MOVX @ DPTR. # 4150 instructions? 43. ANL. What is the function of INC DX. and CPLA instruction? ©Einstein College of Engineering Page 73 of 76 . A instruction? 44. What is the function of CLD instruction? 40. What is the function of MOV instruction in 8086 processor? 39. What is the function of MOV DPTR. INC SI instruction? 42. What is the function of SJMP instruction? 45. What is the function of JNB instruction? 38. What is the function of STOSB instruction? 41. What is the function of ORL.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 37.

What is the function of JNC instruction? ©Einstein College of Engineering Page 74 of 76 . Give some examples of input devices to microprocessor-based system. 51. What is the function of INC DPTR instruction? 48. List the features of 8051 microcontroller? 53.Sub Code: EC 58 Microprocessors and Microcontrollers Lab 46. What is the function of JMP instruction? 50. What is the function of CMP M instruction? 54. What is mean by microcontroller? 52. What is the function of LDA instruction? 49. What is the function of MUL AB instruction? 47.

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 75 of 76 .

Sub Code: EC 58 Microprocessors and Microcontrollers Lab ©Einstein College of Engineering Page 76 of 76 .

Sign up to vote on this title
UsefulNot useful