You are on page 1of 139

1602-18-737-071

Hema Kamani

VASAVI COLLEGE OF ENGINEERING


Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 20.03.2021

Name of the course: ES&IOT Lab

Experiment 1: Addition of two numbers


Aim: To add two numbers and store result in Accumulator
Program:
mov a, #2

mov b, #3

add a,b

end

Output:
1602-18-737-071
Hema Kamani

Experiment 2: Subtraction of two numbers


Aim: To subtract two numbers and store result in Accumulator
Program:
mov a, #3

mov b, #2

subb a,b

end

Output:
1602-18-737-071
Hema Kamani

Experiment 3: Multiplication of two numbers


Aim: To multiply two numbers and store result in Accumulator
Program:
mov a, #2

mov b, #3

mul ab

end

Output:
1602-18-737-071
Hema Kamani

Experiment 4: Division of two numbers


Aim: To divide two numbers and store result in Accumulator
Program:
mov a, #10h

mov b, #02h

div ab

end

Output:
1602-18-737-071
Hema Kamani

Experiment 5:Average of numbers


Aim: To compute average of numbers and store result in Accumulator
Program:
mov r0,#30h

mov r1,#05h

mov b,#05

L1: add a,@r0

inc r0

djnz r1,L1

div ab

end

Output:
1602-18-737-071
Hema Kamani

Experiment 6:Block transfer of numbers


Aim: To transfer block of data from one location to another location
Program:
mov r0,#30h

mov r1,#40h

mov r2,#04

L1: mov a,@r0

mov @r1,a

inc r0

inc r1

djnz r2,L1

end

Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: B.E ES&IoT Lab Roll No: 1602-18-737-071
Section: IT-B Week-2 Name: Hema Kamani

Experiment 1: Port toggling


Aim: To write a program which toggles port 0 with some delay.
Program:
l1:mov a,#0ffh
mov P0,a
acall delay
mov a,00h
mov P0,a
acall delay
sjmp l1
delay:mov r5,#0fh
l3:mov r3,#0ffh
l2:djnz r3,l2
djnz r5,l3
ret
end
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: B.E ES&IoT Lab Roll No: 1602-18-737-071
Section: IT-B Week-2 Name: Hema Kamani
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: B.E ES&IoT Lab Roll No: 1602-18-737-071
Section: IT-B Week-2 Name: Hema Kamani

Experiment 2: Toggling Port 1.0 pin


Aim: To write a C program which toggles port1.0 with some delay.

Program:
l1:setb P1.0
acall delay
clr P1.0
acall delay
sjmp l1
delay:mov r5,#1fh
l3:mov r3,#0ffh
l2:djnz r3,l2
djnz r5,l3
ret
end

Output:
Experiment 3: Handling data of P1 with port p2.1
Aim: To write a program to handle data at p1 with help of p2.1
Program:
setb p2.1
l1:jb p2.1,l2
mov a,#00h
mov p1,a
sjmp l3
l2:mov a,#0ffh
mov p1,a
l3:sjmp l1
end
Output:
Experiment 4: Toggling Port 0 pins
Aim: To write a C program which toggles port 0 with some delay.
Program:
#include <reg51.h>
#define led P1
void delay (unsigned int);
void main()
{
while(1)
{
led=0xff;
delay(100);
led=0x00;
delay(100);
}
}
void delay(unsigned int time)
{
unsigned int x,y; for(x=0;x<1000;x+
+)
{
for(y=0;y<time;y++)
{
}
}
}
Output:
Experiment 5: Handling data at p1 with p2
Aim: To write a C program to handle data at p1 with help of p2.1
Program:
#include <reg51.h>
sbit a=P2^1;
#define led P1
void main()
{
while(1)
{
if(a==1)
led=0XFF;
else
led=0X00;
}
}
Output:
Experiment 6:
Aim: To write a C program to toggle p2.1 bit
Program:
#include <reg51.h>
sbit a=P2^1;
void delay (unsigned int);
void main()
{
while(1)
{ a=0
1;
delay(100);
a=00;
delay(100);
}
}
void delay(unsigned int time)
{
unsigned int x,y;
for(x=0;x<1000;x++)
{
for(y=0;y<time;y++)
{
}
}
}
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

LAB-3
Experiment 1: Timer in mode 0
Aim: Write a program to generate pulse, create delay with timer0 (T0) at P1.2
operate in mode0  with frequency 2 KHz.

Program:
mov tmod ,#00h;
l1: mov tl0,#1Ah;
mov th0,#1Fh;
cpl p1.2;
setb tr0;
target:jnb tf0,target;
clr tr0;
clr tf0;
sjmp l1
end
Calculations:
time period=1/2KHz =0.5millisecond. 
For the half of the clock pulse time = 0.5/2=0.25 ms 
Count= 0.25 milliseconds/1.085micro seconds = 230
In mode 0 : (maximum count = 1FFFh+rollover) 8192 – 230=(7962) 10
In Hex decimal=1F1Ah
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Program to generate pulse, create delay with timer0 (T0) at P1.2 operate in
mode0 with frequency 2 KHz was executed successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 2: Timer in mode 1


Aim: Write a program to generate pulse, create delay with timer0 (T0) at P0.2
operate in mode1  with frequency 2 KHz.

Program:
mov tmod ,#01h;
l1: mov tl0,#1Ah;
mov th0,#0FFh;
cpl p0.2;
setb tr0;
target:jnb tf0,target;
clr tr0;
clr tf0;
sjmp l1 end
Calculations:
time period=1/2KHz =0.5millisecond. 
For the half of the clock pulse time = 0.5/2=0.25 ms 
Count= 0.25 milliseconds/1.085micro seconds = 230
In mode 1 : (maximum count = FFFFh + rollover) 65536 – 230=(65306) 10
In Hex decimal=FF1Ah
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Program to generate pulse, create delay with timer0 (T0) at P0.2 operate in
mode1 with frequency 2 KHz was executed successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 3: Timer in mode 2


Aim: Write a program to generate pulse, create delay with timer0 (T0) at P1.1
operate in mode2  with frequency 2 KHz.

Program:
mov tmod ,#02h;
mov th0,#1Ah;
l1: cpl p1.1;
setb tr0;
target:jnb tf0,target;
clr tr0;
clr tf0;
sjmp l1
end
Calculations:
time period=1/2KHz=0.5millisecond. 
For the half of the clock pulse time = 0.5/2=0.25 ms 
Count=0.25 milliseconds/1.085micro seconds = 230
In mode 2: (maximum count = FFh + rollover) 256 – 230=(26) 10
In Hex decimal=1Ah
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Program to generate pulse, create delay with timer0 (T0) at P1.1 operate in
mode2 with frequency 2 KHz was executed successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 4: Timer in mode 0


Aim: To write a C program to generate pulse, create delay with timer0 (T0) at P1.1
operate in mode0  with frequency 3 KHz.

Program:
#include <reg51.h>
void delay(void);
sbit a=P1^1;
void main(void){
while(1)
{
a=~a;
delay();
}
}
void delay(void){
TMOD=0x00;
TL0=0xF8;
TH0=0x20;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Calculations:
time period=1/3KHz =0.33millisecond. 
For the half of the clock pulse time = 0.33/2=0.165 ms 
Count= 0.165 milliseconds/1.085micro seconds = 152
In mode 0 : (maximum count = 1FFFh ) 8591 + 1(rollover) – 152=(8440) 10
In Hex decimal=20F8H
Output:

Result: C program to generate pulse, create delay with timer0 (T0) at P1.1 operate in
mode0  with frequency 3 KHz was executed successfully..
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 5: Timer in mode 1


Aim: Write a C program to generate pulse, create delay with timer0 (T0) at P1.2
operate in mode 1  with frequency 3 KHz.

Program:
#include <reg51.h>
void delay(void);
sbit a=P1^2;
void main(void){
while(1)
{
a=~a;
delay();
}
}
void delay(void){
TMOD=0x10;
TL0=0x68;
TH0=0xFF;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Calculations:
time period=1/3KHz =0.33millisecond. 
For the half of the clock pulse time = 0.33/2=0.165 ms 
Count= 0.165 milliseconds/1.085micro seconds = 152
In mode 1 : (maximum count = FFFFh ) 65535 + 1(rollover) – 152=(65384) 10
In Hex decimal=FF68H

Output:

Result: C program to generate pulse, create delay with timer0 (T0) at P1.2 operate in
mode1  with frequency 3 KHz was executed successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 6: Timer in mode 2


Aim: Write a C program to generate pulse, create delay with timer0 (T0) at P1.3
operate in mode 2  with frequency 3 KHz.

Program:
#include <reg51.h>
void delay(void);
sbit a=P1^3;
void main(void){
while(1)
{
a=~a;
delay();
}
}
void delay(void){
TMOD=0x02;
TH0= 0x68;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
Calculations:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

time period=1/3KHz =0.33millisecond. 


For the half of the clock pulse time = 0.33/2=0.165 ms 
Count=0.165 milliseconds/1.085micro seconds = 152
In mode 2 : (maximum count = FFH ) 255 + 1(rollover) – 152=(104) 10
In Hex decimal=68H
Output:

Result: C program to generate pulse, create delay with timer0 (T0) at P1.3 operate in
mode2 with frequency 3 KHz was executed successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 7
Aim: Write a C program to toggle all bits of port P1 continuously with some delay in
between. Use timer 0, 16-bit mode to generate the delay.

Program:
#include<reg51.h>

void T0Delay(void);

void main(void)

while(1)

P1=0x55;

T0Delay();

P1=0xAA;

T0Delay();

void T0Delay()

TMOD=0x01;

TL0=0x00;

TH0=0x35;

TR0=1;

while(TF0==0);

TR0=0;

TF0=0;
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Calculations:
Maximum Count= FFFFH
Given TL0,TH0= 3500H
Count= FFFFH-3500H=CAFFH=(51967)10 + 1(roll over)= 51968
Delay= 51968*1.085 micro seconds=56.384milli seconds.

Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Result : C program to toggle all bits of port P1 continuously with some delay in
between by Use timer 0, 16-bit mode to generate the delay was executed
successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

LAB-3
Experiment 1: Timer in mode 0
Aim: Write a program to generate pulse, create delay with timer0 (T0) at P1.2
operate in mode0  with frequency 2 KHz.

Program:
mov tmod ,#00h;
l1: mov tl0,#1Ah;
mov th0,#1Fh;
cpl p1.2;
setb tr0;
target:jnb tf0,target;
clr tr0;
clr tf0;
sjmp l1
end
Calculations:
time period=1/2KHz =0.5millisecond. 
For the half of the clock pulse time = 0.5/2=0.25 ms 
Count= 0.25 milliseconds/1.085micro seconds = 230
In mode 0 : (maximum count = 1FFFh+rollover) 8192 – 230=(7962) 10
In Hex decimal=1F1Ah
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Program to generate pulse, create delay with timer0 (T0) at P1.2 operate in
mode0 with frequency 2 KHz was executed successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 2: Timer in mode 1


Aim: Write a program to generate pulse, create delay with timer0 (T0) at P0.2
operate in mode1  with frequency 2 KHz.

Program:
mov tmod ,#01h;
l1: mov tl0,#1Ah;
mov th0,#0FFh;
cpl p0.2;
setb tr0;
target:jnb tf0,target;
clr tr0;
clr tf0;
sjmp l1 end
Calculations:
time period=1/2KHz =0.5millisecond. 
For the half of the clock pulse time = 0.5/2=0.25 ms 
Count= 0.25 milliseconds/1.085micro seconds = 230
In mode 1 : (maximum count = FFFFh + rollover) 65536 – 230=(65306) 10
In Hex decimal=FF1Ah
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Program to generate pulse, create delay with timer0 (T0) at P0.2 operate in
mode1 with frequency 2 KHz was executed successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 3: Timer in mode 2


Aim: Write a program to generate pulse, create delay with timer0 (T0) at P1.1
operate in mode2  with frequency 2 KHz.

Program:
mov tmod ,#02h;
mov th0,#1Ah;
l1: cpl p1.1;
setb tr0;
target:jnb tf0,target;
clr tr0;
clr tf0;
sjmp l1
end
Calculations:
time period=1/2KHz=0.5millisecond. 
For the half of the clock pulse time = 0.5/2=0.25 ms 
Count=0.25 milliseconds/1.085micro seconds = 230
In mode 2: (maximum count = FFh + rollover) 256 – 230=(26) 10
In Hex decimal=1Ah
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Program to generate pulse, create delay with timer0 (T0) at P1.1 operate in
mode2 with frequency 2 KHz was executed successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 4: Timer in mode 0


Aim: To write a C program to generate pulse, create delay with timer0 (T0) at P1.1
operate in mode0  with frequency 3 KHz.

Program:
#include <reg51.h>
void delay(void);
sbit a=P1^1;
void main(void){
while(1)
{
a=~a;
delay();
}
}
void delay(void){
TMOD=0x00;
TL0=0xF8;
TH0=0x20;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Calculations:
time period=1/3KHz =0.33millisecond. 
For the half of the clock pulse time = 0.33/2=0.165 ms 
Count= 0.165 milliseconds/1.085micro seconds = 152
In mode 0 : (maximum count = 1FFFh ) 8591 + 1(rollover) – 152=(8440) 10
In Hex decimal=20F8H
Output:

Result: C program to generate pulse, create delay with timer0 (T0) at P1.1 operate in
mode0  with frequency 3 KHz was executed successfully..
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 5: Timer in mode 1


Aim: Write a C program to generate pulse, create delay with timer0 (T0) at P1.2
operate in mode 1  with frequency 3 KHz.

Program:
#include <reg51.h>
void delay(void);
sbit a=P1^2;
void main(void){
while(1)
{
a=~a;
delay();
}
}
void delay(void){
TMOD=0x10;
TL0=0x68;
TH0=0xFF;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Calculations:
time period=1/3KHz =0.33millisecond. 
For the half of the clock pulse time = 0.33/2=0.165 ms 
Count= 0.165 milliseconds/1.085micro seconds = 152
In mode 1 : (maximum count = FFFFh ) 65535 + 1(rollover) – 152=(65384) 10
In Hex decimal=FF68H

Output:

Result: C program to generate pulse, create delay with timer0 (T0) at P1.2 operate in
mode1  with frequency 3 KHz was executed successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 6: Timer in mode 2


Aim: Write a C program to generate pulse, create delay with timer0 (T0) at P1.3
operate in mode 2  with frequency 3 KHz.

Program:
#include <reg51.h>
void delay(void);
sbit a=P1^3;
void main(void){
while(1)
{
a=~a;
delay();
}
}
void delay(void){
TMOD=0x02;
TH0= 0x68;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;
}
Calculations:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

time period=1/3KHz =0.33millisecond. 


For the half of the clock pulse time = 0.33/2=0.165 ms 
Count=0.165 milliseconds/1.085micro seconds = 152
In mode 2 : (maximum count = FFH ) 255 + 1(rollover) – 152=(104) 10
In Hex decimal=68H
Output:

Result: C program to generate pulse, create delay with timer0 (T0) at P1.3 operate in
mode2 with frequency 3 KHz was executed successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Experiment 7
Aim: Write a C program to toggle all bits of port P1 continuously with some delay in
between. Use timer 0, 16-bit mode to generate the delay.

Program:
#include<reg51.h>

void T0Delay(void);

void main(void)

while(1)

P1=0x55;

T0Delay();

P1=0xAA;

T0Delay();

void T0Delay()

TMOD=0x01;

TL0=0x00;

TH0=0x35;

TR0=1;

while(TF0==0);

TR0=0;

TF0=0;
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Calculations:
Maximum Count= FFFFH
Given TL0,TH0= 3500H
Count= FFFFH-3500H=CAFFH=(51967)10 + 1(roll over)= 51968
Delay= 51968*1.085 micro seconds=56.384milli seconds.

Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 8.04.2021

Name of the course: ES&IOT Lab

Result : C program to toggle all bits of port P1 continuously with some delay in
between by Use timer 0, 16-bit mode to generate the delay was executed
successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 17.04.2021

Name of the course: ES&IOT Lab

LAB-5
Experiment 1:

Aim: To write a assembly language program that continuously sets 8 bit data from P0 and sends
it to P1 , which simultaneously generates square wave of 200 micro sec period on p2.1 using T0
register to create delay and assuming that XTAL frequency 11.0592 Mhz.

Program:
ORG 0000H

LJMP L1

ORG 000BH

CPL P2.1

RETI

ORG 0030H

L1: MOV TMOD,#02H

MOV P0,#0FFH

MOV TH0,#-92

MOV IE,#82H

;Timer 0

SETB TR0

L2: MOV A,P0

MOV P1,A

SJMP L2

END
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 17.04.2021

Name of the course: ES&IOT Lab

Output:

Result: Assembly language program that continuously sets 8 bit data from P0 and sends it to
P1 , which simultaneously generates square wave of 200 micro sec period on p2.1 using T0
register to create delay is executed successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 17.04.2021

Name of the course: ES&IOT Lab

Experiment 2:
Aim: To write a assembly language program in which the 8051 reads data from P1 and writes it to
P2 continuously , while giving copy of it to the serial port , When ever it receives a character from
serial gives a copy of it to P0 ( Assume XTAL frequency is 11.0592 MHz , baud rate is 9600 ).

Program:
MOV P1 , # 0FFH

Mov TMOD ,# 20H

Mov TH1, # 0FDH

Mov SCON ,# 50H

MOV IE ,# 90H

SETB TR1

L1: Mov A, P1

MOV SBUF ,A

Mov p2 ,A

SJMP L1

ORG 23H

L2: JB TI ,L3

MOV A, SBUF

MOV P0,A

CLR RI

RETI

L3: CLR TI

RETI

END
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll no: 1602-18-737-071 Name: Hema Kamani Date of Submission: 17.04.2021

Name of the course: ES&IOT Lab


Output:

Result: Assembly language program in which the 8051 reads data from P1 and writes it to P2
continuously , while giving copy of it to the serial port , When ever it receives a character from serial
gives a copy of it to P0 is executed successfully.
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

WEEK-6

Experiment 1:

Aim: To write a assembly language program for rotating stepper motor 180 o anticlockwise
continuously.
Flowcahrt:
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

PROGRAM:
L1:MOV R4,#100D

MOV A,#11H

BACK: MOV P2,A

RR A

ACALL DELAY

DJNZ R4,BACK

DELAY:MOV R2,#200

H1:MOV R3,#255

H2:DJNZ R3,H2

DJNZ R2,H1

RET

SJMP L1

END

KEIL μ VISION OUTPUT:


VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Before Execution design look like:


VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

After Execution design look like:

RESULT:

Assembly language program for rotating stepper motor 180 o anticlockwise continuously is
executed successfully.
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Experiment 2:
o
Aim: To write a assembly language program for rotating stepper motor 180 clockwise
continuously.

Program:

L1:MOV R4,#100D
MOV A,#11H
BACK: MOV P2,A
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

RL A
ACALL DELAY
DJNZ R4,BACK
DELAY:MOV R2,#200
H1:MOV R3,#255
H2:DJNZ R3,H2
DJNZ R2,H1
RET
SJMP L1
END

OUTPUT:
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Before execution Design:

After execution Design:


VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

o
Result Assembly language program for rotating stepper motor 180 clockwise continuously is
executed successfully .
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Exp 3:
Aim: To write a assembly language program for rotating stepper motor 360 o clockwise
and 360 o anti clock wise continuously

Program:
L1:MOV R2,#200d
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

MOV A,#11H

H2:MOV P2,A

MOV R3,#11111111b

H1:DJNZ R3,H1

RR A

DJNZ R2,H2

MOV R2,#200D

H4:MOV P2,A

MOV R3,#11111111b

H5:DJNZ R3,H5

RL A

DJNZ R2,H4

SJMP L1

END
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Output:

Before executing design looks like:


VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

After executing design looks like:

Result:
Assembly language program for rotating stepper motor 360 o clockwise and 360 o anti
clock wise continuously is executed successfully.
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

WEEK-7

Experiment 1:

Aim: To write an assembly language program that displays “HEMA 071 VCE IT DEPT” on
LCD continuously.

Flowcahrt:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

PROGRAM:

#include<reg51.h>
void lcdcmd(unsigned char);
void msdelay(unsigned int);
void lcddata(unsigned char);
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

sfr ldata=0xA0;
sbit rs=P3^7;
sbit rw=P3^6;
sbit en=P3^5;
void main()
{
while(1)
{
lcdcmd(0x38); // function set 8-bit mode 2 line and 5X7 dot matrix
msdelay(25); // delay function
lcdcmd(0x0e); // display on and cursor on
msdelay(500);
lcdcmd(0x01); // clear display screen
msdelay(500);
lcdcmd(0x06); // entry mode( shift cursor to right)
msdelay(500);
lcdcmd(0x85); // force cursor to 4th position of the line 1
msdelay(500);
lcddata('H');
msdelay(500);
lcddata('E');
msdelay(500);
lcddata('M');
msdelay(500);
lcddata('A');
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

msdelay(500);
lcddata('N');
msdelay(500);
lcddata('T');
msdelay(500);
lcddata('H');
msdelay(500);
lcddata(' ');
msdelay(500);
lcddata('0');
msdelay(500);
lcddata('7');
msdelay(500);
lcddata('2');
msdelay(500);
lcdcmd(0xC2);
msdelay(500);
lcddata('V');
msdelay(500);
lcddata('C');
msdelay(500);
lcddata('E');
msdelay(500);
lcddata(' ');
msdelay(500);
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

lcddata('I');
msdelay(500);
lcddata('T');
msdelay(500);
lcddata(' ');
msdelay(500);
lcddata('D');
msdelay(500);
lcddata('E');
msdelay(500);
lcddata('P');
msdelay(500);
lcddata('T');
msdelay(500);
}
}
void lcdcmd(unsigned char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
msdelay(1);
en=0;
return;
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

}
void lcddata(unsigned char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
msdelay(1);
en=0;
return;
}
void msdelay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++);
for(j=0;j<1275;j++);

}
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

Before Execution design look like:


VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

After Execution design look like:


VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No. 1 .

RESULT:
Assembly language program that displays “HEMA 071 IT DEPT” on LCD continuously is successfully
executed.
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

WEEK-8
Experiment 1:
Aim: To write a assembly language program that displays a Sawtooth wave
using digital data entered to DAC .

PROGRAM:
Back1: Mov A,#00H
Mov R0,# 0FFH
Back: Mov P2,A
Inc A
Djnz R0,Back
Sjmp Back1
End
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

KEIL μ VISION OUTPUT:


VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Output:

RESULT: Assembly language program that displays a sawtooth wave using digital data entered to
DAC is executed successfully.
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Experiment 2:

AimTo write a assembly language program that displays a square wave using digital data
entered to DAC .

Program:

Mov A,#00H
L2: Mov P2,A
Mov R0,#0FFH
L1: Djnz R0,L1
Cpl A
Sjmp L2

OUTPUT:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Before execution Design:

After execution Design:


VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Result Assembly language program that displays a square wave using digital data entered
to DAC is executed successfully .
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Exp 3:
Aim: To write assembly language program that displays a triangular wave using digital
data entered to DAC

Program:
Back1: Mov A,00H

Mov R0, #0FFH

Back :Mov P2,A

Inc A

Djnz R0 ,Back

Mov R0,# 0FFH

Back2 : Mov P0,A

Dec A

Djnz R0 ,Back2

Sjmp Back1

end

Output:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Design:

Result:
Assembly language program that displays a triangular wave using digital data entered to DAC is
executed successfully.
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Exp 4:

Aim: To write a embedded C program that displays a sawtooth wave using digital data entered to
DAC

Program:

# include <reg 51.h>

void main(void)

Unsigned int x;

While(1)

For( x=0; x< 255; x++)

P0= x;

x=0;

P0=x;

}
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Output:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Design:

Result:
Embedded C program that displays a sawtooth wave using digital data entered to DAC is executed
successfully.
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Exp 5:

Aim:

To write a embedded C program that displays a square wave using digital data entered to DAC .

Program:
#include<reg51.h>

void delay()

int i=0;

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

void main()

while(1)

P2=0XFF;

delay();

P2=0X00;

delay();

} }
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Output:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Design :

Result:
Embedded C program that displays a square wave using digital data entered to DAC is executed
successfully.
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Exp 6 :
Aim:
To write a embedded C program that displays a triangular wave using digital data entered to DAC .

Program:
# include<reg51.h>

void main(void)

unsigned int x;

while(1)

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

P2= x;

for ( x=255 ;x>0; x--)

P2=x;

Output:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Design:
VASAVI COLLEGE OF
ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071 Page No.01 .

Result:
Embedded C program that displays a triangular wave using digital data entered to DAC is executed
successfully.
VASAVI COLLEGE OF ENGINEERING
5
Department of Information Technology
Semester: 6
Course: B.E Section: B
Roll No: 1602-18-737-071 Name: Hema Date of submission:09-05-2021
Name of the course: ES AND IOT LAB week-9

AIM:
To write a assembly language program that displays digits 0-9 in 7 segmented display
(interfacing 7 segmented display with 8051)

PROGRAM:
ORG 4000H
DB 3FH, 06H, 5BH, 4FH, 66H, 6DH, 7DH, 07H, 7FH, 6FH
ORG 0000H
main: MOV DPTR, #4000H
repeat: CLR A
MOVC A, @A+DPTR
MOV P2, A
ACALL delay
INC DPTR
CJNE A, 0, repeat
SJMP main
delay: MOV R0, #08H
LP2: MOV R1, #0FFH
LP1:MOV R2, #0FFH
LP3:DJNZ R2, LP3
DJNZ R1, LP1
DJNZ R0, LP2
RET
END
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Page No. 2 .

PROGRAM SCREENSHOT:
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Page No. 3 .

DESIGN:

DESIGN EXECUTION:
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Page No. 4 .
VASAVI COLLEGE OF ENGINEERING
AUTONOMOUS
(Affiliated to Osmania University)
Hyderabad- 500 031
DEPARTMENT OF : INFORMATION TECHNOLOGY
NAME OF THE LABORATORY : Embedded Systems and IoT LAB _
Name Hema Kamani Roll No. 1602-18-737-071

Page No. 5 .

RESULT:

Assembly language program that displays digits 0-9 in 7 segmented display is executed
successfully
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 24.05.2021

Name of the Course: ES-IOT Lab

1.Aim:
Write a program in assembly language to interface ADC and display message on LCD.
Algorithm:
Step 1: Start
Step 2: Equate P0.0 to ADDA, P0.1 to ADDB, P0.2 to ADDC, P0.3 to ale, P0.4 to sc, P0.5 to
eoc, P0.6 to oe.
Step 3: Input a number and convert to ascii format using user defined by convert().
Step 4: Save code and add to Target->Source Group and click on build target.
Step 5: Then click on Flash->Output, give filename and convert to hex file by clicking on
“OK”.
Step 6: Now, do Translate and press Build target. (hex file will generate in objects file).
Step 7: Now, go to proteus software and add required components (89c51, lcd,adc) and give
connections.
Step 8: Now, load the hex file into 8051.
Step 9: Click on Run button.
Step 10: Stop.

Program:
#include<MYLIB.h>
#define input_port P1 //ADC
//sfr input_port=0x90;
sbit ADDA=P0^0; //Address pins for selecting input channels.
sbit ADDB=P0^1;
sbit ADDC=P0^2;
sbit ale=P0^3;
sbit sc=P0^4;
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 24.05.2021

Name of the Course: ES-IOT Lab

sbit eoc=P0^5;
sbit oe=P0^6;

unsigned char number;

void convert(unsigned char value)


{
unsigned char x,d1,d2,d3;
x=value/10;
d1=value%10;
d2=x%10;
d3=x/10;
lcddata(d3+48);
msdelay(1);
lcddata(d2+48);
msdelay(1);
lcddata(d1+48);
msdelay(10);
}

void main()
{
number=0;
eoc=1; // eoc as input pin
ale=0; // eoc as output pin
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 24.05.2021

Name of the Course: ES-IOT Lab

oe=0; // eoc as output pin


sc=0; // eoc as output pin
ADDC=0; // Selecting input channel IN0 using address lines
ADDB=0;
ADDA=0;

lcd_init8bit();
lcdcmd(0x83);
lcdprint(" ADC 0808 ");
lcdcmd(0xc1);
lcdprint(" Interfacing ");
msdelay(500);
lcdcmd(1);

while(1)
{
ADDC=0; // Selecting input channel IN0 using address lines
ADDB=0;
ADDA=0;
ale=1;
sc=1;
msdelay(1);
ale=0;
sc=0;
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 24.05.2021

Name of the Course: ES-IOT Lab

while(eoc==0);
oe=1;
number=input_port;
msdelay(1);
oe=0;
lcdcmd(0x80);
lcdprint("var res = ");
convert(number);

}
}
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 24.05.2021

Name of the Course: ES-IOT Lab


VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 24.05.2021

Name of the Course: ES-IOT Lab

Result:
Program in assembly language to interface ADC and display message on LCD is completed
successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

1.Aim:
Program to blink LED using Arduino Uno board.
Algorithm:
Step1: Take Arduino board, LED, Resistor.
Step2: Connect one end of LED to ground and another to pin13 using resistor.
Step3: Start simulation.
Step4: stop.
Output:

Result:
Program to blink LED using Arduino Board is executed successfully.

2.Aim:
Program to interface Ultrasonic distance sensor with Arduino Uno board.
Algorithm:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Step1: Take Arduino board, LED, Resistor, Ultrasonic distance sensor.


Step2: Connect digital input pin7 to SIG pin of Ultrasonic sensor,5v pin of Arduino to 5V pin
of sensor and ground to ground.
Step3: Start simulation.
Step4: stop.
Output:

Result:
Program to interface Ultrasonic distance sensor with Arduino Uno board and calculating
distance is successfully executed.

3.Aim:
Control blinking of LED with push button.
Algorithm:
Step1: Take Arduino board, LED, Resistor, push button.
Step2: Connect one end of LED to ground and another to pin13.Connect one end of push
button to pin 2 of Arduino. Another end to 5v using resistor. Another end to Ground.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Step3: Start simulation.


Step4: stop.
Output:

Result:
Controlling blinking of LED with push button is successfully executed.
4.Aim:
Program to interface gas sensor to Arduino Board.
Algorithm:
Step 1: Take Arduino board, breadboard, gas sensor, Resistor.
Step 2: Connect top ends of sensor to ground of breadboard. And down end to A0, another
to ground using resistor. So, it will read through Analog Read.
Step 3: When you bring dirt near to sensor it outputs big number and we you take away
from sensor it projects small values.
Step 4: Start simulation.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Step 5: stop.

Output:

Result:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Program to interface gas sensor with Arduino Uno board and calculating the value is
successfully executed.

5.Aim:
Program to interface LED display to Arduino Board and display “HELLO WORLD” with
seconds.
Algorithm:
Step 1: Take Arduino board, breadboard, led, Resistor.
Step 2: Connect the boards and led with wires as shown.
Step 3: It displays the text “hello world” and print the seconds in next row.
Step 4: Start simulation.
Step 5: stop.
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Result:
Program to interface LED display to Arduino Board and display “HELLO WORLD” with
seconds successfully executed.

6.Aim:
Program to interface Micro Servo with Arduino Board.
Algorithm:
Step 1: Take Arduino board, Micro servo.
Step 2: Connect the boards with servo with wires as shown.
Step 3: It displays rotate 180 degrees.
Step 4: Start simulation.
Step 5: stop.
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Result:
Program to interface Micro Servo with Arduino Board is successfully executed.

6.Aim:
Program to interface PIR sensor with Arduino Board and glow led if object is found.
Algorithm:
Step 1: Take Arduino board, breadboard, pir sensor, led, resistor.
Step 2: Connect the boards with pir sensor and led with wires as shown.
Step 3: Move the object away from it, the bulb won’t glow. If the sensor senses the object,
the object will grow.
Step 4: Start simulation.
Step 5: stop.
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 04.06.2021

Name of the Course: ES-IOT Lab

Result:
Program to interface PIR sensor with Arduino Board and glow LED if object is found.
is successfully executed.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 01.06.2021

Name of the Course: ES-IOT Lab

1.Aim:
Program to interface Keyboard to 8051 microprocessor.
Algorithm:
Step 1: Start
Step 2: Connect R1, R2, R3, R4 to P1.0, P1.1, P1.2, P1.3 and C1, C2, C3 to P1.4, P1.5, P1.6.
Step 3: Initiate R1=R2=R3=R4=0 and C1=C2=C3=1.
Step 4: To check where a switch is closed or not. Under while loop first give R1=0;
R2=R3=R4=1 and check with C’s . If C1==0 return 1 , C2==0 return 2, C3==0 return 3 and so
on.
Step 5: Check with R2=0; R1=R3=R4=1, R3=0; R1=R2=R4=1, R4=0; R2=R3=R1=1
Step 6: Stop.
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: A

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 01.06.2021

Name of the Course: ES-IOT Lab

Result:
Program to interface Keyboard to 8051 microprocessor is successfully executed.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 15.06.202


Name of the Course: ES-IOT Lab

1.Aim:
Program to read the temperature and store it in cloud server(thingspeak).
Algorithm:
Step 1: Start
Step 2: Create a channel in thingspeak and note the “write API Key”.
Step 3: Take a circuit consists of temperature sensor, WIFI module (ESP8266) and Arduino
board.
Step 4: Connect the modules using wires.
Step 5: In the string uri give API key and start simulation.
Step 6: Stop.
Output:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B

Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 15.06.202


Name of the Course: ES-IOT Lab

Result:
Program to read the temperature and store it in cloud server(thingspeak) is successfully
executed.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

EXPERIMENT-1:
AIM: Adding two Numbers.
Algorithm:

1. Start
2. Initialize num1, num2 with 0x0000aaaa, 0x0000bbbb
3. Load register R1 with num1.
4. Load register R2 with num2.
5. Load value of R1 into register R3.
6. Load value of R2 into register R4.
7. Add the numbers present in R3, R4 and store the number in R5.

PROCEDURE FOR EXECUTION:

1. Write the code in editor mode in simulator.

2. Save the code here

3. Click on Run->Assemble

4. Then click the run button in Execute tab.

5. Check the values in Registers table.

Program:
.arm
.data
sum: .word
num1: .word 0x0000aaaa
num2: .word 0x0000bbbb
.text
.global main @ 'main' function is mandatory.

main:
ldr r1, =num1
ldr r2, =num2
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

ldr r3, [r1]


ldr r4, [r2]
add r5, r3, r4
ldr r6, =sum
str r5, [r6]

OUTPUT:

RESULT: Program executed successfully.


VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

EXPERIMENT-2
AIM: Write a program to add elements in an array
ALGORITHM:

1. Start
2. Create an array of numbers
3. Initialize a counter register to the number of elements in an array
4. Load base address of an array to a register.
5. Load value to a temporary register
6. Add and store number in destination register
7. Decrement counter value
8. Repeat steps 5-7 till counter value becomes zero
9. Stop.

PROCEDURE FOR EXECUTION:


1. Write the code in editor mode in simulator.
2. Save the code here
3. Click on Run->Assemble
4. Then click the run button in Execute tab.
5. Check the values in Registers table.

Program:
.arm

.data
numarray: .word 1,2,3,4,5,6,7,8,9
sum: .word

.text
.global main @ 'main' function is mandatory.

main:
mov r0, #9 @ Set loop counter to 0
mov r1, #0 @ Set initial sum value to 0;
ldr r2, =numarray @ r2 = &numarray
.Lloop:
ldr r3, [r2], #4 @ r3 = *r2; r2=r2+4
add r1, r1, r3 @ sum = sum + numarray[i]
subs r0, r0, #1 @ Decrement loop counter
bne .Lloop @ Branch back if the loop counter i!=0
ldr r0, =sum @ r0 = &sum; Reuse register r0
str r1, [r0] @ *r0 = r1 (sum = r1)
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

Output:

Result: Program executed successfully.


VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

EXPERIMENT-3
Aim: To write a program to show output of sum of squares
Algorithm:

1. Start.
2. Initialize the array size and load it in R0.
3. Create an array of numbers.
4. Initialize a variable sqrsum with 0.
5. Initialize a Register R3 with 0.
6. Load base address of an array to a register R1.
7. Start Loop

7.1 if value in R0 is 0 then go to step 8 else continue the remaining steps.

7.2 Increment the base address and load it in register R2.

7.3 Square the number present in R2 and add it to R3.

7.4 Decrement R0 by 1.

7.5 Go to step 7

PROCEDURE FOR EXECUTION:

1. Write the code in editor mode in simulator.

2. Save the code here

3. Click on Run->Assemble

4. Then click the run button in Execute tab.

5. Check the values in Registers table.

Program:
.arm
.data
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

arraysize: .word 10
array: .word 1, -2, 3, -4, 5, -6, 8, -7, 9, -10
sqrsum:.word 0

.text
.global main @ 'main' function is mandatory.

@ r0 = arraysize; r1 = &array; r3 = sum; r2 = array[i]


@ Other Registers Used: r6, r7

main:
ldr r0, =arraysize @ r0 = &arraysize
ldr r0, [r0] @ r0 = arraysize. We are immediately reusing r0.
ldr r1, =array @ r1 = &array
mov r3, #0 @ r3 = 0 (sum = 0)
cmp r0, #0 @ if (r0 == 0) goto exit;
beq .Lexit

@ We are using r0 as a loop index variable

.Lloop: ldr r2, [r1], #4


mla r3, r2, r2, r3 @ r3 = r2*r2+r3 (sum = sum + array[i]*array[i])
subs r0, r0, #1
bne .Lloop
ldr r6, =sqrsum @ r6 = &sqrsum
str r3, [r6] @ *r6 = r3
.Lexit:
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

OUTPUT

RESULT:
Program executed Successfully.
VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

EXPERIMENT-4:

Aim: Program to execute forward branch

Program:

.text
.global main
main:
mov r3, #10
mov r4, #11
cmp r3, r4
ble .Lif
sub r0, r1, r2
b .Lexit
.Lif: add r0, r1, r2
.Lexit:
PROCEDURE FOR EXECUTION:

1. Write the code in editor mode in simulator.

2. Save the code here

3. Click on Run->Assemble

4. Then click the run button in Execute tab.

5. Check the values in Registers table.


VASAVI COLLEGE OF ENGINEERING
Department of Information Technology
Course: BE Semester: VI Section: B
Roll No: 1602-18-737-071 Name: Hema Kamani Date of Submission: 23.06.2021
Name of the Course: ES-IOT Lab 15

OUTPUT:

RESULT: program executed successfully.

You might also like