mailus
Full Member level 4
- Joined
- Mar 6, 2012
- Messages
- 234
- Helped
- 7
- Reputation
- 16
- Reaction score
- 7
- Trophy points
- 1,308
- Location
- -
- Activity points
- 2,706
Code:
sbit led1 at rb0_bit;
sbit led2 at rb1_bit;
sbit sw at ra0_bit;
sbit sw2 at ra1_bit;
void main()
{
adcon1=0x07;
cmcon=0x07;
trisa=0xff;
trisb=0x00;
portb=0x00;
do{
if(Button(&porta,0,10,1))
{
led2=1;
led1=1;
delay_ms(10);
}while(sw=~sw);
if(button(&porta,1,10,1))
{
led1=0;
led2=0;
}while(sw2=~sw2);
delay_ms(10);
}while(1);
}
when i use this code output assign function did not work correctly;
it sets the last assigned values only;
for example:
Code:
if(Button(&porta,0,10,1))
{
led2=1;
led1=1;
delay_ms(10);
}while(sw=~sw);
here led2 is missed in this step;
please clarify my problem..............