Friday, May 25, 2012

Program for LED Blinking in Fashion

#include<8051.h>
#include<stdio.h>
void delay (int time)
{
unsigned int i,j;
for (i=0;i<=time*10;i++)
{
for (j=0;j<=time*10;j++)
{
}}}
void main()
{
P1=0xff;
while(1)
{
P1=0x00;
delay(10);
P1_0=1;
delay(10);
P1_1=1;
delay(10);
P1_2=1;
delay(10);
P1_3=1;
delay(10);
P1_4=1;
delay(10);
P1_5=1;
delay(10);
P1_6=1;
delay(10);
P1_7=1;
delay(10);



P1=0x00;
delay(10);
P1_7=1;
delay(10);
P1_6=1;
delay(10);
P1_5=1;
delay(10);
P1_4=1;
delay(10);
P1_3=1;
delay(10);
P1_2=1;
delay(10);
P1_1=1;
delay(10);
P1_0=1;
delay(10);



P1=0x00;
delay(10);
P1=0x81;
delay(10);
P1=0xc3;
delay(10);
P1=0xe7;
delay(10);
P1=0xff;
delay(10);



P1=0x00;
delay(10);
P1=0x18;
delay(10);
P1=0x3c;
delay(10);
P1=0x7e;
delay(10);
P1=0xff;
delay(10);


P1=0x00;
delay(15);
P1_0=1;
delay(15);
P1_1=1;
delay(15);
P1_2=1;
delay(15);
P1_3=1;
delay(15);
P1_4=1;
delay(15);
P1_5=1;
delay(15);
P1_6=1;
delay(15);
P1_7=1;
delay(15);



P1=0x00;
delay(15);
P1_7=1;
delay(15);
P1_6=1;
delay(15);
P1_5=1;
delay(15);
P1_4=1;
delay(15);
P1_3=1;
delay(15);
P1_2=1;
delay(15);
P1_1=1;
delay(15);
P1_0=1;
delay(15);



P1=0x00;
delay(15);
P1=0x81;
delay(15);
P1=0xc3;
delay(15);
P1=0xe7;
delay(15);
P1=0xff;
delay(15);



P1=0x00;
delay(15);
P1=0x18;
delay(15);
P1=0x3c;
delay(15);
P1=0x7e;
delay(15);
P1=0xff;
delay(15);


P1=0x00;
delay(15);
P1=0x80;
delay(15);
P1=0x40;
delay(15);
P1=0x20;
delay(15);
P1=0x10;
delay(15);
P1=0x08;
delay(15);
P1=0x04;
delay(15);
P1=0x02;
delay(15);
P1=0x01;
delay(15);


P1=0x00;
delay(15);
P1=0x01;
delay(15);
P1=0x02;
delay(15);
P1=0x04;
delay(15);
P1=0x08;
delay(15);
p1=0x10;
delay(15);
P1=0x20;
delay(15);
P1=0x40;
delay(15);
P1=0x80;
delay(15);


P1=0x00;
delay(15);
P1=0x81;
delay(15);
P1=0x42;
delay(15);
P1=0x24;
delay(15);
P1=0x18;
delay(15);


P1=0x00;
delay(15);
P1=0x18;
delay(15);
P1=0x24;
delay(15);
P1=0x42;
delay(15);
P1=0x81;
delay(15);
}
}

Program for LCD interface with 8051

#include<REGX51.H>
#include<stdio.h>
sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
void delay(int a);
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);

void lcdcmd(unsigned char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
delay(2);
en=0;
return;
}

void lcddata(unsigned char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
delay(2);
en=0;
return;
}

void delay(int a)
{
unsigned int i,j;
for(i=0;i<=100;i++)
{
for(j=0;j<=10*a;j++)
{
}}}

void main()
{
P1=0x00;
lcdcmd(0x38);
delay(2);
lcdcmd(0x0E);
delay(2);
lcdcmd(0x01);
delay(2);
lcdcmd(0x06);
delay(2);

while(1)
{
lcdcmd(0x82);
delay(10);
lcddata(‘T’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘C’);
delay(10);
lcddata(‘H’);
delay(10);
lcddata(‘F’);
delay(10);
lcddata(‘O’);
delay(10);
lcddata(‘R’);
delay(10);
lcddata(‘M’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘R’);
delay(10);
lcddata(‘S’);
delay(10);
lcdcmd(0xC2);
delay(10);
lcddata(‘T’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘C’);
delay(10);
lcddata(‘H’);
delay(10);
lcddata(‘N’);
delay(10);
lcddata(‘O’);
delay(10);
lcddata(‘L’);
delay(10);
lcddata(‘O’);
delay(10);
lcddata(‘G’);
delay(10);
lcddata(‘I’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘S’);
delay(10);
}}

Program for Keypad interface with 8051 and Displayed on LCD

#include<8051.h>
#include
#define EN P1_7
#define RW P1_6
#define RS P1_5
#define DL P3
#define c0 P2_0
#define c1 P2_1
#define c2 P2_2
#define c3 P2_3
#define r1 P2_4
#define r2 P2_5
#define r3 P2_6
#define r4 P2_7

void delay(int time);
void lcd_init();
void cmd(char cmdbyte);
void dataa(char ch);
void clear();
void mov_cur(char pos);
void writeat(char ch,char pos);
void enterword();

void delay(int time)
{
int i,j;
for(i=0;i
{
for(j=0;j
{
}
}
}

void cmd(char cmdbyte)
{
EN=1;
RW=0;
RS=0;
DL=cmdbyte;
EN=0;
delay(10);
}

void dataa(char ch)
{
EN=1;
RW=0;
RS=1;
DL=ch;
EN=0;
delay(10);
}

void lcd_init()
{
cmd(0x38);
cmd(0x05);
cmd(0x0F);
cmd(0x06);
}

void clear()
{
cmd(0x01);
}

void mov_cur(char pos)
{
cmd(pos);
}

void keypad()
{
if ((r1==0) && (r2==1) && (r3==1) && (r4==1))
{
if ((c0==0) && (c1==1) && (c2==1) && (c3==1))
{
dataa('a');
}
if ((c0==1) && (c1==0) && (c2==1) && (c3==1))
{
dataa('b');
}
if ((c0==1) && (c1==1) && (c2==0) && (c3==1))
{
dataa('c');
}
if ((c0==1) && (c1==1) && (c2==1) && (c3==0))
{
dataa('d');
}
}
if ((r1==1) && (r2==0) && (r3==1) && (r4==1))
{
if ((c0==0) && (c1==1) && (c2==1) && (c3==1))
{
dataa('e');
}
if ((c0==1) && (c1==0) && (c2==1) && (c3==1))
{
dataa('f');
}
if ((c0==1) && (c1==1) && (c2==0) && (c3==1))
{
dataa('g');
}
if ((c0==1) && (c1==1) && (c2==1) && (c3==0))
{
dataa('h');
}
}
if ((r1==1) && (r2==1) && (r3==0) && (r4==1))
{
if ((c0==0) && (c1==1) && (c2==1) && (c3==1))
{
dataa('i');
}
if ((c0==1) && (c1==0) && (c2==1) && (c3==1))
{
dataa('j');
}
if ((c0==1) && (c1==1) && (c2==0) && (c3==1))
{
dataa('k');
}
if ((c0==1) && (c1==1) && (c2==1) && (c3==0))
{
dataa('l');
}
}
if ((r1==1) && (r2==1) && (r3==1) && (r4==0))
{
if ((c0==0) && (c1==1) && (c2==1) && (c3==1))
{
dataa('m');
}
if ((c0==1) && (c1==0) && (c2==1) && (c3==1))
{
dataa('n');
}
if ((c0==1) && (c1==1) && (c2==0) && (c3==1))
{
dataa('o');
}
if ((c0==1) && (c1==1) && (c2==1) && (c3==0))
{
dataa('p');
}
}
}

void main()
{
P1=0xFF;
P2=0xFF;
P3=0xFF;
lcd_init();
clear();
RW=0;
keypad();
delay(10);
}

Program for ADC interface with 8051

#include<8051.h>
#include
void delay (int time)
{
unsigned int i,j;
for (i=0;i<=time*10;i++)
{
for (j=0;j<=time*10;j++)
{
}
}
}
void adc( )
{
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==0 && P1_1==0 && P1_0==0))
{
P0=0xc0;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==0 && P1_1==0 && P1_0==1))
{
P0=0xf9;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==0 && P1_1==1 && P1_0==0))
{
P0=0xa4;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==0 && P1_1==1 && P1_0==1))
{
P0=0xb0;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==1 && P1_1==0 && P1_0==0))
{
P0=0x99;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==1 && P1_1==0 && P1_0==1))
{
P0=0x92;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==1 && P1_1==1 && P1_0==0))
{
P0=0x82;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==0 && P1_2==1 && P1_1==1 && P1_0==1))
{
P0=0xf8;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==1 && P1_2==0 && P1_1==0 && P1_0==0))
{
P0=0x80;
}
if ((P1_7==0 && P1_6==0 && P1_5==0 && P1_4==0 && P1_3==1 && P1_2==0 && P1_1==0 && P1_0==1))
{
P0=0x90;
}
}
void main( )
{
P0=0xff;
P1=0xff;
delay(10);
while(1)
{
adc( );
delay(10);
}
}

Audio and Video Capturing Robot using RF Communication


In our project keypad is interfaced with RF Transmitter through RF Encoder, so if we press any of the key from forward, backward, right and left, then after pressing any it will generate a signal Which is of 4 bit corresponding to four keys, because firstly we are providing high logic which means 1 and in electronics it means we are providing 5 volt supply to each of the keys, and another pin of keypad is connected is connected to ground so by pressing any key we provide logic 0 means ground. Thus one bit of data has been changed and remaining 3 data remains unchanged, means if we press forward key then we are sending signal 0111 which is of four bit. Now this 4 bit data is converted to 1 bit by RF Encoder (HT12E) which is then transmitted to receiving end via RF Transmitter. Then particular 1 bit data is received at receiving end through RF Receiver, which is then provided to RF Decoder whose work is to decode the data which is being transmitted from transmitter end or through the keypad. Thus 1 bit data is received which is then converted to 4 bit Through RF decoder (HT12D) which is then given to Microcontroller where we programmed our microcontroller, here the 2 motors which are interfaced with microcontroller are moving in either direction through H-Bridge (L293D) which is known as motor driver because this IC is Used to drive 2 dc motors, and another function of this motor driver is to protect our microcontroller from back EMF generated through DC Motor because in this IC Buffer is used which works as feedback diode. Now the motor runs in forward, backward, right and left direction through motors, so by pressing any key the Robot moved in that particular direction. Now for extra features we installed or placed wireless camera over the robot, so the camera captures any audio and video is directly transferred to Television through Camera receiver and TV Tuner. Thus we can easily capture anything through our Project without going anywhere. This wireless robot with camera is very much effective in Warfield zone as we can capture audio and video as well as in night also by attaching Night Vision Camera. There are several Applications of this Robot.

PCB of Basic AVR ckt: -


Schematic Diagram of Basic AVR: -

Schematic Diagram of RF Transmitter: -

PCB Layout of RF Transmitter: -

Schematic Diagram of RF Receiver: -

PCB Layout RF Receiver: -


Program with PPT of this Project can be downloaded through below given link


To download Project report click the link given below


To download the video related to project click the link given below