Friday 16 September 2016

GSM Mobile Controlled Home Appliances

GSM Mobile Controlled Home Appliances:


Code:


#pragma config OSC = HS
#pragma config OSCS = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 45
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config DEBUG = OFF
#pragma config STVR = OFF

#define input PORTB

#define b0 PORTC.F0
#define b1 PORTC.F1

#define b2 PORTC.F2
#define b3 PORTC.F3


void main(void)
{

  TRISC= 0x00;
  TRISB= 0xff;

  while(1)
   {


  if(input==0x0e) // 1 pressed
  {
 b0=1;
 b1=0;
 b2=0;
 b3=0;
 input=0;
}
  if(input==0x0d) // 2 pressed
  {
 b0=0;
 b1=0;
 b2=0;
 b3=0;
 input=0;
}
  if(input==0x0c)   // 3 pressed
  {
 b0=0;
 b1=1;
 b2=0;
 b3=0;
 input=0;
}
   if(input==0x0b)  // 4 pressed
  {
 b0=0;
 b1=0;
 b2=0;
 b3=0;
 input=0;
}
   if(input==0x0a) // 5 pressed
  {
 b0=0;
 b1=0;
 b2=1;
 b3=0;
 input=0;
}
  if(input==0x09)   // 6 pressed
  {
 b0=0;
 b1=0;
 b2=0;
 b3=0;
 input=0;
}
  if(input==0x08)   // 7 pressed
  {
 b0=0;
 b1=0;
 b2=0;
 b3=1;
 input=0;
}
  if(input==0x07)   // 8 pressed
  {
 b0=0;
 b1=0;
 b2=0;
 b3=0;
 input=0;
}
   if(input==0x04) // 9 pressed
  {
 b0=1;
 b1=1;
 b2=1;
 b3=1;
 input=0;
}
  if(input==0x03) // * pressed
  {
 b0=0;
 b1=0;
 b2=0;
 b3=0;
 input=0;
}
 }
   }



Circuit Diagram:


 Layout:








0 comments:

Post a Comment

if you have any doubt please let me know