mashal8050
Newbie level 6
- Joined
- Jun 5, 2012
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,366
hi all members
I am using pic16f877 with 8Mhz clock frequency. I am facing problem in checking the status of an input pin..
My code is
LOGIC
- when RA0 = high then RB0 = 1
-when RA0 = low then it checks if RA1 = high if yes then RB0=0 and RB1=1, if not then RB2=1.
CODE in MikroC
but in proteus nothing happens according to the conditions. Proteus figure is as below:
any help would be highly appreciated.
Regards:grin:
I am using pic16f877 with 8Mhz clock frequency. I am facing problem in checking the status of an input pin..
My code is
LOGIC
- when RA0 = high then RB0 = 1
-when RA0 = low then it checks if RA1 = high if yes then RB0=0 and RB1=1, if not then RB2=1.
CODE in MikroC
Code:
void main()
{
TRISA=0x07;
TRISB=0;
while(1)
{
if(RA0==1)
{
PORTB.F0 = 1;
PORTB.F1 = 0;
PORTB.F2 = 0;
}
else if(RA0==0)
{
if(RA1==1)
{
PORTB.F0 = 0;
PORTB.F1 = 1;
PORTB.F2 = 0;
}
else
{
PORTB.F0 = 0;
PORTB.F1 = 0;
PORTB.F2 = 1;
}
}
}
}
any help would be highly appreciated.
Regards:grin:
Last edited by a moderator: