Thursday, July 5, 2012



source code:-


//----- reading the char or no from the keyboard----//
#include<reg51.h>
sfr ROW=0x80; //assigning PORT-0 to read rows
sfr COL=0xA0; //assigning PORT-2 to read colomns
sfr ldata=0x90; //assigning PORT-1 for LCD data
sbit rs=P3^0;
sbit rw=P3^1;
sbit en=P3^2;
sbit busy=P2^7;
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);
void lcdready(void);
void msdelay(unsigned int itime);
void lcddisplay(unsigned char ch);
  void clear(void);

void main()
{
unsigned char dat[4][4]={'7','8','9','%', // assigning key matrix
                          '4','5','6','*',
  '1','2','3','-',
  'C','0','=','+'};
 unsigned char colloc,rowloc;
 COL=0xFF;
 ROW=0x00;
 rs=0;
 rw=0;
 en=0;
 busy=0;
 /* setting LCD screen*/
 ldata=0x00;
 lcdcmd(0x38);
 lcdcmd(0x0E);
 lcdcmd(0x01);
 lcdcmd(0x06);
 lcdcmd(0x80);
 while(1)
 {
/* reading character from keyboard */
   do
   {
    ROW=0x00;
    colloc=COL;
colloc&=0x0F;
}while(colloc!=0x0F);
do
{
do
{
 msdelay(25);
 colloc=COL;
 colloc&=0x0F;
 }while(colloc==0x0F);
 msdelay(25);
 colloc=COL;
 colloc&=0x0F;
 }while(colloc==0x0F);
    while(1)
{
ROW=0xFE;
colloc=COL;
colloc&=0x0F;
if(colloc!=0x0F)
{
 rowloc=0;
 break;
 }
 ROW=0xFD;
 colloc=COL;
 colloc&=0x0F;
  if(colloc!=0x0F)
  {
   rowloc=1;
break;
}
 ROW=0xFB;
 colloc=COL;
 colloc&=0x0F;
  if(colloc!=0x0F)
  {
   rowloc=2;
break;
}
 ROW=0xF7;
 colloc=COL;
 colloc&=0x0F;
if(colloc!=0x0F)
 {
     rowloc=3;
     break;
   }
  }
   if(colloc==0x0E)
   lcddisplay(dat[rowloc][0]);
   else if(colloc==0x0D)
   lcddisplay(dat[rowloc][1]);
   else if(colloc==0x0B)
   lcddisplay(dat[rowloc][2]);
   else
    lcddisplay(dat[rowloc][3]);
}
  }
  /*displaying char on LCD screen*/
void lcddisplay(unsigned char x)
{
 if(x=='C')
  {
   clear();
    }

 else
 lcddata(x);
   }
 /* sending commands to  LCD display to act in command mode */
void lcdcmd(unsigned char value)
{
 lcdready();
 ldata=value;
 rs=0;
 rw=0;
 en=1;
 msdelay(1);
 en=0;
 }
 /* sending commnad to LCD to display characters*/
void lcddata(unsigned char value)
{
 lcdready();
 ldata=value;
 rs=1;
 rw=0;
 en=1;
 msdelay(20);
 en=0;
 }
 /* checking LCD buffer for free */
void lcdready(void)
{
 busy=1;
 rs=0;
 rw=1;
 if(busy==1)
  {
   en=0;
   msdelay(20);
   en=1;
   }
}
/* generating delay*/
void msdelay(unsigned int value)
{
 unsigned int i,j;
 for(i=0;i<value;i++)
 for(j=0;j<100;j++);
 }
 void clear(void)
 {
  lcdcmd(0x01);
  }






                 This circuit can serve the pumping motor for 5-6sec when the push button was closed. This is a good thing of this circuit. so we can use it for decoration purposes. I made it for pouring milk and water on lord ganapathi head when somebody placed 5Rs/- coin in a money box.

 Working:- It is a Monotable Multivibrator circuit. The components R3 and C3 provides the Triggering to the IC555 timer. The push button is located at the coin entry level. so when somebody placed a coin the coin box it touches the push button. so that it can activate the triggering circuit. C3 and R3 provides the output pulse duration.  

Wednesday, July 4, 2012

video



source code:

 //-----data display in LCD screen-----//
#include<reg51.h>
sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
sbit sw1=P3^0;
sbit sw2=P3^1;
sbit sw3=P3^2;
//sbit sw4=P3^3;
void lcdcmd(unsigned char valude);
void lcddata(unsigned char value);
void delay(unsigned int itime);
void main()
{ unsigned int i;
 unsigned char x[30]={"THATI ANAND ELECTRONICS DEPT."};
 unsigned char x1[30]={" HELLO WORLD  WELCOME ECE"};
  unsigned char x2[30]={"HELLO EINSTEIN HOW ARE YOU SIR"};
  unsigned char c;
 ldata=0x00;
 rs=0;
 rw=0;
 en=0;
 sw1=1;
 sw2=1;
 sw3=1;
 //sw4=1;
while(1)
{
 lcdcmd(0x38);
 delay(25);
 lcdcmd(0x0E);
 delay(25);
 lcdcmd(0x01);
 delay(25);
 lcdcmd(0x06);
 delay(25);
 lcdcmd(0x81);
 delay(25);
 if(sw1==0)
   {
    for(i=0;i<12;i++)
      {
        c=x[i];
        lcddata(c);
         delay(25);
       }
     lcdcmd(0x0C0);
      delay(25);
     for(i=12;i<30;i++)
      {
       c=x[i];
    lcddata(c);
    delay(25);
    }
   }
if(sw2==0)
    {
for(i=0;i<12;i++)
     {
      c=x1[i];
      lcddata(c);
       delay(25);
     }
    lcdcmd(0x0C0);
    delay(25);
    for(i=12;i<30;i++)
      {
       c=x1[i];
       lcddata(c);
       delay(25);
    }
}
if(sw3==0)
   {
    for(i=0;i<15;i++)
      {
        c=x2[i];
        lcddata(c);
         delay(25);
       }
     lcdcmd(0x0C0);
      delay(25);
     for(i=15;i<30;i++)
      {
       c=x2[i];
    lcddata(c);
    delay(25);
    }
   }

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


Here ADC0848 is replaced with push buttons at port-2.

Saturday, June 30, 2012

http://www.codeforge.com/s/0/SPI-Flash-Programmer-3.7

Free open source codes available here
http://www.careerairforce.nic.in/
Indian Air Force recruiting for the posts technical and ground duty candidates.
Last Date 09-July-2012 

Motion detection movable Robot with AT89C51

  The motion dependent applications are becoming  more popular in the present days for example  a door can open when there is a human movement in the sensor region. Likewise it can be used as person detection robot. This the prototype of that kind. Here we use simple circuit to detect the human is dead or alive. It is more important to identify and rescue the live persons when natural disaster situations.
This circuit is designed with AT89C51 microcontroller which is a basic microcontroller. Here we use PIR(Passive Infrared ) sensor to detect the motion. The robot can move in all directions. It is a wireless RF controlled robot.

Txr PART:-
          The transmitter part is shown in fig.1 it designed with HT12E Encoder and 4 push buttons. Whenever the user presses the buttons it generates 12-bit data which contains 8-bit address can set and 4 data bits. These data is transmitted to the robot by the RF transmitter which is running at 433MHz frequency. For each button pressed it generates a different code. The entire Transmitter circuit requires 5v DC supply.

Rxr PART:-

          This  contains the RF receiver and its output to the decoder. The decoder here we should use the HT12D to decode the received data. The output of the decoder is 4-bit data which is generated at the transmitter level when the  switch pressed. For motor operations we required to write the C code. Detection of  human is manual control. The commands can be passed to the robot whenever we want switch the detection. Here I used forward and backward buttons to control the detection operation. For this we need to stop the robot at doubted place and press the forward and backward buttons at a time. If the PIR detects motion then the controller sends  high input to the  buzzer to indicate that the person is alive. To smoothen the motor operations and currents we use L293D IC. These 60 RPM DC motors requires a voltage of 12V and it can be provided by lead acid battery.

          Assemble the circuit on a general purpose PCB. And arrange it on robotic structured cabinet. This was practically implemented and tested.  


                                                     Fig.1  Receiver part


Fig.2 Transmitter part

This circuit can detect motion with the help of PIR sensor, it is a simple and well working circuit. It was tested practically.

The source code is:

#include<reg51.h>
sfr rfr=0x90;
sfr mtr=0xB0;
sbit pir=P2^0;
sbit buz=P2^3;
void detection(void);
void main()
{
 rfr=0xFF;
 buz=0;
 while(1)
  {
   if(rfr==0x0E)
    {
  mtr=0x05;
  }
 else if(rfr==0x0D)
  {
   mtr=0x0A;
   }
 else if(rfr==0x0B)
  {
   mtr=0x02;
   }
 else if(rfr==0x07)
   {
    mtr=0x08;
    }
 else if(rfr==0x0C)
   {
   detection();
  }
   else if(rfr==0x0F)
    {

  mtr=0x00;
  buz=0;
   }
  else
      mtr=0x00;
   buz=0;
 }
 }
 void detection()
 {
 unsigned int i;
   mtr=0x00;
    if(pir==1)
     {
     buz=1;
     for(i=0;i<200;i++);   
      }
    else
       buz=0;
}