wanvnuawner
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <REGX5S2.H>
sbit btnON P2*4;
sbit btnOFF P25;
sbit led = P21;
void main(void)
led = 0. //Turn off led at beginning
btnON = 1; //Default, button is High
btnOFF = 1; //Default, button is High
while(1)
{
if(btnON==0) //check if btnON is pressed?
{
led = 1;
while(btnON==@); //wait till stop pressing
}
if(btnOFF==0) //check if btnOFF is pressed?
{
led = 0;
while(btnOFF==) ;
}
//Do some other things here....
WN eveeee