0% found this document useful (0 votes)
36 views20 pages

SK MPMC Lab Record

Uploaded by

skf78619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views20 pages

SK MPMC Lab Record

Uploaded by

skf78619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Exp No.

1: Program for 16-bit Addition and Subtraction for 8086


16-bit addition

1. a) AIM: Write an assembly language program to add two 16-bit numbers

EQUIPMENT REQUIRED: Personal Computer, Turbo assembler (TASM)

PROGRAM:

ASSUME CS:CODE, DS:DATA


DATA SEGMENT
NUM1 DW 4342H
NUM2 DW 1111H
RESULT DW 02H DUP (00)
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
ADD AX,BX
MOV [RESULT],AX
JNC GO
MOV [RESULT+1],01H
GO : INT 3
CODE ENDS
END START

RESULT:
AX= 5453
BX= 1111

OUTCOME: The 16bit addition of two 16-bit numbers is performed and two operands named as
NUM1 & NUM2 are stored in AX and BX register respectively.

1
16-bit Subtraction

1. (b). AIM: write an assembly language program to subtract two 16- bit numbers

EQUIPMENT REQUIRED: Personal Computer, Turbo assembler (TASM)

PROGRAM:

ASSUME CS:CODE, DS:DATA


DATA SEGMENT
NUM1 DW 4342H
NUM2 DW 1111H
RESULT DW 02H DUP (00)
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
SUB AX,BX
MOV [RESULT],AX
JNB GO
MOV [RESULT+1],01H
GO : INT 3
CODE ENDS
END START

RESULT:
AX = 3231
BX = 1111

OUTCOME: The 16bit subtraction of two 16-bit numbers is performed and two operands
named as NUM1 & NUM2 are stored in AX and BX register respectively.

2
Exp No.2: Program for 16-bit Multiplication and Division for 8086
16-bit Multiplication

2.(a)AIM: write an assembly language program to multiplication of two 16-bit numbers

EQUIPMENT REQUIRED: Personal Computer, Turbo assembler (TASM)

PROGRAM:

ASSUME CS:CODE, DS:DATA


DATA SEGMENT
NUM1 DW 4200H
NUM2 DW 4002H
RESULT DW 01H DUP (00)
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
MUL BX
MOV [RESULT],AX
MOV [RESULT+1],Dx
INT 03H
CODE ENDS
END START

RESULT:
AX = 8400
BX = 4002
CX = 0000
DX = 1080
OUTCOME: The 16bit Multiplication of two 16-bit numbers is performed and DX stores the
Higher Byte of the order, while AX stores the lower Byte.

3
16-bit division

2.(b)AIM: write an assembly language program to perform division between two 16-bit
numbers

EQUIPMENT REQUIRED: Personal Computer, Turbo assembler (TASM)

PROGRAM:

ASSUME CS:CODE, DS:DATA


DATA SEGMENT
NUM1 DW 0090H
NUM2 DW 0040H
RESULT DW 02H DUP (00)
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV BX,NUM2
DIV BX
MOV [RESULT],AX
MOV [RESULT+1],BX
INT 03H
CODE ENDS
END START

RESULT:
AX = 0002
BX = 0040
CX = 0000
DX = 0010

OUTCOME: The 16bit Division of two 16-bit numbers is performed and DX stores the
Remainder of the operation, while AX stores Quotient of the operation.

4
EXP NO.3: Program for sorting an array for 8086.
AIM: Write an assembly language program to arrange numbers in an array in ascending order

EQUIPMENT REQUIRED: Personal Computer, Turbo assembler (TASM)

PROGRAM FOR ASCENDING ORDER


ASSUME CS: CODE, DS: DATA
DATA SEGMENT
LIST DW 4000H, 2000H, 1000H,
3000H
COUNT EQU 04H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV DX, COUNT- 1
AGAIN0: MOV CX, DX
MOV SI, OFFSET LIST
AGAIN1: MOV AX,[SI]
CMP AX, [SI+2]
JL PRL
XCHG [SI+2], AX
XCHG [SI], AX
PRL : ADD SI, 02
LOOP AGAIN1
DEC DX
JNZ AGAIN0
MOV SI,OFFSET LIST
MOV AX,[SI]
MOV BX,[SI+2]
MOV CX,[SI+4]
MOV DX,[SI+6]
INT 03
CODE ENDS
END START

5
RESULT:

AX = 1000
BX = 2000
CX = 3000
DX = 4000

OUTCOME:

For the given inputs of array, the sorting operation is performed.

6
EXP NO: 4 Program for searching for a number or character in a string for 8086.

AIM: Write an assembly language program for searching for a number or character in string

EQUIPMENT REQUIRED: Personal Computer, Turbo assembler (TASM),

PROGRAM:

ASSUME CS:CODE, DS:DATA ,ES:EXTRA


DATA SEGMENT
STRING1 DB 0AH,0DH,"ENTER A
CHARACTER:",0AH,0DH,"$"
STRE DB "FOUND$"
STRNE DB "NOT FOUND$"
DATA ENDS
EXTRA SEGMENT
STRING2 DB "CMRCE$"
STRLEN DW ($-STRING2)
EXTRA ENDS
CODE SEGMENT
START:MOV AX,DATA
MOV DS,AX
MOV AX,EXTRA
MOV ES,AX
MOV DX,OFFSET STRING1
MOV AH,09H
INT 21H
MOV AH,08H
INT 21H
REPNE SCASB
JZ LABLE
MOV DX,OFFSET STRNE
MOV AH,09H
INT 21H
MOV AH,4CH
INT 03H
JMP EXIT
LABLE: MOV DX,OFFSET STRE
MOV AH,09H
INT 21H
7
MOV AH,4CH
INT 03H
EXIT: INT 03H
CODE ENDS
END START

RESULT:

Found

OUTCOME: For the given string the output is found.

8
PART-B
Exp No.5 : Program for 8 bit Addition and Subtraction for 8051

8-bit addition

1. a) AIM: Write an assembly language program to add two numbers

EQUIPMENT REQUIRED: Personal Computer, Kiel Software

PROGRAM:
ORG 8000H
; ADDITION WITHOUT CARRY
MOV A, #06H
MOV B, #09H
ADD A, B
MOV R0, A
RESULT:
Ra = 0x05 b = 0x09
A = 0x05 Sp = 0x07

OUTCOME:
The addition of two numbers for 8051 is performed.

8-bit Subtraction

1. b) AIM: Write an assembly language program to subtract two numbers

EQUIPMENT REQUIRED: Personal Computer, Kiel Software

PROGRAM:
ORG 8000H
;SUBTRACTION WITH CARRY
MOV A, #08H
SUBBC A, #03H
MOV R1, A
RESULT:
R1 = 0x05 Sp = 0x07
A = 0x05
OUTCOME:
The Subraction of two numbers for 8051 is performed.
9
Exp No.6: Program for 8-bit Multiplication and Division for 8051

8-bit Multiplication

2. a) AIM: Write an assembly language program to add two numbers

EQUIPMENT REQUIRED: Personal Computer, Kiel Software

PROGRAM:

ORG 8000H
;MULTIPLICATION
MOV A, #03H
MOV B, #06H
MUL AB
MOV R2, A
RESULT:
a = 0x012 r2 = 0x12
Sp = 0x07
OUTCOME: The Multiplication of two numbers is performed.

8-bit Division

2. b) AIM: Write an assembly language program for division of two numbers

EQUIPMENT REQUIRED: Personal Computer, Kiel Software

PROGRAM:
ORG 8000H
; DIVISION
MOV A, #08H
MOV B, #03H
DIV AB
MOV R3, A
MOV R4, B
RESULT:

A = 0x02 Sp = 0x07 r3 = 0x02


B = 0x02 r4 = 0x02
OUTCOME
The Division of two numbers for 8051 is performed.
10
Exp No.7: Program for 8-bit logical operations for 8051

AIM: Write an assembly language program for logical operations

EQUIPMENT REQUIRED: Personal Computer, Kiel Software

PROGRAM:
ORG 8000H
MOV R0, #0FH
MOV R1, #FOH
MOV R2, #66H
; AND OPERATION
MOV A, #FFH
ANL A, R0
MOV R3, A
; OR OPERATION
MOV A, #FFH
ORL A, R1
MOV R4, A
; XOR OPERATION
MOV A, 03H
MOV A, #FFH
XRL A, R2
MOV R5, A
LCALL 0003H
; CLEAR REGISTER A
MOV A, #0FH
CLR A
MOV R0, A
; SWAP NIBBLES OF REGISTER A
MOV A, #56H
SWAP A
MOV R1, A
; COMPLEMENT THE BIT OF REGISTER A
MOV A, #66H
CPL A

11
MOV R2, A
; ROTATE THE REGISTER CONTENTS TOWARDS RIGHT
MOV A, #63H
RR A
XRL A, R
MOV R3, A
;ROTATE THE REGISTER CONTENTS TOWARDS LEFT
MOV A, #43H
RL A
XRL A, R
MOV R4, A
LCALL 0003H
END
RESULT:
r0 = 0x0f r3 = 0x0f r7 = 0xc4 psw = 0x01
r1 = 0x21 r4 = 0x1f a = 0x29
r2 = 0x66 r5 = 0x09 Sp = 0x81

OUTCOME:

The Logical operations for 8051 are performed.

12
Exp No.8: Program to blink LED with time delay

AIM: Assembly Language Program blink an LED with time delay of 5 Seconds Time Delay in using
8051 Microcontroller.
EQUIPMENT REQUIRED: Personal Computer, Kiel Software

PROGRAM:
ORG 0000H
CLR P3.0
BVRIT: SETB P3.0
ACALL DELAY
CLR P3.0
ACALL DELAY
JMP BVRIT
DELAY: MOV R0,#10H
HERE : DJNZ R0,HERE
END

RESULT:

LED blinks for every 5 seconds.

OUTCOME:

The Program to blink LED with time delay of 5 seconds is done successfully.

13
PART-C
Exp No.9: Blink LED with time delay using Arduino Uno Board
Introduction

To build the circuit, attach a 220-ohm resistor to any pin of Arduino board. Then attach the long
leg of an LED (the positive leg, called the anode) to the resistor. Attach the short leg (the negative leg,
called the cathode) to ground. Then plug the Arduino board into the computer, start the Arduino
program.

Schematic:

Arduino LED Interfacing

Arduino program:

In the program below, the first to do is to initialize pin 13 as an output pin with the line
pinMode (13, OUTPUT);
In the main loop, turn the LED on with the line:
digitalWrite (13, HIGH);
This supplies 5 volts to pin 13. That creates a voltage difference across the pins of the LED, and lights
it up. Then turn it off with the line:
digitalWrite(13, LOW);
That takes pin 13 back to 0 volts, and turns the LED off. In between the on and the off, the delay ()
commands tells the Arduino to do nothing for 1000 milliseconds, or one second.

14
PROGRAM

int led = 13;

void setup()
{
pinMode(led, OUTPUT);
}

void loop()
{
digitalWrite(led, HIGH);

delay(1000);

digitalWrite(led, LOW);

delay(1000);
}

RESULT:

13 Pin LED blinked with 1 second delay.

OUTCOME:

The inbuilt 13 pin LED was successfully interfaced with Arduino Uno.

15
Exp No.10: Interface LCD to Arduino Uno Board for display of Strings
Introduction
The term LCD stands for liquid crystal display. It is one kind of electronic display module used
in an extensive range of applications like various circuits & devices like mobile phones,calculators,
computers, TV sets, etc.

16X2 LCD

The 2x16 LCD uses the 4-bit interface. The RD/WR pin of the LCD is grounded so that write
is permanently enabled. There is a potentiometer for adjusting the contrast. Adjust the pot till a strip
of dark blocks is observed in the first line of the LCD.

Schematic

Arduino LCD interfacing

16
Program to display Strings:

LiquidCrystal lcd( );

void setup()
{
lcd.begin(16, 2);

lcd.print("hello, world!");
}

void loop()
{

lcd.setCursor(0, 1);

lcd.print(millis()/10000
}
RESULT:
LCD Display
“Hello world”

OUTCOME

Successfully interfaced LCD to Arduino Uno board for display of strings.

17
Exp No.11: Interfacing DHT11 sensor to record Humidity and Temperature
on Arduino Board

Introduction

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses acapacitive
humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal on the
data pin (no analog input pins needed). It is fairly simple to use, but requires careful timing to grab
data. The only real downside of this sensor is you can only get new data from it once every 2 seconds;
the sensor readings can be up to 2 seconds old.

Technical Details
• Low cost
• 3 to 5V power and I/O
• 2.5mA max current use during conversion (while requesting data)
• Good for 20-80% humidity readings with 5% accuracy
• Good for 0-50°C temperature readings ±2°C accuracy
• No more than 1 Hz sampling rate (once every second)
• Body size 15.5mm x 12mm x 5.5mm
• 4 pins with 0.1" spacing

DTH11 Module

Arduino-DTH11 Interfacing

18
Program:

#include "DHT.h"

#define DHTPIN 2 // Digital pin connected to the DHT sensor

#define DHTTYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);

void setup()

Serial.begin(9600);

Serial.println(F("DHTxx test!"));

dht.begin();

void loop() {

delay(2000);

float h = dht.readHumidity()

float t = dht.readTemperature();

float f = dht.readTemperature(true);

if (isnan(h) || isnan(t) || isnan(f))

Serial.println(F("Failed to read from DHT sensor!"));

return;

float hif = dht.computeHeatIndex(f, h);

float hic = dht.computeHeatIndex(t, h, false);

Serial.print(F(" Humidity: "));

Serial.print(h);

Serial.print(F("% Temperature: "));

19
Serial.print(t);

Serial.print(F("C "));

Serial.print(f);

Serial.print(F("F Heat index: "));

Serial.print(hic);

Serial.print(F("C "));

Serial.print(hif);

Serial.println(F("F"));

RESULT:

270C

OUTCOME:

Successfully interfaced DHT11 sensor to read humidity and Temperature using Arduino board.

20

You might also like