Sunday, 26 June 2011

programming for switch


//program to play the buzzer when switch1 is pressed  and off the LED1 when switch 2 is pressed
//Target board s/n 102011
//Manufacturer Technophilia

#include "reg51.h" // header file for 8051 series of microcontroller
void main()
 {
  while(1)
   {
    p03=p32; //Data of the switch1 (0 when pressed 1 when released) is read through p32 and send to p03 where buzzer is connected
p20=p33;    //Data of the switch2 is read through p33 and send to p20 whre LED1 is connected
   }
 }

No comments:

Post a Comment