You are on page 1of 6

LAB#01

Led Interfacing with 89C51


1.1)

Programming:

#include<reg51.h>
void main()
{
unsigned i=0;
while(1)
{
P2=0x00;
for(i=0;i<32000;i++);
P2=0xff;
for(i=0;i<32000;i++);
}
}

Output:
And

1.2)

Programing:

#include<reg51.h>
void main()
{
unsigned i=0;
while(1)
{
P2=0xf0;
for(i=0;i<39000;i++);
P2=0x0f;
for(i=0;i<38000;i++);
}
}

Output:

And
1.3)

Codding:

#include<reg51.h>

void main()

unsigned i=0;

while(1)

P2=0xee;

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

P2=0xb0;
for(i=0;i<36000;i++);

P2=0x33;

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

Output:

1.4)

Codding:

#include<reg51.h>

void main()

unsigned i=0;

while(1)

P2=0xee;

for(i=0;i<39000;i++);
P2=0xb0;

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

P2=0x33;

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

Output:

You might also like