0% found this document useful (0 votes)
39 views14 pages

EmbeddedSystemLabReport Full Zayed

The document contains 6 problems related to interfacing LEDs and other devices with an 8051 microcontroller. Each problem includes the problem name, source code for a solution, and a result. The problems cover generating traffic signals, interfacing a stepper motor, simulating a binary counter on LEDs, creating patterns on LEDs, using timers to generate delays, and transferring data between two controllers using I/O ports.

Uploaded by

Foodie. Com
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)
39 views14 pages

EmbeddedSystemLabReport Full Zayed

The document contains 6 problems related to interfacing LEDs and other devices with an 8051 microcontroller. Each problem includes the problem name, source code for a solution, and a result. The problems cover generating traffic signals, interfacing a stepper motor, simulating a binary counter on LEDs, creating patterns on LEDs, using timers to generate delays, and transferring data between two controllers using I/O ports.

Uploaded by

Foodie. Com
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/ 14

0

INDEX

No. Problem Name Page

01 Develop a program to generate Traffic Signals. 01

Develop a program for interfacing stepper motor with


02 03
8051.

03 Simulate Binary Counter (8 Bits) on LEDs. 05

Develop a program for interfacing 8 LEDs at I/O ports and


04 07
create different patterns.

Configure timer control registers of 8051 and develop a


05 09
program to generate delay.

Use of General Purpose I/O port of two controllers for


06 11
data transfer.
1

Problem No: 01
Problem Name: Develop a program to generate traffic signals.
LED’s Interfacing with 8051:

Source Code:

#include<reg51.h>

sbit red = P2^0;


sbit yellow = P2^1;
sbit green = P2^2;

void delay(int time);


void main()
{
red = yellow = green = 0;
2

while(1)
{
red = 1;
delay(800);
red = 0;

yellow = 1;
delay(200);
yellow = 0;

green = 1;
delay(800);
green = 0;

yellow = 1;
delay(200);
yellow = 0;
}
}

void delay(int time)


{
int i,j;
for (i=0; i<time; i++)
{
for (j=0; j<1000; j++)
{
}
}
}

Result:
3

Problem No: 02
Problem Name: Develop a program for interfacing stepper motor
with 8051.
Stepper Motor’s Interfacing With 8051:

Source Code:
#include<reg51.h>

void delay();

void main()
{
while(1)
{
P2 = 0x09;
4

delay();
P2 = 0x03;
delay();
P2 = 0x06;
delay();
P2 = 0x0C;
delay();
}
}

void delay()
{
int i,j;
for (i=0; i<100; i++)
{
for (j=0; j<150; j++)
{
}
}
}

Result:
5

Problem No: 03
Problem Name: Simulate Binary Counter (8 Bits) on LEDs.
LED’s Interfacing with 8051:

Source Code:

#include<reg51.h>

void delay();

void main()
{
P1= 0;
while(1)
{
P1++;
delay();
}
}
6

void delay()
{
int i, j;
for(i=0; i<=100; i++)
{
for(j=0; j<=50; j++)
{
}
}
}

Result:
7

Problem No: 04
Problem Name: Develop a program for interfacing 8 LEDs at I/O
ports and create different patterns.
LED’s Interfacing with 8051:

Source Code:

#include<reg51.h>

void delay();

void main()
{
while(1)
{
P1 = 0x55;
delay();
P1 = 0xAA;
delay();
8

P1 = 0xC3;
delay();
}
}

void delay()
{
int i,j;
for(i=0;i<=100;i++)
{
for(j=0;j<=500;j++)
{
}
}
}

Result:
9

Problem No: 05
Problem Name: Configure timer control registers of 8051 and
develop a program to generate delay.
LED’s Interfacing with 8051:

Source Code:

#include<reg51.h>

void delay();

void main()
{
while(1)
{
P1 = 0x00;
delay();
P1 = 0xFF;
delay();
10

}
}

void delay()
{
int i, j;
for(i=0; i<300; i++)
{
for(j=0; j<300; j++)
{
}
}
}

Result:
11

Problem No: 06
Problem Name: Use of General Purpose I/O port of two controllers
for data transfer.
LED’s and Controller’s Interfacing with 8051:

Source Code:

For First Controller (U1):

#include<reg51.h>

void delay();

void main()
{
while(1)
{
12

P2 = 0xFF;
delay();
P2 = 0x00;
delay();
}
}

void delay()
{
int i, j;
for(i=0; i<300; i++)
{
for(j=0; j<300; j++)
{
}
}
}

For Second Controller (U2):

#include<reg51.h>

void delay();

void main()
{
while(1)
{
P2 = P1;
delay();
}
}

void delay()
{
int i, j;
for(i=0; i<300; i++)
{
for(j=0; j<300; j++)
{
}
}
}
13

Result:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy