Tuesday 5 March 2013

IR program to find the obstacles in 8051


//IR program to find the obstacles

#include<reg51.h>
#include"lcd.h"

sbit sw=P3^2;
bit flag;

void isr(void) interrupt 0
{

      flag=1;

}                      

main()
{

      EA=EX0=1;
      init_lcd();
      cmd_lcd(0x01);
      while(1)
      {
        if(flag==1)
        {
       
                      flag=0;
                      cmd_lcd(0x80);
                      str_lcd("Abstacle Detected");
                      P0=0x55;
                      delay_ms(300);
        }           

                      P0=0x00;

      }



}

No comments:

Post a Comment