Naseer Ahmed
Newbie level 5
- Joined
- Feb 19, 2015
- Messages
- 9
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 3
- Location
- Islamabad, Pakistan, Pakistan
- Activity points
- 113
Dear Friends,
I am interested to utilize PIC 18F4550 for a project.
I have written the following code in MikroC compiler to make PORTB.F1 and PORTB.F2 of PIC18F4550 high (1).
The PORTB.F0 has been made input and a 5 V supply has been connected to it through a push button. While it is zero, the controller polls across "while (PORTB.F0 == 0){}" . When I press the push button, it must make PORTB.F1 and PORTB.F2 high but it doesn't. I mean it doesn't sense the push button on PORTB.F0.
Can any one tell me that how is to program other registers associated with PORTB to utilize it just as input and output PORT?
I am interested to utilize this port only for this purpose, not others.
Thanks
I am interested to utilize PIC 18F4550 for a project.
I have written the following code in MikroC compiler to make PORTB.F1 and PORTB.F2 of PIC18F4550 high (1).
Code:
void main()
{
TRISB = 0x01;
PORTB = 0;
while (PORTB.F0 == 0){}
PORTB.F1 = 1;
DELAY_MS(100);
PORTB.F2 = 1;
DELAY_MS(100);
}
The PORTB.F0 has been made input and a 5 V supply has been connected to it through a push button. While it is zero, the controller polls across "while (PORTB.F0 == 0){}" . When I press the push button, it must make PORTB.F1 and PORTB.F2 high but it doesn't. I mean it doesn't sense the push button on PORTB.F0.
Can any one tell me that how is to program other registers associated with PORTB to utilize it just as input and output PORT?
I am interested to utilize this port only for this purpose, not others.
Thanks