SK MPMC Lab Record
SK MPMC Lab Record
PROGRAM:
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
PROGRAM:
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
PROGRAM:
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
PROGRAM:
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
5
RESULT:
AX = 1000
BX = 2000
CX = 3000
DX = 4000
OUTCOME:
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
PROGRAM:
RESULT:
Found
8
PART-B
Exp No.5 : Program for 8 bit Addition and Subtraction for 8051
8-bit addition
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
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
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
PROGRAM:
ORG 8000H
; DIVISION
MOV A, #08H
MOV B, #03H
DIV AB
MOV R3, A
MOV R4, B
RESULT:
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:
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:
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 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
void setup()
{
pinMode(led, OUTPUT);
}
void loop()
{
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
RESULT:
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
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
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"
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);
return;
Serial.print(h);
19
Serial.print(t);
Serial.print(F("C "));
Serial.print(f);
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