Tuesday 5 March 2013

program for monitoring the switch. if switch is pressed then increment the count in 8051

/* program for monitoring the switch. if switch is pressed then increment the count*/
#include<reg51.h>
sbit sw=P1^2;                                       
main()
{
 unsigned char count=0;

while(1)
 {
    if(sw==0)
      {
     sw=1;
     count=count+1;
     P0=count;
     }
    }
 
       
 }

No comments:

Post a Comment